about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/confname.h194
-rw-r--r--sysdeps/generic/resourcebits.h12
-rw-r--r--sysdeps/libm-ieee754/k_standard.c84
-rw-r--r--sysdeps/mach/hurd/closedir.c5
-rw-r--r--sysdeps/mach/hurd/getrlimit.c7
-rw-r--r--sysdeps/mach/hurd/opendir.c4
-rw-r--r--sysdeps/mach/hurd/readdir.c4
-rw-r--r--sysdeps/posix/getcwd.c12
-rw-r--r--sysdeps/posix/getdtsz.c16
-rw-r--r--sysdeps/posix/sigsetmask.c17
-rw-r--r--sysdeps/posix/sysconf.c117
-rw-r--r--sysdeps/posix/ttyname_r.c3
-rw-r--r--sysdeps/stub/closedir.c9
-rw-r--r--sysdeps/stub/getrlimit.c8
-rw-r--r--sysdeps/stub/opendir.c9
-rw-r--r--sysdeps/stub/readdir.c9
-rw-r--r--sysdeps/stub/sysconf.c17
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/resourcebits.h10
-rw-r--r--sysdeps/unix/closedir.c9
-rw-r--r--sysdeps/unix/getlogin.c11
-rw-r--r--sysdeps/unix/opendir.c5
-rw-r--r--sysdeps/unix/readdir.c3
-rw-r--r--sysdeps/unix/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/resourcebits.h63
-rw-r--r--sysdeps/unix/sysv/linux/i386/resourcebits.h63
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c45
-rw-r--r--sysdeps/unix/sysv/linux/m68k/resourcebits.h (renamed from sysdeps/unix/sysv/linux/resourcebits.h)14
-rw-r--r--sysdeps/unix/sysv/linux/mips/resourcebits.h65
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c37
-rw-r--r--sysdeps/unix/sysv/sysv4/getdtsz.c2
30 files changed, 614 insertions, 244 deletions
diff --git a/sysdeps/generic/confname.h b/sysdeps/generic/confname.h
index fb2679fb45..d0968a1ba5 100644
--- a/sysdeps/generic/confname.h
+++ b/sysdeps/generic/confname.h
@@ -21,175 +21,209 @@ Cambridge, MA 02139, USA.  */
 enum
   {
     _PC_LINK_MAX,
-#define	_PC_LINK_MAX		_PC_LINK_MAX
+#define	_PC_LINK_MAX			_PC_LINK_MAX
     _PC_MAX_CANON,
-#define	_PC_MAX_CANON		_PC_MAX_CANON
+#define	_PC_MAX_CANON			_PC_MAX_CANON
     _PC_MAX_INPUT,
-#define	_PC_MAX_INPUT		_PC_MAX_INPUT
+#define	_PC_MAX_INPUT			_PC_MAX_INPUT
     _PC_NAME_MAX,
-#define	_PC_NAME_MAX		_PC_NAME_MAX
+#define	_PC_NAME_MAX			_PC_NAME_MAX
     _PC_PATH_MAX,
-#define	_PC_PATH_MAX		_PC_PATH_MAX
+#define	_PC_PATH_MAX			_PC_PATH_MAX
     _PC_PIPE_BUF,
-#define	_PC_PIPE_BUF		_PC_PIPE_BUF
+#define	_PC_PIPE_BUF			_PC_PIPE_BUF
     _PC_CHOWN_RESTRICTED,
-#define	_PC_CHOWN_RESTRICTED	_PC_CHOWN_RESTRICTED
+#define	_PC_CHOWN_RESTRICTED		_PC_CHOWN_RESTRICTED
     _PC_NO_TRUNC,
-#define	_PC_NO_TRUNC		_PC_NO_TRUNC
+#define	_PC_NO_TRUNC			_PC_NO_TRUNC
     _PC_VDISABLE,
     _PC_SYNC_IO,
-#define	_PC_SYNC_IO		_PC_SYNC_IO
+#define	_PC_SYNC_IO			_PC_SYNC_IO
     _PC_ASYNC_IO,
-#define	_PC_ASYNC_IO		_PC_ASYNC_IO
+#define	_PC_ASYNC_IO			_PC_ASYNC_IO
     _PC_PRIO_IO,
-#define	_PC_PRIO_IO		_PC_PRIO_IO
+#define	_PC_PRIO_IO			_PC_PRIO_IO
     _PC_SOCK_MAXBUF
-#define	_PC_SOCK_MAXBUF		_PC_SOCK_MAXBUF
+#define	_PC_SOCK_MAXBUF			_PC_SOCK_MAXBUF
   };
 
 /* Values for the argument to `sysconf'.  */
 enum
   {
     _SC_ARG_MAX,
-#define	_SC_ARG_MAX		_SC_ARG_MAX
+#define	_SC_ARG_MAX			_SC_ARG_MAX
     _SC_CHILD_MAX,
-#define	_SC_CHILD_MAX		_SC_CHILD_MAX
+#define	_SC_CHILD_MAX			_SC_CHILD_MAX
     _SC_CLK_TCK,
-#define	_SC_CLK_TCK		_SC_CLK_TCK
+#define	_SC_CLK_TCK			_SC_CLK_TCK
     _SC_NGROUPS_MAX,
-#define	_SC_NGROUPS_MAX		_SC_NGROUPS_MAX
+#define	_SC_NGROUPS_MAX			_SC_NGROUPS_MAX
     _SC_OPEN_MAX,
-#define	_SC_OPEN_MAX		_SC_OPEN_MAX
+#define	_SC_OPEN_MAX			_SC_OPEN_MAX
     _SC_STREAM_MAX,
-#define	_SC_STREAM_MAX		_SC_STREAM_MAX
+#define	_SC_STREAM_MAX			_SC_STREAM_MAX
     _SC_TZNAME_MAX,
-#define	_SC_TZNAME_MAX		_SC_TZNAME_MAX
+#define	_SC_TZNAME_MAX			_SC_TZNAME_MAX
     _SC_JOB_CONTROL,
-#define	_SC_JOB_CONTROL		_SC_JOB_CONTROL
+#define	_SC_JOB_CONTROL			_SC_JOB_CONTROL
     _SC_SAVED_IDS,
-#define	_SC_SAVED_IDS		_SC_SAVED_IDS
+#define	_SC_SAVED_IDS			_SC_SAVED_IDS
     _SC_REALTIME_SIGNALS,
-#define	_SC_REALTIME_SIGNALS	_SC_REALTIME_SIGNALS
+#define	_SC_REALTIME_SIGNALS		_SC_REALTIME_SIGNALS
     _SC_PRIORITY_SCHEDULING,
-#define	_SC_PRIORITY_SCHEDULING	_SC_PRIORITY_SCHEDULING
+#define	_SC_PRIORITY_SCHEDULING		_SC_PRIORITY_SCHEDULING
     _SC_TIMERS,
-#define	_SC_TIMERS		_SC_TIMERS
+#define	_SC_TIMERS			_SC_TIMERS
     _SC_ASYNCHRONOUS_IO,
-#define	_SC_ASYNCHRONOUS_IO	_SC_ASYNCHRONOUS_IO
+#define	_SC_ASYNCHRONOUS_IO		_SC_ASYNCHRONOUS_IO
     _SC_PRIORITIZED_IO,
-#define	_SC_PRIORITIZED_IO	_SC_PRIORITIZED_IO
+#define	_SC_PRIORITIZED_IO		_SC_PRIORITIZED_IO
     _SC_SYNCHRONIZED_IO,
-#define	_SC_SYNCHRONIZED_IO	_SC_SYNCHRONIZED_IO
+#define	_SC_SYNCHRONIZED_IO		_SC_SYNCHRONIZED_IO
     _SC_FSYNC,
-#define	_SC_FSYNC		_SC_FSYNC
+#define	_SC_FSYNC			_SC_FSYNC
     _SC_MAPPED_FILES,
-#define	_SC_MAPPED_FILES	_SC_MAPPED_FILES
+#define	_SC_MAPPED_FILES		_SC_MAPPED_FILES
     _SC_MEMLOCK,
-#define	_SC_MEMLOCK		_SC_MEMLOCK
+#define	_SC_MEMLOCK			_SC_MEMLOCK
     _SC_MEMLOCK_RANGE,
-#define	_SC_MEMLOCK_RANGE	_SC_MEMLOCK_RANGE
+#define	_SC_MEMLOCK_RANGE		_SC_MEMLOCK_RANGE
     _SC_MEMORY_PROTECTION,
-#define	_SC_MEMORY_PROTECTION	_SC_MEMORY_PROTECTION
+#define	_SC_MEMORY_PROTECTION		_SC_MEMORY_PROTECTION
     _SC_MESSAGE_PASSING,
-#define	_SC_MESSAGE_PASSING	_SC_MESSAGE_PASSING
+#define	_SC_MESSAGE_PASSING		_SC_MESSAGE_PASSING
     _SC_SEMAPHORES,
-#define	_SC_SEMAPHORES		_SC_SEMAPHORES
+#define	_SC_SEMAPHORES			_SC_SEMAPHORES
     _SC_SHARED_MEMORY_OBJECTS,
 #define	_SC_SHARED_MEMORY_OBJECTS	_SC_SHARED_MEMORY_OBJECTS
     _SC_AIO_LISTIO_MAX,
-#define	_SC_AIO_LIST_MAX	_SC_AIO_LIST_MAX
+#define	_SC_AIO_LIST_MAX		_SC_AIO_LIST_MAX
     _SC_AIO_MAX,
-#define	_SC_AIO_MAX		_SC_AIO_MAX
+#define	_SC_AIO_MAX			_SC_AIO_MAX
     _SC_AIO_PRIO_DELTA_MAX,
-#define	_SC_AIO_PRIO_DELTA_MAX	_SC_AIO_PRIO_DELTA_MAX
+#define	_SC_AIO_PRIO_DELTA_MAX		_SC_AIO_PRIO_DELTA_MAX
     _SC_DELAYTIMER_MAX,
-#define	_SC_DELAYTIMER_MAX	_SC_DELAYTIMER_MAX
+#define	_SC_DELAYTIMER_MAX		_SC_DELAYTIMER_MAX
     _SC_MQ_OPEN_MAX,
-#define	_SC_MQ_OPEN_MAX		_SC_MQ_OPEN_MAX
+#define	_SC_MQ_OPEN_MAX			_SC_MQ_OPEN_MAX
     _SC_MQ_PRIO_MAX,
-#define	_SC_MQ_PRIO_MAX		_SC_MQ_PRIO_MAX
+#define	_SC_MQ_PRIO_MAX			_SC_MQ_PRIO_MAX
     _SC_VERSION,
-#define	_SC_VERSION		_SC_VERSION
+#define	_SC_VERSION			_SC_VERSION
     _SC_PAGESIZE,
-#define	_SC_PAGESIZE		_SC_PAGESIZE
-#define	_SC_PAGE_SIZE		_SC_PAGESIZE
+#define	_SC_PAGESIZE			_SC_PAGESIZE
+#define	_SC_PAGE_SIZE			_SC_PAGESIZE
     _SC_RTSIG_MAX,
-#define	_SC_RTSIG_MAX		_SC_RTSIG_MAX
+#define	_SC_RTSIG_MAX			_SC_RTSIG_MAX
     _SC_SEM_NSEMS_MAX,
-#define	_SC_SEM_NSEMS_MAX	_SC_SEM_NSEMS_MAX
+#define	_SC_SEM_NSEMS_MAX		_SC_SEM_NSEMS_MAX
     _SC_SEM_VALUE_MAX,
-#define	_SC_SEM_VALUE_MAX	_SC_SEM_VALUE_MAX
+#define	_SC_SEM_VALUE_MAX		_SC_SEM_VALUE_MAX
     _SC_SIGQUEUE_MAX,
-#define	_SC_SIGQUEUE_MAX	_SC_SIGQUEUE_MAX
+#define	_SC_SIGQUEUE_MAX		_SC_SIGQUEUE_MAX
     _SC_TIMER_MAX,
-#define	_SC_TIMER_MAX		_SC_TIMER_MAX
+#define	_SC_TIMER_MAX			_SC_TIMER_MAX
 
     /* Values for the argument to `sysconf'
        corresponding to _POSIX2_* symbols.  */
     _SC_BC_BASE_MAX,
-#define	_SC_BC_BASE_MAX		_SC_BC_BASE_MAX
+#define	_SC_BC_BASE_MAX			_SC_BC_BASE_MAX
     _SC_BC_DIM_MAX,
-#define	_SC_BC_DIM_MAX		_SC_BC_DIM_MAX
+#define	_SC_BC_DIM_MAX			_SC_BC_DIM_MAX
     _SC_BC_SCALE_MAX,
-#define	_SC_BC_SCALE_MAX	_SC_BC_SCALE_MAX
+#define	_SC_BC_SCALE_MAX		_SC_BC_SCALE_MAX
     _SC_BC_STRING_MAX,
-#define	_SC_BC_STRING_MAX	_SC_BC_STRING_MAX
+#define	_SC_BC_STRING_MAX		_SC_BC_STRING_MAX
     _SC_COLL_WEIGHTS_MAX,
-#define	_SC_COLL_WEIGHTS_MAX	_SC_COLL_WEIGHTS_MAX
+#define	_SC_COLL_WEIGHTS_MAX		_SC_COLL_WEIGHTS_MAX
     _SC_EQUIV_CLASS_MAX,
-#define	_SC_EQUIV_CLASS_MAX	_SC_EQUIV_CLASS_MAX
+#define	_SC_EQUIV_CLASS_MAX		_SC_EQUIV_CLASS_MAX
     _SC_EXPR_NEST_MAX,
-#define	_SC_EXPR_NEST_MAX	_SC_EXPR_NEST_MAX
+#define	_SC_EXPR_NEST_MAX		_SC_EXPR_NEST_MAX
     _SC_LINE_MAX,
-#define	_SC_LINE_MAX		_SC_LINE_MAX
+#define	_SC_LINE_MAX			_SC_LINE_MAX
     _SC_RE_DUP_MAX,
-#define	_SC_RE_DUP_MAX		_SC_RE_DUP_MAX
+#define	_SC_RE_DUP_MAX			_SC_RE_DUP_MAX
     _SC_CHARCLASS_NAME_MAX,
-#define	_SC_CHARCLASS_NAME_MAX	_SC_CHARCLASS_NAME_MAX
+#define	_SC_CHARCLASS_NAME_MAX		_SC_CHARCLASS_NAME_MAX
 
     _SC_2_VERSION,
-#define	_SC_2_VERSION		_SC_2_VERSION
+#define	_SC_2_VERSION			_SC_2_VERSION
     _SC_2_C_BIND,
-#define	_SC_2_C_BIND		_SC_2_C_BIND
+#define	_SC_2_C_BIND			_SC_2_C_BIND
     _SC_2_C_DEV,
-#define	_SC_2_C_DEV		_SC_2_C_DEV
+#define	_SC_2_C_DEV			_SC_2_C_DEV
     _SC_2_FORT_DEV,
-#define	_SC_2_FORT_DEV		_SC_2_FORT_DEV
+#define	_SC_2_FORT_DEV			_SC_2_FORT_DEV
     _SC_2_FORT_RUN,
-#define	_SC_2_FORT_RUN		_SC_2_FORT_RUN
+#define	_SC_2_FORT_RUN			_SC_2_FORT_RUN
     _SC_2_SW_DEV,
-#define	_SC_2_SW_DEV		_SC_2_SW_DEV
+#define	_SC_2_SW_DEV			_SC_2_SW_DEV
     _SC_2_LOCALEDEF,
-#define	_SC_2_LOCALEDEF		_SC_2_LOCALEDEF
+#define	_SC_2_LOCALEDEF			_SC_2_LOCALEDEF
 
     _SC_PII,
-#define	_SC_PII			_SC_PII
+#define	_SC_PII				_SC_PII
     _SC_PII_XTI,
-#define	_SC_PII_XTI		_SC_PII_XTI
+#define	_SC_PII_XTI			_SC_PII_XTI
     _SC_PII_SOCKET,
-#define	_SC_PII_SOCKET		_SC_PII_SOCKET
+#define	_SC_PII_SOCKET			_SC_PII_SOCKET
     _SC_PII_INTERNET,
-#define	_SC_PII_INTERNET	_SC_PII_INTERNET
+#define	_SC_PII_INTERNET		_SC_PII_INTERNET
     _SC_PII_OSI,
-#define	_SC_PII_OSI		_SC_PII_OSI
+#define	_SC_PII_OSI			_SC_PII_OSI
     _SC_POLL,
-#define	_SC_POLL		_SC_POLL
+#define	_SC_POLL			_SC_POLL
     _SC_SELECT,
-#define	_SC_SELECT		_SC_SELECT
+#define	_SC_SELECT			_SC_SELECT
     _SC_UIO_MAXIOV,
-#define	_SC_UIO_MAXIOV		_SC_UIO_MAXIOV
+#define	_SC_UIO_MAXIOV			_SC_UIO_MAXIOV
     _SC_PII_INTERNET_STREAM,
-#define	_SC_PII_INTERNET_STREAM	_SC_PII_INTERNET_STREAM
+#define	_SC_PII_INTERNET_STREAM		_SC_PII_INTERNET_STREAM
     _SC_PII_INTERNET_DGRAM,
-#define	_SC_PII_INTERNET_DGRAM	_SC_PII_INTERNET_DGRAM
+#define	_SC_PII_INTERNET_DGRAM		_SC_PII_INTERNET_DGRAM
     _SC_PII_OSI_COTS,
-#define	_SC_PII_OSI_COTS	_SC_PII_OSI_COTS
+#define	_SC_PII_OSI_COTS		_SC_PII_OSI_COTS
     _SC_PII_OSI_CLTS,
-#define	_SC_PII_OSI_CLTS	_SC_PII_OSI_CLTS
+#define	_SC_PII_OSI_CLTS		_SC_PII_OSI_CLTS
     _SC_PII_OSI_M,
-#define	_SC_PII_OSI_M		_SC_PII_OSI_M
-    _SC_T_IOV_MAX
-#define	_SC_T_IOV_MAX		_SC_T_IOV_MAX
+#define	_SC_PII_OSI_M			_SC_PII_OSI_M
+    _SC_T_IOV_MAX,
+#define	_SC_T_IOV_MAX			_SC_T_IOV_MAX
+
+    /* Values according to POSIX 1003.1c (POSIX threads).  */
+    _SC_THREADS,
+#define	_SC_THREADS			_SC_THREADS
+    _SC_THREAD_SAFE_FUNCTIONS,
+#define _SC_THREAD_SAFE_FUNCTIONS	_SC_THREAD_SAFE_FUNCTIONS
+    _SC_GETGR_R_SIZE_MAX,
+#define	_SC_GETGR_R_SIZE_MAX		_SC_GETGR_R_SIZE_MAX
+    _SC_GETPW_R_SIZE_MAX,
+#define	_SC_GETPW_R_SIZE_MAX		_SC_GETPW_R_SIZE_MAX
+    _SC_LOGIN_NAME_MAX,
+#define	_SC_LOGIN_NAME_MAX		_SC_LOGIN_NAME_MAX
+    _SC_TTY_NAME_MAX,
+#define	_SC_TTY_NAME_MAX		_SC_TTY_NAME_MAX
+    _SC_THREAD_DESTRUCTOR_ITERATIONS,
+#define	_SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS
+    _SC_THREAD_KEYS_MAX,
+#define	_SC_THREAD_KEYS_MAX		_SC_THREAD_KEYS_MAX
+    _SC_THREAD_STACK_MIN,
+#define	_SC_THREAD_STACK_MIN		_SC_THREAD_STACK_MIN
+    _SC_THREAD_THREADS_MAX,
+#define	_SC_THREAD_THREADS_MAX		_SC_THREAD_THREADS_MAX
+    _SC_THREAD_ATTR_STACKADDR,
+#define	_SC_THREAD_ATTR_STACKADDR	_SC_THREAD_ATTR_STACKADDR
+    _SC_THREAD_ATTR_STACKSIZE,
+#define	_SC_THREAD_ATTR_STACKSIZE	_SC_THREAD_ATTR_STACKSIZE
+    _SC_THREAD_PRIORITY_SCHEDULING,
+#define	_SC_THREAD_PRIORITY_SCHEDULING	_SC_THREAD_PRIORITY_SCHEDULING
+    _SC_THREAD_PRIO_INHERIT,
+#define	_SC_THREAD_PRIO_INHERIT		_SC_THREAD_PRIO_INHERIT
+    _SC_THREAD_PRIO_PROTECT,
+#define	_SC_THREAD_PRIO_PROTECT		_SC_THREAD_PRIO_PROTECT
+    _SC_THREAD_PROCESS_SHARED,
+#define	_SC_THREAD_PROCESS_SHARED	_SC_THREAD_PROCESS_SHARED
   };
 
 #ifdef __USE_POSIX2
