summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog71
-rw-r--r--include/alloca.h7
-rw-r--r--include/signal.h3
-rw-r--r--include/sys/msg.h8
-rw-r--r--include/sys/uio.h4
-rw-r--r--include/sys/wait.h1
-rw-r--r--linuxthreads/Versions5
-rw-r--r--linuxthreads/descr.h2
-rw-r--r--linuxthreads/manager.c15
-rw-r--r--linuxthreads/no-tsd.c5
-rw-r--r--linuxthreads/pthread.c138
-rw-r--r--linuxthreads/specific.c6
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/allocalim.h26
-rw-r--r--misc/Versions4
-rw-r--r--posix/Versions1
-rw-r--r--resolv/gethnamaddr.c48
-rw-r--r--resolv/nss_dns/dns-host.c70
-rw-r--r--resolv/nss_dns/dns-network.c57
-rw-r--r--resolv/res_query.c20
-rw-r--r--signal/Versions3
-rw-r--r--stdio-common/printf_fp.c2
-rw-r--r--stdio-common/vfprintf.c18
-rw-r--r--string/strcoll.c2
-rw-r--r--string/strxfrm.c2
-rw-r--r--sysdeps/generic/allocalim.h4
-rw-r--r--sysdeps/generic/readv.c7
-rw-r--r--sysdeps/generic/waitid.c5
-rw-r--r--sysdeps/generic/writev.c7
-rw-r--r--sysdeps/posix/readv.c11
-rw-r--r--sysdeps/posix/waitid.c5
-rw-r--r--sysdeps/posix/writev.c11
-rw-r--r--sysdeps/unix/sysv/aix/readv.c7
-rw-r--r--sysdeps/unix/sysv/aix/waitid.c5
-rw-r--r--sysdeps/unix/sysv/aix/writev.c7
-rw-r--r--sysdeps/unix/sysv/linux/msgrcv.c5
-rw-r--r--sysdeps/unix/sysv/linux/msgsnd.c5
-rw-r--r--sysdeps/unix/sysv/linux/readv.c7
-rw-r--r--sysdeps/unix/sysv/linux/sigtimedwait.c3
-rw-r--r--sysdeps/unix/sysv/linux/sigwait.c1
-rw-r--r--sysdeps/unix/sysv/linux/sigwaitinfo.c3
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/writev.c7
-rw-r--r--sysvipc/Versions4
43 files changed, 424 insertions, 200 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a1dcfb008..481d2b2e50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,74 @@
+2002-10-09  Ulrich Drepper  <drepper@redhat.com>
+
+	* Versions.def (libc): Add GLIBC_2.3.1.
+	(libpthread): Add GLIBC_2.3.1.
+
+	* include/signal.h: Add libc_hidden_proto for __sigwait, __sigwaitinfo,
+	and __sigtimedwait.
+	* signal/Versions: Add __sigtimedwait, __sigwait, and __sigwaitinfo.
+	* sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Add
+	libc_hidden_def.
+	* sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise.
+	* sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise.
+
+	* include/sys/msg.h: Declare __libc_msgrcv and __libc_msgsnd.
+	* sysdeps/unix/sysv/linux/msgrcv.c (__msgrcv): Rename to __libc_msgrcv
+	and make old name an alias.
+	* sysdeps/unix/sysv/linux/msgsnd.c (__msgsnd): Rename to __libc_msgsnd
+	and make old name an alias.
+	* sysvipc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_msgrcv and
+	__libc_msgsnd.
+
+	* include/sys/uio.h: Declare __libc_readv and __libc_writev.
+	* misc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_readv and
+	__libc_writev.
+	* sysdeps/generic/readv.c (__readv): Rename to __libc_readv and make
+	old name an alias.
+	* sysdeps/posix/readv.c: Likewise
+	* sysdeps/unix/sysv/aix/readv.c: Likewise.
+	* sysdeps/unix/sysv/linux/readv.c: Likewise.
+	* sysdeps/generic/writev.c (__writev): Rename to __libc_writev and make
+	old name an alias.
+	* sysdeps/posix/writev.c: Likewise
+	* sysdeps/unix/sysv/aix/writev.c: Likewise.
+	* sysdeps/unix/sysv/linux/writev.c: Likewise.
+
+	* include/sys/wait.h: Declare __waitid.
+	* posix/Versions (libc) [GLIBC_PRIVATE]: Add __waitid.
+	* sysdeps/generic/waitid.c (waitid): Rename to __waitid and make old
+	name an alias.
+	* sysdeps/posix/waitid.c: Likewise.
+	* sysdeps/unix/sysv/aix/waitid.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/syscalls.list: Add creat syscall.
+
+2002-10-07  Jakub Jelinek  <jakub@redhat.com>
+
+	* include/alloca.h (__libc_use_alloca, __libc_alloca_cutoff): New
+	prototypes.
+	(__MAX_ALLOCA_CUTOFF): Define.
+	Include allocalim.h.
+	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r,
+	_nss_dns_gethostbyaddr_r): Use alloca or malloc to allocate
+	host_buffer depending on __libc_use_alloca.
+	* resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r,
+	_nss_dns_getnetbyaddr_r): Use alloca or malloc to allocate
+	net_buffer depending on __libc_use_alloca.
+	* resolv/res_query.c (res_nquery): Use alloca or malloc to allocate
+	buf depending on __libc_use_alloca.
+	* resolv/gethnamaddr.c (gethostbyname2, gethostbyaddr): Likewise.
+	* stdio-common/vfprintf.c (vfprintf): Use __libc_use_alloca
+	instead of hardcoded constants.
+	Pass proper size argument to alloca and compute end for wide char
+	version.
+	* stdio-common/printf_fp.c (__printf_fp): Use __libc_use_alloca
+	instead of hardcoded constants.
+	* string/strcoll.c (strcoll): Likewise.
+	* string/strxfrm.c (strxfrm): Likewise.
+	* sysdeps/posix/readv.c (__readv): Likewise.
+	* sysdeps/posix/writev.c (__writev): Likewise.
+	* sysdeps/generic/allocalim.h: New file.
+
 2002-10-08  Roland McGrath  <roland@redhat.com>
 
 	* configure.in (aux_missing warning): Change "too old" to
diff --git a/include/alloca.h b/include/alloca.h
index 3a480f8e24..9536fe0f1f 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -11,4 +11,11 @@ extern void *__alloca (size_t __size);
 # define __alloca(size)	__builtin_alloca (size)
 #endif /* GCC.  */
 
+extern int __libc_use_alloca (size_t size) __attribute__ ((const));
+extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
+
+#define __MAX_ALLOCA_CUTOFF	65536
+
+#include <allocalim.h>
+
 #endif
