summaryrefslogtreecommitdiff
path: root/mit-pthreads/include
diff options
context:
space:
mode:
Diffstat (limited to 'mit-pthreads/include')
-rw-r--r--mit-pthreads/include/Makefile.inc30
-rwxr-xr-xmit-pthreads/include/arpa/inet.h61
-rwxr-xr-xmit-pthreads/include/arpa/nameser.h279
-rw-r--r--mit-pthreads/include/dirent.h97
-rw-r--r--mit-pthreads/include/endian.h95
-rw-r--r--mit-pthreads/include/errno.h52
-rw-r--r--mit-pthreads/include/math.h85
-rw-r--r--mit-pthreads/include/netdb.h146
-rw-r--r--mit-pthreads/include/pthread.h371
-rw-r--r--mit-pthreads/include/pthread/ac-types.h11
-rwxr-xr-xmit-pthreads/include/pthread/cleanup.h59
-rwxr-xr-xmit-pthreads/include/pthread/cond.h102
-rw-r--r--mit-pthreads/include/pthread/config.h5
-rwxr-xr-xmit-pthreads/include/pthread/debug_out.h44
-rwxr-xr-xmit-pthreads/include/pthread/fd.h122
-rwxr-xr-xmit-pthreads/include/pthread/fd_pipe.h54
-rwxr-xr-xmit-pthreads/include/pthread/kernel.h71
-rwxr-xr-xmit-pthreads/include/pthread/kthread.h67
-rwxr-xr-xmit-pthreads/include/pthread/mutex.h102
-rw-r--r--mit-pthreads/include/pthread/paths.h12
-rwxr-xr-xmit-pthreads/include/pthread/prio_queue.h78
-rwxr-xr-xmit-pthreads/include/pthread/pthread_attr.h122
-rwxr-xr-xmit-pthreads/include/pthread/pthread_once.h58
-rwxr-xr-xmit-pthreads/include/pthread/queue.h67
-rwxr-xr-xmit-pthreads/include/pthread/sleep.h63
-rwxr-xr-xmit-pthreads/include/pthread/specific.h66
-rwxr-xr-xmit-pthreads/include/pthread/state.def64
-rwxr-xr-xmit-pthreads/include/pthread/types.h46
-rwxr-xr-xmit-pthreads/include/pthread/unistd.h159
-rwxr-xr-xmit-pthreads/include/pthread/util.h89
-rwxr-xr-xmit-pthreads/include/pthread/version.h43
-rwxr-xr-xmit-pthreads/include/pthread/xtypes.h13
-rw-r--r--mit-pthreads/include/pwd.h93
-rw-r--r--mit-pthreads/include/resolv.h179
-rw-r--r--mit-pthreads/include/sched.h57
-rw-r--r--mit-pthreads/include/signal.h81
-rw-r--r--mit-pthreads/include/stdio.h371
-rw-r--r--mit-pthreads/include/stdlib.h127
-rw-r--r--mit-pthreads/include/string.h85
-rw-r--r--mit-pthreads/include/syslog.h101
-rw-r--r--mit-pthreads/include/time.h102
-rw-r--r--mit-pthreads/include/timers.h45
-rw-r--r--mit-pthreads/include/tzfile.h154
-rw-r--r--mit-pthreads/include/unistd.h183
44 files changed, 4311 insertions, 0 deletions
diff --git a/mit-pthreads/include/Makefile.inc b/mit-pthreads/include/Makefile.inc
new file mode 100644
index 00000000000..b7fe59d5f0d
--- /dev/null
+++ b/mit-pthreads/include/Makefile.inc
@@ -0,0 +1,30 @@
+# from: @(#)Makefile 5.45.1.1 (Berkeley) 5/6/91
+
+# Doing a make install builds /usr/include/pthread
+#
+# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
+# links.
+
+
+FILES= cond.h copyright.h fd.h fd_pipe.h kernel.h mutex.h posix.h \
+ pthread.h pthread_attr.h queue.h util.h
+
+# Machine dependent header file
+MFILE= ${.CURDIR}/arch/${MACHINE}/machdep.h
+
+realinstall:
+ if [ ! -d ${DESTDIR}/usr/include/pthread ]; then \
+ mkdir ${DESTDIR}/usr/include/pthread; \
+ fi
+ @echo installing ${FILES}
+ @-for i in ${FILES}; do \
+ cmp -s $$i ${DESTDIR}/usr/include/pthread/$$i || \
+ install -c -m 644 $$i ${DESTDIR}/usr/include/$$i; \
+ done
+ cmp -s ${MFILE} ${DESTDIR}/usr/include/pthread/machdep.h || \
+ install -c -m 644 ${MFILE} ${DESTDIR}/usr/include/pthread/machdep.h
+ rm -rf ${DESTDIR}/usr/include/pthread.h
+ ln -s /usr/include/pthread/pthread.h ${DESTDIR}/usr/include/pthread.h
+ @chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include/pthread
+ @chmod -R a-w ${DESTDIR}/usr/include/pthread
+
diff --git a/mit-pthreads/include/arpa/inet.h b/mit-pthreads/include/arpa/inet.h
new file mode 100755
index 00000000000..d6ad76f4eb5
--- /dev/null
+++ b/mit-pthreads/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$
+ */
+
+#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/mit-pthreads/include/arpa/nameser.h b/mit-pthreads/include/arpa/nameser.h
new file mode 100755
index 00000000000..350d67538bd
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/dirent.h b/mit-pthreads/include/dirent.h
new file mode 100644
index 00000000000..c3e86cb9da1
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/endian.h b/mit-pthreads/include/endian.h
new file mode 100644
index 00000000000..8fb947dbd33
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/errno.h b/mit-pthreads/include/errno.h
new file mode 100644
index 00000000000..24b005e9369
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/math.h b/mit-pthreads/include/math.h
new file mode 100644
index 00000000000..d5963ce6023
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/netdb.h b/mit-pthreads/include/netdb.h
new file mode 100644
index 00000000000..54d85e5a3ed
--- /dev/null
+++ b/mit-pthreads/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$
+ */
+
+#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/mit-pthreads/include/pthread.h b/mit-pthreads/include/pthread.h
new file mode 100644
index 00000000000..e8a44050215
--- /dev/null
+++ b/mit-pthreads/include/pthread.h
@@ -0,0 +1,371 @@
+/* ==== pthread.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$
+ *
+ * Description : Basic pthread header.
+ *
+ * 1.00 93/07/20 proven
+ * -Started coding this file.
+ *
+ * 93/9/28 streepy - Added support for pthread cancel
+ *
+ */
+
+#ifndef _PTHREAD_H_
+#define _PTHREAD_H_
+
+#include <pthread/types.h>
+
+#include <pthread/version.h>
+#include <pthread/machdep.h>
+#include <pthread/cleanup.h>
+#include <pthread/kernel.h>
+#include <pthread/prio_queue.h>
+#include <pthread/queue.h>
+#include <pthread/sleep.h>
+#include <pthread/mutex.h>
+#include <pthread/cond.h>
+#include <pthread/fd.h>
+#include <pthread/debug_out.h>
+
+/* Requires mutex.h */
+#include <pthread/specific.h>
+
+#include <pthread/util.h>
+
+/* More includes */
+#include <pthread/pthread_once.h>
+
+/* More includes, that need size_t */
+#include <pthread/pthread_attr.h>
+
+#include <signal.h> /* for sigset_t */ /* Moved by monty */
+
+/* Constants for use with pthread_setcancelstate and pthread_setcanceltype */
+#define PTHREAD_CANCEL_DISABLE 0
+#define PTHREAD_CANCEL_ENABLE 1
+#define PTHREAD_CANCEL_DEFERRED 0
+#define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+#define PTHREAD_CANCELLED (void *)1 /* Exit status of a cancelled thread */
+
+
+#ifdef PTHREAD_KERNEL
+
+enum pthread_state {
+#define __pthread_defstate(S,NAME) S,
+#include "pthread/state.def"
+#undef __pthread_defstate
+
+ /* enum lists aren't supposed to end with a comma, sigh */
+ PS_STATE_MAX
+};
+
+/* Put PANIC inside an expression that evaluates to non-void type, to
+ make it easier to combine it in expressions. */
+#define DO_PANIC() (PANIC (), 0)
+#define PANICIF(x) ((x) ? DO_PANIC () : 0)
+
+/* In the thread flag field, we use a series of bit flags. Flags can
+ * organized into "groups" of mutually exclusive flags. Other flags
+ * are unrelated and can be set and cleared with a single bit operation.
+ */
+
+#define PF_WAIT_EVENT 0x01
+#define PF_DONE_EVENT 0x02
+#define PF_EVENT_GROUP 0x03 /* All event bits */
+
+#define PF_CANCEL_STATE 0x04 /* cancellability state */
+#define PF_CANCEL_TYPE 0x08 /* cancellability type */
+#define PF_THREAD_CANCELLED 0x10 /* thread has been cancelled */
+#define PF_RUNNING_TO_CANCEL 0x20 /* Thread is running so it can cancel*/
+#define PF_AT_CANCEL_POINT 0x40 /* Thread is at a cancel point */
+
+/* Flag operations */
+
+#define SET_PF_FLAG(x,f) ( (x)->flags |= (f) )
+#define TEST_PF_FLAG(x,f) ( (x)->flags & (f) )
+#define CLEAR_PF_FLAG(x,f) ( (x)->flags &= ~(f) )
+#define CLEAR_PF_GROUP(x,g) ( (x)->flags &= ~(g) )
+#define SET_PF_FLAG_IN_GROUP(x,g,f) ( CLEAR_PF_GROUP(x,g),SET_PF_FLAG(x,f))
+#define TEST_PF_GROUP(x,g) ( (x)->flags & (g) )
+
+#define SET_PF_DONE_EVENT(x) \
+( !TEST_PF_FLAG(x,PF_DONE_EVENT) \
+ ? ( TEST_PF_FLAG(x,PF_WAIT_EVENT) \
+ ? (SET_PF_FLAG_IN_GROUP(x,PF_EVENT_GROUP,PF_DONE_EVENT), OK) \
+ : DO_PANIC ()) \
+ : NOTOK )
+
+#define SET_PF_WAIT_EVENT(x) \
+( PANICIF (TEST_PF_GROUP(x,PF_EVENT_GROUP) ), \
+ SET_PF_FLAG_IN_GROUP(x,PF_EVENT_GROUP,PF_WAIT_EVENT), 0)
+
+#define CLEAR_PF_DONE_EVENT(x) \
+( PANICIF (!TEST_PF_FLAG(x,PF_DONE_EVENT)), \
+ CLEAR_PF_GROUP(x,PF_EVENT_GROUP) )
+
+#define SET_PF_CANCELLED(x) ( SET_PF_FLAG(x,PF_THREAD_CANCELLED) )
+#define TEST_PF_CANCELLED(x) ( TEST_PF_FLAG(x,PF_THREAD_CANCELLED) )
+
+#define SET_PF_RUNNING_TO_CANCEL(x) ( SET_PF_FLAG(x,PF_RUNNING_TO_CANCEL) )
+#define CLEAR_PF_RUNNING_TO_CANCEL(x)( CLEAR_PF_FLAG(x,PF_RUNNING_TO_CANCEL) )
+#define TEST_PF_RUNNING_TO_CANCEL(x)( TEST_PF_FLAG(x,PF_RUNNING_TO_CANCEL) )
+
+#define SET_PF_AT_CANCEL_POINT(x) ( SET_PF_FLAG(x,PF_AT_CANCEL_POINT) )
+#define CLEAR_PF_AT_CANCEL_POINT(x) ( CLEAR_PF_FLAG(x,PF_AT_CANCEL_POINT) )
+#define TEST_PF_AT_CANCEL_POINT(x) ( TEST_PF_FLAG(x,PF_AT_CANCEL_POINT) )
+
+#define SET_PF_CANCEL_STATE(x,f) \
+ ( (f) ? SET_PF_FLAG(x,PF_CANCEL_STATE) : CLEAR_PF_FLAG(x,PF_CANCEL_STATE) )
+#define TEST_PF_CANCEL_STATE(x) \
+ ( (TEST_PF_FLAG(x,PF_CANCEL_STATE)) ? PTHREAD_CANCEL_ENABLE \
+ : PTHREAD_CANCEL_DISABLE )
+
+#define SET_PF_CANCEL_TYPE(x,f) \
+ ( (f) ? SET_PF_FLAG(x,PF_CANCEL_TYPE) : CLEAR_PF_FLAG(x,PF_CANCEL_TYPE) )
+#define TEST_PF_CANCEL_TYPE(x) \
+ ( (TEST_PF_FLAG(x,PF_CANCEL_TYPE)) ? PTHREAD_CANCEL_ASYNCHRONOUS \
+ : PTHREAD_CANCEL_DEFERRED )
+
+/* See if a thread is in a state that it can be cancelled */
+#define TEST_PTHREAD_IS_CANCELLABLE(x) \
+( (TEST_PF_CANCEL_STATE(x) == PTHREAD_CANCEL_ENABLE && TEST_PF_CANCELLED(x)) \
+ ? ((TEST_PF_CANCEL_TYPE(x) == PTHREAD_CANCEL_ASYNCHRONOUS) \
+ ? 1 \
+ : TEST_PF_AT_CANCEL_POINT(x)) \
+ : 0 )
+
+
+struct pthread_select_data {
+ int nfds;
+ fd_set readfds;
+ fd_set writefds;
+ fd_set exceptfds;
+};
+
+union pthread_wait_data {
+ pthread_mutex_t * mutex;
+ pthread_cond_t * cond;
+ const sigset_t * sigwait; /* Waiting on a signal in sigwait */
+ struct {
+ short fd; /* Used when thread waiting on fd */
+ short branch; /* line number, for debugging */
+ } fd;
+ struct pthread_select_data * select_data;
+};
+
+#define PTT_USER_THREAD 0x0001
+
+struct pthread {
+ int thread_type;
+ struct machdep_pthread machdep_data;
+ pthread_attr_t attr;
+
+ /* Signal interface */
+ sigset_t sigmask;
+ sigset_t sigpending;
+ int sigcount; /* Number of signals pending */
+ int sighandled; /* Set when signal has been handled */
+ /* Timeout time */
+ struct timespec wakeup_time;
+
+ /* Join queue for waiting threads */
+ struct pthread_queue join_queue;
+
+ /*
+ * Thread implementations are just multiple queue type implemenations,
+ * Below are the various link lists currently necessary
+ * It is possible for a thread to be on multiple, or even all the
+ * queues at once, much care must be taken during queue manipulation.
+ *
+ * The pthread structure must be locked before you can even look at
+ * the link lists.
+ */
+
+ /*
+ * ALL threads, in any state.
+ * Must lock kernel lock before manipulating.
+ */
+ struct pthread * pll;
+
+ /*
+ * Standard link list for running threads, mutexes, etc ...
+ * It can't be on both a running link list and a wait queue.
+ * Must lock kernel lock before manipulating.
+ */
+ struct pthread * next;
+ union pthread_wait_data data;
+
+ /*
+ * Actual queue state and priority of thread.
+ * (Note: "priority" is a reserved word in Concurrent C, please
+ * don't use it. --KR)
+ */
+ struct pthread_queue * queue;
+ enum pthread_state state;
+ enum pthread_state old_state; /* Used when cancelled */
+ char flags;
+ char pthread_priority;
+
+ /*
+ * Sleep queue, this is different from the standard link list
+ * because it is possible to be on both (pthread_cond_timedwait();
+ * Must lock sleep mutex before manipulating
+ */
+ struct pthread *sll; /* For sleeping threads */
+
+ /*
+ * Data that doesn't need to be locked
+ * Mostly because only the thread owning the data can manipulate it
+ */
+ void * ret;
+ int error;
+ int * error_p;
+ const void ** specific_data;
+ int specific_data_count;
+
+ /* Cleanup handlers Link List */
+ struct pthread_cleanup *cleanup;
+};
+
+#else /* not PTHREAD_KERNEL */
+
+struct pthread;
+
+#endif
+
+typedef struct pthread *pthread_t;
+
+/*
+ * Globals
+ */
+#ifdef PTHREAD_KERNEL
+
+extern struct pthread * pthread_run;
+extern struct pthread * pthread_initial;
+extern struct pthread * pthread_link_list;
+extern struct pthread_queue pthread_dead_queue;
+extern struct pthread_queue pthread_alloc_queue;
+
+extern pthread_attr_t pthread_attr_default;
+extern volatile int fork_lock;
+extern pthread_size_t pthread_pagesize;
+
+extern sigset_t * uthread_sigmask;
+
+/* Kernel global functions */
+extern void pthread_sched_prevent(void);
+extern void pthread_sched_resume(void);
+extern int __pthread_is_valid( pthread_t );
+extern void pthread_cancel_internal( int freelocks );
+
+#endif
+
+/*
+ * New functions
+ */
+
+__BEGIN_DECLS
+
+#if defined(DCE_COMPAT)
+
+typedef void * (*pthread_startroutine_t)(void *);
+typedef void * pthread_addr_t;
+
+int pthread_create __P_((pthread_t *, pthread_attr_t,
+ pthread_startroutine_t,
+ pthread_addr_t));
+void pthread_exit __P_((pthread_addr_t));
+int pthread_join __P_((pthread_t, pthread_addr_t *));
+
+#else
+
+void pthread_init __P_((void));
+int pthread_create __P_((pthread_t *,
+ const pthread_attr_t *,
+ void * (*start_routine)(void *),
+ void *));
+void pthread_exit __P_((void *));
+pthread_t pthread_self __P_((void));
+int pthread_equal __P_((pthread_t, pthread_t));
+int pthread_join __P_((pthread_t, void **));
+int pthread_detach __P_((pthread_t));
+void pthread_yield __P_((void));
+int pthread_setschedparam __P_((pthread_t pthread, int policy,
+ struct sched_param * param));
+int pthread_getschedparam __P_((pthread_t pthread, int * policy,
+ struct sched_param * param));
+int pthread_kill __P_((struct pthread *, int));
+void (*pthread_signal __P_((int, void (*)(int))))();
+int pthread_cancel __P_(( pthread_t pthread ));
+int pthread_setcancelstate __P_(( int state, int *oldstate ));
+int pthread_setcanceltype __P_(( int type, int *oldtype ));
+void pthread_testcancel __P_(( void ));
+
+int pthread_sigmask __P_((int how, const sigset_t *set,
+ sigset_t * oset)); /* added by Monty */
+int sigwait __P_((const sigset_t * set, int * sig));
+int sigsetwait __P_((const sigset_t * set, int * sig));
+#endif
+
+#if defined(PTHREAD_KERNEL)
+
+/* Not valid, but I can't spell so this will be caught at compile time */
+#define pthread_yeild(notvalid)
+
+#endif
+
+__END_DECLS
+
+/*
+ * Static constructors
+ */
+#ifdef __cplusplus
+
+extern struct pthread * pthread_initial;
+
+class __pthread_init_t {
+/* struct __pthread_init_t { */
+ public:
+ __pthread_init_t() {
+ if (pthread_initial == NULL) {
+ pthread_init();
+ }
+ }
+};
+
+static __pthread_init_t __pthread_init_this_file;
+
+#endif /* __cplusplus */
+
+#endif
diff --git a/mit-pthreads/include/pthread/ac-types.h b/mit-pthreads/include/pthread/ac-types.h
new file mode 100644
index 00000000000..c9dc938f6e8
--- /dev/null
+++ b/mit-pthreads/include/pthread/ac-types.h
@@ -0,0 +1,11 @@
+#ifndef pthread_size_t
+#define pthread_ipaddr_type unsigned int
+#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 long
+#define pthread_off_t long long
+#define pthread_va_list void *
+#endif
diff --git a/mit-pthreads/include/pthread/cleanup.h b/mit-pthreads/include/pthread/cleanup.h
new file mode 100755
index 00000000000..cd995ceddcf
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/cond.h b/mit-pthreads/include/pthread/cond.h
new file mode 100755
index 00000000000..ec9f7cf0016
--- /dev/null
+++ b/mit-pthreads/include/pthread/cond.h
@@ -0,0 +1,102 @@
+/* ==== 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$
+ *
+ * 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
+
+struct timespec;
+
+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/mit-pthreads/include/pthread/config.h b/mit-pthreads/include/pthread/config.h
new file mode 100644
index 00000000000..251948c3874
--- /dev/null
+++ b/mit-pthreads/include/pthread/config.h
@@ -0,0 +1,5 @@
+#ifndef _SYS___CONFIG_H_
+#define _SYS___CONFIG_H_
+#define _OS_HAS_TIMESPEC 1
+#define _OS_HAS_SOCKLEN_T 1
+#endif
diff --git a/mit-pthreads/include/pthread/debug_out.h b/mit-pthreads/include/pthread/debug_out.h
new file mode 100755
index 00000000000..6968c5ea90e
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/pthread/fd.h b/mit-pthreads/include/pthread/fd.h
new file mode 100755
index 00000000000..d27a5066936
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/fd_pipe.h b/mit-pthreads/include/pthread/fd_pipe.h
new file mode 100755
index 00000000000..cc5670dbb7d
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/kernel.h b/mit-pthreads/include/pthread/kernel.h
new file mode 100755
index 00000000000..c474d789681
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/kthread.h b/mit-pthreads/include/pthread/kthread.h
new file mode 100755
index 00000000000..a2e73361d8c
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/mutex.h b/mit-pthreads/include/pthread/mutex.h
new file mode 100755
index 00000000000..e6f1fe58c0f
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/paths.h b/mit-pthreads/include/pthread/paths.h
new file mode 100644
index 00000000000..8af9233a67c
--- /dev/null
+++ b/mit-pthreads/include/pthread/paths.h
@@ -0,0 +1,12 @@
+#ifndef _SYS___PATHS_H_
+#define _SYS___PATHS_H_
+#define _PATH_PTY "/dev/"
+#define _PATH_TZDIR "/usr/share/zoneinfo"
+#define _PATH_TZFILE "/etc/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/mit-pthreads/include/pthread/prio_queue.h b/mit-pthreads/include/pthread/prio_queue.h
new file mode 100755
index 00000000000..e29a0170548
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/pthread_attr.h b/mit-pthreads/include/pthread/pthread_attr.h
new file mode 100755
index 00000000000..8cad262bad2
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/pthread_once.h b/mit-pthreads/include/pthread/pthread_once.h
new file mode 100755
index 00000000000..ac53d5f9b2c
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/queue.h b/mit-pthreads/include/pthread/queue.h
new file mode 100755
index 00000000000..eca7699e95a
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/sleep.h b/mit-pthreads/include/pthread/sleep.h
new file mode 100755
index 00000000000..8bf471a24aa
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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(&current_real_time, NULL);
+ TIMEVAL_TO_TIMESPEC((&current_real_time), current_time);
+ return(ret);
+}
+
+__BEGIN_DECLS
+
+void sleep_schedule __P_((struct timespec *, struct timespec *));
+
+__END_DECLS
+
+#endif
diff --git a/mit-pthreads/include/pthread/specific.h b/mit-pthreads/include/pthread/specific.h
new file mode 100755
index 00000000000..9c66a695556
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/state.def b/mit-pthreads/include/pthread/state.def
new file mode 100755
index 00000000000..c62d102a9f0
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/pthread/types.h b/mit-pthreads/include/pthread/types.h
new file mode 100755
index 00000000000..7fdf001a0bc
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/pthread/unistd.h b/mit-pthreads/include/pthread/unistd.h
new file mode 100755
index 00000000000..3cb07533114
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/pthread/util.h b/mit-pthreads/include/pthread/util.h
new file mode 100755
index 00000000000..aaa33a6318d
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/version.h b/mit-pthreads/include/pthread/version.h
new file mode 100755
index 00000000000..fda3af284d0
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/pthread/xtypes.h b/mit-pthreads/include/pthread/xtypes.h
new file mode 100755
index 00000000000..4dcc4f04f8c
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/pwd.h b/mit-pthreads/include/pwd.h
new file mode 100644
index 00000000000..af945a2b8db
--- /dev/null
+++ b/mit-pthreads/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$
+ */
+
+#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/mit-pthreads/include/resolv.h b/mit-pthreads/include/resolv.h
new file mode 100644
index 00000000000..f6313a7229e
--- /dev/null
+++ b/mit-pthreads/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$
+ */
+
+#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/mit-pthreads/include/sched.h b/mit-pthreads/include/sched.h
new file mode 100644
index 00000000000..dcd9d4e3600
--- /dev/null
+++ b/mit-pthreads/include/sched.h
@@ -0,0 +1,57 @@
+/* ==== pthread.h ============================================================
+ * Copyright (c) 1995 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$
+ *
+ * Description : Basic pthread header.
+ *
+ * 1.00 93/08/29 proven
+ * -Started coding this file.
+ */
+
+#ifndef _SCHED_H_
+#define _SCHED_H_
+
+#include <pthread/prio_queue.h>
+
+/*
+ * New functions
+ */
+
+__BEGIN_DECLS
+
+int sched_yield __P_((void));
+int sched_get_priority_max __P_((int));
+int sched_get_priority_min __P_((int));
+
+__END_DECLS
+
+#endif
diff --git a/mit-pthreads/include/signal.h b/mit-pthreads/include/signal.h
new file mode 100644
index 00000000000..9fb1ec6e2c8
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/stdio.h b/mit-pthreads/include/stdio.h
new file mode 100644
index 00000000000..538d4685f3f
--- /dev/null
+++ b/mit-pthreads/include/stdio.h
@@ -0,0 +1,371 @@
+/* ==== stdio.h ============================================================
+ * Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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: @(#)stdio.h 5.17 (Berkeley) 6/3/91
+ * $Id$
+ */
+
+#ifndef _STDIO_H_
+#define _STDIO_H_
+
+#include <sys/cdefs.h>
+#include <pthread/types.h>
+#include <pthread/posix.h>
+#include <sys/__stdio.h>
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#define _FSTDIO /* Define for new stdio with functions. */
+
+/*
+ * NB: to fit things in six character monocase externals, the stdio
+ * code uses the prefix `__s' for stdio objects, typically followed
+ * by a three-character attempt at a mnemonic.
+ */
+
+/* stdio buffers */
+struct __sbuf {
+ unsigned char *_base;
+ int _size;
+};
+
+/*
+ * stdio state variables.
+ *
+ * The following always hold:
+ *
+ * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
+ * _lbfsize is -_bf._size, else _lbfsize is 0
+ * if _flags&__SRD, _w is 0
+ * if _flags&__SWR, _r is 0
+ *
+ * This ensures that the getc and putc macros (or inline functions) never
+ * try to write or read from a file that is in `read' or `write' mode.
+ * (Moreover, they can, and do, automatically switch from read mode to
+ * write mode, and back, on "r+" and "w+" files.)
+ *
+ * _lbfsize is used only to make the inline line-buffered output stream
+ * code as compact as possible.
+ *
+ * _ub, _up, and _ur are used when ungetc() pushes back more characters
+ * than fit in the current _bf, or when ungetc() pushes back a character
+ * that does not match the previous one in _bf. When this happens,
+ * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
+ * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
+ */
+typedef struct __sFILE {
+ unsigned char *_p; /* current position in (some) buffer */
+ int _r; /* read space left for getc() */
+ int _w; /* write space left for putc() */
+ short _flags; /* flags, below; this FILE is free if 0 */
+ short _file; /* fileno, if Unix descriptor, else -1 */
+ struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
+ int _lbfsize; /* 0 or -_bf._size, for inline putc */
+
+ /* separate buffer for long sequences of ungetc() */
+ struct __sbuf _ub; /* ungetc buffer */
+ unsigned char *_up; /* saved _p when _p is doing ungetc data */
+ int _ur; /* saved _r when _r is counting ungetc data */
+
+ /* tricks to meet minimum requirements even when malloc() fails */
+ unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
+ unsigned char _nbuf[1]; /* guarantee a getc() buffer */
+
+ /* separate buffer for fgetline() when line crosses buffer boundary */
+ struct __sbuf _lb; /* buffer for fgetline() */
+
+ /* Unix stdio files get aligned to block boundaries on fseek() */
+ int _blksize; /* stat.st_blksize (may be != _bf._size) */
+ int _offset; /* current lseek offset */
+} FILE;
+
+__BEGIN_DECLS
+extern FILE __sF[];
+__END_DECLS
+
+#define __SLBF 0x0001 /* line buffered */
+#define __SNBF 0x0002 /* unbuffered */
+#define __SRD 0x0004 /* OK to read */
+#define __SWR 0x0008 /* OK to write */
+ /* RD and WR are never simultaneously asserted */
+#define __SRW 0x0010 /* open for reading & writing */
+#define __SEOF 0x0020 /* found EOF */
+#define __SERR 0x0040 /* found error */
+#define __SMBF 0x0080 /* _buf is from malloc */
+#define __SAPP 0x0100 /* fdopen()ed in append mode */
+#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
+#define __SOPT 0x0400 /* do fseek() optimisation */
+#define __SNPT 0x0800 /* do not do fseek() optimisation */
+#define __SOFF 0x1000 /* set iff _offset is in fact correct */
+#define __SMOD 0x2000 /* true => fgetline modified _p text */
+
+/*
+ * The following three definitions are for ANSI C, which took them
+ * from System V, which brilliantly took internal interface macros and
+ * made them official arguments to setvbuf(), without renaming them.
+ * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
+ *
+ * Although numbered as their counterparts above, the implementation
+ * does not rely on this.
+ */
+#define _IOFBF 0 /* setvbuf should set fully buffered */
+#define _IOLBF 1 /* setvbuf should set line buffered */
+#define _IONBF 2 /* setvbuf should set unbuffered */
+
+#define BUFSIZ 1024 /* size of buffer used by setbuf */
+#define EOF (-1)
+
+/*
+ * FOPEN_MAX is a minimum maximum, and should be the number of descriptors
+ * that the kernel can provide without allocation of a resource that can
+ * fail without the process sleeping. Do not use this for anything.
+ */
+#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */
+#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */
+
+/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
+#ifndef _ANSI_SOURCE
+#define P_tmpdir "/var/tmp/"
+#endif
+#define L_tmpnam 1024 /* XXX must be == PATH_MAX */
+#ifndef TMP_MAX
+#define TMP_MAX 308915776
+#endif
+
+#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 (&__sF[0])
+#define stdout (&__sF[1])
+#define stderr (&__sF[2])
+
+/*
+ * Functions defined in ANSI C standard.
+ */
+__BEGIN_DECLS
+void clearerr __P_((FILE *));
+int fclose __P_((FILE *));
+int feof __P_((FILE *));
+int ferror __P_((FILE *));
+int fflush __P_((FILE *));
+int fgetc __P_((FILE *));
+int fgetpos __P_((FILE *, fpos_t *));
+char * fgets __P_((char *, size_t, FILE *));
+FILE * fopen __P_((const char *, const char *));
+int fprintf __P_((FILE *, const char *, ...));
+int fputc __P_((int, FILE *));
+int fputs __P_((const char *, FILE *));
+size_t fread __P_((void *, size_t, size_t, FILE *));
+FILE * freopen __P_((const char *, const char *, FILE *));
+int fscanf __P_((FILE *, const char *, ...));
+int fseek __P_((FILE *, long, int));
+int fsetpos __P_((FILE *, const fpos_t *));
+long ftell __P_((const FILE *));
+size_t fwrite __P_((const void *, size_t, size_t, FILE *));
+int getc __P_((FILE *));
+int getchar __P_((void));
+char * gets __P_((char *));
+
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+extern int sys_nerr; /* perror(3) external variables */
+/* Under NetBSD and BSD 4.4, at least, this is expected to be a const
+ array of pointers to const. If you take `const' back out of this
+ declaration, please make it conditional on __NetBSD__ and bsd4_4. */
+#ifdef HAVE_SYS_ERRLIST_WITHOUT_CONST
+extern char *sys_errlist[];
+#else
+extern const char *const sys_errlist[];
+#endif
+#endif
+
+void perror __P_((const char *));
+int printf __P_((const char *, ...));
+int putc __P_((int, FILE *));
+int putchar __P_((int));
+int puts __P_((const char *));
+int remove __P_((const char *));
+int rename __P_((const char *, const char *));
+void rewind __P_((FILE *));
+int scanf __P_((const char *, ...));
+void setbuf __P_((FILE *, char *));
+int setvbuf __P_((FILE *, char *, int, size_t));
+int sprintf __P_((char *, const char *, ...));
+int sscanf __P_((const char *, const char *, ...));
+FILE * tmpfile __P_((void));
+char * tmpnam __P_((char *));
+int ungetc __P_((int, FILE *));
+int vfprintf __P_((FILE *, const char *, pthread_va_list));
+int vprintf __P_((const char *, pthread_va_list));
+int vsprintf __P_((char *, const char *, pthread_va_list));
+char *mprintf __P_((const char *, ...));
+char *vmprintf __P_((const char *, pthread_va_list));
+__END_DECLS
+
+/*
+ * Functions defined in POSIX 1003.1.
+ */
+#ifndef _ANSI_SOURCE
+#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */
+#define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */
+
+__BEGIN_DECLS
+char * ctermid __P_((char *));
+char * cuserid __P_((char *));
+FILE * fdopen __P_((int, const char *));
+int fileno __P_((FILE *));
+__END_DECLS
+#endif /* not ANSI */
+
+/*
+ * Functions defined in POSIX 1003.4a. (1c)
+ */
+#ifndef _ANSI_SOURCE
+__BEGIN_DECLS
+void flockfile __P_((FILE *));
+void funlockfile __P_((FILE *));
+int ftrylockfile __P_((FILE *));
+__END_DECLS
+#endif /* not ANSI */
+
+/*
+ * Routines that are purely local.
+ */
+#if !defined (_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+__BEGIN_DECLS
+char *fgetline __P_((FILE *, size_t *));
+int fpurge __P_((FILE *));
+int getw __P_((FILE *));
+int pclose __P_((FILE *));
+FILE *popen __P_((const char *, const char *));
+int putw __P_((int, FILE *));
+void setbuffer __P_((FILE *, char *, int));
+int setlinebuf __P_((FILE *));
+char *tempnam __P_((const char *, const char *));
+int snprintf __P_((char *, size_t, const char *, ...));
+int vsnprintf __P_((char *, size_t, const char *, pthread_va_list));
+int vscanf __P_((const char *, pthread_va_list));
+int vsscanf __P_((const char *, const char *, pthread_va_list));
+__END_DECLS
+
+/*
+ * This is a #define because the function is used internally and
+ * (unlike vfscanf) the name __svfscanf is guaranteed not to collide
+ * with a user function when _ANSI_SOURCE or _POSIX_SOURCE is defined.
+ */
+#define vfscanf __svfscanf
+
+/*
+ * Stdio function-access interface.
+ */
+__BEGIN_DECLS
+FILE *funopen __P_((const void *,
+ int (*)(void *, char *, int),
+ int (*)(void *, const char *, int),
+ fpos_t (*)(void *, fpos_t, int),
+ int (*)(void *)));
+__END_DECLS
+#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
+#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
+#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
+
+/*
+ * Functions internal to the implementation.
+ */
+__BEGIN_DECLS
+int __srget __P_((FILE *));
+int __svfscanf __P_((FILE *, const char *, pthread_va_list));
+int __swbuf __P_((int, FILE *));
+__END_DECLS
+
+/*
+ * The __sfoo macros are here so that we can
+ * define function versions in the C library.
+ */
+#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
+
+__BEGIN_DECLS
+int __getc __P_((FILE *));
+__END_DECLS
+
+#define getc(fp) __getc(fp)
+#define getchar() getc(stdin)
+#define getc_unlocked(fp) __sgetc(fp)
+#define getchar_unlocked() getc_unlocked(stdin)
+
+#ifdef __CAN_DO_EXTERN_INLINE
+__INLINE int __sputc(int _c, FILE *_p)
+{
+ if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
+ return (*_p->_p++ = _c);
+ else
+ return (__swbuf(_c, _p));
+}
+#else
+__BEGIN_DECLS
+int __sputc __P_((int, FILE *));
+__END_DECLS
+#endif
+
+__BEGIN_DECLS
+int __putc __P_((int, FILE *));
+__END_DECLS
+
+#define putc(x, fp) __putc(x, fp)
+#define putchar(x) putc(x, stdout)
+#define putc_unlocked(x, fp) __sputc(x, fp)
+#define putchar_unlocked(x) putc_unlocked(x, stdout)
+
+#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
+#define __sferror(p) (((p)->_flags & __SERR) != 0)
+#define __sfileno(p) ((p)->_file)
+
+#define feof(p) __sfeof(p)
+#define ferror(p) __sferror(p)
+
+#ifndef _ANSI_SOURCE
+#define fileno(p) __sfileno(p)
+#endif
+
+#endif
diff --git a/mit-pthreads/include/stdlib.h b/mit-pthreads/include/stdlib.h
new file mode 100644
index 00000000000..77f84ffa0bb
--- /dev/null
+++ b/mit-pthreads/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$
+ */
+
+#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/mit-pthreads/include/string.h b/mit-pthreads/include/string.h
new file mode 100644
index 00000000000..4143a1cfec7
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/syslog.h b/mit-pthreads/include/syslog.h
new file mode 100644
index 00000000000..31b42285fc1
--- /dev/null
+++ b/mit-pthreads/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/mit-pthreads/include/time.h b/mit-pthreads/include/time.h
new file mode 100644
index 00000000000..614bbeb2a59
--- /dev/null
+++ b/mit-pthreads/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$
+ */
+
+#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/mit-pthreads/include/timers.h b/mit-pthreads/include/timers.h
new file mode 100644
index 00000000000..9a0196a3631
--- /dev/null
+++ b/mit-pthreads/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$
+ *
+ * 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/mit-pthreads/include/tzfile.h b/mit-pthreads/include/tzfile.h
new file mode 100644
index 00000000000..7a486302e10
--- /dev/null
+++ b/mit-pthreads/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$
+ */
+
+#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/mit-pthreads/include/unistd.h b/mit-pthreads/include/unistd.h
new file mode 100644
index 00000000000..213aa983172
--- /dev/null
+++ b/mit-pthreads/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