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

(rtld-subdir-make): Use it.
This commit is contained in:
Roland McGrath 2006-02-28 09:57:07 +00:00
parent 8d2e6a0383
commit a5f2bd861c
13 changed files with 351 additions and 8 deletions

View File

@ -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

View File

@ -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
@ -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

View File

@ -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 \

View File

@ -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 {

View File

@ -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. */

View File

@ -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;
}

View File

@ -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.
@ -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);
@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -71,6 +71,17 @@ enum
#endif
#ifdef __USE_UNIX98
/* Mutex protocols. */
enum
{
PTHREAD_PRIO_NONE,
PTHREAD_PRIO_INHERIT,
PTHREAD_PRIO_PROTECT
};
#endif
/* Mutex initializers. */
#if __WORDSIZE == 64
# define PTHREAD_MUTEX_INITIALIZER \
@ -711,6 +722,22 @@ extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW;
#ifdef __USE_UNIX98
/* Get the priority ceiling of MUTEX. */
extern int pthread_mutex_getprioceiling (__const pthread_mutex_t *
__restrict __mutex,
int *__restrict __prioceiling)
__THROW;
/* Set the priority ceiling of MUTEX to PRIOCEILING, return old
priority ceiling value in *OLD_CEILING. */
extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
int __prioceiling,
int *__restrict __old_ceiling)
__THROW;
#endif
#ifdef __USE_GNU
/* Declare the state protected by MUTEX as consistent. */
extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) __THROW;
@ -745,6 +772,26 @@ extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict
PTHREAD_MUTEX_DEFAULT). */
extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
__THROW;
/* Return in *PROTOCOL the mutex protocol attribute in *ATTR. */
extern int pthread_mutexattr_getprotocol (__const pthread_mutexattr_t *
__restrict __attr,
int *__restrict __protocol) __THROW;
/* Set the mutex protocol attribute in *ATTR to PROTOCOL (either
PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or PTHREAD_PRIO_PROTECT). */
extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
int __protocol) __THROW;
/* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */
extern int pthread_mutexattr_getprioceiling (__const pthread_mutexattr_t *
__restrict __attr,
int *__restrict __prioceiling)
__THROW;
/* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */
extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
int __prioceiling) __THROW;
#endif
#ifdef __USE_GNU