diff options
Diffstat (limited to 'lib/libpthread/include')
40 files changed, 3479 insertions, 0 deletions
diff --git a/lib/libpthread/include/arpa/inet.h b/lib/libpthread/include/arpa/inet.h new file mode 100755 index 00000000000..27e045fa615 --- /dev/null +++ b/lib/libpthread/include/arpa/inet.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)inet.h 5.7 (Berkeley) 4/3/91 + * $Id: inet.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + */ + +#ifndef _INET_H_ +#define _INET_H_ + +/* External definitions for functions in inet(3) */ + +#include <sys/cdefs.h> +#include <sys/types.h> +#include <pthread/types.h> + +__BEGIN_DECLS + +pthread_ipaddr_type inet_addr __P_((const char *)); +int inet_aton __P_((const char *, struct in_addr *)); +pthread_ipaddr_type inet_lnaof __P_((struct in_addr)); +struct in_addr inet_makeaddr __P_((pthread_ipaddr_type, + pthread_ipaddr_type)); +pthread_ipaddr_type inet_netof __P_((struct in_addr)); +pthread_ipaddr_type inet_network __P_((const char *)); +char * inet_ntoa __P_((struct in_addr)); +char * inet_ntoa_r __P_((struct in_addr in, char *buf, + int bufsize)); + +__END_DECLS + +#endif /* !_INET_H_ */ diff --git a/lib/libpthread/include/arpa/nameser.h b/lib/libpthread/include/arpa/nameser.h new file mode 100755 index 00000000000..350d67538bd --- /dev/null +++ b/lib/libpthread/include/arpa/nameser.h @@ -0,0 +1,279 @@ +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)nameser.h 8.2 (Berkeley) 2/16/94 + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#ifndef _NAMESER_H_ +#define _NAMESER_H_ + +#include <endian.h> +#include <sys/types.h> +#include <pthread/types.h> + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ + /* Number of bytes of fixed size data in query structure */ +#define QFIXEDSZ 4 + /* number of bytes of fixed size data in resource record */ +#define RRFIXEDSZ 10 + +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define STATUS 0x2 /* nameserver status query */ +/*#define xxx 0x3*/ /* 0x3 reserved */ + /* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */ +#define UPDATEA 0x9 /* add resource record */ +#define UPDATED 0xa /* delete a specific resource record */ +#define UPDATEDA 0xb /* delete all named resource record */ +#define UPDATEM 0xc /* modify a specific resource record */ +#define UPDATEMA 0xd /* modify all named resource record */ + +#define ZONEINIT 0xe /* initial zone transfer */ +#define ZONEREF 0xf /* incremental zone referesh */ + +/* + * Currently defined response codes + */ +#define NOERROR 0 /* no error */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ + /* non standard */ +#define NOCHANGE 0xf /* update failed to change db */ + +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* connonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ +#define T_RP 17 /* responsible person */ +#define T_AFSDB 18 /* AFS cell database */ +#define T_NSAP 22 /* NSAP address */ +#define T_NSAP_PTR 23 /* reverse lookup for NSAP */ + /* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ + /* Query type values which do not appear in resource records */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ + +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net (MIT) */ +#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ + +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW -1 +#define CONV_BADFMT -2 +#define CONV_BADCKSUM -3 +#define CONV_BADBUFLEN -4 + +#if !defined(BYTE_ORDER) || (BYTE_ORDER != BIG_ENDIAN \ + && BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != PDP_ENDIAN) + /* you must determine what the correct bit order is for + * your compiler - the next line is an intentional error + * which will force your compiles to bomb until you fix + * the above macros. + */ + #error "Undefined or invalid BYTE_ORDER"; +#endif + +/* + * Structure for query header. The order of the fields is machine- and + * compiler-dependent, depending on the byte/bit order and the layout + * of bit fields. We use bit fields only in int variables, as this + * is all ANSI requires. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + pthread_ipport_type id; /* query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + u_int qr:1; /* response flag */ + u_int opcode:4; /* purpose of message */ + u_int aa:1; /* authoritive answer */ + u_int tc:1; /* truncated message */ + u_int rd:1; /* recursion desired */ + /* fields in fourth byte */ + u_int ra:1; /* recursion available */ + u_int pr:1; /* primary server required (non standard) */ + u_int unused:2; /* unused bits */ + u_int rcode:4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + u_int rd:1; /* recursion desired */ + u_int tc:1; /* truncated message */ + u_int aa:1; /* authoritive answer */ + u_int opcode:4; /* purpose of message */ + u_int qr:1; /* response flag */ + /* fields in fourth byte */ + u_int rcode:4; /* response code */ + u_int unused:2; /* unused bits */ + u_int pr:1; /* primary server required (non standard) */ + u_int ra:1; /* recursion available */ +#endif + /* remaining bytes */ + pthread_ipport_type qdcount; /* number of question entries */ + pthread_ipport_type ancount; /* number of answer entries */ + pthread_ipport_type nscount; /* number of authority entries */ + pthread_ipport_type arcount; /* number of resource entries */ +} HEADER; + +/* + * Defines for handling compressed domain names + */ +#define INDIR_MASK 0xc0 + +/* + * Structure for passing resource records around. + */ +struct rrec { + pthread_ipport_type r_zone; /* zone number */ + pthread_ipport_type r_class; /* class number */ + pthread_ipport_type r_type; /* type number */ + pthread_ipaddr_type r_ttl; /* time to live */ + int r_size; /* size of data area */ + char * r_data; /* pointer to data */ +}; + +extern pthread_ipport_type _getshort(); +extern pthread_ipaddr_type _getlong(); + +/* + * Inline versions of get/put short/long. Pointer is advanced. + * We also assume that a "pthread_ipport_type" holds 2 "chars" + * and that a "pthread_ipaddr_type" holds 4 "chars". + * + * These macros demonstrate the property of C whereby it can be + * portable or it can be elegant but never both. + */ +#define GETSHORT(s, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (s) = ((pthread_ipport_type)t_cp[0] << 8) | (pthread_ipport_type)t_cp[1]; \ + (cp) += 2; \ +} + +#define GETLONG(l, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (l) = (((pthread_ipaddr_type)t_cp[0]) << 24) \ + | (((pthread_ipaddr_type)t_cp[1]) << 16) \ + | (((pthread_ipaddr_type)t_cp[2]) << 8) \ + | (((pthread_ipaddr_type)t_cp[3])); \ + (cp) += 4; \ +} + +#define PUTSHORT(s, cp) { \ + register pthread_ipport_type t_s = (pthread_ipport_type)(s); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += 2; \ +} + +/* + * Warning: PUTLONG --no-longer-- destroys its first argument. if you + * were depending on this "feature", you will lose. + */ +#define PUTLONG(l, cp) { \ + register pthread_ipaddr_type t_l = (pthread_ipaddr_type)(l); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += 4; \ +} + +#endif /* !_NAMESER_H_ */ diff --git a/lib/libpthread/include/dirent.h b/lib/libpthread/include/dirent.h new file mode 100644 index 00000000000..c3e86cb9da1 --- /dev/null +++ b/lib/libpthread/include/dirent.h @@ -0,0 +1,97 @@ +/*- + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)dirent.h 5.18 (Berkeley) 2/23/91 + */ + +#ifndef _DIRENT_H_ +#define _DIRENT_H_ + +#include <sys/dirent.h> +#include <pthread.h> + +struct __dirent { + struct __dirent * next; + struct dirent data; + pthread_t owner; +}; + +/* definitions for library routines operating on directories. */ +#define DIRBLKSIZ 1024 + +/* structure describing an open directory. */ +typedef struct _dirdesc { + struct __dirent * dd_dp; /* Linked list of struct __dirent pointer */ + int dd_fd; /* file descriptor associated with directory */ + long dd_loc; /* offset in current buffer */ + long dd_size; /* amount of data returned by getdirentries */ + char * dd_buf; /* data buffer */ + int dd_len; /* size of data buffer */ + long dd_seek; /* magic cookie returned by getdirentries */ + void * dd_ddloc; /* Linked list of ddloc structs for telldir/seekdir */ + pthread_mutex_t *dd_lock; /* Lock for open directory structure */ +} DIR; + +#define dirfd(dirp) ((dirp)->dd_fd) + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef KERNEL + +#include <sys/cdefs.h> + +__BEGIN_DECLS +DIR * opendir __P_((const char *)); +struct dirent * readdir __P_((DIR *)); +int readdir_r __P_((DIR *, struct dirent *, struct dirent **)); +void rewinddir __P_((DIR *)); +int closedir __P_((DIR *)); +#ifndef _POSIX_SOURCE +long telldir __P_((DIR *)); +void seekdir __P_((DIR *, long)); + +/* +int scandir __P_((const char *, struct dirent ***, + int (*)(struct dirent *), + int (*)(const void *, const void *))); +int alphasort __P_((const void *, const void *)); +int getdirentries __P_((int, char *, int, long *)); +*/ +#endif /* not POSIX */ + +__END_DECLS + +#endif /* !KERNEL */ + +#endif /* !_DIRENT_H_ */ diff --git a/lib/libpthread/include/endian.h b/lib/libpthread/include/endian.h new file mode 100644 index 00000000000..8fb947dbd33 --- /dev/null +++ b/lib/libpthread/include/endian.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)nameser.h 8.2 (Berkeley) 2/16/94 + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#ifndef _ENDIAN_H_ +#define _ENDIAN_H_ + +#ifndef BYTE_ORDER +#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */ +#define __LITTLE_ENDIAN 1234 +#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define __BIG_ENDIAN 4321 +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/ +#define __PDP_ENDIAN 3412 + +#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ + defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ + defined(__alpha__) || defined(__alpha) +#define BYTE_ORDER LITTLE_ENDIAN +#define __BYTE_ORDER LITTLE_ENDIAN +#endif + +#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ + defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ + defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || \ + defined(apollo) || defined(hp9000) || defined(hp9000s300) || \ + defined(hp9000s800) || \ + defined (BIT_ZERO_ON_LEFT) +#define BYTE_ORDER BIG_ENDIAN +#define __BYTE_ORDER BIG_ENDIAN +#endif +#endif /* BYTE_ORDER */ + +#if !defined(BYTE_ORDER) || (BYTE_ORDER != BIG_ENDIAN \ + && BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != PDP_ENDIAN) + /* you must determine what the correct bit order is for + * your compiler - the next line is an intentional error + * which will force your compiles to bomb until you fix + * the above macros. + */ + #error "Undefined or invalid BYTE_ORDER"; +#endif + +#endif /* !_ENDIAN_H */ diff --git a/lib/libpthread/include/errno.h b/lib/libpthread/include/errno.h new file mode 100644 index 00000000000..24b005e9369 --- /dev/null +++ b/lib/libpthread/include/errno.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1982, 1986, 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)errno.h 7.13 (Berkeley) 2/19/91 + * errno.h,v 1.3 1993/05/20 16:22:09 cgd Exp + */ + +#ifndef _ERRNO_H_ +#define _ERRNO_H_ + +#include <sys/cdefs.h> +#include <sys/errno.h> + +__BEGIN_DECLS + +extern int * __error(); + +__END_DECLS + +#define errno (* __error()) +#define pthread_errno(x) pthread_run->error_p = x + +#endif /* _ERRNO_H_ */ diff --git a/lib/libpthread/include/math.h b/lib/libpthread/include/math.h new file mode 100644 index 00000000000..d5963ce6023 --- /dev/null +++ b/lib/libpthread/include/math.h @@ -0,0 +1,85 @@ +#ifndef _MATH_H_ +#define _MATH_H_ + +/* Needed for HUGE_VAL */ +#include <sys/__math.h> + +/* XOPEN/SVID */ + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#define M_E 2.7182818284590452354 /* e */ +#define M_LOG2E 1.4426950408889634074 /* log 2e */ +#define M_LOG10E 0.43429448190325182765 /* log 10e */ +#define M_LN2 0.69314718055994530942 /* log e2 */ +#define M_LN10 2.30258509299404568402 /* log e10 */ +#define M_PI 3.14159265358979323846 /* pi */ +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#define M_PI_4 0.78539816339744830962 /* pi/4 */ +#define M_1_PI 0.31830988618379067154 /* 1/pi */ +#define M_2_PI 0.63661977236758134308 /* 2/pi */ +#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ + +#define MAXFLOAT ((float)3.40282346638528860e+38) + +#if !defined(_XOPEN_SOURCE) + +struct exception { + int type; + char *name; + double arg1; + double arg2; + double retval; +}; + +#define HUGE MAXFLOAT + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +#endif /* !_XOPEN_SOURCE */ +#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ + +#include <sys/cdefs.h> + +/* ANSI/POSIX */ + +__BEGIN_DECLS + +double hypot __P_((double, double)); +double acos __P_((double)); +double asin __P_((double)); +double atan __P_((double)); +double atan2 __P_((double, double)); +double cos __P_((double)); +double sin __P_((double)); +double tan __P_((double)); + +double cosh __P_((double)); +double sinh __P_((double)); +double tanh __P_((double)); + +double exp __P_((double)); +double frexp __P_((double, int *)); +double ldexp __P_((double, int)); +double log __P_((double)); +double log10 __P_((double)); +double modf __P_((double, double *)); + +double pow __P_((double, double)); +double sqrt __P_((double)); + +double ceil __P_((double)); +double fabs __P_((double)); +double floor __P_((double)); +double fmod __P_((double, double)); +double rint __P_((double)); /* XOPEN; Added by Monty */ +int finite __P_((double dsrc)); /* math.h; added by Monty */ +__END_DECLS + +#endif /* _MATH_H_ */ diff --git a/lib/libpthread/include/netdb.h b/lib/libpthread/include/netdb.h new file mode 100644 index 00000000000..12ecef51a8e --- /dev/null +++ b/lib/libpthread/include/netdb.h @@ -0,0 +1,146 @@ +/*- + * Copyright (c) 1980, 1983, 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)netdb.h 5.15 (Berkeley) 4/3/91 + * $Id: netdb.h,v 1.1 1998/07/21 13:19:05 peter Exp $ + */ + +#ifndef _NETDB_H_ +#define _NETDB_H_ + +#include <stdio.h> +#include <sys/types.h> +#include <netinet/in.h> + +#define _PATH_HEQUIV "/etc/hosts.equiv" +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" +#define __NETDB_MAXALIASES 35 +#define __NETDB_MAXADDRS 35 + +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net address type */ + unsigned long n_net; /* network # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (left in extern int h_errno). + */ + +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +void endhostent __P_((void)); +void endnetent __P_((void)); +void endprotoent __P_((void)); +void endservent __P_((void)); +struct hostent *gethostbyaddr __P_((const char *, int, int)); +struct hostent *gethostbyname __P_((const char *)); +struct hostent *gethostent __P_((void)); +struct netent *getnetbyaddr __P_((long, int)); /* u_long? */ +struct netent *getnetbyname __P_((const char *)); +struct netent *getnetent __P_((void)); +struct protoent *getprotobyname __P_((const char *)); +struct protoent *getprotobynumber __P_((int)); +struct protoent *getprotoent __P_((void)); +struct servent *getservbyname __P_((const char *, const char *)); +struct servent *getservbyport __P_((int, const char *)); +struct servent *getservent __P_((void)); +void herror __P_((const char *)); +char *hstrerror __P_((int)); +void sethostent __P_((int)); +void setnetent __P_((int)); +void setprotoent __P_((int)); +void setservent __P_((int)); +struct hostent *gethostbyaddr_r __P_((const char *, int, int, + struct hostent *, char *, int, int *)); +struct hostent *gethostbyname_r __P_((const char *, struct hostent *, char *, + int, int *)); +struct hostent *gethostent_r __P_((struct hostent *, char *, int, int *)); +struct netent *getnetbyaddr_r __P_((long, int, struct netent *, char *, int)); +struct netent *getnetbyname_r __P_((const char *, struct netent *, char *, + int)); +struct netent *getnetent_r __P_((struct netent *, char *, int)); +struct protoent *getprotobyname_r __P_((const char *, struct protoent *, char *, + int)); +struct protoent *getprotobynumber_r __P_((int, struct protoent *, char *, int)); +struct protoent *getprotoent_r __P_((struct protoent *, char *, int)); +struct servent *getservbyname_r __P_((const char *, const char *, + struct servent *, char *, int)); +struct servent *getservbyport_r __P_((int, const char *, struct servent *, + char *, int)); +struct servent *getservent_r __P_((struct servent *, char *, int)); +__END_DECLS + +#endif /* !_NETDB_H_ */ diff --git a/lib/libpthread/include/pthread/ac-types.h b/lib/libpthread/include/pthread/ac-types.h new file mode 100755 index 00000000000..f21fc6806e4 --- /dev/null +++ b/lib/libpthread/include/pthread/ac-types.h @@ -0,0 +1,11 @@ +#ifndef pthread_size_t +#define pthread_ipaddr_type unsigned long +#define pthread_ipport_type unsigned short +#define pthread_clock_t long +#define pthread_size_t unsigned int +#define pthread_ssize_t int +#define pthread_time_t long +#define pthread_fpos_t long +#define pthread_off_t long +#define pthread_va_list void * +#endif diff --git a/lib/libpthread/include/pthread/cleanup.h b/lib/libpthread/include/pthread/cleanup.h new file mode 100755 index 00000000000..720f2d55445 --- /dev/null +++ b/lib/libpthread/include/pthread/cleanup.h @@ -0,0 +1,59 @@ +/* ==== cleanup.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: cleanup.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : cleanup header. + * + * 1.20 94/02/13 proven + * -Started coding this file. + */ + +/* + * New cleanup structures + */ +struct pthread_cleanup { + struct pthread_cleanup *next; + void (*routine)(); + void *routine_arg; +}; + +/* + * New functions + */ + +__BEGIN_DECLS + +int pthread_cleanup_push __P_((void (*routine)(void *), void *routine_arg)); +void pthread_cleanup_pop __P_((int execute)); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/cond.h b/lib/libpthread/include/pthread/cond.h new file mode 100755 index 00000000000..28c283b75f4 --- /dev/null +++ b/lib/libpthread/include/pthread/cond.h @@ -0,0 +1,100 @@ +/* ==== cond.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: cond.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : Condition variable header. + * + * 1.00 93/10/30 proven + * -Started coding this file. + */ + +#include <timers.h> + +/* + * New cond structures + */ +enum pthread_condtype { + COND_TYPE_FAST, + COND_TYPE_STATIC_FAST, + COND_TYPE_COUNTING_FAST, /* Used with MUTEX_TYPE_COUNTING_FAST */ + COND_TYPE_METERED, + COND_TYPE_DEBUG, /* Debug conds will have lots of options */ + COND_TYPE_MAX +}; + +#define PTHREAD_CONDTYPE_FAST 1 +#define PTHREAD_CONDTYPE_DEBUG 4 +#define PTHREAD_CONDTYPE_RECURSIVE 2 + +typedef struct pthread_cond { + enum pthread_condtype c_type; + struct pthread_queue c_queue; + semaphore c_lock; + void * c_data; + long c_flags; +} pthread_cond_t; + +typedef struct pthread_condattr { + enum pthread_condtype c_type; + long c_flags; +} pthread_condattr_t; + +/* + * Flags for conds. + */ +#define COND_FLAGS_PRIVATE 0x01 +#define COND_FLAGS_INITED 0x02 +#define COND_FLAGS_BUSY 0x04 + +/* + * Static cond initialization values. + */ +#define PTHREAD_COND_INITIALIZER \ +{ COND_TYPE_STATIC_FAST, PTHREAD_QUEUE_INITIALIZER, \ + SEMAPHORE_CLEAR, NULL, COND_FLAGS_INITED } + +/* + * New functions + */ + +__BEGIN_DECLS + +int pthread_cond_init __P_((pthread_cond_t *, const pthread_condattr_t *)); +int pthread_cond_timedwait __P_((pthread_cond_t *, pthread_mutex_t *, + const struct timespec * abstime)); +int pthread_cond_wait __P_((pthread_cond_t *, pthread_mutex_t *)); +int pthread_cond_signal __P_((pthread_cond_t *)); +int pthread_cond_broadcast __P_((pthread_cond_t *)); +int pthread_cond_destroy __P_((pthread_cond_t *)); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/config.h b/lib/libpthread/include/pthread/config.h new file mode 100755 index 00000000000..d944b14a8c6 --- /dev/null +++ b/lib/libpthread/include/pthread/config.h @@ -0,0 +1,4 @@ +#ifndef _SYS___CONFIG_H_ +#define _SYS___CONFIG_H_ +#define _OS_HAS_TIMESPEC 1 +#endif diff --git a/lib/libpthread/include/pthread/debug_out.h b/lib/libpthread/include/pthread/debug_out.h new file mode 100755 index 00000000000..6968c5ea90e --- /dev/null +++ b/lib/libpthread/include/pthread/debug_out.h @@ -0,0 +1,44 @@ +/* debug_out.h - macros to use for debugging prints in places where calls + to printf() and gang are ill-advised. */ + +#ifdef PTHREAD_DEBUGGING +#define PTHREAD_DEBUG_WriteStr(S) (void)machdep_sys_write(2,S,strlen(S)) +#define PTHREAD_DEBUG_WriteInt32Hex(X) \ + { char _xbuf[8]; int _temp = (int)(X), _temp2; \ + _temp2 = ((_temp>>28)&0xf); \ + _xbuf[0] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>24)&0xf); \ + _xbuf[1] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>20)&0xf); \ + _xbuf[2] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>16)&0xf); \ + _xbuf[3] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>12)&0xf); \ + _xbuf[4] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>8)&0xf); \ + _xbuf[5] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>4)&0xf); \ + _xbuf[6] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = (_temp&0xf); \ + _xbuf[7] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + (void)machdep_sys_write(2,_xbuf,8); \ + } +#ifdef __alpha +#define PTHREAD_DEBUG_WriteInt64Hex(X) \ + { long _tempX = (long)(X),_tempY; \ + _tempY=((_tempX>>32)&0xffffffff); \ + PTHREAD_DEBUG_WriteInt32Hex(_tempY); \ + _tempY=(_tempX&0xffffffff); \ + PTHREAD_DEBUG_WriteInt32Hex(_tempY); \ + } +#define PTHREAD_DEBUG_WritePointer(X) PTHREAD_DEBUG_WriteInt64Hex(X) +#else +#define PTHREAD_DEBUG_WriteInt64Hex(X) PTHREAD_DEBUG_WriteInt32Hex(X) +#define PTHREAD_DEBUG_WritePointer(X) PTHREAD_DEBUG_WriteInt32Hex(X) +#endif /* __alpha */ +#else /* ! PTHREAD_DEBUGGING */ +#define PTHREAD_DEBUG_WriteStr(S) +#define PTHREAD_DEBUG_WriteInt32Hex(X) +#define PTHREAD_DEBUG_WriteInt64HeX(X) +#define PTHREAD_DEBUG_WritePointer(X) +#endif /* PTHREAD_DEBUGGING */ diff --git a/lib/libpthread/include/pthread/fd.h b/lib/libpthread/include/pthread/fd.h new file mode 100755 index 00000000000..28e55935812 --- /dev/null +++ b/lib/libpthread/include/pthread/fd.h @@ -0,0 +1,122 @@ +/* ==== fd.h ============================================================ + * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: fd.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : Basic fd header. + * + * 1.00 93/08/14 proven + * -Started coding this file. + * + * 1.01 93/11/13 proven + * -The functions readv() and writev() added + */ + +/* + * New pthread types. + */ +enum fd_type { + FD_NT, /* Not tested */ + FD_NIU, /* Known to be not in use */ + FD_HALF_DUPLEX, /* Files, and seeking devices */ + FD_FULL_DUPLEX, /* pipes, sockets, drivers, ... */ + FD_TEST_HALF_DUPLEX, /* Redo machdep_sys_fcntl */ + FD_TEST_FULL_DUPLEX /* Redo machdep_sys_fcntl */ +}; + + +#define FD_READ 0x1 +#define FD_WRITE 0x2 +#define FD_RDWR (FD_READ | FD_WRITE) + +union fd_data { + void *ptr; + int i; +}; + +struct timespec; +struct iovec; +struct fd_ops { + pthread_ssize_t (*write) __P_((union fd_data, int, const void *, + size_t, struct timespec *)); + pthread_ssize_t (*read) __P_((union fd_data, int, void *, size_t, + struct timespec *)); + int (*close)(); + int (*fcntl)(); + int (*writev) __P_((union fd_data, int, + const struct iovec *, + int, struct timespec *)); + int (*readv) __P_((union fd_data, int, + const struct iovec *, + int, struct timespec *)); + off_t (*seek)(); + int use_kfds; +}; + +struct fd_table_entry { + struct pthread_queue r_queue; + struct pthread_queue w_queue; + struct pthread *r_owner; + struct pthread *w_owner; + pthread_mutex_t mutex; + struct fd_table_entry *next; + struct fd_ops *ops; + enum fd_type type; + int r_lockcount; /* Count for FILE read locks */ + int w_lockcount; /* Count for FILE write locks */ + int count; + + /* data that needs to be passed to the type dependent fd */ + int flags; + union fd_data fd; +}; + +/* + * Globals + */ +#if defined(PTHREAD_KERNEL) + +extern struct fd_table_entry **fd_table; +extern int dtablesize; + +#endif + +/* + * New functions + */ + +__BEGIN_DECLS + +#if defined(PTHREAD_KERNEL) + +#endif + +__END_DECLS diff --git a/lib/libpthread/include/pthread/fd_pipe.h b/lib/libpthread/include/pthread/fd_pipe.h new file mode 100755 index 00000000000..1561eeb6a7e --- /dev/null +++ b/lib/libpthread/include/pthread/fd_pipe.h @@ -0,0 +1,54 @@ +/* ==== fd_pipe.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: fd_pipe.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : The new fast ITC pipe header. + * + * 1.00 93/08/14 proven + * -Started coding this file. + */ + +struct __pipe { + semaphore lock; + char * buf; + int size; + int flags; + int count; + int offset; + struct pthread * wait; + char * wait_buf; + size_t wait_size; +}; + +#define RD_CLOSED 0x01 +#define WR_CLOSED 0x02 + diff --git a/lib/libpthread/include/pthread/kernel.h b/lib/libpthread/include/pthread/kernel.h new file mode 100755 index 00000000000..71518becced --- /dev/null +++ b/lib/libpthread/include/pthread/kernel.h @@ -0,0 +1,71 @@ +/* ==== kernel.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: kernel.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : mutex header. + * + * 1.00 93/07/22 proven + * -Started coding this file. + */ + +/* + * Defines only for the pthread user kernel. + */ +#if defined(PTHREAD_KERNEL) + +#ifdef __GNUC__ +#include <assert.h> +#endif +#ifdef __ASSERT_FUNCTION +#define PANIC() panic_kernel( __FILE__, __LINE__, __ASSERT_FUNCTION ) +#else +#define PANIC() panic_kernel( __FILE__, __LINE__, (const char *)0 ) +#endif + + +/* Time each rr thread gets */ +#define PTHREAD_RR_TIMEOUT 100000000 + +/* Set the errno value */ +#define SET_ERRNO(x) \ +{ \ + if (!pthread_run->error_p) { \ + pthread_run->error_p = &pthread_run->error; \ + } \ + (*(pthread_run->error_p)) = x; \ +} + +/* Globals only the internals should see */ +extern struct pthread_prio_queue * pthread_current_prio_queue; +extern volatile int pthread_kernel_lock; + +#endif diff --git a/lib/libpthread/include/pthread/kthread.h b/lib/libpthread/include/pthread/kthread.h new file mode 100755 index 00000000000..e9eed520ae9 --- /dev/null +++ b/lib/libpthread/include/pthread/kthread.h @@ -0,0 +1,67 @@ +/* ==== kthread.h ============================================================ + * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: kthread.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : Basic pthread header. + * + * 1.00 93/07/20 proven + * -Started coding this file. + * + * 1.32 94/05/25 proven + * -Started adding kernel thread support + */ + +#ifndef _KTHREAD_H_ +#define _KTHREAD_H_ + +enum kthread_state { + KS_RUNNING, + KS_DEAD, +}; + +struct kthread { + enum kthread_state state; + + struct pthread_queue pthread_current_queue; + struct pthread * pthread_link_list; + struct pthread * pthread_run; + + semaphore lock; + +}; + +/* + * Globals + */ +extern struct kthread * kthread_link_list; + +#endif diff --git a/lib/libpthread/include/pthread/mutex.h b/lib/libpthread/include/pthread/mutex.h new file mode 100755 index 00000000000..273ae461e69 --- /dev/null +++ b/lib/libpthread/include/pthread/mutex.h @@ -0,0 +1,102 @@ +/* ==== mutex.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: mutex.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : mutex header. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +/* + * New mutex structures + */ +enum pthread_mutextype { + MUTEX_TYPE_STATIC_FAST = 0, + MUTEX_TYPE_FAST = 1, + MUTEX_TYPE_COUNTING_FAST = 2, /* Recursive */ + MUTEX_TYPE_METERED = 3, + MUTEX_TYPE_DEBUG = 4, /* This will have lots of options */ + MUTEX_TYPE_MAX +}; + +#define PTHREAD_MUTEXTYPE_FAST 1 +#define PTHREAD_MUTEXTYPE_DEBUG 4 +#define PTHREAD_MUTEXTYPE_RECURSIVE 2 + +union pthread_mutex_data { + void * m_ptr; + int m_count; +}; + +typedef struct pthread_mutex { + enum pthread_mutextype m_type; + struct pthread_queue m_queue; + struct pthread * m_owner; + semaphore m_lock; + union pthread_mutex_data m_data; + long m_flags; +} pthread_mutex_t; + +typedef struct pthread_mutexattr { + enum pthread_mutextype m_type; + long m_flags; +} pthread_mutexattr_t; + +/* + * Flags for mutexes. + */ +#define MUTEX_FLAGS_PRIVATE 0x01 +#define MUTEX_FLAGS_INITED 0x02 +#define MUTEX_FLAGS_BUSY 0x04 + +/* + * Static mutex initialization values. + */ +#define PTHREAD_MUTEX_INITIALIZER \ +{ MUTEX_TYPE_STATIC_FAST, PTHREAD_QUEUE_INITIALIZER, \ + NULL, SEMAPHORE_CLEAR, { NULL }, MUTEX_FLAGS_INITED } + +/* + * New functions + */ + +__BEGIN_DECLS + +int pthread_mutex_init __P_((pthread_mutex_t *, const pthread_mutexattr_t *)); +int pthread_mutex_lock __P_((pthread_mutex_t *)); +int pthread_mutex_unlock __P_((pthread_mutex_t *)); +int pthread_mutex_trylock __P_((pthread_mutex_t *)); +int pthread_mutex_destroy __P_((pthread_mutex_t *)); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/paths.h b/lib/libpthread/include/pthread/paths.h new file mode 100755 index 00000000000..3d695546bc3 --- /dev/null +++ b/lib/libpthread/include/pthread/paths.h @@ -0,0 +1,12 @@ +#ifndef _SYS___PATHS_H_ +#define _SYS___PATHS_H_ +#define _PATH_PTY "/devices/pseudo/" +#define _PATH_TZDIR "/usr/share/lib/zoneinfo" +#define _PATH_TZFILE "/usr/share/lib/zoneinfo/localtime" +#define _PATH_RESCONF "/etc/resolv.conf" +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" +#define _PATH_BSHELL "/bin/sh" +#endif diff --git a/lib/libpthread/include/pthread/prio_queue.h b/lib/libpthread/include/pthread/prio_queue.h new file mode 100755 index 00000000000..d9c84ad25ed --- /dev/null +++ b/lib/libpthread/include/pthread/prio_queue.h @@ -0,0 +1,78 @@ +/* ==== priority.h ========================================================== + * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: prio_queue.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Priority functions. + * + * 1.00 94/09/19 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_PRIO_QUEUE_H_ +#define _PTHREAD_PRIO_QUEUE_H_ + +/* + * Static queue initialization values. + */ +#define PTHREAD_DEFAULT_PRIORITY 64 +#define PTHREAD_MAX_PRIORITY 126 +#define PTHREAD_MIN_PRIORITY 0 + +/* + * New prio_queue structures + */ +struct pthread_prio_level { + struct pthread * first; + struct pthread * last; +}; + +struct pthread_prio_queue { + void * data; + struct pthread * next; + struct pthread_prio_level level[PTHREAD_MAX_PRIORITY + 1]; +}; + +/* + * New functions + */ + +__BEGIN_DECLS + +void pthread_prio_queue_init __P_((struct pthread_prio_queue *)); +void pthread_prio_queue_enq __P_((struct pthread_prio_queue *, + struct pthread *)); +struct pthread *pthread_prio_queue_deq + __P_((struct pthread_prio_queue *)); + +__END_DECLS + +#endif diff --git a/lib/libpthread/include/pthread/pthread_attr.h b/lib/libpthread/include/pthread/pthread_attr.h new file mode 100755 index 00000000000..2602c1fa9c2 --- /dev/null +++ b/lib/libpthread/include/pthread/pthread_attr.h @@ -0,0 +1,122 @@ +/* ==== pthread_attr.h ======================================================== + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: pthread_attr.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Basic pthread attributes header. + * + * 1.00 93/11/03 proven + * -Started coding this file. + */ + +#define _POSIX_THREAD_ATTR_STACKSIZE + +#define PTHREAD_STACK_DEFAULT 65536 + +/* flags */ +#define PTHREAD_DETACHED 0x1 +#define PTHREAD_SCOPE_SYSTEM 0x2 +#define PTHREAD_INHERIT_SCHED 0x4 +#define PTHREAD_NOFLOAT 0x8 + +#define PTHREAD_CREATE_DETACHED PTHREAD_DETACHED +#define PTHREAD_CREATE_JOINABLE 0 +#define PTHREAD_SCOPE_PROCESS 0 +#define PTHREAD_EXPLICIT_SCHED 0 + +/* + * New pthread attribute types. + */ +enum schedparam_policy { + SCHED_RR, + SCHED_IO, + SCHED_FIFO, + SCHED_OTHER +}; + +struct pthread_attr { + enum schedparam_policy schedparam_policy; + int sched_priority; + + int flags; + void * arg_attr; + void (*cleanup_attr)(); + void * stackaddr_attr; + size_t stacksize_attr; +}; + +struct sched_param { + int sched_priority; + void * no_data; +}; + +/* + * New functions + */ + +__BEGIN_DECLS + +#if defined(DCE_COMPAT) + +typedef struct pthread_attr * pthread_attr_t; + +int pthread_attr_create __P_((pthread_attr_t *)); +int pthread_attr_delete __P_((pthread_attr_t *)); + +#else + +typedef struct pthread_attr pthread_attr_t; + +int pthread_attr_init __P_((pthread_attr_t *)); +int pthread_attr_destroy __P_((pthread_attr_t *)); +int pthread_attr_setstacksize __P_((pthread_attr_t *, size_t)); +int pthread_attr_getstacksize __P_((pthread_attr_t *, size_t *)); +int pthread_attr_setstackaddr __P_((pthread_attr_t *, void *)); +int pthread_attr_getstackaddr __P_((pthread_attr_t *, void **)); +int pthread_attr_setdetachstate __P_((pthread_attr_t *, int )); +int pthread_attr_getdetachstate __P_((pthread_attr_t *, int *)); +int pthread_attr_setscope __P_((pthread_attr_t *, int )); +int pthread_attr_getscope __P_((pthread_attr_t *, int *)); +int pthread_attr_setinheritsched __P_((pthread_attr_t *, int )); +int pthread_attr_getinheritsched __P_((pthread_attr_t *, int *)); +int pthread_attr_setschedpolicy __P_((pthread_attr_t *, int )); +int pthread_attr_getschedpolicy __P_((pthread_attr_t *, int *)); +int pthread_attr_setschedparam __P_((pthread_attr_t *, struct sched_param *)); +int pthread_attr_getschedparam __P_((pthread_attr_t *, struct sched_param *)); + +int pthread_attr_setfloatstate __P_((pthread_attr_t *, int )); +int pthread_attr_getfloatstate __P_((pthread_attr_t *, int *)); +int pthread_attr_setcleanup __P_((pthread_attr_t *, void (*routine)(void *), + void *)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/include/pthread/pthread_once.h b/lib/libpthread/include/pthread/pthread_once.h new file mode 100755 index 00000000000..a9395c0f7fe --- /dev/null +++ b/lib/libpthread/include/pthread/pthread_once.h @@ -0,0 +1,58 @@ +/* ==== pthread_once.h ======================================================== + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: pthread_once.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : mutex header. + * + * 1.00 93/12/12 proven + * -Started coding this file. + */ + +/* New pthread_once structures */ +typedef struct pthread_once { + int state; + pthread_mutex_t mutex; +} pthread_once_t; + +/* Static pthread_once_t initialization value. */ +#define PTHREAD_NEEDS_INIT 0 +#define PTHREAD_DONE_INIT 1 +#define PTHREAD_ONCE_INIT { PTHREAD_NEEDS_INIT, PTHREAD_MUTEX_INITIALIZER } + +/* New functions */ + +__BEGIN_DECLS + +int pthread_once __P_((pthread_once_t *, void (*init_routine)(void))); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/queue.h b/lib/libpthread/include/pthread/queue.h new file mode 100755 index 00000000000..0d7d2d219e3 --- /dev/null +++ b/lib/libpthread/include/pthread/queue.h @@ -0,0 +1,67 @@ +/* ==== queue.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: queue.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : mutex header. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +/* + * New queue structures + */ +struct pthread_queue { + struct pthread *q_next; + struct pthread *q_last; + void *q_data; +}; + +/* + * Static queue initialization values. + */ +#define PTHREAD_QUEUE_INITIALIZER { NULL, NULL, NULL } + +/* + * New functions + * Should make pthread_queue_get a macro + */ + +__BEGIN_DECLS + +void pthread_queue_init __P_((struct pthread_queue *)); +void pthread_queue_enq __P_((struct pthread_queue *, struct pthread *)); +int pthread_queue_remove __P_((struct pthread_queue *, struct pthread *)); +struct pthread *pthread_queue_get __P_((struct pthread_queue *)); +struct pthread *pthread_queue_deq __P_((struct pthread_queue *)); + +__END_DECLS diff --git a/lib/libpthread/include/pthread/sleep.h b/lib/libpthread/include/pthread/sleep.h new file mode 100755 index 00000000000..9f8f2dccd95 --- /dev/null +++ b/lib/libpthread/include/pthread/sleep.h @@ -0,0 +1,63 @@ +/* ==== sleep.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: sleep.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : sleep header. + * + * 1.00 94/06/04 proven + * -Started coding this file. + */ + +#if defined(PTHREAD_KERNEL) + +#include <timers.h> + +/* + * New functions + */ +static inline int machdep_gettimeofday(struct timespec * current_time) +{ + struct timeval current_real_time; + int ret; + + ret = gettimeofday(¤t_real_time, NULL); + TIMEVAL_TO_TIMESPEC((¤t_real_time), current_time); + return(ret); +} + +__BEGIN_DECLS + +void sleep_schedule __P_((struct timespec *, struct timespec *)); + +__END_DECLS + +#endif diff --git a/lib/libpthread/include/pthread/specific.h b/lib/libpthread/include/pthread/specific.h new file mode 100755 index 00000000000..6757ceeb08e --- /dev/null +++ b/lib/libpthread/include/pthread/specific.h @@ -0,0 +1,66 @@ +/* ==== specific.h ======================================================== + * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: specific.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Thread specific data management header. + * + * 1.20 94/03/30 proven + * -Started coding this file. + */ + +#define PTHREAD_DATAKEYS_MAX 256 +#define _POSIX_THREAD_DESTRUTOR_ITERATIONS 4 + +/* + * New thread specific key type. + */ +struct pthread_key { + pthread_mutex_t mutex; + long count; + void (*destructor)(); +}; + +typedef int pthread_key_t; + +/* + * New functions + */ + +__BEGIN_DECLS + +int pthread_key_create __P_((pthread_key_t *, void (*routine)(void *))); +int pthread_setspecific __P_((pthread_key_t, const void *)); +void *pthread_getspecific __P_((pthread_key_t)); +int pthread_key_delete __P_((pthread_key_t)); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/state.def b/lib/libpthread/include/pthread/state.def new file mode 100755 index 00000000000..c62d102a9f0 --- /dev/null +++ b/lib/libpthread/include/pthread/state.def @@ -0,0 +1,64 @@ +/* This file defines the states that a given thread can be in. + + The funky macro use here is so that this one header file can also + define the corresponding state names, so that the two lists can't + get inconsistent within a given source tree. */ + +/* The thread is runnable. */ +__pthread_defstate (PS_RUNNING, "running") + +/* + * The rest of the states are where the thread is waiting on some event. + * Someday maybe the "data" field will point to the object being waited for. + */ + +/* Waiting for a mutex (pthread_mutex_lock()). */ +__pthread_defstate (PS_MUTEX_WAIT, "mutex") + +/* Waiting on a condition variable + (pthread_cond_wait(), or pthread_cond_timedwait()). */ +__pthread_defstate (PS_COND_WAIT, "cond") + +/* + * File descriptor stuff. + * + * File descriptors have a special lock. If it is a FULL_DUPLEX fd such as + * a socket or fifo then it has two mutexes, one for reads and one for writes. + * Some routines will even try to get both. It will always try to get the + * read lock first before tring to get the write. All other fds only have + * one mutex which all calls will get. It is displayed as if it is a read lock. + */ +/* Waiting on a fd read lock (fd_lock()) */ +__pthread_defstate (PS_FDLR_WAIT, "fdlr") + +/* Waiting on a fd write lock (fd_lock()) */ +__pthread_defstate (PS_FDLW_WAIT, "fdlw") + +/* Waiting for the kernel fd to have data to read, + (read(), readv(), recv(), recvfrom(), and recvmsg()). */ +__pthread_defstate (PS_FDR_WAIT, "fdr") /* Waiting on a kernel read */ + +/* Waiting for the kernel fd to allow a write + (write(), writev(), send(), sendto(), sendmsg()) */ +__pthread_defstate (PS_FDW_WAIT, "fdw") + +/* Waiting for several fds in a select() */ +__pthread_defstate (PS_SELECT_WAIT, "select") + +/* Waiting on a sleep (sleep(), usleep() or nanosleep()). */ +__pthread_defstate (PS_SLEEP_WAIT, "sleep") + +/* Waiting for a child to die (wait(), waitpid(), wait3(), or wait4()). */ +__pthread_defstate (PS_WAIT_WAIT, "wait") + +/* Waiting on some set of signals (sigwait()) */ +__pthread_defstate (PS_SIGWAIT, "sig") + +/* Waiting for a thread to die (pthread_join()) */ +__pthread_defstate (PS_JOIN, "join") + +/* Waiting for some thread to join with me or detach me */ +__pthread_defstate (PS_DEAD, "dead") + +/* Waiting for some thread to create me */ +__pthread_defstate (PS_UNALLOCED, "unallocated") diff --git a/lib/libpthread/include/pthread/types.h b/lib/libpthread/include/pthread/types.h new file mode 100755 index 00000000000..7fdf001a0bc --- /dev/null +++ b/lib/libpthread/include/pthread/types.h @@ -0,0 +1,46 @@ +#ifndef pthread_types_h +#define pthread_types_h + +#include <pthread/xtypes.h> +#include <pthread/ac-types.h> + +#if !defined (pthread_va_list) && defined (__NetBSD__) +#include <stdarg.h> +#define pthread_va_list _BSD_VA_LIST_ +#endif + +#if !defined (pthread_va_list) && defined (__GNUC__) +#define __need_va_list +#include <stdarg.h> +#define pthread_va_list __gnuc_va_list +#endif /* pthread_va_list, __GNUC__ */ + +/* OSF/1 does it this way. */ +#if !defined (pthread_va_list) && defined (pthread_have_va_list_h) +#ifndef _VA_LIST +#define _HIDDEN_VA_LIST +#include <va_list.h> +#define pthread_va_list __va_list +#else +/* va_list has already been defined */ +#define pthread_va_list va_list +#endif +#endif + +/* If all else fails... */ +#ifndef pthread_va_list +#include <stdarg.h> +#define pthread_va_list va_list +#endif + +#if defined(__STDC__) || defined(__GNUC__) +#ifndef __P_ +#define __P_(protos) protos +#endif +#else +#ifndef __P_ +#define __P_(protos) +#endif +#endif + +#endif /* pthread_types_h */ diff --git a/lib/libpthread/include/pthread/unistd.h b/lib/libpthread/include/pthread/unistd.h new file mode 100755 index 00000000000..3cb07533114 --- /dev/null +++ b/lib/libpthread/include/pthread/unistd.h @@ -0,0 +1,159 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)unistd.h 5.13 (Berkeley) 6/17/91 + */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +void _exit __P_((int)); +int access __P_((const char *, int)); +int chdir __P_((const char *)); +int chown __P_((const char *, uid_t, gid_t)); +int close __P_((int)); +int dup __P_((int)); +int dup2 __P_((int, int)); +int execve __P_((const char *, char * const *, char * const *)); +pid_t fork __P_((void)); +int isatty __P_((int)); +int link __P_((const char *, const char *)); +off_t lseek __P_((int, off_t, int)); +int pipe __P_((int *)); +ssize_t read __P_((int, void *, size_t)); +u_int sleep __P_((u_int)); +char *ttyname __P_((int)); +int unlink __P_((const char *)); +ssize_t write __P_((int, const void *, size_t)); + +/* Not implemented for threads yet */ +u_int alarm __P_((u_int)); +char *cuserid __P_((char *)); +int execl __P_((const char *, const char *, ...)); +int execle __P_((const char *, const char *, ...)); +int execlp __P_((const char *, const char *, ...)); +int execv __P_((const char *, char * const *)); +int execvp __P_((const char *, char * const *)); +long fpathconf __P_((int, int)); /* not yet */ +char *getcwd __P_((char *, size_t)); +gid_t getegid __P_((void)); +uid_t geteuid __P_((void)); +gid_t getgid __P_((void)); +int getgroups __P_((int, int *)); /* XXX (gid_t *) */ +char *getlogin __P_((void)); +pid_t getpgrp __P_((void)); +pid_t getpid __P_((void)); +pid_t getppid __P_((void)); +uid_t getuid __P_((void)); +long pathconf __P_((const char *, int)); /* not yet */ +int pause __P_((void)); +int rmdir __P_((const char *)); +int setgid __P_((gid_t)); +int setpgid __P_((pid_t, pid_t)); +pid_t setsid __P_((void)); +int setuid __P_((uid_t)); +long sysconf __P_((int)); /* not yet */ +pid_t tcgetpgrp __P_((int)); +int tcsetpgrp __P_((int, pid_t)); + +#ifndef _POSIX_SOURCE + +int acct __P_((const char *)); +int async_daemon __P_((void)); +char *brk __P_((const char *)); +int chflags __P_((const char *, long)); +int chroot __P_((const char *)); +char *crypt __P_((const char *, const char *)); +int des_cipher __P_((const char *, char *, long, int)); +int des_setkey __P_((const char *key)); +int encrypt __P_((char *, int)); +void endusershell __P_((void)); +int exect __P_((const char *, char * const *, char * const *)); +int fchdir __P_((int)); +int fchflags __P_((int, long)); +int fchown __P_((int, uid_t, gid_t)); +int fsync __P_((int)); +int ftruncate __P_((int, off_t)); +int getdtablesize __P_((void)); +long gethostid __P_((void)); +int gethostname __P_((char *, int)); +mode_t getmode __P_((const void *, mode_t)); +int getpagesize __P_((void)); +char *getpass __P_((const char *)); +char *getusershell __P_((void)); +char *getwd __P_((char *)); /* obsoleted by getcwd() */ +int initgroups __P_((const char *, int)); +int mknod __P_((const char *, mode_t, dev_t)); +int mkstemp __P_((char *)); +char *mktemp __P_((char *)); +int nfssvc __P_((int)); +int nice __P_((int)); +void psignal __P_((u_int, const char *)); +extern char *sys_siglist[]; +int profil __P_((char *, int, int, int)); +int rcmd __P_((char **, int, const char *, + const char *, const char *, int *)); +char *re_comp __P_((const char *)); +int re_exec __P_((const char *)); +int readlink __P_((const char *, char *, int)); +int reboot __P_((int)); +int revoke __P_((const char *)); +int rresvport __P_((int *)); +int ruserok __P_((const char *, int, const char *, const char *)); +char *sbrk __P_((int)); +int setegid __P_((gid_t)); +int seteuid __P_((uid_t)); +int setgroups __P_((int, const int *)); +void sethostid __P_((long)); +int sethostname __P_((const char *, int)); +int setkey __P_((const char *)); +int setlogin __P_((const char *)); +void *setmode __P_((const char *)); +int setpgrp __P_((pid_t pid, pid_t pgrp)); /* obsoleted by setpgid() */ +int setregid __P_((int, int)); +int setreuid __P_((int, int)); +int setrgid __P_((gid_t)); +int setruid __P_((uid_t)); +void setusershell __P_((void)); +int swapon __P_((const char *)); +int symlink __P_((const char *, const char *)); +void sync __P_((void)); +int syscall __P_((int, ...)); +int truncate __P_((const char *, off_t)); +int ttyslot __P_((void)); +u_int ualarm __P_((u_int, u_int)); +void usleep __P_((u_int)); +int vfork __P_((void)); + +#endif /* !_POSIX_SOURCE */ +__END_DECLS + diff --git a/lib/libpthread/include/pthread/util.h b/lib/libpthread/include/pthread/util.h new file mode 100755 index 00000000000..c9ff1dbcabd --- /dev/null +++ b/lib/libpthread/include/pthread/util.h @@ -0,0 +1,89 @@ +/* ==== util.h ============================================================ + * Copyright (c) 1991, 1992, 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: util.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Header file for generic utility functions. + * + * 91/08/31 proven - Added exchange. + * Exchange any two objects of any size in any table. + * + * 91/10/06 proven - Cleaned out all the old junk. + * + * 91/03/06 proven - Added getint. + */ + +#ifndef _PTHREAD_UTIL_H +#define _PTHREAD_UTIL_H + +#ifndef NULL +#define NULL 0 +#endif + +/* Stuff only pthread internals really uses */ +#if defined(PTHREAD_KERNEL) + +#undef FALSE +#undef TRUE + +typedef enum Boolean { + FALSE, + TRUE +} Boolean; + +#define OK 0 +#define NUL '\0' +#define NOTOK -1 + +#if ! defined(min) +#define min(a,b) (((a)<(b))?(a):(b)) +#define max(a,b) (((a)>(b))?(a):(b)) +#endif + +/* Alingn the size to the next multiple of 4 bytes */ +#define ALIGN4(size) ((size + 3) & ~3) +#define ALIGN8(size) ((size + 7) & ~7) + +#ifdef DEBUG +#define DEBUG0(s) printf(s) +#define DEBUG1(s,a) printf(s,a) +#define DEBUG2(s,a,b) printf(s,a,b) +#define DEBUG3(s,a,b,c) printf(s,a,b,c) +#else +#define DEBUG0(s) +#define DEBUG1(s) +#define DEBUG2(s) +#define DEBUG3(s) +#endif + +#endif + +#endif diff --git a/lib/libpthread/include/pthread/version.h b/lib/libpthread/include/pthread/version.h new file mode 100755 index 00000000000..ae0cbc6f4cb --- /dev/null +++ b/lib/libpthread/include/pthread/version.h @@ -0,0 +1,43 @@ +/* ==== version.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: version.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Header file for programs that what to KNOW the version. + * + * 94/08/24 proven - Added this file for pthreads. + */ + +#ifndef _PTHREAD_VERSION_H +#define _PTHREAD_VERSION_H 1 +#define _PTHREAD_VERSION_M 60 +#define _PTHREAD_VERSION_P 0 +#endif diff --git a/lib/libpthread/include/pthread/xtypes.h b/lib/libpthread/include/pthread/xtypes.h new file mode 100755 index 00000000000..4dcc4f04f8c --- /dev/null +++ b/lib/libpthread/include/pthread/xtypes.h @@ -0,0 +1,13 @@ +/* If you need any special typedefs for function pointers &c to try + testing for in configure.in, define them here. */ + +/* According to ANSI, two struct types in the same module are not + compatible types. So there's no way to define a type for + pthread_sigset_t that's compatible with sigset_t when they're + structure types, if we assume we can't pull in a __sigset_t or + something by itself from system header files. + + Since that was my main reason for creating this file, there isn't + anything here now. If after working on this code a bit longer we + don't find anything else to put here, this file should just go + away. */ diff --git a/lib/libpthread/include/pwd.h b/lib/libpthread/include/pwd.h new file mode 100644 index 00000000000..4607080607a --- /dev/null +++ b/lib/libpthread/include/pwd.h @@ -0,0 +1,93 @@ +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)pwd.h 8.2 (Berkeley) 1/21/94 + * $Id: pwd.h,v 1.1 1998/07/21 13:19:08 peter Exp $ + */ + +#ifndef _PWD_H_ +#define _PWD_H_ + +#include <sys/types.h> + +#ifndef _POSIX_SOURCE +#define _PATH_PASSWD "/etc/passwd" +#define _PATH_MASTERPASSWD "/etc/master.passwd" + +#define _PATH_MP_DB "/etc/pwd.db" +#define _PATH_SMP_DB "/etc/spwd.db" + +#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb" + +#define _PW_KEYBYNAME '1' /* stored by name */ +#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */ +#define _PW_KEYBYUID '3' /* stored by uid */ + +#define _PASSWORD_EFMT1 '_' /* extended encryption format */ + +#define _PASSWORD_LEN 128 /* max length, not counting NULL */ +#endif + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* encrypted password */ + int pw_uid; /* user uid */ + int pw_gid; /* user gid */ + time_t pw_change; /* password change time */ + char *pw_class; /* user access class */ + char *pw_gecos; /* Honeywell login info */ + char *pw_dir; /* home directory */ + char *pw_shell; /* default shell */ + time_t pw_expire; /* account expiration */ +}; + +#include <sys/cdefs.h> + +__BEGIN_DECLS +struct passwd *getpwuid __P_((uid_t)); +struct passwd *getpwnam __P_((const char *)); +#ifndef _POSIX_SOURCE +struct passwd *getpwent __P_((void)); +#ifndef _XOPEN_SOURCE +int setpassent __P_((int)); +#endif +void setpwent __P_((void)); +void endpwent __P_((void)); +#endif +__END_DECLS + +#endif /* !_PWD_H_ */ diff --git a/lib/libpthread/include/resolv.h b/lib/libpthread/include/resolv.h new file mode 100644 index 00000000000..7e2fcc7a5da --- /dev/null +++ b/lib/libpthread/include/resolv.h @@ -0,0 +1,179 @@ +/* + * Copyright (c) 1983, 1987, 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)resolv.h 5.15 (Berkeley) 4/3/91 + * $Id: resolv.h,v 1.1 1998/07/21 13:19:08 peter Exp $ + */ + +#ifndef _RESOLV_H_ +#define _RESOLV_H_ + +#include <netinet/in.h> +/* + * This is specificly for Solaris which defines NOERROR in the streams + * header files and defines it differently than in arpa/nameser.h + */ +#ifdef NOERROR +#undef NOERROR +#endif +#include <arpa/nameser.h> + +/* + * revision information. this is the release date in YYYYMMDD format. + * it can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__RES > 19931104)". do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#define __RES 19940703 + +/* + * Resolver configuration file. + * Normally not present, but may contain the address of the + * inital name server(s) to query and the domain search list. + */ + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +/* + * Global defines and variables for resolver stub. + */ +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ +#define MAXDNSLUS 4 /* max # of host lookup types */ + +#define RES_TIMEOUT 5 /* min. seconds between retries */ +#define MAXRESOLVSORT 10 /* number of net to sort on */ +#define RES_MAXNDOTS 15 /* should reflect bit field size */ + +struct __res_state { + int retrans; /* retransmition time interval */ + int retry; /* number of times to retransmit */ + long options; /* option flags - see below. */ + int nscount; /* number of name servers */ + struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + u_short id; /* current packet id */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ + char defdname[MAXDNAME]; /* default domain */ + long pfcode; /* RES_PRF_ flags - see below. */ + u_char ndots:4; /* threshold for initial abs. query */ + u_char nsort:4; /* number of elements in sort_list[] */ + char unused[3]; + struct { + struct in_addr addr; + u_long mask; + } sort_list[MAXRESOLVSORT]; + char lookups[MAXDNSLUS]; +}; + +/* + * Resolver options + */ +#define RES_INIT 0x0001 /* address initialized */ +#define RES_DEBUG 0x0002 /* print debug messages */ +#define RES_AAONLY 0x0004 /* authoritative answers only */ +#define RES_USEVC 0x0008 /* use virtual circuit */ +#define RES_PRIMARY 0x0010 /* query primary server only */ +#define RES_IGNTC 0x0020 /* ignore trucation errors */ +#define RES_RECURSE 0x0040 /* recursion desired */ +#define RES_DEFNAMES 0x0080 /* use default domain name */ +#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x0200 /* search up local domain tree */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) + +/* + * Resolver "pfcode" values. Used by dig. + */ +#define RES_PRF_STATS 0x0001 +/* 0x0002 */ +#define RES_PRF_CLASS 0x0004 +#define RES_PRF_CMD 0x0008 +#define RES_PRF_QUES 0x0010 +#define RES_PRF_ANS 0x0020 +#define RES_PRF_AUTH 0x0040 +#define RES_PRF_ADD 0x0080 +#define RES_PRF_HEAD1 0x0100 +#define RES_PRF_HEAD2 0x0200 +#define RES_PRF_TTLID 0x0400 +#define RES_PRF_HEADX 0x0800 +#define RES_PRF_QUERY 0x1000 +#define RES_PRF_REPLY 0x2000 +#define RES_PRF_INIT 0x4000 +/* 0x8000 */ + +#define _res (*_res_status()) +#define h_errno (_res_get_error()) + +#include <sys/cdefs.h> +#include <stdio.h> + +/* Private routines shared between libc/net, named, nslookup and others. */ +#define dn_skipname __dn_skipname +#define fp_query __fp_query +#define hostalias __hostalias +#define putlong __putlong +#define putshort __putshort +#define p_class __p_class +#define p_time __p_time +#define p_type __p_type +__BEGIN_DECLS +struct __res_state *_res_status __P_((void)); +int _res_get_error __P_((void)); + +int __dn_skipname __P_((const u_char *, const u_char *)); +void __fp_query __P_((char *, FILE *)); +char *__hostalias __P_((const char *)); +void __putlong __P_((pthread_ipaddr_type, unsigned char *)); +void __putshort __P_((pthread_ipport_type, unsigned char *)); +char *__p_class __P_((int)); +char *__p_time __P_((unsigned long)); +char *__p_type __P_((int)); + +int dn_comp __P_((const unsigned char *, unsigned char *, int, + unsigned char **, unsigned char **)); +int dn_expand __P_((const unsigned char *, const unsigned char *, + const unsigned char *, unsigned char *, int)); +int res_init __P_((void)); +int res_mkquery __P_((int, const char *, int, int, const char *, int, + const char *, char *, int)); +int res_send __P_((const char *, int, char *, int)); +__END_DECLS + +#endif /* !_RESOLV_H_ */ + diff --git a/lib/libpthread/include/signal.h b/lib/libpthread/include/signal.h new file mode 100644 index 00000000000..9fb1ec6e2c8 --- /dev/null +++ b/lib/libpthread/include/signal.h @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)signal.h 8.3 (Berkeley) 3/30/94 + */ + +#ifndef _SIGNAL_H +#define _SIGNAL_H + +#include <sys/types.h> +#include <sys/cdefs.h> +#include <sys/__signal.h> + +__BEGIN_DECLS + +int raise __P_((int)); +/* RETSIGTYPE signal __P_((int __sig, RETSIGTYPE)); */ + +#ifndef _ANSI_SOURCE + +int sigfillset __P_((sigset_t *)); +int sigemptyset __P_((sigset_t *)); +int sigaddset __P_((sigset_t *, int)); +int sigdelset __P_((sigset_t *, int)); +int sigismember __P_((const sigset_t *, int)); +int sigsuspend __P_((const sigset_t *)); +int sigprocmask __P_((int, const sigset_t *, sigset_t *)); + +/* Still need work */ +int kill __P_((pid_t, int)); +int sigaction __P_((int, const struct sigaction *, struct sigaction *)); +int sigpending __P_((sigset_t *)); + +#ifndef _POSIX_SOURCE + +int killpg __P_((pid_t, int)); +int siginterrupt __P_((int, int)); +void psignal __P_((unsigned int, const char *)); + +/* int sigpause __P_((int)); */ +/* int sigsetmask __P_((int)); */ +/* int sigblock __P_((int)); */ +/* int sigreturn __P_((struct sigcontext *)); */ +/* int sigvec __P_((int, struct sigvec *, struct sigvec *)); */ +/* int sigstack __P_((const struct sigstack *, struct sigstack *)); */ + +#endif /* !_POSIX_SOURCE */ +#endif /* !_ANSI_SOURCE */ + +__END_DECLS + +#endif /* !_USER_SIGNAL_H */ diff --git a/lib/libpthread/include/stdlib.h b/lib/libpthread/include/stdlib.h new file mode 100644 index 00000000000..f51c7edf694 --- /dev/null +++ b/lib/libpthread/include/stdlib.h @@ -0,0 +1,127 @@ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)time.h 5.12 (Berkeley) 3/9/91 + * $Id: stdlib.h,v 1.1 1998/07/21 13:19:10 peter Exp $ + */ + +#ifndef _STDLIB_H_ +#define _STDLIB_H_ + +#include <sys/__stdlib.h> + +/* Returned by `div'. */ +typedef struct + { + int quot; /* Quotient. */ + int rem; /* Remainder. */ + } div_t; + +/* Returned by `ldiv'. */ +typedef struct + { + long quot; /* Quotient. */ + long rem; /* Remainder. */ + } ldiv_t; + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +#define EXIT_FAILURE 1 /* Failing exit status. */ +#define EXIT_SUCCESS 0 /* Successful exit status. */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +double atof __P_((const char *)); +int atoi __P_((const char *)); +long atol __P_((const char *)); +double strtod __P_((const char *, char **)); +long strtol __P_((const char *, char **, int)); +unsigned long strtoul __P_((const char *, char **, int)); + +int rand __P_((void)); +void srand __P_((unsigned int)); + +long random __P_((void)); +void srandom __P_((unsigned int)); +char * initstate __P_((unsigned int, char *, int)); +char * setstate __P_((char *)); + +void * malloc __P_((size_t)); +void * realloc __P_((void *, size_t)); +void * calloc __P_((size_t, size_t)); +void free __P_((void *)); + +__NORETURN void abort __P_((void)); +int atexit __P_((void (* __func)() )); +__NORETURN void exit __P_((int)); +int system __P_((const char *)); + +extern char ** environ; + +char * getenv __P_((const char *)); +int putenv __P_((const char *)); +int setenv __P_((const char *, const char *, int)); +void unsetenv __P_((const char *)); + +void * bsearch __P_((const void *, const void *, size_t, size_t, + int (* __func)__P_((const void *, const void *)) )); +void qsort __P_((void *, size_t, size_t, + int (* __func)__P_((const void *, const void *)) )); + +int abs __P_((int)); +long labs __P_((long)); +div_t div __P_((int, int)); +ldiv_t ldiv __P_((long, long)); + +void * memchr __P_((const void *, int, size_t)); + +/* Stuff to do */ +int mblen __P_((const char *, size_t)); +int mbtowc __P_((wchar_t *, const char *, size_t)); +int wctomb __P_((char *, wchar_t)); +size_t mbstowcs __P_((wchar_t *, const char *, size_t)); +size_t wcstombs __P_((char *, const wchar_t *, size_t)); + + +__END_DECLS + +#endif /* !_STDLIB_H_ */ diff --git a/lib/libpthread/include/string.h b/lib/libpthread/include/string.h new file mode 100644 index 00000000000..4143a1cfec7 --- /dev/null +++ b/lib/libpthread/include/string.h @@ -0,0 +1,85 @@ +/* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)string.h 5.10 (Berkeley) 3/9/91 + */ + +#ifndef _STRING_H_ +#define _STRING_H_ +#include <sys/cdefs.h> +#include <pthread/types.h> +#include <pthread/posix.h> +#include <sys/__string.h> + +#ifndef NULL +#define NULL 0 +#endif + +__BEGIN_DECLS +void *memchr __P_((const void *, int, size_t)); +int memcmp __P_((const void *, const void *, size_t)); +void *memcpy __P_((void *, const void *, size_t)); +void *memmove __P_((void *, const void *, size_t)); +void *memset __P_((void *, int, size_t)); +char *strcat __P_((char *, const char *)); +char *strchr __P_((const char *, int)); +int strcmp __P_((const char *, const char *)); +int strcoll __P_((const char *, const char *)); +char *strcpy __P_((char *, const char *)); +size_t strcspn __P_((const char *, const char *)); +char *strerror __P_((int)); +size_t strlen __P_((const char *)); +char *strncat __P_((char *, const char *, size_t)); +int strncmp __P_((const char *, const char *, size_t)); +char *strncpy __P_((char *, const char *, size_t)); +char *strpbrk __P_((const char *, const char *)); +char *strrchr __P_((const char *, int)); +size_t strspn __P_((const char *, const char *)); +char *strstr __P_((const char *, const char *)); +char *strtok __P_((char *, const char *)); +char *strtok_r __P_((char *, const char *, char **)); +size_t strxfrm __P_((char *, const char *, size_t)); + +/* Nonstandard routines common to all pthreads supported platforms */ +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +int ffs __P_((int)); +void *memccpy __P_((void *, const void *, int, size_t)); +int strcasecmp __P_((const char *, const char *)); +int strncasecmp __P_((const char *, const char *, size_t)); +char *strsignal __P_((int)); +void swab __P_((const void *, void *, size_t)); +#endif +__END_DECLS + +#endif /* _STRING_H_ */ diff --git a/lib/libpthread/include/syslog.h b/lib/libpthread/include/syslog.h new file mode 100644 index 00000000000..31b42285fc1 --- /dev/null +++ b/lib/libpthread/include/syslog.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)syslog.h 7.8 (Berkeley) 5/26/88 + */ + +#ifndef SYSLOG_H +#define SYSLOG_H + +/* Added __[BEGIN/END]_DECLS so this file would work with C++. (mevans) */ +#include <sys/cdefs.h> +#include <stdarg.h> + +/* Discipline: openlog(), closelog(), and setlogmask() are not thread-safe + * and should only be called when other threads will not be calling syslog + * functions. syslog() and vsyslog() are thread-safe and may be called + * asynchronously, even if openlog() has not been called. */ + +/* + * Facility codes + */ + +#define LOG_KERN (0<<3) /* kernel messages */ +#define LOG_USER (1<<3) /* random user-level messages */ +#define LOG_MAIL (2<<3) /* mail system */ +#define LOG_DAEMON (3<<3) /* system daemons */ +#define LOG_AUTH (4<<3) /* security/authorization messages */ +#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ +#define LOG_LPR (6<<3) /* line printer subsystem */ +#define LOG_NEWS (7<<3) /* network news subsystem */ +#define LOG_UUCP (8<<3) /* UUCP subsystem */ + /* other codes through 15 reserved for system use */ +#define LOG_LOCAL0 (16<<3) /* reserved for local use */ +#define LOG_LOCAL1 (17<<3) /* reserved for local use */ +#define LOG_LOCAL2 (18<<3) /* reserved for local use */ +#define LOG_LOCAL3 (19<<3) /* reserved for local use */ +#define LOG_LOCAL4 (20<<3) /* reserved for local use */ +#define LOG_LOCAL5 (21<<3) /* reserved for local use */ +#define LOG_LOCAL6 (22<<3) /* reserved for local use */ +#define LOG_LOCAL7 (23<<3) /* reserved for local use */ + +#define LOG_NFACILITIES 24 /* maximum number of facilities */ +#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ + +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) /* facility of pri */ + +/* + * Priorities (these are ordered) + */ + +#define LOG_EMERG 0 /* system is unusable */ +#define LOG_ALERT 1 /* action must be taken immediately */ +#define LOG_CRIT 2 /* critical conditions */ +#define LOG_ERR 3 /* error conditions */ +#define LOG_WARNING 4 /* warning conditions */ +#define LOG_NOTICE 5 /* normal but signification condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ + +#define LOG_PRIMASK 0x0007 /* mask to extract priority part (internal) */ +#define LOG_PRI(p) ((p) & LOG_PRIMASK) /* extract priority */ + +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +#ifdef KERNEL +#define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ +#endif + +/* + * arguments to setlogmask. + */ +#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything; LOG_NDELAY is the + * inverse of what it used to be. + */ +#define LOG_PID 0x01 /* log the pid with each message */ +#define LOG_CONS 0x02 /* log on the console if errors in sending */ +#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ +#define LOG_NDELAY 0x08 /* don't delay open */ +#define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */ + +__BEGIN_DECLS + +/* Syslogging functions. */ +void syslog(int pri, char *fmt, ...); +void vsyslog(int pri, char *fmt, va_list args); +void openlog(char *ident, int logstat, int logfac); +void closelog(void); +int setlogmask(int pmask); + +__END_DECLS + +#endif + diff --git a/lib/libpthread/include/time.h b/lib/libpthread/include/time.h new file mode 100644 index 00000000000..c27e66838a3 --- /dev/null +++ b/lib/libpthread/include/time.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)time.h 5.12 (Berkeley) 3/9/91 + * $Id: time.h,v 1.1 1998/07/21 13:19:10 peter Exp $ + */ + +#ifndef _TIME_H_ +#define _TIME_H_ + +#include <sys/__time.h> + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef __hpux__ +struct tm { + int tm_sec; /* seconds after the minute [0-60] */ + int tm_min; /* minutes after the hour [0-59] */ + int tm_hour; /* hours since midnight [0-23] */ + int tm_mday; /* day of the month [1-31] */ + int tm_mon; /* months since January [0-11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday [0-6] */ + int tm_yday; /* days since January 1 [0-365] */ + int tm_isdst; /* Daylight Savings Time flag */ + long tm_gmtoff; /* offset from CUT in seconds */ + char *tm_zone; /* timezone abbreviation */ +}; +#endif /* __hpux__ */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +/* clock_t clock __P_((void)); */ + +char * asctime __P_((const struct tm *)); +double difftime __P_((time_t, time_t)); +char * ctime __P_((const time_t *)); +struct tm * gmtime __P_((const time_t *)); +struct tm * localtime __P_((const time_t *)); + +char * asctime_r __P_((const struct tm *, char *)); +char * ctime_r __P_((const time_t *, char *)); +struct tm * gmtime_r __P_((const time_t *, struct tm *)); +struct tm * localtime_r __P_((const time_t *, struct tm *)); + +time_t mktime __P_((struct tm *)); + +/* size_t strftime __P_((char *, size_t, const char *, const struct tm *)); */ +time_t time __P_((time_t *)); + +#if !defined(_ANSI_SOURCE) +/* #define CLK_TCK 100 */ +extern char *tzname[2]; +void tzset __P_((void)); +#endif /* not ANSI */ + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +/* char *timezone __P_((int, int)); */ +void tzsetwall __P_((void)); +#endif /* neither ANSI nor POSIX */ + +__END_DECLS + +#endif /* !_TIME_H_ */ diff --git a/lib/libpthread/include/timers.h b/lib/libpthread/include/timers.h new file mode 100644 index 00000000000..af9db4a5b01 --- /dev/null +++ b/lib/libpthread/include/timers.h @@ -0,0 +1,45 @@ +/* ==== timers.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: timers.h,v 1.1 1998/07/21 13:19:10 peter Exp $ + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _TIMERS_H_ +#define _TIMERS_H_ + +#include <sys/timers.h> + +#endif diff --git a/lib/libpthread/include/tzfile.h b/lib/libpthread/include/tzfile.h new file mode 100644 index 00000000000..95bbc424be7 --- /dev/null +++ b/lib/libpthread/include/tzfile.h @@ -0,0 +1,154 @@ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Arthur David Olson of the National Cancer Institute. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)tzfile.h 5.10 (Berkeley) 4/3/91 + * $Id: tzfile.h,v 1.1 1998/07/21 13:19:10 peter Exp $ + */ + +#ifndef _TZFILE_H_ +#define _TZFILE_H_ + +#include <pthread/paths.h> + +/* + * Information about time zone files. + */ +#define TZDIR _PATH_TZDIR +#define TZDEFAULT _PATH_TZFILE +#define TZDEFRULES "posixrules" + +/* +** Each file begins with. . . +*/ + +struct tzhead { + char tzh_reserved[24]; /* reserved for future use */ + char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ + char tzh_leapcnt[4]; /* coded number of leap seconds */ + char tzh_timecnt[4]; /* coded number of transition times */ + char tzh_typecnt[4]; /* coded number of local time types */ + char tzh_charcnt[4]; /* coded number of abbr. chars */ +}; + +/* +** . . .followed by. . . +** +** tzh_timecnt (char [4])s coded transition times a la time(2) +** tzh_timecnt (unsigned char)s types of local time starting at above +** tzh_typecnt repetitions of +** one (char [4]) coded GMT offset in seconds +** one (unsigned char) used to set tm_isdst +** one (unsigned char) that's an abbreviation list index +** tzh_charcnt (char)s '\0'-terminated zone abbreviations +** tzh_leapcnt repetitions of +** one (char [4]) coded leap second transition times +** one (char [4]) total correction after above +** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition +** time is standard time, if FALSE, +** transition time is wall clock time +** if absent, transition times are +** assumed to be wall clock time +*/ + +/* +** In the current implementation, "tzset()" refuses to deal with files that +** exceed any of the limits below. +*/ + +/* +** The TZ_MAX_TIMES value below is enough to handle a bit more than a +** year's worth of solar time (corrected daily to the nearest second) or +** 138 years of Pacific Presidential Election time +** (where there are three time zone transitions every fourth year). +*/ +#define TZ_MAX_TIMES 370 + +#define NOSOLAR /* 4BSD doesn't currently handle solar time */ + +#ifndef NOSOLAR +#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ +#else +#define TZ_MAX_TYPES 10 /* Maximum number of local time types */ +#endif + +#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ + +#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ + +#define SECSPERMIN 60 +#define MINSPERHOUR 60 +#define HOURSPERDAY 24 +#define DAYSPERWEEK 7 +#define DAYSPERNYEAR 365 +#define DAYSPERLYEAR 366 +#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) +#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) +#define MONSPERYEAR 12 + +#define TM_SUNDAY 0 +#define TM_MONDAY 1 +#define TM_TUESDAY 2 +#define TM_WEDNESDAY 3 +#define TM_THURSDAY 4 +#define TM_FRIDAY 5 +#define TM_SATURDAY 6 + +#define TM_JANUARY 0 +#define TM_FEBRUARY 1 +#define TM_MARCH 2 +#define TM_APRIL 3 +#define TM_MAY 4 +#define TM_JUNE 5 +#define TM_JULY 6 +#define TM_AUGUST 7 +#define TM_SEPTEMBER 8 +#define TM_OCTOBER 9 +#define TM_NOVEMBER 10 +#define TM_DECEMBER 11 + +#define TM_YEAR_BASE 1900 + +#define EPOCH_YEAR 1970 +#define EPOCH_WDAY TM_THURSDAY + +/* +** Accurate only for the past couple of centuries; +** that will probably do. +*/ + +#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) + +#endif /* !_TZFILE_H_ */ + diff --git a/lib/libpthread/include/unistd.h b/lib/libpthread/include/unistd.h new file mode 100644 index 00000000000..213aa983172 --- /dev/null +++ b/lib/libpthread/include/unistd.h @@ -0,0 +1,183 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)unistd.h 5.13 (Berkeley) 6/17/91 + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#include <sys/cdefs.h> +#include <sys/__unistd.h> + +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_OK 0 + +#ifndef SEEK_SET +#define SEEK_SET 0 /* set file offset to offset */ +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* set file offset to current plus offset */ +#endif +#ifndef SEEK_END +#define SEEK_END 2 /* set file offset to EOF plus offset */ +#endif + +#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDOUT_FILENO 1 /* standard output file descriptor */ +#define STDERR_FILENO 2 /* standard error file descriptor */ + +__BEGIN_DECLS +void _exit __P_((int)); +int access __P_((const char *, int)); +int chdir __P_((const char *)); +int chown __P_((const char *, uid_t, gid_t)); +int close __P_((int)); +int dup __P_((int)); +int dup2 __P_((int, int)); +int execve __P_((const char *, char * const *, char * const *)); +pid_t fork __P_((void)); +int isatty __P_((int)); +int link __P_((const char *, const char *)); +off_t lseek __P_((int, off_t, int)); +int pipe __P_((int *)); +ssize_t read __P_((int, void *, size_t)); +unsigned sleep __P_((unsigned)); +char *ttyname __P_((int)); +int unlink __P_((const char *)); +ssize_t write __P_((int, const void *, size_t)); + +/* Not implemented for threads yet */ +unsigned alarm __P_((unsigned)); +char *cuserid __P_((char *)); +int execl __P_((const char *, const char *, ...)); +int execle __P_((const char *, const char *, ...)); +int execlp __P_((const char *, const char *, ...)); +int execv __P_((const char *, char * const *)); +int execvp __P_((const char *, char * const *)); +long fpathconf __P_((int, int)); /* not yet */ +char *getcwd __P_((char *, size_t)); +gid_t getegid __P_((void)); +uid_t geteuid __P_((void)); +gid_t getgid __P_((void)); +int getgroups __P_((int, gid_t *)); /* XXX (gid_t *) */ +char *getlogin __P_((void)); +pid_t getpgrp __P_((void)); +pid_t getpid __P_((void)); +pid_t getppid __P_((void)); +uid_t getuid __P_((void)); +long pathconf __P_((const char *, int)); /* not yet */ +int pause __P_((void)); +int rmdir __P_((const char *)); +int setgid __P_((gid_t)); +int setpgid __P_((pid_t, pid_t)); +pid_t setsid __P_((void)); +int setuid __P_((uid_t)); +long sysconf __P_((int)); /* not yet */ +pid_t tcgetpgrp __P_((int)); +int tcsetpgrp __P_((int, pid_t)); + +#ifndef _POSIX_SOURCE + +int acct __P_((const char *)); +int async_daemon __P_((void)); +char *brk __P_((const char *)); +/* int chflags __P_((const char *, long)); */ +int chroot __P_((const char *)); +char *crypt __P_((const char *, const char *)); +int des_cipher __P_((const char *, char *, long, int)); +void des_setkey __P_((const char *key)); +void encrypt __P_((char *, int)); +void endusershell __P_((void)); +int exect __P_((const char *, char * const *, char * const *)); +int fchdir __P_((int)); +/* int fchflags __P_((int, long)); */ +int fchown __P_((int, uid_t, gid_t)); +int fsync __P_((int)); +int ftruncate __P_((int, off_t)); +int getdtablesize __P_((void)); +long gethostid __P_((void)); +int gethostname __P_((char *, int)); +mode_t getmode __P_((const void *, mode_t)); +int getpagesize __P_((void)); +char *getpass __P_((const char *)); +char *getusershell __P_((void)); +char *getwd __P_((char *)); /* obsoleted by getcwd() */ +int initgroups __P_((const char *, gid_t)); +int mknod __P_((const char *, mode_t, dev_t)); +int mkstemp __P_((char *)); +char *mktemp __P_((char *)); +int nfssvc __P_((int)); +int nice __P_((int)); +void psignal __P_((unsigned, const char *)); +/* extern char *sys_siglist[]; */ +int profil __P_((char *, int, int, int)); +int rcmd __P_((char **, int, const char *, + const char *, const char *, int *)); +char *re_comp __P_((const char *)); +int re_exec __P_((const char *)); +int readlink __P_((const char *, char *, int)); +int reboot __P_((int)); +int revoke __P_((const char *)); +int rresvport __P_((int *)); +int ruserok __P_((const char *, int, const char *, const char *)); +char *sbrk __P_((int)); +int setegid __P_((gid_t)); +int seteuid __P_((uid_t)); +int setgroups __P_((int, const gid_t *)); +void sethostid __P_((long)); +int sethostname __P_((const char *, int)); +void setkey __P_((const char *)); +int setlogin __P_((const char *)); +void *setmode __P_((const char *)); +int setpgrp __P_((pid_t pid, pid_t pgrp)); /* obsoleted by setpgid() */ +int setregid __P_((int, int)); +int setreuid __P_((int, int)); +int setrgid __P_((gid_t)); +int setruid __P_((uid_t)); +void setusershell __P_((void)); +int swapon __P_((const char *)); +int symlink __P_((const char *, const char *)); +void sync __P_((void)); +int syscall __P_((int, ...)); +int truncate __P_((const char *, off_t)); +int ttyslot __P_((void)); +unsigned ualarm __P_((unsigned, unsigned)); +void usleep __P_((unsigned)); +int vfork __P_((void)); + +#endif /* !_POSIX_SOURCE */ +__END_DECLS + +#endif |