Skip to content

Commit

Permalink
* elf/rtld-Rules (subdir-args): New variable.
Browse files Browse the repository at this point in the history
	(rtld-subdir-make): Use it.
  • Loading branch information
Roland McGrath committed Feb 28, 2006
1 parent 8d2e6a0 commit a5f2bd8
Show file tree
Hide file tree
Showing 13 changed files with 351 additions and 8 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2006-02-28 Roland McGrath <roland@redhat.com>

* elf/rtld-Rules (subdir-args): New variable.
(rtld-subdir-make): Use it.

2006-02-22 Martin Schwidefsky <schwidefsky@de.ibm.com>

* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
Expand Down
10 changes: 8 additions & 2 deletions elf/rtld-Rules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Subroutine makefile for compiling libc modules linked into dynamic linker.

# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -72,10 +72,16 @@ include $(patsubst %,../o-iterator.mk,$(object-suffixes-left))

# This is how we descend into each subdirectory. See below.
define rtld-subdir-make
$(MAKE) -C ../$* objdir=$(objdir) -f Makefile -f ../elf/rtld-Rules rtld-all \
$(MAKE) $(subdir-args) objdir=$(objdir) \
-f Makefile -f ../elf/rtld-Rules rtld-all \
rtld-modules='$(addprefix rtld-,$(rtld-$*))'
endef

# See subdir-target-args in ../Makefile for the model.
subdir-args = subdir=$*$(if $($*-srcdir),\
-C $($*-srcdir) ..=`pwd`/,\
-C $(..)$* ..=../)

FORCE:

else
Expand Down
7 changes: 6 additions & 1 deletion nptl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ libpthread-routines = init vars events version \
pthread_attr_getaffinity pthread_attr_setaffinity \
pthread_mutexattr_getrobust pthread_mutexattr_setrobust \
pthread_mutex_consistent \
cleanup_routine unwind-forcedunwind
cleanup_routine unwind-forcedunwind \
pthread_mutexattr_getprotocol \
pthread_mutexattr_setprotocol \
pthread_mutexattr_getprioceiling \
pthread_mutexattr_setprioceiling \
pthread_mutex_getprioceiling pthread_mutex_setprioceiling
# pthread_setuid pthread_seteuid pthread_setreuid \
# pthread_setresuid \
# pthread_setgid pthread_setegid pthread_setregid \
Expand Down
3 changes: 3 additions & 0 deletions nptl/Versions
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ libpthread {
GLIBC_2.4 {
pthread_mutexattr_getrobust_np; pthread_mutexattr_setrobust_np;
pthread_mutex_consistent_np;
pthread_mutexattr_getprotocol; pthread_mutexattr_setprotocol;
pthread_mutexattr_getprioceiling; pthread_mutexattr_setprioceiling;
pthread_mutex_getprioceiling; pthread_mutex_setprioceiling;
};

GLIBC_PRIVATE {
Expand Down
17 changes: 13 additions & 4 deletions nptl/pthreadP.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,24 @@ enum
PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP
= PTHREAD_MUTEX_ROBUST_PRIVATE_NP | PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP
= PTHREAD_MUTEX_ROBUST_PRIVATE_NP | PTHREAD_MUTEX_ADAPTIVE_NP
= PTHREAD_MUTEX_ROBUST_PRIVATE_NP | PTHREAD_MUTEX_ADAPTIVE_NP,
PTHREAD_MUTEX_PRIO_INHERIT_PRIVATE_NP = 32,
PTHREAD_MUTEX_PRIO_PROTECT_PRIVATE_NP = 64
};
#define PTHREAD_MUTEX_PRIO_CEILING_SHIFT 16
#define PTHREAD_MUTEX_PRIO_CEILING_MASK 0x00ff0000


/* Flags in mutex attr. */
#define PTHREAD_MUTEXATTR_FLAG_ROBUST 0x40000000
#define PTHREAD_MUTEXATTR_FLAG_PSHARED 0x80000000
#define PTHREAD_MUTEXATTR_PROTOCOL_SHIFT 28
#define PTHREAD_MUTEXATTR_PROTOCOL_MASK 0x30000000
#define PTHREAD_MUTEXATTR_PRIO_CEILING_SHIFT 16
#define PTHREAD_MUTEXATTR_PRIO_CEILING_MASK 0x00ff0000
#define PTHREAD_MUTEXATTR_FLAG_ROBUST 0x40000000
#define PTHREAD_MUTEXATTR_FLAG_PSHARED 0x80000000
#define PTHREAD_MUTEXATTR_FLAG_BITS \
(PTHREAD_MUTEXATTR_FLAG_ROBUST | PTHREAD_MUTEXATTR_FLAG_PSHARED)
(PTHREAD_MUTEXATTR_FLAG_ROBUST | PTHREAD_MUTEXATTR_FLAG_PSHARED \
| PTHREAD_MUTEXATTR_PROTOCOL_MASK | PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)


/* Bits used in robust mutex implementation. */
Expand Down
33 changes: 33 additions & 0 deletions nptl/pthread_mutex_getprioceiling.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* Get current priority ceiling of pthread_mutex_t.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <pthreadP.h>


int
pthread_mutex_getprioceiling (mutex, prioceiling)
const pthread_mutex_t *mutex;
int *prioceiling;
{
*prioceiling = (mutex->__data.__kind & PTHREAD_MUTEX_PRIO_CEILING_MASK)
>> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;

return 0;
}
28 changes: 27 additions & 1 deletion nptl/pthread_mutex_init.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
Expand Down Expand Up @@ -46,6 +46,11 @@ __pthread_mutex_init (mutex, mutexattr)
if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0
&& (imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_PSHARED) != 0)
return ENOTSUP;
// XXX For now we don't support priority inherited or priority protected
// XXX mutexes.
if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK)
!= (PTHREAD_PRIO_NONE << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT))
return ENOTSUP;