diff --git a/sysdeps/generic/resourcebits.h b/sysdeps/generic/resourcebits.h
index e343b300cc..74cbcb0e97 100644
--- a/sysdeps/generic/resourcebits.h
+++ b/sysdeps/generic/resourcebits.h
@@ -1,5 +1,5 @@
 /* Bit values for resource limits.  4.4 BSD/generic GNU version.
-Copyright (C) 1994 Free Software Foundation, Inc.
+Copyright (C) 1994, 1996 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
@@ -27,26 +27,36 @@ enum __rlimit_resource
   {
     /* Per-process CPU limit, in seconds.  */
     RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
     /* Largest file that can be created, in bytes.  */
     RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
     /* Maximum size of data segment, in bytes.  */
     RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
     /* Maximum size of stack segment, in bytes.  */
     RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
     /* Largest core file that can be created, in bytes.  */
     RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
     /* Largest resident set size, in bytes.
        This affects swapping; processes that are exceeding their
        resident set size will be more likely to have physical memory
        taken from them.  */
     RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
     /* Locked-in-memory address space.  */
     RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
     /* Number of processes.  */
     RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
     /* Number of open files.  */
     RLIMIT_OFILE,
     RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_OFILE	RLIMIT_OFILE
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
 
     RLIMIT_NLIMITS,		/* Number of limit flavors.  */
     RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
