]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 9 Oct 2002 09:42:48 +0000 (09:42 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 9 Oct 2002 09:42:48 +0000 (09:42 +0000)
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.

43 files changed:
ChangeLog
include/alloca.h
include/signal.h
include/sys/msg.h
include/sys/uio.h
include/sys/wait.h
linuxthreads/Versions
linuxthreads/descr.h
linuxthreads/manager.c
linuxthreads/no-tsd.c
linuxthreads/pthread.c
linuxthreads/specific.c
linuxthreads/sysdeps/unix/sysv/linux/allocalim.h [new file with mode: 0644]
misc/Versions
posix/Versions
resolv/gethnamaddr.c
resolv/nss_dns/dns-host.c
resolv/nss_dns/dns-network.c
resolv/res_query.c
signal/Versions
stdio-common/printf_fp.c
stdio-common/vfprintf.c
string/strcoll.c
string/strxfrm.c
sysdeps/generic/allocalim.h [new file with mode: 0644]
sysdeps/generic/readv.c
sysdeps/generic/waitid.c
sysdeps/generic/writev.c
sysdeps/posix/readv.c
sysdeps/posix/waitid.c
sysdeps/posix/writev.c
sysdeps/unix/sysv/aix/readv.c
sysdeps/unix/sysv/aix/waitid.c
sysdeps/unix/sysv/aix/writev.c
sysdeps/unix/sysv/linux/msgrcv.c
sysdeps/unix/sysv/linux/msgsnd.c
sysdeps/unix/sysv/linux/readv.c
sysdeps/unix/sysv/linux/sigtimedwait.c
sysdeps/unix/sysv/linux/sigwait.c
sysdeps/unix/sysv/linux/sigwaitinfo.c
sysdeps/unix/sysv/linux/syscalls.list
sysdeps/unix/sysv/linux/writev.c
sysvipc/Versions

index 6a1dcfb00883dafbbb943c10dafbd8c0e24a5084..481d2b2e50a708588ba01910a7407c4c15eeb267 100644 (file)
--- 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
index 3a480f8e24a8c1d589cc00a85699584d3b9839c8..9536fe0f1fd38a1f9ceb74b27c44fd7eb9ad14c2 100644 (file)
@@ -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
index 4196a6f012afdc9a8d23570c1d12a10ad5fb8593..3d599ef19a6eb23014a1b0c444e201fc97b36972 100644 (file)
@@ -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,
index 0f8026dda1aa789257132c763e699e2e254cb433..02bb9aefd0ee23f4d3ee43863ecf1906d90fa93d 100644 (file)
@@ -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
index 09bdce2b2262f19ab37bfb2f5088129b9bc05079..8c2b0167c18292fc05f574e8e8b3f3b2a155a5e5 100644 (file)
@@ -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
index d1560b2b24212a986f6bb8c9c5cc266714a373d8..f1eceb1cf0781404b4b74f4779206602bc5be716 100644 (file)
@@ -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);
index ec4e8730b3b803e254a4b97d641fa89f248ded55..4e4c6cc55ee71637993538f965f4cd223e0d115d 100644 (file)
@@ -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;
   }
 }
index cc64cbc8aa0ec3bba0c5efeec135e9f092005f60..1e14823d83c3627383d5ed64e383f075a940ee7f 100644 (file)
@@ -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
index 08bf4678158872a233430205e42e39ff44a3fe53..cb9c33ecfb6aafdc2fa1a4136e8a6dc5f9ba614a 100644 (file)
@@ -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;
index 099e7b49aeb2365eb9f7a2bc24d3ed07b9b106be..de6c2945aaa822822c1f09669b4b39099a0ffa00 100644 (file)
@@ -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;
+}
index 9281a414c996f3b192a123643d88b33fd4146f1c..e2042bdb74292acdc2dee53cc9be912cd9a76741 100644 (file)
@@ -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
index c5d742d9782418305820037dc36de8906ff953bb..17e62e82b719d9b4d1a94077360af900b309ad9c 100644 (file)
@@ -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 (file)
index 0000000..f62f7d6
--- /dev/null
@@ -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));
+}
index 08834ca0a1648345c508cf295515aac3527d2278..f05915a28ee82802d13af245d4f7391ca7080518 100644 (file)
@@ -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.
index 07dc49a4d4069243c79d397f08f919db9a673db7..c81f357ddde48dbf705f6ce42ac3537a6f92777b 100644 (file)
@@ -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;
   }
 }
index 1ab102b4200375cb21d1bbfea903b26aa471f0e3..797af94874c5c0864beaace6ac28e73b5b6cec9f 100644 (file)
@@ -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) {
index c7bfc13aabfc3e258b43acf37e4065c15c33949b..39eccabbdff942d3644faf552653964597a7aaa8 100644 (file)
@@ -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;
index 774c868d2f6d3eaf7d8008b89e922d9781294ea5..9a366aca65b6ca3aec81f3791116bf309b1ee01f 100644 (file)
@@ -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.  */
index 866a2bba551cacad38789edc2ef2b80b9b5d4990..968ba8b4e854c34a5f338a821d3f7a7875c204cb 100644 (file)
@@ -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)
index 0217a4089d2e958ccc8f6a6c7e25553a3b15b2dd..c53276b08489b55a8a1fd981cc5a1d2135367378 100644 (file)
@@ -49,4 +49,7 @@ libc {
     # Needed to provide a pointer to the XPG sigpause function.
     __xpg_sigpause;
   }