diff --git a/include/signal.h b/include/signal.h
index 4196a6f012..3d599ef19a 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -22,9 +22,12 @@ extern int __sigprocmask (int __how,
 extern int __sigsuspend (__const sigset_t *__set);
 libc_hidden_proto (__sigsuspend)
 extern int __sigwait (__const sigset_t *__set, int *__sig);
+libc_hidden_proto (__sigwait)
 extern int __sigwaitinfo (__const sigset_t *__set, siginfo_t *__info);
+libc_hidden_proto (__sigwaitinfo)
 extern int __sigtimedwait (__const sigset_t *__set, siginfo_t *__info,
 			   __const struct timespec *__timeout);
+libc_hidden_proto (__sigtimedwait)
 extern int __sigqueue (__pid_t __pid, int __sig,
 		       __const union sigval __val);
 extern int __sigvec (int __sig, __const struct sigvec *__vec,
diff --git a/include/sys/msg.h b/include/sys/msg.h
index 0f8026dda1..02bb9aefd0 100644
--- a/include/sys/msg.h
+++ b/include/sys/msg.h
@@ -1 +1,9 @@
+#ifndef _SYS_MSG_H
 #include <sysvipc/sys/msg.h>
+
+extern int __libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp,
+			  int msgflg);
+extern int __libc_msgsnd (int msqid, const void *msgp, size_t msgsz,
+			  int msgflg);
+
+#endif
diff --git a/include/sys/uio.h b/include/sys/uio.h
index 09bdce2b22..8c2b0167c1 100644
--- a/include/sys/uio.h
+++ b/include/sys/uio.h
@@ -4,6 +4,10 @@
 /* Now define the internal interfaces.  */
 extern ssize_t __readv (int __fd, __const struct iovec *__vector,
 			int __count);
+extern ssize_t __libc_readv (int __fd, __const struct iovec *__vector,
+			     int __count);
 extern ssize_t __writev (int __fd, __const struct iovec *__vector,
 			 int __count);
+extern ssize_t __libc_writev (int __fd, __const struct iovec *__vector,
+			      int __count);
 #endif
diff --git a/include/sys/wait.h b/include/sys/wait.h
index d1560b2b24..f1eceb1cf0 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -5,6 +5,7 @@
 extern __pid_t __waitpid (__pid_t __pid, int *__stat_loc,
 			  int __options);
 libc_hidden_proto (__waitpid)
+extern int __waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options);
 
 extern __pid_t __libc_waitpid (pid_t __pid, int *__stat_loc, int __options);
 extern __pid_t __libc_wait (int *__stat_loc);
diff --git a/linuxthreads/Versions b/linuxthreads/Versions
index ec4e8730b3..4e4c6cc55e 100644
--- a/linuxthreads/Versions
+++ b/linuxthreads/Versions
@@ -20,8 +20,7 @@ libc {
   GLIBC_PRIVATE {
     # Internal libc interface to libpthread
     __libc_internal_tsd_get; __libc_internal_tsd_set;
-    __libc_internal_tsd_address;
-
+    __libc_internal_tsd_address; __libc_alloca_cutoff;
   }
 }
 
@@ -163,7 +162,7 @@ libpthread {
   GLIBC_PRIVATE {
     # Internal libc interface to libpthread
     __libc_internal_tsd_get; __libc_internal_tsd_set;
-    __libc_internal_tsd_address;
+    __libc_internal_tsd_address; __libc_alloca_cutoff;
     __pthread_kill_other_threads_np;
   }
 }
diff --git a/linuxthreads/descr.h b/linuxthreads/descr.h
index cc64cbc8aa..1e14823d83 100644
--- a/linuxthreads/descr.h
+++ b/linuxthreads/descr.h
@@ -165,6 +165,8 @@ struct _pthread_descr_struct {
 #ifdef USE_TLS
   char *p_stackaddr;		/* Stack address.  */
 #endif
+  size_t p_alloca_cutoff;	/* Maximum size which should be allocated
+				   using alloca() instead of malloc().  */
   /* New elements must be added at the end.  */
 } __attribute__ ((aligned(32))); /* We need to align the structure so that
 				    doubles are aligned properly.  This is 8
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index 08bf467815..cb9c33ecfb 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -334,7 +334,8 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
                                   char ** out_new_thread,
                                   char ** out_new_thread_bottom,
                                   char ** out_guardaddr,
-                                  size_t * out_guardsize)
+                                  size_t * out_guardsize,
+                                  size_t * out_stacksize)
 {
   pthread_descr new_thread;
   char * new_thread_bottom;
@@ -388,6 +389,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
       /* Clear the thread data structure.  */
       memset (new_thread, '\0', sizeof (*new_thread));
 #endif
+      stacksize = attr->__stacksize;
     }
   else
     {
@@ -559,6 +561,11 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
   *out_new_thread_bottom = new_thread_bottom;
   *out_guardaddr = guardaddr;
   *out_guardsize = guardsize;
+#ifdef NEED_SEPARATE_REGISTER_STACK
+  *out_stacksize = stacksize / 2;
+#else
+  *out_stacksize = stacksize;
+#endif
   return 0;
 }
 
@@ -575,7 +582,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   char * new_thread_bottom;
   pthread_t new_thread_id;
   char *guardaddr = NULL;
-  size_t guardsize = 0;
+  size_t guardsize = 0, stksize = 0;
   int pagesize = __getpagesize();
   int saved_errno = 0;
 
