diff options
Diffstat (limited to 'mit-pthreads/machdep/linux-2.0')
19 files changed, 937 insertions, 0 deletions
diff --git a/mit-pthreads/machdep/linux-2.0/__math.h b/mit-pthreads/machdep/linux-2.0/__math.h new file mode 100755 index 00000000000..05c65d58321 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/__math.h @@ -0,0 +1,4 @@ +#ifndef HUGE_VAL +#define HUGE_VAL DBL_MAX +#endif + diff --git a/mit-pthreads/machdep/linux-2.0/__path.h b/mit-pthreads/machdep/linux-2.0/__path.h new file mode 100755 index 00000000000..9caeb7d3016 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/__path.h @@ -0,0 +1,14 @@ +/* + * from: @(#)time.h 5.12 (Berkeley) 3/9/91 + * $Id$ + */ + +#ifndef _SYS__PATH_H_ +#define _SYS__PATH_H_ + +#define _PATH_PTY "/dev/" +#define _PATH_TZDIR "/usr/lib/zoneinfo" +#define _PATH_TZFILE "/usr/lib/zoneinfo/localtime" + +#endif /* !_SYS__PATH_H_ */ + diff --git a/mit-pthreads/machdep/linux-2.0/__signal.h b/mit-pthreads/machdep/linux-2.0/__signal.h new file mode 100755 index 00000000000..4cd671f155c --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/__signal.h @@ -0,0 +1,24 @@ +#include <features.h> +#include <linux/signal.h> + +#ifndef SIGCLD +#define SIGCLD SIGCHLD +#endif + +typedef int sig_atomic_t; + +typedef __sighandler_t SignalHandler; + +#define SignalBad ((SignalHandler)-1) +#define SignalDefault ((SignalHandler)0) +#define SignalIgnore ((SignalHandler)1) + +#define __sigmask(sig) (1 << ((sig) - 1)) +#define sigmask __sigmask + +#define __SIGFILLSET 0xffffffff +#define __SIGEMPTYSET 0 +#define __SIGADDSET(s,n) ((*s) |= (__sigmask(n))) +#define __SIGDELSET(s,n) ((*s) &= ~(__sigmask(n))) +#define __SIGISMEMBER(s,n) ((*s) & (__sigmask(n))) + diff --git a/mit-pthreads/machdep/linux-2.0/__stdio.h b/mit-pthreads/machdep/linux-2.0/__stdio.h new file mode 100755 index 00000000000..eb7e904c34d --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/__stdio.h @@ -0,0 +1,7 @@ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +typedef pthread_fpos_t fpos_t; diff --git a/mit-pthreads/machdep/linux-2.0/__stdlib.h b/mit-pthreads/machdep/linux-2.0/__stdlib.h new file mode 100755 index 00000000000..eaa0bb988ee --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/__stdlib.h @@ -0,0 +1,20 @@ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <features.h> + +/* Get size_t, wchar_t and NULL from <stddef.h>. */ +#define __need_size_t +#define __need_wchar_t +#define __need_NULL +#include <stddef.h> + +#define __need_Emath +#include <errno.h> + +/* Get HUGE_VAL (returned by strtod on overflow) from <float.h>. */ +#define __need_HUGE_VAL +#include <float.h> + +#endif diff --git a/mit-pthreads/machdep/linux-2.0/__string.h b/mit-pthreads/machdep/linux-2.0/__string.h new file mode 100755 index 00000000000..8a5e09608e0 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/__string.h @@ -0,0 +1,18 @@ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +/* Non-standard Linux string routines. */ +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +__BEGIN_DECLS +int bcmp __P_((const void *, const void *, size_t)); +void bcopy __P_((const void *, void *, size_t)); +void bzero __P_((void *, size_t)); +char *index __P_((const char *, int)); +char *rindex __P_((const char *, int)); +char *strdup __P_((const char *)); +char *strsep __P_((char **, const char *)); +__END_DECLS +#endif diff --git a/mit-pthreads/machdep/linux-2.0/__time.h b/mit-pthreads/machdep/linux-2.0/__time.h new file mode 100755 index 00000000000..b86c153543a --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/__time.h @@ -0,0 +1,78 @@ +/* ==== __time.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 : System specific time header. + * + * 1.00 94/11/07 proven + * -Started coding this file. + */ + +#ifndef _SYS___TIME_H_ +#define _SYS___TIME_H_ + +#include <features.h> + +struct timespec + { + long int tv_sec; /* Seconds. */ + long int tv_nsec; /* Nanoseconds. */ + }; + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; +#endif +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *) 0) +#endif +#endif +#endif + +#define CLOCKS_PER_SEC 100 +#define CLK_TCK 100 + +extern long int timezone; +extern int daylight; + +#endif diff --git a/mit-pthreads/machdep/linux-2.0/__unistd.h b/mit-pthreads/machdep/linux-2.0/__unistd.h new file mode 100755 index 00000000000..444f070659a --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/__unistd.h @@ -0,0 +1,62 @@ +/*- + * 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. + * + * from: @(#)stdlib.h 5.13 (Berkeley) 6/4/91 + * $Id$ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <features.h> + +/* POSIX Standard approved as IEEE Std 1003.1 as of August, 1988. */ +#define _POSIX_VERSION 199009L +#define _POSIX2_C_BIND 1 +#define _POSIX2_C_DEV 1 +#define _POSIX2_SW_DEV 1 + +#define __need_size_t + +#include <sys/types.h> +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif +int chroot(const char *); +int gethostname(char *, int); +#ifdef __cplusplus +} +#endif +#endif + diff --git a/mit-pthreads/machdep/linux-2.0/cdefs.h b/mit-pthreads/machdep/linux-2.0/cdefs.h new file mode 100755 index 00000000000..04f93a138c9 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/cdefs.h @@ -0,0 +1,36 @@ +/* This is intended to eventually find /usr/include/sys/cdefs.h + * if it's inside the ifdef then it won't work if this file is + * found in the include files path more than once. + * + * include_next is a GNU C extension, we might eventually want + * to have our own cdefs in here simply to avoid GNU C dependencies + * (though there are already enough in the asm stuff anyways) + * [gsstark:19950419.0307EST] + */ + +/* We are almost always included from features.h. */ + +#ifndef _FEATURES_H +#include <features.h> +#endif + +#ifndef __BITS_SOCKET_H +#define __BITS_SOCKET_H +#endif + +#define __need_timespec + +#include_next <sys/cdefs.h> + +#ifndef _PTHREAD_SYS_CDEFS_H_ +#define _PTHREAD_SYS_CDEFS_H_ + +#ifndef __NORETURN +#define __NORETURN +#endif /* __NORETURN not defined. */ + +#if !defined(__cplusplus) +#define __CAN_DO_EXTERN_INLINE +#endif + +#endif /* _PTHREAD_SYS_CDEFS_H_ */ diff --git a/mit-pthreads/machdep/linux-2.0/compat.h b/mit-pthreads/machdep/linux-2.0/compat.h new file mode 100755 index 00000000000..6edb992ac3d --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/compat.h @@ -0,0 +1,47 @@ +/* ==== compat.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 _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#include <sys/types.h> + +#define omsghdr msghdr + +#endif diff --git a/mit-pthreads/machdep/linux-2.0/dirent.h b/mit-pthreads/machdep/linux-2.0/dirent.h new file mode 100755 index 00000000000..7f783a198e0 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/dirent.h @@ -0,0 +1,27 @@ + +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H + +#include <sys/types.h> +#include <linux/limits.h> + +struct dirent { + long d_ino; + off_t d_off; + unsigned short d_reclen; + char d_name[NAME_MAX+1]; +}; + +#ifndef d_fileno +#define d_fileno d_ino +#endif + +#ifndef d_namlen +#define d_namlen d_reclen +#endif + +#ifndef MAXNAMLEN +#define MAXNAMLEN NAME_MAX +#endif + +#endif diff --git a/mit-pthreads/machdep/linux-2.0/errno.h b/mit-pthreads/machdep/linux-2.0/errno.h new file mode 100755 index 00000000000..a94a56b0437 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/errno.h @@ -0,0 +1,12 @@ +/* ==== errno.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Errno is already broken up into data/prototyes. + */ + +#ifndef _SYS_ERRNO_H_ +#define _SYS_ERRNO_H_ + +#include <linux/errno.h> + +#endif diff --git a/mit-pthreads/machdep/linux-2.0/extra/bits/local_lim.h b/mit-pthreads/machdep/linux-2.0/extra/bits/local_lim.h new file mode 100644 index 00000000000..1a319ccdfd4 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/extra/bits/local_lim.h @@ -0,0 +1,15 @@ +/* Minimum guaranteed maximum values for system limits. Linux version. + +/* The kernel header pollutes the namespace with the NR_OPEN symbol. + Remove this after including the header if necessary. */ + +#ifndef NR_OPEN +# define __undef_NR_OPEN +#endif + +#include <linux/limits.h> + +#ifdef __undef_NR_OPEN +# undef NR_OPEN +# undef __undef_NR_OPEN +#endif diff --git a/mit-pthreads/machdep/linux-2.0/extra/bits/socket.h b/mit-pthreads/machdep/linux-2.0/extra/bits/socket.h new file mode 100755 index 00000000000..cc4c0fd262e --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/extra/bits/socket.h @@ -0,0 +1,193 @@ +/* ==== socket.h.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Correct Linux header file. + */ + +#ifndef _PTHREAD_SOCKET_H_ +#define _PTHREAD_SOCKET_H_ + +/* #include <linux/socket.h> */ +#ifndef _LINUX_SOCKET_H +#define _LINUX_SOCKET_H + +/* IP options */ +#define IP_TOS 1 +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IP_TTL 2 +#ifndef IP_HDRINCL +#define IP_HDRINCL 3 +#endif +#ifdef V1_3_WILL_DO_THIS_FUNKY_STUFF +#define IP_OPTIONS 4 +#endif + +#endif + +/* #include <asm/socket.h> arch-dependent defines */ +#include <linux/sockios.h> /* the SIOCxxx I/O controls */ +#include <pthread/posix.h> + +struct sockaddr { + unsigned short sa_family; /* address family, AF_xxx */ + char sa_data[14]; /* 14 bytes of protocol address */ +}; + +struct linger { + int l_onoff; /* Linger active */ + int l_linger; /* How long to linger for */ +}; + +struct msghdr +{ + void * msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + struct iovec * msg_iov; /* Data blocks */ + int msg_iovlen; /* Number of blocks */ + void * msg_accrights; /* Per protocol magic (eg BSD file descriptor passing) */ + int msg_accrightslen;/* Length of rights list */ +}; + +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ + +/* Supported address families. */ +#define AF_UNSPEC 0 +#define AF_UNIX 1 /* Unix domain sockets */ +#define AF_INET 2 /* Internet IP Protocol */ +#define AF_AX25 3 /* Amateur Radio AX.25 */ +#define AF_IPX 4 /* Novell IPX */ +#define AF_APPLETALK 5 /* Appletalk DDP */ +#define AF_NETROM 6 /* Amateur radio NetROM */ +#define AF_BRIDGE 7 /* Multiprotocol bridge */ +#define AF_AAL5 8 /* Reserved for Werner's ATM */ +#define AF_X25 9 /* Reserved for X.25 project */ +#define AF_INET6 10 /* IP version 6 */ +#define AF_MAX 12 /* For now.. */ + +/* Protocol families, same as address families. */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_AX25 AF_AX25 +#define PF_IPX AF_IPX +#define PF_APPLETALK AF_APPLETALK +#define PF_NETROM AF_NETROM +#define PF_BRIDGE AF_BRIDGE +#define PF_AAL5 AF_AAL5 +#define PF_X25 AF_X25 +#define PF_INET6 AF_INET6 + +#define PF_MAX AF_MAX + +/* Maximum queue length specificable by listen. */ +#define SOMAXCONN 128 + +/* Flags we can use with send/ and recv. */ +#define MSG_OOB 1 +#define MSG_PEEK 2 +#define MSG_DONTROUTE 4 + +/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ +#define SOL_SOCKET 1 +#define SOL_IP 0 +#define SOL_IPX 256 +#define SOL_AX25 257 +#define SOL_ATALK 258 +#define SOL_NETROM 259 +#define SOL_TCP 6 +#define SOL_UDP 17 + +/* For setsockoptions(2) */ +#define SO_DEBUG 1 +#define SO_REUSEADDR 2 +#define SO_TYPE 3 +#define SO_ERROR 4 +#define SO_DONTROUTE 5 +#define SO_BROADCAST 6 +#define SO_SNDBUF 7 +#define SO_RCVBUF 8 +#define SO_KEEPALIVE 9 +#define SO_OOBINLINE 10 +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_LINGER 13 +/* To add :#define SO_REUSEPORT 14 */ + + +#define IP_MULTICAST_IF 32 +#define IP_MULTICAST_TTL 33 +#define IP_MULTICAST_LOOP 34 +#define IP_ADD_MEMBERSHIP 35 +#define IP_DROP_MEMBERSHIP 36 + + +/* These need to appear somewhere around here */ +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +/* IPX options */ +#define IPX_TYPE 1 + +/* TCP options - this way around because someone left a set in the c library includes */ +#define TCP_NODELAY 1 +#define TCP_MAXSEG 2 + +/* The various priorities. */ +#define SOPRI_INTERACTIVE 0 +#define SOPRI_NORMAL 1 +#define SOPRI_BACKGROUND 2 + +/* + * Functions + */ + +__BEGIN_DECLS + +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int listen __P_((int, int)); +int socket __P_((int, int, int)); + +int getsockopt __P_((int __s, int __level, int __optname, + void *__optval, int *__optlen)); +int setsockopt __P_((int __s, int __level, int __optname, + __const void *__optval, int optlen)); +int getsockname __P_((int __sockfd, struct sockaddr *__addr, + int *__paddrlen)); +int getpeername __P_((int __sockfd, struct sockaddr *__peer, + int *__paddrlen)); +ssize_t send __P_((int __sockfd, __const void *__buff, size_t __len, int __flags)); +ssize_t recv __P_((int __sockfd, void *__buff, size_t __len, int __flags)); +ssize_t sendto __P_((int __sockfd, __const void *__buff, size_t __len, + int __flags, __const struct sockaddr *__to, + int __tolen)); +ssize_t recvfrom __P_((int __sockfd, void *__buff, size_t __len, + int __flags, struct sockaddr *__from, + int *__fromlen)); +extern ssize_t sendmsg __P_((int __fd, __const struct msghdr *__message, + int __flags)); +extern ssize_t recvmsg __P_((int __fd, struct msghdr *__message, + int __flags)); +int shutdown __P_((int __sockfd, int __how)); + +__END_DECLS + +#endif + + + + diff --git a/mit-pthreads/machdep/linux-2.0/socket.h b/mit-pthreads/machdep/linux-2.0/socket.h new file mode 100755 index 00000000000..fb43c394e10 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/socket.h @@ -0,0 +1,196 @@ +/* ==== socket.h.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Correct Linux header file. + */ + +#ifndef _PTHREAD_SOCKET_H_ +#define _PTHREAD_SOCKET_H_ + +/* #include <linux/socket.h> */ +#ifndef _LINUX_SOCKET_H +#define _LINUX_SOCKET_H + +/* IP options */ +#define IP_TOS 1 +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IP_TTL 2 +#ifndef IP_HDRINCL +#define IP_HDRINCL 3 +#endif +#ifdef V1_3_WILL_DO_THIS_FUNKY_STUFF +#define IP_OPTIONS 4 +#endif + +#endif + +/* Type for length arguments in socket calls. */ +typedef unsigned int socklen_t; + +/* #include <asm/socket.h> arch-dependent defines */ +#include <linux/sockios.h> /* the SIOCxxx I/O controls */ +#include <pthread/posix.h> + +struct sockaddr { + unsigned short sa_family; /* address family, AF_xxx */ + char sa_data[14]; /* 14 bytes of protocol address */ +}; + +struct linger { + int l_onoff; /* Linger active */ + int l_linger; /* How long to linger for */ +}; + +struct msghdr +{ + void * msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + struct iovec * msg_iov; /* Data blocks */ + int msg_iovlen; /* Number of blocks */ + void * msg_accrights; /* Per protocol magic (eg BSD file descriptor passing) */ + int msg_accrightslen;/* Length of rights list */ +}; + +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ + +/* Supported address families. */ +#define AF_UNSPEC 0 +#define AF_UNIX 1 /* Unix domain sockets */ +#define AF_INET 2 /* Internet IP Protocol */ +#define AF_AX25 3 /* Amateur Radio AX.25 */ +#define AF_IPX 4 /* Novell IPX */ +#define AF_APPLETALK 5 /* Appletalk DDP */ +#define AF_NETROM 6 /* Amateur radio NetROM */ +#define AF_BRIDGE 7 /* Multiprotocol bridge */ +#define AF_AAL5 8 /* Reserved for Werner's ATM */ +#define AF_X25 9 /* Reserved for X.25 project */ +#define AF_INET6 10 /* IP version 6 */ +#define AF_MAX 12 /* For now.. */ + +/* Protocol families, same as address families. */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_AX25 AF_AX25 +#define PF_IPX AF_IPX +#define PF_APPLETALK AF_APPLETALK +#define PF_NETROM AF_NETROM +#define PF_BRIDGE AF_BRIDGE +#define PF_AAL5 AF_AAL5 +#define PF_X25 AF_X25 +#define PF_INET6 AF_INET6 + +#define PF_MAX AF_MAX + +/* Maximum queue length specificable by listen. */ +#define SOMAXCONN 128 + +/* Flags we can use with send/ and recv. */ +#define MSG_OOB 1 +#define MSG_PEEK 2 +#define MSG_DONTROUTE 4 + +/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ +#define SOL_SOCKET 1 +#define SOL_IP 0 +#define SOL_IPX 256 +#define SOL_AX25 257 +#define SOL_ATALK 258 +#define SOL_NETROM 259 +#define SOL_TCP 6 +#define SOL_UDP 17 + +/* For setsockoptions(2) */ +#define SO_DEBUG 1 +#define SO_REUSEADDR 2 +#define SO_TYPE 3 +#define SO_ERROR 4 +#define SO_DONTROUTE 5 +#define SO_BROADCAST 6 +#define SO_SNDBUF 7 +#define SO_RCVBUF 8 +#define SO_KEEPALIVE 9 +#define SO_OOBINLINE 10 +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_LINGER 13 +/* To add :#define SO_REUSEPORT 14 */ + + +#define IP_MULTICAST_IF 32 +#define IP_MULTICAST_TTL 33 +#define IP_MULTICAST_LOOP 34 +#define IP_ADD_MEMBERSHIP 35 +#define IP_DROP_MEMBERSHIP 36 + + +/* These need to appear somewhere around here */ +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +/* IPX options */ +#define IPX_TYPE 1 + +/* TCP options - this way around because someone left a set in the c library includes */ +#define TCP_NODELAY 1 +#define TCP_MAXSEG 2 + +/* The various priorities. */ +#define SOPRI_INTERACTIVE 0 +#define SOPRI_NORMAL 1 +#define SOPRI_BACKGROUND 2 + +/* + * Functions + */ + +__BEGIN_DECLS + +int accept __P_((int, struct sockaddr *, socklen_t *)); +int bind __P_((int, const struct sockaddr *, socklen_t)); +int connect __P_((int, const struct sockaddr *, socklen_t)); +int listen __P_((int, int)); +int socket __P_((int, int, int)); + +int getsockopt __P_((int __s, int __level, int __optname, + void *__optval, socklen_t *__optlen)); +int setsockopt __P_((int __s, int __level, int __optname, + __const void *__optval, socklen_t optlen)); +int getsockname __P_((int __sockfd, struct sockaddr *__addr, + socklen_t *__paddrlen)); +int getpeername __P_((int __sockfd, struct sockaddr *__peer, + socklen_t *__paddrlen)); +ssize_t send __P_((int __sockfd, __const void *__buff, size_t __len, int __flags)); +ssize_t recv __P_((int __sockfd, void *__buff, size_t __len, int __flags)); +ssize_t sendto __P_((int __sockfd, __const void *__buff, size_t __len, + int __flags, __const struct sockaddr *__to, + socklen_t __tolen)); +ssize_t recvfrom __P_((int __sockfd, void *__buff, size_t __len, + int __flags, struct sockaddr *__from, + socklen_t *__fromlen)); +extern ssize_t sendmsg __P_((int __fd, __const struct msghdr *__message, + int __flags)); +extern ssize_t recvmsg __P_((int __fd, struct msghdr *__message, + int __flags)); +int shutdown __P_((int __sockfd, int __how)); + +__END_DECLS + +#endif + + + + diff --git a/mit-pthreads/machdep/linux-2.0/socketcall.h b/mit-pthreads/machdep/linux-2.0/socketcall.h new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/socketcall.h diff --git a/mit-pthreads/machdep/linux-2.0/timers.h b/mit-pthreads/machdep/linux-2.0/timers.h new file mode 100755 index 00000000000..110cb27378c --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/timers.h @@ -0,0 +1,71 @@ +/* ==== 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 _SYS_TIMERS_H_ +#define _SYS_TIMERS_H_ + +#include <pthread/config.h> +#include <sys/types.h> +#include <time.h> + +#ifndef _OS_HAS_TIMESPEC +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#endif + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/mit-pthreads/machdep/linux-2.0/uio.h b/mit-pthreads/machdep/linux-2.0/uio.h new file mode 100755 index 00000000000..67af5bf76e0 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/uio.h @@ -0,0 +1,15 @@ +/* ==== uio.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Correct Linux header file. + */ + +#ifndef _PTHREAD_UIO_H_ +#define _PTHREAD_UIO_H_ + +struct iovec { + void *iov_base; + size_t iov_len; +}; + +#endif diff --git a/mit-pthreads/machdep/linux-2.0/wait.h b/mit-pthreads/machdep/linux-2.0/wait.h new file mode 100755 index 00000000000..bcc28c5ef58 --- /dev/null +++ b/mit-pthreads/machdep/linux-2.0/wait.h @@ -0,0 +1,98 @@ +/* $NetBSD: wait.h,v 1.7 1994/06/29 06:46:23 cgd Exp $ */ + +/* + * Copyright (c) 1982, 1986, 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. + * + * @(#)wait.h 8.1 (Berkeley) 6/2/93 + */ + +/* + * This file holds definitions relevent to the wait4 system call + * and the alternate interfaces that use it (wait, wait3, waitpid). + */ + +/* + * Macros to test the exit status returned by wait and extract the + * relevant values. Union wait is no supported with pthreads. + */ +#define __W_INT(i) (i) +#define __WSTATUS(x) (__W_INT(x) & 0177) +#define __WSTOPPED 0177 /* __WSTATUS if process is stopped */ +#define WIFSTOPPED(x) (__WSTATUS(x) == __WSTOPPED) +#define WSTOPSIG(x) (__W_INT(x) >> 8) +#define WIFSIGNALED(x) (__WSTATUS(x) != __WSTOPPED && __WSTATUS(x) != 0) +#define WTERMSIG(x) (__WSTATUS(x)) +#define WIFEXITED(x) (__WSTATUS(x) == 0) +#define WEXITSTATUS(x) (__W_INT(x) >> 8) + +#ifndef _POSIX_SOURCE +#define WCOREDUMP(x) (__W_INT(x) & WCOREFLAG) +#define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) +#define W_STOPCODE(sig) ((sig) << 8 | __WSTOPPED) +#endif + +/* + * Option bits for the third argument of wait4. WNOHANG causes the + * wait to not hang if there are no stopped or terminated processes, rather + * returning an error indication in this case (pid==0). WUNTRACED + * indicates that the caller should receive status about untraced children + * which stop due to signals. If children are stopped and a wait without + * this option is done, it is as though they were still running... nothing + * about them is returned. + */ +#define WNOHANG 1 /* dont hang in wait */ +#define WUNTRACED 2 /* tell about stopped, untraced children */ + +#ifndef _POSIX_SOURCE + +/* Tokens for special values of the "pid" parameter to wait4. */ +#define WAIT_ANY (-1) /* any process */ +#define WAIT_MYPGRP 0 /* any process in my process group */ + +#define WSTOPPED __WSTOPPED +#endif /* _POSIX_SOURCE */ + +#include <sys/types.h> +#include <sys/cdefs.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +__BEGIN_DECLS +pid_t wait __P_((int *)); +pid_t waitpid __P_((pid_t, int *, int)); +#ifndef _POSIX_SOURCE +pid_t wait3 __P_((int *, int, void *)); +pid_t wait4 __P_((pid_t, int *, int, void *)); +#endif +__END_DECLS |