+  GLIBC_PRIVATE {
+    __sigtimedwait; __sigwait; __sigwaitinfo;
+  }
 }
index e746101ddf37f671e7b18e0715bb255cd405b1d9..0f0c68eb88035caeded14bc832720c252b8ac302 100644 (file)
@@ -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));
index 788290b803bd2cc695b89d47ca024855a60d49e5..4f9cd9b424edc55ac8645bf9feaa05bd17a190aa 100644 (file)
@@ -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));
index 3c5682d1cd39be7298e98deec31c257074effc36..26072018ac41321ad674f1f3954a6bd539f7d7d1 100644 (file)
@@ -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];
index c53dad55554a5e2e7a60e40408eb0031199b4eab..6475fa9206d924f5e1b17510fd348fe360f14f44 100644 (file)
@@ -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 (file)
index 0000000..2491129
--- /dev/null
@@ -0,0 +1,4 @@
+extern inline int __libc_use_alloca (size_t size)
+{
+  return size <= __MAX_ALLOCA_CUTOFF;
+}
index 82f86965de5617e9bf3114553e309a5806efb0f3..b33444c036e51ccef280d26897a220cf7af91189 100644 (file)
@@ -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>
index 9e2a3da9ad60cf5a30fa2dd6fdf3fb4451a5e2c9..a9de1a19a5c9331d435d635b84de98a4ed75bcce 100644 (file)
@@ -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)
index 3bfc0be8776b11dc3b08c5c9c5670153f9fee261..d424c72143f6769159d1eed1083048643369648e 100644 (file)
@@ -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>
index bb6634529dc8b257d0a39dac3abe89794cf62fd8..bde57b44fa2106bdc622c9e02fa315e8f81bba2a 100644 (file)
@@ -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
index dcb93b67690012646eb2677fc1d649599c9fe974..8687436309b0ca684cc664434416c01c1ce92dd1 100644 (file)
@@ -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)
index 7afdce3289c574147406430323b2ef8b1d2e119c..ae5ef1efb4bb01f9518f65658e68e9ca13f9e71e 100644 (file)
@@ -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
index 8c126909936a498f04e289c8cf0d153fae7bbb1e..eddca0fc87463f753666c325ba4e6d92d78ca3d9 100644 (file)
@@ -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)
index 36a012ef022f8e6f1c67dcd814350a102196d1e0..1d637df76e4f69d1ab7d1526605467a48ca9482d 100644 (file)
@@ -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)
index 0d5a3335af4bdb9e4eac1393fe1186ef4cc546c5..d0e5741590dac05df9e7d2d942bdcee4c0cd5d6a 100644 (file)
@@ -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)
index ab437920c9f72c7b54433166e74dd82d9398e2f8..fdc13ff0faf3cfed848563aa89721c1074fc10ee 100644 (file)
@@ -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)
index f4df5da425ebdf77e4450ba7ce98e624492bbc95..7beba6b198e40b477abaaa5377a36e50e213e8ef 100644 (file)
@@ -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)
index 601afc09e511d44d70da5fb5323a9ea7ce9b4d6c..eeba46a09d8e4376f387927bc3fe324b6fcdb657 100644 (file)
@@ -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>
index e96117b5488ec4621d63ab7ec90ba7349d94d3b8..c374287ea630faa9c1a4e5f8dddba18d6c80819e 100644 (file)
@@ -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>
index 39cc3e9750c1842e47e4c6b07731c5eeda4e1d10..6eb4cf95327791a6025acdac66f6aaeb535ef1fb 100644 (file)
@@ -53,6 +53,7 @@ __sigwait (set, sig)
 
   return ret;
 }
+libc_hidden_def (__sigwait)
 weak_alias (__sigwait, sigwait)
 #else
 # include <sysdeps/posix/sigwait.c>
index b59ee54fc1f18f254c9cff5d88a725cfc23b0030..b1569bc67f5599f752137f650669f7f2226b9645 100644 (file)
@@ -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>
index 5ab190b97cfede3e92cc905132e92422092cccb8..5fcc9b5d9af08349aa5839c4cb8dd5801aa9bf85 100644 (file)
@@ -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
-
index 729fd9aca57c0702a42d8853ce80ad4531477bac..76cc920daecd8ddabb7b01daa269f7fda78d65c5 100644 (file)
@@ -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>
index cc9284fc7adcd2676c799bf63dcae30034644618..93c322e61a87cab2d125381e0a0014a4e464db1f 100644 (file)
@@ -9,4 +9,8 @@ libc {
     # s*
     semctl; semget; semop; shmat; shmctl; shmdt; shmget;
   }
+  GLIBC_2.3.1 {
+    # Cancellation point entries.
+    __libc_msgrcv; __libc_msgsnd;
+  }
 }