@@ -608,7 +615,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
 	continue;
       if (pthread_allocate_stack(attr, thread_segment(sseg),
 				 pagesize, &stack_addr, &new_thread_bottom,
-                                 &guardaddr, &guardsize) == 0)
+                                 &guardaddr, &guardsize, &stksize) == 0)
 	{
 #ifdef USE_TLS
 	  new_thread->p_stackaddr = stack_addr;
@@ -639,6 +646,8 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   new_thread->p_guardsize = guardsize;
   new_thread->p_nr = sseg;
   new_thread->p_inheritsched = attr ? attr->__inheritsched : 0;
+  new_thread->p_alloca_cutoff = stksize / 4 > __MAX_ALLOCA_CUTOFF
+				 ? __MAX_ALLOCA_CUTOFF : stksize / 4;
   /* Initialize the thread handle */
   __pthread_init_lock(&__pthread_handles[sseg].h_lock);
   __pthread_handles[sseg].h_descr = new_thread;
diff --git a/linuxthreads/no-tsd.c b/linuxthreads/no-tsd.c
index 099e7b49ae..de6c2945aa 100644
--- a/linuxthreads/no-tsd.c
+++ b/linuxthreads/no-tsd.c
@@ -38,3 +38,8 @@ void **(*__libc_internal_tsd_address) (enum __libc_tsd_key_t)
      __THROW __attribute__ ((__const__));
 
 #endif /* !(USE_TLS && HAVE___THREAD) */
+
+int __libc_alloca_cutoff (size_t size)
+{
+  return size <= __MAX_ALLOCA_CUTOFF;
+}
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 9281a414c9..e2042bdb74 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -63,58 +63,20 @@ static pthread_descr manager_thread;
 /* Descriptor of the initial thread */
 
 struct _pthread_descr_struct __pthread_initial_thread = {
-  {
-    {
-      .self = &__pthread_initial_thread /* pthread_descr self */
-    }
-  },
-  &__pthread_initial_thread,  /* pthread_descr p_nextlive */
-  &__pthread_initial_thread,  /* pthread_descr p_prevlive */
-  NULL,                       /* pthread_descr p_nextwaiting */
-  NULL,			      /* pthread_descr p_nextlock */
-  PTHREAD_THREADS_MAX,        /* pthread_t p_tid */
-  0,                          /* int p_pid */
-  0,                          /* int p_priority */
-  &__pthread_handles[0].h_lock, /* struct _pthread_fastlock * p_lock */
-  0,                          /* int p_signal */
-  NULL,                       /* sigjmp_buf * p_signal_buf */
-  NULL,                       /* sigjmp_buf * p_cancel_buf */
-  0,                          /* char p_terminated */
-  0,                          /* char p_detached */
-  0,                          /* char p_exited */
-  NULL,                       /* void * p_retval */
-  0,                          /* int p_retval */
-  NULL,                       /* pthread_descr p_joining */
-  NULL,                       /* struct _pthread_cleanup_buffer * p_cleanup */
-  0,                          /* char p_cancelstate */
-  0,                          /* char p_canceltype */
-  0,                          /* char p_canceled */
-  NULL,                       /* char * p_in_sighandler */
-  0,                          /* char p_sigwaiting */
-  PTHREAD_START_ARGS_INITIALIZER(NULL),
-                              /* struct pthread_start_args p_start_args */
-  {NULL},                     /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */
-  {NULL},                     /* void * p_libc_specific[_LIBC_TSD_KEY_N] */
-  &_errno,                    /* int *p_errnop */
-  0,                          /* int p_errno */
-  &_h_errno,                  /* int *p_h_errnop */
-  0,                          /* int p_h_errno */
-  &_res,		      /* struct __res_state *p_resp */
-  {},			      /* struct __res_state p_res */
-  1,                          /* int p_userstack */
-  NULL,                       /* void * p_guardaddr */
-  0,                          /* size_t p_guardsize */
-  0,                          /* Always index 0 */
-  0,                          /* int p_report_events */
-  {{{0, }}, 0, NULL},         /* td_eventbuf_t p_eventbuf */
-  __ATOMIC_INITIALIZER,       /* struct pthread_atomic p_resume_count */
-  0,                          /* char p_woken_by_cancel */
-  0,                          /* char p_condvar_avail */
-  0,                          /* char p_sem_avail */
-  NULL,                       /* struct pthread_extricate_if *p_extricate */
-  NULL,	                      /* pthread_readlock_info *p_readlock_list; */
-  NULL,                       /* pthread_readlock_info *p_readlock_free; */
-  0                           /* int p_untracked_readlock_count; */
+  .p_header.data.self = &__pthread_initial_thread,
+  .p_nextlive = &__pthread_initial_thread,
+  .p_prevlive = &__pthread_initial_thread,
+  .p_tid = PTHREAD_THREADS_MAX,
+  .p_lock = &__pthread_handles[0].h_lock,
+  .p_start_args = PTHREAD_START_ARGS_INITIALIZER(NULL),
+#if !(USE_TLS && HAVE___THREAD)
+  .p_errnop = &_errno,
+  .p_h_errnop = &_h_errno,
+  .p_resp = &_res,
+#endif
+  .p_userstack = 1,
+  .p_resume_count = __ATOMIC_INITIALIZER,
+  .p_alloca_cutoff = __MAX_ALLOCA_CUTOFF
 };
 
 /* Descriptor of the manager thread; none of this is used but the error
@@ -123,58 +85,15 @@ struct _pthread_descr_struct __pthread_initial_thread = {
 
 #define manager_thread (&__pthread_manager_thread)
 struct _pthread_descr_struct __pthread_manager_thread = {
-  {
-    {
-      .self = &__pthread_manager_thread /* pthread_descr self */
-    }
-  },
-  NULL,                       /* pthread_descr p_nextlive */
-  NULL,                       /* pthread_descr p_prevlive */
-  NULL,                       /* pthread_descr p_nextwaiting */
-  NULL,			      /* pthread_descr p_nextlock */
-  0,                          /* int p_tid */
-  0,                          /* int p_pid */
-  0,                          /* int p_priority */
-  &__pthread_handles[1].h_lock, /* struct _pthread_fastlock * p_lock */
-  0,                          /* int p_signal */
-  NULL,                       /* sigjmp_buf * p_signal_buf */
-  NULL,                       /* sigjmp_buf * p_cancel_buf */
-  0,                          /* char p_terminated */
-  0,                          /* char p_detached */
-  0,                          /* char p_exited */
-  NULL,                       /* void * p_retval */
-  0,                          /* int p_retval */
-  NULL,                       /* pthread_descr p_joining */
-  NULL,                       /* struct _pthread_cleanup_buffer * p_cleanup */
-  0,                          /* char p_cancelstate */
-  0,                          /* char p_canceltype */
-  0,                          /* char p_canceled */
-  NULL,                       /* char * p_in_sighandler */
-  0,                          /* char p_sigwaiting */
-  PTHREAD_START_ARGS_INITIALIZER(__pthread_manager),
-                              /* struct pthread_start_args p_start_args */
-  {NULL},                     /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */
-  {NULL},                     /* void * p_libc_specific[_LIBC_TSD_KEY_N] */
-  &__pthread_manager_thread.p_errno, /* int *p_errnop */
-  0,                          /* int p_errno */
-  NULL,                       /* int *p_h_errnop */
-  0,                          /* int p_h_errno */
-  NULL,			      /* struct __res_state *p_resp */
-  {},			      /* struct __res_state p_res */
-  0,                          /* int p_userstack */
-  NULL,                       /* void * p_guardaddr */
-  0,                          /* size_t p_guardsize */
-  1,                          /* Always index 1 */
-  0,                          /* int p_report_events */
-  {{{0, }}, 0, NULL},         /* td_eventbuf_t p_eventbuf */
-  __ATOMIC_INITIALIZER,       /* struct pthread_atomic p_resume_count */
-  0,                          /* char p_woken_by_cancel */
-  0,                          /* char p_condvar_avail */
-  0,                          /* char p_sem_avail */
-  NULL,                       /* struct pthread_extricate_if *p_extricate */
-  NULL,	                      /* pthread_readlock_info *p_readlock_list; */
-  NULL,                       /* pthread_readlock_info *p_readlock_free; */
-  0                           /* int p_untracked_readlock_count; */
+  .p_header.data.self = &__pthread_manager_thread,
+  .p_lock = &__pthread_handles[1].h_lock,
+  .p_start_args = PTHREAD_START_ARGS_INITIALIZER(__pthread_manager),
+#if !(USE_TLS && HAVE___THREAD)
+  .p_errnop = &__pthread_manager_thread.p_errno,
+#endif
+  .p_nr = 1,
+  .p_resume_count = __ATOMIC_INITIALIZER,
+  .p_alloca_cutoff = PTHREAD_STACK_MIN / 4
 };
 #endif
 
@@ -418,6 +337,7 @@ __pthread_initialize_minimal(void)
 # if __LT_SPINLOCK_INIT != 0
   self->p_resume_count = (struct pthread_atomic) __ATOMIC_INITIALIZER;
 # endif
+  self->p_alloca_cutoff = __MAX_ALLOCA_CUTOFF;
 
   /* Another variable which points to the thread descriptor.  */
   __pthread_main_thread = self;
@@ -487,6 +407,15 @@ __pthread_init_max_stacksize(void)
   }
 #endif
   __pthread_max_stacksize = max_stack;
+  if (max_stack / 4 < __MAX_ALLOCA_CUTOFF)
+    {
+#ifdef USE_TLS
+      pthread_descr self = THREAD_SELF;
+      self->p_alloca_cutoff = max_stack / 4;
+#else
+      __pthread_initial_thread.p_alloca_cutoff = max_stack / 4;
+#endif
+    }
 }
 
 
@@ -629,6 +558,7 @@ int __pthread_initialize_manager(void)
 # if __LT_SPINLOCK_INIT != 0
   self->p_resume_count = (struct pthread_atomic) __ATOMIC_INITIALIZER;
 # endif
