diff options
author | 2005-02-06 07:45:06 +0000 | |
---|---|---|
committer | 2005-02-06 07:45:06 +0000 | |
commit | 968459b3b99c2f3e955f02954201d3a8994f6b09 (patch) | |
tree | 3be3558755667fb380b1b53ed6f38678b714c5af /src/patchsets/glibc/2.2.5 | |
parent | added quickpkg to TODO list (diff) | |
download | gentoo-968459b3b99c2f3e955f02954201d3a8994f6b09.tar.gz gentoo-968459b3b99c2f3e955f02954201d3a8994f6b09.tar.bz2 gentoo-968459b3b99c2f3e955f02954201d3a8994f6b09.zip |
glibc patches wh00t !
Diffstat (limited to 'src/patchsets/glibc/2.2.5')
78 files changed, 4685 insertions, 0 deletions
diff --git a/src/patchsets/glibc/2.2.5/01_all_glibc-xdr_security.patch b/src/patchsets/glibc/2.2.5/01_all_glibc-xdr_security.patch new file mode 100644 index 0000000000..9abd6ba9f9 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/01_all_glibc-xdr_security.patch @@ -0,0 +1,217 @@ +Security fix for http://www.cert.org/advisories/CA-2003-10.html + +=================================================================== +RCS file: /cvs/glibc/libc/sunrpc/rpc/xdr.h,v +retrieving revision 1.26 +retrieving revision 1.27 +diff -u -r1.26 -r1.27 +--- libc/sunrpc/rpc/xdr.h 1999/10/09 21:26:03 1.26 ++++ libc/sunrpc/rpc/xdr.h 2002/12/16 02:05:49 1.27 +@@ -126,7 +126,7 @@ + /* returns bytes off from beginning */ + bool_t (*x_setpostn) (XDR *__xdrs, u_int __pos); + /* lets you reposition the stream */ +- int32_t *(*x_inline) (XDR *__xdrs, int __len); ++ int32_t *(*x_inline) (XDR *__xdrs, u_int __len); + /* buf quick ptr to buffered data */ + void (*x_destroy) (XDR *__xdrs); + /* free privates of this xdr_stream */ +@@ -139,7 +139,7 @@ + caddr_t x_public; /* users' data */ + caddr_t x_private; /* pointer to private data */ + caddr_t x_base; /* private used for position info */ +- int x_handy; /* extra private word */ ++ u_int x_handy; /* extra private word */ + }; + + /* +=================================================================== +RCS file: /cvs/glibc/libc/sunrpc/xdr_mem.c,v +retrieving revision 1.13 +retrieving revision 1.15 +diff -u -r1.13 -r1.15 +--- libc/sunrpc/xdr_mem.c 2002/02/26 01:43:56 1.13 ++++ libc/sunrpc/xdr_mem.c 2002/12/16 10:25:27 1.15 +@@ -39,6 +39,7 @@ + */ + + #include <string.h> ++#include <limits.h> + #include <rpc/rpc.h> + + static bool_t xdrmem_getlong (XDR *, long *); +@@ -47,7 +48,7 @@ + static bool_t xdrmem_putbytes (XDR *, const char *, u_int); + static u_int xdrmem_getpos (const XDR *); + static bool_t xdrmem_setpos (XDR *, u_int); +-static int32_t *xdrmem_inline (XDR *, int); ++static int32_t *xdrmem_inline (XDR *, u_int); + static void xdrmem_destroy (XDR *); + static bool_t xdrmem_getint32 (XDR *, int32_t *); + static bool_t xdrmem_putint32 (XDR *, const int32_t *); +@@ -100,8 +101,9 @@ + static bool_t + xdrmem_getlong (XDR *xdrs, long *lp) + { +- if ((xdrs->x_handy -= 4) < 0) ++ if (xdrs->x_handy < 4) + return FALSE; ++ xdrs->x_handy -= 4; + *lp = (int32_t) ntohl ((*((int32_t *) (xdrs->x_private)))); + xdrs->x_private += 4; + return TRUE; +@@ -115,8 +117,9 @@ + static bool_t + xdrmem_putlong (XDR *xdrs, const long *lp) + { +- if ((xdrs->x_handy -= 4) < 0) ++ if (xdrs->x_handy < 4) + return FALSE; ++ xdrs->x_handy -= 4; + *(int32_t *) xdrs->x_private = htonl (*lp); + xdrs->x_private += 4; + return TRUE; +@@ -131,8 +134,9 @@ + static bool_t + xdrmem_getbytes (XDR *xdrs, caddr_t addr, u_int len) + { +- if ((xdrs->x_handy -= len) < 0) ++ if (xdrs->x_handy < len) + return FALSE; ++ xdrs->x_handy -= len; + memcpy (addr, xdrs->x_private, len); + xdrs->x_private += len; + return TRUE; +@@ -145,8 +149,9 @@ + static bool_t + xdrmem_putbytes (XDR *xdrs, const char *addr, u_int len) + { +- if ((xdrs->x_handy -= len) < 0) ++ if (xdrs->x_handy < len) + return FALSE; ++ xdrs->x_handy -= len; + memcpy (xdrs->x_private, addr, len); + xdrs->x_private += len; + return TRUE; +@@ -173,7 +178,9 @@ + caddr_t newaddr = xdrs->x_base + pos; + caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; + +- if ((long) newaddr > (long) lastaddr) ++ if ((long) newaddr > (long) lastaddr ++ || (UINT_MAX < LONG_MAX ++ && (long) UINT_MAX < (long) lastaddr - (long) newaddr)) + return FALSE; + xdrs->x_private = newaddr; + xdrs->x_handy = (long) lastaddr - (long) newaddr; +@@ -184,7 +191,7 @@ + * xdrs modified + */ + static int32_t * +-xdrmem_inline (XDR *xdrs, int len) ++xdrmem_inline (XDR *xdrs, u_int len) + { + int32_t *buf = 0; + +@@ -205,8 +212,9 @@ + static bool_t + xdrmem_getint32 (XDR *xdrs, int32_t *ip) + { +- if ((xdrs->x_handy -= 4) < 0) ++ if (xdrs->x_handy < 4) + return FALSE; ++ xdrs->x_handy -= 4; + *ip = ntohl ((*((int32_t *) (xdrs->x_private)))); + xdrs->x_private += 4; + return TRUE; +@@ -220,8 +228,9 @@ + static bool_t + xdrmem_putint32 (XDR *xdrs, const int32_t *ip) + { +- if ((xdrs->x_handy -= 4) < 0) ++ if (xdrs->x_handy < 4) + return FALSE; ++ xdrs->x_handy -= 4; + *(int32_t *) xdrs->x_private = htonl (*ip); + xdrs->x_private += 4; + return TRUE; +=================================================================== +RCS file: /cvs/glibc/libc/sunrpc/xdr_rec.c,v +retrieving revision 1.26 +retrieving revision 1.27 +diff -u -r1.26 -r1.27 +--- libc/sunrpc/xdr_rec.c 2002/08/04 20:49:36 1.26 ++++ libc/sunrpc/xdr_rec.c 2002/12/16 10:25:28 1.27 +@@ -61,7 +61,7 @@ + static bool_t xdrrec_putbytes (XDR *, const char *, u_int); + static u_int xdrrec_getpos (const XDR *); + static bool_t xdrrec_setpos (XDR *, u_int); +-static int32_t *xdrrec_inline (XDR *, int); ++static int32_t *xdrrec_inline (XDR *, u_int); + static void xdrrec_destroy (XDR *); + static bool_t xdrrec_getint32 (XDR *, int32_t *); + static bool_t xdrrec_putint32 (XDR *, const int32_t *); +@@ -373,7 +373,7 @@ + } + + static int32_t * +-xdrrec_inline (XDR *xdrs, int len) ++xdrrec_inline (XDR *xdrs, u_int len) + { + RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; + int32_t *buf = NULL; +=================================================================== +RCS file: /cvs/glibc/libc/sunrpc/xdr_sizeof.c,v +retrieving revision 1.5 +retrieving revision 1.6 +diff -u -r1.5 -r1.6 +--- libc/sunrpc/xdr_sizeof.c 2001/01/28 17:52:48 1.5 ++++ libc/sunrpc/xdr_sizeof.c 2002/12/16 02:05:48 1.6 +@@ -71,13 +71,13 @@ + } + + static int32_t * +-x_inline (XDR *xdrs, int len) ++x_inline (XDR *xdrs, u_int len) + { + if (len == 0) + return NULL; + if (xdrs->x_op != XDR_ENCODE) + return NULL; +- if (len < (int) (long int) xdrs->x_base) ++ if (len < (u_int) (long int) xdrs->x_base) + { + /* x_private was already allocated */ + xdrs->x_handy += len; +@@ -159,5 +159,5 @@ + stat = func (&x, data); + if (x.x_private) + free (x.x_private); +- return stat == TRUE ? (unsigned) x.x_handy : 0; ++ return stat == TRUE ? x.x_handy : 0; + } +=================================================================== +RCS file: /cvs/glibc/libc/sunrpc/xdr_stdio.c,v +retrieving revision 1.15 +retrieving revision 1.16 +diff -u -r1.15 -r1.16 +--- libc/sunrpc/xdr_stdio.c 2002/09/17 10:58:04 1.15 ++++ libc/sunrpc/xdr_stdio.c 2002/12/16 10:25:28 1.16 +@@ -55,7 +55,7 @@ + static bool_t xdrstdio_putbytes (XDR *, const char *, u_int); + static u_int xdrstdio_getpos (const XDR *); + static bool_t xdrstdio_setpos (XDR *, u_int); +-static int32_t *xdrstdio_inline (XDR *, int); ++static int32_t *xdrstdio_inline (XDR *, u_int); + static void xdrstdio_destroy (XDR *); + static bool_t xdrstdio_getint32 (XDR *, int32_t *); + static bool_t xdrstdio_putint32 (XDR *, const int32_t *); +@@ -157,7 +157,7 @@ + } + + static int32_t * +-xdrstdio_inline (XDR *xdrs, int len) ++xdrstdio_inline (XDR *xdrs, u_int len) + { + /* + * Must do some work to implement this: must insure diff --git a/src/patchsets/glibc/2.2.5/02_all_glibc-2.2.4-string2.h.patch b/src/patchsets/glibc/2.2.5/02_all_glibc-2.2.4-string2.h.patch new file mode 100644 index 0000000000..4994a6febc --- /dev/null +++ b/src/patchsets/glibc/2.2.5/02_all_glibc-2.2.4-string2.h.patch @@ -0,0 +1,167 @@ +# This patch apparently eliminates compiler warnings for some versions of gcc. +# For information about the string2 patch, see: +# http://lists.gentoo.org/pipermail/gentoo-dev/2001-June/001559.html + +--- string/bits/string2.h.old Mon Dec 31 17:39:55 2001 ++++ string/bits/string2.h Mon Dec 31 17:40:26 2001 +@@ -234,47 +234,47 @@ + { + case 1: + __u->__c = __src0_1; +- __u = __extension__ ((void *) __u + 1); ++ __u = __extension__ (void *)((char *) __u + 1); + break; + case 2: + __u->__usi = __src0_2; +- __u = __extension__ ((void *) __u + 2); ++ __u = __extension__ (void *)((char *) __u + 2); + break; + case 3: + __u->__usi = __src0_2; +- __u = __extension__ ((void *) __u + 2); ++ __u = __extension__ (void *)((char *) __u + 2); + __u->__c = __src2_1; +- __u = __extension__ ((void *) __u + 1); ++ __u = __extension__ (void *)((char *) __u + 1); + break; + case 4: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + break; + case 5: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__c = __src4_1; +- __u = __extension__ ((void *) __u + 1); ++ __u = __extension__ (void *)((char *) __u + 1); + break; + case 6: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__usi = __src4_2; +- __u = __extension__ ((void *) __u + 2); ++ __u = __extension__ (void *)((char *) __u + 2); + break; + case 7: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__usi = __src4_2; +- __u = __extension__ ((void *) __u + 2); ++ __u = __extension__ (void *)((char *) __u + 2); + __u->__c = __src6_1; +- __u = __extension__ ((void *) __u + 1); ++ __u = __extension__ (void *)((char *) __u + 1); + break; + case 8: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__ui = __src4_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + break; + } + return (void *) __u; +@@ -359,7 +359,7 @@ + __extension__ __u->__sca8 = __src8; + break; + } +- return __extension__ ((void *) __u + __srclen); ++ return __extension__ (void *)((char *) __u + __srclen); + } + # endif + # endif +@@ -415,7 +415,7 @@ + break; + case 3: + __u->__usi = __src0_2; +- __u = __extension__ ((void *) __u + 2); ++ __u = __extension__ (void *)((char *) __u + 2); + __u->__uc = '\0'; + break; + case 4: +@@ -423,24 +423,24 @@ + break; + case 5: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__uc = '\0'; + break; + case 6: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__usi = __src4_2; + break; + case 7: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__usi = __src4_2; +- __u = __extension__ ((void *) __u + 2); ++ __u = __extension__ (void *)((char *) __u + 2); + __u->__uc = '\0'; + break; + case 8: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__ui = __src4_4; + break; + } +@@ -572,40 +572,40 @@ + break; + case 2: + __u->__usi = __src0_2; +- __u = __extension__ ((void *) __u + 1); ++ __u = __extension__ (void *)((char *) __u + 1); + break; + case 3: + __u->__usi = __src0_2; +- __u = __extension__ ((void *) __u + 2); ++ __u = __extension__ (void *)((char *) __u + 2); + __u->__uc = '\0'; + break; + case 4: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 3); ++ __u = __extension__ (void *)((char *) __u + 3); + break; + case 5: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__uc = '\0'; + break; + case 6: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__usi = __src4_2; +- __u = __extension__ ((void *) __u + 1); ++ __u = __extension__ (void *)((char *) __u + 1); + break; + case 7: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__usi = __src4_2; +- __u = __extension__ ((void *) __u + 2); ++ __u = __extension__ (void *)((char *) __u + 2); + __u->__uc = '\0'; + break; + case 8: + __u->__ui = __src0_4; +- __u = __extension__ ((void *) __u + 4); ++ __u = __extension__ (void *)((char *) __u + 4); + __u->__ui = __src4_4; +- __u = __extension__ ((void *) __u + 3); ++ __u = __extension__ (void *)((char *) __u + 3); + break; + } + return &__u->__c; diff --git a/src/patchsets/glibc/2.2.5/03_all_glibc-2.2.5-threadsig.patch b/src/patchsets/glibc/2.2.5/03_all_glibc-2.2.5-threadsig.patch new file mode 100644 index 0000000000..1994437578 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/03_all_glibc-2.2.5-threadsig.patch @@ -0,0 +1,21 @@ +# This next one is a new patch to fix thread signal handling. See: +# http://sources.redhat.com/ml/libc-hacker/2002-02/msg00120.html +# (Added by drobbins on 05 Mar 2002) + +2002-02-17 Andreas Schwab <schwab@suse.de> + +* signals.c (sigwait): Check for old sighandler being SIG_ERR, + not NULL. + +--- linuxthreads/signals.c.~1.23.~ Mon Jan 14 16:16:45 2002 ++++ linuxthreads/signals.c Sun Feb 17 00:51:41 2002 +@@ -198,7 +198,7 @@ + s != __pthread_sig_cancel && + s != __pthread_sig_debug) { + sigdelset(&mask, s); +- if (sighandler[s].old == NULL || ++ if (sighandler[s].old == (arch_sighandler_t) SIG_ERR || + sighandler[s].old == (arch_sighandler_t) SIG_DFL || + sighandler[s].old == (arch_sighandler_t) SIG_IGN) { + sa.sa_handler = pthread_null_sighandler; + diff --git a/src/patchsets/glibc/2.2.5/04_all_glibc-2.2.2-test-lfs-timeout.patch b/src/patchsets/glibc/2.2.5/04_all_glibc-2.2.2-test-lfs-timeout.patch new file mode 100644 index 0000000000..285d52fd44 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/04_all_glibc-2.2.2-test-lfs-timeout.patch @@ -0,0 +1,13 @@ +fixes a test that will timeout due to ReiserFS' slow handling of sparse files + +--- io/test-lfs.c ++++ io/test-lfs.c +@@ -34,7 +34,7 @@ + #define PREPARE do_prepare + + /* We might need a bit longer timeout. */ +-#define TIMEOUT 20 /* sec */ ++#define TIMEOUT 120 /* sec */ + + /* This defines the `main' function and some more. */ + #include <test-skeleton.c> diff --git a/src/patchsets/glibc/2.2.5/05_all_glibc-2.2.5-dns-network-overflow.patch b/src/patchsets/glibc/2.2.5/05_all_glibc-2.2.5-dns-network-overflow.patch new file mode 100644 index 0000000000..179b2b9df2 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/05_all_glibc-2.2.5-dns-network-overflow.patch @@ -0,0 +1,18 @@ +# A buffer overflow vulnerability exists in multiple implementations of DNS +# resolver libraries. This affects glibc-2.2.5 and earlier. + +http://bugs.gentoo.org/show_bug.cgi?id=4923 +http://www.cert.org/advisories/CA-2002-19.html +--- libc/resolv/nss_dns/dns-network.c Fri Jul 12 10:18:13 2002 ++++ libc/resolv/nss_dns/dns-network.c Fri Jul 12 10:20:10 2002 +@@ -328,7 +328,9 @@ + } + cp += n; + *alias_pointer++ = bp; +- bp += strlen (bp) + 1; ++ n = strlen (bp) + 1; ++ bp += n; ++ linebuflen -= n; + result->n_addrtype = class == C_IN ? AF_INET : AF_UNSPEC; + ++have_answer; + } diff --git a/src/patchsets/glibc/2.2.5/06_all_glibc-2.2.5-sunrpc-overflow.patch b/src/patchsets/glibc/2.2.5/06_all_glibc-2.2.5-sunrpc-overflow.patch new file mode 100644 index 0000000000..8ab20e1ef4 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/06_all_glibc-2.2.5-sunrpc-overflow.patch @@ -0,0 +1,90 @@ +# Security update for sunrpc + +--- glibc-2.2.5.orig/malloc/malloc.c Wed Sep 19 05:23:27 2001 ++++ glibc-2.2.5/malloc/malloc.c Tue Aug 13 11:16:26 2002 +@@ -3795,14 +3795,26 @@ + { + arena *ar_ptr; + mchunkptr p, oldtop; +- INTERNAL_SIZE_T sz, csz, oldtopsize; ++ INTERNAL_SIZE_T bytes, sz, csz, oldtopsize; + Void_t* mem; + + #if defined _LIBC || defined MALLOC_HOOKS + __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, __const __malloc_ptr_t)) = + __malloc_hook; ++ ++ /* size_t is unsigned so the behavior on overflow is defined. */ ++ bytes = n * elem_size; ++#define HALF_INTERNAL_SIZE_T \ ++ (((INTERNAL_SIZE_T) 1) << (8 * sizeof (INTERNAL_SIZE_T) / 2)) ++ if (__builtin_expect ((n | elem_size) >= HALF_INTERNAL_SIZE_T, 0)) { ++ if (elem_size != 0 && bytes / elem_size != n) { ++ __set_errno (ENOMEM); ++ return 0; ++ } ++ } ++ + if (hook != NULL) { +- sz = n * elem_size; ++ sz = bytes; + #if defined __GNUC__ && __GNUC__ >= 2 + mem = (*hook)(sz, RETURN_ADDRESS (0)); + #else +@@ -3819,7 +3831,7 @@ + } + #endif + +- if(request2size(n * elem_size, sz)) ++ if(request2size(bytes, sz)) + return 0; + arena_get(ar_ptr, sz); + if(!ar_ptr) +@@ -3862,7 +3874,7 @@ + } + if (p == 0) return 0; + } +- mem = BOUNDED_N(chunk2mem(p), n * elem_size); ++ mem = BOUNDED_N(chunk2mem(p), bytes); + + /* Two optional cases in which clearing not necessary */ + +@@ -4899,9 +4911,9 @@ + { + void *mem; + +- /* Test whether the SIZE argument is valid. It must be a power of +- two multiple of sizeof (void *). */ +- if (size % sizeof (void *) != 0 || (size & (size - 1)) != 0) ++ /* Test whether the ALIGNMENT argument is valid. It must be a power ++ of two multiple of sizeof (void *). */ ++ if (alignment % sizeof (void *) != 0 || (alignment & (alignment - 1)) != 0) + return EINVAL; + + mem = __libc_memalign (alignment, size); +diff -urN glibc-2.2.5.orig/sunrpc/xdr_array.c glibc-2.2.5/sunrpc/xdr_array.c +--- glibc-2.2.5.orig/sunrpc/xdr_array.c Fri Sep 7 13:59:19 2001 ++++ glibc-2.2.5/sunrpc/xdr_array.c Thu Aug 1 16:48:38 2002 +@@ -45,6 +45,7 @@ + #include <rpc/types.h> + #include <rpc/xdr.h> + #include <libintl.h> ++#include <limits.h> + + #ifdef USE_IN_LIBIO + # include <wchar.h> +@@ -81,7 +82,9 @@ + return FALSE; + } + c = *sizep; +- if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) ++ ++ /* Make sure that "c * elsize" doesn't overflow */ ++ if ((c > maxsize || UINT_MAX/elsize < c) && (xdrs->x_op != XDR_FREE)) + { + return FALSE; + } + + + + diff --git a/src/patchsets/glibc/2.2.5/07_all_glibc-2.2.5-divdi3.patch b/src/patchsets/glibc/2.2.5/07_all_glibc-2.2.5-divdi3.patch new file mode 100644 index 0000000000..35339b45c1 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/07_all_glibc-2.2.5-divdi3.patch @@ -0,0 +1,411 @@ +This patch fixes the nvidia-glx probs, openoffice and vmware probs and such ... + +http://sources.redhat.com/ml/libc-hacker/2002-02/msg00152.html + +--- libc/sysdeps/i386/Makefile.jj Fri Sep 17 18:59:13 1999 ++++ libc/sysdeps/i386/Makefile Thu Feb 28 19:04:03 2002 +@@ -9,6 +9,12 @@ ifeq ($(subdir),csu) + # On i686 we must avoid generating the trampoline functions generated + # to get the GOT pointer. + CFLAGS-initfini.s += -march=i386 -mcpu=i386 ++ ++ifeq (yes,$(build-shared)) ++# Compatibility ++sysdep_routines += divdi3 ++shared-only-routines += divdi3 ++endif + endif + + ifeq ($(subdir),db2) +--- libc/sysdeps/m68k/Makefile.jj Thu Aug 23 18:49:59 2001 ++++ libc/sysdeps/m68k/Makefile Thu Feb 28 19:04:29 2002 +@@ -33,6 +33,14 @@ CFLAGS-setjmp.c := -fno-omit-frame-point + # The 68k `long double' is a distinct type we support. + long-double-fcts = yes + ++ifeq ($(subdir),csu) ++ifeq (yes,$(build-shared)) ++# Compatibility ++sysdep_routines += divdi3 ++shared-only-routines += divdi3 ++endif ++endif ++ + ifeq ($(subdir),elf) + CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused + endif +--- libc/sysdeps/s390/s390-32/Makefile.jj Fri Mar 16 09:59:44 2001 ++++ libc/sysdeps/s390/s390-32/Makefile Thu Feb 28 19:04:44 2002 +@@ -1,5 +1,13 @@ + pic-ccflag = -fpic + ++ifeq ($(subdir),csu) ++ifeq (yes,$(build-shared)) ++# Compatibility ++sysdep_routines += divdi3 ++shared-only-routines += divdi3 ++endif ++endif ++ + ifeq ($(subdir),gmon) + sysdep_routines += s390-mcount + endif +--- libc/sysdeps/powerpc/Makefile.orig 2000-11-27 17:32:47.000000000 -0600 ++++ libc/sysdeps/powerpc/Makefile 2002-10-02 20:43:26.000000000 -0500 +@@ -24,6 +24,13 @@ + endif + + ifeq ($(subdir),csu) ++ ++ifeq (yes,$(build-shared)) ++# Compatibility ++sysdep_routines += divdi3 ++shared-only-routines += divdi3 ++endif ++ + ifneq ($(elf),no) + # The initfini generation code doesn't work in the presence of -fPIC, so + # we use -fpic instead which is much better. +--- libc/sysdeps/powerpc/Versions.orig 2000-02-28 15:27:57.000000000 -0600 ++++ libc/sysdeps/powerpc/Versions 2002-10-02 20:43:20.000000000 -0500 +@@ -1,3 +1,10 @@ ++libc { ++ GLIBC_2.0 { ++ # Functions from libgcc. ++ __divdi3; __moddi3; __udivdi3; __umoddi3; ++ } ++} ++ + libm { + GLIBC_2.1 { + # symbols used in macros from sysdeps/powerpc/bits/fenv.h +--- libc/sysdeps/wordsize-32/divdi3.c.jj Thu Feb 28 18:53:16 2002 ++++ libc/sysdeps/wordsize-32/divdi3.c Thu Feb 28 19:02:18 2002 +@@ -0,0 +1,327 @@ ++/* 64-bit multiplication and division ++ Copyright (C) 1989, 1992-1999, 2000, 2001, 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 Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include <endian.h> ++#include <stdlib.h> ++#include <bits/wordsize.h> ++ ++#if __WORDSIZE != 32 ++#error This is for 32-bit targets only ++#endif ++ ++typedef unsigned int UQItype __attribute__ ((mode (QI))); ++typedef int SItype __attribute__ ((mode (SI))); ++typedef unsigned int USItype __attribute__ ((mode (SI))); ++typedef int DItype __attribute__ ((mode (DI))); ++typedef unsigned int UDItype __attribute__ ((mode (DI))); ++#define Wtype SItype ++#define HWtype SItype ++#define DWtype DItype ++#define UWtype USItype ++#define UHWtype USItype ++#define UDWtype UDItype ++#define W_TYPE_SIZE 32 ++ ++#include <stdlib/longlong.h> ++ ++#if __BYTE_ORDER == __BIG_ENDIAN ++struct DWstruct { Wtype high, low;}; ++#elif __BYTE_ORDER == __LITTLE_ENDIAN ++struct DWstruct { Wtype low, high;}; ++#else ++#error Unhandled endianity ++#endif ++typedef union { struct DWstruct s; DWtype ll; } DWunion; ++ ++static UDWtype ++__udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) ++{ ++ DWunion ww; ++ DWunion nn, dd; ++ DWunion rr; ++ UWtype d0, d1, n0, n1, n2; ++ UWtype q0, q1; ++ UWtype b, bm; ++ ++ nn.ll = n; ++ dd.ll = d; ++ ++ d0 = dd.s.low; ++ d1 = dd.s.high; ++ n0 = nn.s.low; ++ n1 = nn.s.high; ++ ++#if !UDIV_NEEDS_NORMALIZATION ++ if (d1 == 0) ++ { ++ if (d0 > n1) ++ { ++ /* 0q = nn / 0D */ ++ ++ udiv_qrnnd (q0, n0, n1, n0, d0); ++ q1 = 0; ++ ++ /* Remainder in n0. */ ++ } ++ else ++ { ++ /* qq = NN / 0d */ ++ ++ if (d0 == 0) ++ d0 = 1 / d0; /* Divide intentionally by zero. */ ++ ++ udiv_qrnnd (q1, n1, 0, n1, d0); ++ udiv_qrnnd (q0, n0, n1, n0, d0); ++ ++ /* Remainder in n0. */ ++ } ++ ++ if (rp != 0) ++ { ++ rr.s.low = n0; ++ rr.s.high = 0; ++ *rp = rr.ll; ++ } ++ } ++ ++#else /* UDIV_NEEDS_NORMALIZATION */ ++ ++ if (d1 == 0) ++ { ++ if (d0 > n1) ++ { ++ /* 0q = nn / 0D */ ++ ++ count_leading_zeros (bm, d0); ++ ++ if (bm != 0) ++ { ++ /* Normalize, i.e. make the most significant bit of the ++ denominator set. */ ++ ++ d0 = d0 << bm; ++ n1 = (n1 << bm) | (n0 >> (W_TYPE_SIZE - bm)); ++ n0 = n0 << bm; ++ } ++ ++ udiv_qrnnd (q0, n0, n1, n0, d0); ++ q1 = 0; ++ ++ /* Remainder in n0 >> bm. */ ++ } ++ else ++ { ++ /* qq = NN / 0d */ ++ ++ if (d0 == 0) ++ d0 = 1 / d0; /* Divide intentionally by zero. */ ++ ++ count_leading_zeros (bm, d0); ++ ++ if (bm == 0) ++ { ++ /* From (n1 >= d0) /\ (the most significant bit of d0 is set), ++ conclude (the most significant bit of n1 is set) /\ (the ++ leading quotient digit q1 = 1). ++ ++ This special case is necessary, not an optimization. ++ (Shifts counts of W_TYPE_SIZE are undefined.) */ ++ ++ n1 -= d0; ++ q1 = 1; ++ } ++ else ++ { ++ /* Normalize. */ ++ ++ b = W_TYPE_SIZE - bm; ++ ++ d0 = d0 << bm; ++ n2 = n1 >> b; ++ n1 = (n1 << bm) | (n0 >> b); ++ n0 = n0 << bm; ++ ++ udiv_qrnnd (q1, n1, n2, n1, d0); ++ } ++ ++ /* n1 != d0... */ ++ ++ udiv_qrnnd (q0, n0, n1, n0, d0); ++ ++ /* Remainder in n0 >> bm. */ ++ } ++ ++ if (rp != 0) ++ { ++ rr.s.low = n0 >> bm; ++ rr.s.high = 0; ++ *rp = rr.ll; ++ } ++ } ++#endif /* UDIV_NEEDS_NORMALIZATION */ ++ ++ else ++ { ++ if (d1 > n1) ++ { ++ /* 00 = nn / DD */ ++ ++ q0 = 0; ++ q1 = 0; ++ ++ /* Remainder in n1n0. */ ++ if (rp != 0) ++ { ++ rr.s.low = n0; ++ rr.s.high = n1; ++ *rp = rr.ll; ++ } ++ } ++ else ++ { ++ /* 0q = NN / dd */ ++ ++ count_leading_zeros (bm, d1); ++ if (bm == 0) ++ { ++ /* From (n1 >= d1) /\ (the most significant bit of d1 is set), ++ conclude (the most significant bit of n1 is set) /\ (the ++ quotient digit q0 = 0 or 1). ++ ++ This special case is necessary, not an optimization. */ ++ ++ /* The condition on the next line takes advantage of that ++ n1 >= d1 (true due to program flow). */ ++ if (n1 > d1 || n0 >= d0) ++ { ++ q0 = 1; ++ sub_ddmmss (n1, n0, n1, n0, d1, d0); ++ } ++ else ++ q0 = 0; ++ ++ q1 = 0; ++ ++ if (rp != 0) ++ { ++ rr.s.low = n0; ++ rr.s.high = n1; ++ *rp = rr.ll; ++ } ++ } ++ else ++ { ++ UWtype m1, m0; ++ /* Normalize. */ ++ ++ b = W_TYPE_SIZE - bm; ++ ++ d1 = (d1 << bm) | (d0 >> b); ++ d0 = d0 << bm; ++ n2 = n1 >> b; ++ n1 = (n1 << bm) | (n0 >> b); ++ n0 = n0 << bm; ++ ++ udiv_qrnnd (q0, n1, n2, n1, d1); ++ umul_ppmm (m1, m0, q0, d0); ++ ++ if (m1 > n1 || (m1 == n1 && m0 > n0)) ++ { ++ q0--; ++ sub_ddmmss (m1, m0, m1, m0, d1, d0); ++ } ++ ++ q1 = 0; ++ ++ /* Remainder in (n1n0 - m1m0) >> bm. */ ++ if (rp != 0) ++ { ++ sub_ddmmss (n1, n0, n1, n0, m1, m0); ++ rr.s.low = (n1 << b) | (n0 >> bm); ++ rr.s.high = n1 >> bm; ++ *rp = rr.ll; ++ } ++ } ++ } ++ } ++ ++ ww.s.low = q0; ++ ww.s.high = q1; ++ return ww.ll; ++} ++ ++DWtype ++__divdi3 (DWtype u, DWtype v) ++{ ++ Wtype c = 0; ++ DWtype w; ++ ++ if (u < 0) ++ { ++ c = ~c; ++ u = -u; ++ } ++ if (v < 0) ++ { ++ c = ~c; ++ v = -v; ++ } ++ w = __udivmoddi4 (u, v, NULL); ++ if (c) ++ w = -w; ++ return w; ++} ++ ++DWtype ++__moddi3 (DWtype u, DWtype v) ++{ ++ Wtype c = 0; ++ DWtype w; ++ ++ if (u < 0) ++ { ++ c = ~c; ++ u = -u; ++ } ++ if (v < 0) ++ { ++ c = ~c; ++ v = -v; ++ } ++ __udivmoddi4 (u, v, &w); ++ if (c) ++ w = -w; ++ return w; ++} ++ ++UDWtype ++__udivdi3 (UDWtype u, UDWtype v) ++{ ++ return __udivmoddi4 (u, v, NULL); ++} ++ ++UDWtype ++__umoddi3 (UDWtype u, UDWtype v) ++{ ++ UDWtype w; ++ ++ __udivmoddi4 (u, v, &w); ++ return w; ++} diff --git a/src/patchsets/glibc/2.2.5/08_all_glibc-2.2.5-getgrouplist.patch b/src/patchsets/glibc/2.2.5/08_all_glibc-2.2.5-getgrouplist.patch new file mode 100644 index 0000000000..d2a1b0e30c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/08_all_glibc-2.2.5-getgrouplist.patch @@ -0,0 +1,33 @@ +A bug in the getgrouplist function can cause a buffer overflow if +the size of the group list is too small to hold all the user's groups. +https://rhn.redhat.com/errata/RHSA-2003-325.html + +--- glibc-2.2.5/grp/initgroups.c.orig 2003-11-13 13:03:29.620138976 -0500 ++++ glibc-2.2.5/grp/initgroups.c 2003-11-13 13:05:03.693837600 -0500 +@@ -23,6 +23,7 @@ + #include <stdlib.h> + #include <string.h> + #include <unistd.h> ++#include <sys/param.h> + #include <sys/types.h> + #include <nsswitch.h> + +@@ -207,6 +208,9 @@ + return -1; + + result = internal_getgrouplist (user, group, &size, &newgroups, -1); ++ ++ memcpy (groups, newgroups, MIN (*ngroups, result) * sizeof (gid_t)); ++ + if (result > *ngroups) + { + *ngroups = result; +@@ -214,8 +218,6 @@ + } + else + *ngroups = result; +- +- memcpy (groups, newgroups, *ngroups * sizeof (gid_t)); + + free (newgroups); + return result; diff --git a/src/patchsets/glibc/2.2.5/09_all_glibc-2.2.5-ppc-sqrtl.patch b/src/patchsets/glibc/2.2.5/09_all_glibc-2.2.5-ppc-sqrtl.patch new file mode 100644 index 0000000000..3549565f09 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/09_all_glibc-2.2.5-ppc-sqrtl.patch @@ -0,0 +1,22 @@ +This patch fixes the absence of sqrtl on PPC +http://sources.redhat.com/ml/libc-hacker/2002-05/msg00012.html + +--- sysdeps/powerpc/fpu/w_sqrt.c 6 Jul 2001 04:56:02 -0000 1.2 ++++ sysdeps/powerpc/fpu/w_sqrt.c 10 May 2002 08:40:46 -0000 +@@ -1,5 +1,5 @@ + /* Single-precision floating point square root. +- Copyright (C) 1997 Free Software Foundation, Inc. ++ Copyright (C) 1997, 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 +@@ -139,3 +139,8 @@ weak_alias (__sqrt, sqrt) + /* Strictly, this is wrong, but the only places where _ieee754_sqrt is + used will not pass in a negative result. */ + strong_alias(__sqrt,__ieee754_sqrt) ++ ++#ifdef NO_LONG_DOUBLE ++weak_alias (__sqrt, __sqrtl) ++weak_alias (__sqrt, sqrtl) ++#endif + diff --git a/src/patchsets/glibc/2.2.5/10_all_glibc-2.2.5-gcc311.patch b/src/patchsets/glibc/2.2.5/10_all_glibc-2.2.5-gcc311.patch new file mode 100644 index 0000000000..a253201f34 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/10_all_glibc-2.2.5-gcc311.patch @@ -0,0 +1,17 @@ +Some gcc-3.1.1 fixes. This works fine for other versions of gcc as well, +and should generally be ok, as it just fixes define order that causes scope +problems with gcc-3.1.1. +(Azarah, 14 Jul 2002) + +--- glibc-2.2.5/sysdeps/unix/sysv/linux/errlist.c Fri Jul 5 22:35:57 2002 ++++ glibc-2.2.5.azarah/sysdeps/unix/sysv/linux/errlist.c Fri Jul 5 22:41:51 2002 +@@ -37,8 +37,8 @@ + + const int __old_sys_nerr = OLD_ERRLIST_SIZE; + +-strong_alias (__old_sys_nerr, _old_sys_nerr); + weak_alias (__old_sys_nerr, _old_sys_nerr) ++strong_alias (__old_sys_nerr, _old_sys_nerr); + compat_symbol (libc, __old_sys_nerr, _sys_nerr, GLIBC_2_0); + compat_symbol (libc, _old_sys_nerr, sys_nerr, GLIBC_2_0); + weak_alias (__old_sys_errlist, _old_sys_errlist); diff --git a/src/patchsets/glibc/2.2.5/11_all_glibc-2.2.5.divbyzero.patch b/src/patchsets/glibc/2.2.5/11_all_glibc-2.2.5.divbyzero.patch new file mode 100644 index 0000000000..9c77ef9a34 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/11_all_glibc-2.2.5.divbyzero.patch @@ -0,0 +1,40 @@ +gcc-3.x fixes + +http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0228.html + +diff -uNr glibc-2.2.5.orig/iconv/skeleton.c glibc-2.2.5/iconv/skeleton.c +--- glibc-2.2.5.orig/iconv/skeleton.c 2001-07-06 14:54:47.000000000 +1000 ++++ glibc-2.2.5/iconv/skeleton.c 2002-08-09 20:28:32.000000000 +1000 +@@ -193,15 +193,32 @@ + character set we can define RESET_INPUT_BUFFER in a very fast way. */ + #if !defined RESET_INPUT_BUFFER && !defined SAVE_RESET_STATE + # if MIN_NEEDED_FROM == MAX_NEEDED_FROM && MIN_NEEDED_TO == MAX_NEEDED_TO ++#if !(__GNUC__ >= 3 && __GNUC_MINOR__ >= 2) + /* We have to use these `if's here since the compiler cannot know that + (outbuf - outerr) is always divisible by MIN_NEEDED_TO. */ + # define RESET_INPUT_BUFFER \ + if (MIN_NEEDED_FROM % MIN_NEEDED_TO == 0) \ + *inptrp -= (outbuf - outerr) * (MIN_NEEDED_FROM / MIN_NEEDED_TO); \ + else if (MIN_NEEDED_TO % MIN_NEEDED_FROM == 0) \ + *inptrp -= (outbuf - outerr) / (MIN_NEEDED_TO / MIN_NEEDED_FROM); \ + else \ + *inptrp -= ((outbuf - outerr) / MIN_NEEDED_TO) * MIN_NEEDED_FROM ++#else ++/* We have to use these `#if's here since the compiler cannot know that ++ (outbuf - outerr) is always divisible by MIN_NEEDED_TO. We have to ++ use preprocessor arithmetic and no C code because gcc 3.2 complains ++ about division by zero even in obviously dead code. */ ++# if MIN_NEEDED_FROM % MIN_NEEDED_TO == 0 ++# define RESET_INPUT_BUFFER \ ++ *inptrp -= (outbuf - outerr) * (MIN_NEEDED_FROM / MIN_NEEDED_TO) ++# elif MIN_NEEDED_TO % MIN_NEEDED_FROM == 0 ++# define RESET_INPUT_BUFFER \ ++ *inptrp -= (outbuf - outerr) / (MIN_NEEDED_TO / MIN_NEEDED_FROM) ++# else ++# define RESET_INPUT_BUFFER \ ++ *inptrp -= ((outbuf - outerr) / MIN_NEEDED_TO) * MIN_NEEDED_FROM ++# endif ++#endif + # endif + #endif + diff --git a/src/patchsets/glibc/2.2.5/12_all_glibc-2.2.5.restrict_arr.patch b/src/patchsets/glibc/2.2.5/12_all_glibc-2.2.5.restrict_arr.patch new file mode 100644 index 0000000000..aa849190c6 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/12_all_glibc-2.2.5.restrict_arr.patch @@ -0,0 +1,26 @@ +gcc-3.x fixes + +http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2002/08/0228.html + +diff -uNr glibc-2.2.5.orig/posix/regex.h glibc-2.2.5/posix/regex.h +--- glibc-2.2.5.orig/posix/regex.h 2001-07-06 14:55:38.000000000 +1000 ++++ glibc-2.2.5/posix/regex.h 2002-08-09 20:06:19.000000000 +1000 +@@ -529,10 +529,14 @@ + # endif + # endif + #endif +-/* For now unconditionally define __restrict_arr to expand to nothing. +- Ideally we would have a test for the compiler which allows defining +- it to restrict. */ +-#define __restrict_arr ++/* gcc 3.1 and up support the [restrict] syntax. */ ++#ifndef __restrict_arr ++# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) ++# define __restrict_arr __restrict ++# else ++# define __restrict_arr ++# endif ++#endif + + /* POSIX compatibility. */ + extern int regcomp _RE_ARGS ((regex_t *__restrict __preg, diff --git a/src/patchsets/glibc/2.2.5/13_all_glibc-2.2.5-alpha-gcc3-fix.patch b/src/patchsets/glibc/2.2.5/13_all_glibc-2.2.5-alpha-gcc3-fix.patch new file mode 100644 index 0000000000..f51c7e32ef --- /dev/null +++ b/src/patchsets/glibc/2.2.5/13_all_glibc-2.2.5-alpha-gcc3-fix.patch @@ -0,0 +1,11 @@ +--- glibc-2.2.5/linuxthreads/sysdeps/alpha/pt-machine.h Mon Jul 23 17:52:42 2001 ++++ glibc-2.2.5-alpha-gcc3-fix/linuxthreads/sysdeps/alpha/pt-machine.h Sat Sep 7 14:58:23 2002 +@@ -71,7 +71,7 @@ + #define THREAD_SELF \ + ({ \ + register pthread_descr __self __asm__("$0"); \ +- __asm__ ("call_pal %1" : "=r"(__self) : "i"(PAL_rduniq) : "$0"); \ ++ __asm__ ("call_pal %1" : "=r"(__self) : "i"(PAL_rduniq)); \ + __self; \ + }) + diff --git a/src/patchsets/glibc/2.2.5/14_all_glibc-2.2.5-alpha-pcdyn-fix.patch b/src/patchsets/glibc/2.2.5/14_all_glibc-2.2.5-alpha-pcdyn-fix.patch new file mode 100644 index 0000000000..ce51ee3fc8 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/14_all_glibc-2.2.5-alpha-pcdyn-fix.patch @@ -0,0 +1,19 @@ +--- glibc-2.2.5/sysdeps/alpha/divrem.h Fri Jul 6 06:55:45 2001 ++++ glibc-2.2.5-alpha/sysdeps/alpha/divrem.h Fri Sep 6 17:32:35 2002 +@@ -86,6 +86,7 @@ + + .align 3 + UFUNC_NAME: ++$udiv_entry: + lda sp, -STACK(sp) + .frame sp, STACK, retaddr, 0 + #ifdef PROF +@@ -206,7 +207,7 @@ + cmovge AT, AT, arg2 + + /* Do the unsigned division. */ +- bsr retaddr, UFUNC_NAME ++ bsr retaddr, $udiv_entry + + /* Restore originals and adjust the sign of the result. */ + ldq arg1, 0(sp) diff --git a/src/patchsets/glibc/2.2.5/15_all_glibc-2.2.5-sparc-mathinline.patch b/src/patchsets/glibc/2.2.5/15_all_glibc-2.2.5-sparc-mathinline.patch new file mode 100644 index 0000000000..f1fa9c2a75 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/15_all_glibc-2.2.5-sparc-mathinline.patch @@ -0,0 +1,23 @@ +--- glibc-2.2.5/sysdeps/sparc/fpu/bits/mathinline.h 2001-11-28 21:13:08.000000000 +0000 ++++ glibc-2.3.1/sysdeps/sparc/fpu/bits/mathinline.h 2002-05-16 01:16:23.000000000 +0100 +@@ -213,16 +213,16 @@ + + # ifndef __NO_MATH_INLINES + +-__MATH_INLINE double fdim (double __x, double __y); ++__MATH_INLINE double fdim (double __x, double __y) __THROW; + __MATH_INLINE double +-fdim (double __x, double __y) ++fdim (double __x, double __y) __THROW + { + return __x < __y ? 0 : __x - __y; + } + +-__MATH_INLINE float fdimf (float __x, float __y); ++__MATH_INLINE float fdimf (float __x, float __y) __THROW; + __MATH_INLINE float +-fdimf (float __x, float __y) ++fdimf (float __x, float __y) __THROW + { + return __x < __y ? 0 : __x - __y; + } diff --git a/src/patchsets/glibc/2.2.5/16_all_glibc-2.2.5-sparc-misc.patch b/src/patchsets/glibc/2.2.5/16_all_glibc-2.2.5-sparc-misc.patch new file mode 100644 index 0000000000..dc5f08bf50 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/16_all_glibc-2.2.5-sparc-misc.patch @@ -0,0 +1,339 @@ +#! /bin/sh -e + +# DP: Misc. SPARC fixes. + +if [ $# -ne 2 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;; + -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +esac +exit 0 + +2002-05-16 David S. Miller <davem@redhat.com> + + * sysdeps/sparc/sparc32/dl-machine.h (LOAD_PIC_REG): Define. + (elf_machine_dynamic): Use it to force PIC register to be loaded. + (elf_machine_load_address): Likewise. + * sysdeps/sparc/sparc64/dl-machine.h: Mirror sparc32 changes. + + * sysdeps/sparc/sparc64/strncmp.S: When second argument pointer + is unaligned, do not forget to fully initialize %g1 magic value. + + * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h (LOC): Fix CPP + pasting. + + * sysdeps/unix/sysv/linux/sparc/sys/procfs.h: Fix 64-bit elf + register definitions and provide 32-bit variants of structures + during 64-bit builds. + + * soft-fp/op-1.h (_FP_FRAC_CLEAR_OVERP_1): Define. + * soft-fp/op-2.h (_FP_FRAC_CLEAR_OVERP_2): Define. + * soft-fp/op-4.h (_FP_FRAC_CLEAR_OVERP_4): Define. + * soft-fp/op-common.h (_FP_PACK_CANONICAL): After rounding, if + _FP_FRAC_OVERP_X is set, use _FP_FRAC_CLEAR_OVERP_X to clear it. + (_FP_FROM_INT): Perform right shifts on unsigned integer type. + Do not clear implicit one bit here, it must be done post-rounding. + Only pad to the left using left shift if value uses less than the + available fractional bits. + +diff -urN glibc-2.2.5.orig/soft-fp/op-1.h glibc-2.2.5/soft-fp/op-1.h +--- glibc-2.2.5.orig/soft-fp/op-1.h Mon Jun 17 21:48:12 2002 ++++ glibc-2.2.5/soft-fp/op-1.h Mon Jun 17 22:27:52 2002 +@@ -55,6 +55,7 @@ + #define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE)X##_f < 0) + #define _FP_FRAC_ZEROP_1(X) (X##_f == 0) + #define _FP_FRAC_OVERP_1(fs,X) (X##_f & _FP_OVERFLOW_##fs) ++#define _FP_FRAC_CLEAR_OVERP_1(fs,X) (X##_f &= ~_FP_OVERFLOW_##fs) + #define _FP_FRAC_EQ_1(X, Y) (X##_f == Y##_f) + #define _FP_FRAC_GE_1(X, Y) (X##_f >= Y##_f) + #define _FP_FRAC_GT_1(X, Y) (X##_f > Y##_f) +diff -urN glibc-2.2.5.orig/soft-fp/op-2.h glibc-2.2.5/soft-fp/op-2.h +--- glibc-2.2.5.orig/soft-fp/op-2.h Mon Jun 17 21:48:12 2002 ++++ glibc-2.2.5/soft-fp/op-2.h Mon Jun 17 22:27:52 2002 +@@ -112,6 +112,7 @@ + #define _FP_FRAC_NEGP_2(X) ((_FP_WS_TYPE)X##_f1 < 0) + #define _FP_FRAC_ZEROP_2(X) ((X##_f1 | X##_f0) == 0) + #define _FP_FRAC_OVERP_2(fs,X) (_FP_FRAC_HIGH_##fs(X) & _FP_OVERFLOW_##fs) ++#define _FP_FRAC_CLEAR_OVERP_2(fs,X) (_FP_FRAC_HIGH_##fs(X) &= ~_FP_OVERFLOW_##fs) + #define _FP_FRAC_EQ_2(X, Y) (X##_f1 == Y##_f1 && X##_f0 == Y##_f0) + #define _FP_FRAC_GT_2(X, Y) \ + (X##_f1 > Y##_f1 || X##_f1 == Y##_f1 && X##_f0 > Y##_f0) +diff -urN glibc-2.2.5.orig/soft-fp/op-4.h glibc-2.2.5/soft-fp/op-4.h +--- glibc-2.2.5.orig/soft-fp/op-4.h Mon Jun 17 21:48:12 2002 ++++ glibc-2.2.5/soft-fp/op-4.h Mon Jun 17 22:27:52 2002 +@@ -129,6 +129,7 @@ + #define _FP_FRAC_ZEROP_4(X) ((X##_f[0] | X##_f[1] | X##_f[2] | X##_f[3]) == 0) + #define _FP_FRAC_NEGP_4(X) ((_FP_WS_TYPE)X##_f[3] < 0) + #define _FP_FRAC_OVERP_4(fs,X) (_FP_FRAC_HIGH_##fs(X) & _FP_OVERFLOW_##fs) ++#define _FP_FRAC_CLEAR_OVERP_4(fs,X) (_FP_FRAC_HIGH_##fs(X) &= ~_FP_OVERFLOW_##fs) + + #define _FP_FRAC_EQ_4(X,Y) \ + (X##_f[0] == Y##_f[0] && X##_f[1] == Y##_f[1] \ +diff -urN glibc-2.2.5.orig/soft-fp/op-common.h glibc-2.2.5/soft-fp/op-common.h +--- glibc-2.2.5.orig/soft-fp/op-common.h Mon Jun 17 21:48:12 2002 ++++ glibc-2.2.5/soft-fp/op-common.h Mon Jun 17 22:27:52 2002 +@@ -89,11 +89,10 @@ + _FP_ROUND(wc, X); \ + if (_FP_FRAC_OVERP_##wc(fs, X)) \ + { \ +- _FP_FRAC_SRL_##wc(X, (_FP_WORKBITS+1)); \ ++ _FP_FRAC_CLEAR_OVERP_##wc(fs, X); \ + X##_e++; \ + } \ +- else \ +- _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ ++ _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ + if (X##_e >= _FP_EXPMAX_##fs) \ + { \ + /* overflow */ \ +@@ -682,25 +681,27 @@ + do { \ + if (r) \ + { \ ++ unsigned rtype ur_; \ + X##_c = FP_CLS_NORMAL; \ + \ + if ((X##_s = (r < 0))) \ + r = -r; \ + \ ++ ur_ = (unsigned rtype) r; \ + if (rsize <= _FP_W_TYPE_SIZE) \ +- __FP_CLZ(X##_e, r); \ ++ __FP_CLZ(X##_e, ur_); \ + else \ +- __FP_CLZ_2(X##_e, (_FP_W_TYPE)(r >> _FP_W_TYPE_SIZE), \ +- (_FP_W_TYPE)r); \ ++ __FP_CLZ_2(X##_e, (_FP_W_TYPE)(ur_ >> _FP_W_TYPE_SIZE), \ ++ (_FP_W_TYPE)ur_); \ + if (rsize < _FP_W_TYPE_SIZE) \ + X##_e -= (_FP_W_TYPE_SIZE - rsize); \ + X##_e = rsize - X##_e - 1; \ + \ + if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e) \ +- __FP_FRAC_SRS_1(r, (X##_e - _FP_WFRACBITS_##fs), rsize); \ +- r &= ~((rtype)1 << X##_e); \ +- _FP_FRAC_DISASSEMBLE_##wc(X, ((unsigned rtype)r), rsize); \ +- _FP_FRAC_SLL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1)); \ ++ __FP_FRAC_SRS_1(ur_, (X##_e - _FP_WFRACBITS_##fs + 1), rsize);\ ++ _FP_FRAC_DISASSEMBLE_##wc(X, ur_, rsize); \ ++ if ((_FP_WFRACBITS_##fs - X##_e - 1) > 0) \ ++ _FP_FRAC_SLL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1)); \ + } \ + else \ + { \ +diff -urN glibc-2.2.5.orig/sysdeps/sparc/sparc32/dl-machine.h glibc-2.2.5/sysdeps/sparc/sparc32/dl-machine.h +--- glibc-2.2.5.orig/sysdeps/sparc/sparc32/dl-machine.h Mon Jun 17 21:48:12 2002 ++++ glibc-2.2.5/sysdeps/sparc/sparc32/dl-machine.h Mon Jun 17 22:27:52 2002 +@@ -42,7 +42,6 @@ + #define LD_SO_PRELOAD ((_dl_hwcap & HWCAP_SPARC_V9) ? "/etc/ld.so.preload32" \ + : "/etc/ld.so.preload") + +- + /* Return nonzero iff ELF header is compatible with the running host. */ + static inline int + elf_machine_matches_host (const Elf32_Ehdr *ehdr) +@@ -64,6 +63,17 @@ + return 0; + } + ++/* We have to do this because elf_machine_{dynamic,load_address} can be ++ invoked from functions that have no GOT references, and thus the compiler ++ has no obligation to load the PIC register. */ ++#define LOAD_PIC_REG(PIC_REG) \ ++do { register Elf32_Addr pc __asm("o7"); \ ++ __asm("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t" \ ++ "call 1f\n\t" \ ++ "add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n" \ ++ "1:\tadd %1, %0, %1" \ ++ : "=r" (pc), "=r" (PIC_REG)); \ ++} while (0) + + /* Return the link-time address of _DYNAMIC. Conveniently, this is the + first element of the GOT. This must be inlined in a function which +@@ -72,6 +82,9 @@ + elf_machine_dynamic (void) + { + register Elf32_Addr *got asm ("%l7"); ++ ++ LOAD_PIC_REG (got); ++ + return *got; + } + +@@ -80,6 +93,8 @@ + elf_machine_load_address (void) + { + register Elf32_Addr pc __asm("%o7"), pic __asm("%l7"), got; ++ ++ LOAD_PIC_REG (pic); + + /* Utilize the fact that a local .got entry will be partially + initialized at startup awaiting its RELATIVE fixup. */ +diff -urN glibc-2.2.5.orig/sysdeps/sparc/sparc64/dl-machine.h glibc-2.2.5/sysdeps/sparc/sparc64/dl-machine.h +--- glibc-2.2.5.orig/sysdeps/sparc/sparc64/dl-machine.h Mon Jun 17 21:48:12 2002 ++++ glibc-2.2.5/sysdeps/sparc/sparc64/dl-machine.h Mon Jun 17 22:27:52 2002 +@@ -34,6 +34,18 @@ + return ehdr->e_machine == EM_SPARCV9; + } + ++/* We have to do this because elf_machine_{dynamic,load_address} can be ++ invoked from functions that have no GOT references, and thus the compiler ++ has no obligation to load the PIC register. */ ++#define LOAD_PIC_REG(PIC_REG) \ ++do { Elf64_Addr tmp; \ ++ __asm("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t" \ ++ "rd %%pc, %0\n\t" \ ++ "add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t" \ ++ "add %0, %1, %0" \ ++ : "=r" (PIC_REG), "=r" (tmp)); \ ++} while (0) ++ + /* Return the link-time address of _DYNAMIC. Conveniently, this is the + first element of the GOT. This must be inlined in a function which + uses global data. */ +@@ -42,6 +54,8 @@ + { + register Elf64_Addr *elf_pic_register __asm__("%l7"); + ++ LOAD_PIC_REG (elf_pic_register); ++ + return *elf_pic_register; + } + +@@ -50,6 +64,8 @@ + elf_machine_load_address (void) + { + register Elf64_Addr *elf_pic_register __asm__("%l7"); ++ ++ LOAD_PIC_REG (elf_pic_register); + + /* We used to utilize the fact that a local .got entry will + be partially initialized at startup awaiting its RELATIVE +diff -urN glibc-2.2.5.orig/sysdeps/sparc/sparc64/strncmp.S glibc-2.2.5/sysdeps/sparc/sparc64/strncmp.S +--- glibc-2.2.5.orig/sysdeps/sparc/sparc64/strncmp.S Mon Jun 17 21:48:12 2002 ++++ glibc-2.2.5/sysdeps/sparc/sparc64/strncmp.S Mon Jun 17 22:27:52 2002 +@@ -290,14 +290,15 @@ + ldxa [%o0] ASI_PNF, %g4 /* Load */ + 11: sllx %g3, 3, %g5 /* IEU0 Group */ + mov 64, %g7 /* IEU1 */ +- sub %o1, %g3, %o1 /* IEU0 Group */ ++ or %g1, %g2, %g1 /* IEU0 Group */ ++ sub %o1, %g3, %o1 /* IEU1 */ + +- sub %g7, %g5, %g7 /* IEU1 */ ++ sub %g7, %g5, %g7 /* IEU0 Group */ + ldxa [%o1] ASI_PNF, %o4 /* Load */ +- sllx %g1, 7, %g2 /* IEU0 Group */ +- add %o1, 8, %o1 /* IEU1 */ ++ sllx %g1, 7, %g2 /* IEU1 */ ++ add %o1, 8, %o1 /* IEU0 Group */ + /* %g1 = 0101010101010101 +- %g2 = 8080808080800880 ++ %g2 = 8080808080808080 + %g3 = %o1 alignment + %g5 = number of bits to shift left + %g7 = number of bits to shift right */ +diff -urN glibc-2.2.5.orig/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h glibc-2.2.5/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h +--- glibc-2.2.5.orig/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h Mon Jun 17 21:48:12 2002 ++++ glibc-2.2.5/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h Mon Jun 17 22:27:52 2002 +@@ -48,7 +48,7 @@ + #define END(name) \ + .size name, . - name + +-#define LOC(name) . ## L ## name ++#define LOC(name) .##L##name + + #ifdef PIC + #define SYSCALL_ERROR_HANDLER \ +diff -urN glibc-2.2.5.orig/sysdeps/unix/sysv/linux/sparc/sys/procfs.h glibc-2.2.5/sysdeps/unix/sysv/linux/sparc/sys/procfs.h +--- glibc-2.2.5.orig/sysdeps/unix/sysv/linux/sparc/sys/procfs.h Mon Jun 17 21:48:12 2002 ++++ glibc-2.2.5/sysdeps/unix/sysv/linux/sparc/sys/procfs.h Mon Jun 17 22:27:52 2002 +@@ -35,7 +35,7 @@ + + #if __WORDSIZE == 64 + +-#define ELF_NGREG 20 ++#define ELF_NGREG 36 + + typedef struct + { +@@ -138,6 +138,73 @@ + + typedef struct elf_prstatus prstatus_t; + typedef struct elf_prpsinfo prpsinfo_t; ++ ++#if __WORDSIZE == 64 ++ ++/* Provide 32-bit variants so that BFD can read 32-bit ++ core files. */ ++#define ELF_NGREG32 38 ++typedef struct ++ { ++ union ++ { ++ unsigned int pr_regs[32]; ++ double pr_dregs[16]; ++ } pr_fr; ++ unsigned int __unused; ++ unsigned int pr_fsr; ++ unsigned char pr_qcnt; ++ unsigned char pr_q_entrysize; ++ unsigned char pr_en; ++ unsigned int pr_q[64]; ++ } elf_fpregset_t32; ++ ++typedef unsigned int elf_greg_t32; ++typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG32]; ++ ++struct elf_prstatus32 ++ { ++ struct elf_siginfo pr_info; /* Info associated with signal. */ ++ short int pr_cursig; /* Current signal. */ ++ unsigned int pr_sigpend; /* Set of pending signals. */ ++ unsigned int pr_sighold; /* Set of held signals. */ ++ __pid_t pr_pid; ++ __pid_t pr_ppid; ++ __pid_t pr_pgrp; ++ __pid_t pr_sid; ++ struct ++ { ++ int tv_sec, tv_usec; ++ } pr_utime, /* User time. */ ++ pr_stime, /* System time. */ ++ pr_cutime, /* Cumulative user time. */ ++ pr_cstime; /* Cumulative system time. */ ++ elf_gregset_t32 pr_reg; /* GP registers. */ ++ int pr_fpvalid; /* True if math copro being used. */ ++ }; ++ ++struct elf_prpsinfo32 ++ { ++ char pr_state; /* Numeric process state. */ ++ char pr_sname; /* Char for pr_state. */ ++ char pr_zomb; /* Zombie. */ ++ char pr_nice; /* Nice val. */ ++ unsigned int pr_flag; /* Flags. */ ++ unsigned short int pr_uid; ++ unsigned short int pr_gid; ++ int pr_pid, pr_ppid, pr_pgrp, pr_sid; ++ /* Lots missing */ ++ char pr_fname[16]; /* Filename of executable. */ ++ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ ++ }; ++ ++typedef elf_gregset_t32 prgregset32_t; ++typedef elf_fpregset_t32 prfpregset32_t; ++ ++typedef struct elf_prstatus32 prstatus32_t; ++typedef struct elf_prpsinfo32 prpsinfo32_t; ++ ++#endif /* sparc64 */ + + __END_DECLS + diff --git a/src/patchsets/glibc/2.2.5/17_all_glibc-2.2.5-sparc64-fixups.patch b/src/patchsets/glibc/2.2.5/17_all_glibc-2.2.5-sparc64-fixups.patch new file mode 100644 index 0000000000..181f13c52d --- /dev/null +++ b/src/patchsets/glibc/2.2.5/17_all_glibc-2.2.5-sparc64-fixups.patch @@ -0,0 +1,46 @@ +#! /bin/sh -e + +# DP: Fix ldconfig so that lib64 searches are implicit. + +if [ $# -ne 2 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;; + -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +esac +exit 0 + +--- glibc-2.2.3/elf/ldconfig.c~ Tue Mar 20 11:44:35 2001 ++++ glibc-2.2.3/elf/ldconfig.c Tue Apr 24 18:14:05 2001 +@@ -287,6 +287,26 @@ + dir_entries = entry; + else if (ptr == NULL) + prev->next = entry; ++#ifdef __sparc__ ++#define MSUBDIR "64" ++ if (ptr == NULL) { ++ int si = strlen(entry->path) - strlen(MSUBDIR); ++ if (strcmp (entry->path + (si <= 0 ? 0 : si), MSUBDIR) != 0) { ++ /* Handle subdirectory later. */ ++ struct dir_entry *new_entry; ++ ++ new_entry = xmalloc (sizeof (struct dir_entry)); ++ new_entry->path = xmalloc(strlen(entry->path)+strlen(MSUBDIR)+1); ++ new_entry->flag = entry->flag; ++ new_entry->next = NULL; ++ sprintf(new_entry->path, "%s%s", entry->path, MSUBDIR); ++ if (opt_verbose) ++ printf("Adding implicit multilib directory:\n\t%s\n", new_entry->path); ++ add_single_dir (new_entry, 0); ++ } ++ } ++#undef MSUBDIR ++#endif + } + + /* Add one directory to the list of directories to process. */ diff --git a/src/patchsets/glibc/2.2.5/18_all_glibc-2.2.5-sparc32-semctl.patch b/src/patchsets/glibc/2.2.5/18_all_glibc-2.2.5-sparc32-semctl.patch new file mode 100644 index 0000000000..9017b8bed5 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/18_all_glibc-2.2.5-sparc32-semctl.patch @@ -0,0 +1,209 @@ +--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c.jj Fri Feb 11 20:44:42 2000 ++++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c Thu Apr 25 22:52:00 2002 +@@ -1 +1,205 @@ +-#include <sysdeps/unix/sysv/linux/i386/semctl.c> ++/* Semctl for architectures where word sized unions are passed indirectly ++ 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. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include <errno.h> ++#include <stdarg.h> ++#include <sys/sem.h> ++#include <ipc_priv.h> ++ ++#include <sysdep.h> ++#include <string.h> ++#include <sys/syscall.h> ++ ++#include "kernel-features.h" ++#include <shlib-compat.h> ++ ++struct __old_semid_ds ++{ ++ struct __old_ipc_perm sem_perm; /* operation permission struct */ ++ __time_t sem_otime; /* last semop() time */ ++ __time_t sem_ctime; /* last time changed by semctl() */ ++ struct sem *__sembase; /* ptr to first semaphore in array */ ++ struct sem_queue *__sem_pending; /* pending operations */ ++ struct sem_queue *__sem_pending_last; /* last pending operation */ ++ struct sem_undo *__undo; /* ondo requests on this array */ ++ unsigned short int sem_nsems; /* number of semaphores in set */ ++}; ++ ++/* Define a `union semun' suitable for Linux here. */ ++union semun ++{ ++ int val; /* value for SETVAL */ ++ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ ++ unsigned short int *array; /* array for GETALL & SETALL */ ++ struct seminfo *__buf; /* buffer for IPC_INFO */ ++}; ++ ++#include <bp-checks.h> ++#include <bp-semctl.h> /* definition of CHECK_SEMCTL needs union semum */ ++ ++#ifdef __NR_getuid32 ++# if __ASSUME_32BITUIDS == 0 ++/* This variable is shared with all files that need to check for 32bit ++ uids. */ ++extern int __libc_missing_32bit_uids; ++# endif ++#endif ++ ++/* Return identifier for array of NSEMS semaphores associated with ++ KEY. */ ++#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) ++int __old_semctl (int semid, int semnum, int cmd, ...); ++#endif ++int __new_semctl (int semid, int semnum, int cmd, ...); ++ ++#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) ++int ++__old_semctl (int semid, int semnum, int cmd, ...) ++{ ++ union semun arg; ++ va_list ap; ++ ++ /* Get the argument only if required. */ ++ arg.buf = NULL; ++ switch (cmd) ++ { ++ case SETVAL: /* arg.val */ ++ case GETALL: /* arg.array */ ++ case SETALL: ++ case IPC_STAT: /* arg.buf */ ++ case IPC_SET: ++ case SEM_STAT: ++ case IPC_INFO: /* arg.__buf */ ++ case SEM_INFO: ++ va_start (ap, cmd); ++ arg = va_arg (ap, union semun); ++ va_end (ap); ++ break; ++ } ++ ++ return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, ++ CHECK_SEMCTL (&arg, semid, cmd)); ++} ++compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0); ++#endif ++ ++int ++__new_semctl (int semid, int semnum, int cmd, ...) ++{ ++ union semun arg; ++ va_list ap; ++ ++ /* Get the argument only if required. */ ++ arg.buf = NULL; ++ switch (cmd) ++ { ++ case SETVAL: /* arg.val */ ++ case GETALL: /* arg.array */ ++ case SETALL: ++ case IPC_STAT: /* arg.buf */ ++ case IPC_SET: ++ case SEM_STAT: ++ case IPC_INFO: /* arg.__buf */ ++ case SEM_INFO: ++ va_start (ap, cmd); ++ arg = va_arg (ap, union semun); ++ va_end (ap); ++ break; ++ } ++ ++#if __ASSUME_32BITUIDS > 0 ++ return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64, ++ CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)); ++#else ++ switch (cmd) { ++ case SEM_STAT: ++ case IPC_STAT: ++ case IPC_SET: ++ break; ++ default: ++ return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, ++ CHECK_SEMCTL (&arg, semid, cmd)); ++ } ++ ++ { ++ int result; ++ struct __old_semid_ds old; ++ struct semid_ds *buf; ++ ++#ifdef __NR_getuid32 ++ if (__libc_missing_32bit_uids <= 0) ++ { ++ if (__libc_missing_32bit_uids < 0) ++ { ++ int save_errno = errno; ++ ++ /* Test presence of new IPC by testing for getuid32 syscall. */ ++ result = INLINE_SYSCALL (getuid32, 0); ++ if (result == -1 && errno == ENOSYS) ++ __libc_missing_32bit_uids = 1; ++ else ++ __libc_missing_32bit_uids = 0; ++ __set_errno(save_errno); ++ } ++ if (__libc_missing_32bit_uids <= 0) ++ { ++ result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64, ++ CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)); ++ return result; ++ } ++ } ++#endif ++ ++ buf = arg.buf; ++ arg.buf = (struct semid_ds *)&old; ++ if (cmd == IPC_SET) ++ { ++ old.sem_perm.uid = buf->sem_perm.uid; ++ old.sem_perm.gid = buf->sem_perm.gid; ++ old.sem_perm.mode = buf->sem_perm.mode; ++ if (old.sem_perm.uid != buf->sem_perm.uid || ++ old.sem_perm.gid != buf->sem_perm.gid) ++ { ++ __set_errno (EINVAL); ++ return -1; ++ } ++ } ++ result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, ++ CHECK_SEMCTL (&arg, semid, cmd)); ++ if (result != -1 && cmd != IPC_SET) ++ { ++ memset(buf, 0, sizeof(*buf)); ++ buf->sem_perm.__key = old.sem_perm.__key; ++ buf->sem_perm.uid = old.sem_perm.uid; ++ buf->sem_perm.gid = old.sem_perm.gid; ++ buf->sem_perm.cuid = old.sem_perm.cuid; ++ buf->sem_perm.cgid = old.sem_perm.cgid; ++ buf->sem_perm.mode = old.sem_perm.mode; ++ buf->sem_perm.__seq = old.sem_perm.__seq; ++ buf->sem_otime = old.sem_otime; ++ buf->sem_ctime = old.sem_ctime; ++ buf->sem_nsems = old.sem_nsems; ++ } ++ return result; ++ } ++#endif ++} ++ ++versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2); diff --git a/src/patchsets/glibc/2.2.5/19_all_glibc-2.2.5-arm-sysdeps-fix.patch b/src/patchsets/glibc/2.2.5/19_all_glibc-2.2.5-arm-sysdeps-fix.patch new file mode 100644 index 0000000000..42b398ee83 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/19_all_glibc-2.2.5-arm-sysdeps-fix.patch @@ -0,0 +1,13 @@ +--- sysdeps/unix/sysv/linux/configure.orig Mon Sep 23 21:31:29 2002 ++++ sysdeps/unix/sysv/linux/configure Mon Sep 23 21:30:09 2002 +@@ -60,6 +60,10 @@ + libc_cv_gcc_unwind_find_fde=yes + arch_minimum_kernel=2.0.10 + ;; ++ arm*) ++ arch_minimum_kernel=2.4.0 ++ libc_cv_gcc_unwind_find_fde=yes ++ ;; + ia64*) + arch_minimum_kernel=2.4.0 + ;; diff --git a/src/patchsets/glibc/2.2.5/20_all_glibc-2.2.5-arm-errlist-fix.patch b/src/patchsets/glibc/2.2.5/20_all_glibc-2.2.5-arm-errlist-fix.patch new file mode 100644 index 0000000000..90799ae65c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/20_all_glibc-2.2.5-arm-errlist-fix.patch @@ -0,0 +1,51 @@ +2002-07-22 Philip Blundell <philb@gnu.org> + + * sysdeps/unix/sysv/linux/arm/errlist.c: Remove extra weak alias + definiton of _old_sys_nerr. Define _old_sys_errlist as strong + alias. + +2002-05-19 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/unix/sysv/linux/errlist.c: Remove extra weak alias + definiton of _old_sys_nerr. Define _old_sys_errlist as strong + alias. + +--- sysdeps/unix/sysv/linux/errlist.c 6 Jul 2001 04:56:12 -0000 1.8 ++++ sysdeps/unix/sysv/linux/errlist.c 3 Jun 2002 06:49:30 -0000 1.8.2.1 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. ++/* Copyright (C) 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,7 +41,7 @@ + strong_alias (__old_sys_nerr, _old_sys_nerr); + compat_symbol (libc, __old_sys_nerr, _sys_nerr, GLIBC_2_0); + compat_symbol (libc, _old_sys_nerr, sys_nerr, GLIBC_2_0); +-weak_alias (__old_sys_errlist, _old_sys_errlist); ++strong_alias (__old_sys_errlist, _old_sys_errlist); + compat_symbol (libc, __old_sys_errlist, _sys_errlist, GLIBC_2_0); + compat_symbol (libc, _old_sys_errlist, sys_errlist, GLIBC_2_0); + #endif + +--- sysdeps/unix/sysv/linux/arm/errlist.c 6 Jul 2001 04:56:13 -0000 1.4 ++++ sysdeps/unix/sysv/linux/arm/errlist.c 24 Jul 2002 11:17:01 -0000 1.5 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. ++/* Copyright (C) 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 +@@ -38,10 +38,9 @@ extern const char *const *__old_sys_errl + const int __old_sys_nerr = OLD_ERRLIST_SIZE; + + strong_alias (__old_sys_nerr, _old_sys_nerr); +-weak_alias (__old_sys_nerr, _old_sys_nerr) + compat_symbol (libc, __old_sys_nerr, _sys_nerr, GLIBC_2_0); + compat_symbol (libc, _old_sys_nerr, sys_nerr, GLIBC_2_0); +-weak_alias (__old_sys_errlist, _old_sys_errlist); ++strong_alias (__old_sys_errlist, _old_sys_errlist); + compat_symbol (libc, __old_sys_errlist, _sys_errlist, GLIBC_2_0); + compat_symbol (libc, _old_sys_errlist, sys_errlist, GLIBC_2_0); + #endif + diff --git a/src/patchsets/glibc/2.2.5/man/pthread_atfork.3thr b/src/patchsets/glibc/2.2.5/man/pthread_atfork.3thr new file mode 100644 index 0000000000..b1b4eaefc1 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_atfork.3thr @@ -0,0 +1,110 @@ +.TH PTHREAD_ATFORK 3 LinuxThreads + +.SH NAME +pthread_atfork \- register handlers to be called at fork(2) time + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_atfork(void (*" prepare ")(void), void (*" parent ")(void), void (*" child ")(void));" + +.SH DESCRIPTION + +.B "pthread_atfork" +registers handler functions to be called just before +and just after a new process is created with +.BR "fork" (2). +The +.I "prepare" +handler will be called from the parent process, just before the new +process is created. The +.I "parent" +handler will be called from the parent +process, just before +.BR "fork" (2) +returns. The +.I "child" +handler will be +called from the child process, just before +.BR "fork" (2) +returns. + +One or several of the three handlers +.IR "prepare" , +.I "parent" +and +.I "child" +can be given as +.BR "NULL" , +meaning that no handler needs to be called at +the corresponding point. + +.B "pthread_atfork" +can be called several times to install several sets +of handlers. At +.BR "fork" (2) +time, the +.I "prepare" +handlers are called in +LIFO order (last added with +.BR "pthread_atfork" , +first called before +.BR "fork" ), +while the +.I "parent" +and +.I "child" +handlers are called in FIFO order +(first added, first called). + +To understand the purpose of +.BR "pthread_atfork" , +recall that +.BR "fork" (2) +duplicates the whole memory space, including mutexes in their current +locking state, but only the calling thread: other threads are not +running in the child process. Thus, if a mutex is locked by a thread +other than the thread calling +.BR "fork" , +that mutex will remain locked +forever in the child process, possibly blocking the execution of the +child process. To avoid this, install handlers with +.B "pthread_atfork" +as follows: the +.I "prepare" +handler locks the global mutexes (in locking +order), and the +.I "parent" +and +.I "child" +handlers unlock them (in +reverse order). Alternatively, +.I "prepare" +and +.I "parent" +can be set to +.B "NULL" +and +.I "child" +to a function that calls +.B "pthread_mutex_init" +on +the global mutexes. + +.SH "RETURN VALUE" + +.B "pthread_atfork" +returns 0 on success and a non-zero error code on error. + +.SH ERRORS +.TP +.B "ENOMEM" +insufficient memory available to register the handlers. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "fork" (2), +.BR "pthread_mutex_lock" (3), +.BR "pthread_mutex_unlock" (3). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_destroy.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_destroy.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_destroy.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_getdetachstate.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_getdetachstate.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_getdetachstate.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_getinheritsched.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_getinheritsched.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_getinheritsched.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_getschedparam.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_getschedparam.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_getschedparam.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_getschedpolicy.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_getschedpolicy.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_getschedpolicy.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_getscope.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_getscope.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_getscope.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_init.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_init.3thr new file mode 100644 index 0000000000..1948c09395 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_init.3thr @@ -0,0 +1,309 @@ +.TH PTHREAD_ATTR_INIT 3 LinuxThreads + + +.SH NAME +pthread_attr_init, pthread_attr_destroy, pthread_attr_setdetachstate, pthread_attr_getdetachstate, pthread_attr_setschedparam, pthread_attr_getschedparam, pthread_attr_setschedpolicy, pthread_attr_getschedpolicy, pthread_attr_setinheritsched, pthread_attr_getinheritsched, pthread_attr_setscope, pthread_attr_getscope \- thread creation attributes + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_attr_init(pthread_attr_t *" attr ");" + +.BI "int pthread_attr_destroy(pthread_attr_t *" attr ");" + +.BI "int pthread_attr_setdetachstate(pthread_attr_t *" attr ", int " detachstate ");" + +.BI "int pthread_attr_getdetachstate(const pthread_attr_t *" attr ", int *" detachstate ");" + +.BI "int pthread_attr_setschedpolicy(pthread_attr_t *" attr ", int " policy ");" + +.BI "int pthread_attr_getschedpolicy(const pthread_attr_t *" attr ", int *" policy ");" + +.BI "int pthread_attr_setschedparam(pthread_attr_t *" attr ", const struct sched_param *" param ");" + +.BI "int pthread_attr_getschedparam(const pthread_attr_t *" attr ", struct sched_param *" param ");" + +.BI "int pthread_attr_setinheritsched(pthread_attr_t *" attr ", int " inherit ");" + +.BI "int pthread_attr_getinheritsched(const pthread_attr_t *" attr ", int *" inherit ");" + +.BI "int pthread_attr_setscope(pthread_attr_t *" attr ", int " scope ");" + +.BI "int pthread_attr_getscope(const pthread_attr_t *" attr ", int *" scope ");" + +.SH DESCRIPTION + +Setting attributes for threads is achieved by filling a +thread attribute object +.I "attr" +of type +.BR "pthread_attr_t" , +then passing it as +second argument to +.BR "pthread_create" (3). +Passing +.B "NULL" +is equivalent to +passing a thread attribute object with all attributes set to their +default values. + +.B "pthread_attr_init" +initializes the thread attribute object +.I "attr" +and +fills it with default values for the attributes. (The default values +are listed below for each attribute.) + +Each attribute +.I "attrname" +(see below for a list of all attributes) can +be individually set using the function +.BI "pthread_attr_set" "attrname" +and retrieved using the function +.BI "pthread_attr_get" "attrname." + +.B "pthread_attr_destroy" +destroys a thread attribute object, which +must not be reused until it is reinitialized. +.B "pthread_attr_destroy" +does nothing in the LinuxThreads implementation. + +Attribute objects are consulted only when creating a new thread. The +same attribute object can be used for creating several +threads. Modifying an attribute object after a call to +.B "pthread_create" +does not change the attributes of the thread +previously created. + +The following thread attributes are supported: + +.SS detachstate + +Control whether the thread is created in the joinable state (value +.BR "PTHREAD_CREATE_JOINABLE" ) +or in the detached state +( +.BR "PTHREAD_CREATE_DETACHED" ). + +Default value: +.BR "PTHREAD_CREATE_JOINABLE" . + +In the joinable state, another thread can synchronize on the thread +termination and recover its termination code using +.BR "pthread_join" (3), +but some of the thread resources are kept allocated after the thread +terminates, and reclaimed only when another thread performs +.BR "pthread_join" (3) +on that thread. + +In the detached state, the thread resources are immediately freed when +it terminates, but +.BR "pthread_join" (3) +cannot be used to synchronize on +the thread termination. + +A thread created in the joinable state can later be put in the +detached thread using +.BR "pthread_detach" (3). + +.SS schedpolicy + +Select the scheduling policy for the thread: one of +.B "SCHED_OTHER" +(regular, non-realtime scheduling), +.B "SCHED_RR" +(realtime, round-robin) or +.B "SCHED_FIFO" +(realtime, first-in first-out). See +.BR "sched_setpolicy" (2) +for more information on scheduling policies. + +Default value: +.BR "SCHED_OTHER" . + +The realtime scheduling policies +.B "SCHED_RR" +and +.B "SCHED_FIFO" +are +available only to processes with superuser privileges. + +The scheduling policy of a thread can be changed after creation with +.BR "pthread_setschedparam" (3). + +.SS schedparam + +Contain the scheduling parameters (essentially, the scheduling +priority) for the thread. See +.BR "sched_setparam" (2) +for more information +on scheduling parameters. + +Default value: priority is 0. + +This attribute is not significant if the scheduling policy is +.BR "SCHED_OTHER" ; +it only matters for the realtime policies +.B "SCHED_RR" +and +.BR "SCHED_FIFO" . + +The scheduling priority of a thread can be changed after creation with +.BR "pthread_setschedparam" (3). + +.SS inheritsched + +Indicate whether the scheduling policy and scheduling parameters for +the newly created thread are determined by the values of the +.I "schedpolicy" +and +.I "schedparam" +attributes (value +.BR "PTHREAD_EXPLICIT_SCHED" ) +or are inherited from the parent thread +(value +.BR "PTHREAD_INHERIT_SCHED" ). + +Default value: +.BR "PTHREAD_EXPLICIT_SCHED" . + +.SS scope + +Define the scheduling contention scope for the created thread. The +only value supported in the LinuxThreads implementation is +.BR "PTHREAD_SCOPE_SYSTEM" , +meaning that the threads contend for CPU time +with all processes running on the machine. In particular, thread +priorities are interpreted relative to the priorities of all other +processes on the machine. The other value specified by the standard, +.BR "PTHREAD_SCOPE_PROCESS" , +means that scheduling contention occurs only +between the threads of the running process: thread priorities are +interpreted relative to the priorities of the other threads of the +process, regardless of the priorities of other processes. +.B "PTHREAD_SCOPE_PROCESS" +is not supported in LinuxThreads. + +Default value: +.BR "PTHREAD_SCOPE_SYSTEM" . + +.SH "RETURN VALUE" + +All functions return 0 on success and a non-zero error code on error. +On success, the +.BI "pthread_attr_get" "attrname" +functions also store the +current value of the attribute +.I "attrname" +in the location pointed to +by their second argument. + +.SH ERRORS + +The +.B "pthread_attr_setdetachstate" +function returns the following error +codes on error: +.RS +.TP +.B "EINVAL" +the specified +.I "detachstate" +is not one of +.B "PTHREAD_CREATE_JOINABLE" +or +.BR "PTHREAD_CREATE_DETACHED" . +.RE + +The +.B "pthread_attr_setschedparam" +function returns the following error +codes on error: +.RS +.TP +.B "EINVAL" +the priority specified in +.I "param" +is outside the range of allowed +priorities for the scheduling policy currently in +.I "attr" +(1 to 99 for +.B "SCHED_FIFO" +and +.BR "SCHED_RR" ; +0 for +.BR "SCHED_OTHER" ). +.RE + +The +.B "pthread_attr_setschedpolicy" +function returns the following error +codes on error: +.RS +.TP +.B "EINVAL" +the specified +.I "policy" +is not one of +.BR "SCHED_OTHER" , +.BR "SCHED_FIFO" , +or +.BR "SCHED_RR" . + +.TP +.B "ENOTSUP" +.I "policy" +is +.B "SCHED_FIFO" +or +.BR "SCHED_RR" , +and the effective user of the +calling process is not super-user. +.RE + +The +.B "pthread_attr_setinheritsched" +function returns the following error +codes on error: +.RS +.TP +.B "EINVAL" +the specified +.I "inherit" +is not one of +.B "PTHREAD_INHERIT_SCHED" +or +.BR "PTHREAD_EXPLICIT_SCHED" . +.RE + +The +.B "pthread_attr_setscope" +function returns the following error +codes on error: +.RS +.TP +.B "EINVAL" +the specified +.I "scope" +is not one of +.B "PTHREAD_SCOPE_SYSTEM" +or +.BR "PTHREAD_SCOPE_PROCESS" . + +.TP +.B "ENOTSUP" +the specified +.I "scope" +is +.B "PTHREAD_SCOPE_PROCESS" +(not supported). +.RE + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_create" (3), +.BR "pthread_join" (3), +.BR "pthread_detach" (3), +.BR "pthread_setschedparam" (3). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_setdetachstate.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_setdetachstate.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_setdetachstate.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_setinheritsched.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_setinheritsched.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_setinheritsched.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_setschedparam.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_setschedparam.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_setschedparam.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_setschedpolicy.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_setschedpolicy.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_setschedpolicy.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_attr_setscope.3thr b/src/patchsets/glibc/2.2.5/man/pthread_attr_setscope.3thr new file mode 100644 index 0000000000..380ce7e58c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_attr_setscope.3thr @@ -0,0 +1 @@ +.so man3/pthread_attr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cancel.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cancel.3thr new file mode 100644 index 0000000000..7290cca5d3 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cancel.3thr @@ -0,0 +1,209 @@ +.TH PTHREAD_CANCEL 3 LinuxThreads + + +.SH NAME +pthread_cancel, pthread_setcancelstate, pthread_setcanceltype, pthread_testcancel \- thread cancellation + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_cancel(pthread_t " thread ");" + +.BI "int pthread_setcancelstate(int " state ", int *" oldstate ");" + +.BI "int pthread_setcanceltype(int " type ", int *" oldtype ");" + +.BI "void pthread_testcancel(void);" + +.SH DESCRIPTION + +Cancellation is the mechanism by which a thread can terminate the +execution of another thread. More precisely, a thread can send a +cancellation request to another thread. Depending on its settings, the +target thread can then either ignore the request, honor it +immediately, or defer it till it reaches a cancellation point. + +When a thread eventually honors a cancellation request, it performs as +if +.B "pthread_exit(PTHREAD_CANCELED)" +has been called at that point: +all cleanup handlers are executed in reverse order, finalization +functions for thread-specific data are called, and finally the thread +stops executing with the return value +.BR "PTHREAD_CANCELED" . +See +.BR "pthread_exit" (3) +for more information. + +.B "pthread_cancel" +sends a cancellation request to the thread denoted +by the +.I "thread" +argument. + +.B "pthread_setcancelstate" +changes the cancellation state for the +calling thread -- that is, whether cancellation requests are ignored +or not. The +.I "state" +argument is the new cancellation state: either +.B "PTHREAD_CANCEL_ENABLE" +to enable cancellation, or +.B "PTHREAD_CANCEL_DISABLE" +to disable cancellation (cancellation +requests are ignored). If +.I "oldstate" +is not +.BR "NULL" , +the previous +cancellation state is stored in the location pointed to by +.IR "oldstate" , +and can thus be restored later by another call to +.BR "pthread_setcancelstate" . + +.B "pthread_setcanceltype" +changes the type of responses to cancellation +requests for the calling thread: asynchronous (immediate) or deferred. +The +.I "type" +argument is the new cancellation type: either +.B "PTHREAD_CANCEL_ASYNCHRONOUS" +to cancel the calling thread as soon as +the cancellation request is received, or +.B "PTHREAD_CANCEL_DEFERRED" +to +keep the cancellation request pending until the next cancellation +point. If +.I "oldtype" +is not +.BR "NULL" , +the previous +cancellation state is stored in the location pointed to by +.IR "oldtype" , +and can thus be restored later by another call to +.BR "pthread_setcanceltype" . + +Threads are always created by +.BR "pthread_create" (3) +with cancellation +enabled and deferred. That is, the initial cancellation state is +.B "PTHREAD_CANCEL_ENABLE" +and the initial type is +.BR "PTHREAD_CANCEL_DEFERRED" . + +Cancellation points are those points in the program execution where a +test for pending cancellation requests is performed and cancellation +is executed if positive. The following POSIX threads functions +are cancellation points: + +.BR "pthread_join" (3) +.br +.BR "pthread_cond_wait" (3) +.br +.BR "pthread_cond_timedwait" (3) +.br +.BR "pthread_testcancel" (3) +.br +.BR "sem_wait" (3) +.br +.BR "sigwait" (3) + +All other POSIX threads functions are guaranteed not to be +cancellation points. That is, they never perform cancellation in +deferred cancellation mode. + +.B "pthread_testcancel" +does nothing except testing for pending +cancellation and executing it. Its purpose is to introduce explicit +checks for cancellation in long sequences of code that do not call +cancellation point functions otherwise. + +.SH "RETURN VALUE" + +.BR "pthread_cancel" , +.B "pthread_setcancelstate" +and +.B "pthread_setcanceltype" +return 0 on success and a non-zero error code +on error. + +.SH ERRORS +.B "pthread_cancel" +returns the following error code on error: +.RS +.TP +.B "ESRCH" +no thread could be found corresponding to that specified by the +.I "thread" +ID. +.RE + +.B "pthread_setcancelstate" +returns the following error code on error: +.RS +.TP +.B "EINVAL" +the +.I "state" +argument is not +.B "PTHREAD_CANCEL_ENABLE" +nor +.B "PTHREAD_CANCEL_DISABLE" +.RE + +.B "pthread_setcanceltype" +returns the following error code on error: +.RS +.TP +.B "EINVAL" +the +.I "type" +argument is not +.B "PTHREAD_CANCEL_DEFERRED" +nor +.B "PTHREAD_CANCEL_ASYNCHRONOUS" +.RE + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_exit" (3), +.BR "pthread_cleanup_push" (3), +.BR "pthread_cleanup_pop" (3). + +.SH BUGS + +POSIX specifies that a number of system calls (basically, all +system calls that may block, such as +.BR "read" (2), +.BR "write" (2), +.BR "wait" (2), +etc.) and library functions that may call these system calls (e.g. +.BR "fprintf" (3)) +are cancellation points. LinuxThreads is not yet +integrated enough with the C library to implement this, and thus none +of the C library functions is a cancellation point. + +For system calls at least, there is a workaround. Cancellation +requests are transmitted to the target thread by sending it a +signal. That signal will interrupt all blocking system calls, causing +them to return immediately with the +.B "EINTR" +error. So, checking for +cancellation during a +.B "read" +system call, for instance, can be +achieved as follows: + +.RS +.ft 3 +.nf +.sp +pthread_testcancel(); +retcode = read(fd, buffer, length); +pthread_testcancel(); +.ft +.LP +.RE +.fi diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cleanup_pop.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cleanup_pop.3thr new file mode 100644 index 0000000000..14a43bc859 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cleanup_pop.3thr @@ -0,0 +1 @@ +.so man3/pthread_cleanup_push.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cleanup_pop_restore_np.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cleanup_pop_restore_np.3thr new file mode 100644 index 0000000000..14a43bc859 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cleanup_pop_restore_np.3thr @@ -0,0 +1 @@ +.so man3/pthread_cleanup_push.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cleanup_push.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cleanup_push.3thr new file mode 100644 index 0000000000..491bb8763c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cleanup_push.3thr @@ -0,0 +1,253 @@ +.TH PTHREAD_CLEANUP 3 LinuxThreads + + +.SH NAME +pthread_cleanup_push, pthread_cleanup_pop, pthread_cleanup_push_defer_np, pthread_cleanup_pop_restore_np \- install and remove cleanup handlers + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "void pthread_cleanup_push(void (*" routine ") (void *), void *" arg ");" + +.BI "void pthread_cleanup_pop(int " execute ");" + +.BI "void pthread_cleanup_push_defer_np(void (*" routine ") (void *), void *" arg ");" + +.BI "void pthread_cleanup_pop_restore_np(int " execute ");" + +.SH DESCRIPTION + +Cleanup handlers are functions that get called when a thread +terminates, either by calling +.BR "pthread_exit" (3) +or because of +cancellation. Cleanup handlers are installed and removed following a +stack-like discipline. + +The purpose of cleanup handlers is to free the resources that a thread +may hold at the time it terminates. In particular, if a thread +exits or is cancelled while it owns a locked mutex, the mutex will +remain locked forever and prevent other threads from executing +normally. The best way to avoid this is, just before locking the +mutex, to install a cleanup handler whose effect is to unlock the +mutex. Cleanup handlers can be used similarly to free blocks allocated +with +.BR "malloc" (3) +or close file descriptors on thread termination. + +.B "pthread_cleanup_push" +installs the +.I "routine" +function with argument +.I "arg" +as a cleanup handler. From this point on to the matching +.BR "pthread_cleanup_pop" , +the function +.I "routine" +will be called with +arguments +.I "arg" +when the thread terminates, either through +.BR "pthread_exit" (3) +or by cancellation. If several cleanup handlers are active at that +point, they are called in LIFO order: the most recently installed +handler is called first. + +.B "pthread_cleanup_pop" +removes the most recently installed cleanup +handler. If the +.I "execute" +argument is not 0, it also executes the +handler, by calling the +.I "routine" +function with arguments +.IR "arg" . +If +the +.I "execute" +argument is 0, the handler is only removed but not +executed. + +Matching pairs of +.B "pthread_cleanup_push" +and +.B "pthread_cleanup_pop" +must occur in the same function, at the same level of block nesting. +Actually, +.B "pthread_cleanup_push" +and +.B "pthread_cleanup_pop" +are macros, +and the expansion of +.B "pthread_cleanup_push" +introduces an open brace +.B "{" +with the matching closing brace +.B "}" +being introduced by the expansion +of the matching +.BR "pthread_cleanup_pop" . + +.B "pthread_cleanup_push_defer_np" +is a non-portable extension that +combines +.B "pthread_cleanup_push" +and +.BR "pthread_setcanceltype" (3). +It pushes a cleanup handler just as +.B "pthread_cleanup_push" +does, but +also saves the current cancellation type and sets it to deferred +cancellation. This ensures that the cleanup mechanism is effective +even if the thread was initially in asynchronous cancellation mode. + +.B "pthread_cleanup_pop_restore_np" +pops a cleanup handler introduced by +.BR "pthread_cleanup_push_defer_np" , +and restores the cancellation type to +its value at the time +.B "pthread_cleanup_push_defer_np" +was called. + +.B "pthread_cleanup_push_defer_np" +and +.B "pthread_cleanup_pop_restore_np" +must occur in matching pairs, at the same level of block nesting. + +The following sequence + +.RS +.ft 3 +.nf +.sp +pthread_cleanup_push_defer_np(routine, arg); +... +pthread_cleanup_pop_defer_np(execute); +.ft +.LP +.RE +.fi + +is functionally equivalent to (but more compact and more efficient than) + +.RS +.ft 3 +.nf +.sp +{ int oldtype; + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); + pthread_cleanup_push(routine, arg); + ... + pthread_cleanup_pop(execute); + pthread_setcanceltype(oldtype, NULL); +} +.ft +.LP +.RE +.fi + +.SH "RETURN VALUE" + +None. + +.SH ERRORS + +None. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_exit" (3), +.BR "pthread_cancel" (3), +.BR "pthread_setcanceltype" (3). + +.SH EXAMPLE + +Here is how to lock a mutex +.I "mut" +in such a way that it will be +unlocked if the thread is canceled while +.I "mut" +is locked: + +.RS +.ft 3 +.nf +.sp +pthread_cleanup_push(pthread_mutex_unlock, (void *) &mut); +pthread_mutex_lock(&mut); +/* do some work */ +pthread_mutex_unlock(&mut); +pthread_cleanup_pop(0); +.ft +.LP +.RE +.fi + +Equivalently, the last two lines can be replaced by + +.RS +.ft 3 +.nf +.sp +pthread_cleanup_pop(1); +.ft +.LP +.RE +.fi + +Notice that the code above is safe only in deferred cancellation mode +(see +.BR "pthread_setcanceltype" (3)). +In asynchronous cancellation mode, +a cancellation can occur between +.B "pthread_cleanup_push" +and +.BR "pthread_mutex_lock" , +or between +.B "pthread_mutex_unlock" +and +.BR "pthread_cleanup_pop" , +resulting in both cases in the thread trying to +unlock a mutex not locked by the current thread. This is the main +reason why asynchronous cancellation is difficult to use. + +If the code above must also work in asynchronous cancellation mode, +then it must switch to deferred mode for locking and unlocking the +mutex: + +.RS +.ft 3 +.nf +.sp +pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); +pthread_cleanup_push(pthread_mutex_unlock, (void *) &mut); +pthread_mutex_lock(&mut); +/* do some work */ +pthread_cleanup_pop(1); +pthread_setcanceltype(oldtype, NULL); +.ft +.LP +.RE +.fi + +The code above can be rewritten in a more compact and more +efficient way, using the non-portable functions +.B "pthread_cleanup_push_defer_np" +and +.BR "pthread_cleanup_pop_restore_np" : + +.RS +.ft 3 +.nf +.sp +pthread_cleanup_push_restore_np(pthread_mutex_unlock, (void *) &mut); +pthread_mutex_lock(&mut); +/* do some work */ +pthread_cleanup_pop_restore_np(1); +.ft +.LP +.RE +.fi + diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cleanup_push_defer_np.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cleanup_push_defer_np.3thr new file mode 100644 index 0000000000..14a43bc859 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cleanup_push_defer_np.3thr @@ -0,0 +1 @@ +.so man3/pthread_cleanup_push.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cond_broadcast.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cond_broadcast.3thr new file mode 100644 index 0000000000..1a999b8081 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cond_broadcast.3thr @@ -0,0 +1 @@ +.so man3/pthread_cond_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cond_destroy.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cond_destroy.3thr new file mode 100644 index 0000000000..1a999b8081 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cond_destroy.3thr @@ -0,0 +1 @@ +.so man3/pthread_cond_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cond_init.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cond_init.3thr new file mode 100644 index 0000000000..608e143f3d --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cond_init.3thr @@ -0,0 +1,345 @@ +.TH PTHREAD_COND 3 LinuxThreads + + +.SH NAME +pthread_cond_init, pthread_cond_destroy, pthread_cond_signal, pthread_cond_broadcast, pthread_cond_wait, pthread_cond_timedwait \- operations on conditions + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "pthread_cond_t " cond " = PTHREAD_COND_INITIALIZER;" + +.BI "int pthread_cond_init(pthread_cond_t *" cond ", pthread_condattr_t *" cond_attr ");" + +.BI "int pthread_cond_signal(pthread_cond_t *" cond ");" + +.BI "int pthread_cond_broadcast(pthread_cond_t *" cond ");" + +.BI "int pthread_cond_wait(pthread_cond_t *" cond ", pthread_mutex_t *" mutex ");" + +.BI "int pthread_cond_timedwait(pthread_cond_t *" cond ", pthread_mutex_t *" mutex ", const struct timespec *" abstime ");" + +.BI "int pthread_cond_destroy(pthread_cond_t *" cond ");" + +.SH DESCRIPTION + +A condition (short for ``condition variable'') is a synchronization +device that allows threads to suspend execution and relinquish the +processors until some predicate on shared data is satisfied. The basic +operations on conditions are: signal the condition (when the +predicate becomes true), and wait for the condition, suspending the +thread execution until another thread signals the condition. + +A condition variable must always be associated with a mutex, to avoid +the race condition where a thread prepares to wait on a condition +variable and another thread signals the condition just before the +first thread actually waits on it. + +.B "pthread_cond_init" +initializes the condition variable +.IR "cond" , +using the +condition attributes specified in +.IR "cond_attr" , +or default attributes +if +.I "cond_attr" +is +.BR "NULL" . +The LinuxThreads implementation supports no +attributes for conditions, hence the +.I "cond_attr" +parameter is actually +ignored. + +Variables of type +.B "pthread_cond_t" +can also be initialized +statically, using the constant +.BR "PTHREAD_COND_INITIALIZER" . + +.B "pthread_cond_signal" +restarts one of the threads that are waiting on +the condition variable +.IR "cond" . +If no threads are waiting on +.IR "cond" , +nothing happens. If several threads are waiting on +.IR "cond" , +exactly one +is restarted, but it is not specified which. + +.B "pthread_cond_broadcast" +restarts all the threads that are waiting on +the condition variable +.IR "cond" . +Nothing happens if no threads are +waiting on +.IR "cond" . + +.B "pthread_cond_wait" +atomically unlocks the +.I "mutex" +(as per +.BR "pthread_unlock_mutex" ) +and waits for the condition variable +.I "cond" +to +be signaled. The thread execution is suspended and does not consume +any CPU time until the condition variable is signaled. The +.I "mutex" +must be locked by the calling thread on entrance to +.BR "pthread_cond_wait" . +Before returning to the calling thread, +.B "pthread_cond_wait" +re-acquires +.I "mutex" +(as per +.BR "pthread_lock_mutex" ). + +Unlocking the mutex and suspending on the condition variable is done +atomically. Thus, if all threads always acquire the mutex before +signaling the condition, this guarantees that the condition cannot be +signaled (and thus ignored) between the time a thread locks the mutex +and the time it waits on the condition variable. + +.B "pthread_cond_timedwait" +atomically unlocks +.I "mutex" +and waits on +.IR "cond" , +as +.B "pthread_cond_wait" +does, but it also bounds the duration +of the wait. If +.I "cond" +has not been signaled within the amount of time +specified by +.IR "abstime" , +the mutex +.I "mutex" +is re-acquired and +.B "pthread_cond_timedwait" +returns the error +.BR "ETIMEDOUT" . +The +.I "abstime" +parameter specifies an absolute time, with the same +origin as +.BR "time" (2) +and +.BR "gettimeofday" (2): +an +.I "abstime" +of 0 +corresponds to 00:00:00 GMT, January 1, 1970. + +.B "pthread_cond_destroy" +destroys a condition variable, freeing the +resources it might hold. No threads must be waiting on the condition +variable on entrance to +.BR "pthread_cond_destroy" . +In the LinuxThreads +implementation, no resources are associated with condition variables, +thus +.B "pthread_cond_destroy" +actually does nothing except checking that +the condition has no waiting threads. + +.SH CANCELLATION + +.B "pthread_cond_wait" +and +.B "pthread_cond_timedwait" +are cancellation +points. If a thread is cancelled while suspended in one of these +functions, the thread immediately resumes execution, then locks again +the +.I "mutex" +argument to +.B "pthread_cond_wait" +and +.BR "pthread_cond_timedwait" , +and finally executes the cancellation. +Consequently, cleanup handlers are assured that +.I "mutex" +is locked when +they are called. + +.SH "ASYNC-SIGNAL SAFETY" + +The condition functions are not async-signal safe, and should not be +called from a signal handler. In particular, calling +.B "pthread_cond_signal" +or +.B "pthread_cond_broadcast" +from a signal +handler may deadlock the calling thread. + +.SH "RETURN VALUE" + +All condition variable functions return 0 on success and a non-zero +error code on error. + +.SH ERRORS + +.BR "pthread_cond_init" , +.BR "pthread_cond_signal" , +.BR "pthread_cond_broadcast" , +and +.B "pthread_cond_wait" +never return an error code. + +The +.B "pthread_cond_timedwait" +function returns the following error codes +on error: +.RS +.TP +.B "ETIMEDOUT" +the condition variable was not signaled until the timeout specified by +.I "abstime" + +.TP +.B "EINTR" +.B "pthread_cond_timedwait" +was interrupted by a signal +.RE + +The +.B "pthread_cond_destroy" +function returns the following error code +on error: +.RS +.TP +.B "EBUSY" +some threads are currently waiting on +.IR "cond" . +.RE + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_condattr_init" (3), +.BR "pthread_mutex_lock" (3), +.BR "pthread_mutex_unlock" (3), +.BR "gettimeofday" (2), +.BR "nanosleep" (2). + +.SH EXAMPLE + +Consider two shared variables +.I "x" +and +.IR "y" , +protected by the mutex +.IR "mut" , +and a condition variable +.I "cond" +that is to be signaled whenever +.I "x" +becomes greater than +.IR "y" . + +.RS +.ft 3 +.nf +.sp +int x,y; +pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; +pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +.ft +.LP +.RE +.fi + +Waiting until +.I "x" +is greater than +.I "y" +is performed as follows: + +.RS +.ft 3 +.nf +.sp +pthread_mutex_lock(&mut); +while (x <= y) { + pthread_cond_wait(&cond, &mut); +} +/* operate on x and y */ +pthread_mutex_unlock(&mut); +.ft +.LP +.RE +.fi + +Modifications on +.I "x" +and +.I "y" +that may cause +.I "x" +to become greater than +.I "y" +should signal the condition if needed: + +.RS +.ft 3 +.nf +.sp +pthread_mutex_lock(&mut); +/* modify x and y */ +if (x > y) pthread_cond_broadcast(&cond); +pthread_mutex_unlock(&mut); +.ft +.LP +.RE +.fi + +If it can be proved that at most one waiting thread needs to be waken +up (for instance, if there are only two threads communicating through +.I "x" +and +.IR "y" ), +.B "pthread_cond_signal" +can be used as a slightly more +efficient alternative to +.BR "pthread_cond_broadcast" . +In doubt, use +.BR "pthread_cond_broadcast" . + +To wait for +.I "x" +to becomes greater than +.I "y" +with a timeout of 5 +seconds, do: + +.RS +.ft 3 +.nf +.sp +struct timeval now; +struct timespec timeout; +int retcode; + +pthread_mutex_lock(&mut); +gettimeofday(&now); +timeout.tv_sec = now.tv_sec + 5; +timeout.tv_nsec = now.tv_usec * 1000; +retcode = 0; +while (x <= y && retcode != ETIMEDOUT) { + retcode = pthread_cond_timedwait(&cond, &mut, &timeout); +} +if (retcode == ETIMEDOUT) { + /* timeout occurred */ +} else { + /* operate on x and y */ +} +pthread_mutex_unlock(&mut); +.ft +.LP +.RE +.fi diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cond_signal.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cond_signal.3thr new file mode 100644 index 0000000000..1a999b8081 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cond_signal.3thr @@ -0,0 +1 @@ +.so man3/pthread_cond_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cond_timedwait.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cond_timedwait.3thr new file mode 100644 index 0000000000..1a999b8081 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cond_timedwait.3thr @@ -0,0 +1 @@ +.so man3/pthread_cond_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_cond_wait.3thr b/src/patchsets/glibc/2.2.5/man/pthread_cond_wait.3thr new file mode 100644 index 0000000000..1a999b8081 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_cond_wait.3thr @@ -0,0 +1 @@ +.so man3/pthread_cond_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_condattr_destroy.3thr b/src/patchsets/glibc/2.2.5/man/pthread_condattr_destroy.3thr new file mode 100644 index 0000000000..54813909aa --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_condattr_destroy.3thr @@ -0,0 +1 @@ +.so man3/pthread_condattr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_condattr_init.3thr b/src/patchsets/glibc/2.2.5/man/pthread_condattr_init.3thr new file mode 100644 index 0000000000..28bb0dad6c --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_condattr_init.3thr @@ -0,0 +1,47 @@ +.TH PTHREAD_CONDATTR 3 LinuxThreads + + +.SH NAME +pthread_condattr_init, pthread_condattr_destroy \- condition creation attributes + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_condattr_init(pthread_condattr_t *" attr ");" + +.BI "int pthread_condattr_destroy(pthread_condattr_t *" attr ");" + +.SH DESCRIPTION + +Condition attributes can be specified at condition creation time, by passing a +condition attribute object as second argument to +.BR "pthread_cond_init" (3). +Passing +.B "NULL" +is equivalent to passing a condition attribute object with +all attributes set to their default values. + +The LinuxThreads implementation supports no attributes for +conditions. The functions on condition attributes are included only +for compliance with the POSIX standard. + +.B "pthread_condattr_init" +initializes the condition attribute object +.I "attr" +and fills it with default values for the attributes. +.B "pthread_condattr_destroy" +destroys a condition attribute object, +which must not be reused until it is reinitialized. Both functions do +nothing in the LinuxThreads implementation. + +.SH "RETURN VALUE" +.B "pthread_condattr_init" +and +.B "pthread_condattr_destroy" +always return 0. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_cond_init" (3). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_create.3thr b/src/patchsets/glibc/2.2.5/man/pthread_create.3thr new file mode 100644 index 0000000000..0802ecec94 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_create.3thr @@ -0,0 +1,70 @@ +.TH PTHREAD_CREATE 3 LinuxThreads + +.SH NAME +pthread_create \- create a new thread + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_create(pthread_t * " thread ", pthread_attr_t * " attr ", void * (*" start_routine ")(void *), void * " arg ");" + +.SH DESCRIPTION +.B "pthread_create" +creates a new thread of control that executes +concurrently with the calling thread. The new thread applies the +function +.I "start_routine" +passing it +.I "arg" +as first argument. The new +thread terminates either explicitly, by calling +.BR "pthread_exit" (3), +or implicitly, by returning from the +.I "start_routine" +function. The +latter case is equivalent to calling +.BR "pthread_exit" (3) +with the result +returned by +.I "start_routine" +as exit code. + +The +.I "attr" +argument specifies thread attributes to be applied to the +new thread. See +.BR "pthread_attr_init" (3) +for a complete list of thread +attributes. The +.I "attr" +argument can also be +.BR "NULL" , +in which case +default attributes are used: the created thread is joinable (not +detached) and has default (non real-time) scheduling policy. + +.SH "RETURN VALUE" +On success, the identifier of the newly created thread is stored in +the location pointed by the +.I "thread" +argument, and a 0 is returned. On +error, a non-zero error code is returned. + +.SH ERRORS +.TP +.B "EAGAIN" +not enough system resources to create a process for the new thread. +.TP +.B "EAGAIN" +more than +.B "PTHREAD_THREADS_MAX" +threads are already active. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_exit" (3), +.BR "pthread_join" (3), +.BR "pthread_detach" (3), +.BR "pthread_attr_init" (3). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_detach.3thr b/src/patchsets/glibc/2.2.5/man/pthread_detach.3thr new file mode 100644 index 0000000000..50a6d0b33f --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_detach.3thr @@ -0,0 +1,73 @@ +.TH PTHREAD_DETACH 3 LinuxThreads + +.SH NAME +pthread_detach \- put a running thread in the detached state + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_detach(pthread_t " th ");" + +.SH DESCRIPTION +.B "pthread_detach" +put the thread +.I "th" +in the detached state. This +guarantees that the memory resources consumed by +.I "th" +will be freed +immediately when +.I "th" +terminates. However, this prevents other threads +from synchronizing on the termination of +.I "th" +using +.BR "pthread_join" . + +A thread can be created initially in the detached state, using the +.B "detachstate" +attribute to +.BR "pthread_create" (3). +In contrast, +.B "pthread_detach" +applies to threads created in the joinable state, and +which need to be put in the detached state later. + +After +.B "pthread_detach" +completes, subsequent attempts to perform +.B "pthread_join" +on +.I "th" +will fail. If another thread is already joining +the thread +.I "th" +at the time +.B "pthread_detach" +is called, +.B "pthread_detach" +does nothing and leaves +.I "th" +in the joinable state. + +.SH "RETURN VALUE" +On success, 0 is returned. On error, a non-zero error code is returned. + +.SH ERRORS +.TP +.B "ESRCH" +No thread could be found corresponding to that specified by +.I "th" +.TP +.B "EINVAL" +the thread +.I "th" +is already in the detached state + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_create" (3), +.BR "pthread_join" (3), +.BR "pthread_attr_setdetachstate" (3) diff --git a/src/patchsets/glibc/2.2.5/man/pthread_equal.3thr b/src/patchsets/glibc/2.2.5/man/pthread_equal.3thr new file mode 100644 index 0000000000..c3a09cfab0 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_equal.3thr @@ -0,0 +1,28 @@ +.TH PTHREAD_EQUAL 3 LinuxThreads + +.SH NAME +pthread_equal \- compare two thread identifiers + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_equal(pthread_t " thread1 ", pthread_t " thread2 ");" + +.SH DESCRIPTION +.B "pthread_equal" +determines if two thread identifiers refer to the same +thread. + +.SH "RETURN VALUE" +A non-zero value is returned if +.I "thread1" +and +.I "thread2" +refer to the +same thread. Otherwise, 0 is returned. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_self" (3). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_exit.3thr b/src/patchsets/glibc/2.2.5/man/pthread_exit.3thr new file mode 100644 index 0000000000..47f6f75ce2 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_exit.3thr @@ -0,0 +1,41 @@ +.TH PTHREAD_EXIT 3 LinuxThreads + +.SH NAME +pthread_exit \- terminate the calling thread + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "void pthread_exit(void *" retval ");" + +.SH DESCRIPTION +.B "pthread_exit" +terminates the execution of the calling thread. +All cleanup handlers that have been set for the calling thread with +.BR "pthread_cleanup_push" (3) +are executed in reverse order (the most +recently pushed handler is executed first). Finalization functions for +thread-specific data are then called for all keys that have non- +.B "NULL" +values associated with them in the calling thread (see +.BR "pthread_key_create" (3)). +Finally, execution of the calling thread is +stopped. + +The +.I "retval" +argument is the return value of the thread. It can be +consulted from another thread using +.BR "pthread_join" (3). + +.SH "RETURN VALUE" +The +.B "pthread_exit" +function never returns. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_create" (3), +.BR "pthread_join" (3). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_getschedparam.3thr b/src/patchsets/glibc/2.2.5/man/pthread_getschedparam.3thr new file mode 100644 index 0000000000..8dcf883cc8 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_getschedparam.3thr @@ -0,0 +1 @@ +.so man3/pthread_setschedparam.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_join.3thr b/src/patchsets/glibc/2.2.5/man/pthread_join.3thr new file mode 100644 index 0000000000..3a8ff953b8 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_join.3thr @@ -0,0 +1,120 @@ +.TH PTHREAD_JOIN 3 LinuxThreads + +.SH NAME +pthread_join \- wait for termination of another thread + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_join(pthread_t " th ", void **" thread_return ");" + +.SH DESCRIPTION +.B "pthread_join" +suspends the execution of the calling thread until the +thread identified by +.I "th" +terminates, either by calling +.BR "pthread_exit" (3) +or by being cancelled. + +If +.I "thread_return" +is not +.BR "NULL" , +the return value of +.I "th" +is stored +in the location pointed to by +.IR "thread_return" . +The return value of +.I "th" +is either the argument it gave to +.BR "pthread_exit" (3), +or +.B "PTHREAD_CANCELED" +if +.I "th" +was cancelled. + +The joined thread +.B "th" +must be in the joinable state: it must not have +been detached using +.BR "pthread_detach" (3) +or the +.B "PTHREAD_CREATE_DETACHED" +attribute to +.BR "pthread_create" (3). + +When a joinable thread terminates, its memory resources (thread +descriptor and stack) are not deallocated until another thread +performs +.B "pthread_join" +on it. Therefore, +.B "pthread_join" +must be +called once for each joinable thread created to avoid memory leaks. + +At most one thread can wait for the termination of a given +thread. Calling +.B "pthread_join" +on a thread +.I "th" +on which another +thread is already waiting for termination returns an error. + +.SH CANCELLATION + +.B "pthread_join" +is a cancellation point. If a thread is canceled while +suspended in +.BR "pthread_join" , +the thread execution resumes immediately +and the cancellation is executed without waiting for the +.I "th" +thread +to terminate. If cancellation occurs during +.BR "pthread_join" , +the +.I "th" +thread remains not joined. + +.SH "RETURN VALUE" +On success, the return value of +.I "th" +is stored in the location pointed +to by +.IR "thread_return" , +and 0 is returned. On error, a non-zero error +code is returned. + +.SH ERRORS +.TP +.B "ESRCH" +No thread could be found corresponding to that specified by +.IR "th" . +.TP +.B "EINVAL" +The +.I "th" +thread has been detached. +.TP +.B "EINVAL" +Another thread is already waiting on termination of +.IR "th" . +.TP +.B "EDEADLK" +The +.I "th" +argument refers to the calling thread. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_exit" (3), +.BR "pthread_detach" (3), +.BR "pthread_create" (3), +.BR "pthread_attr_setdetachstate" (3), +.BR "pthread_cleanup_push" (3), +.BR "pthread_key_create" (3). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_key_create.3thr b/src/patchsets/glibc/2.2.5/man/pthread_key_create.3thr new file mode 100644 index 0000000000..afcdf7b471 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_key_create.3thr @@ -0,0 +1,213 @@ +.TH PTHREAD_SPECIFIC 3 LinuxThreads + +.SH NAME +pthread_key_create, pthread_key_delete, pthread_setspecific, pthread_getspecific \- management of thread-specific data + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_key_create(pthread_key_t *" key ", void (*" destr_function ") (void *));" + +.BI "int pthread_key_delete(pthread_key_t " key ");" + +.BI "int pthread_setspecific(pthread_key_t " key ", const void *" pointer ");" + +.BI "void * pthread_getspecific(pthread_key_t " key ");" + +.SH DESCRIPTION + +Programs often need global or static variables that have different +values in different threads. Since threads share one memory space, +this cannot be achieved with regular variables. Thread-specific data +is the POSIX threads answer to this need. + +Each thread possesses a private memory block, the thread-specific data +area, or TSD area for short. This area is indexed by TSD keys. The TSD +area associates values of type +.B "void *" +to TSD keys. TSD keys are +common to all threads, but the value associated with a given TSD key +can be different in each thread. + +For concreteness, the TSD areas can be viewed as arrays of +.B "void *" +pointers, TSD keys as integer indices into these arrays, and the value +of a TSD key as the value of the corresponding array element in the +calling thread. + +When a thread is created, its TSD area initially associates +.B "NULL" +with all keys. + +.B "pthread_key_create" +allocates a new TSD key. The key is stored in the +location pointed to by +.IR "key" . +There is a limit of +.B "PTHREAD_KEYS_MAX" +on the number of keys allocated at a given time. The value initially +associated with the returned key is +.B "NULL" +in all currently executing +threads. + +The +.I "destr_function" +argument, if not +.BR "NULL" , +specifies a destructor +function associated with the key. When a thread terminates via +.B "pthread_exit" +or by cancellation, +.I "destr_function" +is called with +arguments the value associated with the key in that thread. The +.I "destr_function" +is not called if that value is +.BR "NULL" . +The order in +which destructor functions are called at thread termination time is +unspecified. + +Before the destructor function is called, the +.B "NULL" +value is +associated with the key in the current thread. A destructor function +might, however, re-associate non- +.B "NULL" +values to that key or some +other key. To deal with this, if after all the destructors have been +called for all non- +.B "NULL" +values, there are still some non- +.B "NULL" +values with associated destructors, then the process is repeated. The +LinuxThreads implementation stops the process after +.B "PTHREAD_DESTRUCTOR_ITERATIONS" +iterations, even if some non- +.B "NULL" +values with associated descriptors remain. Other implementations may +loop indefinitely. + +.B "pthread_key_delete" +deallocates a TSD key. It does not check whether +non- +.B "NULL" +values are associated with that key in the currently +executing threads, nor call the destructor function associated with +the key. + +.B "pthread_setspecific" +changes the value associated with +.I "key" +in the +calling thread, storing the given +.I "pointer" +instead. + +.B "pthread_getspecific" +returns the value currently associated with +.I "key" +in the calling thread. + +.SH "RETURN VALUE" + +.BR "pthread_key_create" , +.BR "pthread_key_delete" , +and +.B "pthread_setspecific" +return 0 on success and a non-zero error code on failure. If +successful, +.B "pthread_key_create" +stores the newly allocated key in the +location pointed to by its +.I "key" +argument. + +.B "pthread_getspecific" +returns the value associated with +.I "key" +on +success, and +.B "NULL" +on error. + +.SH ERRORS +.B "pthread_key_create" +returns the following error code on error: +.RS +.TP +.B "EAGAIN" +.B "PTHREAD_KEYS_MAX" +keys are already allocated +.RE + +.B "pthread_key_delete" +and +.B "pthread_setspecific" +return the following +error code on error: +.RS +.TP +.B "EINVAL" +.I "key" +is not a valid, allocated TSD key +.RE + +.B "pthread_getspecific" +returns +.B "NULL" +if +.I "key" +is not a valid, +allocated TSD key. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +pthread_create(3), pthread_exit(3), pthread_testcancel(3). + +.SH EXAMPLE + +The following code fragment allocates a thread-specific array of 100 +characters, with automatic reclaimation at thread exit: + +.RS +.ft 3 +.nf +.sp +/* Key for the thread-specific buffer */ +static pthread_key_t buffer_key; + +/* Once-only initialisation of the key */ +static pthread_once_t buffer_key_once = PTHREAD_ONCE_INIT; + +/* Allocate the thread-specific buffer */ +void buffer_alloc(void) +{ + pthread_once(&buffer_key_once, buffer_key_alloc); + pthread_setspecific(buffer_key, malloc(100)); +} + +/* Return the thread-specific buffer */ +char * get_buffer(void) +{ + return (char *) pthread_getspecific(buffer_key); +} + +/* Allocate the key */ +static void buffer_key_alloc() +{ + pthread_key_create(&buffer_key, buffer_destroy); +} + +/* Free the thread-specific buffer */ +static void buffer_destroy(void * buf) +{ + free(buf); +} +.ft +.LP +.RE +.fi diff --git a/src/patchsets/glibc/2.2.5/man/pthread_kill.3thr b/src/patchsets/glibc/2.2.5/man/pthread_kill.3thr new file mode 100644 index 0000000000..f9fd392c32 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_kill.3thr @@ -0,0 +1 @@ +.so man3/pthread_sigmask.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_kill_other_threads_np.3thr b/src/patchsets/glibc/2.2.5/man/pthread_kill_other_threads_np.3thr new file mode 100644 index 0000000000..64c3e3e0e0 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_kill_other_threads_np.3thr @@ -0,0 +1,53 @@ +.TH PTHREAD_KILL_OTHER_THREADS_NP 3 LinuxThreads + +.SH NAME +pthread_kill_other_threads_np \- terminate all threads in program except calling thread + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "void pthread_kill_other_threads_np(void);" + +.SH DESCRIPTION +.B "pthread_kill_other_threads_np" +is a non-portable LinuxThreads extension. +It causes all threads in the program to terminate immediately, except +the calling thread which proceeds normally. It is intended to be +called just before a thread calls one of the +.B "exec" +functions, +e.g. +.BR "execve" (2). + +Termination of the other threads is not performed through +.BR "pthread_cancel" (3) +and completely bypasses the cancellation +mechanism. Hence, the current settings for cancellation state and +cancellation type are ignored, and the cleanup handlers are not +executed in the terminated threads. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "execve" (2), +.BR "pthread_setcancelstate" (3), +.BR "pthread_setcanceltype" (3), +.BR "pthread_cancel" (3). + +.SH BUGS + +According to POSIX 1003.1c, a successful +.B "exec*" +in one of the threads +should terminate automatically all other threads in the program. +This behavior is not yet implemented in LinuxThreads. +Calling +.B "pthread_kill_other_threads_np" +before +.B "exec*" +achieves much +of the same behavior, except that if +.B "exec*" +ultimately fails, then +all other threads are already killed. diff --git a/src/patchsets/glibc/2.2.5/man/pthread_mutex_destroy.3thr b/src/patchsets/glibc/2.2.5/man/pthread_mutex_destroy.3thr new file mode 100644 index 0000000000..52cf2dc41f --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_mutex_destroy.3thr @@ -0,0 +1 @@ +.so man3/pthread_mutex_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_mutex_init.3thr b/src/patchsets/glibc/2.2.5/man/pthread_mutex_init.3thr new file mode 100644 index 0000000000..2dc90878f1 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_mutex_init.3thr @@ -0,0 +1,274 @@ +.TH PTHREAD_MUTEX 3 LinuxThreads + + +.SH NAME +pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock, pthread_mutex_destroy \- operations on mutexes + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "pthread_mutex_t " fastmutex " = PTHREAD_MUTEX_INITIALIZER;" + +.BI "pthread_mutex_t " recmutex " = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;" + +.BI "pthread_mutex_t " errchkmutex " = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;" + +.BI "int pthread_mutex_init(pthread_mutex_t *" mutex ", const pthread_mutexattr_t *" mutexattr ");" + +.BI "int pthread_mutex_lock(pthread_mutex_t *" mutex "));" + +.BI "int pthread_mutex_trylock(pthread_mutex_t *" mutex ");" + +.BI "int pthread_mutex_unlock(pthread_mutex_t *" mutex ");" + +.BI "int pthread_mutex_destroy(pthread_mutex_t *" mutex ");" + +.SH DESCRIPTION +A mutex is a MUTual EXclusion device, and is useful for protecting +shared data structures from concurrent modifications, and implementing +critical sections and monitors. + +A mutex has two possible states: unlocked (not owned by any thread), +and locked (owned by one thread). A mutex can never be owned by two +different threads simultaneously. A thread attempting to lock a mutex +that is already locked by another thread is suspended until the owning +thread unlocks the mutex first. + +.B "pthread_mutex_init" +initializes the mutex object pointed to by +.I "mutex" +according to the mutex attributes specified in +.IR "mutexattr" . +If +.I "mutexattr" +is +.BR "NULL" , +default attributes are used instead. + +The LinuxThreads implementation supports only one mutex attributes, +the +.IR "mutex kind" , +which is either ``fast'', ``recursive'', or +``error checking''. The kind of a mutex determines whether +it can be locked again by a thread that already owns it. +The default kind is ``fast''. See +.BR "pthread_mutexattr_init" (3) +for more +information on mutex attributes. + +Variables of type +.B "pthread_mutex_t" +can also be initialized +statically, using the constants +.B "PTHREAD_MUTEX_INITIALIZER" +(for fast +mutexes), +.B "PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP" +(for recursive +mutexes), and +.B "PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP" +(for error checking +mutexes). + +.B "pthread_mutex_lock" +locks the given mutex. If the mutex is currently +unlocked, it becomes locked and owned by the calling thread, and +.B "pthread_mutex_lock" +returns immediately. If the mutex is already +locked by another thread, +.B "pthread_mutex_lock" +suspends the calling +thread until the mutex is unlocked. + +If the mutex is already locked by the calling thread, the behavior of +.B "pthread_mutex_lock" +depends on the kind of the mutex. If the mutex is +of the ``fast'' kind, the calling thread is suspended until the mutex +is unlocked, thus effectively causing the calling thread to +deadlock. If the mutex is of the ``error checking'' kind, +.B "pthread_mutex_lock" +returns immediately with the error code +.BR "EDEADLK" . +If the mutex is of the ``recursive'' kind, +.B "pthread_mutex_lock" +succeeds and returns immediately, recording the number of times the +calling thread has locked the mutex. An equal number of +.B "pthread_mutex_unlock" +operations must be performed before the mutex +returns to the unlocked state. + +.B "pthread_mutex_trylock" +behaves identically to +.BR "pthread_mutex_lock" , +except that it does not block the calling thread if the mutex is +already locked by another thread (or by the calling thread in the case +of a ``fast'' mutex). Instead, +.B "pthread_mutex_trylock" +returns +immediately with the error code +.BR "EBUSY" . + +.B "pthread_mutex_unlock" +unlocks the given mutex. The mutex is assumed +to be locked and owned by the calling thread on entrance to +.BR "pthread_mutex_unlock" . +If the mutex is of the ``fast'' kind, +.B "pthread_mutex_unlock" +always returns it to the unlocked state. If it +is of the ``recursive'' kind, it decrements the locking count of the +mutex (number of +.B "pthread_mutex_lock" +operations performed on it by +the calling thread), and only when this count reaches zero is the +mutex actually unlocked. + +On ``error checking'' mutexes, +.B "pthread_mutex_unlock" +actually checks +at run-time that the mutex is locked on entrance, and that it was +locked by the same thread that is now calling +.BR "pthread_mutex_unlock" . +If these conditions are not met, an error code is returned and the +mutex remains unchanged. ``Fast'' and ``recursive'' mutexes perform +no such checks, thus allowing a locked mutex to be unlocked by a +thread other than its owner. This is non-portable behavior and must +not be relied upon. + +.B "pthread_mutex_destroy" +destroys a mutex object, freeing the resources +it might hold. The mutex must be unlocked on entrance. In the +LinuxThreads implementation, no resources are associated with mutex +objects, thus +.B "pthread_mutex_destroy" +actually does nothing except +checking that the mutex is unlocked. + +.SH CANCELLATION + +None of the mutex functions is a cancellation point, not even +.BR "pthread_mutex_lock" , +in spite of the fact that it can suspend a +thread for arbitrary durations. This way, the status of mutexes at +cancellation points is predictable, allowing cancellation handlers to +unlock precisely those mutexes that need to be unlocked before the +thread stops executing. Consequently, threads using deferred +cancellation should never hold a mutex for extended periods of time. + +.SH "ASYNC-SIGNAL SAFETY" + +The mutex functions are not async-signal safe. What this means is that +they should not be called from a signal handler. In particular, +calling +.B "pthread_mutex_lock" +or +.B "pthread_mutex_unlock" +from a signal +handler may deadlock the calling thread. + +.SH "RETURN VALUE" + +.B "pthread_mutex_init" +always returns 0. The other mutex functions +return 0 on success and a non-zero error code on error. + +.SH ERRORS + +The +.B "pthread_mutex_lock" +function returns the following error code +on error: +.RS +.TP +.B "EINVAL" +the mutex has not been properly initialized. + +.TP +.B "EDEADLK" +the mutex is already locked by the calling thread +(``error checking'' mutexes only). +.RE + +The +.B "pthread_mutex_trylock" +function returns the following error codes +on error: +.RS +.TP +.B "EBUSY" +the mutex could not be acquired because it was currently locked. + +.TP +.B "EINVAL" +the mutex has not been properly initialized. +.RE + +The +.B "pthread_mutex_unlock" +function returns the following error code +on error: +.RS +.TP +.B "EINVAL" +the mutex has not been properly initialized. + +.TP +.B "EPERM" +the calling thread does not own the mutex (``error checking'' mutexes only). +.RE + +The +.B "pthread_mutex_destroy" +function returns the following error code +on error: +.RS +.TP +.B "EBUSY" +the mutex is currently locked. +.RE + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_mutexattr_init" (3), +.BR "pthread_mutexattr_setkind_np" (3), +.BR "pthread_cancel" (3). + +.SH EXAMPLE + +A shared global variable +.I "x" +can be protected by a mutex as follows: + +.RS +.ft 3 +.nf +.sp +int x; +pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; +.ft +.LP +.RE +.fi + +All accesses and modifications to +.I "x" +should be bracketed by calls to +.B "pthread_mutex_lock" +and +.B "pthread_mutex_unlock" +as follows: + +.RS +.ft 3 +.nf +.sp +pthread_mutex_lock(&mut); +/* operate on x */ +pthread_mutex_unlock(&mut); +.ft +.LP +.RE +.fi + + diff --git a/src/patchsets/glibc/2.2.5/man/pthread_mutex_lock.3thr b/src/patchsets/glibc/2.2.5/man/pthread_mutex_lock.3thr new file mode 100644 index 0000000000..52cf2dc41f --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_mutex_lock.3thr @@ -0,0 +1 @@ +.so man3/pthread_mutex_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_mutex_trylock.3thr b/src/patchsets/glibc/2.2.5/man/pthread_mutex_trylock.3thr new file mode 100644 index 0000000000..52cf2dc41f --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_mutex_trylock.3thr @@ -0,0 +1 @@ +.so man3/pthread_mutex_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_mutex_unlock.3thr b/src/patchsets/glibc/2.2.5/man/pthread_mutex_unlock.3thr new file mode 100644 index 0000000000..52cf2dc41f --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_mutex_unlock.3thr @@ -0,0 +1 @@ +.so man3/pthread_mutex_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_destroy.3thr b/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_destroy.3thr new file mode 100644 index 0000000000..8a6460d05e --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_destroy.3thr @@ -0,0 +1 @@ +.so man3/pthread_mutexattr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_getkind_np.3thr b/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_getkind_np.3thr new file mode 100644 index 0000000000..8a6460d05e --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_getkind_np.3thr @@ -0,0 +1 @@ +.so man3/pthread_mutexattr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_init.3thr b/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_init.3thr new file mode 100644 index 0000000000..560b0a9498 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_init.3thr @@ -0,0 +1,122 @@ +.TH PTHREAD_MUTEXATTR 3 LinuxThreads + + +.SH NAME +pthread_mutexattr_init, pthread_mutexattr_destroy, pthread_mutexattr_setkind_np, pthread_mutexattr_getkind_np \- mutex creation attributes + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_mutexattr_init(pthread_mutexattr_t *" attr ");" + +.BI "int pthread_mutexattr_destroy(pthread_mutexattr_t *" attr ");" + +.BI "int pthread_mutexattr_setkind_np(pthread_mutexattr_t *" attr ", int " kind ");" + +.BI "int pthread_mutexattr_getkind_np(const pthread_mutexattr_t *" attr ", int *" kind ");" + +.SH DESCRIPTION + +Mutex attributes can be specified at mutex creation time, by passing a +mutex attribute object as second argument to +.BR "pthread_mutex_init" (3). +Passing +.B "NULL" +is equivalent to passing a mutex attribute object with +all attributes set to their default values. + +.B "pthread_mutexattr_init" +initializes the mutex attribute object +.I "attr" +and fills it with default values for the attributes. + +.B "pthread_mutexattr_destroy" +destroys a mutex attribute object, which +must not be reused until it is reinitialized. +.B "pthread_mutexattr_destroy" +does nothing in the LinuxThreads implementation. + +LinuxThreads supports only one mutex attribute: the mutex kind, which +is either +.B "PTHREAD_MUTEX_FAST_NP" +for ``fast'' mutexes, +.B "PTHREAD_MUTEX_RECURSIVE_NP" +for ``recursive'' mutexes, +or +.B "PTHREAD_MUTEX_ERRORCHECK_NP" +for ``error checking'' mutexes. +As the +.B "NP" +suffix indicates, this is a non-portable extension to the +POSIX standard and should not be employed in portable programs. + +The mutex kind determines what happens if a thread attempts to lock a +mutex it already owns with +.BR "pthread_mutex_lock" (3). +If the mutex is of +the ``fast'' kind, +.BR "pthread_mutex_lock" (3) +simply suspends the calling +thread forever. If the mutex is of the ``error checking'' kind, +.BR "pthread_mutex_lock" (3) +returns immediately with the error code +.BR "EDEADLK" . +If the mutex is of the ``recursive'' kind, the call to +.BR "pthread_mutex_lock" (3) +returns immediately with a success return +code. The number of times the thread owning the mutex has locked it is +recorded in the mutex. The owning thread must call +.BR "pthread_mutex_unlock" (3) +the same number of times before the mutex +returns to the unlocked state. + +The default mutex kind is ``fast'', that is, +.BR "PTHREAD_MUTEX_FAST_NP" . + +.B "pthread_mutexattr_setkind_np" +sets the mutex kind attribute in +.I "attr" +to the value specified by +.IR "kind" . + +.B "pthread_mutexattr_getkind_np" +retrieves the current value of the +mutex kind attribute in +.I "attr" +and stores it in the location pointed +to by +.IR "kind" . + +.SH "RETURN VALUE" +.BR "pthread_mutexattr_init" , +.B "pthread_mutexattr_destroy" +and +.B "pthread_mutexattr_getkind_np" +always return 0. + +.B "pthread_mutexattr_setkind_np" +returns 0 on success and a non-zero +error code on error. + +.SH ERRORS + +On error, +.B "pthread_mutexattr_setkind_np" +returns the following error code: +.TP +.B "EINVAL" +.I "kind" +is neither +.B "PTHREAD_MUTEX_FAST_NP" +nor +.B "PTHREAD_MUTEX_RECURSIVE_NP" +nor +.B "PTHREAD_MUTEX_ERRORCHECK_NP" + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_mutex_init" (3), +.BR "pthread_mutex_lock" (3), +.BR "pthread_mutex_unlock" (3). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_setkind_np.3thr b/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_setkind_np.3thr new file mode 100644 index 0000000000..8a6460d05e --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_mutexattr_setkind_np.3thr @@ -0,0 +1 @@ +.so man3/pthread_mutexattr_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_once.3thr b/src/patchsets/glibc/2.2.5/man/pthread_once.3thr new file mode 100644 index 0000000000..5022f93972 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_once.3thr @@ -0,0 +1,49 @@ +.TH PTHREAD_ONCE 3 LinuxThreads + +.SH NAME +pthread_once \- once-only initialization + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "pthread_once_t " once_control " = PTHREAD_ONCE_INIT;" + +.BI "int pthread_once(pthread_once_t *" once_control ", void (*" init_routine ") (void));" + +.SH DESCRIPTION + +The purpose of +.B "pthread_once" +is to ensure that a piece of +initialization code is executed at most once. The +.I "once_control" +argument points to a static or extern variable statically initialized +to +.BR "PTHREAD_ONCE_INIT" . + +The first time +.B "pthread_once" +is called with a given +.I "once_control" +argument, it calls +.I "init_routine" +with no argument and changes the +value of the +.I "once_control" +variable to record that initialization has +been performed. Subsequent calls to +.B "pthread_once" +with the same +.B "once_control" +argument do nothing. + +.SH "RETURN VALUE" +.B "pthread_once" +always returns 0. + +.SH ERRORS +None. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + diff --git a/src/patchsets/glibc/2.2.5/man/pthread_self.3thr b/src/patchsets/glibc/2.2.5/man/pthread_self.3thr new file mode 100644 index 0000000000..65fea53b77 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_self.3thr @@ -0,0 +1,24 @@ +.TH PTHREAD_SELF 3 LinuxThreads + +.SH NAME +pthread_self \- return identifier of current thread + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "pthread_t pthread_self(void);" + +.SH DESCRIPTION +.B "pthread_self" +return the thread identifier for the calling thread. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_equal" (3), +.BR "pthread_join" (3), +.BR "pthread_detach" (3), +.BR "pthread_setschedparam" (3), +.BR "pthread_getschedparam" (3). + diff --git a/src/patchsets/glibc/2.2.5/man/pthread_setcancelstate.3thr b/src/patchsets/glibc/2.2.5/man/pthread_setcancelstate.3thr new file mode 100644 index 0000000000..5b6d374df9 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_setcancelstate.3thr @@ -0,0 +1 @@ +.so man3/pthread_cancel.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_setcanceltype.3thr b/src/patchsets/glibc/2.2.5/man/pthread_setcanceltype.3thr new file mode 100644 index 0000000000..5b6d374df9 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_setcanceltype.3thr @@ -0,0 +1 @@ +.so man3/pthread_cancel.3thr diff --git a/src/patchsets/glibc/2.2.5/man/pthread_setschedparam.3thr b/src/patchsets/glibc/2.2.5/man/pthread_setschedparam.3thr new file mode 100644 index 0000000000..15e8223716 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_setschedparam.3thr @@ -0,0 +1,126 @@ +.TH PTHREAD_SETSCHEDPARAM 3 LinuxThreads + + +.SH NAME +pthread_setschedparam, pthread_getschedparam \- control thread scheduling parameters + +.SH SYNOPSIS +.B #include <pthread.h> + +.BI "int pthread_setschedparam(pthread_t " target_thread ", int " policy ", const struct sched_param *" param ");" + +.BI "int pthread_getschedparam(pthread_t " target_thread ", int *" policy ", struct sched_param *" param ");" + +.SH DESCRIPTION + +.B "pthread_setschedparam" +sets the scheduling parameters for the thread +.I "target_thread" +as indicated by +.I "policy" +and +.IR "param" . +.I "policy" +can be +either +.B "SCHED_OTHER" +(regular, non-realtime scheduling), +.B "SCHED_RR" +(realtime, round-robin) or +.B "SCHED_FIFO" +(realtime, first-in +first-out). +.I "param" +specifies the scheduling priority for the two +realtime policies. See +.BR "sched_setpolicy" (2) +for more information on +scheduling policies. + +The realtime scheduling policies +.B "SCHED_RR" +and +.B "SCHED_FIFO" +are +available only to processes with superuser privileges. + +.B "pthread_getschedparam" +retrieves the scheduling policy and scheduling +parameters for the thread +.I "target_thread" +and store them in the +locations pointed to by +.I "policy" +and +.IR "param" , +respectively. + +.SH "RETURN VALUE" +.B "pthread_setschedparam" +and +.B "pthread_getschedparam" +return 0 on +success and a non-zero error code on error. + +.SH ERRORS +On error, +.B "pthread_setschedparam" +returns the following error codes: +.RS +.TP +.B "EINVAL" +.I "policy" +is not one of +.BR "SCHED_OTHER" , +.BR "SCHED_RR" , +.B "SCHED_FIFO" + +.TP +.B "EINVAL" +the priority value specified by +.I "param" +is not valid for the specified policy + +.TP +.B "EPERM" +the calling process does not have superuser permissions + +.TP +.B "ESRCH" +the +.I "target_thread" +is invalid or has already terminated + +.TP +.B "EFAULT" +.I "param" +points outside the process memory space +.RE + +On error, +.B "pthread_getschedparam" +returns the following error codes: +.RS +.TP +.B "ESRCH" +the +.I "target_thread" +is invalid or has already terminated + +.TP +.B "EFAULT" +.I "policy" +or +.I "param" +point outside the process memory space +.RE + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "sched_setscheduler" (2), +.BR "sched_getscheduler" (2), +.BR "sched_getparam" (2), +.BR "pthread_attr_setschedpolicy" (3), +.BR "pthread_attr_setschedparam" (3). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_sigmask.3thr b/src/patchsets/glibc/2.2.5/man/pthread_sigmask.3thr new file mode 100644 index 0000000000..e13df4e30a --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_sigmask.3thr @@ -0,0 +1,197 @@ +.TH PTHREAD_SIGNAL 3 LinuxThreads + + +.SH NAME +pthread_sigmask, pthread_kill, sigwait \- handling of signals in threads + +.SH SYNOPSIS +.B #include <pthread.h> +.br +.B #include <signal.h> + +.BI "int pthread_sigmask(int " how ", const sigset_t *" newmask ", sigset_t *" oldmask ");" + +.BI "int pthread_kill(pthread_t " thread ", int " signo ");" + +.BI "int sigwait(const sigset_t *" set ", int *" sig ");" + +.SH DESCRIPTION + +.B "pthread_sigmask" +changes the signal mask for the calling thread as +described by the +.I "how" +and +.I "newmask" +arguments. If +.I "oldmask" +is not +.BR "NULL" , +the previous signal mask is stored in the location pointed to +by +.IR "oldmask" . + +The meaning of the +.I "how" +and +.I "newmask" +arguments is the same as for +.BR "sigprocmask" (2). +If +.I "how" +is +.BR "SIG_SETMASK" , +the signal mask is set to +.IR "newmask" . +If +.I "how" +is +.BR "SIG_BLOCK" , +the signals specified to +.I "newmask" +are added to the current signal mask. If +.I "how" +is +.BR "SIG_UNBLOCK" , +the +signals specified to +.I "newmask" +are removed from the current signal +mask. + +Recall that signal masks are set on a per-thread basis, but signal +actions and signal handlers, as set with +.BR "sigaction" (2), +are shared +between all threads. + +.B "pthread_kill" +send signal number +.I "signo" +to the thread +.IR "thread" . +The signal is delivered and handled as described in +.BR "kill" (2). + +.B "sigwait" +suspends the calling thread until one of the signals +in +.I "set" +is delivered to the calling thread. It then stores the number +of the signal received in the location pointed to by +.I "sig" +and +returns. The signals in +.I "set" +must be blocked and not ignored on +entrance to +.BR "sigwait" . +If the delivered signal has a signal handler +function attached, that function is +.I "not" +called. + +.SH CANCELLATION + +.B "sigwait" +is a cancellation point. + +.SH "RETURN VALUE" + +On success, 0 is returned. On failure, a non-zero error code is returned. + +.SH ERRORS + +The +.B "pthread_sigmask" +function returns the following error codes +on error: +.RS +.TP +.B "EINVAL" +.I "how" +is not one of +.BR "SIG_SETMASK" , +.BR "SIG_BLOCK" , +or +.B "SIG_UNBLOCK" + +.TP +.B "EFAULT" +.I "newmask" +or +.I "oldmask" +point to invalid addresses +.RE + +The +.B "pthread_kill" +function returns the following error codes +on error: +.RS +.TP +.B "EINVAL" +.I "signo" +is not a valid signal number + +.TP +.B "ESRCH" +the thread +.I "thread" +does not exist (e.g. it has already terminated) +.RE + +The +.B "sigwait" +function never returns an error. + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "sigprocmask" (2), +.BR "kill" (2), +.BR "sigaction" (2), +.BR "sigsuspend" (2). + +.SH NOTES + +For +.B "sigwait" +to work reliably, the signals being waited for must be +blocked in all threads, not only in the calling thread, since +otherwise the POSIX semantics for signal delivery do not guarantee +that it's the thread doing the +.B "sigwait" +that will receive the signal. +The best way to achieve this is block those signals before any threads +are created, and never unblock them in the program other than by +calling +.BR "sigwait" . + +.SH BUGS + +Signal handling in LinuxThreads departs significantly from the POSIX +standard. According to the standard, ``asynchronous'' (external) +signals are addressed to the whole process (the collection of all +threads), which then delivers them to one particular thread. The +thread that actually receives the signal is any thread that does +not currently block the signal. + +In LinuxThreads, each thread is actually a kernel process with its own +PID, so external signals are always directed to one particular thread. +If, for instance, another thread is blocked in +.B "sigwait" +on that +signal, it will not be restarted. + +The LinuxThreads implementation of +.B "sigwait" +installs dummy signal +handlers for the signals in +.I "set" +for the duration of the wait. Since +signal handlers are shared between all threads, other threads must not +attach their own signal handlers to these signals, or alternatively +they should all block these signals (which is recommended anyway -- +see the Notes section). diff --git a/src/patchsets/glibc/2.2.5/man/pthread_testcancel.3thr b/src/patchsets/glibc/2.2.5/man/pthread_testcancel.3thr new file mode 100644 index 0000000000..5b6d374df9 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/pthread_testcancel.3thr @@ -0,0 +1 @@ +.so man3/pthread_cancel.3thr diff --git a/src/patchsets/glibc/2.2.5/man/sem_destroy.3thr b/src/patchsets/glibc/2.2.5/man/sem_destroy.3thr new file mode 100644 index 0000000000..c40159c4ca --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/sem_destroy.3thr @@ -0,0 +1 @@ +.so man3/sem_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/sem_getvalue.3thr b/src/patchsets/glibc/2.2.5/man/sem_getvalue.3thr new file mode 100644 index 0000000000..c40159c4ca --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/sem_getvalue.3thr @@ -0,0 +1 @@ +.so man3/sem_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/sem_init.3thr b/src/patchsets/glibc/2.2.5/man/sem_init.3thr new file mode 100644 index 0000000000..d3e7a430ed --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/sem_init.3thr @@ -0,0 +1,198 @@ +.TH SEMAPHORES 3 LinuxThreads + + +.SH NAME +sem_init, sem_wait, sem_trywait, sem_post, sem_getvalue, sem_destroy \- operations on semaphores + +.SH SYNOPSIS +.B #include <semaphore.h> + +.BI "int sem_init(sem_t *" sem ", int " pshared ", unsigned int " value ");" + +.BI "int sem_wait(sem_t * " sem ");" + +.BI "int sem_trywait(sem_t * " sem ");" + +.BI "int sem_post(sem_t * " sem ");" + +.BI "int sem_getvalue(sem_t * " sem ", int * " sval ");" + +.BI "int sem_destroy(sem_t * " sem ");" + +.SH DESCRIPTION +This manual page documents POSIX 1003.1b semaphores, not to be +confused with SystemV semaphores as described in +.BR "ipc" (5), +.BR "semctl" (2) +and +.BR "semop" (2). + +Semaphores are counters for resources shared between threads. The +basic operations on semaphores are: increment the counter atomically, +and wait until the counter is non-null and decrement it atomically. + +.B "sem_init" +initializes the semaphore object pointed to by +.IR "sem" . +The +count associated with the semaphore is set initially to +.IR "value" . +The +.I "pshared" +argument indicates whether the semaphore is local to the +current process ( +.I "pshared" +is zero) or is to be shared between several +processes ( +.I "pshared" +is not zero). LinuxThreads currently does not +support process-shared semaphores, thus +.B "sem_init" +always returns with +error +.B "ENOSYS" +if +.I "pshared" +is not zero. + +.B "sem_wait" +suspends the calling thread until the semaphore pointed to +by +.I "sem" +has non-zero count. It then atomically decreases the +semaphore count. + +.B "sem_trywait" +is a non-blocking variant of +.BR "sem_wait" . +If the +semaphore pointed to by +.I "sem" +has non-zero count, the count is +atomically decreased and +.B "sem_trywait" +immediately returns 0. +If the semaphore count is zero, +.B "sem_trywait" +immediately returns with +error +.BR "EAGAIN" . + +.B "sem_post" +atomically increases the count of the semaphore pointed to +by +.IR "sem" . +This function never blocks and can safely be used in +asynchronous signal handlers. + +.B "sem_getvalue" +stores in the location pointed to by +.I "sval" +the current +count of the semaphore +.IR "sem" . + +.B "sem_destroy" +destroys a semaphore object, freeing the resources it +might hold. No threads should be waiting on the semaphore at the time +.B "sem_destroy" +is called. In the LinuxThreads implementation, no +resources are associated with semaphore objects, thus +.B "sem_destroy" +actually does nothing except checking that no thread is waiting on the +semaphore. + +.SH CANCELLATION + +.B "sem_wait" +is a cancellation point. + +.SH "ASYNC-SIGNAL SAFETY" + +On processors supporting atomic compare-and-swap (Intel 486, Pentium +and later, Alpha, PowerPC, MIPS II, Motorola 68k), the +.B "sem_post" +function is async-signal safe and can therefore be +called from signal handlers. This is the only thread synchronization +function provided by POSIX threads that is async-signal safe. + +On the Intel 386 and the Sparc, the current LinuxThreads +implementation of +.B "sem_post" +is not async-signal safe by lack of the +required atomic operations. + +.SH "RETURN VALUE" + +The +.B "sem_wait" +and +.B "sem_getvalue" +functions always return 0. +All other semaphore functions return 0 on success and -1 on error, in +addition to writing an error code in +.BR "errno" . + +.SH ERRORS + +The +.B "sem_init" +function sets +.B "errno" +to the following codes on error: +.RS +.TP +.B "EINVAL" +.I "value" +exceeds the maximal counter value +.B "SEM_VALUE_MAX" +.TP +.B "ENOSYS" +.I "pshared" +is not zero +.RE + +The +.B "sem_trywait" +function sets +.B "errno" +to the following error code on error: +.RS +.TP +.B "EAGAIN" +the semaphore count is currently 0 +.RE + +The +.B "sem_post" +function sets +.B "errno" +to the following error code on error: +.RS +.TP +.B "ERANGE" +after incrementation, the semaphore value would exceed +.B "SEM_VALUE_MAX" +(the semaphore count is left unchanged in this case) +.RE + +The +.B "sem_destroy" +function sets +.B "errno" +to the following error code on error: +.RS +.TP +.B "EBUSY" +some threads are currently blocked waiting on the semaphore. +.RE + +.SH AUTHOR +Xavier Leroy <Xavier.Leroy@inria.fr> + +.SH "SEE ALSO" +.BR "pthread_mutex_init" (3), +.BR "pthread_cond_init" (3), +.BR "pthread_cancel" (3), +.BR "ipc" (5). + diff --git a/src/patchsets/glibc/2.2.5/man/sem_post.3thr b/src/patchsets/glibc/2.2.5/man/sem_post.3thr new file mode 100644 index 0000000000..c40159c4ca --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/sem_post.3thr @@ -0,0 +1 @@ +.so man3/sem_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/sem_trywait.3thr b/src/patchsets/glibc/2.2.5/man/sem_trywait.3thr new file mode 100644 index 0000000000..c40159c4ca --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/sem_trywait.3thr @@ -0,0 +1 @@ +.so man3/sem_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/sem_wait.3thr b/src/patchsets/glibc/2.2.5/man/sem_wait.3thr new file mode 100644 index 0000000000..c40159c4ca --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/sem_wait.3thr @@ -0,0 +1 @@ +.so man3/sem_init.3thr diff --git a/src/patchsets/glibc/2.2.5/man/sigwait.3thr b/src/patchsets/glibc/2.2.5/man/sigwait.3thr new file mode 100644 index 0000000000..f9fd392c32 --- /dev/null +++ b/src/patchsets/glibc/2.2.5/man/sigwait.3thr @@ -0,0 +1 @@ +.so man3/pthread_sigmask.3thr |