diff --git a/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c
index ea070bc9b2..644108e7a0 100644
--- a/sysdeps/libm-ieee754/k_standard.c
+++ b/sysdeps/libm-ieee754/k_standard.c
@@ -112,7 +112,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = zero;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if(_LIB_VERSION == _SVID_) {
 		    (void) WRITE2("acos: DOMAIN error\n", 19);
 		  }
@@ -129,7 +129,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = zero;
 		if(_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if(_LIB_VERSION == _SVID_) {
 		    	(void) WRITE2("asin: DOMAIN error\n", 19);
 		  }
@@ -148,7 +148,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = zero;
 		if(_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if(_LIB_VERSION == _SVID_) {
 			(void) WRITE2("atan2: DOMAIN error\n", 20);
 		      }
@@ -168,7 +168,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -185,7 +185,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -202,7 +202,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -216,7 +216,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = zero;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -232,7 +232,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y0: DOMAIN error\n", 17);
 		      }
@@ -251,7 +251,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y0: DOMAIN error\n", 17);
 		      }
@@ -270,7 +270,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y1: DOMAIN error\n", 17);
 		      }
@@ -289,7 +289,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y1: DOMAIN error\n", 17);
 		      }
@@ -308,7 +308,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("yn: DOMAIN error\n", 17);
 		      }