+  tcb->p_alloca_cutoff = PTHREAD_STACK_MIN / 4;
 #else
   tcb = &__pthread_manager_thread;
 #endif
diff --git a/linuxthreads/specific.c b/linuxthreads/specific.c
index c5d742d978..17e62e82b7 100644
--- a/linuxthreads/specific.c
+++ b/linuxthreads/specific.c
@@ -239,3 +239,9 @@ void **(*const __libc_internal_tsd_address) (enum __libc_tsd_key_t key)
      __THROW __attribute__ ((__const__)) = libc_internal_tsd_address;
 
 #endif
+
+int __libc_alloca_cutoff (size_t size)
+{
+  pthread_descr self = thread_self();
+  return size <= THREAD_GETMEM_NC(self, p_alloca_cutoff);
+}
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h b/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h
new file mode 100644
index 0000000000..f62f7d6e9f
--- /dev/null
+++ b/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h
@@ -0,0 +1,26 @@
+/* Determine whether block of given size can be allocated on the stack or not.
+   Copyright (C) 2002 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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <limits.h>
+
+extern inline int __libc_use_alloca (size_t size)
+{
+  return (__builtin_expect (size <= PTHREAD_STACK_MIN / 4, 1)
+	  || __libc_alloca_cutoff (size));
+}
diff --git a/misc/Versions b/misc/Versions
index 08834ca0a1..f05915a28e 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -127,6 +127,10 @@ libc {
     # s*
     setxattr;
   }
+  GLIBC_2.3.1 {
+    # Support for cancellation points.
+    __libc_readv; __libc_writev;
+  }
   GLIBC_PRIVATE {
     # functions which have an additional interface since they are
     # cancelable.
diff --git a/posix/Versions b/posix/Versions
index 07dc49a4d4..c81f357ddd 100644
--- a/posix/Versions
+++ b/posix/Versions
@@ -114,5 +114,6 @@ libc {
     # are cancelable.
     __libc_wait; __libc_waitpid; __libc_pause; __libc_nanosleep; __libc_fork;
     __libc_pread; __libc_pread64; __libc_pwrite; __libc_pwrite64;
+    __waitid;
   }
 }
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 1ab102b420..797af94874 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -510,10 +510,11 @@ gethostbyname2(name, af)
 	const char *name;
 	int af;
 {
-	querybuf buf;
+	querybuf *buf;
 	register const char *cp;
 	char *bp;
-	int n, size, type, len;
+	int n, size, type, len, use_malloc = 0;
+	struct hostent *ret;
 	extern struct hostent *_gethtbyname2();
 
 	if ((_res.options & RES_INIT) == 0 && __res_ninit(&_res) == -1) {
@@ -615,13 +616,26 @@ gethostbyname2(name, af)
 				break;
 		}
 
-	if ((n = res_nsearch(&_res, name, C_IN, type, buf.buf, sizeof(buf.buf))) < 0) {
+	if (!__libc_use_alloca (MAXPACKET)) {
+		buf = (querybuf *) malloc (sizeof (*buf));
+		if (buf == NULL) {
+			__set_h_errno (NETDB_INTERNAL);
+			return NULL;
+		}
+		use_malloc = 1;
+	} else
+		buf = (querybuf *) alloca (sizeof (*buf));
+
+	if ((n = res_nsearch(&_res, name, C_IN, type, buf->buf, sizeof(buf->buf))) < 0) {
 		dprintf("res_nsearch failed (%d)\n", n);
 		if (errno == ECONNREFUSED)
 			return (_gethtbyname2(name, af));
 		return (NULL);
 	}
-	return (getanswer(&buf, n, name, type));
+	ret = getanswer(buf, n, name, type);
+	if (use_malloc)
+		free (buf);
+	return ret;
 }
 
 struct hostent *
@@ -633,9 +647,9 @@ gethostbyaddr(addr, len, af)
 	const u_char *uaddr = (const u_char *)addr;
 	static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
 	static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
-	int n;
+	int n, use_malloc = 0;
 	socklen_t size;
-	querybuf buf;
+	querybuf *buf;
 	register struct hostent *hp;
 	char qbuf[MAXDNAME+1], *qp = NULL;
 #ifdef SUNSECURITY
@@ -696,18 +710,34 @@ gethostbyaddr(addr, len, af)
 	default:
 		abort();
 	}
-	n = res_nquery(&_res, qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf);
+
+	if (!__libc_use_alloca (MAXPACKET)) {
+		buf = (querybuf *) malloc (sizeof (*buf));
+		if (buf == NULL) {
+			__set_h_errno (NETDB_INTERNAL);
+			return NULL;
+		}
+		use_malloc = 1;
+	} else
+		buf = (querybuf *) alloca (sizeof (*buf));
+
+	n = res_nquery(&_res, qbuf, C_IN, T_PTR, buf->buf, sizeof buf->buf);
 	if (n < 0 && af == AF_INET6) {
 		strcpy(qp, "ip6.int");
-		n = res_nquery(&_res, qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf);
+		n = res_nquery(&_res, qbuf, C_IN, T_PTR, buf->buf, sizeof buf->buf);
 	}
 	if (n < 0) {
+		if (use_malloc)
+			free (buf);
 		dprintf("res_nquery failed (%d)\n", n);
 		if (errno == ECONNREFUSED)
 			return (_gethtbyaddr(addr, len, af));
 		return (NULL);
 	}
-	if (!(hp = getanswer(&buf, n, qbuf, T_PTR)))
+	hp = getanswer(buf, n, qbuf, T_PTR);
+	if (use_malloc)
+		free (buf);
+	if (!hp)
 		return (NULL);	/* h_errno was set by getanswer() */
 #ifdef SUNSECURITY
 	if (af == AF_INET) {
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index c7bfc13aab..39eccabbdf 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -132,12 +132,13 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result,
 			   char *buffer, size_t buflen, int *errnop,
 			   int *h_errnop)
 {
-  querybuf host_buffer;
+  querybuf *host_buffer;
   char tmp[NS_MAXDNAME];
   int size, type, n;
   const char *cp;
-  int map = 0;
+  int map = 0, use_malloc = 0;
   int olderr = errno;
+  enum nss_status status;
 
   if ((_res.options & RES_INIT) == 0 && __res_ninit (&_res) == -1)
     return NSS_STATUS_UNAVAIL;
@@ -169,8 +170,21 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result,
       && (cp = res_hostalias (&_res, name, tmp, sizeof (tmp))) != NULL)
     name = cp;
 
-  n = res_nsearch (&_res, name, C_IN, type, host_buffer.buf,
-		   sizeof (host_buffer.buf));
+  if (!__libc_use_alloca (MAXPACKET))
+    {
+      host_buffer = (querybuf *) malloc (sizeof (querybuf));
+      if (host_buffer == NULL)
+	{
+	  *errnop = ENOMEM;
+	  return NSS_STATUS_UNAVAIL;
+	}
+      use_malloc = 1;
+    }
+  else
+    host_buffer = (querybuf *) alloca (sizeof (querybuf));
+
+  n = res_nsearch (&_res, name, C_IN, type, host_buffer->buf,
+		   sizeof (host_buffer->buf));
   if (n < 0)
     {
       enum nss_status status = (errno == ECONNREFUSED
@@ -185,11 +199,15 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result,
 	 by having the RES_USE_INET6 bit in _res.options set, we try
 	 another lookup.  */
       if (af == AF_INET6 && (_res.options & RES_USE_INET6))
-	n = res_nsearch (&_res, name, C_IN, T_A, host_buffer.buf,
-			 sizeof (host_buffer.buf));
+	n = res_nsearch (&_res, name, C_IN, T_A, host_buffer->buf,
+			 sizeof (host_buffer->buf));
 
       if (n < 0)
-	return status;
+	{
+	  if (use_malloc)
+	    free (host_buffer);
+	  return status;
+	}
 
       map = 1;
 
@@ -197,8 +215,11 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result,
       result->h_length = INADDRSZ;;
     }
 
-  return getanswer_r (&host_buffer, n, name, type, result, buffer, buflen,
-		      errnop, h_errnop, map);
+  status = getanswer_r (host_buffer, n, name, type, result, buffer, buflen,
+			errnop, h_errnop, map);
+  if (use_malloc)
+    free (host_buffer);
+  return status;
 }
 
 
