aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-10-09 09:42:48 +0000
committerUlrich Drepper <drepper@redhat.com>2002-10-09 09:42:48 +0000
commit6166815d696407069c33c1f0cad76fb1847e4bc7 (patch)
treed7aaf5fd8551eb6d69fb80863a4a415cfaa9c01a
parent4c2821faea94c4300fe283f13e4a667f1f73b90b (diff)
downloadglibc-6166815d696407069c33c1f0cad76fb1847e4bc7.tar.xz
glibc-6166815d696407069c33c1f0cad76fb1847e4bc7.zip
Update.
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.
-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, /* s