@@ -327,7 +327,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("yn: DOMAIN error\n", 17);
 		      }
@@ -347,7 +347,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
                 if (_LIB_VERSION == _POSIX_)
 			errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         errno = ERANGE;
 		}
 		break;
@@ -364,7 +364,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("lgamma: SING error\n", 19);
 		      }
@@ -383,7 +383,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log: SING error\n", 16);
 		      }
@@ -402,7 +402,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log: DOMAIN error\n", 18);
 		      }
@@ -422,7 +422,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log10: SING error\n", 18);
 		      }
@@ -442,7 +442,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log10: DOMAIN error\n", 20);
 		      }
@@ -458,7 +458,7 @@ static double zero = 0.0;	/* used as const */
 		exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl");
 		exc.retval = zero;
 		if (_LIB_VERSION != _SVID_) exc.retval = 1.0;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			(void) WRITE2("pow(0,0): DOMAIN error\n", 23);
 			errno = EDOM;
 		}
@@ -480,7 +480,7 @@ static double zero = 0.0;	/* used as const */
 		}
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -493,7 +493,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval =  zero;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -509,7 +509,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
 		      }
@@ -528,7 +528,7 @@ static double zero = 0.0;	/* used as const */
 		    exc.retval = zero/zero;	/* X/Open allow NaN */
 		if (_LIB_VERSION == _POSIX_)
 		   errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("neg**non-integral: DOMAIN error\n", 32);
 		      }
@@ -548,7 +548,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL);
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -565,7 +565,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = zero/zero;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("sqrt: DOMAIN error\n", 19);
 		      }
@@ -585,7 +585,7 @@ static double zero = 0.0;	/* used as const */
 		    exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("fmod:  DOMAIN error\n", 20);
                   }
@@ -603,7 +603,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("remainder: DOMAIN error\n", 24);
                   }
@@ -620,7 +620,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("acosh: DOMAIN error\n", 20);
                   }
@@ -637,7 +637,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("atanh: DOMAIN error\n", 20);
                   }
@@ -654,7 +654,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = x/zero;	/* sign(x)*inf */
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("atanh: SING error\n", 18);
                   }
@@ -671,7 +671,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -685,7 +685,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = __copysign(zero,x);
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -698,7 +698,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -715,7 +715,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -732,7 +732,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -749,7 +749,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -766,7 +766,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -783,7 +783,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -804,7 +804,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
                 if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   errno = ERANGE;
                 }
 		break;
@@ -821,7 +821,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("gamma: SING error\n", 18);
 		      }
@@ -838,7 +838,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = x;
 		if (_LIB_VERSION == _IEEE_ ||
 		    _LIB_VERSION == _POSIX_) exc.retval = 1.0;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = EDOM;
 		}
 		break;
diff --git a/sysdeps/mach/hurd/closedir.c b/sysdeps/mach/hurd/closedir.c
index 4c62783584..482e19aa20 100644
--- a/sysdeps/mach/hurd/closedir.c
+++ b/sysdeps/mach/hurd/closedir.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
@@ -29,7 +28,7 @@ Cambridge, MA 02139, USA.  */
 /* Close the directory stream DIRP.
    Return 0 if successful, -1 if not.  */
 int
-DEFUN(closedir, (dirp), DIR *dirp)
+__closedir (DIR *dirp)
 {
   error_t err;
 
@@ -59,4 +58,4 @@ DEFUN(closedir, (dirp), DIR *dirp)
 
   return 0;
 }
-
+weak_alias (__closedir, closedir)
diff --git a/sysdeps/mach/hurd/getrlimit.c b/sysdeps/mach/hurd/getrlimit.c
index a05d32277d..5645181978 100644
--- a/sysdeps/mach/hurd/getrlimit.c
+++ b/sysdeps/mach/hurd/getrlimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1994, 1996 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
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <sys/resource.h>
 #include <errno.h>
 #include <hurd.h>
@@ -25,8 +24,7 @@ Cambridge, MA 02139, USA.  */
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
 int