@@ -236,10 +257,10 @@ _nss_dns_gethostbyaddr_r (const void *addr, socklen_t len, int af,
     char *h_addr_ptrs[MAX_NR_ADDRS + 1];
     char linebuffer[0];
   } *host_data = (struct host_data *) buffer;
-  querybuf host_buffer;
+  querybuf *host_buffer;
   char qbuf[MAXDNAME+1], *qp = NULL;
   size_t size;
-  int n, status;
+  int n, status, use_malloc = 0;
   int olderr = errno;
 
   if ((_res.options & RES_INIT) == 0 && __res_ninit (&_res) == -1)
@@ -294,23 +315,40 @@ _nss_dns_gethostbyaddr_r (const void *addr, socklen_t len, int af,
       break;
     }
 
-  n = res_nquery (&_res, qbuf, C_IN, T_PTR, (u_char *)host_buffer.buf,
-		  sizeof host_buffer);
+  if (!__libc_use_alloca (MAXPACKET))
+    {
+      host_buffer = (querybuf *) malloc (sizeof (querybuf));
+      if (host_buffer == NULL)
+	{
+	  *errnop = ENOMEM;
+	  return NSS_STATUS_UNAVAIL;
+	}
+      use_malloc = 1;
+    }
+  else
+    host_buffer = (querybuf *) alloca (sizeof (querybuf));
+
+  n = res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer->buf,
+		  sizeof (host_buffer->buf));
   if (n < 0 && af == AF_INET6)
     {
       strcpy (qp, "ip6.int");
-      n = res_nquery (&_res, qbuf, C_IN, T_PTR, (u_char *)host_buffer.buf,
-		      sizeof host_buffer);
+      n = res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer->buf,
+		      sizeof (host_buffer->buf));
     }
   if (n < 0)
     {
       *h_errnop = h_errno;
       __set_errno (olderr);
+      if (use_malloc)
+	free (host_buffer);
       return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
     }
 