/* Clear the whole variable. */
memset (mutex, '\0', __SIZEOF_PTHREAD_MUTEX_T);
Expand All @@ -54,6 +59,27 @@ __pthread_mutex_init (mutex, mutexattr)
mutex->__data.__kind = imutexattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0)
mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_PRIVATE_NP;
switch ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK)
>> PTHREAD_MUTEXATTR_PROTOCOL_SHIFT)
{
case PTHREAD_PRIO_INHERIT:
mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_INHERIT_PRIVATE_NP;
break;
case PTHREAD_PRIO_PROTECT:
mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_PROTECT_PRIVATE_NP;
if (PTHREAD_MUTEX_PRIO_CEILING_MASK
== PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)
mutex->__data.__kind |= (imutexattr->mutexkind
& PTHREAD_MUTEXATTR_PRIO_CEILING_MASK);
else
mutex->__data.__kind |= ((imutexattr->mutexkind
& PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)
>> PTHREAD_MUTEXATTR_PRIO_CEILING_SHIFT)
<< PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
break;
default:
break;
}

/* Default values: mutex not used yet. */
// mutex->__count = 0; already done by memset
Expand Down
55 changes: 55 additions & 0 deletions nptl/pthread_mutex_setprioceiling.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* Set current priority ceiling of pthread_mutex_t.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <errno.h>
#include <pthreadP.h>


int
pthread_mutex_setprioceiling (mutex, prioceiling, old_ceiling)
pthread_mutex_t *mutex;
int prioceiling;
int *old_ceiling;
{
/* The low bits of __kind aren't ever changed after pthread_mutex_init,
so we don't need a lock yet. */
if ((mutex->__data.__kind & PTHREAD_MUTEX_PRIO_PROTECT_PRIVATE_NP) == 0)
return EINVAL;

if (prioceiling < 0 || __builtin_expect (prioceiling > 255, 0))
return EINVAL;

/* XXX This needs to lock with TID, but shouldn't obey priority protect
protocol. */
/* lll_xxx_mutex_lock (mutex->__data.__lock); */

if (old_ceiling != NULL)
*old_ceiling = (mutex->__data.__kind & PTHREAD_MUTEX_PRIO_CEILING_MASK)
>> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;

int newkind = (mutex->__data.__kind & ~PTHREAD_MUTEX_PRIO_CEILING_MASK);
mutex->__data.__kind = newkind
| (prioceiling << PTHREAD_MUTEX_PRIO_CEILING_SHIFT);

/* XXX This needs to unlock the above special kind of lock. */
/* lll_xxx_mutex_unlock (mutex->__data.__lock); */

return 0;
}
37 changes: 37 additions & 0 deletions nptl/pthread_mutexattr_getprioceiling.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* Get priority ceiling setting from pthread_mutexattr_t.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <pthreadP.h>


int
pthread_mutexattr_getprioceiling (attr, prioceiling)
const pthread_mutexattr_t *attr;
int *prioceiling;
{
const struct pthread_mutexattr *iattr;

iattr = (const struct pthread_mutexattr *) attr;

*prioceiling = ((iattr->mutexkind & PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)
>> PTHREAD_MUTEXATTR_PRIO_CEILING_SHIFT);

return 0;
}
37 changes: 37 additions & 0 deletions nptl/pthread_mutexattr_getprotocol.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* Get priority protocol setting from pthread_mutexattr_t.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <pthreadP.h>


int
pthread_mutexattr_getprotocol (attr, protocol)
const pthread_mutexattr_t *attr;
int *protocol;
{
const struct pthread_mutexattr *iattr;

iattr = (const struct pthread_mutexattr *) attr;

*protocol = ((iattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK)
>> PTHREAD_MUTEXATTR_PROTOCOL_SHIFT);

return 0;
}
39 changes: 39 additions & 0 deletions nptl/pthread_mutexattr_setprioceiling.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* Change priority ceiling setting in pthread_mutexattr_t.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <errno.h>
#include <pthreadP.h>


int
pthread_mutexattr_setprioceiling (attr, prioceiling)
pthread_mutexattr_t *attr;
int prioceiling;
{
if (prioceiling < 0 || __builtin_expect (prioceiling > 255, 0))
return EINVAL;

struct pthread_mutexattr *iattr = (struct pthread_mutexattr *) attr;

iattr->mutexkind = ((iattr->mutexkind & ~PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)
| (prioceiling << PTHREAD_MUTEXATTR_PRIO_CEILING_SHIFT));

return 0;
}
41 changes: 41 additions & 0 deletions nptl/pthread_mutexattr_setprotocol.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Change priority protocol setting in pthread_mutexattr_t.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <errno.h>
#include <pthreadP.h>


int
pthread_mutexattr_setprotocol (attr, protocol)
pthread_mutexattr_t *attr;
int protocol;
{
if (protocol != PTHREAD_PRIO_NONE
&& protocol != PTHREAD_PRIO_INHERIT
&& __builtin_expect (protocol != PTHREAD_PRIO_PROTECT, 0))
return EINVAL;

struct pthread_mutexattr *iattr = (struct pthread_mutexattr *) attr;

iattr->mutexkind = ((iattr->mutexkind & ~PTHREAD_MUTEXATTR_PROTOCOL_MASK)
| (protocol << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT));

return 0;
}
Loading

0 comments on commit a5f2bd8

Please sign in to comment.