-DEFUN(getrlimit, (resource, rlimits),
-      enum __rlimit_resource resource AND struct rlimit *rlimits)
+__getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
 {
   struct rlimit lim;
 
@@ -44,3 +42,4 @@ DEFUN(getrlimit, (resource, rlimits),
 
   return 0;
 }
+weak_alias (__getrlimit, getrlimit)
diff --git a/sysdeps/mach/hurd/opendir.c b/sysdeps/mach/hurd/opendir.c
index bab84d52f0..9c3ae8af89 100644
--- a/sysdeps/mach/hurd/opendir.c
+++ b/sysdeps/mach/hurd/opendir.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <limits.h>
 #include <stddef.h>
@@ -34,7 +33,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Open a directory stream on NAME.  */
 DIR *
-DEFUN(opendir, (name), CONST char *name)
+__opendir (const char *name)
 {
   DIR *dirp;
   int fd;
@@ -70,3 +69,4 @@ DEFUN(opendir, (name), CONST char *name)
 
   return dirp;
 }
+weak_alias (__opendir, opendir)
diff --git a/sysdeps/mach/hurd/readdir.c b/sysdeps/mach/hurd/readdir.c
index 715f9278a2..2ff43e30ca 100644
--- a/sysdeps/mach/hurd/readdir.c
+++ b/sysdeps/mach/hurd/readdir.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <limits.h>
 #include <stddef.h>
@@ -31,7 +30,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Read a directory entry from DIRP.  */
 struct dirent *
-DEFUN(readdir, (dirp), DIR *dirp)
+__readdir (DIR *dirp)
 {
   struct dirent *dp;
 
@@ -104,3 +103,4 @@ DEFUN(readdir, (dirp), DIR *dirp)
 
   return dp;
 }
+weak_alias (__readdir, readdir)
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index af858a2643..2d8011e276 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -286,10 +286,10 @@ __getcwd (buf, size)
       mount_point = dotdev != thisdev;
 
       /* Search for the last directory.  */
-      dirstream = opendir (dotp);
+      dirstream = __opendir (dotp);
       if (dirstream == NULL)
 	goto lose;
-      while ((d = readdir (dirstream)) != NULL)
+      while ((d = __readdir (dirstream)) != NULL)
 	{
 	  if (d->d_name[0] == '.' &&
 	      (d->d_name[1] == '\0' ||
@@ -304,7 +304,7 @@ __getcwd (buf, size)
 	      if (__lstat (name, &st) < 0)
 		{
 		  int save = errno;
-		  (void) closedir (dirstream);
+		  (void) __closedir (dirstream);
 		  errno = save;
 		  goto lose;
 		}
@@ -315,7 +315,7 @@ __getcwd (buf, size)
       if (d == NULL)
 	{
 	  int save = errno;
-	  (void) closedir (dirstream);
+	  (void) __closedir (dirstream);
 	  errno = save;
 	  goto lose;
 	}
@@ -336,7 +336,7 @@ __getcwd (buf, size)
 		  buf = realloc (path, size);
 		  if (buf == NULL)
 		    {
-		      (void) closedir (dirstream);
+		      (void) __closedir (dirstream);
 		      free (path);
 		      errno = ENOMEM; /* closedir might have changed it.  */
 		      return NULL;
@@ -348,7 +348,7 @@ __getcwd (buf, size)
 	  pathp -= namlen;
 	  (void) memcpy (pathp, d->d_name, namlen);
 	  *--pathp = '/';
-	  (void) closedir (dirstream);
+	  (void) __closedir (dirstream);
 	}
 
       thisdev = dotdev;
diff --git a/sysdeps/posix/getdtsz.c b/sysdeps/posix/getdtsz.c
index 2080dc7c51..22ecb4f890 100644
--- a/sysdeps/posix/getdtsz.c
+++ b/sysdeps/posix/getdtsz.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995, 1996 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
@@ -16,17 +16,21 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
+#include <limits.h>
 #include <unistd.h>
-
-extern long int EXFUN(__sysconf, (int));
+#include <sys/resource.h>
 
 /* Return the maximum number of file descriptors
    the current process could possibly have.  */
 int
-DEFUN_VOID(__getdtablesize)
+__getdtablesize (void)
 {
-  return __sysconf (_SC_OPEN_MAX);
+  struct rlimit ru;
+
+  /* This should even work if `getrlimit' is not implemented.  POSIX.1
+     does not define this function but we will generate a stub which
+     returns -1.  */
+  return __getrlimit (RLIMIT_NOFILE, &ru) < 0 ? OPEN_MAX : ru.rlim_cur;
 }
 
 weak_alias (__getdtablesize, getdtablesize)
diff --git a/sysdeps/posix/sigsetmask.c b/sysdeps/posix/sigsetmask.c
index 12e77a619d..87756278ad 100644
--- a/sysdeps/posix/sigsetmask.c
+++ b/sysdeps/posix/sigsetmask.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1994, 1995, 1996 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
@@ -16,29 +16,28 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <signal.h>
 
 /* Set the mask of blocked signals to MASK, returning the old mask.  */
 int
-DEFUN(__sigsetmask, (mask), int mask)
+__sigsetmask (int mask)
 {
   register int sig;
   sigset_t set, oset;
 
-  if (__sigemptyset(&set) < 0)
+  if (__sigemptyset (&set) < 0)
     return -1;
-  
+
   if (sizeof (mask) == sizeof (set))
     *(int *) &set = mask;
   else
     for (sig = 1; sig < NSIG; ++sig)
       if ((mask & sigmask(sig)) &&
-	  __sigaddset(&set, sig) < 0)
+	  __sigaddset (&set, sig) < 0)
 	return -1;
 
-  if (sigprocmask(SIG_SETMASK, &set, &oset) < 0)
+  if (__sigprocmask (SIG_SETMASK, &set, &oset) < 0)
     return -1;
 
   mask = 0;
@@ -46,8 +45,8 @@ DEFUN(__sigsetmask, (mask), int mask)
     mask = *(int *) &oset;
   else
     for (sig = 1; sig < NSIG; ++sig)
-      if (__sigismember(&oset, sig))
-	mask |= sigmask(sig);
+      if (__sigismember (&oset, sig))
+	mask |= sigmask (sig);
 
   return mask;
 }
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index dda72a3591..5b2caf66f6 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -18,10 +18,12 @@ Cambridge, MA 02139, USA.  */
 
 #include <errno.h>
 #include <limits.h>
-#include <unistd.h>
+#include <grp.h>
+#include <pwd.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <time.h>
+#include <unistd.h>
 
 extern int __getdtablesize __P ((void));
 extern size_t __getpagesize __P ((void));
@@ -480,6 +482,119 @@ __sysconf (name)
 #else
       return -1;
 #endif
+
+      /* POSIX 1003.1c (POSIX Threads).  */
+    case _SC_THREADS:
+#ifdef	_POSIX_THREADS
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_SAFE_FUNCTIONS:
+#ifdef	_POSIX_THREAD_SAFE_FUNCTIONS
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_GETGR_R_SIZE_MAX:
+#ifdef	NSS_BUFLEN_GROUP
+      return NSS_BUFLEN_GROUP;
+#else
+      return -1;
+#endif
+
+    case _SC_GETPW_R_SIZE_MAX:
+#ifdef	NSS_BUFLEN_PASSWD
+      return NSS_BUFLEN_PASSWD;
+#else
+      return -1;
+#endif
+
+    case _SC_LOGIN_NAME_MAX:
+#ifdef	_POSIX_LOGIN_NAME_MAX
+      return _POSIX_LOGIN_NAME_MAX;
+#else
+      return -1;
+#endif
+
+    case _SC_TTY_NAME_MAX:
+#ifdef	_POSIX_TTY_NAME_MAX
+      return _POSIX_TTY_NAME_MAX;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_DESTRUCTOR_ITERATIONS:
+#ifdef	PTHREAD_DESTRUCTOR_ITERATIONS
+      return PTHREAD_DESTRUCTOR_ITERATIONS;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_KEYS_MAX:
+#ifdef	PTHREAD_KEYS_MAX
+      return PTHREAD_KEYS_MAX;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_STACK_MIN:
+#ifdef	PTHREAD_STACK_MIN
+      return PTHREAD_STACK_MIN;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_THREADS_MAX:
+#ifdef	PTHREAD_THREADS_MAX
+      return PTHREAD_THREADS_MAX;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_ATTR_STACKADDR:
+#ifdef	_POSIX_THREAD_ATTR_STACKADDR
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_ATTR_STACKSIZE:
+#ifdef	_POSIX_THREAD_ATTR_STACKSIZE
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_PRIORITY_SCHEDULING:
+#ifdef	_POSIX_THREAD_PRIORITY_SCHEDULING
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_PRIO_INHERIT:
+#ifdef	_POSIX_THREAD_PRIO_INHERIT
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_PRIO_PROTECT:
+#ifdef	_POSIX_THREAD_PRIO_PROTECT
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_PROCESS_SHARED:
+#ifdef	_POSIX_THREAD_PROCESS_SHARED
+      return 1;
+#else
+      return -1;
+#endif
     }
 }
 
diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c
index 4450a83326..a05dbd5be3 100644
--- a/sysdeps/posix/ttyname_r.c
+++ b/sysdeps/posix/ttyname_r.c
@@ -33,7 +33,7 @@ Cambridge, MA 02139, USA.  */
 /* Store at most BUFLEN character of the pathname of the terminal FD is
    open on in BUF.  Return 0 on success, -1 otherwise.  */
 int
-ttyname_r (fd, buf, buflen)
+__ttyname_r (fd, buf, buflen)
      int fd;
      char *buf;
      int buflen;
@@ -89,3 +89,4 @@ ttyname_r (fd, buf, buflen)
   errno = save;
   return -1;
 }