-  status = getanswer_r (&host_buffer, n, qbuf, T_PTR, result, buffer, buflen,
+  status = getanswer_r (host_buffer, n, qbuf, T_PTR, result, buffer, buflen,
 			errnop, h_errnop, 0 /* XXX */);
+  if (use_malloc)
+    free (host_buffer);
   if (status != NSS_STATUS_SUCCESS)
     {
       *h_errnop = h_errno;
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 774c868d2f..9a366aca65 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -110,27 +110,47 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
 			 int *herrnop)
 {
   /* Return entry for network with NAME.  */
-  querybuf net_buffer;
-  int anslen;
+  querybuf *net_buffer;
+  int anslen, use_malloc = 0;
   char *qbuf;
+  enum nss_status status;
 
   if ((_res.options & RES_INIT) == 0 && __res_ninit (&_res) == -1)
     return NSS_STATUS_UNAVAIL;
 
   qbuf = strdupa (name);
-  anslen = res_nsearch (&_res, qbuf, C_IN, T_PTR, (u_char *) &net_buffer,
-			sizeof (querybuf));
+
+  if (!__libc_use_alloca (MAXPACKET))
+    {
+      net_buffer = (querybuf *) malloc (sizeof (querybuf));
+      if (net_buffer == NULL)
+	{
+	  *errnop = ENOMEM;
+	  return NSS_STATUS_UNAVAIL;
+	}
+      use_malloc = 1;
+    }
+  else
+    net_buffer = (querybuf *) alloca (sizeof (querybuf));
+
+  anslen = res_nsearch (&_res, qbuf, C_IN, T_PTR, net_buffer->buf,
+			sizeof (net_buffer->buf));
   if (anslen < 0)
     {
       /* Nothing found.  */
       *errnop = errno;
+      if (use_malloc)
+	free (net_buffer);
       return (errno == ECONNREFUSED
 	      || errno == EPFNOSUPPORT
 	      || errno == EAFNOSUPPORT)
 	? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
     }
 
-  return getanswer_r (&net_buffer, anslen, result, buffer, buflen, BYNAME);
+  status = getanswer_r (net_buffer, anslen, result, buffer, buflen, BYNAME);
+  if (use_malloc)
+    free (net_buffer);
+  return status;
 }
 
 
@@ -141,10 +161,10 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
 {
   /* Return entry for network with NAME.  */
   enum nss_status status;
-  querybuf net_buffer;
+  querybuf *net_buffer;
   unsigned int net_bytes[4];
   char qbuf[MAXDNAME];
-  int cnt, anslen;
+  int cnt, anslen, use_malloc = 0;
   u_int32_t net2;
   int olderr = errno;
 
@@ -181,20 +201,37 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
       break;
     }
 
-  anslen = res_nquery (&_res, qbuf, C_IN, T_PTR, (u_char *) &net_buffer,
-		       sizeof (querybuf));
+  if (!__libc_use_alloca (MAXPACKET))
+    {
+      net_buffer = (querybuf *) malloc (sizeof (querybuf));
+      if (net_buffer == NULL)
+	{
+	  *errnop = ENOMEM;
+	  return NSS_STATUS_UNAVAIL;
+	}
+      use_malloc = 1;
+    }
+  else
+    net_buffer = (querybuf *) alloca (sizeof (querybuf));
+
+  anslen = res_nquery (&_res, qbuf, C_IN, T_PTR, net_buffer->buf,
+		       sizeof (net_buffer->buf));
   if (anslen < 0)
     {
       /* Nothing found.  */
       int err = errno;
       __set_errno (olderr);
+      if (use_malloc)
+	free (net_buffer);
       return (err == ECONNREFUSED
 	      || err == EPFNOSUPPORT
 	      || err == EAFNOSUPPORT)
 	? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
     }
 
-  status = getanswer_r (&net_buffer, anslen, result, buffer, buflen, BYADDR);
+  status = getanswer_r (net_buffer, anslen, result, buffer, buflen, BYADDR);
+  if (use_malloc)
+    free (net_buffer);
   if (status == NSS_STATUS_SUCCESS)
     {
       /* Strip trailing zeros.  */
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 866a2bba55..968ba8b4e8 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -108,28 +108,42 @@ res_nquery(res_state statp,
 	   u_char *answer,	/* buffer to put answer */
 	   int anslen)		/* size of answer buffer */
 {
-	u_char buf[MAXPACKET];
+	u_char *buf;
 	HEADER *hp = (HEADER *) answer;
-	int n;
+	int n, use_malloc = 0;
 
 	hp->rcode = NOERROR;	/* default */
 
+	if (!__libc_use_alloca (MAXPACKET)) {
+		buf = malloc (MAXPACKET);
+		if (buf == NULL) {
+			__set_h_errno (NETDB_INTERNAL);
+			return -1;
+		}
+		use_malloc = 1;
+	} else
+		buf = alloca (MAXPACKET);
+
 #ifdef DEBUG
 	if (statp->options & RES_DEBUG)
 		printf(";; res_query(%s, %d, %d)\n", name, class, type);
 #endif
 
 	n = res_nmkquery(statp, QUERY, name, class, type, NULL, 0, NULL,
-			 buf, sizeof(buf));
+			 buf, MAXPACKET);
 	if (n <= 0) {
 #ifdef DEBUG
 		if (statp->options & RES_DEBUG)
 			printf(";; res_query: mkquery failed\n");
 #endif
 		RES_SET_H_ERRNO(statp, NO_RECOVERY);
+		if (use_malloc)
+			free (buf);
 		return (n);
 	}
 	n = res_nsend(statp, buf, n, answer, anslen);
+	if (use_malloc)
+		free (buf);
 	if (n < 0) {
 #ifdef DEBUG
 		if (statp->options & RES_DEBUG)
diff --git a/signal/Versions b/signal/Versions
index 0217a4089d..c53276b084 100644
--- a/signal/Versions
+++ b/signal/Versions
@@ -49,4 +49,7 @@ libc {
     # Needed to provide a pointer to the XPG sigpause function.
     __xpg_sigpause;
   }
+  GLIBC_PRIVATE {
+    __sigtimedwait; __sigwait; __sigwaitinfo;
+  }
 }
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index e746101ddf..0f0c68eb88 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -869,7 +869,7 @@ __printf_fp (FILE *fp,
        it is possible that we need two more characters in front of all the
        other output.  If the amount of memory we have to allocate is too
        large use `malloc' instead of `alloca'.  */
-    buffer_malloced = chars_needed > 5000;
+    buffer_malloced = ! __libc_use_alloca (chars_needed * 2 * sizeof (wchar_t));
     if (buffer_malloced)
       {
 	wbuffer = (wchar_t *) malloc ((2 + chars_needed) * sizeof (wchar_t));
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 788290b803..4f9cd9b424 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1039,7 +1039,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 									      \
 	    /* Allocate dynamically an array which definitely is long	      \
 	       enough for the wide character version.  */		      \
-	    if (len < 8192)						      \
+	    if (__libc_use_alloca (len * sizeof (wchar_t)))		      \
 	      string = (CHAR_T *) alloca (len * sizeof (wchar_t));	      \
 	    else if ((string = (CHAR_T *) malloc (len * sizeof (wchar_t)))    \
 		     == NULL)						      \
@@ -1201,7 +1201,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	    if (prec >= 0)						      \
 	      {								      \
 		/* The string `s2' might not be NUL terminated.  */	      \
-		if (prec < 32768)					      \
+		if (__libc_use_alloca (prec))				      \
 		  string = (char *) alloca (prec);			      \
 		else if ((string = (char *) malloc (prec)) == NULL)	      \
 		  {							      \
@@ -1219,7 +1219,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 		  {							      \
 		    assert (__mbsinit (&mbstate));			      \
 		    s2 = (const wchar_t *) string;			      \
-		    if (len + 1 < 32768)				      \
+		    if (__libc_use_alloca (len + 1))			      \
 		      string = (char *) alloca (len + 1);		      \
 		    else if ((string = (char *) malloc (len + 1)) == NULL)    \
 		      {							      \
@@ -1448,7 +1448,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	  {
 	    /* We have to use a special buffer.  The "32" is just a safe
 	       bet for all the output which is not counted in the width.  */
-	    if (width < (int) (32768 / sizeof (CHAR_T)))
+	    if (__libc_use_alloca ((width + 32) * sizeof (CHAR_T)))
 	      workend = ((CHAR_T *) alloca ((width + 32) * sizeof (CHAR_T))
 			 + (width + 32));
 	    else
@@ -1473,7 +1473,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	{
 	  /* We have to use a special buffer.  The "32" is just a safe
 	     bet for all the output which is not counted in the width.  */
-	  if (width < (int) (32768 / sizeof (CHAR_T)))
+	  if (__libc_use_alloca ((width + 32) * sizeof (CHAR_T)))
 	    workend = ((CHAR_T *) alloca ((width + 32) * sizeof (CHAR_T))
 		       + (width + 32));
 	  else
@@ -1516,8 +1516,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       if (prec > width
 	  && prec + 32 > (int)(sizeof (work_buffer) / sizeof (work_buffer[0])))
 	{
-	  if (prec < (int) (32768 / sizeof (CHAR_T)))
-	    workend = alloca (prec + 32) + (prec + 32);
+	  if (__libc_use_alloca ((prec + 32) * sizeof (CHAR_T)))
+	    workend = ((CHAR_T *) alloca ((prec + 32) * sizeof (CHAR_T)))
+		      + (prec + 32);
 	  else
 	    {
 	      workstart = (CHAR_T *) malloc ((prec + 32) * sizeof (CHAR_T));
@@ -1832,7 +1833,8 @@ do_positional:
 	if (MAX (prec, width) + 32 > (int) (sizeof (work_buffer)
 					    / sizeof (CHAR_T)))
 	  {
-	    if (MAX (prec, width) < (int) (32768 / sizeof (CHAR_T)))
+	    if (__libc_use_alloca ((MAX (prec, width) + 32)
+				   * sizeof (CHAR_T)))
 	      workend = ((CHAR_T *) alloca ((MAX (prec, width) + 32)
 					    * sizeof (CHAR_T))
 			 + (MAX (prec, width) + 32));
diff --git a/string/strcoll.c b/string/strcoll.c
index 3c5682d1cd..26072018ac 100644
--- a/string/strcoll.c
+++ b/string/strcoll.c
@@ -155,7 +155,7 @@ STRCOLL (s1, s2, l)
 
      Please note that the localedef programs makes sure that `position'
      is not used at the first level.  */
-  if (s1len + s2len >= 16384)
+  if (! __libc_use_alloca (s1len + s2len))
     {
       idx1arr = (int32_t *) malloc ((s1len + s2len) * (sizeof (int32_t) + 1));
       idx2arr = &idx1arr[s1len];
diff --git a/string/strxfrm.c b/string/strxfrm.c
index c53dad5555..6475fa9206 100644
--- a/string/strxfrm.c
+++ b/string/strxfrm.c
@@ -175,7 +175,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
      values.  But since there is no limit on the length of the string
      we have to use `malloc' if the string is too long.  We should be
      very conservative here.  */
-  if (srclen >= 16384)
+  if (! __libc_use_alloca (srclen))
     {
       idxarr = (int32_t *) malloc ((srclen + 1) * (sizeof (int32_t) + 1));
       rulearr = (unsigned char *) &idxarr[srclen];
diff --git a/sysdeps/generic/allocalim.h b/sysdeps/generic/allocalim.h
new file mode 100644
index 0000000000..2491129a7d
--- /dev/null
+++ b/sysdeps/generic/allocalim.h
@@ -0,0 +1,4 @@
+extern inline int __libc_use_alloca (size_t size)
+{
+  return size <= __MAX_ALLOCA_CUTOFF;
+}
diff --git a/sysdeps/generic/readv.c b/sysdeps/generic/readv.c
index 82f86965de..b33444c036 100644
--- a/sysdeps/generic/readv.c
+++ b/sysdeps/generic/readv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 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
@@ -26,7 +26,7 @@
    Operates just like `read' (see <unistd.h>) except that data are
    put in VECTOR instead of a contiguous buffer.  */
 ssize_t
-__readv (fd, vector, count)
+__libc_readv (fd, vector, count)
      int fd;
      const struct iovec *vector;
      int count;
@@ -34,7 +34,8 @@ __readv (fd, vector, count)
   __set_errno (ENOSYS);
   return -1;
 }
-weak_alias (__readv, readv)
+strong_alias (__libc_readv, __readv)
+weak_alias (__libc_readv, readv)
 
 stub_warning (readv)
 #include <stub-tag.h>
diff --git a/sysdeps/generic/waitid.c b/sysdeps/generic/waitid.c
index 9e2a3da9ad..a9de1a19a5 100644
--- a/sysdeps/generic/waitid.c
+++ b/sysdeps/generic/waitid.c
@@ -1,5 +1,5 @@
 /* Stub version of waitid.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -23,7 +23,7 @@
 #include <sys/wait.h>
 
 int
-waitid (idtype, id, infop, options)
+__waitid (idtype, id, infop, options)
      idtype_t idtype;
      id_t id;
      siginfo_t *infop;
@@ -32,3 +32,4 @@ waitid (idtype, id, infop, options)
   __set_errno (ENOSYS);
   return -1;
 }
+weak_alias (__waitid, waitid)
diff --git a/sysdeps/generic/writev.c b/sysdeps/generic/writev.c
index 3bfc0be877..d424c72143 100644
--- a/sysdeps/generic/writev.c
+++ b/sysdeps/generic/writev.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 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
@@ -26,7 +26,7 @@
    Operates just like `write' (see <unistd.h>) except that the data
    are taken from VECTOR instead of a contiguous buffer.  */
 ssize_t
-__writev (fd, vector, count)
+__libc_writev (fd, vector, count)
      int fd;
      const struct iovec *vector;
      int count;
@@ -34,7 +34,8 @@ __writev (fd, vector, count)
   __set_errno (ENOSYS);
   return -1;
 }
-weak_alias (__writev, writev)
+strong_alias (__libc_writev, __writev)
+weak_alias (__libc_writev, writev)
 
 stub_warning (writev)
 #include <stub-tag.h>
diff --git a/sysdeps/posix/readv.c b/sysdeps/posix/readv.c
index bb6634529d..bde57b44fa 100644
--- a/sysdeps/posix/readv.c
+++ b/sysdeps/posix/readv.c
@@ -30,7 +30,7 @@
    Operates just like `read' (see <unistd.h>) except that data are
    put in VECTOR instead of a contiguous buffer.  */
 ssize_t
-__readv (int fd, const struct iovec *vector, int count)
+__libc_readv (int fd, const struct iovec *vector, int count)
 {
   char *buffer;
   char *buffer_start;
@@ -55,8 +55,8 @@ __readv (int fd, const struct iovec *vector, int count)
   /* Allocate a temporary buffer to hold the data.  We should normally
      use alloca since it's faster and does not require synchronization
      with other threads.  But we cannot if the amount of memory
-     required is too large.  Use 512k as the limit.  */
-  if (bytes < 512 * 1024)
+     required is too large.  */
+  if (__libc_use_alloca (bytes))
     buffer = (char *) __alloca (bytes);
   else
     {
@@ -94,6 +94,7 @@ __readv (int fd, const struct iovec *vector, int count)
 
   return bytes_read;
 }
-#ifndef __readv
-weak_alias (__readv, readv)
+#ifndef __libc_readv
+strong_alias (__libc_readv, __readv)
+weak_alias (__libc_readv, readv)
 #endif
diff --git a/sysdeps/posix/waitid.c b/sysdeps/posix/waitid.c
index dcb93b6769..8687436309 100644
--- a/sysdeps/posix/waitid.c
+++ b/sysdeps/posix/waitid.c
@@ -1,5 +1,5 @@
 /* Pseudo implementation of waitid.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1997.
 
@@ -28,7 +28,7 @@
 #include <assert.h>
 
 int
-waitid (idtype, id, infop, options)
+__waitid (idtype, id, infop, options)
      idtype_t idtype;
      id_t id;
      siginfo_t *infop;
@@ -118,3 +118,4 @@ waitid (idtype, id, infop, options)
 
   return 0;
 }
+weak_alias (__waitid, waitid)
diff --git a/sysdeps/posix/writev.c b/sysdeps/posix/writev.c
index 7afdce3289..ae5ef1efb4 100644
--- a/sysdeps/posix/writev.c
+++ b/sysdeps/posix/writev.c
@@ -30,7 +30,7 @@
    Operates just like `write' (see <unistd.h>) except that the data
    are taken from VECTOR instead of a contiguous buffer.  */
 ssize_t
-__writev (int fd, const struct iovec *vector, int count)
+__libc_writev (int fd, const struct iovec *vector, int count)
 {
   char *buffer;
   register char *bp;
@@ -55,8 +55,8 @@ __writev (int fd, const struct iovec *vector, int count)
   /* Allocate a temporary buffer to hold the data.  We should normally
      use alloca since it's faster and does not require synchronization
      with other threads.  But we cannot if the amount of memory
-     required is too large.  Use 512k as the limit.  */
-  if (bytes < 512 * 1024)
+     required is too large.  */
+  if (__libc_use_alloca (bytes))
     buffer = (char *) __alloca (bytes);
   else
     {
@@ -90,6 +90,7 @@ __writev (int fd, const struct iovec *vector, int count)
 
   return bytes_written;
 }
-#ifndef __writev
-weak_alias (__writev, writev)
+#ifndef __libc_writev
+strong_alias (__libc_writev, __writev)
+weak_alias (__libc_writev, writev)
 #endif
diff --git a/sysdeps/unix/sysv/aix/readv.c b/sysdeps/unix/sysv/aix/readv.c
index 8c12690993..eddca0fc87 100644
--- a/sysdeps/unix/sysv/aix/readv.c
+++ b/sysdeps/unix/sysv/aix/readv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995-1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995-1998, 2000, 2002 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,11 +27,12 @@ extern ssize_t kreadv (int fd, const struct iovec *iovp, size_t iovcnt,
    Operates just like `read' (see <unistd.h>) except that data are
    put in VECTOR instead of a contiguous buffer.  */
 ssize_t
-__readv (fd, vector, count)
+__libc_readv (fd, vector, count)
      int fd;
      const struct iovec *vector;
      int count;
 {
   return kreadv (fd, vector, count, 0);
 }
-strong_alias (__readv, readv)
+strong_alias (__libc_readv, __readv)
+weak_alias (__libc_readv, readv)
diff --git a/sysdeps/unix/sysv/aix/waitid.c b/sysdeps/unix/sysv/aix/waitid.c
index 36a012ef02..1d637df76e 100644
--- a/sysdeps/unix/sysv/aix/waitid.c
+++ b/sysdeps/unix/sysv/aix/waitid.c
@@ -1,5 +1,5 @@
 /* Pseudo implementation of waitid.
-   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1997.
 
@@ -31,7 +31,7 @@ extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options,
 		       struct rusage *ru_loc, siginfo_t *infop);
 
 int
-waitid (idtype, id, infop, options)
+__waitid (idtype, id, infop, options)
      idtype_t idtype;
      id_t id;
      siginfo_t *infop;
@@ -80,3 +80,4 @@ waitid (idtype, id, infop, options)
 
   return 0;
 }
+weak_alias (__waitid, waitid)
diff --git a/sysdeps/unix/sysv/aix/writev.c b/sysdeps/unix/sysv/aix/writev.c
index 0d5a3335af..d0e5741590 100644
--- a/sysdeps/unix/sysv/aix/writev.c
+++ b/sysdeps/unix/sysv/aix/writev.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995-1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995-1998, 2000, 2002 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,11 +27,12 @@ extern ssize_t kwritev (int fd, const struct iovec *iovp, size_t iovcnt,
    Operates just like `read' (see <unistd.h>) except that data are
    put in VECTOR instead of a contiguous buffer.  */
 ssize_t
-__writev (fd, vector, count)
+__libc_writev (fd, vector, count)
      int fd;
      const struct iovec *vector;
      int count;
 {
   return kwritev (fd, vector, count, 0);
 }
-strong_alias (__writev, writev)
+strong_alias (__libc_writev, __writev)
+weak_alias (__libc_writev, writev)
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index ab437920c9..fdc13ff0fa 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -36,7 +36,7 @@ struct ipc_kludge
 
 
 int
-msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
+__libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
      int msqid;
      void *msgp;
      size_t msgsz;
@@ -52,3 +52,4 @@ msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
 
   return INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg, __ptrvalue (&tmp));
 }
+weak_alias (__libc_msgrcv, msgrcv)
diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
index f4df5da425..7beba6b198 100644
--- a/sysdeps/unix/sysv/linux/msgsnd.c
+++ b/sysdeps/unix/sysv/linux/msgsnd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,1999,2000,2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
 
@@ -27,7 +27,7 @@
 #include <bp-checks.h>
 
 int
-msgsnd (msqid, msgp, msgsz, msgflg)
+__libc_msgsnd (msqid, msgp, msgsz, msgflg)
      int msqid;
      const void *msgp;
      size_t msgsz;
@@ -36,3 +36,4 @@ msgsnd (msqid, msgp, msgsz, msgflg)
   return INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
 			 msgflg, (void *) CHECK_N (msgp, msgsz));
 }
+weak_alias (__libc_msgsnd, msgsnd)
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index 601afc09e5..eeba46a09d 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -40,7 +40,7 @@ static ssize_t __atomic_readv_replacement (int, __const struct iovec *,
 /* We should deal with kernel which have a smaller UIO_FASTIOV as well
    as a very big count.  */
 ssize_t
-__readv (fd, vector, count)
+__libc_readv (fd, vector, count)
      int fd;
      const struct iovec *vector;
      int count;
@@ -54,7 +54,8 @@ __readv (fd, vector, count)
 
   return __atomic_readv_replacement (fd, vector, count);
 }
-weak_alias (__readv, readv)
+strong_alias (__libc_readv, __readv)
+weak_alias (__libc_readv, readv)
 
-#define __readv static internal_function __atomic_readv_replacement
+#define __libc_readv static internal_function __atomic_readv_replacement
 #include <sysdeps/posix/readv.c>
diff --git a/sysdeps/unix/sysv/linux/sigtimedwait.c b/sysdeps/unix/sysv/linux/sigtimedwait.c
index e96117b548..c374287ea6 100644
--- a/sysdeps/unix/sysv/linux/sigtimedwait.c
+++ b/sysdeps/unix/sysv/linux/sigtimedwait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2002 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
@@ -40,6 +40,7 @@ __sigtimedwait (set, info, timeout)
   return INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
 			 CHECK_1 (info), timeout, _NSIG / 8);
 }
+libc_hidden_def (__sigtimedwait)
 weak_alias (__sigtimedwait, sigtimedwait)
 #else
 # include <sysdeps/generic/sigtimedwait.c>
diff --git a/sysdeps/unix/sysv/linux/sigwait.c b/sysdeps/unix/sysv/linux/sigwait.c
index 39cc3e9750..6eb4cf9532 100644
--- a/sysdeps/unix/sysv/linux/sigwait.c
+++ b/sysdeps/unix/sysv/linux/sigwait.c
@@ -53,6 +53,7 @@ __sigwait (set, sig)
 
   return ret;
 }
+libc_hidden_def (__sigwait)
 weak_alias (__sigwait, sigwait)
 #else
 # include <sysdeps/posix/sigwait.c>
diff --git a/sysdeps/unix/sysv/linux/sigwaitinfo.c b/sysdeps/unix/sysv/linux/sigwaitinfo.c
index b59ee54fc1..b1569bc67f 100644
--- a/sysdeps/unix/sysv/linux/sigwaitinfo.c
+++ b/sysdeps/unix/sysv/linux/sigwaitinfo.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2002 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
@@ -41,6 +41,7 @@ __sigwaitinfo (set, info)
   return INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
 			 CHECK_1 (info), NULL, _NSIG / 8);
 }
+libc_hidden_def (__sigwaitinfo)
 weak_alias (__sigwaitinfo, sigwaitinfo)
 #else
 # include <sysdeps/generic/sigwaitinfo.c>
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 5ab190b97c..5fcc9b5d9a 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -4,6 +4,7 @@ adjtimex	adjtime	adjtimex	i:p	__adjtimex	adjtimex ntp_adjtime __adjtimex_interna
 bdflush		EXTRA	bdflush		i:ii	bdflush
 capget		EXTRA	capget		i:pp	capget
 capset		EXTRA	capset		i:pp	capset
+creat		-	creat		i:si	creat
 create_module	EXTRA	create_module	3	create_module
 delete_module	EXTRA	delete_module	3	delete_module
 fdatasync	-	fdatasync	i:i	fdatasync
@@ -79,4 +80,3 @@ flistxattr	EXTRA	flistxattr	i:isi	flistxattr
 removexattr	EXTRA	removexattr	i:ss	removexattr
 lremovexattr	EXTRA	lremovexattr	i:ss	lremovexattr
 fremovexattr	EXTRA	fremovexattr	i:is	fremovexattr
-
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
index 729fd9aca5..76cc920dae 100644
--- a/sysdeps/unix/sysv/linux/writev.c
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -40,7 +40,7 @@ static ssize_t __atomic_writev_replacement (int, const struct iovec *,
 /* We should deal with kernel which have a smaller UIO_FASTIOV as well
    as a very big count.  */
 ssize_t
-__writev (fd, vector, count)
+__libc_writev (fd, vector, count)
      int fd;
      const struct iovec *vector;
      int count;
@@ -54,7 +54,8 @@ __writev (fd, vector, count)
 
   return __atomic_writev_replacement (fd, vector, count);
 }
-weak_alias (__writev, writev)
+strong_alias (__libc_writev, __writev)
+weak_alias (__libc_writev, writev)
 
-#define __writev static internal_function __atomic_writev_replacement
+#define __libc_writev static internal_function __atomic_writev_replacement
 #include <sysdeps/posix/writev.c>
diff --git a/sysvipc/Versions b/sysvipc/Versions
index cc9284fc7a..93c322e61a 100644
--- a/sysvipc/Versions
+++ b/sysvipc/Versions
@@ -9,4 +9,8 @@ libc {
     # s*
     semctl; semget; semop; shmat; shmctl; shmdt; shmget;
   }
+  GLIBC_2.3.1 {
+    # Cancellation point entries.
+    __libc_msgrcv; __libc_msgsnd;
+  }
 }