+weak_alias (__ttyname_r, ttyname_r)
diff --git a/sysdeps/stub/closedir.c b/sysdeps/stub/closedir.c
index fbc1ebe3d4..5fb2ed3e7d 100644
--- a/sysdeps/stub/closedir.c
+++ b/sysdeps/stub/closedir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996 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
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <dirent.h>
@@ -25,11 +24,11 @@ Cambridge, MA 02139, USA.  */
 /* Close the directory stream DIRP.
    Return 0 if successful, -1 if not.  */
 int
-DEFUN(closedir, (dirp), DIR *dirp)
+__closedir (DIR *dirp)
 {
   errno = ENOSYS;
-  return(-1);
+  return -1;
 }
-
+weak_alias (__closedir, closedir)
 
 stub_warning (closedir)
diff --git a/sysdeps/stub/getrlimit.c b/sysdeps/stub/getrlimit.c
index 8553c5f262..a3f31448bc 100644
--- a/sysdeps/stub/getrlimit.c
+++ b/sysdeps/stub/getrlimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996 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
@@ -16,19 +16,17 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <sys/resource.h>
 #include <errno.h>
 
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
 int
-DEFUN(getrlimit, (resource, rlimits),
-      enum __rlimit_resource resource AND struct rlimit *rlimits)
+__getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
 {
   errno = ENOSYS;
   return -1;
 }
-
+weak_alias (__getrlimit, getrlimit)
 
 stub_warning (getrlimit)
diff --git a/sysdeps/stub/opendir.c b/sysdeps/stub/opendir.c
index e2124c79ad..f0d7784d1e 100644
--- a/sysdeps/stub/opendir.c
+++ b/sysdeps/stub/opendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996 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
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <dirent.h>
@@ -24,11 +23,11 @@ Cambridge, MA 02139, USA.  */
 
 /* Open a directory stream on NAME.  */
 DIR *
-DEFUN(opendir, (name), CONST char *name)
+__opendir (const char *name)
 {
   errno = ENOSYS;
-  return(NULL);
+  return NULL;
 }
-
+weak_alias (__opendir, opendir)
 
 stub_warning (opendir)
diff --git a/sysdeps/stub/readdir.c b/sysdeps/stub/readdir.c
index ad23ac1afc..d210906dbd 100644
--- a/sysdeps/stub/readdir.c
+++ b/sysdeps/stub/readdir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996 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
@@ -16,18 +16,17 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <dirent.h>
 
 /* Read a directory entry from DIRP.  */
 struct dirent *
-DEFUN(readdir, (dirp), DIR *dirp)
+__readdir (DIR *dirp)
 {
   errno = ENOSYS;
-  return(NULL);
+  return NULL;
 }
-
+weak_alias (__readdir, readdir)
 
 stub_warning (readdir)
diff --git a/sysdeps/stub/sysconf.c b/sysdeps/stub/sysconf.c
index f3b0c352ca..613ef674b8 100644
--- a/sysdeps/stub/sysconf.c
+++ b/sysdeps/stub/sysconf.c
@@ -128,6 +128,23 @@ __sysconf (name)
     case _SC_2_FORT_DEV:
     case _SC_2_SW_DEV:
 
+    case _SC_THREADS:
+    case _SC_THREAD_SAFE_FUNCTIONS:
+    case _SC_GETGR_R_SIZE_MAX:
+    case _SC_GETPW_R_SIZE_MAX:
+    case _SC_LOGIN_NAME_MAX:
+    case _SC_TTY_NAME_MAX:
+    case _SC_THREAD_DESTRUCTOR_ITERATIONS:
+    case _SC_THREAD_KEYS_MAX:
+    case _SC_THREAD_STACK_MIN:
+    case _SC_THREAD_THREADS_MAX:
+    case _SC_THREAD_ATTR_STACKADDR:
+    case _SC_THREAD_ATTR_STACKSIZE:
+    case _SC_THREAD_PRIORITY_SCHEDULING:
+    case _SC_THREAD_PRIO_INHERIT:
+    case _SC_THREAD_PRIO_PROTECT:
+    case _SC_THREAD_PROCESS_SHARED:
+
       break;
     }
 
diff --git a/sysdeps/unix/bsd/sun/sunos4/resourcebits.h b/sysdeps/unix/bsd/sun/sunos4/resourcebits.h
index b5d3704e6c..485dec9b81 100644
--- a/sysdeps/unix/bsd/sun/sunos4/resourcebits.h
+++ b/sysdeps/unix/bsd/sun/sunos4/resourcebits.h
@@ -1,5 +1,5 @@
 /* Bit values for resource limits.  SunOS 4 version.
-Copyright (C) 1994 Free Software Foundation, Inc.
+Copyright (C) 1994, 1996 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
@@ -27,22 +27,30 @@ enum __rlimit_resource
   {
     /* Per-process CPU limit, in seconds.  */
     RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
     /* Largest file that can be created, in bytes.  */
     RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
     /* Maximum size of data segment, in bytes.  */
     RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
     /* Maximum size of stack segment, in bytes.  */
     RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
     /* Largest core file that can be created, in bytes.  */
     RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
     /* Largest resident set size, in bytes.
        This affects swapping; processes that are exceeding their
        resident set size will be more likely to have physical memory
        taken from them.  */
     RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
     /* Number of open files.  */
     RLIMIT_NOFILE,
     RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
+#defin	RLIMIT_NOFILE	RLIMIT_NOFILE
+#defin	RLIMIT_OFILE	RLIMIT_OFILE
 
     RLIM_NLIMITS
   };
diff --git a/sysdeps/unix/closedir.c b/sysdeps/unix/closedir.c
index 1d4fd8eef0..5b938a8272 100644
--- a/sysdeps/unix/closedir.c
+++ b/sysdeps/unix/closedir.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
@@ -27,7 +26,7 @@ Cambridge, MA 02139, USA.  */
 /* Close the directory stream DIRP.
    Return 0 if successful, -1 if not.  */
 int
-DEFUN(closedir, (dirp), DIR *dirp)
+__closedir (DIR *dirp)
 {
   int fd;
 
@@ -40,12 +39,12 @@ DEFUN(closedir, (dirp), DIR *dirp)
   __libc_lock_lock (dirp->lock);
 
   fd = dirp->fd;
-  free ((PTR) dirp->data);
+  free ((void *) dirp->data);
 
   __libc_lock_fini (dirp->lock);
 
-  free ((PTR) dirp);
+  free ((void *) dirp);
 
   return __close (fd);
 }
-
+weak_alias (__closedir, closedir)
diff --git a/sysdeps/unix/getlogin.c b/sysdeps/unix/getlogin.c
index 246b488f51..5a8ad96df2 100644
--- a/sysdeps/unix/getlogin.c
+++ b/sysdeps/unix/getlogin.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
@@ -30,7 +29,7 @@ Cambridge, MA 02139, USA.  */
    The returned pointer, if not NULL, is good only until the next call.  */
 
 char *
-DEFUN_VOID(getlogin)
+getlogin (void)
 {
   char tty_pathname[2 + 2 * NAME_MAX];
   char *real_tty_path = tty_pathname;
@@ -44,7 +43,7 @@ DEFUN_VOID(getlogin)
     if (d < 0)
       return NULL;
 
-    if (ttyname_r (d, real_tty_path, sizeof (tty_pathname)) < 0)
+    if (__ttyname_r (d, real_tty_path, sizeof (tty_pathname)) < 0)
       err = errno;
     (void) close (d);
 
@@ -57,9 +56,9 @@ DEFUN_VOID(getlogin)
 
   real_tty_path += 5;		/* Remove "/dev/".  */
 
-  setutent_r (&utmp_data);
+  __setutent_r (&utmp_data);
   strncpy (line.ut_line, real_tty_path, sizeof line.ut_line);
-  if (getutline_r (&line, &ut, &utmp_data) < 0)
+  if (__getutline_r (&line, &ut, &utmp_data) < 0)
     {
       if (errno == ESRCH)
 	/* The caller expects ENOENT if nothing is found.  */
@@ -69,7 +68,7 @@ DEFUN_VOID(getlogin)
   else
     result = ut->ut_line;
 
-  endutent_r (&utmp_data);
+  __endutent_r (&utmp_data);
 
   return result;
 }
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c
index 8dca80b3ae..890d428086 100644
--- a/sysdeps/unix/opendir.c
+++ b/sysdeps/unix/opendir.c
@@ -31,7 +31,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Open a directory stream on NAME.  */
 DIR *
-opendir (const char *name)
+__opendir (const char *name)
 {
   DIR *dirp;
   struct stat statbuf;
@@ -49,7 +49,7 @@ opendir (const char *name)
   if (fd < 0)
     return NULL;
 
-  if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
+  if (__fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
     goto lose;
 
   if (fstat (fd, &statbuf) < 0)
@@ -95,3 +95,4 @@ opendir (const char *name)
 
   return dirp;
 }
+weak_alias (__opendir, opendir)
diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c
index 5d0c40fdc1..46f2caff87 100644
--- a/sysdeps/unix/readdir.c
+++ b/sysdeps/unix/readdir.c
@@ -30,7 +30,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Read a directory entry from DIRP.  */
 struct dirent *
-readdir (DIR *dirp)
+__readdir (DIR *dirp)
 {
   struct dirent *dp;
 
@@ -105,3 +105,4 @@ readdir (DIR *dirp)
 
   return dp;
 }
+weak_alias (__readdir, readdir)
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index 5b3e30de89..0da9d17b07 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -18,7 +18,7 @@ getgroups	-	getgroups	2	__getgroups	getgroups
 getitimer	-	getitimer	2	__getitimer	getitimer
 getpid		-	getpid		0	__getpid	getpid
 getpriority	-	getpriority	2	getpriority
-getrlimit	-	getrlimit	2	getrlimit
+getrlimit	-	getrlimit	2	__getrlimit	getrlimit
 getuid		-	getuid		0	__getuid	getuid
 ioctl		-	ioctl		3	__ioctl		ioctl
 kill		-	kill		2	__kill		kill
@@ -33,7 +33,7 @@ readlink	-	readlink	3	__readlink	readlink
 readv		-	readv		3	readv
 reboot		-	reboot		1	reboot
 rename		-	rename		2	rename
-rmdir		-	rmdir		1	__rmdir	rmdir
+rmdir		-	rmdir		1	__rmdir		rmdir
 select		-	select		5	__select	select
 setdomain	-	setdomainname	2	setdomainname
 setegid		-	setegid		1	__setegid	setegid
diff --git a/sysdeps/unix/sysv/linux/alpha/resourcebits.h b/sysdeps/unix/sysv/linux/alpha/resourcebits.h
new file mode 100644
index 0000000000..a53d523a1e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/resourcebits.h
@@ -0,0 +1,63 @@
+/* Bit values for resource limits.  Linux/Alpha version.
+Copyright (C) 1996 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
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* These are the values for Linux/Alpha.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+  {
+    /* Per-process CPU limit, in seconds.  */
+    RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
+    /* Largest file that can be created, in bytes.  */
+    RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
+    /* Maximum size of data segment, in bytes.  */
+    RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
+    /* Maximum size of stack segment, in bytes.  */
+    RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
+    /* Largest core file that can be created, in bytes.  */
+    RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
+    /* Largest resident set size, in bytes.
+       This affects swapping; processes that are exceeding their
+       resident set size will be more likely to have physical memory
+       taken from them.  */
+    RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
+    /* Number of open files.  */
+    RLIMIT_OFILE,
+#define	RLIMIT_OFILE	RLIMIT_OFILE
+    RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
+    /* Address space limit.  */
+    RLIMIT_AS,
+#define	RLIMIT_AS	RLIMIT_AS
+    /* Number of processes.  */
+    RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
+    /* Locked-in-memory address space.  */
+    RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
+
+    RLIMIT_NLIMITS,		/* Number of limit flavors.  */
+    RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
+  };
diff --git a/sysdeps/unix/sysv/linux/i386/resourcebits.h b/sysdeps/unix/sysv/linux/i386/resourcebits.h
new file mode 100644
index 0000000000..b4713bf3d6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/resourcebits.h
@@ -0,0 +1,63 @@
+/* Bit values for resource limits.  Linux/i386 version.
+Copyright (C) 1996 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
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* These are the values for Linux/i386.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+  {
+    /* Per-process CPU limit, in seconds.  */
+    RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
+    /* Largest file that can be created, in bytes.  */
+    RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
+    /* Maximum size of data segment, in bytes.  */
+    RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
+    /* Maximum size of stack segment, in bytes.  */
+    RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
+    /* Largest core file that can be created, in bytes.  */
+    RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
+    /* Largest resident set size, in bytes.
+       This affects swapping; processes that are exceeding their
+       resident set size will be more likely to have physical memory
+       taken from them.  */
+    RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
+    /* Number of processes.  */
+    RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
+    /* Number of open files.  */
+    RLIMIT_OFILE,
+#define	RLIMIT_OFILE	RLIMIT_OFILE
+    RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
+    /* Locked-in-memory address space.  */
+    RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
+    /* Address space limit.  */
+    RLIMIT_AS,
+#define	RLIMIT_AS	RLIMIT_AS
+
+    RLIMIT_NLIMITS,		/* Number of limit flavors.  */
+    RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
+  };
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index a63200c1ae..aa7d9c4ac0 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -20,6 +20,7 @@ Cambridge, MA 02139, USA.  */
 #include <unistd.h>
 #include <sysdep.h>
 #include <fpu_control.h>
+#include <linux/personality.h>
 #include "init-first.h"
 
 extern void __libc_init (int, char **, char **);
@@ -28,6 +29,11 @@ extern void __libc_global_ctors (void);
 /* The function is called from assembly stubs the compiler can't see.  */
 static void init (void *) __attribute__ ((unused));
 
+extern int __libc_is_static;
+#ifdef PIC
+weak_extern (__libc_is_static)
+#endif
+
 static void
 init (void *data)
 {
@@ -37,15 +43,36 @@ init (void *data)
   char **argv = (char **)data + 1;
   char **envp = &argv[argc + 1];
 
-  /* The `personality' system call takes one argument that chooses the
-     "personality", i.e. the set of system calls and such.  Zero is the
-     native Linux value; we must make this call first thing to disable
-     emulation of some other system that might have been enabled by default
-     based on the executable format.  */
-  __personality (0);
-
-  /* Set the FPU control word to the proper default value.  */
-  __setfpucw (__fpu_control);
+#ifdef PIC
+  if (&__libc_is_static != NULL)
+#endif
+    {
+#ifdef PIC
+      /* We must not call `personality' twice.  */
+      if (__libc_is_static == 0)
+#endif
+	{
+	  /* The `personality' system call takes one argument that
+	     chooses the "personality", i.e. the set of system calls
+	     and such.  We must make this call first thing to disable
+	     emulation of some other system that might have been
+	     enabled by default based on the executable format.  */
+	  __personality (PER_LINUX);
+
+	  /* Set the FPU control word to the proper default value.  */
+	  __setfpucw (__fpu_control);
+	}
+
+      /* We set LIBC_IS_STATIC to a value > 0 for the static library
+	 and < 0 for the shared library.  This information might be
+	 useful for the running program but it is mainly necessary for
+	 the above `if' statement.  */
+#ifdef PIC
+      __libc_is_static = -1;
+#else
+      __libc_is_static = 1;
+#endif
+    }
 
   __environ = envp;
   __libc_init (argc, argv, envp);
diff --git a/sysdeps/unix/sysv/linux/resourcebits.h b/sysdeps/unix/sysv/linux/m68k/resourcebits.h
index 9cd6ab46d8..65cc6e550a 100644
--- a/sysdeps/unix/sysv/linux/resourcebits.h
+++ b/sysdeps/unix/sysv/linux/m68k/resourcebits.h
@@ -1,4 +1,4 @@
-/* Bit values for resource limits.  Linux version.
+/* Bit values for resource limits.  Linux/m68k version.
 Copyright (C) 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
@@ -17,33 +17,43 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-/* These are the values for Linux.  */
+/* These are the values for Linux/m68k.  */
 
 /* Kinds of resource limit.  */
 enum __rlimit_resource
   {
     /* Per-process CPU limit, in seconds.  */
     RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
     /* Largest file that can be created, in bytes.  */
     RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
     /* Maximum size of data segment, in bytes.  */
     RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
     /* Maximum size of stack segment, in bytes.  */
     RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
     /* Largest core file that can be created, in bytes.  */
     RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
     /* Largest resident set size, in bytes.
        This affects swapping; processes that are exceeding their
        resident set size will be more likely to have physical memory
        taken from them.  */
     RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
     /* Number of processes.  */
     RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
     /* Number of open files.  */
     RLIMIT_OFILE,
+#define	RLIMIT_OFILE	RLIMIT_OFILE
     RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
     /* Locked-in-memory address space.  */
     RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
 
     RLIMIT_NLIMITS,		/* Number of limit flavors.  */
     RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
diff --git a/sysdeps/unix/sysv/linux/mips/resourcebits.h b/sysdeps/unix/sysv/linux/mips/resourcebits.h
new file mode 100644
index 0000000000..095f40b09c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/resourcebits.h
@@ -0,0 +1,65 @@
+/* Bit values for resource limits.  Linux/MIPS version.
+Copyright (C) 1996 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
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* These are the values for Linux/MIPS.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+  {
+    /* Per-process CPU limit, in seconds.  */
+    RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
+    /* Largest file that can be created, in bytes.  */
+    RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
+    /* Maximum size of data segment, in bytes.  */
+    RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
+    /* Maximum size of stack segment, in bytes.  */
+    RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
+    /* Largest core file that can be created, in bytes.  */
+    RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
+    /* Number of open files.  */
+    RLIMIT_OFILE,
+#define	RLIMIT_OFILE	RLIMIT_OFILE
+    RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
+    /* Address space limit.  */
+    RLIMIT_AS,
+#define	RLIMIT_AS	RLIMIT_AS
+    RLIMIT_VMEM = RLIMIT_AS,
+#define	RLIMIT_VMEM	RLIMIT_VMEM
+    /* Largest resident set size, in bytes.
+       This affects swapping; processes that are exceeding their
+       resident set size will be more likely to have physical memory
+       taken from them.  */
+    RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
+    /* Number of processes.  */
+    RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
+    /* Locked-in-memory address space.  */
+    RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
+
+    RLIMIT_NLIMITS,		/* Number of limit flavors.  */
+    RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
+  };
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
deleted file mode 100644
index 2ae584f164..0000000000
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-/* On Linux we must not ask __getdtablesize for te value for _SC_OPEN_MAX
-   because this would mean an endless loop.  */
-
-#include <limits.h>
-#include <unistd.h>
-
-extern long int __default_sysconf (int name);
-
-long int
-__sysconf (int name)
-{
-  if (name == _SC_OPEN_MAX)
-    return OPEN_MAX;
-
-  return __default_sysconf (name);
-}
-
-#define __sysconf __default_sysconf
-
-#include <sysdeps/posix/sysconf.c>
diff --git a/sysdeps/unix/sysv/sysv4/getdtsz.c b/sysdeps/unix/sysv/sysv4/getdtsz.c
deleted file mode 100644
index c1ae6108fb..0000000000
--- a/sysdeps/unix/sysv/sysv4/getdtsz.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Solaris uses sysconf ala POSIX.1.  */
-#include <sysdeps/posix/getdtsz.c>