diff --git a/HFSinclude/net/dli_var.h b/HFSinclude/net/dli_var.h new file mode 100644 index 0000000..2833832 --- /dev/null +++ b/HFSinclude/net/dli_var.h @@ -0,0 +1,14 @@ +/* + * Too bad we don't have symlinks for GNO ... + * This file allows a program to use the *proper* name for this + * header file, while allowing the "real" header file to reside on + * a ProDOS volume. This is good for speed and disk integrity, + * and gives a work-around for those sites which don't use HFS. + * + * $Id: dli_var.h,v 1.1 1997/02/28 04:41:52 gdr Exp $ + */ + +#ifndef _NET_DLI_VAR_H_ +#include +#endif + diff --git a/HFSinclude/net/if_arp.h b/HFSinclude/net/if_arp.h new file mode 100644 index 0000000..d7218c9 --- /dev/null +++ b/HFSinclude/net/if_arp.h @@ -0,0 +1,13 @@ +/* + * Too bad we don't have symlinks for GNO ... + * This file allows a program to use the *proper* name for this + * header file, while allowing the "real" header file to reside on + * a ProDOS volume. This is good for speed and disk integrity, + * and gives a work-around for those sites which don't use HFS. + * + * $Id: if_arp.h,v 1.1 1997/02/28 04:41:53 gdr Exp $ + */ + +#ifndef _NET_IF_ARP_H_ +#include +#endif diff --git a/HFSinclude/net/raw_cb.h b/HFSinclude/net/raw_cb.h new file mode 100644 index 0000000..57fdc52 --- /dev/null +++ b/HFSinclude/net/raw_cb.h @@ -0,0 +1,13 @@ +/* + * Too bad we don't have symlinks for GNO ... + * This file allows a program to use the *proper* name for this + * header file, while allowing the "real" header file to reside on + * a ProDOS volume. This is good for speed and disk integrity, + * and gives a work-around for those sites which don't use HFS. + * + * $Id: raw_cb.h,v 1.1 1997/02/28 04:41:53 gdr Exp $ + */ + +#ifndef _NET_RAW_CB_H_ +#include +#endif diff --git a/HFSinclude/netinet/in_systm.h b/HFSinclude/netinet/in_systm.h new file mode 100644 index 0000000..d201dfa --- /dev/null +++ b/HFSinclude/netinet/in_systm.h @@ -0,0 +1,13 @@ +/* + * Too bad we don't have symlinks for GNO ... + * This file allows a program to use the *proper* name for this + * header file, while allowing the "real" header file to reside on + * a ProDOS volume. This is good for speed and disk integrity, + * and gives a work-around for those sites which don't use HFS. + * + * $Id: in_systm.h,v 1.1 1997/02/28 04:41:59 gdr Exp $ + */ + +#ifndef _NETINET_IN_SYSTM_H_ +#include +#endif diff --git a/HFSinclude/sys/ioctl_compat.h b/HFSinclude/sys/ioctl_compat.h new file mode 100644 index 0000000..3896b52 --- /dev/null +++ b/HFSinclude/sys/ioctl_compat.h @@ -0,0 +1,13 @@ +/* + * Too bad we don't have symlinks for GNO ... + * This file allows a program to use the *proper* name for this + * header file, while allowing the "real" header file to reside on + * a ProDOS volume. This is good for speed and disk integrity, + * and gives a work-around for those sites which don't use HFS. + * + * $Id: ioctl_compat.h,v 1.1 1997/02/28 04:41:59 gdr Exp $ + */ + +#ifndef _SYS_IOCTL_COMPAT_H_ +#include +#endif diff --git a/include/arpa/ftp.h b/include/arpa/ftp.h new file mode 100644 index 0000000..9a36488 --- /dev/null +++ b/include/arpa/ftp.h @@ -0,0 +1,109 @@ +/* + * 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. + * + * @(#)ftp.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_FTP_H_ +#define _ARPA_FTP_H_ + +/* Definitions for FTP; see RFC-765. */ + +/* + * Reply codes. + */ +#define PRELIM 1 /* positive preliminary */ +#define COMPLETE 2 /* positive completion */ +#define CONTINUE 3 /* positive intermediate */ +#define TRANSIENT 4 /* transient negative completion */ +#define ERROR 5 /* permanent negative completion */ + +/* + * Type codes + */ +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +#ifdef FTP_NAMES +char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; +#endif + +/* + * Form codes + */ +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ +#ifdef FTP_NAMES +char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; +#endif + +/* + * Structure codes + */ +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ +#ifdef FTP_NAMES +char *strunames[] = {"0", "File", "Record", "Page" }; +#endif + +/* + * Mode types + */ +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ +#ifdef FTP_NAMES +char *modenames[] = {"0", "Stream", "Block", "Compressed" }; +#endif + +/* + * Record Tokens + */ +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* + * Block Header + */ +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +#endif /* !_FTP_H_ */ diff --git a/include/arpa/inet.h b/include/arpa/inet.h new file mode 100644 index 0000000..0a15801 --- /dev/null +++ b/include/arpa/inet.h @@ -0,0 +1,58 @@ +/* + * 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. + * + * @(#)inet.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_INET_H_ +#define _ARPA_INET_H_ + +/* External definitions for functions in inet(3) */ + +#ifndef _SYS_CDEFS_H_ +#include +#endif +#ifndef _SYS_TYPES_H_ +#include +#endif + +__BEGIN_DECLS +unsigned long inet_addr __P((const char *)); +int inet_aton __P((const char *, struct in_addr *)); +unsigned long inet_lnaof __P((struct in_addr)); +struct in_addr inet_makeaddr __P((u_long , u_long)); +unsigned long inet_netof __P((struct in_addr)); +unsigned long inet_network __P((const char *)); +char *inet_ntoa __P((struct in_addr)); +__END_DECLS + +#endif /* !_INET_H_ */ diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h new file mode 100644 index 0000000..f85112e --- /dev/null +++ b/include/arpa/nameser.h @@ -0,0 +1,300 @@ +/* + * 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. + * + * - + * 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-- + * + * @(#)nameser.h 8.2 (Berkeley) 2/16/94 + * From Id: nameser.h,v 4.9.1.15 1994/07/19 22:51:24 vixie Exp + */ + +#ifndef _ARPA_NAMESER_H_ +#define _ARPA_NAMESER_H_ + +#ifndef _SYS_PARAM_H_ +#include +#endif +#ifndef _SYS_TYPES_H_ +#include +#endif +#ifndef _SYS_CDEFS_H_ +#include +#endif +#ifndef _MACHINE_ENDIAN_H_ +#include +#endif + +/* + * 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 (__BIND > 19931104)". do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#define __BIND 19950621 /* interface version stamp */ + +/* + * 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 */ +#define HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#define QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#define INT32SZ 4 /* for systems without 32-bit ints */ +#define INT16SZ 2 /* for systems without 16-bit ints */ +#define INADDRSZ 4 /* for sizeof(struct inaddr) != 4 */ + +/* + * 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 */ +#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */ +#ifdef ALLOW_UPDATES + /* 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 */ +#endif + +/* + * 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 */ +#ifdef ALLOW_UPDATES + /* non standard */ +# define NOCHANGE 0xf /* update failed to change db */ +#endif + +/* + * 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 /* canonical 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_X25 19 /* X_25 calling address */ +#define T_ISDN 20 /* ISDN calling address */ +#define T_RT 21 /* router */ +#define T_NSAP 22 /* NSAP address */ +#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */ +#define T_SIG 24 /* security signature */ +#define T_KEY 25 /* security key */ +#define T_PX 26 /* X.400 mail mapping */ +#define T_GPOS 27 /* geographical position (withdrawn) */ +#define T_AAAA 28 /* IP6 Address */ +#define T_LOC 29 /* Location Information */ + /* 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) + +/* + * 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 { + unsigned id :16; /* query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + unsigned qr: 1; /* response flag */ + unsigned opcode: 4; /* purpose of message */ + unsigned aa: 1; /* authoritive answer */ + unsigned tc: 1; /* truncated message */ + unsigned rd: 1; /* recursion desired */ + /* fields in fourth byte */ + unsigned ra: 1; /* recursion available */ + unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned rcode :4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + unsigned rd :1; /* recursion desired */ + unsigned tc :1; /* truncated message */ + unsigned aa :1; /* authoritive answer */ + unsigned opcode :4; /* purpose of message */ + unsigned qr :1; /* response flag */ + /* fields in fourth byte */ + unsigned rcode :4; /* response code */ + unsigned unused :3; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned ra :1; /* recursion available */ +#endif + /* remaining bytes */ + unsigned qdcount :16; /* number of question entries */ + unsigned ancount :16; /* number of answer entries */ + unsigned nscount :16; /* number of authority entries */ + unsigned arcount :16; /* number of resource entries */ +} HEADER; + +/* + * Defines for handling compressed domain names + */ +#define INDIR_MASK 0xc0 + +/* + * Structure for passing resource records around. + */ +struct rrec { + int16_t r_zone; /* zone number */ + int16_t r_class; /* class number */ + int16_t r_type; /* type number */ + u_int32_t r_ttl; /* time to live */ + int r_size; /* size of data area */ + char *r_data; /* pointer to data */ +}; + +extern u_int16_t _getshort __P((const u_char *)); +extern u_int32_t _getlong __P((const u_char *)); + +/* + * Inline versions of get/put short/long. Pointer is advanced. + * + * These macros demonstrate the property of C whereby it can be + * portable or it can be elegant but rarely both. + */ +#define GETSHORT(s, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (s) = ((u_int16_t)t_cp[0] << 8) \ + | ((u_int16_t)t_cp[1]) \ + ; \ + (cp) += INT16SZ; \ +} + +#define GETLONG(l, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (l) = ((u_int32_t)t_cp[0] << 24) \ + | ((u_int32_t)t_cp[1] << 16) \ + | ((u_int32_t)t_cp[2] << 8) \ + | ((u_int32_t)t_cp[3]) \ + ; \ + (cp) += INT32SZ; \ +} + +#define PUTSHORT(s, cp) { \ + register u_int16_t t_s = (u_int16_t)(s); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += INT16SZ; \ +} + +#define PUTLONG(l, cp) { \ + register u_int32_t t_l = (u_int32_t)(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) += INT32SZ; \ +} + +#endif /* !_ARPA_NAMESER_H_ */ diff --git a/include/arpa/telnet.h b/include/arpa/telnet.h new file mode 100644 index 0000000..4880426 --- /dev/null +++ b/include/arpa/telnet.h @@ -0,0 +1,321 @@ +/* + * 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. + * + * @(#)telnet.h 8.2 (Berkeley) 12/15/93 + */ + +#ifndef _ARPA_TELNET_H_ +#define _ARPA_TELNET_H_ + +/* + * Definitions for the TELNET protocol. + */ +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ +#define ABORT 238 /* Abort process */ +#define SUSP 237 /* Suspend process */ +#define xEOF 236 /* End of file: EOF is already used... */ + +#define SYNCH 242 /* for telfunc calls */ + +#ifdef TELCMDS +char *telcmds[] = { + "EOF", "SUSP", "ABORT", "EOR", + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", + NULL +}; +#else +extern char *telcmds[]; +#endif + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ + (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +/* telnet options */ +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_TUID 26 /* TACACS user identification */ +#define TELOPT_OUTMRK 27 /* output marking */ +#define TELOPT_TTYLOC 28 /* terminal location number */ +#define TELOPT_3270REGIME 29 /* 3270 regime */ +#define TELOPT_X3PAD 30 /* X.3 PAD */ +#define TELOPT_NAWS 31 /* window size */ +#define TELOPT_TSPEED 32 /* terminal speed */ +#define TELOPT_LFLOW 33 /* remote flow control */ +#define TELOPT_LINEMODE 34 /* Linemode option */ +#define TELOPT_XDISPLOC 35 /* X Display Location */ +#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ +#define TELOPT_AUTHENTICATION 37/* Authenticate */ +#define TELOPT_ENCRYPT 38 /* Encryption option */ +#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ +#define TELOPT_EXOPL 255 /* extended-options-list */ + + +#define NTELOPTS (1+TELOPT_NEW_ENVIRON) +#ifdef TELOPTS +char *telopts[NTELOPTS+1] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", + "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", + "ENCRYPT", "NEW-ENVIRON", + NULL +}; +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#endif + +/* sub-option qualifiers */ +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ +#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ +#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ +#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ + +#define LFLOW_OFF 0 /* Disable remote flow control */ +#define LFLOW_ON 1 /* Enable remote flow control */ +#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ +#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ + +/* + * LINEMODE suboptions + */ + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +/* Not part of protocol, but needed to simplify things... */ +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 + +#define NSLC 18 + +/* + * For backwards compatability, we define SLC_NAMES to be the + * list of names if SLC_NAMES is not defined. + */ +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", NULL +#ifdef SLC_NAMES +char *slc_names[] = { + SLC_NAMELIST +}; +#else +extern char *slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 + +/* + * AUTHENTICATION suboptions + */ + +/* + * Who is authenticating who ... + */ +#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ +#define AUTH_WHO_SERVER 1 /* Server authenticating client */ +#define AUTH_WHO_MASK 1 + +/* + * amount of authentication done + */ +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_CNT 5 + +#define AUTHTYPE_TEST 99 + +#ifdef AUTH_NAMES +char *authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, +}; +#else +extern char *authtype_names[]; +#endif + +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] + +/* + * ENCRYPTion suboptions + */ +#define ENCRYPT_IS 0 /* I pick encryption type ... */ +#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ +#define ENCRYPT_REPLY 2 /* Initial setup response */ +#define ENCRYPT_START 3 /* Am starting to send encrypted */ +#define ENCRYPT_END 4 /* Am ending encrypted */ +#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ +#define ENCRYPT_REQEND 6 /* Request you send encrypting */ +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 + +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 + +#ifdef ENCRYPT_NAMES +char *encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", + 0, +}; +char *enctype_names[] = { + "ANY", "DES_CFB64", "DES_OFB64", 0, +}; +#else +extern char *encrypt_names[]; +extern char *enctype_names[]; +#endif + + +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] + +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] + +#endif /* !_TELNET_H_ */ diff --git a/include/arpa/tftp.h b/include/arpa/tftp.h new file mode 100644 index 0000000..3d3dbf3 --- /dev/null +++ b/include/arpa/tftp.h @@ -0,0 +1,80 @@ +/* + * 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. + * + * @(#)tftp.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_TFTP_H_ +#define _ARPA_TFTP_H_ + +/* + * Trivial File Transfer Protocol (IEN-133) + */ +#define SEGSIZE 512 /* data segment size */ + +/* + * Packet types. + */ +#define RRQ 01 /* read request */ +#define WRQ 02 /* write request */ +#define DATA 03 /* data packet */ +#define ACK 04 /* acknowledgement */ +#define ERROR 05 /* error code */ + +struct tftphdr { + short th_opcode; /* packet type */ + union { + short tu_block; /* block # */ + short tu_code; /* error code */ + char tu_stuff[1]; /* request packet stuff */ + } th_u; + char th_data[1]; /* data or error string */ +}; + +#define th_block th_u.tu_block +#define th_code th_u.tu_code +#define th_stuff th_u.tu_stuff +#define th_msg th_data + +/* + * Error codes. + */ +#define EUNDEF 0 /* not defined */ +#define ENOTFOUND 1 /* file not found */ +#define EACCESS 2 /* access violation */ +#define ENOSPACE 3 /* disk full or allocation exceeded */ +#define EBADOP 4 /* illegal TFTP operation */ +#define EBADID 5 /* unknown transfer ID */ +#define EEXISTS 6 /* file already exists */ +#define ENOUSER 7 /* no such user */ + +#endif /* !_TFTP_H_ */ diff --git a/include/curses.h b/include/curses.h new file mode 100644 index 0000000..c167397 --- /dev/null +++ b/include/curses.h @@ -0,0 +1,403 @@ +/* + * Copyright (c) 1981, 1993, 1994 + * 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. + * + * @(#)curses.h 8.3 (Berkeley) 7/27/94 + */ + +#ifndef _CURSES_H_ +#define _CURSES_H_ + +#ifndef _SYS_TYPES_H_ +#include +#endif +#ifndef _SYS_CDEFS_H_ +#include +#endif +#ifndef __stdio__ +#include +#endif + +#ifndef _BSD_VA_LIST_ +#define _BSD_VA_LIST_ __va_list +#endif + +/* + * The following #defines and #includes are present for backward + * compatibility only. They should not be used in future code. + * + * START BACKWARD COMPATIBILITY ONLY. + */ +#ifndef _CURSES_PRIVATE + +/* This stuff needed for those pgms which include */ +/* Undef things manually to avoid redefinition */ + +#undef USE_OLD_TTY +#undef B0 +#undef B50 +#undef B75 +#undef B110 +#undef B134 +#undef B150 +#undef B200 +#undef B300 +#undef B600 +#undef B1200 +#undef B1800 +#undef B2400 +#undef B4800 +#undef B9600 +#undef EXTA +#undef EXTB +#undef B57600 +#undef B115200 + +#ifndef _TERMIOS_H_ +#include +#endif +#ifndef _SYS_IOCTL_H_ +#include +#endif +#ifndef _SYS_IOCTL_COMPAT_H_ +#include /* For sgttyb and related */ +#endif + +#define bool char +#define reg register + +#ifndef TRUE +#define TRUE (1) +#endif +#ifndef FALSE +#define FALSE (0) +#endif + +#define _puts(s) tputs(s, 0, __cputchar) + +/* Old-style terminal modes access. */ +#define baudrate() (cfgetospeed(&__baset)) +#define crmode() cbreak() +#define erasechar() (__baset.c_cc[VERASE]) +#define killchar() (__baset.c_cc[VKILL]) +#define nocrmode() nocbreak() + +/* WINDOW structure members name compatibility */ +#define _curx curx +#define _cury cury +#define _begx begx +#define _begy begy +#define _maxx maxx +#define _maxy maxy + +#define _tty __baset + +#endif /* _CURSES_PRIVATE */ + +extern char GT; /* Gtty indicates tabs. */ +extern char NONL; /* Term can't hack LF doing a CR. */ +extern char UPPERCASE; /* Terminal is uppercase only. */ + +extern int My_term; /* Use Def_term regardless. */ +extern char *Def_term; /* Default terminal type. */ + +/* Termcap capabilities. */ +extern char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS, + PC, UL, XB, XN, XT, XS, XX; +extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, + *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, + *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, + *KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF, + *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, + *VE, *al, *dl, *sf, *sr, + *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM, + *RIGHT_PARM; + +/* END BACKWARD COMPATIBILITY ONLY. */ + +/* 8-bit ASCII characters. */ +#define unctrl(c) __unctrl[(c) & 0xff] +#define unctrllen(ch) __unctrllen[(ch) & 0xff] + +extern char *__unctrl[256]; /* Control strings. */ +extern char __unctrllen[256]; /* Control strings length. */ + +/* + * A window an array of __LINE structures pointed to by the 'lines' pointer. + * A line is an array of __LDATA structures pointed to by the 'line' pointer. + * + * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new + * fields are added -- padding fields with *constant values* should ensure + * that the compiler will not generate any padding when storing an array of + * __LDATA structures. This is to enable consistent use of memcmp, and memcpy + * for comparing and copying arrays. + */ +typedef struct { + char ch; /* the actual character */ + +#define __STANDOUT 0x01 /* Added characters are standout. */ + char attr; /* attributes of character */ +} __LDATA; + +#define __LDATASIZE (sizeof(__LDATA)) + +typedef struct { +#define __ISDIRTY 0x01 /* Line is dirty. */ +#define __ISPASTEOL 0x02 /* Cursor is past end of line */ +#define __FORCEPAINT 0x04 /* Force a repaint of the line */ + u_int flags; + u_long hash; /* non-BSD */ /* Hash value for the line. */ + size_t *firstchp, *lastchp; /* First and last chngd columns ptrs */ + size_t firstch, lastch; /* First and last changed columns. */ + __LDATA *line; /* Pointer to the line text. */ +} __LINE; + +typedef struct __window { /* Window structure. */ + struct __window *nextp, *orig; /* Subwindows list and parent. */ + size_t begy, begx; /* Window home. */ + size_t cury, curx; /* Current x, y coordinates. */ + size_t maxy, maxx; /* Maximum values for curx, cury. */ + short ch_off; /* x offset for firstch/lastch. */ + __LINE **lines; /* Array of pointers to the lines */ + __LINE *lspace; /* line space (for cleanup) */ + __LDATA *wspace; /* window space (for cleanup) */ + +#define __ENDLINE 0x001 /* End of screen. */ +#define __FLUSH 0x002 /* Fflush(stdout) after refresh. */ +#define __FULLWIN 0x004 /* Window is a screen. */ +#define __IDLINE 0x008 /* Insert/delete sequences. */ +#define __SCROLLWIN 0x010 /* Last char will scroll window. */ +#define __SCROLLOK 0x020 /* Scrolling ok. */ +#define __CLEAROK 0x040 /* Clear on next refresh. */ +#define __WSTANDOUT 0x080 /* Standout window */ +#define __LEAVEOK 0x100 /* If curser left */ +#define __FULLLINE 0x200 /* Line width = terminal width. */ + u_int flags; +} WINDOW; + +/* Curses external declarations. */ +extern WINDOW *curscr; /* Current screen. */ +extern WINDOW *stdscr; /* Standard screen. */ + +typedef struct termios SGTTY; + +extern SGTTY __orig_termios; /* Terminal state before curses */ +extern SGTTY __baset; /* Our base terminal state */ +extern int __tcaction; /* If terminal hardware set. */ +extern int __tty_fileno; /* Terminal file descriptor */ + +extern int COLS; /* Columns on the screen. */ +extern int LINES; /* Lines on the screen. */ + +extern char *ttytype; /* Full name of current terminal. */ + +#define ERR (0) /* Error return. */ +#define OK (1) /* Success return. */ + +/* Standard screen pseudo functions. */ +#define addbytes(s, n) __waddbytes(stdscr, s, n, 0) +#define addch(ch) waddch(stdscr, ch) +#define addnstr(s, n) waddnstr(stdscr, s, n) +#define addstr(s) __waddbytes(stdscr, s, strlen(s), 0) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define delch() wdelch(stdscr) +#define deleteln() wdeleteln(stdscr) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(s) wgetstr(stdscr, s) +#define inch() winch(stdscr) +#define insch(ch) winsch(stdscr, ch) +#define insertln() winsertln(stdscr) +#define move(y, x) wmove(stdscr, y, x) +#define refresh() wrefresh(stdscr) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define waddbytes(w, s, n) __waddbytes(w, s, n, 0) +#define waddstr(w, s) __waddbytes(w, s, strlen(s), 0) + +/* Standard screen plus movement pseudo functions. */ +#define mvaddbytes(y, x, s, n) mvwaddbytes(stdscr, y, x, s, n) +#define mvaddch(y, x, ch) mvwaddch(stdscr, y, x, ch) +#define mvaddnstr(y, x, s, n) mvwaddnstr(stdscr, y, x, s, n) +#define mvaddstr(y, x, s) mvwaddstr(stdscr, y, x, s) +#define mvdelch(y, x) mvwdelch(stdscr, y, x) +#define mvgetch(y, x) mvwgetch(stdscr, y, x) +#define mvgetstr(y, x, s) mvwgetstr(stdscr, y, x, s) +#define mvinch(y, x) mvwinch(stdscr, y, x) +#define mvinsch(y, x, c) mvwinsch(stdscr, y, x, c) +#define mvwaddbytes(w, y, x, s, n) \ + (wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0)) +#define mvwaddch(w, y, x, ch) \ + (wmove(w, y, x) == ERR ? ERR : waddch(w, ch)) +#define mvwaddnstr(w, y, x, s, n) \ + (wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n)) +#define mvwaddstr(w, y, x, s) \ + (wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, strlen(s), 0)) +#define mvwdelch(w, y, x) \ + (wmove(w, y, x) == ERR ? ERR : wdelch(w)) +#define mvwgetch(w, y, x) \ + (wmove(w, y, x) == ERR ? ERR : wgetch(w)) +#define mvwgetstr(w, y, x, s) \ + (wmove(w, y, x) == ERR ? ERR : wgetstr(w, s)) +#define mvwinch(w, y, x) \ + (wmove(w, y, x) == ERR ? ERR : winch(w)) +#define mvwinsch(w, y, x, c) \ + (wmove(w, y, x) == ERR ? ERR : winsch(w, c)) + +/* Psuedo functions. */ +#define clearok(w, bf) \ + ((bf) ? ((w)->flags |= __CLEAROK) : ((w)->flags &= ~__CLEAROK)) +#define flushok(w, bf) \ + ((bf) ? ((w)->flags |= __FLUSH) : ((w)->flags &= ~__FLUSH)) +#define getyx(w, y, x) \ + (y) = (w)->cury, (x) = (w)->curx +#define leaveok(w, bf) \ + ((bf) ? ((w)->flags |= __LEAVEOK) : ((w)->flags &= ~__LEAVEOK)) +#define scrollok(w, bf) \ + ((bf) ? ((w)->flags |= __SCROLLOK) : ((w)->flags &= ~__SCROLLOK)) +#define winch(w) \ + ((w)->lines[(w)->cury]->line[(w)->curx].ch & 0377) + +/* Public function prototypes. */ +int box __P((WINDOW *, int, int)); +int cbreak __P((void)); +int delwin __P((WINDOW *)); +int echo __P((void)); +int endwin __P((void)); +char *fullname __P((char *, char *)); +char *getcap __P((char *)); +int gettmode __P((void)); +void idlok __P((WINDOW *, int)); +WINDOW *initscr __P((void)); +char *longname __P((char *, char *)); +int mvcur __P((int, int, int, int)); +int mvprintw __P((int, int, const char *, ...)); +int mvscanw __P((int, int, const char *, ...)); +int mvwin __P((WINDOW *, int, int)); +int mvwprintw __P((WINDOW *, int, int, const char *, ...)); +int mvwscanw __P((WINDOW *, int, int, const char *, ...)); +WINDOW *newwin __P((int, int, int, int)); +int nl __P((void)); +int nocbreak __P((void)); +int noecho __P((void)); +int nonl __P((void)); +int noraw __P((void)); +int overlay __P((WINDOW *, WINDOW *)); +int overwrite __P((WINDOW *, WINDOW *)); +int printw __P((const char *, ...)); +int raw __P((void)); +int resetty __P((void)); +int savetty __P((void)); +int scanw __P((const char *, ...)); +int scroll __P((WINDOW *)); +int setterm __P((char *)); +int sscans __P((WINDOW *, const char *, ...)); +WINDOW *subwin __P((WINDOW *, int, int, int, int)); +int suspendwin __P((void)); +int touchline __P((WINDOW *, int, int, int)); +int touchoverlap __P((WINDOW *, WINDOW *)); +int touchwin __P((WINDOW *)); +int vwprintw __P((WINDOW *, const char *, _BSD_VA_LIST_)); +int vwscanw __P((WINDOW *, const char *, _BSD_VA_LIST_)); +int waddch __P((WINDOW *, int)); +int waddnstr __P((WINDOW *, const char *, int)); +int wclear __P((WINDOW *)); +int wclrtobot __P((WINDOW *)); +int wclrtoeol __P((WINDOW *)); +int wdelch __P((WINDOW *)); +int wdeleteln __P((WINDOW *)); +int werase __P((WINDOW *)); +int wgetch __P((WINDOW *)); +int wgetstr __P((WINDOW *, char *)); +int winsch __P((WINDOW *, int)); +int winsertln __P((WINDOW *)); +int wmove __P((WINDOW *, int, int)); +int wprintw __P((WINDOW *, const char *, ...)); +int wrefresh __P((WINDOW *)); +int wscanw __P((WINDOW *, const char *, ...)); +int wstandend __P((WINDOW *)); +int wstandout __P((WINDOW *)); +int vwprintw __P((WINDOW *, const char *, _BSD_VA_LIST_)); + +/* Private functions that are needed for user programs prototypes. */ +void __cputchar __P((int)); +int _putchar __P((int)); +int __waddbytes __P((WINDOW *, const char *, int, int)); + +/* Private functions. */ +#ifdef _CURSES_PRIVATE +void __CTRACE __P((const char *, ...)); +u_long __hash __P((char *, int)); /* non-BSD */ +void __id_subwins __P((WINDOW *)); +int __mvcur __P((int, int, int, int, int)); +void __restore_stophandler __P((void)); +void __set_stophandler __P((void)); +void __set_subwin __P((WINDOW *, WINDOW *)); +void __set_scroll_region __P((int, int, int, int)); +void __startwin __P((void)); +void __stop_signal_handler __P((int, int)); /* non-BSD */ +void __swflags __P((WINDOW *)); +int __touchline __P((WINDOW *, int, int, int, int)); +int __touchwin __P((WINDOW *)); +char *__tscroll __P((const char *, int, int)); +int __waddch __P((WINDOW *, __LDATA *)); + +/* Private #defines. */ +#define min(a,b) (a < b ? a : b) +#define max(a,b) (a > b ? a : b) + +/* Private externs. */ +extern char DB; +extern int __echoit; +extern int __endwin; +extern int __pfast; +extern int __rawmode; +extern int __noqch; +extern int __usecs; + +int tputs __P((const char *, int, void (*)(int))); + +#else + +int tputs __P((const char *, int, int (*)(int))); + +#endif + +/* Termcap functions. */ +int tgetent __P((char *, const char *)); +int tgetnum __P((const char *)); +int tgetflag __P((const char *)); +char *tgetstr __P((const char *, char **)); +char *tgoto __P((const char *, int, int)); + +#endif /* !_CURSES_H_ */ diff --git a/include/db.h b/include/db.h new file mode 100644 index 0000000..94db0b5 --- /dev/null +++ b/include/db.h @@ -0,0 +1,225 @@ +/*- + * Copyright (c) 1990, 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. + * + * @(#)db.h 8.4 (Berkeley) 2/21/94 + */ + +#ifndef _DB_H_ +#define _DB_H_ + +#ifndef _SYS_TYPES_H_ +#include +#endif + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +#ifndef _LIMITS_H_ +#include +#endif + +#define RET_ERROR -1 /* Return values. */ +#define RET_SUCCESS 0 +#define RET_SPECIAL 1 + +#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ +typedef u_int32_t pgno_t; +#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ +typedef u_int16_t indx_t; +#define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ +typedef u_int32_t recno_t; + +/* Key/data structure -- a Data-Base Thang. */ +typedef struct { + void *data; /* data */ + size_t size; /* data length */ +} DBT; + +/* Routine flags. */ +#define R_CURSOR 1 /* del, put, seq */ +#define __R_UNUSED 2 /* UNUSED */ +#define R_FIRST 3 /* seq */ +#define R_IAFTER 4 /* put (RECNO) */ +#define R_IBEFORE 5 /* put (RECNO) */ +#define R_LAST 6 /* seq (BTREE, RECNO) */ +#define R_NEXT 7 /* seq */ +#define R_NOOVERWRITE 8 /* put */ +#define R_PREV 9 /* seq (BTREE, RECNO) */ +#define R_SETCURSOR 10 /* put (RECNO) */ +#define R_RECNOSYNC 11 /* sync (RECNO) */ + +typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; + +/* + * !!! + * The following flags are included in the dbopen(3) call as part of the + * open(2) flags. In order to avoid conflicts with the open flags, start + * at the top of the 16 or 32-bit number space and work our way down. If + * the open flags were significantly expanded in the future, it could be + * a problem. Wish I'd left another flags word in the dbopen call. + * + * !!! + * None of this stuff is implemented yet. The only reason that it's here + * is so that the access methods can skip copying the key/data pair when + * the DB_LOCK flag isn't set. + */ +#if UINT_MAX > 65535 +#define DB_LOCK 0x20000000 /* Do locking. */ +#define DB_SHMEM 0x40000000 /* Use shared memory. */ +#define DB_TXN 0x80000000 /* Do transactions. */ +#else +#define DB_LOCK 0x2000 /* Do locking. */ +#define DB_SHMEM 0x4000 /* Use shared memory. */ +#define DB_TXN 0x8000 /* Do transactions. */ +#endif + +/* Access method description structure. */ +typedef struct __db { + DBTYPE type; /* Underlying db type. */ + int (*close) __P((struct __db *)); + int (*del) __P((const struct __db *, const DBT *, u_int)); + int (*get) __P((const struct __db *, const DBT *, DBT *, u_int)); + int (*put) __P((const struct __db *, DBT *, const DBT *, u_int)); + int (*seq) __P((const struct __db *, DBT *, DBT *, u_int)); + int (*sync) __P((const struct __db *, u_int)); + void *internal; /* Access method private. */ + int (*fd) __P((const struct __db *)); +} DB; + +#define BTREEMAGIC 0x053162 +#define BTREEVERSION 3 + +/* Structure used to pass parameters to the btree routines. */ +typedef struct { +#define R_DUP 0x01 /* duplicate keys */ + u_long flags; + u_int cachesize; /* bytes to cache */ + int maxkeypage; /* maximum keys per page */ + int minkeypage; /* minimum keys per page */ + u_int psize; /* page size */ + int (*compare) /* comparison function */ + __P((const DBT *, const DBT *)); + size_t (*prefix) /* prefix function */ + __P((const DBT *, const DBT *)); + int lorder; /* byte order */ +} BTREEINFO; + +#define HASHMAGIC 0x061561 +#define HASHVERSION 2 + +/* Structure used to pass parameters to the hashing routines. */ +typedef struct { + u_int bsize; /* bucket size */ + u_int ffactor; /* fill factor */ + u_int nelem; /* number of elements */ + u_int cachesize; /* bytes to cache */ + u_int32_t /* hash function */ + (*hash) __P((const void *, size_t)); + int lorder; /* byte order */ +} HASHINFO; + +/* Structure used to pass parameters to the record routines. */ +typedef struct { +#define R_FIXEDLEN 0x01 /* fixed-length records */ +#define R_NOKEY 0x02 /* key not required */ +#define R_SNAPSHOT 0x04 /* snapshot the input */ + u_long flags; + u_int cachesize; /* bytes to cache */ + u_int psize; /* page size */ + int lorder; /* byte order */ + size_t reclen; /* record length (fixed-length records) */ + u_char bval; /* delimiting byte (variable-length records */ + char *bfname; /* btree file name */ +} RECNOINFO; + +#ifdef __DBINTERFACE_PRIVATE +/* + * Little endian <==> big endian 32-bit swap macros. + * M_32_SWAP swap a memory location + * P_32_SWAP swap a referenced memory location + * P_32_COPY swap from one location to another + */ +#define M_32_SWAP(a) { \ + u_int32_t _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[3]; \ + ((char *)&a)[1] = ((char *)&_tmp)[2]; \ + ((char *)&a)[2] = ((char *)&_tmp)[1]; \ + ((char *)&a)[3] = ((char *)&_tmp)[0]; \ +} +#define P_32_SWAP(a) { \ + u_int32_t _tmp = *(u_int32_t *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[3]; \ + ((char *)a)[1] = ((char *)&_tmp)[2]; \ + ((char *)a)[2] = ((char *)&_tmp)[1]; \ + ((char *)a)[3] = ((char *)&_tmp)[0]; \ +} +#define P_32_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[3]; \ + ((char *)&(b))[1] = ((char *)&(a))[2]; \ + ((char *)&(b))[2] = ((char *)&(a))[1]; \ + ((char *)&(b))[3] = ((char *)&(a))[0]; \ +} + +/* + * Little endian <==> big endian 16-bit swap macros. + * M_16_SWAP swap a memory location + * P_16_SWAP swap a referenced memory location + * P_16_COPY swap from one location to another + */ +#define M_16_SWAP(a) { \ + u_int16_t _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[1]; \ + ((char *)&a)[1] = ((char *)&_tmp)[0]; \ +} +#define P_16_SWAP(a) { \ + u_int16_t _tmp = *(u_int16_t *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[1]; \ + ((char *)a)[1] = ((char *)&_tmp)[0]; \ +} +#define P_16_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[1]; \ + ((char *)&(b))[1] = ((char *)&(a))[0]; \ +} +#endif + +__BEGIN_DECLS +DB *dbopen __P((const char *, int, int, DBTYPE, const void *)); + +#ifdef __DBINTERFACE_PRIVATE +DB *__bt_open __P((const char *, int, int, const BTREEINFO *, int)); +DB *__hash_open __P((const char *, int, int, const HASHINFO *, int)); +DB *__rec_open __P((const char *, int, int, const RECNOINFO *, int)); +void __dbpanic __P((DB *dbp)); +#endif +__END_DECLS +#endif /* !_DB_H_ */ diff --git a/include/defaults.h b/include/defaults.h new file mode 100644 index 0000000..b07e270 --- /dev/null +++ b/include/defaults.h @@ -0,0 +1,34 @@ +/************************************************* + * Start of GNO v2.0.6 definitions. + * + * $Id: defaults.h,v 1.1 1997/02/28 04:42:01 gdr Exp $ + */ + +#define __appleiigs__ +#define __GNO__ + +/* + * __ORCAC_VERSION should be: + * undefined for Orca/C earlier than v2.1.0 + * 210 for Orca/C v2.1.0 - v2.1.1b1 + * 211 for Orca/C v2.1.1b2 and higher + * Note that if you have Orca/C v2.0.x or earlier, it doesn't even + * include this file by default. + */ +#define __ORCAC_VERSION 211 + +/* + * These should be identically equal. Orca/C headers use one, BSD headers + * use the other. Unfortunately, this construct will miss definitions + * given in source files -- it is only caught on the occ command line. + */ +#if defined(__KeepNamespacePure__) && !defined(_ANSI_SOURCE) +#define _ANSI_SOURCE +#endif +#if defined(_ANSI_SOURCE) && !defined(__KeepNamespacePure__) +#define __KeepNamespacePure__ +#endif + +/* + * End of GNO v2.0.6 definitions. + *************************************************/ diff --git a/include/dirent.h b/include/dirent.h new file mode 100644 index 0000000..ceab7e2 --- /dev/null +++ b/include/dirent.h @@ -0,0 +1,111 @@ +/*- + * Copyright (c) 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. + * + * @(#)dirent.h 8.1 (Berkeley) 6/8/93 + */ + +#ifndef _DIRENT_H_ +#define _DIRENT_H_ + +/* + * The kernel defines the format of directory entries returned by + * the getdirentries(2) system call. + */ +#ifndef _SYS_DIRENT_H_ +#include +#endif + +#ifdef _POSIX_SOURCE +typedef void * DIR; +#else + +#define d_ino d_fileno /* backward compatibility */ + +/* definitions for library routines operating on directories. */ +#define DIRBLKSIZ 1024 + +/* avoid requirement for in user code */ +#ifdef __LIBC_DIRENT +#define _DATA_T struct dirent * +#define _ENT_T DirEntryRecGS * +#else +#define _DATA_T void * +#define _ENT_T void * +#endif + +/* structure describing an open directory. */ + +typedef struct _dirdesc { + int dd_fd; /* file descriptor associated with directory */ + _ENT_T dd_ent; /* libc internal use only! */ + _DATA_T dd_data; /* the current entry */ +} DIR; + +#undef _ENT_T +#undef _DATA_T + +#define dirfd(dirp) ((dirp)->dd_fd) + +#ifndef NULL +#define NULL (void *) 0L +#endif + +#endif /* _POSIX_SOURCE */ + +#ifndef KERNEL + +#ifndef _SYS_CDEFS_H_ +#include +#endif +#ifndef _SYS_TYPES_H_ +#include +#endif + +__BEGIN_DECLS +DIR *opendir __P((const char *)); +struct dirent *readdir __P((DIR *)); +void rewinddir __P((DIR *)); +int closedir __P((DIR *)); +#ifndef _POSIX_SOURCE +long telldir __P((const 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 alphacasesort __P((const void *, const void *)); /* GNO-specific */ +int getdirentries __P((int, char *, int, long *)); +#endif /* not POSIX */ +__END_DECLS + +#endif /* !KERNEL */ + +#endif /* !_DIRENT_H_ */ diff --git a/include/err.h b/include/err.h new file mode 100644 index 0000000..29a830b --- /dev/null +++ b/include/err.h @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 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. + * + * @(#)err.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ERR_H_ +#define _ERR_H_ + +/* + * Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two + * places ( and ), so if we include one + * of them here we may collide with the utility's includes. It's unreasonable + * for utilities to have to include one of them to include err.h, so we get + * _BSD_VA_LIST_ from and use it. + */ + +#ifndef _MACHINE_ANSI_H_ +#include +#endif + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +__dead void err __P((int, const char *, ...)) __dead2; +__dead void verr __P((int, const char *, _BSD_VA_LIST_)) __dead2; +__dead void errx __P((int, const char *, ...)) __dead2; +__dead void verrx __P((int, const char *, _BSD_VA_LIST_)) __dead2; +void warn __P((const char *, ...)); +void vwarn __P((const char *, _BSD_VA_LIST_)); +void warnx __P((const char *, ...)); +void vwarnx __P((const char *, _BSD_VA_LIST_)); +void err_set_file __P((void *)); +void err_set_exit __P((void (*)__P((int)))); +__END_DECLS + +#endif /* !_ERR_H_ */ diff --git a/include/errno.h b/include/errno.h new file mode 100644 index 0000000..b239586 --- /dev/null +++ b/include/errno.h @@ -0,0 +1,14 @@ +/* + * Too bad we don't have symlinks for GNO ... + * + * $Id: errno.h,v 1.1 1997/02/28 04:42:01 gdr Exp $ + */ + +#ifndef _ERRNO_H_ +#define _ERRNO_H_ + +#ifndef _SYS_ERRNO_H_ +#include +#endif + +#endif diff --git a/include/fcntl.h b/include/fcntl.h new file mode 100644 index 0000000..b2d7828 --- /dev/null +++ b/include/fcntl.h @@ -0,0 +1,15 @@ +/* + * Too bad we don't have symlinks for GNO ... + * + * $Id: fcntl.h,v 1.1 1997/02/28 04:42:01 gdr Exp $ + */ + +#ifndef _FCNTL_H_ +#define _FCNTL_H_ + +#ifndef _SYS_FCNTL_H_ +#include +#endif + +#endif + diff --git a/include/fnmatch.h b/include/fnmatch.h new file mode 100644 index 0000000..b69f587 --- /dev/null +++ b/include/fnmatch.h @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 1992, 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. + * + * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _FNMATCH_H_ +#define _FNMATCH_H_ + +#define FNM_NOMATCH 1 /* Match failed. */ + +#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ +#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ +#define FNM_PERIOD 0x04 /* Period must be matched by period. */ +#ifndef _POSIX_SOURCE +#define FNM_CASEFOLD 0x08 /* Case insensitive match (GNO-specific) */ +#endif + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +#ifndef _POSIX_SOURCE +int fnmatch __P((const char *, const char *, int)); +#endif +__END_DECLS + +#endif /* !_FNMATCH_H_ */ diff --git a/include/fts.h b/include/fts.h new file mode 100644 index 0000000..cbf875f --- /dev/null +++ b/include/fts.h @@ -0,0 +1,128 @@ +/* + * Copyright (c) 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. + * + * @(#)fts.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _FTS_H_ +#define _FTS_H_ + +typedef struct { + struct _ftsent *fts_cur; /* current node */ + struct _ftsent *fts_child; /* linked list of children */ + struct _ftsent **fts_array; /* sort array */ + dev_t fts_dev; /* starting device # */ + char *fts_path; /* path for this descent */ + int fts_rfd; /* fd for root */ + int fts_pathlen; /* sizeof(path) */ + int fts_nitems; /* elements in the sort array */ + int (*fts_compar)(const void *, const void *); + /* compare function */ + +#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */ +#define FTS_LOGICAL 0x002 /* logical walk */ +#define FTS_NOCHDIR 0x004 /* don't change directories */ +#define FTS_NOSTAT 0x008 /* don't get stat info */ +#define FTS_PHYSICAL 0x010 /* physical walk */ +#define FTS_SEEDOT 0x020 /* return dot and dot-dot */ +#define FTS_XDEV 0x040 /* don't cross devices */ +#define FTS_OPTIONMASK 0x07f /* valid user option mask */ + +#define FTS_NAMEONLY 0x080 /* (private) child names only */ +#define FTS_STOP 0x100 /* (private) unrecoverable error */ + int fts_options; /* fts_open options, global flags */ +} FTS; + +typedef struct _ftsent { + struct _ftsent *fts_cycle; /* cycle node */ + struct _ftsent *fts_parent; /* parent directory */ + struct _ftsent *fts_link; /* next file in directory */ + long fts_number; /* local numeric value */ + void *fts_pointer; /* local address value */ + char *fts_accpath; /* access path */ + char *fts_path; /* root path */ + int fts_errno; /* errno for this node */ + int fts_symfd; /* fd for symlink */ + u_short fts_pathlen; /* strlen(fts_path) */ + u_short fts_namelen; /* strlen(fts_name) */ + + ino_t fts_ino; /* inode */ + dev_t fts_dev; /* device */ + nlink_t fts_nlink; /* link count */ + +#define FTS_ROOTPARENTLEVEL -1 +#define FTS_ROOTLEVEL 0 + short fts_level; /* depth (-1 to N) */ + +#define FTS_D 1 /* preorder directory */ +#define FTS_DC 2 /* directory that causes cycles */ +#define FTS_DEFAULT 3 /* none of the above */ +#define FTS_DNR 4 /* unreadable directory */ +#define FTS_DOT 5 /* dot or dot-dot */ +#define FTS_DP 6 /* postorder directory */ +#define FTS_ERR 7 /* error; errno is set */ +#define FTS_F 8 /* regular file */ +#define FTS_INIT 9 /* initialized only */ +#define FTS_NS 10 /* stat(2) failed */ +#define FTS_NSOK 11 /* no stat(2) requested */ +#define FTS_SL 12 /* symbolic link */ +#define FTS_SLNONE 13 /* symbolic link without target */ + u_short fts_info; /* user flags for FTSENT structure */ + +#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ +#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ + u_short fts_flags; /* private flags for FTSENT structure */ + +#define FTS_AGAIN 1 /* read node again */ +#define FTS_FOLLOW 2 /* follow symbolic link */ +#define FTS_NOINSTR 3 /* no instructions */ +#define FTS_SKIP 4 /* discard node */ + u_short fts_instr; /* fts_set() instructions */ + + struct stat *fts_statp; /* stat(2) information */ + char fts_name[1]; /* file name */ +} FTSENT; + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +FTSENT *fts_children __P((FTS *, int)); +int fts_close __P((FTS *)); +FTS *fts_open __P((char * const *, int, + int (*)(const FTSENT **, const FTSENT **))); +FTSENT *fts_read __P((FTS *)); +int fts_set __P((FTS *, FTSENT *, int)); +__END_DECLS + +#endif /* !_FTS_H_ */ diff --git a/include/glob.h b/include/glob.h new file mode 100644 index 0000000..b4d60b8 --- /dev/null +++ b/include/glob.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Guido van Rossum. + * + * 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. + * + * @(#)glob.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _GLOB_H_ +#define _GLOB_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +struct stat; +typedef struct { + int gl_pathc; /* Count of total paths so far. */ + int gl_matchc; /* Count of paths matching pattern. */ + int gl_offs; /* Reserved at beginning of gl_pathv. */ + int gl_flags; /* Copy of flags parameter to glob. */ + char **gl_pathv; /* List of paths matching pattern. */ + /* Copy of errfunc parameter to glob. */ + int (*gl_errfunc) __P((const char *, int)); + + /* + * Alternate filesystem access methods for glob; replacement + * versions of closedir(3), readdir(3), opendir(3), stat(2) + * and lstat(2). + */ + void (*gl_closedir) __P((void *)); + struct dirent *(*gl_readdir) __P((void *)); + void *(*gl_opendir) __P((const char *)); + int (*gl_lstat) __P((const char *, struct stat *)); + int (*gl_stat) __P((const char *, struct stat *)); +} glob_t; + +#define GLOB_APPEND 0x0001 /* Append to output from previous call. */ +#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ +#define GLOB_ERR 0x0004 /* Return on error. */ +#define GLOB_MARK 0x0008 /* Append / to matching directories. */ +#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */ +#define GLOB_NOSORT 0x0020 /* Don't sort. */ + +#ifndef _POSIX_SOURCE +#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ +#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ +#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ +#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ +#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ +#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ +#endif + +#define GLOB_NOSPACE (-1) /* Malloc call failed. */ +#define GLOB_ABEND (-2) /* Unignored error. */ + +__BEGIN_DECLS +int glob __P((const char *, int, int (*)(const char *, int), glob_t *)); +void globfree __P((glob_t *)); +__END_DECLS + +#endif /* !_GLOB_H_ */ diff --git a/include/gno/conf.h b/include/gno/conf.h new file mode 100644 index 0000000..e93ec1b --- /dev/null +++ b/include/gno/conf.h @@ -0,0 +1,32 @@ +/* + * conf.h -- Configuration and size constants. Note that most of these + * are meaningless on the IIgs. + * + * $Id: conf.h,v 1.1 1997/02/28 04:42:06 gdr Exp $ + */ + +#ifndef _GNO_CONF_H_ +#define _GNO_CONF_H_ + +/* + * the following defines can be changed but not deleted + */ + +#define NPROC 32 /* max user processes */ + +/* + * the following defines can be changed or deleted + */ + +#define GNOVERSION \ + "for GS/OS 3.0 on Apple IIgs (65816) (5/28/91) - Jawaid Bazyar" +#define MESSAGE /* message passing available */ +#define NSEM 50 /* total number of semaphores */ +#define RTCLOCK /* system has a real-time clock */ +#define QUANTUM 100 /* milliseconds a process is allowed + to run without being rescheduled */ + +#define DEBUG_RESCHED /* if defined, displays information + about the processes being scheduled */ + +#endif /* _GNO_CONF_H_ */ diff --git a/include/gno/gno.h b/include/gno/gno.h new file mode 100644 index 0000000..da42151 --- /dev/null +++ b/include/gno/gno.h @@ -0,0 +1,118 @@ +/* + * gno/gno.h This collection of declarations are for routines that + * reside in libc, but are Apple IIgs or GNO specific. + * + * $Id: gno.h,v 1.1 1997/02/28 04:42:06 gdr Exp $ + */ + +#ifndef _GNO_GNO_H_ +#define _GNO_GNO_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +#ifndef _SYS_TYPES_H_ +#include +#endif + +#ifndef __TYPES__ +#include +#endif + +#ifndef _STDLIB_H_ +#include +#endif + +#ifndef udispatch +#define udispatch 0xE10008 +#endif + +/* Arguments to setdebug(2) -- unverified */ +#define dbgGSOS 0x0001 +#define dbgPATH 0x0002 +#define dbgERROR 0x0004 +#define dbgSIG 0x0008 +#define dbgSYSCALL 0x0010 +#define dbgPBLOCK 0x0020 + +/* Environment Information */ +char * __prognameGS __P((void)); +char * buildCmd __P((char * const *)); +int buildEnv __P((char * const *)); +char * buildPath __P((const char *)); +int isRootPath __P((const char *)); +int needsgno __P((void)); +int setdebug __P((int)); +void * setsystemvector __P((void *)); +int InstallNetDriver __P((caddr_t netcore, short domain)); +void SetGNOQuitRec __P((word pCount, GSStringPtr pathname, + word flags)); +#if defined(__ORCAC__) && !defined(__KERN_STATUS) +#define __KERN_STATUS /* conflict with */ +pascal int kernVersion(void) inline(0x0403, udispatch); +pascal int kernStatus(void) inline(0x0603, udispatch); +#endif + +/* Stack Checking */ +void _beginStackCheck __P((void)); +int _endStackCheck __P((void)); + +/* String Conversions */ +#define GIfree(a) free(a) +#define GOfree(a) free(a) + +GSStringPtr __C2GS __P((const char *, GSStringPtr)); +GSStringPtr __C2GSMALLOC __P((const char *)); +char * __GS2C __P((char *, const GSStringPtr)); +char * __GS2CMALLOC __P((const GSStringPtr)); +GSStringPtr GIinit __P((word, const char *)); +GSStringPtr GIchange __P((GSStringPtr, word, const char *)); +ResultBufPtr GOinit __P((word, const char *)); +ResultBufPtr GOchange __P((ResultBufPtr, word, const char *)); + +/* Mapping */ +char * _mapPath __P((char *)); +GSStringPtr _mapPathGS __P((GSStringPtr)); +int _getPathMapping __P((void)); +int _setPathMapping __P((int)); +mode_t _mapMode2GS __P((mode_t)); +mode_t _mapMode2Unix __P((mode_t)); +int _getModeEmulation __P((void)); +int _setModeEmulation __P((int)); +int _mapErr __P((int)); + +/* Message Passing IPC */ +int procsend __P((pid_t, unsigned long)); +unsigned long procreceive __P((void)); +unsigned long procrecvtim __P((short)); +unsigned long procrecvclr __P((void)); + +/* Job Control */ +int tcnewpgrp __P((int)); +int tctpgrp __P((int, pid_t)); +int settpgrp __P((int)); + +/* Semaphores */ +int scount __P((int)); +int screate __P((int)); +int sdelete __P((int)); +int ssignal __P((int)); +int swait __P((int)); + +/* Timers */ +unsigned long alarm10 __P((unsigned long tenths)); + +/* Network */ +int InstallNetDriver __P((void *pr_usrreq, int domain)); + +/* Kernel Virtual Memory */ +#ifdef KERNEL +kvm_t * kvm_open __P((void)); /* non-BSD */ +int kvm_close __P((kvm_t *)); +struct pentry * kvm_getproc __P((kvm_t *, pid_t)); +struct pentry * kvm_nextproc __P((kvm_t *)); +int kvm_setproc __P((kvm_t *)); +#endif + +#endif /* _GNO_GNO_H_ */ diff --git a/include/gno/kerntool.h b/include/gno/kerntool.h new file mode 100644 index 0000000..d51e958 --- /dev/null +++ b/include/gno/kerntool.h @@ -0,0 +1,90 @@ +/* + * ToolBox interface file for the GNO version 1.0.6 Kernel. + * + * Copyright 1991-1996, Procyon Inc. + * + * $Id: kerntool.h,v 1.1 1997/02/28 04:42:06 gdr Exp $ + */ + +#ifndef _GNO_KERNTOOL_H_ +#define _GNO_KERNTOOL_H_ + +#ifndef _SYS_TYPES_H_ +#include +#endif + +#ifndef __TYPES__ +#include +#endif + +#ifndef udispatch +#define udispatch 0xE10008 +#endif + +pascal void kernBootInit(void) inline(0x0103, udispatch); +pascal void kernStartUp(void) inline(0x0203, udispatch); +pascal void kernShutDown(void) inline(0x0303, udispatch); +pascal void kernReset(void) inline(0x0503, udispatch); + +#if defined(__ORCAC__) && !defined(__KERN_STATUS) +#define __KERN_STATUS /* conflict with */ +pascal int kernVersion(void) inline(0x0403, udispatch); +pascal int kernStatus(void) inline(0x0603, udispatch); +#endif + +/* 0x0703, 0x0803 undocumented */ +pascal int Kgetpid(void) inline(0x0903, udispatch); +pascal int Kkill(int pid, int sig) inline (0x0A03, udispatch); +pascal int Kfork(void *subr) inline(0x0B03, udispatch); +pascal int Kexec(char *filename,char *cmdline) inline(0x0C03, udispatch); +pascal int Kswait(int sem) inline(0x0D03, udispatch); +pascal int Kssignal(int sem) inline(0x0E03, udispatch); +pascal int Kscreate(int count) inline(0x0F03, udispatch); +pascal int Ksdelete(int sem) inline(0x1003, udispatch); +/* kvm 1103 thru 1503 */ +pascal void * Ksignal(int sig, void (*func)()) inline(0x1603, udispatch); +pascal int Kwait(union wait *status) inline(0x1703, udispatch); +pascal int Ktcnewpgrp(int fdtty) inline(0x1803, udispatch); +pascal int Ksettpgrp(int fdtty) inline(0x1903, udispatch); +pascal int Ktctpgrp(int fdtty, int pid) inline(0x1A03, udispatch); +pascal longword Ksigsetmask(longword mask) inline(0x1B03, udispatch); +pascal longword Ksigblock(longword mask) inline(0x1C03, udispatch); +# pascal int K_execve(char *filename,char *cmdline) + inline(0x1D03,udispatch); +#pascal longword Kalarm(longword seconds) inline(0x1E03,udispatch); +pascal int Ksetdebug(int code) inline(0x1F03,udispatch); +pascal void * Ksetsystemvector(void *vect) inline(0x2003,udispatch); +pascal int Ksigpause(longword mask) inline(0x2103,udispatch); + +pascal int Kdup(int filedes) + Kdup2 + Kpipe + Kgetpgrp + Kioctl + Kstat + Kfstat + Klstat + Kgetuid + Kgetgid + Kgeteuid + Kgetegid + Ksetuid + Ksetgid + Kprocsend + Kprocreceive + Krecvclr + Krecvtim + Ksetpgrp + Ktimes + Kpcreate + Kpsend + Kpreceive + Kpdelete + Kpreset + Kpbind + Kpgetport + Kpgetcount + Kscount + Kfork2 + +#endif /* _GNO_KERNTOOL_H_ */ diff --git a/include/gno/kvm.h b/include/gno/kvm.h new file mode 100644 index 0000000..9a59726 --- /dev/null +++ b/include/gno/kvm.h @@ -0,0 +1,41 @@ +/* + * Kernel VM access routines + * written June 4, 1991 by Jawaid Bazyar + * mod. October 17, 1991 for new call paradigm + * Copyright 1991-1996 Procyon, Inc. + * + * Note that there is absolutely no VM involved here, I simply kept the + * same names as BSD/SunOS for compatibility. + * + * $Id: kvm.h,v 1.1 1997/02/28 04:42:06 gdr Exp $ + */ + +#ifndef _GNO_KVM_H_ +#define _GNO_KVM_H_ + +#ifndef __TYPES__ +#include +#endif + +#ifndef _GNO_PROC_H_ +#include +#endif + +struct kvmt { + int procIndex; /* don't futz with this */ + int pid; /* you can use this to determine pid */ + struct pentry kvm_pent; +}; +typedef struct kvmt kvmt; + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +kvmt * kvm_open __P((void)); +int kvm_close __P((kvmt *k)); +struct pentry * kvmgetproc __P((kvmt *kd, int pid)); +struct pentry * kvmnextproc __P((kvmt *kd)); +int kvmsetproc __P((kvmt *kd)); + +#endif /* _GNO_KVM_H_ */ diff --git a/include/gno/proc.h b/include/gno/proc.h new file mode 100644 index 0000000..ccd22be --- /dev/null +++ b/include/gno/proc.h @@ -0,0 +1,157 @@ +/* + * Kernel Process table structure + * Copyright 1991-1996 Procyon, Inc. + * + * $Id: proc.h,v 1.1 1997/02/28 04:42:06 gdr Exp $ + */ + +#ifndef _GNO_PROC_H_ +#define _GNO_PROC_H_ + +#ifndef __TYPES__ +#include +#endif + +#ifndef _SYS_SIGNAL_H_ +#include +#endif + +/* the various process states are defined here */ + +#define procUNUSED 0 +#define procRUNNING 1 +#define procREADY 2 +#define procBLOCKED 3 +#define procNEW 4 +#define procSUSPENDED 5 +#define procWAIT 6 +#define procWAITSIGCH 7 +#define procPAUSED 8 +#define procSLEEP 9 + +#define BLOCKED_RECEIVE 2 +#define BLOCKED_PRECEIVE 3 + +#define SYSERR -1 +#define SYSOK 0 + +#define rtGSOS 0 +#define rtPIPE 1 +#define rtTTY 2 +#define rtSOCKET 3 + +#define rfPIPEREAD 1 /* read end of the pipe */ +#define rfPIPEWRITE 2 /* write end of the pipe */ +#define rfCLOSEEXEC 4 /* close this file on an exec() */ +#define rfP16NEWL 8 /* special prodos-16 newline mode */ + +typedef struct fdentry { + word refNum; /* refNum, pipeNum, ttyID, or sockNum */ + word refType; /* 0 = GS/OS refnum, 1 = pipe, 2 = tty, 3 = socket */ + word refLevel; /* "file level" of the refnum */ + word refFlags; /* see flags above */ + word NLenableMask; /* these three fields are for newline handling */ + word NLnumChars; + void *NLtable; +} fdentry, *fdentryPtr; + +typedef struct fdtable { + word fdCount; + word fdLevel; + word fdLevelMode; + word fdTableSize; + fdentry fds[1]; +} fdtable, *fdtablePtr; + +#define FD_SIZE 32 + +typedef struct quitStack { + struct quitStack *next; + char data[1]; +} quitStack; + +/* these flags are set by _execve() and fork() during process creation. */ + +#define FL_RESOURCE 1 /* does the process have and use a resource fork? */ +#define FL_FORKED 2 /* was the process started with fork() ? */ +#define FL_COMPLIANT 4 /* is the process fully GNO compliant? */ +#define FL_NORMTERM 8 /* did the program terminate via exit()? 1=yes */ +#define FL_RESTART 16 /* is the program restartable? (set by QuitGS) */ +#define FL_NORESTART 32 /* don't allow this code to restart */ +#define FL_QDSTARTUP 64 /* flag set if QDStartUp was called */ +#define FL_MSGRECVD 128 /* flag set if there's a send() msg waiting */ +#define FL_SELECTING 256 /* this process is 'selecting' */ + +struct pentry { + int parentpid; /* pid of this process' parent */ + int processState; + int userID; /* a GS/OS UserID, used to keep track of memory */ + int ttyID; /* driver (not GS/OS) number of i/o port */ + word irq_A; /* context information for the process */ + word irq_X; + word irq_Y; + word irq_S; + word irq_D; + byte irq_B; + byte irq_B1; + word irq_P; + word irq_state; + word irq_PC; + word irq_K; + int psem; /* semaphoreID process is blocked on */ + char **prefix; /* cwd's (GS/OS prefixes 0,1, and 9 */ + char *args; /* the command line that invoked the process program */ + char **env; /* environment variables for the program */ + struct sigrec *siginfo; /* global mask of which signals are blocked */ + byte irq_SLTROM; + byte irq_STATEREG; + word lastTool; + longword ticks; + word flags; + fdtablePtr openFiles; + word pgrp; + word exitCode; + void *LInfo; + word stoppedState; /* process state before stoppage */ + longword alarmCount; + void *executeHook; /* for a good time call... */ + word queueLink; +#ifdef KERNEL + chldInfoPtr waitq; /* where waits wait to be processed */ +#else + void *waitq; +#endif + int waitdone; + int flpid; + quitStack *returnStack; + word t2StackPtr; + word p_uid, p_gid; + word p_euid, p_egid; + word SANEwap; + longword msg; + longword childTicks; + unsigned long p_waitvec; + unsigned p_slink; + struct pentry *p_link,*p_rlink; + int p_prio; + /* no unused entries */ +}; +typedef struct pentry procState, *procStatePtr; + +#ifdef KERNEL +struct kernelStruct { + procState procTable[32]; + int curProcInd; + int userID; + int mutex; + int timeleft; + int numProcs; + word truepid; + word shutdown; + word gsosDebug; + int floatingPID; +}; +typedef struct kernelStruct kernelStruct, *kernelStructPtr; + +#endif /* KERNEL */ +#endif /* _GNO_PROC_H_ */ diff --git a/include/gno/sim.h b/include/gno/sim.h new file mode 100644 index 0000000..c718b82 --- /dev/null +++ b/include/gno/sim.h @@ -0,0 +1,46 @@ +/* + * Serial Interrupt Manager + * C Interface File + * Copyright 1993-1996, Procyon Enterprises Incorporated + * + * Free distribution is hereby granted for use with the SIM tool. + * + * $Id: sim.h,v 1.1 1997/02/28 04:42:06 gdr Exp $ + */ + +#ifndef _GNO_SIM_H_ +#define _GNO_SIM_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +extern int SIMVERSION __P((int *versionPtr)); +extern int INSTALLINTVECT __P((int port, unsigned long address)); +extern int REMOVEINTVECT __P((int port, unsigned long address)); + +#define SIMVersion SIMVERSION +#define InstallIntVect INSTALLINTVECT +#define RemoveIntVect REMOVEINTVECT + +#define SIMPrinterPort 1 +#define SIMModemPort 2 +#define SIMIRQ0 3 +#define SIMIRQ1 4 +#define SIMIRQ2 5 +#define SIMIRQ3 6 +#define SIMIRQ4 7 +#define SIMIRQ5 8 +#define SIMIRQ6 9 +#define SIMIRQ7 10 + +#define SIMNoError 0 +#define SIMAlreadyInst 1 +#define SIMInvalidAddr 2 +#define SIMATalkActive 3 +#define SIMNotInstalled 4 +#define SIMInvalidPort 5 +#define SIMNotFound 6 +#define SIMNO8259 7 + +#endif /* _GNO_SIM_H_ */ diff --git a/include/grp.h b/include/grp.h new file mode 100644 index 0000000..19b84c8 --- /dev/null +++ b/include/grp.h @@ -0,0 +1,71 @@ +/*- + * 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. + * + * @(#)grp.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _GRP_H_ +#define _GRP_H_ + +#ifndef _POSIX_SOURCE +#define _PATH_GROUP "/etc/group" +#endif + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + int gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +struct group *getgrgid __P((gid_t)); +struct group *getgrnam __P((const char *)); +#ifndef _POSIX_SOURCE +struct group *getgrent __P((void)); +int setgrent __P((void)); +void endgrent __P((void)); +void setgrfile __P((const char *)); +int setgroupent __P((int)); +#endif +__END_DECLS + +#endif /* !_GRP_H_ */ diff --git a/include/libutil.h b/include/libutil.h new file mode 100644 index 0000000..2f914dd --- /dev/null +++ b/include/libutil.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1995 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, is permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice immediately at the beginning of the file, without modification, + * 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. This work was done expressly for inclusion into FreeBSD. Other use + * is permitted provided this notation is included. + * 4. Absolutely no warranty of function or purpose is made by the author + * Peter Wemm. + * 5. Modifications may be freely made to this file providing the above + * conditions are met. + * + * $Id: libutil.h,v 1.1 1997/02/28 04:42:01 gdr Exp $ + */ + +#ifndef _LIBUTIL_H_ +#define _LIBUTIL_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +/* Avoid pulling in all the include files for no need */ +struct termios; +struct winsize; +struct utmp; + +__BEGIN_DECLS +void setproctitle __P((const char *fmt, ...)); +void login __P((struct utmp *ut)); +int login_tty __P((int fd)); +int logout __P((char *line)); +void logwtmp __P((char *line, char *name, char *host)); +int openpty __P((int *amaster, int *aslave, char *name, + struct termios *termp, struct winsize *winp)); +__END_DECLS + +#endif /* !_LIBUTIL_H_ */ diff --git a/include/limits.h b/include/limits.h new file mode 100644 index 0000000..f3f5480 --- /dev/null +++ b/include/limits.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1988, 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. + * + * @(#)limits.h 8.2 (Berkeley) 1/4/94 + */ + +#ifndef _LIMITS_H_ +#define _LIMITS_H_ + +#define _POSIX_ARG_MAX 1024 /* non-POSIX: was 4096 */ +#define _POSIX_CHILD_MAX 6 +#define _POSIX_LINK_MAX 1 /* non-POSIX */ +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_NAME_MAX 14 +#define _POSIX_NGROUPS_MAX 0 +#define _POSIX_OPEN_MAX 16 +#define _POSIX_PATH_MAX 255 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_TZNAME_MAX 3 + +#define _POSIX2_BC_BASE_MAX 99 +#define _POSIX2_BC_DIM_MAX 2048 +#define _POSIX2_BC_SCALE_MAX 99 +#define _POSIX2_BC_STRING_MAX 1000 +#define _POSIX2_EQUIV_CLASS_MAX 2 +#define _POSIX2_EXPR_NEST_MAX 32 +#define _POSIX2_LINE_MAX 2048 +#define _POSIX2_RE_DUP_MAX 255 + +#ifndef _MACHINE_LIMITS_H_ +#include +#endif +#ifndef _SYS_SYSLIMITS_H_ +#include +#endif + +#endif /* !_LIMITS_H_ */ diff --git a/include/machine/ansi.h b/include/machine/ansi.h new file mode 100644 index 0000000..8edc090 --- /dev/null +++ b/include/machine/ansi.h @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 1990, 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. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + * $Id: ansi.h,v 1.1 1997/02/28 04:42:07 gdr Exp $ + */ + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +/* + * Types which are fundamental to the implementation and must be declared + * in more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ unsigned long /* clock() */ +#define _BSD_PTRDIFF_T_ long /* non-BSD */ /* ptr1 - ptr2 */ +#define _BSD_SIZE_T_ unsigned long /* non-BSD */ /* sizeof() */ +#define _BSD_SSIZE_T_ long /* non-BSD *//* byte count or error */ +#define _BSD_TIME_T_ long /* time() */ + +/* + * Types which are fundamental to the implementation and must be used + * in more than one standard header although they are only declared in + * one (perhaps nonstandard) header are defined here. Standard headers + * use _BSD_XXX_T_ without undef'ing it. + */ +#define _BSD_OFF_T_ long /* non-BSD */ /* file offset */ +#define _BSD_PID_T_ short /* non-BSD */ /* process [group] */ + +#ifndef __va_list__ +#define __va_list__ +typedef char *__va_list[2]; +#endif + +#define _BSD_VA_LIST_ __va_list /* non-BSD: was 'char *' */ + +/* + * Runes (wchar_t) is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you + * lose a bit of ANSI conformance, but your programs will still work. + * + * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t + * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains + * defined for ctype.h. + */ + +/* + * BSD uses int (32 bit). Orca/C's ints are 16 bits, so there may be + * problems in the future. + */ +#define _BSD_WCHAR_T_ int /* wchar_t */ +#define _BSD_RUNE_T_ int /* rune_t */ + +/* + * Frequencies of the clock ticks reported by clock() and times(). They + * are the same as stathz for bogus historical reasons. They should be + * 1e6 because clock() and times() are implemented using getrusage() and + * there is no good reason why they should be less accurate. There is + * the bad reason that (broken) programs might not like clock_t or + * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough + * to hold the required 24 hours worth of ticks if the frequency is + * 1000000ul, and ``unsigned long long'' would be nonstandard). + */ +#define _BSD_CLK_TCK_ 60 /* non-BSD */ +#define _BSD_CLOCKS_PER_SEC_ 60 /* non-BSD */ + +#endif /* !_MACHINE_ANSI_H_ */ diff --git a/include/machine/endian.h b/include/machine/endian.h new file mode 100644 index 0000000..a089fa6 --- /dev/null +++ b/include/machine/endian.h @@ -0,0 +1,40 @@ +/* + * machine/endian.h for the IIgs. + * + * $Id: endian.h,v 1.1 1997/02/28 04:42:07 gdr Exp $ + */ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ 1 + +/* + * Define the order of 32-bit words in 64-bit words. + * + * These may cause problems under Orca/C as there is no base 64 bit + * type. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax, 65c816 */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#define BYTE_ORDER LITTLE_ENDIAN + +#define ntohl(x) ((0xff & (x)>>24) | (0xff00 & (x)>>8) | \ + (0xff0000 & (x)<<8) | (0xff000000 & (x)<<24)) +#define ntohs(x) ((0xff & (x)>>8) | (0xff00 & (x)<<8)) +#define htonl(x) ntohl(x) +#define htons(x) ntohs(x) + +#define NTOHL(x) ntohl(x) +#define NTOHS(x) ntohs(x) +#define HTONL(x) htonl(x) +#define HTONS(x) htons(x) + +#endif /* _MACHINE_ENDIAN_H_ */ diff --git a/include/machine/limits.h b/include/machine/limits.h new file mode 100644 index 0000000..2f26d62 --- /dev/null +++ b/include/machine/limits.h @@ -0,0 +1,46 @@ +/* + * $Id: limits.h,v 1.1 1997/02/28 04:42:07 gdr Exp $ + */ + +#ifndef _MACHINE_LIMITS_H_ +#define _MACHINE_LIMITS_H_ + +#define CHAR_BIT 8 /* number of bits in a char */ +#define MB_LEN_MAX 1 /* Allow 31 bit UTF2 */ + +/* + * According to ANSI (section 2.2.4.2), the values below must be usable by + * #if preprocessing directives. Additionally, the expression must have the + * same type as would an expression that is an object of the corresponding + * type converted according to the integral promotions. + */ + +#define SCHAR_MAX 127 /* min value for a signed char */ +#define SCHAR_MIN (-128) /* max value for a signed char */ + +#define CHAR_MAX 255u /* max value for a char */ +#define CHAR_MIN 0 /* min value for a char */ +#define UCHAR_MAX 255u /* max value for an unsigned char */ + +#define USHRT_MAX 65535u /* max value for an unsigned short */ +#define SHRT_MAX 32767 /* max value for a short */ +#define SHRT_MIN (-32767-1) /* min value for a short */ + +#define UINT_MAX 65535u /* max value for an unsigned int */ +#define INT_MAX 32767 /* max value for an int */ +#define INT_MIN (-32767-1) /* min value for an int */ + +#define ULONG_MAX 4294967295u /* max value for an unsigned long */ +#define LONG_MAX 2147483647 /* max value for a long */ +#define LONG_MIN (-2147483647-1) /* min value for a long */ + +#if !defined(_ANSI_SOURCE) +#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */ + +#if !defined(_POSIX_SOURCE) +#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */ + +#endif /* !_POSIX_SOURCE */ +#endif /* !_ANSI_SOURCE */ + +#endif /* !_MACHINE_LIMITS_H_ */ diff --git a/include/machine/param.h b/include/machine/param.h new file mode 100644 index 0000000..d93e7c8 --- /dev/null +++ b/include/machine/param.h @@ -0,0 +1,28 @@ +/* + * machine/param.h + * + * Copyright 1991-1996, Procyon, Inc. + * All Rights Reserved + * + * $Id: param.h,v 1.1 1997/02/28 04:42:07 gdr Exp $ + */ + +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ + +#define MACHINE "APPLEIIGS" + +#ifdef KERNEL /* non-BSD. Obsolete? */ +#define DAYSPERNYEAR 365 +#define SECSPERDAY 86400L +#endif + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#define ALIGNBYTES 0 +#define ALIGN(p) p + +#endif diff --git a/include/machine/signal.h b/include/machine/signal.h new file mode 100644 index 0000000..382aaed --- /dev/null +++ b/include/machine/signal.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1992-1996, Procyon, Inc. + * This file was pieced together from the BSD manpages and my own + * implementation. The definition of sigmask (with a modification to + * make ANSI happy) was borrowed straight from the BSD signal.h file. + */ + +#ifndef _MACHINE_SIGNAL_H_ +#define _MACHINE_SIGNAL_H_ + +typedef int sig_atomic_t; + +#ifndef _SYS_WAIT_H_ +#include +#endif + +typedef struct chldInfo { + struct chldInfo *next; + int pid; /* pid of terminated process */ + union wait status; /* exit status of terminated process */ +} chldInfo, *chldInfoPtr; + +#ifdef KERNEL + +#ifndef _SYS_SIGNAL_H_ +#include +#endif + +struct sigrec { + unsigned long signalmask; + unsigned long sigpending; /* describes which signals are pending */ + void (*v_signal[NSIG])(int, int); + unsigned long u_sigmask[NSIG]; + unsigned long u_oldmask; /* for sigpause & sigblock */ + int sigindex; /* which signal to check next for processing */ +}; +#endif /* KERNEL */ + +#endif diff --git a/include/machine/types.h b/include/machine/types.h new file mode 100644 index 0000000..edd9acb --- /dev/null +++ b/include/machine/types.h @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 1990, 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. + * + * @(#)types.h 8.3 (Berkeley) 1/5/94 + * $Id: types.h,v 1.1 1997/02/28 04:42:07 gdr Exp $ + */ + +#ifndef _MACHTYPES_H_ +#define _MACHTYPES_H_ + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +typedef struct _physadr { + int r[1]; +} *physadr; + +#if 1 /* for GNO */ +typedef int label_t[13]; +#else /* for BSD */ +typedef struct label_t { + int val[6]; +} label_t; +#endif +#endif + +typedef unsigned long vm_offset_t; +typedef unsigned long vm_size_t; + +#if (__STDC__ != 1) || defined(_IN_KERNEL) /* GNO-specific */ +typedef unsigned short iord_t; +typedef unsigned short pgadr_t; +typedef char swck_t; +typedef unsigned_char use_t; +typedef long ubadr_t; +#define MAXUSE 255 +#endif /* (__STDC__ != 1) || defined(_IN_KERNEL) */ + +/* + * Basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#ifdef __STDC__ +typedef signed char int8_t; +#else +typedef signed char int8_t; +#endif +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef long int32_t; +typedef unsigned long u_int32_t; + +#if 0 +typedef long long int64_t; +typedef unsigned long long u_int64_t; +#endif + +#endif /* _MACHTYPES_H_ */ diff --git a/include/net/af.h b/include/net/af.h new file mode 100644 index 0000000..62c550e --- /dev/null +++ b/include/net/af.h @@ -0,0 +1,65 @@ +#if CMU +/* + ********************************************************************** + * Mach Operating System + * Copyright (c) 1986 Carnegie-Mellon University + * + * This software was developed by the Mach operating system + * project at Carnegie-Mellon University's Department of Computer + * Science. Software contributors as of May 1986 include Mike Accetta, + * Robert Baron, William Bolosky, Jonathan Chew, David Golub, + * Glenn Marcy, Richard Rashid, Avie Tevanian and Michael Young. + * + * Some software in these files are derived from sources other + * than CMU. Previous copyright and other source notices are + * preserved below and permission to use such software is + * dependent on licenses from those institutions. + * + * Permission to use the CMU portion of this software for + * any non-commercial research and development purpose is + * granted with the understanding that appropriate credit + * will be given to CMU, the Mach project and its authors. + * The Mach project would appreciate being notified of any + * modifications and of redistribution of this software so that + * bug fixes and enhancements may be distributed to users. + * + * All other rights are reserved to Carnegie-Mellon University. + ********************************************************************** + */ + +#endif CMU +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)af.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Address family routines, + * used in handling generic sockaddr structures. + * + * Hash routine is called + * af_hash(addr, h); + * struct sockaddr *addr; struct afhash *h; + * producing an afhash structure for addr. + * + * Netmatch routine is called + * af_netmatch(addr1, addr2); + * where addr1 and addr2 are sockaddr *. Returns 1 if network + * values match, 0 otherwise. + */ +struct afswitch { + int (*af_hash)(); + int (*af_netmatch)(); +}; + +struct afhash { + u_int afh_hosthash; + u_int afh_nethash; +}; + +#ifdef KERNEL +struct afswitch afswitch[]; +#endif diff --git a/include/net/dli.var.h b/include/net/dli.var.h new file mode 100644 index 0000000..ecd3fed --- /dev/null +++ b/include/net/dli.var.h @@ -0,0 +1,49 @@ +/* + * Mach Operating System + * Copyright (c) 1987 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + * + ********************************************************************** + * HISTORY + * 06-May-87 Mike Accetta (mja) at Carnegie-Mellon University + * Created. + * [ V5.1(F10) ] + * + ********************************************************************** + */ + + + +/* + * Data-link interface address structure. + * + * The standard interface address header plus a pointer to the DLI protocol + * specific block. + */ +struct dli_ifaddr { + struct ifaddr da_ifa; +#define da_addr da_ifa.ifa_addr +#define da_broadaddr da_ifa.ifa_broadaddr +#define da_ifp da_ifa.ifa_ifp + struct dli_var *da_dlv; +}; + + +/* + * Per-interface data block + * + * Each network device driver which supports this protocol will allocate + * one of these blocks for each network interface with which it is + * configured. The driver will call dli_init() with the appropriate + * parameters to initialize the block and DLI protocol for the interface + * every time that it is initialized. + */ +struct dli_var { + struct dli_ifaddr dlv_da; /* interface address (linked into the */ + /* master address list for the interface) */ + struct sockproto dlv_rproto; /* protocol of current input packet */ + struct sockaddr dlv_rsrc; /* src addr of current input packet */ + u_char dlv_hln; /* hardware address length (bytes) */ + u_char dlv_lhl; /* local interface header length (bytes) */ +}; diff --git a/include/net/etherdefs.h b/include/net/etherdefs.h new file mode 100644 index 0000000..799a2f7 --- /dev/null +++ b/include/net/etherdefs.h @@ -0,0 +1,63 @@ +/* + * Mach Operating System + * Copyright (c) 1987 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + * + * HISTORY + * 09-Apr-90 Bradley Taylor (btaylor) at NeXT, Inc. + * Created. Originally part of . + */ +#ifndef _ETHERDEFS_ +#define _ETHERDEFS_ + +/* + * Ethernet address - 6 octets + */ +struct ether_addr { + u_char ether_addr_octet[6]; +}; + +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + u_char ether_dhost[6]; + u_char ether_shost[6]; + u_short ether_type; +}; + +#define IFTYPE_ETHERNET "10MB Ethernet" + +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ +#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP (SUN_RPC) */ + +/* + * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have + * (type-ETHERTYPE_TRAIL)*512 bytes of data followed + * by an ETHER type (as given above) and then the (variable-length) header. + */ +#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ +#define ETHERTYPE_NTRAILER 16 + + +#define ETHERHDRSIZE 14 +#define ETHERMTU 1500 + +#define ETHERMIN (60-ETHERHDRSIZE) + +#endif /* _ETHERDEFS_ */ diff --git a/include/net/if.arp.h b/include/net/if.arp.h new file mode 100644 index 0000000..8c6d45b --- /dev/null +++ b/include/net/if.arp.h @@ -0,0 +1,70 @@ +/* + * Mach Operating System + * Copyright (c) 1987 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + */ + +/* + * Copyright (c) 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_arp.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * HISTORY + * 20-Oct-87 Peter King (king) at NeXT, Inc. + * SUN_RPC: Added Sun's RARP support. + */ + +/* @(#)if_arp.h 2.1 88/05/18 4.0NFSSRC SMI; from UCB 7.1 6/5/86 */ + +/* + * Address Resolution Protocol. + * + * See RFC 826 for protocol description. ARP packets are variable + * in size; the arphdr structure defines the fixed-length portion. + * Protocol type values are the same as those for 10 Mb/s Ethernet. + * It is followed by the variable-sized fields ar_sha, arp_spa, + * arp_tha and arp_tpa in that order, according to the lengths + * specified. Field names used correspond to RFC 826. + */ +struct arphdr { + u_short ar_hrd; /* format of hardware address */ +#define ARPHRD_ETHER 1 /* ethernet hardware address */ + u_short ar_pro; /* format of protocol address */ + u_char ar_hln; /* length of hardware address */ + u_char ar_pln; /* length of protocol address */ + u_short ar_op; /* one of: */ +#define ARPOP_REQUEST 1 /* request to resolve address */ +#define ARPOP_REPLY 2 /* response to previous request */ +#define REVARP_REQUEST 3 /* Reverse ARP request (SUN_RPC) */ +#define REVARP_REPLY 4 /* Reverse ARP reply (SUN_RPC) */ +/* + * The remaining fields are variable in size, + * according to the sizes above. + */ +#ifdef notdef + u_char ar_sha[]; /* sender hardware address */ + u_char ar_spa[]; /* sender protocol address */ + u_char ar_tha[]; /* target hardware address */ + u_char ar_tpa[]; /* target protocol address */ +#endif +}; + +/* + * ARP ioctl request + */ +struct arpreq { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ +}; +/* arp_flags and at_flags field values */ +#define ATF_INUSE 0x01 /* entry in use */ +#define ATF_COM 0x02 /* completed entry (enaddr valid) */ +#define ATF_PERM 0x04 /* permanent entry */ +#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ +#define ATF_USETRAILERS 0x10 /* has requested trailers */ diff --git a/include/net/if.h b/include/net/if.h new file mode 100644 index 0000000..be1ae81 --- /dev/null +++ b/include/net/if.h @@ -0,0 +1,253 @@ +/* + * 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. + * + * @(#)if.h 7.1 (Berkeley) 6/4/86 + */ +#ifndef _IF_ +#define _IF_ 1 + +/* + * Structures defining a network interface, providing a packet + * transport mechanism (ala level 0 of the PUP protocols). + * + * Each interface accepts output datagrams of a specified maximum + * length, and provides higher level routines with input datagrams + * received from its medium. + * + * Output occurs when the routine if_output is called, with three parameters: + * (*ifp->if_output)(ifp, m, dst) + * Here m is the mbuf chain to be sent and dst is the destination address. + * The output routine encapsulates the supplied datagram if necessary, + * and then transmits it on its medium. + * + * On input, each interface unwraps the data received by it, and either + * places it on the input queue of a internetwork datagram routine + * and posts the associated software interrupt, or passes the datagram to a raw + * packet input routine. + * + * Routines exist for locating interfaces by their addresses + * or for locating a interface on a certain network, as well as more general + * routing and gateway routines maintaining information used to locate + * interfaces. These routines live in the files if.c and route.c + */ + +#if NeXT +#include +#include +#endif /* NeXT */ + +/* + * Structure defining a queue for a network interface. + * + * (Would like to call this struct ``if'', but C isn't PL/1.) + */ +struct ifnet { + char *if_name; /* name, e.g. ``en'' or ``lo'' */ +#if NeXT + char *if_type; /* type of interface */ +#endif /* NeXT */ + short if_unit; /* sub-unit for lower level driver */ + short if_mtu; /* maximum transmission unit */ + short if_flags; /* up/down, broadcast, etc. */ +#if NeXT +#else /* NeXT */ + short if_timer; /* time 'til if_watchdog called */ +#endif /* NeXT */ + int if_metric; /* routing metric (external only) */ +#if NeXT + int if_class; /* class of interface */ +#endif /* NeXT */ + struct ifaddr *if_addrlist; /* linked list of addresses per if */ + struct ifqueue { + struct mbuf *ifq_head; + struct mbuf *ifq_tail; + int ifq_len; + int ifq_maxlen; + int ifq_drops; + } if_snd; /* output queue */ +/* procedure handles */ + int (*if_init)(); /* init routine */ + int (*if_output)(); /* output routine */ +#if NeXT + int (*if_control)(); /* control routine */ + int (*if_input)(); /* input routine */ + netbuf_t (*if_getbuf)(); /* get buffer routine */ +#else /* NeXT */ + int (*if_ioctl)(); /* ioctl routine */ + int (*if_reset)(); /* bus reset routine */ + int (*if_watchdog)(); /* timer routine */ +#endif /* NeXT */ +/* generic interface statistics */ + int if_ipackets; /* packets received on interface */ + int if_ierrors; /* input errors on interface */ + int if_opackets; /* packets sent on interface */ + int if_oerrors; /* output errors on interface */ + int if_collisions; /* collisions on csma interfaces */ +#if NeXT + void *if_private; /* private to interface */ +#endif /* NeXT */ +/* end statistics */ + struct ifnet *if_next; +}; + +#if NeXT +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_POINTTOPOINT 0x10 /* interface is point-to-point link */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ +#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ +#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_NOARP 0x80 /* no address resolution protocol */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ +#define IFF_DIALUP 0x400 /* For ISDN */ +#else /* NeXT */ +#endif /* NeXT */ + +#if NeXT +/* flags set internally only: */ +#define IFF_CANTCHANGE (IFF_BROADCAST|IFF_POINTTOPOINT|IFF_RUNNING|IFF_AUTOCONF|IFF_AUTODONE) +#else /* NeXT */ +/* flags set internally only: */ +#define IFF_CANTCHANGE (IFF_BROADCAST | IFF_POINTTOPOINT | IFF_RUNNING) +#endif /* NeXT */ + +/* + * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) + * input routines have queues of messages stored on ifqueue structures + * (defined above). Entries are added to and deleted from these structures + * by these macros, which should be called with ipl raised to splimp(). + */ +#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) +#define IF_DROP(ifq) ((ifq)->ifq_drops++) +#define IF_ENQUEUE(ifq, m) { \ + (m)->m_act = 0; \ + if ((ifq)->ifq_tail == 0) \ + (ifq)->ifq_head = m; \ + else \ + (ifq)->ifq_tail->m_act = m; \ + (ifq)->ifq_tail = m; \ + (ifq)->ifq_len++; \ +} +#define IF_PREPEND(ifq, m) { \ + (m)->m_act = (ifq)->ifq_head; \ + if ((ifq)->ifq_tail == 0) \ + (ifq)->ifq_tail = (m); \ + (ifq)->ifq_head = (m); \ + (ifq)->ifq_len++; \ +} +/* + * Packets destined for level-1 protocol input routines + * have a pointer to the receiving interface prepended to the data. + * IF_DEQUEUEIF extracts and returns this pointer when dequeueing the packet. + * IF_ADJ should be used otherwise to adjust for its presence. + */ +#define IF_ADJ(m) { \ + (m)->m_off += sizeof(struct ifnet *); \ + (m)->m_len -= sizeof(struct ifnet *); \ + if ((m)->m_len == 0) { \ + struct mbuf *n; \ + MFREE((m), n); \ + (m) = n; \ + } \ +} +#define IF_DEQUEUEIF(ifq, m, ifp) { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_act) == 0) \ + (ifq)->ifq_tail = 0; \ + (m)->m_act = 0; \ + (ifq)->ifq_len--; \ + (ifp) = *(mtod((m), struct ifnet **)); \ + IF_ADJ(m); \ + } \ +} +#define IF_DEQUEUE(ifq, m) { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_act) == 0) \ + (ifq)->ifq_tail = 0; \ + (m)->m_act = 0; \ + (ifq)->ifq_len--; \ + } \ +} + +#define IFQ_MAXLEN 50 +#define IFNET_SLOWHZ 1 /* granularity is 1 second */ + +/* + * The ifaddr structure contains information about one address + * of an interface. They are maintained by the different address families, + * are allocated and attached when an address is set, and are linked + * together so all addresses for an interface can be located. + */ +struct ifaddr { + struct sockaddr ifa_addr; /* address of interface */ + union { + struct sockaddr ifu_broadaddr; + struct sockaddr ifu_dstaddr; + } ifa_ifu; +#define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ +#define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of p-to-p link */ + struct ifnet *ifa_ifp; /* back-pointer to interface */ + struct ifaddr *ifa_next; /* next address for interface */ +}; + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ +struct ifreq { +#define IFNAMSIZ 16 + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + short ifru_flags; + short ifru_mtu; + u_long ifru_asyncmap; /* For PPP */ + int ifru_metric; + caddr_t ifru_data; + } ifr_ifru; +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu for PPP*/ +#define ifr_asyncmap ifr_ifru.ifru_asyncmap /* async control char map */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +}; + +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ +struct ifconf { + int ifc_len; /* size of associated buffer */ + union { + caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ +}; + +#include +#ifdef KERNEL +struct ifqueue rawintrq; /* raw packet input queue */ +struct ifnet *ifnet; +struct ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet(); +struct ifaddr *ifa_ifwithdstaddr(); +#endif /* KERNEL */ + +#endif /* _IF_ */ diff --git a/include/net/netbuf.h b/include/net/netbuf.h new file mode 100644 index 0000000..4d01b01 --- /dev/null +++ b/include/net/netbuf.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 1990 by NeXT, Inc., All Rights Reserved + * + */ + +/* + * Network Buffer API (for kernel use only) + * + * HISTORY + * 09-Apr-90 Bradley Taylor (btaylor) at NeXT, Inc. + * Created. + */ +#ifndef _NETBUF_ +#define _NETBUF_ + +typedef struct { char opaque[1]; } *netbuf_t; + +#ifdef KERNEL + +extern char *nb_map(netbuf_t nb); +extern netbuf_t nb_alloc(unsigned size); +extern netbuf_t nb_alloc_wrapper(void *data, unsigned size, + void freefunc(void *), void *freefunc_arg); + +extern void nb_free(netbuf_t nb); +extern void nb_free_wrapper(netbuf_t nb); +extern unsigned nb_size(netbuf_t nb); +extern int nb_read(netbuf_t nb, unsigned offset, unsigned size, void *target); +extern int nb_write(netbuf_t nb, unsigned offset, unsigned size, void *source); +extern int nb_shrink_top(netbuf_t nb, unsigned size); +extern int nb_grow_top(netbuf_t nb, unsigned size); +extern int nb_shrink_bot(netbuf_t nb, unsigned size); +extern int nb_grow_bot(netbuf_t nb, unsigned size); + +#endif /* KERNEL */ +#endif /* _NETBUF_ */ diff --git a/include/net/netif.h b/include/net/netif.h new file mode 100644 index 0000000..d6f6f06 --- /dev/null +++ b/include/net/netif.h @@ -0,0 +1,150 @@ +/* + * Copyright (C) 1990 by NeXT, Inc., All Rights Reserved + * + */ + +/* + * Network Interface API + * + * HISTORY + * 09-Apr-90 Bradley Taylor (btaylor) at NeXT, Inc. + * Created. Some parts originally part of . + */ +#ifndef _NETIF_ +#define _NETIF_ + +#import + +/* + * BEGIN: BSD copyrighted material + */ +/* + * 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. + * + */ +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_DEBUG 0x4 /* turn on debugging */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_POINTTOPOINT 0x10 /* interface is point-to-point link */ +#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ +#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ +#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_NOARP 0x80 /* no address resolution protocol */ +/* next two not supported now, but reserved: */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ +#define IFF_D1 0x400 /* For CSLIP */ +#define IFF_D2 0x800 /* For CSLIP */ +#define IFF_D3 0x1000 /* For CSLIP */ +#define IFF_COMPAC IFF_D1 /* For PPP */ +#define IFF_COMPPROT 0x2000 /* For PPP */ +/* + * END: BSD copyrighted material + */ + +#define IFF_AUTOCONF 0x4000 /* Network is autoconfiguring */ +#define IFF_AUTODONE 0x8000 /* Network has autoconfigured */ + +typedef enum netif_class { + NETIFCLASS_REAL = 0, + NETIFCLASS_VIRTUAL = 0x1000, + NETIFCLASS_SNIFFER = 0x2000 +} netif_class_t; + +#ifdef KERNEL + +extern const char IFCONTROL_SETFLAGS[]; +extern const char IFCONTROL_SETADDR[]; +extern const char IFCONTROL_GETADDR[]; +extern const char IFCONTROL_AUTOADDR[]; +extern const char IFCONTROL_UNIXIOCTL[]; + + +typedef struct if_ioctl { + unsigned ioctl_command; + void *ioctl_data; +} if_ioctl_t; + +typedef struct { char opaque[1]; } *netif_t; + + +typedef int (*if_input_func_t)(netif_t netif, netif_t realnetif, + netbuf_t nb, void *extra); +typedef int (*if_init_func_t)(netif_t netif); + +typedef int (*if_output_func_t)(netif_t netif, netbuf_t nb, void *address); +typedef netbuf_t (*if_getbuf_func_t)(netif_t netif); +typedef int (*if_control_func_t)(netif_t netif, const char *command, + void *data); + +typedef void (*if_attach_func_t)(void *private, netif_t realif); + +extern int if_output(netif_t netif, netbuf_t packet, void *addr); +extern int if_init(netif_t netif); +extern int if_control(netif_t netif, const char *command, void *data); + + +extern int if_ioctl(netif_t netif, unsigned command, void *data); + +extern netbuf_t if_getbuf(netif_t netif); +extern int if_handle_input(netif_t netif, netbuf_t nb, void *extra); + + + +extern netif_t if_attach(if_init_func_t init_func, + if_input_func_t input_func, + if_output_func_t output_func, + if_getbuf_func_t getbuf_func, + if_control_func_t control_func, + const char *name, + unsigned unit, + const char *type, + unsigned mtu, + unsigned flags, + netif_class_t class, + void *private); + +extern void if_registervirtual(if_attach_func_t attach_func, void *private); + +extern void if_detach(netif_t); + +extern netif_t iflist_first(void); +extern netif_t iflist_next(netif_t); + +/* + * Readable attributes + */ +extern const char *if_type(netif_t netif); +extern const char *if_name(netif_t netif); +extern unsigned if_unit(netif_t netif); +extern unsigned if_mtu(netif_t netif); +extern netif_class_t if_class(netif_t netif); +extern void *if_private(netif_t netif); + +/* + * Writable attributes + */ +extern unsigned if_flags(netif_t netif); +extern void if_flags_set(netif_t netif, unsigned flags); + +extern unsigned if_ipackets(netif_t netif); +extern void if_ipackets_set(netif_t netif, unsigned ipackets); + +extern unsigned if_opackets(netif_t netif); +extern void if_opackets_set(netif_t netif, unsigned opackets); + +extern unsigned if_oerrors(netif_t netif); +extern void if_oerrors_set(netif_t netif, unsigned oerrors); + +extern unsigned if_ierrors(netif_t netif); +extern void if_ierrors_set(netif_t netif, unsigned ierrors); + +extern unsigned if_collisions(netif_t netif); +extern void if_collisions_set(netif_t netif, unsigned collisions); + +#endif /* KERNEL */ + +#endif /* _NETIF_ */ diff --git a/include/net/netisr.h b/include/net/netisr.h new file mode 100644 index 0000000..d667b4f --- /dev/null +++ b/include/net/netisr.h @@ -0,0 +1,67 @@ +/* + * Mach Operating System + * Copyright (c) 1987 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + */ +/* + ********************************************************************** + * HISTORY + * 5-Nov-87 David Golub (dbg) at Carnegie-Mellon University + * Use kernel-thread for networking code. + * + ********************************************************************** + */ + +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)netisr.h 7.1 (Berkeley) 6/4/86 + */ + +#ifdef MACH +/* + * The networking code is a separate kernel task, currently + * bound to the master cpu. + */ +#if defined(KERNEL) && !defined(LOCORE) + +int soft_net_wakeup; +#define setsoftnet() (wakeup((caddr_t)&soft_net_wakeup)) + +#endif defined(KERNEL) && !defined(LOCORE) + +#else MACH +/* + * The networking code runs off software interrupts. + * + * You can switch into the network by doing splnet() and return by splx(). + * The software interrupt level for the network is higher than the software + * level for the clock (so you can enter the network in routines called + * at timeout time). + */ +#ifdef vax +#define setsoftnet() mtpr(SIRR, 12) +#endif +#endif MACH + +/* + * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status + * word which is used to de-multiplex a single software + * interrupt used for scheduling the network code to calls + * on the lowest level routine of each protocol. + */ +#define NETISR_RAW 0 /* same as AF_UNSPEC */ +#define NETISR_IP 2 /* same as AF_INET */ +#define NETISR_IMP 3 /* same as AF_IMPLINK */ +#define NETISR_NS 6 /* same as AF_NS */ + +#define schednetisr(anisr) { netisr |= 1<<(anisr); setsoftnet(); } + +#ifndef LOCORE +#ifdef KERNEL +int netisr; /* scheduling bits for network */ +#endif +#endif diff --git a/include/net/raw.cb.h b/include/net/raw.cb.h new file mode 100644 index 0000000..607bb3f --- /dev/null +++ b/include/net/raw.cb.h @@ -0,0 +1,78 @@ +/* + * Mach Operating System + * Copyright (c) 1987 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + */ +/* + * HISTORY + * 26-Sep-89 Morris Meyer (mmeyer) at NeXT + * NFS 4.0 Changes: Back out statistics gathering support. + * + * 13-Aug-87 Peter King (king) at NeXT + * SUN_RPC: Added rcb_cc and rcb_mbcnt for statistics gathering. + * Added RAW_TALLY flag to turn on statistics gathering + */ + +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)raw_cb.h 7.1 (Berkeley) 6/4/86 + */ + +/* @(#)raw_cb.h 2.1 88/05/30 4.0NFSSRC SMI; from UCB 7.1 6/5/86 */ + +/* + * Raw protocol interface control block. Used + * to tie a socket to the generic raw interface. + */ +struct rawcb { + struct rawcb *rcb_next; /* doubly linked list */ + struct rawcb *rcb_prev; + struct socket *rcb_socket; /* back pointer to socket */ + struct sockaddr rcb_faddr; /* destination address */ + struct sockaddr rcb_laddr; /* socket's address */ + struct sockproto rcb_proto; /* protocol family, protocol */ + caddr_t rcb_pcb; /* protocol specific stuff */ + struct mbuf *rcb_options; /* protocol specific options */ + struct route rcb_route; /* routing information */ + short rcb_flags; +/* SUN_RPC */ + int rcb_cc; /* bytes of rawintr queued data */ + int rcb_mbcnt; /* bytes of rawintr queued mbufs */ +/* SUN_RPC */ +}; + +/* + * Since we can't interpret canonical addresses, + * we mark an address present in the flags field. + */ +#define RAW_LADDR 01 +#define RAW_FADDR 02 +#define RAW_DONTROUTE 04 /* no routing, default */ +#define RAW_TALLY 0x08 /* tally delivered packets (SUN_RPC) */ + +#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb) + +/* + * Nominal space allocated to a raw socket. + */ +#define RAWSNDQ 2048 +#define RAWRCVQ 2048 + +/* + * Format of raw interface header prepended by + * raw_input after call from protocol specific + * input routine. + */ +struct raw_header { + struct sockproto raw_proto; /* format of packet */ + struct sockaddr raw_dst; /* dst address for rawintr */ + struct sockaddr raw_src; /* src address for sbappendaddr */ +}; + +#ifdef KERNEL +struct rawcb rawcb; /* head of list */ +#endif diff --git a/include/net/route.h b/include/net/route.h new file mode 100644 index 0000000..b706b41 --- /dev/null +++ b/include/net/route.h @@ -0,0 +1,95 @@ +/* + * Mach Operating System + * Copyright (c) 1987 Carnegie-Mellon University + * All rights reserved. The CMU software License Agreement specifies + * the terms and conditions for use and redistribution. + */ +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + * + * @(#)route.h 7.3 (Berkeley) 12/30/87 + */ + +/* + * Kernel resident routing tables. + * + * The routing tables are initialized when interface addresses + * are set by making entries for all directly connected interfaces. + */ + +#if 0 +/* + * A route consists of a destination address and a reference + * to a routing entry. These are often held by protocols + * in their control blocks, e.g. inpcb. + */ +struct route { + struct rtentry *ro_rt; + struct sockaddr ro_dst; +}; +#endif + +/* + * We distinguish between routes to hosts and routes to networks, + * preferring the former if available. For each route we infer + * the interface to use from the gateway address supplied when + * the route was entered. Routes that forward packets through + * gateways are marked so that the output routines know to address the + * gateway rather than the ultimate destination. + */ +struct rtentry { + u_long rt_hash; /* to speed lookups */ + struct sockaddr rt_dst; /* key */ + struct sockaddr rt_gateway; /* value */ + short rt_flags; /* up/down?, host/net */ + short rt_refcnt; /* # held references */ + u_long rt_use; /* raw # packets forwarded */ + struct ifnet *rt_ifp; /* the answer: interface to use */ +}; + +#define RTF_UP 0x1 /* route useable */ +#define RTF_GATEWAY 0x2 /* destination is a gateway */ +#define RTF_HOST 0x4 /* host entry (net otherwise) */ +#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ +#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ + +/* + * Routing statistics. + */ +struct rtstat { + short rts_badredirect; /* bogus redirect calls */ + short rts_dynamic; /* routes created by redirects */ + short rts_newgateway; /* routes modified by redirects */ + short rts_unreach; /* lookups which failed */ + short rts_wildcard; /* lookups satisfied by a wildcard */ +}; + +#ifdef KERNEL +#define RTFREE(rt) \ + if ((rt)->rt_refcnt == 1) \ + rtfree(rt); \ + else \ + (rt)->rt_refcnt--; + +#ifdef GATEWAY +#define RTHASHSIZ 64 +#else +#define RTHASHSIZ 8 +#endif +#if (RTHASHSIZ & (RTHASHSIZ - 1)) == 0 +#define RTHASHMOD(h) ((h) & (RTHASHSIZ - 1)) +#else +#define RTHASHMOD(h) ((h) % RTHASHSIZ) +#endif +struct mbuf *rthost[RTHASHSIZ]; +struct mbuf *rtnet[RTHASHSIZ]; +struct rtstat rtstat; +#endif diff --git a/include/netdb.h b/include/netdb.h new file mode 100644 index 0000000..c538da0 --- /dev/null +++ b/include/netdb.h @@ -0,0 +1,149 @@ +/*- + * Copyright (c) 1980, 1983, 1988, 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. + * + * @(#)netdb.h 8.1 (Berkeley) 6/2/93 + * $Id: netdb.h,v 1.1 1997/02/28 04:42:02 gdr Exp $ + * - + * 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 _NETDB_H_ +#define _NETDB_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" + +extern int h_errno; + +/* + * 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 an unsigned long -- 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 NETDB_INTERNAL -1 /* see errno */ +#define NETDB_SUCCESS 0 /* no problem */ +#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 */ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__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 *)); +const char *hstrerror __P((int)); +void sethostent __P((int)); +/* void sethostfile __P((const char *)); */ +void setnetent __P((int)); +void setprotoent __P((int)); +void setservent __P((int)); +__END_DECLS + +#endif /* !_NETDB_H_ */ diff --git a/include/netinet/in.h b/include/netinet/in.h new file mode 100644 index 0000000..54dde2a --- /dev/null +++ b/include/netinet/in.h @@ -0,0 +1,353 @@ +/* + * Copyright (c) 1982, 1986, 1990, 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. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + * $Id: in.h,v 1.1 1997/02/28 04:42:11 gdr Exp $ + */ + +#ifndef _NETINET_IN_H_ +#define _NETINET_IN_H_ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981, and numerous additions. + */ + +/* + * Protocols + */ +#define IPPROTO_IP 0 /* dummy for IP */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_IGMP 2 /* group mgmt protocol */ +#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ +#define IPPROTO_IPIP 4 /* IP encapsulation in IP */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ +#define IPPROTO_IDP 22 /* xns idp */ +#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ +#define IPPROTO_RSVP 46 /* resource reservation */ +#define IPPROTO_EON 80 /* ISO cnlp */ +#define IPPROTO_ENCAP 98 /* encapsulation header */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + + +/* + * Local port number conventions: + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define IPPORT_RESERVED 1024 +#define IPPORT_USERRESERVED 5000 + +/* + * Internet address (a structure for historical reasons) + */ +#if 0 /* BSD 4.4 */ +struct in_addr { + u_long s_addr; +}; +#else /* GNO (also BSD 4.3?) */ +struct in_addr { + union { + struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { u_short s_w1,s_w2; } S_un_w; + u_long S_addr; + } S_un; +#define s_addr S_un.S_addr /* can be used for most tcp & ip code */ +#define s_host S_un.S_un_b.s_b2 /* host on imp */ +#define s_net S_un.S_un_b.s_b1 /* network */ +#define s_imp S_un.S_un_w.s_w2 /* imp */ +#define s_impno S_un.S_un_b.s_b4 /* imp # */ +#define s_lh S_un.S_un_b.s_b3 /* logical host */ +}; +#endif /* 0 */ + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ +#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ +#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ +#define IN_MULTICAST(i) IN_CLASSD(i) + +#define IN_EXPERIMENTAL(i) (((long)(i) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) + +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ +#ifndef KERNEL +#define INADDR_NONE 0xffffffff /* -1 return */ +#endif + +#define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */ +#define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */ + +#define IN_LOOPBACKNET 127 /* official! */ + +/* + * Socket address, internet style. + */ +struct sockaddr_in { +#if 0 /* BSD */ + u_char sin_len; + u_char sin_family; +#else /* GNO */ + short sin_family; +#endif + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* + * Structure used to describe IP options. + * Used to store options internally, to pass them to a process, + * or to restore options retrieved earlier. + * The ip_dst is used for the first-hop gateway when using a source route + * (this gets put into the header proper). + */ +struct ip_opts { + struct in_addr ip_dst; /* first hop, 0 w/o src rt */ + char ip_opts[40]; /* actually variable in size */ +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + * First word of comment is data type; bool is stored in int. + */ +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ +#define IP_HDRINCL 2 /* int; header is included with data */ +#define IP_TOS 3 /* int; IP type of service and preced. */ +#define IP_TTL 4 /* int; IP time to live */ +#define IP_TIMETOLIVE IP_TTL +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ +#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ +#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ +#define IP_RSVP_ON 15 /* enable RSVP in kernel */ +#define IP_RSVP_OFF 16 /* disable RSVP in kernel */ +#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */ +#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */ + +/* + * Defaults and limits for options + */ +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ +#define IP_MAX_MEMBERSHIPS 20 /* per socket */ + +/* + * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. + */ +struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + +/* + * Definitions for inet sysctl operations. + * + * Third level is protocol number. + * Fourth level is desired variable within that protocol. + */ +#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */ + +#define CTL_IPPROTO_NAMES { \ + { "ip", CTLTYPE_NODE }, \ + { "icmp", CTLTYPE_NODE }, \ + { "igmp", CTLTYPE_NODE }, \ + { "ggp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "tcp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { "egp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "pup", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "udp", CTLTYPE_NODE }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { 0, 0 }, \ + { "idp", CTLTYPE_NODE }, \ +} + +/* + * Names for IP sysctl objects + */ +#define IPCTL_FORWARDING 1 /* act as router */ +#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ +#define IPCTL_DEFTTL 3 /* default TTL */ +#ifdef notyet +#define IPCTL_DEFMTU 4 /* default MTU */ +#endif +#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */ +#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */ +#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */ +#define IPCTL_SOURCEROUTE 8 /* may perform source routes */ +#define IPCTL_MAXID 9 + +#define IPCTL_NAMES { \ + { 0, 0 }, \ + { "forwarding", CTLTYPE_INT }, \ + { "redirect", CTLTYPE_INT }, \ + { "ttl", CTLTYPE_INT }, \ + { "mtu", CTLTYPE_INT }, \ + { "rtexpire", CTLTYPE_INT }, \ + { "rtminexpire", CTLTYPE_INT }, \ + { "rtmaxcache", CTLTYPE_INT }, \ + { "sourceroute", CTLTYPE_INT }, \ +} + +/* + * This section contains macros used in GNO that aren't part of BSD. + */ + +#ifdef __GNO__ +/* + * Port/socket numbers: network standard functions + */ +#define IPPORT_ECHO 7 +#define IPPORT_DISCARD 9 +#define IPPORT_SYSTAT 11 +#define IPPORT_DAYTIME 13 +#define IPPORT_NETSTAT 15 +#define IPPORT_FTP 21 +#define IPPORT_TELNET 23 +#define IPPORT_SMTP 25 +#define IPPORT_TIMESERVER 37 +#define IPPORT_NAMESERVER 42 +#define IPPORT_WHOIS 43 +#define IPPORT_MTP 57 + +/* + * Port/socket numbers: host specific functions + */ +#define IPPORT_TFTP 69 +#define IPPORT_RJE 77 +#define IPPORT_FINGER 79 +#define IPPORT_TTYLINK 87 +#define IPPORT_SUPDUP 95 + +/* + * UNIX TCP sockets + */ +#define IPPORT_EXECSERVER 512 +#define IPPORT_LOGINSERVER 513 +#define IPPORT_CMDSERVER 514 +#define IPPORT_EFSSERVER 520 + +/* + * UNIX UDP sockets + */ +#define IPPORT_BIFFUDP 512 +#define IPPORT_WHOSERVER 513 +#define IPPORT_ROUTESERVER 520 /* 520+1 also used */ + +/* + * Link numbers + */ +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 + +/* + * Define a macro to stuff the loopback address into an Internet address + */ +#define IN_SET_LOOPBACK_ADDR(a) {(a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \ + (a)->sin_family = AF_INET;} + +#endif /* __GNO__ */ + + +#ifdef KERNEL +struct ifnet; struct mbuf; /* forward declarations for Standard C */ + +#if 0 && defined(__GNO__) +/* + * gdr: Prototypes are needed here, but I have no idea what they are. + * Obsolete? + */ +struct in_addr in_makeaddr __P(()); +u_long in_lnaof __P(()); +#endif + +int in_broadcast __P((struct in_addr, struct ifnet *)); +int in_canforward __P((struct in_addr)); +int in_cksum __P((struct mbuf *, int)); +int in_localaddr __P((struct in_addr)); +u_long in_netof __P((struct in_addr)); +void in_socktrim __P((struct sockaddr_in *)); +char *inet_ntoa __P((struct in_addr)); /* in libkern */ +#endif + +#endif + diff --git a/include/netinet/in.systm.h b/include/netinet/in.systm.h new file mode 100644 index 0000000..638e6dc --- /dev/null +++ b/include/netinet/in.systm.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 1982, 1986, 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. + * + * @(#)in_systm.h 8.1 (Berkeley) 6/10/93 + * $Id: in.systm.h,v 1.1 1997/02/28 04:42:11 gdr Exp $ + */ + +#ifndef _NETINET_IN_SYSTM_H_ +#define _NETINET_IN_SYSTM_H_ + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +typedef u_short n_short; /* short as received from the net */ +typedef u_long n_long; /* long as received from the net */ + +typedef u_long n_time; /* ms since 00:00 GMT, byte rev */ + +#ifdef KERNEL +n_time iptime __P((void)); +#endif + +#endif diff --git a/include/netinet/ip.h b/include/netinet/ip.h new file mode 100644 index 0000000..b003599 --- /dev/null +++ b/include/netinet/ip.h @@ -0,0 +1,179 @@ +/* + * Copyright (c) 1982, 1986, 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. + * + * @(#)ip.h 8.1 (Berkeley) 6/10/93 + * $Id: ip.h,v 1.1 1997/02/28 04:42:11 gdr Exp $ + */ + +#ifndef _NETINET_IP_H_ +#define _NETINET_IP_H_ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ +#define IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + * + * We declare ip_len and ip_off to be short, rather than u_short + * pragmatically since otherwise unsigned comparisons can result + * against negative integers quite easily, and fail in subtle ways. + */ +struct ip { +#if BYTE_ORDER == LITTLE_ENDIAN + u_char ip_hl:4, /* header length */ + ip_v:4; /* version */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_char ip_v:4, /* version */ + ip_hl:4; /* header length */ +#endif + u_char ip_tos; /* type of service */ + short ip_len; /* total length */ + u_short ip_id; /* identification */ + short ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Definitions for IP type of service (ip_tos) + */ +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_MINCOST 0x02 + +/* + * Definitions for IP precedence (also in ip_tos) (hopefully unused) + */ +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#if 1 /* GNO */ +#define IPTOS_PREC_ROUTINE 0x10 +#else /* BSD */ +#define IPTOS_PREC_ROUTINE 0x00 +#endif + +/* + * Definitions for options. + */ +#define IPOPT_COPIED(o) ((o)&0x80) +#define IPOPT_CLASS(o) ((o)&0x60) +#define IPOPT_NUMBER(o) ((o)&0x1f) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_DEBMEAS 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_EOL 0 /* end of option list */ +#define IPOPT_NOP 1 /* no operation */ + +#define IPOPT_RR 7 /* record packet route */ +#define IPOPT_TS 68 /* timestamp */ +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define IPOPT_LSRR 131 /* loose source route */ +#define IPOPT_SATID 136 /* satnet id */ +#define IPOPT_SSRR 137 /* strict source route */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define IPOPT_OPTVAL 0 /* option ID */ +#define IPOPT_OLEN 1 /* option length */ +#define IPOPT_OFFSET 2 /* offset within option */ +#define IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct ip_timestamp { + u_char ipt_code; /* IPOPT_TS */ + u_char ipt_len; /* size of structure (variable) */ + u_char ipt_ptr; /* index of current entry */ +#if BYTE_ORDER == LITTLE_ENDIAN + u_char ipt_flg:4, /* flags, see below */ + ipt_oflw:4; /* overflow counter */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_char ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ +#endif + union ipt_timestamp { + n_long ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + n_long ipt_time; + } ipt_ta[1]; + } ipt_timestamp; +}; + +/* flag bits for ipt_flg */ +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 3 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define IPOPT_SECUR_UNCLASS 0x0000 +#define IPOPT_SECUR_CONFID 0xf135 +#define IPOPT_SECUR_EFTO 0x789a +#define IPOPT_SECUR_MMMM 0xbc4d +#define IPOPT_SECUR_RESTR 0xaf13 +#define IPOPT_SECUR_SECRET 0xd788 +#define IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define MAXTTL 255 /* maximum time to live (seconds) */ +#define IPDEFTTL 64 /* default ttl, from RFC 1340 */ +#define IPFRAGTTL 60 /* time to live for frags, slowhz */ +#define IPTTLDEC 1 /* subtracted when forwarding */ + +#define IP_MSS 576 /* default maximum segment size */ + +#endif diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h new file mode 100644 index 0000000..c312b37 --- /dev/null +++ b/include/netinet/tcp.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 1982, 1986, 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. + * + * @(#)tcp.h 8.1 (Berkeley) 6/10/93 + * $Id: tcp.h,v 1.1 1997/02/28 04:42:12 gdr Exp $ + */ + +#ifndef _NETINET_TCP_H_ +#define _NETINET_TCP_H_ + +typedef u_long tcp_seq; +typedef u_long tcp_cc; /* connection count per rfc1644 */ + +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr { + u_short th_sport; /* source port */ + u_short th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +#if BYTE_ORDER == LITTLE_ENDIAN + u_char th_x2:4, /* (unused) */ + th_off:4; /* data offset */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_char th_off:4, /* data offset */ + th_x2:4; /* (unused) */ +#endif + u_char th_flags; +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 +#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) + + u_short th_win; /* window */ + u_short th_sum; /* checksum */ + u_short th_urp; /* urgent pointer */ +}; + +#define TCPOPT_EOL 0 +#define TCPOPT_NOP 1 +#define TCPOPT_MAXSEG 2 +#define TCPOLEN_MAXSEG 4 +#define TCPOPT_WINDOW 3 +#define TCPOLEN_WINDOW 3 +#define TCPOPT_SACK_PERMITTED 4 /* Experimental */ +#define TCPOLEN_SACK_PERMITTED 2 +#define TCPOPT_SACK 5 /* Experimental */ +#define TCPOPT_TIMESTAMP 8 +#define TCPOLEN_TIMESTAMP 10 +#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ +#define TCPOPT_TSTAMP_HDR \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) + +#define TCPOPT_CC 11 /* CC options: RFC-1644 */ +#define TCPOPT_CCNEW 12 +#define TCPOPT_CCECHO 13 +#define TCPOLEN_CC 6 +#define TCPOLEN_CC_APPA (TCPOLEN_CC+2) +#define TCPOPT_CC_HDR(ccopt) \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC) + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). + */ +#define TCP_MSS 512 + +#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ +#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */ + +#define TCP_MAX_WINSHIFT 14 /* maximum window shift */ + +#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */ +#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr)) + /* max space left for options */ + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ +#define TCP_MAXSEG 0x02 /* set maximum segment size */ +#define TCP_NOPUSH 0x04 /* don't push last block of write */ +#define TCP_NOOPT 0x08 /* don't use TCP options */ + +#endif diff --git a/include/paths.h b/include/paths.h new file mode 100644 index 0000000..3992b82 --- /dev/null +++ b/include/paths.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 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. + * + * @(#)paths.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _PATHS_H_ +#define _PATHS_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +/* Default search path. */ +#define _PATH_DEFPATH "/usr/bin:/bin" +/* All standard utilities path. */ +#define _PATH_STDPATH \ + "/usr/bin:/bin:/usr/sbin:/sbin:" + +#define _PATH_BSHELL "/bin/sh" +#define _PATH_CONSOLE ".ttyco" +#define _PATH_CSHELL "/bin/csh" +#define _PATH_DEVDB "/var/run/dev.db" +#define _PATH_DEVNULL ".null" +#define _PATH_DRUM ".drum" +#define _PATH_FTPUSERS "/etc/ftpusers" +#ifndef _POSIX_SOURCE +#define _PATH_GSHELL "/bin/gsh" /* GNO-specific */ +#endif +#define _PATH_KMEM ".kmem" +#define _PATH_MAILDIR "/var/mail" +#define _PATH_MAN "/usr/share/man" +#define _PATH_MEM ".mem" +#define _PATH_NOLOGIN "/etc/nologin" +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#define _PATH_SHELLS "/etc/shells" +#define _PATH_TTY ".tty" +#define _PATH_UNIX "don't use _PATH_UNIX" +#define _PATH_VI "/usr/bin/vi" + +/* Provide trailing slash, since mostly used for building pathnames. */ +#define _PATH_DEV "/dev/" +#define _PATH_TMP "/tmp/" +#define _PATH_VARDB "/var/db/" +#define _PATH_VARRUN "/var/run/" +#define _PATH_VARTMP "/var/tmp/" +#define _PATH_YP "/var/yp/" +#define _PATH_UUCPLOCK "/var/spool/lock/" + +/* How to get the correct name of the kernel. */ +__BEGIN_DECLS +const char *getbootfile __P((void)); +__END_DECLS + +#endif /* !_PATHS_H_ */ diff --git a/include/protocols/talkd.h b/include/protocols/talkd.h new file mode 100644 index 0000000..34b5da2 --- /dev/null +++ b/include/protocols/talkd.h @@ -0,0 +1,114 @@ +/* + * 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. + * + * @(#)talkd.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _PROTOCOLS_TALKD_H_ +#define _PROTOCOLS_TALKD_H_ + +/* + * This describes the protocol used by the talk server and clients. + * + * The talk server acts a repository of invitations, responding to + * requests by clients wishing to rendezvous for the purpose of + * holding a conversation. In normal operation, a client, the caller, + * initiates a rendezvous by sending a CTL_MSG to the server of + * type LOOK_UP. This causes the server to search its invitation + * tables to check if an invitation currently exists for the caller + * (to speak to the callee specified in the message). If the lookup + * fails, the caller then sends an ANNOUNCE message causing the server + * to broadcast an announcement on the callee's login ports requesting + * contact. When the callee responds, the local server uses the + * recorded invitation to respond with the appropriate rendezvous + * address and the caller and callee client programs establish a + * stream connection through which the conversation takes place. + */ + +/* + * Client->server request message format. + */ +typedef struct { + u_char vers; /* protocol version */ + u_char type; /* request type, see below */ + u_char answer; /* not used */ + u_char pad; + u_long id_num; /* message id */ + struct osockaddr addr; /* old (4.3) style */ + struct osockaddr ctl_addr; /* old (4.3) style */ + long pid; /* caller's process id */ +#define NAME_SIZE 12 + char l_name[NAME_SIZE];/* caller's name */ + char r_name[NAME_SIZE];/* callee's name */ +#define TTY_SIZE 16 + char r_tty[TTY_SIZE];/* callee's tty name */ +} CTL_MSG; + +/* + * Server->client response message format. + */ +typedef struct { + u_char vers; /* protocol version */ + u_char type; /* type of request message, see below */ + u_char answer; /* respose to request message, see below */ + u_char pad; + u_long id_num; /* message id */ + struct osockaddr addr; /* address for establishing conversation */ +} CTL_RESPONSE; + +#define TALK_VERSION 1 /* protocol version */ + +/* message type values */ +#define LEAVE_INVITE 0 /* leave invitation with server */ +#define LOOK_UP 1 /* check for invitation by callee */ +#define DELETE 2 /* delete invitation by caller */ +#define ANNOUNCE 3 /* announce invitation by caller */ + +/* answer values */ +#define SUCCESS 0 /* operation completed properly */ +#define NOT_HERE 1 /* callee not logged in */ +#define FAILED 2 /* operation failed for unexplained reason */ +#define MACHINE_UNKNOWN 3 /* caller's machine name unknown */ +#define PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */ +#define UNKNOWN_REQUEST 5 /* request has invalid type value */ +#define BADVERSION 6 /* request has invalid protocol version */ +#define BADADDR 7 /* request has invalid addr value */ +#define BADCTLADDR 8 /* request has invalid ctl_addr value */ + +/* + * Operational parameters. + */ +#define MAX_LIFE 60 /* max time daemon saves invitations */ +/* RING_WAIT should be 10's of seconds less than MAX_LIFE */ +#define RING_WAIT 30 /* time to wait before resending invitation */ + +#endif /* !_TALKD_H_ */ diff --git a/include/pwd.h b/include/pwd.h new file mode 100644 index 0000000..f161148 --- /dev/null +++ b/include/pwd.h @@ -0,0 +1,134 @@ +/*- + * 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. + * + * @(#)pwd.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _PWD_H_ +#define _PWD_H_ + +#ifndef _SYS_TYPES_H_ +#include +#endif + +#ifndef _POSIX_SOURCE +#define _PATH_PWD "/etc" +#define _PATH_PASSWD "/etc/passwd" +#define _PASSWD "passwd" +#define _PATH_MASTERPASSWD "/etc/master.passwd" +#define _MASTERPASSWD "master.passwd" + +#define _PATH_MP_DB "/etc/pwd.db" +#define _MP_DB "pwd.db" +#define _PATH_SMP_DB "/etc/spwd.db" +#define _SMP_DB "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 _PW_KEYYPENABLED '4' /* YP is enabled */ +#define _PW_KEYYPBYNUM '5' /* special +@netgroup entries */ + +#define _PASSWORD_EFMT1 '_' /* extended encryption format */ + +#define _PASSWORD_LEN 128 /* max length, not counting NULL */ +#endif + +#if 0 +/* + * GNO v2.0.4 and earlier -- there is a new (although as yet unimplemented) + * version below. + */ +struct passwd { /* see getpwent(3) */ + char *pw_name; + char *pw_passwd; + int pw_uid; + int pw_gid; + int pw_quota; + char *pw_comment; + char *pw_gecos; + char *pw_dir; + char *pw_shell; +}; +#else /* 0 */ +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 (real name) */ + char *pw_dir; /* home directory */ + char *pw_shell; /* default shell */ + time_t pw_expire; /* account expiration */ + unsigned long pw_fields; /* internal: fields filled in */ +}; + +/* Mapping from fields to bits for pw_fields. */ +#define _PWF(x) (1 << x) +#define _PWF_NAME _PWF(0) +#define _PWF_PASSWD _PWF(1) +#define _PWF_UID _PWF(2) +#define _PWF_GID _PWF(3) +#define _PWF_CHANGE _PWF(4) +#define _PWF_CLASS _PWF(5) +#define _PWF_GECOS _PWF(6) +#define _PWF_DIR _PWF(7) +#define _PWF_SHELL _PWF(8) +#define _PWF_EXPIRE _PWF(9) + +#endif /* 0 */ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +struct passwd *getpwuid __P((uid_t)); +struct passwd *getpwnam __P((const char *)); +#ifndef _POSIX_SOURCE +struct passwd *getpwent __P((void)); +int setpassent __P((int)); +int setpwent __P((void)); +void endpwent __P((void)); +#endif +__END_DECLS + +#endif /* !_PWD_H_ */ diff --git a/include/regexp.h b/include/regexp.h new file mode 100644 index 0000000..0119be1 --- /dev/null +++ b/include/regexp.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 1986 by University of Toronto. + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley + * by Henry Spencer. + * + * 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. + * + * @(#)regexp.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _REGEXP_H_ +#define _REGEXP_H_ + +/* + * Definitions etc. for regexp(3) routines. + * + * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], + * not the System V one. + */ +#define NSUBEXP 10 +typedef struct regexp { + char *startp[NSUBEXP]; + char *endp[NSUBEXP]; + char regstart; /* Internal use only. */ + char reganch; /* Internal use only. */ + char *regmust; /* Internal use only. */ + int regmlen; /* Internal use only. */ + char program[1]; /* Unwarranted chumminess with compiler. */ +} regexp; + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +regexp *regcomp __P((const char *)); +int regexec __P((const regexp *, const char *)); +void regsub __P((const regexp *, const char *, char *)); +void regerror __P((const char *)); +__END_DECLS + +#endif /* !_REGEXP_H_ */ diff --git a/include/resolv.h b/include/resolv.h new file mode 100644 index 0000000..193fbcc --- /dev/null +++ b/include/resolv.h @@ -0,0 +1,265 @@ +/*- + * Copyright (c) 1983, 1987, 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. + * + * - + * 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-- + * + * @(#)resolv.h 8.1 (Berkeley) 6/2/93 + * From Id: resolv.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp + * $Id: resolv.h,v 1.1 1997/02/28 04:42:02 gdr Exp $ + */ + +#ifndef _RESOLV_H_ +#define _RESOLV_H_ + +#ifndef _SYS_PARAM_H_ +#include +#endif +#ifndef _SYS_TYPES_H_ +#include +#endif +#ifndef _SYS_CDEFS_H_ +#include +#endif +#ifndef _ARPA_NAMESER_H_ +#include +#endif +#ifndef __stdio__ +#include +#endif + +/* + * 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. + */ + +#if 0 /* GNO 2.0.6 still uses the old style */ +#define __RES 19950621 /* 'struct state' -- see below */ +#else +#undef __RES +#endif + +/* + * 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 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 */ + +#ifdef __RES /* GNO 2.0.6 doesn't define this */ +struct __res_state { + int retrans; /* retransmition time interval */ + int retry; /* number of times to retransmit */ + u_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 */ + u_long pfcode; /* RES_PRF_ flags - see below. */ + unsigned ndots:4; /* threshold for initial abs. query */ + unsigned nsort:4; /* number of elements in sort_list[] */ + char unused[3]; + struct { + struct in_addr addr; + u_int32_t mask; + } sort_list[MAXRESOLVSORT]; +}; +#else /* ! __RES */ +struct 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 defdname[MAXDNAME]; /* default domain */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ +}; +#endif + +/* + * Resolver options (keep these in synch with res_debug.c, please) + */ +#define RES_INIT 0x00000001 /* address initialized */ +#define RES_DEBUG 0x00000002 /* print debug messages */ +#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ +#define RES_USEVC 0x00000008 /* use virtual circuit */ +#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ +#define RES_IGNTC 0x00000020 /* ignore trucation errors */ +#define RES_RECURSE 0x00000040 /* recursion desired */ +#define RES_DEFNAMES 0x00000080 /* use default domain name */ +#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x00000200 /* search up local domain tree */ +#define RES_INSECURE1 0x00000400 /* type 1 security disabled */ +#define RES_INSECURE2 0x00000800 /* type 2 security disabled */ +#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) + +/* + * Resolver "pfcode" values. Used by dig. + */ +#define RES_PRF_STATS 0x00000001 +/* 0x00000002 */ +#define RES_PRF_CLASS 0x00000004 +#define RES_PRF_CMD 0x00000008 +#define RES_PRF_QUES 0x00000010 +#define RES_PRF_ANS 0x00000020 +#define RES_PRF_AUTH 0x00000040 +#define RES_PRF_ADD 0x00000080 +#define RES_PRF_HEAD1 0x00000100 +#define RES_PRF_HEAD2 0x00000200 +#define RES_PRF_TTLID 0x00000400 +#define RES_PRF_HEADX 0x00000800 +#define RES_PRF_QUERY 0x00001000 +#define RES_PRF_REPLY 0x00002000 +#define RES_PRF_INIT 0x00004000 +/* 0x00008000 */ + +/* hooks are still experimental as of 4.9.2 */ +typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } + res_sendhookact; + +typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr_in * const *ns, + const u_char **query, + int *querylen, + u_char *ans, + int anssiz, + int *resplen)); + +typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr_in *ns, + const u_char *query, + int querylen, + u_char *ans, + int anssiz, + int *resplen)); + +extern struct __res_state _res; + +/* Private routines shared between libc/net, named, nslookup and others. */ +#define dn_skipname __dn_skipname +#define fp_query __fp_query +#define fp_nquery __fp_nquery +#define hostalias __hostalias +#define putlong __putlong +#define putshort __putshort +#define p_class __p_class +#define p_time __p_time +#define p_type __p_type +#define p_cdnname __p_cdnname +#define p_cdname __p_cdname +#define p_fqname __p_fqname +#define p_rr __p_rr +#define p_option __p_option +#define res_randomid __res_randomid +#define res_isourserver __res_isourserver +#define res_nameinquery __res_nameinquery +#define res_queriesmatch __res_queriesmatch + +__BEGIN_DECLS +int __dn_skipname __P((const u_char *, const u_char *)); +void __fp_resstat __P((struct __res_state *, FILE *)); +void __fp_query __P((const u_char *, FILE *)); +void __fp_nquery __P((const u_char *, int, FILE *)); +char *__hostalias __P((const char *)); +void __putlong __P((u_int32_t, u_char *)); +void __putshort __P((u_int16_t, u_char *)); +char *__p_time __P((u_int32_t)); +void __p_query __P((const u_char *)); +const u_char *__p_cdnname __P((const u_char *, const u_char *, int, FILE *)); +const u_char *__p_cdname __P((const u_char *, const u_char *, FILE *)); +const u_char *__p_fqname __P((const u_char *, const u_char *, FILE *)); +const u_char *__p_rr __P((const u_char *, const u_char *, FILE *)); +const char *__p_type __P((int)); +const char *__p_class __P((int)); +const char *__p_option __P((u_long option)); +int dn_comp __P((const char *, u_char *, int, u_char **, u_char **)); +int dn_expand __P((const u_char *, const u_char *, const u_char *, + char *, int)); +int res_init __P((void)); +u_int16_t res_randomid __P((void)); +int res_query __P((const char *, int, int, u_char *, int)); +int res_search __P((const char *, int, int, u_char *, int)); +int res_querydomain __P((const char *, const char *, int, int, + u_char *, int)); +int res_mkquery __P((int, const char *, int, int, const u_char *, int, + const u_char *, u_char *, int)); +int res_send __P((const u_char *, int, u_char *, int)); +int res_isourserver __P((const struct sockaddr_in *)); +int res_nameinquery __P((const char *, int, int, + const u_char *, const u_char *)); +int res_queriesmatch __P((const u_char *, const u_char *, + const u_char *, const u_char *)); +__END_DECLS + +#endif /* !_RESOLV_H_ */ diff --git a/include/rpc/types.h b/include/rpc/types.h new file mode 100644 index 0000000..434bc74 --- /dev/null +++ b/include/rpc/types.h @@ -0,0 +1,68 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)types.h 1.18 87/07/24 SMI + * from: @(#)types.h 2.3 88/08/15 4.0 RPCSRC + * $Id: types.h,v 1.1 1997/02/28 04:42:13 gdr Exp $ + */ + +/* + * Rpc additions to + */ +#ifndef _RPC_TYPES_H +#define _RPC_TYPES_H + +#define bool_t int +#define enum_t int +#define __dontcare__ -1 + +#ifndef FALSE +# define FALSE (0) +#endif +#ifndef TRUE +# define TRUE (1) +#endif +#ifndef NULL +# define NULL (void *) 0L +#endif + +#define mem_alloc(bsize) malloc(bsize) +#define mem_free(ptr, bsize) free(ptr) + +#ifndef _SYS_TYPES_H_ +#include +#endif +#ifndef _SYS_TIME_H_ +#include +#endif + +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK (u_long)0x7F000001 +#endif + +#endif /* !_RPC_TYPES_H */ diff --git a/include/setjmp.h b/include/setjmp.h new file mode 100644 index 0000000..7495a2e --- /dev/null +++ b/include/setjmp.h @@ -0,0 +1,21 @@ +/**************************************************************** +* +* setjmp.h - nonlocal jump library +* +* February 1989 +* Mike Westerfield +* +* Copyright 1989 +* Byte Works, Inc. +* +****************************************************************/ + +#ifndef __setjmp__ +#define __setjmp__ + +typedef int jmp_buf[6]; + +void longjmp(jmp_buf, int); +int setjmp(jmp_buf); + +#endif diff --git a/include/sgtty.h b/include/sgtty.h new file mode 100644 index 0000000..87b09ba --- /dev/null +++ b/include/sgtty.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1985, 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. + * + * @(#)sgtty.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef USE_OLD_TTY +#define USE_OLD_TTY +#endif +#ifndef _SYS_IOCTL_H_ +#include +#endif +#ifndef _SYS_CDEFS_H_ +#include +#endif + +#ifndef _POSIX_SOURCE +int stty __P((int, struct sgttyb *)); +int gtty __P((int, struct sgttyb *)); +#endif diff --git a/include/signal.h b/include/signal.h new file mode 100644 index 0000000..fb5d90a --- /dev/null +++ b/include/signal.h @@ -0,0 +1,91 @@ +/*- + * 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_ + +#ifndef _SYS_TYPES_H_ +#include +#endif + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +#ifndef _SYS_SIGNAL_H_ +#include +#endif + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +extern __const char *__const sys_signame[NSIG]; +extern __const char *__const sys_siglist[NSIG]; +#endif + +__BEGIN_DECLS +int raise __P((int)); +#ifndef _ANSI_SOURCE +int kill __P((pid_t, int)); +int sigaction __P((int, const struct sigaction *, struct sigaction *)); +int sigaddset __P((sigset_t *, int)); +int sigdelset __P((sigset_t *, int)); +int sigemptyset __P((sigset_t *)); +int sigfillset __P((sigset_t *)); +int sigismember __P((const sigset_t *, int)); +int sigpending __P((sigset_t *)); +int sigprocmask __P((int, const sigset_t *, sigset_t *)); +int sigsuspend __P((const sigset_t *)); +#ifndef _POSIX_SOURCE +int killpg __P((pid_t, int)); +int sigaltstack __P((const struct sigaltstack *, struct sigaltstack *)); +u_long sigblock __P((u_long)); /* non-BSD */ +int siginterrupt __P((int, int)); +int sigpause __P((u_long)); /* non-BSD */ +int sigreturn __P((struct sigcontext *)); +u_long sigsetmask __P((u_long)); /* non-BSD */ +int sigstack __P((const struct sigstack *, struct sigstack *)); +int sigvec __P((int, struct sigvec *, struct sigvec *)); +void psignal __P((unsigned int, const char *)); +#endif /* !_POSIX_SOURCE */ +#endif /* !_ANSI_SOURCE */ +__END_DECLS + +/* List definitions after function declarations, or Reiser cpp gets upset. */ +#define sigaddset(set, signo) (*(set) |= 1 << ((signo) - 1), 0) +#define sigdelset(set, signo) (*(set) &= ~(1 << ((signo) - 1)), 0) +#define sigemptyset(set) (*(set) = 0, 0) +#define sigfillset(set) (*(set) = ~(sigset_t)0, 0) +#define sigismember(set, signo) ((*(set) & (1 << ((signo) - 1))) != 0) + +#endif /* !_SIGNAL_H_ */ diff --git a/include/stddef.h b/include/stddef.h new file mode 100644 index 0000000..c632b15 --- /dev/null +++ b/include/stddef.h @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 1990, 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. + * + * @(#)stddef.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _STDDEF_H_ +#define _STDDEF_H_ + +#ifndef _MACHINE_ANSI_H_ +#include +#endif + +typedef _BSD_PTRDIFF_T_ ptrdiff_t; + +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +#ifdef _BSD_WCHAR_T_ +#ifndef _ANSI_SOURCE +typedef _BSD_WCHAR_T_ rune_t; +#endif +typedef _BSD_WCHAR_T_ wchar_t; +#undef _BSD_WCHAR_T_ +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#define offsetof(type, member) ((size_t)(&((type *)0)->member)) + +#endif /* _STDDEF_H_ */ diff --git a/include/stdio.h b/include/stdio.h new file mode 100644 index 0000000..19dfa11 --- /dev/null +++ b/include/stdio.h @@ -0,0 +1,237 @@ +/**************************************************************** +* +* stdio.h - input/output facilities +* +* February 1989 +* Mike Westerfield +* +* Copyright 1989, 1993 +* Byte Works, Inc. +* +****************************************************************/ + +#ifndef __stdio__ +#define __stdio__ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +#ifndef _SYS_SYSLIMITS_H_ +#include +#endif + +/* + * Misc. + */ + +#ifndef __va_list__ +#define __va_list__ +typedef char *__va_list[2]; +#endif + +#ifndef EOF +#define EOF (-1) +#endif + +#ifndef NULL +#define NULL (void *) 0L +#endif + +#ifndef __size_t__ +#define __size_t__ 1 +typedef unsigned long size_t; +#endif + +/* seek codes */ + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +/* + * Error handling + */ + +#if !defined(__KeepNamespacePure__) && !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) + extern const int sys_nerr; /* largest index for sys_errlist */ + extern const char * const sys_errlist[]; /* error messages */ +#endif + +/* + * files + */ + +typedef struct __file { + struct __file *next; /* next file in linked list */ + unsigned char *_ptr, /* next location to write to */ + *_base, /* first byte of the buffer */ + *_end; /* end of the file buffer */ + unsigned long _size, /* size of the file buffer */ + _cnt; /* # chars that can be read/writen to buffer */ +#if defined(__ORCAC_VERSION) && (__ORCAC_VERSION > 210) + int _pbk[2]; /* put back character; changed in v2.1.1b2 */ +#else +#error bad stuff batman + int _pbk; /* put back character */ +#endif + unsigned int _flag, /* buffer flags */ + _file; /* GS/OS file ID */ + } FILE; + +#define BUFSIZ 1024 /* default buffer size */ +#define _LBUFSIZ 255 /* line buffer size */ + +#define _IOFBF 0x0001 /* full buffering */ +#define _IONBF 0x0002 /* no buffering */ +#define _IOLBF 0x0004 /* flush when a \n is written */ +#define _IOREAD 0x0008 /* currently reading */ +#define _IOWRT 0x0010 /* currently writing */ +#define _IORW 0x0020 /* read/write enabled */ +#define _IOMYBUF 0x0040 /* buffer was allocated by stdio */ +#define _IOEOF 0x0080 /* has an EOF been found? */ +#define _IOERR 0x0100 /* has an error occurred? */ +#define _IOTEXT 0x0200 /* is this file a text file? */ +#define _IOTEMPFILE 0x0400 /* was this file created by tmpfile()? */ + +extern FILE *stderr; /* standard I/O files */ +extern FILE *stdin; +extern FILE *stdout; + +#define L_tmpnam 26 /* size of a temp name */ +#define TMP_MAX 10000 /* # of unique temp names */ +#ifdef __GNO__ +#define __max_open OPEN_MAX /* <= OPEN_MAX */ +#else +#define __max_open 32767 /* Orca Shell: no practical limit */ +#endif +#ifndef __KeepNamespacePure__ + #define SYS_OPEN __max_open /* max # open files */ +#endif +#define FOPEN_MAX __max_open /* max # open files */ +#undef __max_open +#define FILENAME_MAX 1024 /* recommended file name length */ + +/* + * Other types + */ + +typedef long fpos_t; + +/* + * Functions declared as macros + */ + +#ifdef __ORCAC_VERSION /* Orca/C v2.1.0 or later */ + +#define setbuf(stream,buf) ((buf==NULL) ? (void) __setvbuf(stream,NULL,_IONBF,0l) : (void) __setvbuf(stream,buf,_IOFBF,(size_t) BUFSIZ)) +#define setlinebuf(stream) (__setvbuf((stream),NULL,_IOLBF,_LBUFSIZ)) +#define rewind(stream) (__fseek((stream),0L,SEEK_SET)) +int __fseek(FILE *, long, int); +int __setvbuf(FILE *, char *, int, size_t); +int getc(FILE *); +int putc(int, FILE *); + +#else /* __ORCAC_VERSION */ + +#define getc(p) (fgetc(p)) +#define putc(x, p) fputc(x, p) +#define setbuf(stream,buf) ((buf==NULL) ? (void) setvbuf(stream,NULL,_IONBF,0l) : (void) setvbuf(stream,buf,_IOFBF,(size_t) BUFSIZ)) +#define setlinebuf(stream) (setvbuf((stream),NULL,_IOLBF,_LBUFSIZ)) +#define rewind(stream) (fseek((stream),0L,SEEK_SET)) + +#endif /* __ORCAC_VERSION */ + +/* + * Function declarations + */ + +void clearerr(FILE *); +int fclose(FILE *); +int feof(FILE *); +int ferror(FILE *); +int fflush(FILE *); +int fgetc(FILE *); +int fgetpos(FILE *, fpos_t *); +char *fgets(char *, int, FILE *); +FILE *fopen(const char *, const char *); +int fprintf(FILE *, const char *, ...); +int fputc(int, FILE *); +int fputs(const char *, FILE *); +size_t fread(void *, size_t, size_t, FILE *); +FILE *freopen(const char *, const char *, FILE *); +int fscanf(FILE *, const char *, ...); +int fseek(FILE *, long, int); +int fsetpos(FILE *, const fpos_t *); +long int ftell(FILE *); +size_t fwrite(const void *, size_t, size_t, FILE *); +int getchar(void); +char *gets(char *); +void perror(const char *); +int printf(const char *, ...); +int putchar(int); +int puts(const char *); +int remove(const char *); +int rename(const char *, const char *); +int scanf(const char *, ...); +int setvbuf(FILE *, char *, int, size_t); +int sprintf(char *, const char *, ...); +int sscanf(const char *, const char *, ...); +FILE *tmpfile(void); +char *tmpnam(char *); +int ungetc(int c, FILE *); +int vfprintf(FILE *, const char *, __va_list); +int vprintf(const char *, __va_list); +int vsprintf(char *, const char *, __va_list); + +/* + * The remaining functions and macros in this file are GNO-specific + */ + +/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ +#ifndef _ANSI_SOURCE +#define P_tmpdir "/tmp/" +#endif + +/* + * Functions defined in POSIX 1003.1. + */ +#ifndef _ANSI_SOURCE +#define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */ +#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */ +#define fileno(f) (f->_file) + +__BEGIN_DECLS +#ifndef _POSIX_SOURCE +char *cuserid __P((char *)); /* non-BSD */ +#endif +char *ctermid __P((char *)); +FILE *fdopen __P((int, const char *)); +int fileno __P((FILE *)); +__END_DECLS +#endif /* not ANSI */ + +/* + * Routines that are purely local. + */ +#if !defined (_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +__BEGIN_DECLS +char *fgetln __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)); +char *tempnam __P((const char *, const char *)); +int snprintf __P((char *, size_t, const char *, ...)); +int vfscanf __P((FILE *, const char *, __va_list)); +int vsnprintf __P((char *, size_t, const char *, __va_list)); +int vscanf __P((const char *, __va_list)); +int vsscanf __P((const char *, const char *, __va_list)); +FILE *zopen __P((const char *, const char *, int)); +__END_DECLS + +#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ + +#endif /* __stdio__ */ diff --git a/include/stdlib.h b/include/stdlib.h new file mode 100644 index 0000000..cebfe3d --- /dev/null +++ b/include/stdlib.h @@ -0,0 +1,202 @@ +/*- + * Copyright (c) 1990, 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. + * + * @(#)stdlib.h 8.3 (Berkeley) 2/16/94 + */ + +#ifndef _STDLIB_H_ +#define _STDLIB_H_ + +#ifndef _MACHINE_ANSI_H_ +#include +#endif + +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +#ifdef _BSD_WCHAR_T_ +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +typedef _BSD_WCHAR_T_ rune_t; +#endif +typedef _BSD_WCHAR_T_ wchar_t; +#undef _BSD_WCHAR_T_ +#endif + +typedef struct { + int quot; /* quotient */ + int rem; /* remainder */ +} div_t; + +typedef struct { + long quot; /* quotient */ + long rem; /* remainder */ +} ldiv_t; + +#ifndef NULL +#define NULL (void *) 0L +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +#define RAND_MAX 32767 + +extern int __mb_cur_max; +#define MB_CUR_MAX __mb_cur_max + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +__dead void + abort __P((void)) __dead2; +__pure int + abs __P((int)) __pure2; +int atexit __P((void (*)(void))); +double atof __P((const char *)); +int atoi __P((const char *)); +long atol __P((const char *)); +void *bsearch __P((const void *, const void *, size_t, + size_t, int (*)(const void *, const void *))); +void *calloc __P((size_t, size_t)); +__pure div_t + div __P((int, int)) __pure2; +__dead void + exit __P((int)) __dead2; +void free __P((void *)); +char *getenv __P((const char *)); +__pure long + labs __P((long)) __pure2; +__pure ldiv_t + ldiv __P((long, long)) __pure2; +void *malloc __P((size_t)); +void qsort __P((void *, size_t, size_t, + int (*)(const void *, const void *))); +int rand __P((void)); +void *realloc __P((void *, size_t)); +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +void rexit __P((int)); +#endif +void srand __P((unsigned)); +double strtod __P((const char *, char **)); +long strtol __P((const char *, char **, int)); +unsigned long + strtoul __P((const char *, char **, int)); +int system __P((const char *)); + +int mblen __P((const char *, size_t)); +size_t mbstowcs __P((wchar_t *, const char *, size_t)); +int wctomb __P((char *, wchar_t)); +int mbtowc __P((wchar_t *, const char *, size_t)); +size_t wcstombs __P((char *, const wchar_t *, size_t)); + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +int putenv __P((const char *)); +int setenv __P((const char *, const char *, int)); + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) + /* GNO-specific routines */ +int environInit __P((void)); /* formerly initenv(3) */ +void environPop __P((void)); /* formerly popenv(3) */ +int environPush __P((void)); /* formerly pushenv(3) */ +#endif + +double drand48 __P((void)); +double erand48 __P((unsigned short[3])); +long jrand48 __P((unsigned short[3])); +void lcong48 __P((unsigned short[7])); +long lrand48 __P((void)); +long mrand48 __P((void)); +long nrand48 __P((unsigned short[3])); +unsigned short + *seed48 __P((unsigned short[3])); +void srand48 __P((long)); + +void *alloca __P((size_t)); /* built-in for gcc */ + /* getcap(3) functions */ +char *getbsize __P((int *, long *)); +char *cgetcap __P((char *, char *, int)); +int cgetclose __P((void)); +int cgetent __P((char **, char **, char *)); +int cgetfirst __P((char **, char **)); +int cgetmatch __P((char *, char *)); +int cgetnext __P((char **, char **)); +int cgetnum __P((char *, char *, long *)); +int cgetset __P((char *)); +int cgetstr __P((char *, char *, char **)); +int cgetustr __P((char *, char *, char **)); + +int daemon __P((int, int)); +char *devname __P((int, int)); +int getloadavg __P((double [], int)); + +extern char *optarg; /* getopt(3) external variables */ +extern int opterr, optind, optopt; +int getopt __P((int, char * const *, const char *)); +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +int getopt_restart __P((void)); /* GNO v2.0.4 backward compatible */ +#endif + +extern char *suboptarg; /* getsubopt(3) external variable */ +int getsubopt __P((char **, char * const *, char **)); + +char *group_from_gid __P((unsigned long, int)); +int heapsort __P((void *, size_t, size_t, + int (*)(const void *, const void *))); +char *initstate __P((unsigned, char *, int)); +int mergesort __P((void *, size_t, size_t, + int (*)(const void *, const void *))); +int radixsort __P((const unsigned char **, int, const unsigned char *, + unsigned)); +int sradixsort __P((const unsigned char **, int, const unsigned char *, + unsigned)); +long random __P((void)); +char *realpath __P((const char *, char resolved_path[])); +char *setstate __P((char *)); +void srandom __P((unsigned)); +char *user_from_uid __P((unsigned long, int)); +#ifndef __STRICT_ANSI__ + /* non-BSD; uses "long long" and "unsigned long long" */ +struct quad_t; +struct quad_t strtoq __P((const char *, char **, int)); +struct u_quad_t; +struct u_quad_t strtouq __P((const char *, char **, int)); +#endif +void unsetenv __P((const char *)); + +#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ +__END_DECLS + +#endif /* !_STDLIB_H_ */ diff --git a/include/string.h b/include/string.h new file mode 100644 index 0000000..e13344d --- /dev/null +++ b/include/string.h @@ -0,0 +1,118 @@ +/*- + * Copyright (c) 1990, 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. + * + * @(#)string.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _STRING_H_ +#define _STRING_H_ + +#ifndef _MACHINE_ANSI_H_ +#include +#endif + +#if defined(_BSD_SIZE_T_) && !defined(__size_t__) +#define __size_t__ 1 +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +#ifndef NULL +#define NULL (void *) 0L +#endif + +#ifndef _SYS_CDEFS_H_ +#include +#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 *)); +size_t strxfrm __P((char *, const char *, size_t)); + +/* Nonstandard routines */ +#ifndef _ANSI_SOURCE +int bcmp __P((const void *, const void *, size_t)); +void bcopy __P((const void *, void *, size_t)); +void bzero __P((void *, size_t)); +int ffs __P((int)); +char *index __P((const char *, int)); +void *memccpy __P((void *, const void *, int, size_t)); +char *rindex __P((const char *, int)); +int strcasecmp __P((const char *, const char *)); +char *strdup __P((const char *)); +void strmode __P((int, char *)); +int strncasecmp __P((const char *, const char *, size_t)); +char *strsep __P((char **, const char *)); +void swab __P((const void *, void *, size_t)); + +/* These are specific to Orca and GNO. Some should probably use "const" */ +char *c2pstr __P((char *)); +char *p2cstr __P((char *)); +int strpos __P((char *, char)); +char *strrpbrk __P((char *, char *)); +int strrpos __P((char *, char)); +char *strupr __P((char *str)); +char *strlwr __P((char *str)); +char *strset __P((char *str, char ch)); +char *strnset __P((char *str, char ch, unsigned count)); +char *strrev __P((char *str)); +char *strpblnks __P((char *str)); +char *strrpblnks __P((char *str)); +char *strpad __P((char *str, char ch, unsigned count)); +char *strrpad __P((char *str, char ch, unsigned count)); +short stricmp __P((const char *s1, const char *s2)); +short strincmp __P((const char *s1, const char *s2, unsigned n)); + +#endif +__END_DECLS + +#endif /* _STRING_H_ */ diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h new file mode 100644 index 0000000..9d95902 --- /dev/null +++ b/include/sys/cdefs.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Berkeley Software Design, 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. + * + * @(#)cdefs.h 8.7 (Berkeley) 1/21/94 + * $Id: cdefs.h,v 1.1 1997/02/28 04:42:13 gdr Exp $ + */ + +#ifndef _SYS_CDEFS_H_ +#define _SYS_CDEFS_H_ + +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +/* + * The __CONCAT macro is used to concatenate parts of symbol names, e.g. + * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. + * The __CONCAT macro is a bit tricky -- make sure you don't put spaces + * in between its arguments. __CONCAT can also concatenate double-quoted + * strings produced by the __STRING macro, but this only works with ANSI C. + */ +#if defined(__STDC__) || defined(__cplusplus) +#define __P(protos) protos /* full-blown ANSI C */ +#define __CONCAT1(x,y) x ## y +#define __CONCAT(x,y) __CONCAT1(x,y) +#define __STRING(x) #x + +#define __const const /* define reserved names to standard */ +#define __signed signed +#define __volatile volatile + +#if defined(__cplusplus) +#define __inline inline /* convert to C++ keyword */ +#else +#define __inline /* delete GCC keyword */ +#endif /* !__cplusplus */ + +#else /* !(__STDC__ || __cplusplus) */ +#define __P(protos) () /* traditional C preprocessor */ +#define __CONCAT(x,y) x/**/y +#define __STRING(x) "x" + +#ifndef __GNUC__ +#define __const /* delete pseudo-ANSI C keywords */ +#define __inline +#define __signed +#define __volatile +/* + * In non-ANSI C environments, new programs will want ANSI-only C keywords + * deleted from the program and old programs will want them left alone. + * When using a compiler other than gcc, programs using the ANSI C keywords + * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. + * When using "gcc -traditional", we assume that this is the intent; if + * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. + */ +#ifndef NO_ANSI_KEYWORDS +#define const /* delete ANSI C keywords */ +#define inline +#define signed +#define volatile +#endif /* !NO_ANSI_KEYWORDS */ +#endif /* !__GNUC__ */ +#endif /* !(__STDC__ || __cplusplus) */ + +/* + * The original BSD version of this file had additional #defines intended + * for GNU gcc. They have been deleted from the GNO version, and we just + * provide the "short version". + */ +#define __dead +#define __dead2 +#define __pure +#define __pure2 +#define __attribute__(x) + +#endif /* !_SYS_CDEFS_H_ */ diff --git a/include/sys/dirent.h b/include/sys/dirent.h new file mode 100644 index 0000000..c83217b --- /dev/null +++ b/include/sys/dirent.h @@ -0,0 +1,84 @@ +/*- + * Copyright (c) 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. + * + * @(#)dirent.h 8.1 (Berkeley) 6/2/93 + * $Id: dirent.h,v 1.1 1997/02/28 04:42:13 gdr Exp $ + */ + +#ifndef _SYS_DIRENT_H_ +#define _SYS_DIRENT_H_ + +/* + * The dirent structure defines the format of directory entries returned by + * the getdirentries(2) system call. + * + * A directory entry has a struct dirent at the front of it, containing its + * inode number, the length of the entry, and the length of the name + * contained in the entry. These are followed by the name padded to a 4 + * byte boundary with null bytes. All names are guaranteed null terminated. + * The maximum length of a name in a directory is MAXNAMLEN. + */ + +struct dirent { + unsigned long d_fileno; /* file number of entry */ + unsigned short d_reclen; /* length of this record */ + unsigned char d_type; /* file type, see below */ + unsigned char d_namlen; /* length of string in d_name */ +#ifdef _POSIX_SOURCE + char d_name[255 + 1]; /* name must be no longer than this */ +#else +#define MAXNAMLEN 255 + char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */ +#endif +}; + +/* + * File types + */ +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 + +/* + * Convert between stat structure types and directory types. + */ +#ifndef __GNO__ /* these haven't been reviewed */ +#define IFTODT(mode) (((mode) & 0170000) >> 12) +#define DTTOIF(dirtype) ((dirtype) << 12) +#endif + +#endif diff --git a/include/sys/errno.h b/include/sys/errno.h new file mode 100644 index 0000000..fc38126 --- /dev/null +++ b/include/sys/errno.h @@ -0,0 +1,180 @@ +/* + * Copyright (c) 1982, 1986, 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 /* + * Copyright (c) 1982, 1986, 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 y 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. + * + * @(#)errno.h 8.5 (Berkeley) 1/21/94 + * $Id: errno.h,v 1.1 1997/02/28 04:42:14 gdr Exp $ + */ + +#ifndef _SYS_ERRNO_H_ +#define _SYS_ERRNO_H_ + +#ifndef KERNEL +extern int errno; /* global error number */ +#endif + +/* These are provided by both the GNO kernel and Orca/Shell */ +#define EDOM 1 /* Numerical argument out of domain */ +#define ERANGE 2 /* Result too large */ +#define ENOMEM 3 /* Cannot allocate memory */ +#define ENOENT 4 /* No such file or directory */ +#define EIO 5 /* Input/output error */ +#define EINVAL 6 /* Invalid argument */ +#define EBADF 7 /* Bad file descriptor */ +#define EMFILE 8 /* Too many open files */ +#define EACCES 9 /* Permission denied -- POSIX */ + /* The Orca/C uses */ + /* EACCESS for this value, */ + /* but that macro conflicts */ + /* with . */ +#define EEXIST 10 /* File exists */ +#define ENOSPC 11 /* No space left on device */ + +/* These are only provided by the GNO kernel. */ +#define EPERM 12 /* Operation not permitted */ +#define ESRCH 13 /* No such process */ +#define EINTR 14 /* Interrupted system call */ +#define E2BIG 15 /* Argument list too long */ +#define ENOEXEC 16 /* Exec format error */ +#define ECHILD 17 /* No child processes */ +#define EAGAIN 18 /* Resource temporarily unavailable */ +#define ENOTDIR 19 /* Not a directory */ +#define ENOTTY 20 /* Inappropriate ioctl for device */ +#define EPIPE 21 /* Broken pipe */ +#define ESPIPE 22 /* Illegal seek */ +#ifndef _POSIX_SOURCE +#define ENOTBLK 23 /* Block device required */ +#endif +#define EISDIR 24 /* Is a directory */ + +/* ipc/network software -- argument errors */ +#ifndef _POSIX_SOURCE +#define ENOTSOCK 25 /* Socket operation on non-socket */ +#define EDESTADDRREQ 26 /* Destination address required */ +#define EMSGSIZE 27 /* Message too long */ +#define EPROTOTYPE 28 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 29 /* Protocol not available */ +#define EPROTONOSUPPORT 30 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 31 /* Socket type not supported */ +#define EOPNOTSUPP 32 /* Operation not supported on socket */ +#define EPFNOSUPPORT 33 /* Protocol family not supported */ +#define EAFNOSUPPORT 34 /* Address family not supported by protocol family */ +#define EADDRINUSE 35 /* Address already in use */ +#define EADDRNOTAVAIL 36 /* Can't assign requested address */ + +/* ipc/network software -- operational errors */ +#define ENETDOWN 37 /* Network is down */ +#define ENETUNREACH 38 /* Network is unreachable */ +#define ENETRESET 39 /* Network dropped connection on reset */ +#define ECONNABORTED 40 /* Software caused connection abort */ +#define ECONNRESET 41 /* Connection reset by peer */ +#define ENOBUFS 42 /* No buffer space available */ +#define EISCONN 43 /* Socket is already connected */ +#define ENOTCONN 44 /* Socket is not connected */ +#define ESHUTDOWN 45 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 46 /* Too many references: can't splice */ +#define ETIMEDOUT 47 /* Connection timed out */ +#define ECONNREFUSED 48 /* Connection refused */ + +/* non-blocking and interrupt i/o */ +#define EWOULDBLOCK 49 /* Operation would block */ +#define EINPROGRESS 50 /* Operation now in progress */ +#define EALREADY 51 /* Operation already in progress */ +#endif /* _POSIX_SOURCE */ + +#define EFAULT 52 /* this one should be up top */ +#define ENODEV 53 /* this one should be up top */ + +#ifndef _POSIX_SOURCE +#define EHOSTDOWN 54 /* Host is down */ +#define EHOSTUNREACH 55 /* No route to host */ +#define ELAST 55 /* Must be equal largest errno */ +#endif + +/* + * The remainder of these values are not currently used by GNO. + */ +#if 0 +#define ENXIO 56 /* Device not configured */ +#define EDEADLK 57 /* Resource deadlock avoided */ +#define EBUSY 58 /* Device busy */ +#define EXDEV 59 /* Cross-device link */ +#define ENFILE 60 /* Too many open files in system */ +#ifndef _POSIX_SOURCE +#define ETXTBSY 61 /* Text file busy */ +#endif +#define EFBIG 62 /* File too large */ +#define EROFS 63 /* Read-only file system */ +#define EMLINK 64 /* Too many links */ +#ifndef _POSIX_SOURCE +#define ELOOP 65 /* Too many levels of symbolic links */ +#endif +#define ENAMETOOLONG 66 /* File name too long */ +#define ENOTEMPTY 67 /* Directory not empty */ +#define ENOLCK 68 /* No locks available */ +#define ENOSYS 69 /* Function not implemented */ + +/* quotas & mush */ +#ifndef _POSIX_SOURCE +#define EPROCLIM 70 /* Too many processes */ +#define EUSERS 71 /* Too many users */ +#define EDQUOT 72 /* Disc quota exceeded */ + +/* Network File System */ +#define ESTALE 73 /* Stale NFS file handle */ +#define EREMOTE 74 /* Too many levels of remote in path */ +#define EBADRPC 75 /* RPC struct is bad */ +#define ERPCMISMATCH 76 /* RPC version wrong */ +#define EPROGUNAVAIL 77 /* RPC prog. not avail */ +#define EPROGMISMATCH 78 /* Program version wrong */ +#define EPROCUNAVAIL 79 /* Bad procedure for program */ + +#define EFTYPE 80 /* Inappropriate file type or format */ +#define EAUTH 81 /* Authentication error */ +#define ENEEDAUTH 82 /* Need authenticator */ +#define ELAST 82 /* Must be equal largest errno */ +#endif /* _POSIX_SOURCE */ + +#ifdef KERNEL +/* pseudo-errors returned inside kernel to modify return to process */ +#define ERESTART -1 /* restart syscall */ +#define EJUSTRETURN -2 /* don't modify regs, just return */ +#endif + +#endif /* 0 */ +#endif /* _SYS_ERRNO_H_ */ diff --git a/include/sys/fcntl.h b/include/sys/fcntl.h new file mode 100644 index 0000000..e5bfb58 --- /dev/null +++ b/include/sys/fcntl.h @@ -0,0 +1,205 @@ +/*- + * Copyright (c) 1983, 1990, 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. + * + * @(#)fcntl.h 8.3 (Berkeley) 1/21/94 + * $Id: fcntl.h,v 1.1 1997/02/28 04:42:14 gdr Exp $ + */ + +#ifndef _SYS_FCNTL_H_ +#define _SYS_FCNTL_H_ + +/* + * This file includes the definitions for open and fcntl + * described by POSIX for ; it also includes + * related kernel definitions. + */ + +#if !defined(KERNEL) && !defined(_SYS_TYPES_H_) +#include +#endif + +/* + * File status flags: these are used by open(2), fcntl(2). + * They are also used (indirectly) in the kernel file structure f_flags, + * which is a superset of the open/fcntl flags. Open flags and f_flags + * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags). + * Open/fcntl flags begin with O_; kernel-internal flags begin with F. + */ +/* open-only flags */ +#define O_RDONLY 0x0001 /* open for reading only */ +#define O_WRONLY 0x0002 /* open for writing only */ +#define O_RDWR 0x0004 /* open for reading and writing */ +#define O_ACCMODE 0x0007 /* mask for above modes */ + +/* + * Kernel encoding of open mode; separate read and write bits that are + * independently testable: 1 greater than the above. + * + * XXX + * FREAD and FWRITE are excluded from the #ifdef KERNEL so that TIOCFLUSH, + * which was documented to use FREAD/FWRITE, continues to work. + */ +#ifndef _POSIX_SOURCE +#define FREAD 0x0001 +#define FWRITE 0x0002 +#endif +#define O_NONBLOCK 0x0008 /* no delay */ +#define O_APPEND 0x0010 /* set append mode */ +#if !defined(_POSIX_SOURCE) && !defined(__GNO__) +/* not yet implemented in GNO */ +#define O_SHLOCK conflicts with o_binary /* open with shared file lock */ +#define O_EXLOCK conflicts with o_trans /* open with exclusive file lock */ +#define O_ASYNC 0x0400 /* signal pgrp when data ready */ +#define O_FSYNC 0x0800 /* synchronous writes */ +#endif +#define O_CREAT 0x0020 /* create if nonexistant */ +#define O_TRUNC 0x0040 /* truncate to zero length */ +#define O_EXCL 0x0080 /* error if already exists */ +#if defined(KERNEL) && !defined(__GNO__) +/* not used in GNO */ +#define FMARK 0x1000 /* mark during gc() */ +#define FDEFER 0x2000 /* defer for next gc pass */ +#define FHASLOCK 0x4000 /* descriptor holds advisory lock */ +#endif + +#ifndef _POSIX_SOURCE +#define O_BINARY 0x0100 /* non-POSIX, mostly ignored by GNO */ +#define O_TRANS 0x0200 /* GNO specific */ +#endif + +/* defined by POSIX 1003.1; BSD default, so no bit required */ +#define O_NOCTTY 0 /* don't assign controlling terminal */ + +#ifdef KERNEL +/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */ +#define FFLAGS(oflags) ((oflags) + 1) +#define OFLAGS(fflags) ((fflags) - 1) + +/* bits to save after open */ +#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK) +/* bits settable by fcntl(F_SETFL, ...) */ +#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK) +#endif + +/* + * The O_* flags used to have only F* names, which were used in the kernel + * and by fcntl. We retain the F* names for the kernel f_flags field + * and for backward compatibility for fcntl. + */ +#ifndef _POSIX_SOURCE +#define FAPPEND O_APPEND /* kernel/compat */ +#define FASYNC O_ASYNC /* kernel/compat */ +#define FFSYNC O_FSYNC /* kernel */ +#define FNONBLOCK O_NONBLOCK /* kernel */ +#define FNDELAY O_NONBLOCK /* compat */ +#define O_NDELAY O_NONBLOCK /* compat */ +#endif + +/* + * Constants used for fcntl(2) + */ + +#ifdef __GNO__ +#define F_DUPFD 1 /* duplicate file descriptor */ +#else + +/* command values */ +#define F_DUPFD 0 /* duplicate file descriptor */ +#define F_GETFD 1 /* get file descriptor flags */ +#define F_SETFD 2 /* set file descriptor flags */ +#define F_GETFL 3 /* get file status flags */ +#define F_SETFL 4 /* set file status flags */ +#ifndef _POSIX_SOURCE +#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ +#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ +#endif +#define F_GETLK 7 /* get record locking information */ +#define F_SETLK 8 /* set record locking information */ +#define F_SETLKW 9 /* F_SETLK; wait if blocked */ + +/* file descriptor flags (F_GETFD, F_SETFD) */ +#define FD_CLOEXEC 1 /* close-on-exec flag */ + +/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ +#define F_RDLCK 1 /* shared or read lock */ +#define F_UNLCK 2 /* unlock */ +#define F_WRLCK 3 /* exclusive or write lock */ +#ifdef KERNEL +#define F_WAIT 0x010 /* Wait until lock is granted */ +#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */ +#define F_POSIX 0x040 /* Use POSIX semantics for lock */ +#endif + +/* + * Advisory file segment locking data type - + * information passed to system by user + */ +struct flock { + off_t l_start; /* starting offset */ + off_t l_len; /* len = 0 means until end of file */ + pid_t l_pid; /* lock owner */ + short l_type; /* lock type: read/write, etc. */ + short l_whence; /* type of l_start */ +}; + + +#ifndef _POSIX_SOURCE +/* lock operations for flock(2) */ +#define LOCK_SH 0x01 /* shared file lock */ +#define LOCK_EX 0x02 /* exclusive file lock */ +#define LOCK_NB 0x04 /* don't block when locking */ +#define LOCK_UN 0x08 /* unlock file */ +#endif + +#endif /* ! __GNO__ */ + +#ifndef KERNEL +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +int open __P((const char *, int, ...)); +int creat __P((const char *, mode_t)); +int fcntl __P((int, int, ...)); +#ifndef _POSIX_SOURCE +int flock __P((int, int)); +#endif /* !_POSIX_SOURCE */ +__END_DECLS +#endif + +#endif /* !_SYS_FCNTL_H_ */ diff --git a/include/sys/filio.h b/include/sys/filio.h new file mode 100644 index 0000000..bc246e3 --- /dev/null +++ b/include/sys/filio.h @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * 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. + * + * @(#)filio.h 8.1 (Berkeley) 3/28/94 + * $Id: filio.h,v 1.1 1997/02/28 04:42:14 gdr Exp $ + */ + +#ifndef _SYS_FILIO_H_ +#define _SYS_FILIO_H_ + +#ifndef _SYS_IOCCOM_H_ +#include +#endif + +/* Generic file-descriptor ioctl's. */ +#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ +#define FIONCLEX _IO('f', 2) /* remove close on exec */ +#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ +#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ +#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ +#define FIOSETOWN _IOW('f', 124, int) /* set owner */ +#define FIOGETOWN _IOR('f', 123, int) /* get owner */ + +#endif /* !_SYS_FILIO_H_ */ diff --git a/include/sys/ioccom.h b/include/sys/ioccom.h new file mode 100644 index 0000000..5cb16cd --- /dev/null +++ b/include/sys/ioccom.h @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * 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. + * + * @(#)ioccom.h 8.2 (Berkeley) 3/28/94 + * $Id: ioccom.h,v 1.1 1997/02/28 04:42:14 gdr Exp $ + */ + +#ifndef _SYS_IOCCOM_H_ +#define _SYS_IOCCOM_H_ + +/* + * Ioctl's have the command encoded in the lower word, and the size of + * any in or out parameters in the upper word. The high 3 bits of the + * upper word are used to encode the in/out status of the parameter. + * + * IOCPARM_MASK used to be 0x7f in GNO v2.0.4 + */ +#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ +#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) +#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) +#define IOCGROUP(x) (((x) >> 8) & 0xff) + +#define IOCPARM_MAX NBPG /* max size of ioctl, mult. of NBPG */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT) +#define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ + +#define _IOC(inout,group,num,len) \ + (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) +#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) +#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) +#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) +/* this should be _IORW, but stdio got there first */ +#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) + +#endif /* !_SYS_IOCCOM_H_ */ diff --git a/include/sys/ioctl.compat.h b/include/sys/ioctl.compat.h new file mode 100644 index 0000000..fb89c49 --- /dev/null +++ b/include/sys/ioctl.compat.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) 1990, 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. + * + * @(#)ioctl_compat.h 8.4 (Berkeley) 1/21/94 + * $Id: ioctl.compat.h,v 1.1 1997/02/28 04:42:14 gdr Exp $ + */ + +#ifndef _SYS_IOCTL_COMPAT_H_ +#define _SYS_IOCTL_COMPAT_H_ + +#ifndef _SYS_TTYCHARS_H_ +#include +#endif +#ifndef _SYS_TTYDEV_H_ +#include +#endif + +struct tchars { + char t_intrc; /* interrupt */ + char t_quitc; /* quit */ + char t_startc; /* start output */ + char t_stopc; /* stop output */ + char t_eofc; /* end-of-file */ + char t_brkc; /* input delimiter (like nl) */ +}; + +struct ltchars { + char t_suspc; /* stop process signal */ + char t_dsuspc; /* delayed stop process signal */ + char t_rprntc; /* reprint line */ + char t_flushc; /* flush output (toggles) */ + char t_werasc; /* word erase */ + char t_lnextc; /* literal next character */ +}; + +/* + * Structure for TIOCGETP and TIOCSETP ioctls. + */ +#ifndef _SGTTYB_ +#define _SGTTYB_ +struct sgttyb { + char sg_ispeed; /* input speed */ + char sg_ospeed; /* output speed */ + char sg_erase; /* erase character */ + char sg_kill; /* kill character */ + short sg_flags; /* mode flags */ +}; +#endif + +#ifdef USE_OLD_TTY +# undef TIOCGETD +# define TIOCGETD _IOR('t', 0, int) /* get line discipline */ +# undef TIOCSETD +# define TIOCSETD _IOW('t', 1, int) /* set line discipline */ +#else +# define OTIOCGETD _IOR('t', 0, int) /* get line discipline */ +# define OTIOCSETD _IOW('t', 1, int) /* set line discipline */ +#endif +#define TIOCHPCL _IO('t', 2) /* hang up on last close */ +#define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */ +#define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */ +#define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/ +#define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */ +#define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */ +#define TANDEM 0x00000001L /* send stopc on out q full */ +#define CBREAK 0x00000002L /* half-cooked mode */ +#define LCASE 0x00000004L /* simulate lower case */ +#ifdef ECHO /* from */ +#undef ECHO +#endif +#define ECHO 0x00000008L /* echo input */ +#define CRMOD 0x00000010L /* map \r to \r\n on output */ +#define RAW 0x00000020L /* no i/o processing */ +#define ODDP 0x00000040L /* get/send odd parity */ +#define EVENP 0x00000080L /* get/send even parity */ +#define ANYP 0x000000c0L /* get any parity/send none */ +#define NLDELAY 0x00000300L /* \n delay */ +#define NL0 0x00000000L +#define NL1 0x00000100L /* tty 37 */ +#define NL2 0x00000200L /* vt05 */ +#define NL3 0x00000300L +#define TBDELAY 0x00000c00L /* horizontal tab delay */ +#define TAB0 0x00000000L +#define TAB1 0x00000400L /* tty 37 */ +#define TAB2 0x00000800L +#define XTABS 0x00000c00L /* expand tabs on output */ +#define CRDELAY 0x00003000L /* \r delay */ +#define CR0 0x00000000L +#define CR1 0x00001000L /* tn 300 */ +#define CR2 0x00002000L /* tty 37 */ +#define CR3 0x00003000L /* concept 100 */ +#define VTDELAY 0x00004000L /* vertical tab delay */ +#define FF0 0x00000000L +#define FF1 0x00004000L /* tty 37 */ +#define BSDELAY 0x00008000L /* \b delay */ +#define BS0 0x00000000L +#define BS1 0x00008000L +#define ALLDELAY (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY) +#define CRTBS 0x00010000L /* do backspacing for crt */ +#define PRTERA 0x00020000L /* \ ... / erase */ +#define CRTERA 0x00040000L /* " \b " to wipe out char */ +#define TILDE 0x00080000L /* hazeltine tilde kludge */ +#define MDMBUF 0x00100000L /*start/stop output on carrier*/ +#define LITOUT 0x00200000L /* literal output */ +#define TOSTOP 0x00400000L /*SIGSTOP on background output*/ +#define FLUSHO 0x00800000L /* flush output to terminal */ +#define NOHANG 0x01000000L /* (no-op) was no SIGHUP on carrier drop */ +#define L001000 0x02000000L +#define CRTKIL 0x04000000L /* kill line with " \b " */ +#define PASS8 0x08000000L +#define CTLECH 0x10000000L /* echo control chars as ^X */ +#define PENDIN 0x20000000L /* tp->t_rawq needs reread */ +#define DECCTQ 0x40000000L /* only ^Q starts after ^S */ +#define NOFLSH 0x80000000L /* no output flush on signal */ +#define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ +#define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ +#define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */ +#define TIOCLGET _IOR('t', 124, int) /* get local modes */ +#define LCRTBS (CRTBS>>16) +#define LPRTERA (PRTERA>>16) +#define LCRTERA (CRTERA>>16) +#define LTILDE (TILDE>>16) +#define LMDMBUF (MDMBUF>>16) +#define LLITOUT (LITOUT>>16) +#define LTOSTOP (TOSTOP>>16) +#define LFLUSHO (FLUSHO>>16) +#define LNOHANG (NOHANG>>16) +#define LCRTKIL (CRTKIL>>16) +#define LPASS8 (PASS8>>16) +#define LCTLECH (CTLECH>>16) +#define LPENDIN (PENDIN>>16) +#define LDECCTQ (DECCTQ>>16) +#define LNOFLSH (NOFLSH>>16) +#define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars*/ +#define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars*/ +#define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */ +#define OTTYDISC 0 +#define NETLDISC 1 +#define NTTYDISC 2 + +#endif /* !_SYS_IOCTL_COMPAT_H_ */ diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h new file mode 100644 index 0000000..4326a2b --- /dev/null +++ b/include/sys/ioctl.h @@ -0,0 +1,132 @@ +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * 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. + * + * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 + * $Id: ioctl.h,v 1.1 1997/02/28 04:42:14 gdr Exp $ + */ + +#ifndef _SYS_IOCTL_H_ +#define _SYS_IOCTL_H_ + +#ifndef _SYS_TTYCOM_H_ +#include +#endif + +/* + * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ + * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented + * nonwithstanding). + */ +struct ttysize { + unsigned short ts_lines; + unsigned short ts_cols; + unsigned short ts_xxx; + unsigned short ts_yyy; +}; +#define TIOCGSIZE TIOCGWINSZ +#define TIOCSSIZE TIOCSWINSZ + +#ifndef _SYS_IOCCOM_H_ +#include +#endif + +#ifndef _SYS_FILIO_H_ +#include +#endif + +#ifndef _SYS_SOCKIO_H_ +#include +#endif + +#ifndef KERNEL + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +/* + * non-BSD: uses "..." instead of "void *" + */ +int ioctl __P((int, unsigned long, void *)); +__END_DECLS +#endif /* !KERNEL */ + +/* + * This section appears to be GNO-specific + */ +#if defined(__GNO__) && !defined(_POSIX_SOURCE) + +#define FIOCDIROK _IOW('f', 104, int) +#define TIOCSETK _IOW('t',19,unsigned int) /* set keyboard map flags */ +#define TIOCGETK _IOR('t',20,unsigned int) /* get keyboard map flags */ +#define OAMAP 0001 /* map OA-key to some sequence */ +#define OA2META 0002 /* map OA-key to meta-key */ +#define OA2HIBIT 0004 /* map OA-key to key|0x80 */ +#define VT100ARROW 0010 /* map arrows to vt100 arrows */ +#define TIOCSHUP _IOW('t',21,unsigned int) /* set sighup control flags */ +#define TIOCGHUP _IOR('t',22,unsigned int) /* get sighup control flags */ +#define CDxNIL 0x00 +#define CDxGPI 0x08 +#define CDxCTS 0x20 +#define TIOCSVECT _IOW('t',23,unsigned long *) /* set console i/o vectors */ +#define TIOCGVECT _IOR('t',24,unsigned long *) /* get console i/o vectors */ + +/* CS_RPAUSE */ +/* Disk space resource pause per-file control */ +#define FIOCNOSPC _IOWR('f', 106, int) +#define FIOCNOSPC_SAME 0 /* no change */ +#define FIOCNOSPC_ERROR 1 /* prohibit pause */ +#define FIOCNOSPC_PAUSE 2 /* allow pause */ +/* CS_RPAUSE */ + +#endif /* __GNO__ && !_POSIX_SOURCE */ + +#endif /* !_SYS_IOCTL_H_ */ + +/* + * Keep outside _SYS_IOCTL_H_ + * Compatability with old terminal driver + * + * Source level -> define USE_OLD_TTY + * Kernel level -> options COMPAT_43 or COMPAT_SUNOS + */ +#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) +#ifndef _SYS_IOCTL_COMPAT_H_ +#include +#endif +#endif diff --git a/include/sys/mount.h b/include/sys/mount.h new file mode 100644 index 0000000..a2a6e17 --- /dev/null +++ b/include/sys/mount.h @@ -0,0 +1,51 @@ +/* + * GNO/ME 2.0.6 + * mount.h - File system interface calls. + * This file used to be called + * + * $Id: mount.h,v 1.1 1997/02/28 04:42:14 gdr Exp $ + */ + +#ifndef _SYS_MOUNT_H_ +#define _SYS_MOUNT_H_ + +#ifndef _SYS_TYPES_H_ +#include +#endif + +typedef quad_t fsid_t; /* formerly an equivalent struct */ + +struct statfs { + long f_type; /* FST type (see below) */ + long f_bsize; /* fundamental file system block size */ + long f_blocks; /* total blocks in file system */ + long f_bfree; /* free blocks */ + long f_bavail; /* free blocks available to non-superuser */ + long f_files; /* total file nodes in file system */ + long f_ffree; /* free file nodes in fs */ + fsid_t f_fsid; /* file system id (GS/OS device number) */ + long f_spare[7]; /* reserved */ +}; + +#define MOUNT_PRODOS 0x0001 /* ProDOS or SOS */ +#define MOUNT_DOS_33 0x0002 /* DOS 3.3 */ +#define MOUNT_DOS_32 0x0003 /* DOS 3.1 or 3.2 */ +#define MOUNT_PASCAL 0x0004 /* Apple II Pascal */ +#define MOUNT_MFS 0x0005 /* Macintosh (MFS) */ +#define MOUNT_HFS 0x0006 /* Macintosh (HFS) */ +#define MOUNT_LISA 0x0007 /* Lisa */ +#define MOUNT_CPM 0x0008 /* Apple CP/M */ +#define MOUNT_MSDOS 0x000A /* MS/DOS */ +#define MOUNT_HISHS 0x000B /* High Sierra */ +#define MOUNT_CD9660 0x000C /* ISO 9660 (CD-ROM) */ +#define MOUNT_APLSHAR 0x000D /* AppleShare */ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +int statfs __P((const char *path, struct statfs *buf)); +int fstatfs __P((int fd, struct statfs *buf)); + +#endif /* _SYS_MOUNT_H_ */ + diff --git a/include/sys/param.h b/include/sys/param.h new file mode 100644 index 0000000..4e18aae --- /dev/null +++ b/include/sys/param.h @@ -0,0 +1,255 @@ +/*- + * Copyright (c) 1982, 1986, 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. + * + * @(#)param.h 8.2 (Berkeley) 1/21/94 + * $Id: param.h,v 1.1 1997/02/28 04:42:14 gdr Exp $ + */ + +#ifndef _SYS_PARAM_H_ +#define _SYS_PARAM_H_ + +#define BSD 199306 /* System version (year & month). */ +#define BSD4_3 1 +#define BSD4_4 1 + +#ifndef NULL +#define NULL (void *) 0L +#endif + +#if !defined(LOCORE) && !defined(_SYS_TYPES_H_) +#include +#endif + +/* + * Machine-independent constants (some used in following include files). + * Redefined constants are from POSIX 1003.1 limits file. + * + * MAXCOMLEN should be >= sizeof(ac_comm) (see ) + * MAXLOGNAME should be >= UT_NAMESIZE (see ) + */ +#ifndef _SYS_SYSLIMITS_H_ +#include +#endif + +#define MAXCOMLEN 16 /* max command name remembered */ +#define MAXINTERP 32 /* max interpreter file name length */ +#define MAXLOGNAME 12 /* max login name length */ +#define MAXUPRC CHILD_MAX /* max simultaneous processes */ +#define NCARGS ARG_MAX /* max bytes for an exec function */ +#define NGROUPS NGROUPS_MAX /* max number groups */ +#define NOFILE OPEN_MAX /* max open files per process */ +#define NOGROUP 65535 /* marker for empty group set member */ +#define MAXHOSTNAMELEN 256 /* max hostname size */ +#define MAXDOMNAMELEN 256 /* non-BSD: max domain name size */ + +/* More types and definitions used throughout the kernel. */ +#ifdef KERNEL +#include +#include +#include + +#ifndef __GNO__ +#include +#include +#endif + +#include + +#ifndef __GNO__ +#include +#endif + +#endif /* KERNEL */ + +/* Signals. */ +#ifndef _SYS_SIGNAL_H_ +#include +#endif + +/* Machine type dependent parameters. */ +#ifndef _MACHINE_PARAM_H_ +#include +#endif +#ifndef _MACHINE_LIMITS_H_ +#include +#endif + +#ifdef __GNO__ + +/* presumed size of GS/OS internal buffers */ +#define MAXBSIZE 4096 + +#else /* ! __GNO__ */ +%%% whoops -- you cannot have these defines + +/* + * Priorities. Note that with 32 run queues, differences less than 4 are + * insignificant. + */ +#define PSWP 0 +#define PVM 4 +#define PINOD 8 +#define PRIBIO 16 +#define PVFS 20 +#define PZERO 22 /* No longer magic, shouldn't be here. XXX */ +#define PSOCK 24 +#define PWAIT 32 +#define PLOCK 36 +#define PPAUSE 40 +#define PUSER 50 +#define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */ + +#define PRIMASK 0x0ff +#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ + +#define NZERO 0 /* default "nice" */ + +#define NBPW sizeof(int) /* number of bytes per word (integer) */ + +#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ +#define NODEV (dev_t)(-1) /* non-existent device */ + +/* + * Clustering of hardware pages on machines with ridiculously small + * page sizes is done here. The paging subsystem deals with units of + * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. + */ +#define CLBYTES (CLSIZE*NBPG) +#define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ +#define claligned(x) ((((int)(x))&CLOFSET)==0) +#define CLOFF CLOFSET +#define CLSHIFT (PGSHIFT+CLSIZELOG2) + +#if CLSIZE==1 +#define clbase(i) (i) +#define clrnd(i) (i) +#else +/* Give the base virtual address (first of CLSIZE). */ +#define clbase(i) ((i) &~ (CLSIZE-1)) +/* Round a number of clicks up to a whole cluster. */ +#define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) +#endif + +#define CBLOCK 128 /* Clist block size, must be a power of 2. */ +#define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */ + /* Data chars/clist. */ +#define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) +#define CROUND (CBLOCK - 1) /* Clist rounding. */ + +/* + * File system parameters and macros. + * + * The file system is made out of blocks of at most MAXBSIZE units, with + * smaller units (fragments) only in the last direct block. MAXBSIZE + * primarily determines the size of buffers in the buffer pool. It may be + * made larger without any effect on existing file systems; however making + * it smaller make make some file systems unmountable. Also, MAXBSIZE + * must be less than MAXPHYS!!! + */ +#define MAXBSIZE 16384 +#define MAXFRAG 8 + +#endif /* ! __GNO__ */ + +/* + * MAXPATHLEN defines the longest permissable path length after expanding + * symbolic links. It is used to allocate a temporary buffer from the buffer + * pool in which to do the name expansion, hence should be a power of two, + * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the + * maximum number of symbolic links that may be expanded in a path name. + * It should be set high enough to allow all legitimate uses, but halt + * infinite loops reasonably quickly. + */ +#define MAXPATHLEN PATH_MAX +#define MAXSYMLINKS 1 + +/* Bit map related macros. */ +#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) +#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) +#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) + +/* Macros for counting and rounding. */ +#ifndef howmany +#define howmany(x, y) (((x)+((y)-1))/(y)) +#endif +#define rounddown(x, y) (((x)/(y))*(y)) +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#define powerof2(x) ((((x)-1)&(x))==0) + +/* Macros for min/max. */ +#ifndef KERNEL +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MAX(a,b) (((a)>(b))?(a):(b)) +#endif + +#ifndef __GNO__ +/* + * Constants for setting the parameters of the kernel memory allocator. + * + * 2 ** MINBUCKET is the smallest unit of memory that will be + * allocated. It must be at least large enough to hold a pointer. + * + * Units of memory less or equal to MAXALLOCSAVE will permanently + * allocate physical memory; requests for these size pieces of + * memory are quite fast. Allocations greater than MAXALLOCSAVE must + * always allocate and free physical memory; requests for these + * size allocations should be done infrequently as they will be slow. + * + * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and + * MAXALLOCSIZE must be a power of two. + */ +#define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ +#define MAXALLOCSAVE (2 * CLBYTES) + +/* + * Scale factor for scaled integers used to count %cpu time and load avgs. + * + * The number of CPU `tick's that map to a unique `%age' can be expressed + * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that + * can be calculated (assuming 32 bits) can be closely approximated using + * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). + * + * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', + * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. + */ +#define FSHIFT 11 /* bits to right of fixed binary point */ +#define FSCALE (1<=NPORTS ) + +#endif /* KERNEL */ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +int pcreate __P((int count)); +int psend __P((int portid, long msg)); +long preceive __P((int portid)); +int pdelete __P((int portid, int (*dispose)(long))); +int preset __P((int portid, int (*dispose)(long))); +int pbind __P((int portid, const char *name)); +int pgetport __P((const char *name)); +int pgetcount __P((int portid)); + +#endif /* _SYS_PORTS_H_ */ diff --git a/include/sys/select.h b/include/sys/select.h new file mode 100644 index 0000000..4b8f638 --- /dev/null +++ b/include/sys/select.h @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 1992, 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. + * + * @(#)select.h 8.2 (Berkeley) 1/4/94 + * $Id: select.h,v 1.1 1997/02/28 04:42:15 gdr Exp $ + */ + +#ifndef _SYS_SELECT_H_ +#define _SYS_SELECT_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +/* + * Used to maintain information about processes that wish to be + * notified when I/O becomes possible. + */ +struct selinfo { + pid_t si_pid; /* process to be notified */ + short si_flags; /* see below */ +}; +#define SI_COLL 0x0001 /* collision occurred */ + +#ifdef KERNEL +struct proc; + +void selrecord __P((struct proc *selector, struct selinfo *)); +void selwakeup __P((struct selinfo *)); +#endif + +#endif /* !_SYS_SELECT_H_ */ diff --git a/include/sys/signal.h b/include/sys/signal.h new file mode 100644 index 0000000..61b4659 --- /dev/null +++ b/include/sys/signal.h @@ -0,0 +1,214 @@ +/* + * Copyright (c) 1982, 1986, 1989, 1991, 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. + * + * @(#)signal.h 8.2 (Berkeley) 1/21/94 + * $Id: signal.h,v 1.1 1997/02/28 04:42:15 gdr Exp $ + */ + +#ifndef _SYS_SIGNAL_H_ +#define _SYS_SIGNAL_H_ + +#define NSIG 31 /* counting 0; could be 32 (mask is 1-31) */ + +#if !defined(_ANSI_SOURCE) && !defined(_MACHINE_SIGNAL_H_) +#include /* sigcontext; codes for SIGILL, SIGFPE */ +#endif + +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt */ +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#ifndef _POSIX_SOURCE +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#endif +#define SIGABRT 6 /* abort() */ +#ifndef _POSIX_SOURCE +#define SIGIOT SIGABRT /* compatibility */ +#define SIGEMT 7 /* EMT instruction */ +#endif +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#ifndef _POSIX_SOURCE +#define SIGBUS 10 /* bus error */ +#endif +#define SIGSEGV 11 /* segmentation violation */ +#ifndef _POSIX_SOURCE +#define SIGSYS 12 /* bad argument to system call */ +#endif +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ +#ifndef _POSIX_SOURCE +#define SIGURG 16 /* urgent condition on IO channel */ +#endif +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#ifndef _POSIX_SOURCE +#define SIGCLD SIGCHLD /* System V name for SIGCHLD */ +#endif +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#ifndef _POSIX_SOURCE +#define SIGIO 23 /* input/output possible signal */ +#define SIGPOLL SIGIO /* System V name for SIGIO */ +#define SIGXCPU 24 /* exceeded CPU time limit */ +#define SIGXFSZ 25 /* exceeded file size limit */ +#define SIGVTALRM 26 /* virtual time alarm */ +#define SIGPROF 27 /* profiling time alarm */ +#define SIGWINCH 28 /* window size changes */ +#define SIGINFO 29 /* information request */ +#endif +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ + +typedef void (*__SIG_FUNC__) __P((int, int)); +#define SIG_DFL ((__SIG_FUNC__) (0)) +#define SIG_IGN ((__SIG_FUNC__) (1)) +#define SIG_ERR ((__SIG_FUNC__) (-1)) + +#ifndef _ANSI_SOURCE +typedef unsigned long sigset_t; /* non-BSD type */ + +/* + * Signal vector "template" used in sigaction call. + */ +struct sigaction { +#ifdef __GNO__ + void (*sa_handler)(int, void (*)(void)); /* signal handler */ +#else + void (*sa_handler)(); /* signal handler */ +#endif + sigset_t sa_mask; /* signal mask to apply */ + int sa_flags; /* see signal options below */ +}; +#ifndef _POSIX_SOURCE +#define SA_ONSTACK 0x0001 /* take signal on signal stack */ +#define SA_RESTART 0x0002 /* restart system on signal return */ +#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */ +#ifdef COMPAT_SUNOS +#define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */ +#endif +#endif +#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */ + +/* + * Flags for sigprocmask: (non-BSD: off by one) + */ +#define SIG_BLOCK 0 /* block specified signal set */ +#define SIG_UNBLOCK 1 /* unblock specified signal set */ +#define SIG_SETMASK 2 /* set specified signal set */ + +#ifndef _POSIX_SOURCE + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +#if 1 /* GNO */ +typedef void (*sig_t) __P((int, int)); /* type of signal function */ +#else /* BSD */ +typedef void (*sig_t) __P((int)); /* type of signal function */ +#endif + +/* + * Structure used in sigaltstack call. + */ +struct sigaltstack { + char *ss_sp; /* signal stack base */ + int ss_size; /* signal stack length */ + int ss_flags; /* SA_DISABLE and/or SA_ONSTACK */ +}; +#define MINSIGSTKSZ 8192 /* minimum allowable stack */ +#define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */ + +/* + * 4.3 compatibility: + * Signal vector "template" used in sigvec call. + */ +struct sigvec { +#ifdef __GNO__ + sig_t sv_handler; /* signal handler */ +#else + void (*sv_handler)(); /* signal handler */ +#endif + int sv_mask; /* signal mask to apply */ + int sv_flags; /* see signal options below */ +}; + +#define SV_ONSTACK SA_ONSTACK +#define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ +#define sv_onstack sv_flags /* isn't compatibility wonderful! */ + +/* + * Structure used in sigstack call. + */ +struct sigstack { + char *ss_sp; /* signal stack pointer */ + int ss_onstack; /* current status */ +}; + +/* + * Macro for converting signal number to a mask suitable for + * sigblock(). + */ +#define sigmask(m) (1 << ((unsigned long int)((m)-1))) + +#define BADSIG SIG_ERR + +#endif /* !_POSIX_SOURCE */ +#endif /* !_ANSI_SOURCE */ + +/* + * For historical reasons; programs expect signal's return value to be + * defined by . + */ +__BEGIN_DECLS + +#ifndef _POSIX_SOURCE +sig_t signal __P((int, sig_t)); +#endif + +/* + * Old definitions: + * BSD: void (*signal __P((int, void (*) __P((int))))) __P((int)); + * GNO: void *signal(int sig, void (*func)(int, int)); + */ + +__END_DECLS +#endif /* !_SYS_SIGNAL_H_ */ diff --git a/include/sys/socket.h b/include/sys/socket.h new file mode 100644 index 0000000..e49106e --- /dev/null +++ b/include/sys/socket.h @@ -0,0 +1,373 @@ +/* + * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 + * 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. + * + * @(#)socket.h 8.4 (Berkeley) 2/21/94 + * $Id: socket.h,v 1.1 1997/02/28 04:42:15 gdr Exp $ + */ + +#ifndef _SYS_SOCKET_H_ +#define _SYS_SOCKET_H_ + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ +#define SO_USEPRIV 0x4000 /* non-BSD: allocate from privileged port area */ +#define SO_CANTSIG 0x8000 /* non-BSD: prevent SIGPIPE on SS_CANTSENDMORE */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_LOCAL 1 /* local to host (pipes, portals) */ +#define AF_UNIX AF_LOCAL /* backward compatibility */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_NBS AF_ISO /* non-BSD */ +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_MAX 17 + +#if 0 /* not implemented under GNO v2.0.6 */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ +#define AF_COIP 20 /* connection-oriented IP, aka ST II */ +#define AF_CNT 21 /* Computer Network Technology */ +#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ +#define AF_IPX 23 /* Novell Internet Protocol */ +#define AF_SIP 24 /* Simple Internet Protocol */ +#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ +#define AF_ISDN 26 /* Integrated Services Digital Network*/ +#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ +#define AF_MAX 27 +#endif /* 0 */ + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + u_char sa_len; /* total length */ + u_char sa_family; /* address family */ + char sa_data[14]; /* actually longer; address value */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + u_short sp_family; /* address family */ + u_short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_LOCAL AF_LOCAL +#define PF_UNIX PF_LOCAL /* backward compatibility */ +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_NBS AF_ISO /* non-BSD */ +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ +#define PF_COIP AF_COIP +#define PF_CNT AF_CNT +#define PF_SIP AF_SIP +#define PF_IPX AF_IPX /* same format as AF_NS */ +#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */ +#define PF_PIP pseudo_AF_PIP +#define PF_ISDN AF_ISDN + +#define PF_MAX AF_MAX + +/* + * Definitions for network related sysctl, CTL_NET. + * + * Second level is protocol family. + * Third level is protocol number. + * + * Further levels are defined by the individual families below. + */ +#define NET_MAXID AF_MAX + +#define CTL_NET_NAMES { \ + { 0, 0 }, \ + { "unix", CTLTYPE_NODE }, \ + { "inet", CTLTYPE_NODE }, \ + { "implink", CTLTYPE_NODE }, \ + { "pup", CTLTYPE_NODE }, \ + { "chaos", CTLTYPE_NODE }, \ + { "xerox_ns", CTLTYPE_NODE }, \ + { "iso", CTLTYPE_NODE }, \ + { "emca", CTLTYPE_NODE }, \ + { "datakit", CTLTYPE_NODE }, \ + { "ccitt", CTLTYPE_NODE }, \ + { "ibm_sna", CTLTYPE_NODE }, \ + { "decnet", CTLTYPE_NODE }, \ + { "dec_dli", CTLTYPE_NODE }, \ + { "lat", CTLTYPE_NODE }, \ + { "hylink", CTLTYPE_NODE }, \ + { "appletalk", CTLTYPE_NODE }, \ + { "route", CTLTYPE_NODE }, \ + { "link_layer", CTLTYPE_NODE }, \ + { "xtp", CTLTYPE_NODE }, \ + { "coip", CTLTYPE_NODE }, \ + { "cnt", CTLTYPE_NODE }, \ + { "rtip", CTLTYPE_NODE }, \ + { "ipx", CTLTYPE_NODE }, \ + { "sip", CTLTYPE_NODE }, \ + { "pip", CTLTYPE_NODE }, \ +} + +/* + * PF_ROUTE - Routing table + * + * Three additional levels are defined: + * Fourth: address family, 0 is wildcard + * Fifth: type of info, defined below + * Sixth: flag(s) to mask with for NET_RT_FLAGS + */ +#define NET_RT_DUMP 1 /* dump; may limit to a.f. */ +#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ +#define NET_RT_IFLIST 3 /* survey interface list */ +#define NET_RT_MAXID 4 + +#define CTL_NET_RT_NAMES { \ + { 0, 0 }, \ + { "dump", CTLTYPE_STRUCT }, \ + { "flags", CTLTYPE_STRUCT }, \ + { "iflist", CTLTYPE_STRUCT }, \ +} + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 /* non-BSD: was 128 */ + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ + +#if 0 /* not used in GNO v2.0.6 */ +#define MSG_EOR 0x8 /* data completes record */ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ +#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ +#define MSG_EOF 0x100 /* data completes connection */ +#define MSG_COMPAT 0x8000 /* used in sendit() */ +#endif /* 0 */ + +#define MSG_MAXIOVLEN 16 /* non-BSD */ + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + u_int cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by u_char cmsg_data[]; */ +}; + +/* given pointer to struct cmsghdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) + +/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ + +/* + * 4.3 compat sockaddr, move to compat file later + */ +struct osockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * 4.3-compat message header (move to compat file later). + */ +struct omsghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#ifndef KERNEL + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +/* GNO is currently using osockaddr and omsghdr */ +#define __SOCKADDR osockaddr +#define __MSGHDR omsghdr + +__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 getpeername __P((int, struct __SOCKADDR *, int *)); +int getsockname __P((int, struct __SOCKADDR *, int *)); +int getsockopt __P((int, int, int, void *, int *)); +int listen __P((int, int)); +/* + * The next block of declarations have return types that differ from + * their BSD implementations (returing int instead of ssize_t). They also + * use "unsigned" vice "int" for the type of one of their parameters. -- gdr + */ +int recv __P((int, void *, size_t, unsigned int)); +int recvfrom __P((int, void *, size_t, unsigned int, struct __SOCKADDR *, int *)); +int recvmsg __P((int, struct __MSGHDR *, unsigned int)); +int send __P((int, const void *, size_t, unsigned int)); +int sendto __P((int, const void *, + size_t, int, const struct __SOCKADDR *, unsigned int)); +int sendmsg __P((int, const struct __MSGHDR *, unsigned int)); +/* + * End non-BSD block. + */ +int setsockopt __P((int, int, int, const void *, int)); +int shutdown __P((int, int)); +int socket __P((int, int, int)); +int socketpair __P((int, int, int, int *)); +__END_DECLS + +#else /* KERNEL */ +void pfctlinput __P((int, struct __SOCKADDR *)); +#endif /* !KERNEL */ +#endif /* !_SYS_SOCKET_H_ */ diff --git a/include/sys/sockio.h b/include/sys/sockio.h new file mode 100644 index 0000000..255f9e5 --- /dev/null +++ b/include/sys/sockio.h @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * 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. + * + * @(#)sockio.h 8.1 (Berkeley) 3/28/94 + * $Id: sockio.h,v 1.1 1997/02/28 04:42:15 gdr Exp $ + */ + +#ifndef _SYS_SOCKIO_H_ +#define _SYS_SOCKIO_H_ + +#ifndef _SYS_IOCCOM_H_ +#include +#endif + +#undef _UNIMPLEMENTED /* GNO doesn't have all of these yet */ + +/* Socket ioctl's. */ +#ifdef _UNIMPLEMENTED +#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ +#endif +#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ +#ifdef _UNIMPLEMENTED +#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ +#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ +#endif + +#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ +#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ +#define SIOCSETRTINFO _IOWR('r', 12, struct fullrtentry) /* change aux info */ +#define SIOCGETRTINFO _IOWR('r', 13, struct fullrtentry) /* read aux info */ +#define SIOCGETVIFINF _IOWR('r', 14, struct vif_conf) /* read m/c vifs */ +#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */ +#ifdef _UNIMPLEMENTED +#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */ +#endif + +#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ +#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ +#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ +#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ +#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ +#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ +#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ +#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ +#ifdef _UNIMPLEMENTED +#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ +#endif +#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ +#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ +#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ +#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ +#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ +#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ +#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ +#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ + +#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ +#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ +#if 1 /* GNO */ +#define SIOCGIFMTU _IOWR('i', 126, struct ifreq) /* get IF mtu */ +#define SIOCSIFMTU _IOW('i', 127, struct ifreq) /* set IF mtu */ +#else /* BSD */ +#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */ +#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */ +#endif +#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */ +#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ + +#endif /* !_SYS_SOCKIO_H_ */ diff --git a/include/sys/stat.h b/include/sys/stat.h new file mode 100644 index 0000000..0ec1711 --- /dev/null +++ b/include/sys/stat.h @@ -0,0 +1,248 @@ +/*- + * Copyright (c) 1982, 1986, 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. + * + * @(#)stat.h 8.6 (Berkeley) 3/8/94 + * $Id: stat.h,v 1.1 1997/02/28 04:42:15 gdr Exp $ + */ + +#ifndef _SYS_STAT_H_ +#define _SYS_STAT_H_ + +/* + * XXX we need this for struct timespec. We get miscellaneous namespace + * pollution with it. struct timespace itself is namespace pollution if + * _POSIX_SOURCE is defined. + */ +#ifndef _SYS_TIME_H_ +#include +#endif + +#ifdef __GNO__ + +struct stat +{ + dev_t st_dev; + ino_t st_ino; + unsigned short st_mode; + short st_nlink; /* number of links to file = 0 */ + uid_t st_uid; /* user id = 0 */ + gid_t st_gid; /* group id = 0 */ + dev_t st_rdev; + off_t st_size; + time_t st_atime; /* last access time = mod time */ + int st_spare1; + time_t st_mtime; + int st_spare2; + time_t st_ctime; + int st_spare3; + long st_blksize; + long st_blocks; + long st_spare4[2]; +}; + +#ifdef KERNEL +#define STAT_BSIZE 512 /* size of blocks in st_blocks */ +#define STAT_BSHIFT 9 /* log2(STAT_BSIZE) */ +#define btosb(bytes) ((unsigned)(bytes) >> STAT_BSHIFT) +#define sbtob(db) ((unsigned)(db) << STAT_BSHIFT) +#endif + +#else /* ! __GNO__ */ +%%% __GNO__ is not defined and it should be. See 13/orcacdefs/defaults.h + +#ifndef _POSIX_SOURCE +struct ostat { + unsigned short st_dev; /* inode's device */ + ino_t st_ino; /* inode's number */ + mode_t st_mode; /* inode protection mode */ + nlink_t st_nlink; /* number of hard links */ + unsigned short st_uid; /* user ID of the file's owner */ + unsigned short st_gid; /* group ID of the file's group */ + unsigned short st_rdev; /* device type */ + long st_size; /* file size, in bytes */ + struct timespec st_atimespec; /* time of last access */ + struct timespec st_mtimespec; /* time of last data modification */ + struct timespec st_ctimespec; /* time of last file status change */ + long st_blksize; /* optimal blocksize for I/O */ + long st_blocks; /* blocks allocated for file */ + unsigned long st_flags; /* user defined flags for file */ + unsigned long st_gen; /* file generation number */ +}; +#endif /* !_POSIX_SOURCE */ + +struct stat { + dev_t st_dev; /* inode's device */ + ino_t st_ino; /* inode's number */ + mode_t st_mode; /* inode protection mode */ + nlink_t st_nlink; /* number of hard links */ + uid_t st_uid; /* user ID of the file's owner */ + gid_t st_gid; /* group ID of the file's group */ + dev_t st_rdev; /* device type */ + struct timespec st_atimespec; /* time of last access */ + struct timespec st_mtimespec; /* time of last data modification */ + struct timespec st_ctimespec; /* time of last file status change */ + off_t st_size; /* file size, in bytes */ + quad_t st_blocks; /* blocks allocated for file */ + unsigned long st_blksize; /* optimal blocksize for I/O */ + unsigned long st_flags; /* user defined flags for file */ + unsigned long st_gen; /* file generation number */ + long st_lspare; + quad_t st_qspare[2]; +}; +#define st_atime st_atimespec.ts_sec +#define st_mtime st_mtimespec.ts_sec +#define st_ctime st_ctimespec.ts_sec + +#endif /* ! __GNO__ */ + +#define S_ISUID 0004000 /* set user id on execution */ +#define S_ISGID 0002000 /* set group id on execution */ +#ifndef _POSIX_SOURCE +#define S_ISTXT 0001000 /* sticky bit */ +#endif + +#define S_IRWXU 0000700 /* RWX mask for owner */ +#define S_IRUSR 0000400 /* R for owner */ +#define S_IWUSR 0000200 /* W for owner */ +#define S_IXUSR 0000100 /* X for owner */ + +#ifndef _POSIX_SOURCE +#define S_IREAD S_IRUSR +#define S_IWRITE S_IWUSR +#define S_IEXEC S_IXUSR +#endif + +#define S_IRWXG 0000070 /* RWX mask for group */ +#define S_IRGRP 0000040 /* R for group */ +#define S_IWGRP 0000020 /* W for group */ +#define S_IXGRP 0000010 /* X for group */ + +#define S_IRWXO 0000007 /* RWX mask for other */ +#define S_IROTH 0000004 /* R for other */ +#define S_IWOTH 0000002 /* W for other */ +#define S_IXOTH 0000001 /* X for other */ + +#ifndef _POSIX_SOURCE +#define S_IFMT 0170000 /* type of file mask */ +#define S_IFIFO 0010000 /* named pipe (fifo) */ +#define S_IFCHR 0020000 /* character special */ +#define S_IFDIR 0040000 /* directory */ +#define S_IFBLK 0060000 /* block special */ +#define S_IFREG 0100000 /* regular */ +#define S_IFLNK 0120000 /* symbolic link */ +#define S_IFSOCK 0140000 /* socket */ +#define S_ISVTX 0001000 /* save swapped text even after use */ +#endif + +#define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */ +#define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */ +#define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */ +#define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */ +#define S_ISFIFO(m) (((m) & 0170000) == 0010000 || \ + ((m) & 0170000) == 0140000) /* fifo or socket */ +#ifndef _POSIX_SOURCE +#define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */ +#define S_ISSOCK(m) (((m) & 0170000) == 0010000 || \ + ((m) & 0170000) == 0140000) /* fifo or socket */ +#endif + +#ifndef _POSIX_SOURCE +#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ + /* 7777 */ +#define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO) + /* 0666 */ +#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) + +#define S_BLKSIZE 512 /* block size used in the stat struct */ + +/* + * Definitions of flags stored in file flags word. + * + * Super-user and owner changeable flags. + */ +#define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */ +#define UF_NODUMP 0x00000001 /* do not dump file */ +#define UF_IMMUTABLE 0x00000002 /* file may not be changed */ +#define UF_APPEND 0x00000004 /* writes to file may only append */ +/* + * Super-user changeable flags. + */ +#define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */ +#define SF_ARCHIVED 0x00010000 /* file is archived */ +#define SF_IMMUTABLE 0x00020000 /* file may not be changed */ +#define SF_APPEND 0x00040000 /* writes to file may only append */ + +#ifdef KERNEL +/* + * Shorthand abbreviations of above. + */ +#define APPEND (UF_APPEND | SF_APPEND) +#define IMMUTABLE (UF_IMMUTABLE | SF_IMMUTABLE) +#endif + +#endif /* !_POSIX_SOURCE */ + +#ifdef KERNEL +void cvtstat __P((struct stat *, struct ostat *)); +#else /* KERNEL */ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +int chmod __P((const char *, mode_t)); +int fstat __P((int, struct stat *)); +#if 1 /* GNO implementation currently missing mode_t parameter */ +int mkdir __P((const char *)); +#else +int mkdir __P((const char *, mode_t)); +#endif +int mkfifo __P((const char *, mode_t)); +int stat __P((const char *, struct stat *)); +mode_t umask __P((mode_t)); +#ifndef _POSIX_SOURCE +int chflags __P((const char *, u_long)); +int fchflags __P((int, u_long)); +int fchmod __P((int, mode_t)); +int lstat __P((const char *, struct stat *)); +#endif +__END_DECLS + +#endif /* KERNEL */ + +#endif /* !_SYS_STAT_H_ */ diff --git a/include/sys/syslimits.h b/include/sys/syslimits.h new file mode 100644 index 0000000..68bc239 --- /dev/null +++ b/include/sys/syslimits.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1988, 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. + * + * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 + * $Id: syslimits.h,v 1.1 1997/02/28 04:42:15 gdr Exp $ + */ + +#ifndef _SYS_SYSLIMITS_H_ +#define _SYS_SYSLIMITS_H_ + +#define ARG_MAX 1024 /* max bytes for an exec function */ + /* non-BSD: was 65536 */ +#ifndef CHILD_MAX +#define CHILD_MAX 40 /* max simultaneous processes */ +#endif +#define LINK_MAX 1 /* max file link count *//* non-BSD */ +#define MAX_CANON 255 /* max bytes in term canon input line */ +#define MAX_INPUT 255 /* max bytes in terminal input */ +#define NAME_MAX 255 /* max bytes in a file name */ +#define NGROUPS_MAX 16 /* max supplemental group id's */ +#ifndef OPEN_MAX /* non-BSD: OPEN_MAX was 32 */ +#define OPEN_MAX 30 /* max open files per process */ +#endif +#define PATH_MAX 1024 /* max bytes in pathname */ +#define PIPE_BUF 512 /* max bytes for atomic pipe writes */ + +#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ +#define BC_DIM_MAX 2048 /* max array elements in bc(1) */ +#define BC_SCALE_MAX 99 /* max scale value in bc(1) */ +#define BC_STRING_MAX 1000 /* max const string length in bc(1) */ +#define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */ +#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ +#define LINE_MAX 2048 /* max bytes in an input line */ +#define RE_DUP_MAX 255 /* max RE's in interval notation */ + +#endif diff --git a/include/sys/syslog.h b/include/sys/syslog.h new file mode 100644 index 0000000..b8930de --- /dev/null +++ b/include/sys/syslog.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 1982, 1986, 1988, 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. + * + * @(#)syslog.h 8.1 (Berkeley) 6/2/93 + * $Id: syslog.h,v 1.1 1997/02/28 04:42:15 gdr Exp $ + */ + +#ifndef _SYS_SYSLOG_H_ +#define _SYS_SYSLOG_H_ + +#define _PATH_LOG "/dev/log" + +/* + * priorities/facilities are encoded into a single 32-bit quantity, where the + * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility + * (0-big number). Both the priorities and the facilities map roughly + * one-to-one to strings in the syslogd(8) source code. This mapping is + * included in this file. + * + * 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 significant condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ + +#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ + /* extract priority */ +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +#ifdef SYSLOG_NAMES +#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ + /* mark "facility" */ +#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) +typedef struct _code { + char *c_name; + int c_val; +} CODE; + +CODE prioritynames[] = { + "alert", LOG_ALERT, + "crit", LOG_CRIT, + "debug", LOG_DEBUG, + "emerg", LOG_EMERG, + "err", LOG_ERR, + "error", LOG_ERR, /* DEPRECATED */ + "info", LOG_INFO, + "none", INTERNAL_NOPRI, /* INTERNAL */ + "notice", LOG_NOTICE, + "panic", LOG_EMERG, /* DEPRECATED */ + "warn", LOG_WARNING, /* DEPRECATED */ + "warning", LOG_WARNING, + NULL, -1, +}; +#endif + +/* 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 */ +#define LOG_CRON (9<<3) /* clock daemon */ +#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ +#define LOG_FTP (11<<3) /* ftp daemon */ + + /* 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 /* current number of facilities */ +#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ + /* facility of pri */ +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) + +#ifdef SYSLOG_NAMES +CODE facilitynames[] = { + "auth", LOG_AUTH, + "authpriv", LOG_AUTHPRIV, + "cron", LOG_CRON, + "daemon", LOG_DAEMON, + "ftp", LOG_FTP, + "kern", LOG_KERN, + "lpr", LOG_LPR, + "mail", LOG_MAIL, + "mark", INTERNAL_MARK, /* INTERNAL */ + "news", LOG_NEWS, + "security", LOG_AUTH, /* DEPRECATED */ + "syslog", LOG_SYSLOG, + "user", LOG_USER, + "uucp", LOG_UUCP, + "local0", LOG_LOCAL0, + "local1", LOG_LOCAL1, + "local2", LOG_LOCAL2, + "local3", LOG_LOCAL3, + "local4", LOG_LOCAL4, + "local5", LOG_LOCAL5, + "local6", LOG_LOCAL6, + "local7", LOG_LOCAL7, + NULL, -1, +}; +#endif + +#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 /* don't wait for console forks: DEPRECATED */ +#define LOG_PERROR 0x20 /* log to stderr as well */ + +#ifdef KERNEL + +#else /* not KERNEL */ + +/* + * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two + * places ( and ), so if we include one + * of them here we may collide with the utility's includes. It's unreasonable + * for utilities to have to include one of them to include syslog.h, so we get + * _BSD_VA_LIST_ from and use it. + */ +#ifndef _MACHINE_ANSI_H_ +#include +#endif +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +void closelog __P((void)); +void openlog __P((const char *, int, int)); +int setlogmask __P((int)); +void syslog __P((int, const char *, ...)); +void vsyslog __P((int, const char *, _BSD_VA_LIST_)); +#ifndef _POSIX_SOURCE +void old_syslog __P((char **dataHandle)); /* GNO-specific */ +#endif +__END_DECLS + +#endif /* !KERNEL */ + +#endif diff --git a/include/sys/termios.h b/include/sys/termios.h new file mode 100644 index 0000000..59b0909 --- /dev/null +++ b/include/sys/termios.h @@ -0,0 +1,284 @@ +/* + * Copyright (c) 1988, 1989, 1993, 1994 + * 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. + * + * @(#)termios.h 8.3 (Berkeley) 3/28/94 + * $Id: termios.h,v 1.1 1997/02/28 04:42:15 gdr Exp $ + */ + +#ifndef _SYS_TERMIOS_H_ +#define _SYS_TERMIOS_H_ + +/* + * Special Control Characters + * + * Index into c_cc[] character array. + * + * Name Subscript Enabled by + */ +#define VEOF 0 /* ICANON */ +#define VEOL 1 /* ICANON */ +#define VINTR 2 /* ISIG */ +#define VQUIT 3 /* ISIG */ +#define VSTART 4 /* IXON, IXOFF */ +#define VSTOP 5 /* IXON, IXOFF */ +#define VSUSP 6 /* ISIG */ +#define VERASE 7 /* ICANON */ +#define VKILL 8 /* ICANON */ + +#define VMIN 1 /* !ICANON */ +#define VTIME 2 /* !ICANON */ + +#define NCCS 9 + +#if 0 /* not used by GNO v2.0.6 */ +#ifndef _POSIX_SOURCE +#define VEOL2 9 /* ICANON */ +#define VWERASE 10 /* ICANON */ +#define VREPRINT 11 /* ICANON */ +#define VDSUSP 12 /* ISIG */ +#define VLNEXT 13 /* IEXTEN */ +#define VDISCARD 14 /* IEXTEN */ +#define VSTATUS 15 /* ICANON */ +#define NCCS 15 +#endif +#endif /* 0 */ + +#define _POSIX_VDISABLE 0xff + +#ifndef _POSIX_SOURCE +#define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0) +#endif + +/* + * Input flags - software input processing + */ +#define BRKINT 0x0001 /* map BREAK to SIGINTR */ +#define IGNBRK 0x0002 /* ignore BREAK condition */ +#define IGNPAR 0x0004 /* ignore (discard) parity errors */ +#define PARMRK 0x0008 /* mark parity and framing errors */ +#define INPCK 0x0010 /* enable checking of parity errors */ +#define ISTRIP 0x0020 /* strip 8th bit off chars */ +#define INLCR 0x0040 /* map NL into CR */ +#define IGNCR 0x0080 /* ignore CR */ +#define ICRNL 0x0100 /* map CR to NL (ala CRMOD) */ +#define IXON 0x0200 /* enable output flow control */ +#define IXOFF 0x0400 /* enable input flow control */ +#if 0 && !defined(_POSIX_SOURCE) /* not used by GNO v2.0.6 */ +#define IXANY 0x0800 /* any char will restart after stop */ +#define IMAXBEL 0x2000 /* ring bell on input queue full */ +#endif /*_POSIX_SOURCE */ + +/* + * Output flags - software output processing + */ +#define OPOST 0x0001 /* enable following output processing */ +#ifndef _POSIX_SOURCE +#define ONLCR 0x0002 /* map NL to CR-NL (ala CRMOD) */ +#define OXTABS 0x0004 /* expand tabs to spaces */ +#if 0 /* not used by GNO v2.0.6 */ +#define ONOEOT 0x0008 /* discard EOT's (^D) on output) */ +#endif +#endif /*_POSIX_SOURCE */ + +/* + * Control flags - hardware control of terminal + */ +#define CSIZE 0x000C /* character size mask */ +#define CS5 0x0000 /* 5 bits (pseudo) */ +#define CS6 0x0004 /* 6 bits */ +#define CS7 0x0008 /* 7 bits */ +#define CS8 0x000C /* 8 bits */ +#define CLOCAL 0x0001 /* ignore modem status lines */ +#define CREAD 0x0002 /* enable receiver */ +#define CSTOPB 0x0010 /* send 2 stop bits iff set */ +#define HUPCL 0x0020 /* hang up on last close */ +#define PARENB 0x0040 /* parity enable */ +#define PARODD 0x0080 /* odd parity iff set, else even */ + +#if 0 /* not used by GNO v2.0.6 */ +#ifndef _POSIX_SOURCE +#define CCTS_OFLOW 0x0100 /* CTS flow control of output */ +#define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW) +#define CRTS_IFLOW 0x0200 /* RTS flow control of input */ +#define CDTR_IFLOW 0x0400 /* DTR flow control of input */ +#define CDSR_OFLOW 0x0800 /* DSR flow control of output */ +#define CCAR_OFLOW 0x1000 /* DCD flow control of output */ +#define MDMBUF 0x2000 /* old name for CCAR_OFLOW */ +#define CIGNORE 0x4000 /* ignore control flags */ +#endif /* _POSIX_SOURCE */ +#endif /* 0 */ + +/* + * "Local" flags - dumping ground for other state + * + * Warning: some flags in this structure begin with + * the letter "I" and look like they belong in the + * input flag. + */ +#undef ECHO /* from */ +#define ECHO 0x0001 /* enable echoing */ +#define ECHOE 0x0002 /* visually erase chars */ +#define ECHOK 0x0004 /* echo NL after line kill */ +#define ECHONL 0x0008 /* echo NL even if ECHO is off */ +#define ICANON 0x0010 /* canonicalize input lines */ +#define ISIG 0x0020 /* enable signals INTR, QUIT, [D]SUSP */ +#undef NOFLSH +#define NOFLSH 0x0040 /* don't flush after interrupt */ +#undef TOSTOP +#define TOSTOP 0x0080 /* stop background jobs from output */ +#define IEXTEN 0x0100 /* enable DISCARD and LNEXT */ + +#if 0 /* not used for GNO v2.0.6 */ +#ifndef _POSIX_SOURCE +#define EXTPROC 0x0200 /* external processing */ +#define ECHOKE 0x0400 /* visual erase for line kill */ +#define ECHOPRT 0x0800 /* visual erase mode for hardcopy */ +#define ECHOCTL 0x1000 /* echo control chars as ^(Char) */ +#define FLUSHO 0x2000 /* output being flushed (state) */ +#define NOKERNINFO 0x4000 /* no kernel output from VSTATUS */ +#define PENDIN 0x8000 /* XXX retype pending input (state) */ +#define ALTWERASE Oops. No more bits /* use alternate WERASE algorithm */ +#endif /*_POSIX_SOURCE */ +#endif /* 0 */ + +typedef unsigned short tcflag_t; /* non-BSD type (as u_long) */ +typedef unsigned char cc_t; +typedef unsigned char speed_t; /* XXX should be unsigned long */ + +struct termios { /* non-BSD; sequence of fields changed */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ + cc_t c_cc[NCCS]; /* control chars */ + tcflag_t c_iflag; /* input flags */ + tcflag_t c_oflag; /* output flags */ + tcflag_t c_cflag; /* control flags */ + tcflag_t c_lflag; /* local flags */ +}; + +/* + * Commands passed to tcsetattr() for setting the termios structure. + */ +#define TCSANOW 0 /* make change immediate */ +#define TCSADRAIN 1 /* drain output, then change */ +#define TCSAFLUSH 2 /* drain output, flush input */ +#ifndef _POSIX_SOURCE +#define TCSASOFT 0x10 /* flag - don't alter h.w. state */ +#endif + +/* + * Standard speeds + */ +#define B0 0 +#define B50 1 +#define B75 2 +#define B110 3 +#define B134 4 +#define B150 5 +#define B200 6 /* This is really 57600 baud!!! */ +#define B300 7 +#define B600 8 +#define B1200 9 +#define B1800 10 +#define B2400 11 +#define B4800 12 +#define B9600 13 +#define B19200 14 +#define B38400 15 +#ifndef _POSIX_SOURCE +#define EXTA 14 +#define EXTB 15 +#define B57600 B200 +#endif + +#if 0 /* not used by GNO v2.0.6 */ +#ifndef _POSIX_SOURCE +#define B7200 16 +#define B14400 17 +#define B28800 18 +#define B76800 19 +#define B115200 20 +#define B230400 21 +#endif /* !_POSIX_SOURCE */ +#endif /* 0 */ + +#ifndef KERNEL + +#define TCIFLUSH 1 +#define TCOFLUSH 2 +#define TCIOFLUSH 3 +#define TCOOFF 1 +#define TCOON 2 +#define TCIOFF 3 +#define TCION 4 + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +speed_t cfgetispeed __P((const struct termios *)); +speed_t cfgetospeed __P((const struct termios *)); +int cfsetispeed __P((struct termios *, speed_t)); +int cfsetospeed __P((struct termios *, speed_t)); +int tcgetattr __P((int, struct termios *)); +int tcsetattr __P((int, int, const struct termios *)); +int tcdrain __P((int)); +int tcflow __P((int, int)); +int tcflush __P((int, int)); +int tcsendbreak __P((int, int)); + +#ifndef _POSIX_SOURCE +void cfmakeraw __P((struct termios *)); +int cfsetspeed __P((struct termios *, speed_t)); +#endif /* !_POSIX_SOURCE */ +__END_DECLS + +#endif /* !KERNEL */ + + +/* + * Include tty ioctl's that aren't just for backwards compatibility + * with the old tty driver. These ioctl definitions were previously + * in . + */ +#if !defined(_POSIX_SOURCE) && !defined(_SYS_TTYCOM_H_) +#include +#endif + +/* + * END OF PROTECTED INCLUDE. + */ +#endif /* !_SYS_TERMIOS_H_ */ + +#if !defined(_POSIX_SOURCE) && !defined(_SYS_TTYDEFAULTS_H_) +#include +#endif diff --git a/include/sys/time.h b/include/sys/time.h new file mode 100644 index 0000000..9955ddc --- /dev/null +++ b/include/sys/time.h @@ -0,0 +1,141 @@ +/* + * Copyright (c) 1982, 1986, 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. + * + * @(#)time.h 8.1 (Berkeley) 6/2/93 + * $Id: time.h,v 1.1 1997/02/28 04:42:15 gdr Exp $ + */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; + +/* + * Structure defined by POSIX.4 to be like a timeval. + */ +struct timespec { + long ts_sec; /* seconds */ + long ts_nsec; /* and nanoseconds */ +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->ts_sec = (tv)->tv_sec; \ + (ts)->ts_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->ts_sec; \ + (tv)->tv_usec = (ts)->ts_nsec / 1000; \ +} + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ + +/* Operations on timevals. */ +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec == (uvp)->tv_sec) ? \ + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ + ((tvp)->tv_sec cmp (uvp)->tv_sec)) + +/* + * Names of the interval timers, and structure + * defining a timer setting. + */ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; + +/* + * Getkerninfo clock information structure + */ +struct clockinfo { + int hz; /* clock frequency */ + int tick; /* micro-seconds per hz tick */ + int stathz; /* statistics clock frequency */ + int profhz; /* profiling clock frequency */ +}; + +#ifdef KERNEL + +int itimerdecr __P((struct itimerval *itp,int usec)); +int itimerfix __P((struct timeval *)); +void microtime __P((struct timeval *)); +void timevaladd __P((struct timeval *, struct timeval *)); +void timevalfix __P((struct timeval *)); +void timevalsub __P((struct timeval *, struct timeval *)); + +#else /* not KERNEL */ + +#ifndef _TIME_H_ +#include +#endif + +#ifndef _POSIX_SOURCE +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +int adjtime __P((const struct timeval *, struct timeval *)); +int getitimer __P((int, struct itimerval *)); +int gettimeofday __P((struct timeval *, struct timezone *)); +int setitimer __P((int, const struct itimerval *, struct itimerval *)); +int settimeofday __P((const struct timeval *, const struct timezone *)); +int utimes __P((const char *, const struct timeval *)); +__END_DECLS +#endif /* !POSIX */ + +#endif /* !KERNEL */ + +#endif /* !_SYS_TIME_H_ */ diff --git a/include/sys/times.h b/include/sys/times.h new file mode 100644 index 0000000..9abf397 --- /dev/null +++ b/include/sys/times.h @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 1990, 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. + * + * @(#)times.h 8.4 (Berkeley) 1/21/94 + * $Id: times.h,v 1.1 1997/02/28 04:42:16 gdr Exp $ + */ + +#ifndef _SYS_TIMES_H_ +#define _SYS_TIMES_H_ + +#ifndef _MACHINE_ANSI_H_ +#include +#endif + +#ifdef _BSD_CLOCK_T_ +typedef _BSD_CLOCK_T_ clock_t; +#undef _BSD_CLOCK_T_ +#endif + +struct tms { + clock_t tms_utime; /* User CPU time */ + clock_t tms_stime; /* System CPU time */ + clock_t tms_cutime; /* User CPU time of terminated child procs */ + clock_t tms_cstime; /* System CPU time of terminated child procs */ +}; + +#if !defined(KERNEL) && !defined(_SYS_CDEFS_H_) +#include + +__BEGIN_DECLS +clock_t times __P((struct tms *)); +__END_DECLS +#endif +#endif /* !_SYS_TIMES_H_ */ diff --git a/include/sys/tty.h b/include/sys/tty.h new file mode 100644 index 0000000..1c8bdb5 --- /dev/null +++ b/include/sys/tty.h @@ -0,0 +1,282 @@ +/*- + * Copyright (c) 1982, 1986, 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. + * + * @(#)tty.h 8.6 (Berkeley) 1/21/94 + * $Id: tty.h,v 1.1 1997/02/28 04:42:16 gdr Exp $ + */ + +#ifndef _SYS_TTY_H_ +#define _SYS_TTY_H_ + +#ifndef _SYS_TERMIOS_H_ +#include +#endif +#ifndef _SYS_SELECT_H +#include /* For struct selinfo. */ +#endif + +/* + * Clists are character lists, which is a variable length linked list + * of cblocks, with a count of the number of characters in the list. + */ +struct clist { + int c_cc; /* Number of characters in the clist. */ + int c_cbcount; /* Number of cblocks. */ + int c_cbmax; /* Max # cblocks allowed for this clist. */ + int c_cbreserved; /* # cblocks reserved for this clist. */ + char *c_cf; /* Pointer to the first cblock. */ + char *c_cl; /* Pointer to the last cblock. */ +}; + +/* + * Per-tty structure. + * + * Should be split in two, into device and tty drivers. + * Glue could be masks of what to echo and circular buffer + * (low, high, timeout). + */ +struct tty { + struct clist t_rawq; /* Device raw input queue. */ + long t_rawcc; /* Raw input queue statistics. */ + struct clist t_canq; /* Device canonical queue. */ + long t_cancc; /* Canonical queue statistics. */ + struct clist t_outq; /* Device output queue. */ + long t_outcc; /* Output queue statistics. */ + int t_line; /* Interface to device drivers. */ + dev_t t_dev; /* Device. */ + int t_state; /* Device and driver (TS*) state. */ + int t_flags; /* Tty flags. */ + int t_timeout; /* Timeout for ttywait() */ + struct pgrp *t_pgrp; /* Foreground process group. */ + struct session *t_session; /* Enclosing session. */ + struct selinfo t_rsel; /* Tty read/oob select. */ + struct selinfo t_wsel; /* Tty write select. */ + struct termios t_termios; /* Termios state. */ + struct winsize t_winsize; /* Window size. */ + /* Start output. */ + void (*t_oproc) __P((struct tty *)); + /* Stop output. */ + void (*t_stop) __P((struct tty *, int)); + /* Set hardware state. */ + int (*t_param) __P((struct tty *, struct termios *)); + void *t_sc; /* XXX: net/if_sl.c:sl_softc. */ + int t_column; /* Tty output column. */ + int t_rocount, t_rocol; /* Tty. */ + int t_hiwat; /* High water mark. */ + int t_lowat; /* Low water mark. */ + int t_gen; /* Generation number. */ +}; + +#define t_cc t_termios.c_cc +#define t_cflag t_termios.c_cflag +#define t_iflag t_termios.c_iflag +#define t_ispeed t_termios.c_ispeed +#define t_lflag t_termios.c_lflag +#define t_min t_termios.c_min +#define t_oflag t_termios.c_oflag +#define t_ospeed t_termios.c_ospeed +#define t_time t_termios.c_time + +#define TTIPRI 25 /* Sleep priority for tty reads. */ +#define TTOPRI 26 /* Sleep priority for tty writes. */ + +/* + * User data unfortunately has to be copied through buffers on the way to + * and from clists. The buffers are on the stack so their sizes must be + * fairly small. + */ +#define IBUFSIZ 384 /* Should be >= max value of MIN. */ +#define OBUFSIZ 100 + +#ifndef TTYHOG +#define TTYHOG 1024 +#endif + +#ifdef KERNEL +#define TTMAXHIWAT roundup(2048, CBSIZE) +#define TTMINHIWAT roundup(100, CBSIZE) +#define TTMAXLOWAT 256 +#define TTMINLOWAT 32 +#endif + +/* These flags are kept in t_state. */ +#define TS_SO_OLOWAT 0x00001 /* Wake up when output <= low water. */ +#define TS_ASYNC 0x00002 /* Tty in async I/O mode. */ +#define TS_BUSY 0x00004 /* Draining output. */ +#define TS_CARR_ON 0x00008 /* Carrier is present. */ +#define TS_FLUSH 0x00010 /* Outq has been flushed during DMA. */ +#define TS_ISOPEN 0x00020 /* Open has completed. */ +#define TS_TBLOCK 0x00040 /* Further input blocked. */ +#define TS_TIMEOUT 0x00080 /* Wait for output char processing. */ +#define TS_TTSTOP 0x00100 /* Output paused. */ +#ifdef notyet +#define TS_WOPEN 0x00200 /* Open in progress. */ +#endif +#define TS_XCLUDE 0x00400 /* Tty requires exclusivity. */ + +/* State for intra-line fancy editing work. */ +#define TS_BKSL 0x00800 /* State for lowercase \ work. */ +#define TS_CNTTB 0x01000 /* Counting tab width, ignore FLUSHO. */ +#define TS_ERASE 0x02000 /* Within a \.../ for PRTRUB. */ +#define TS_LNCH 0x04000 /* Next character is literal. */ +#define TS_TYPEN 0x08000 /* Retyping suspended input (PENDIN). */ +#define TS_LOCAL (TS_BKSL | TS_CNTTB | TS_ERASE | TS_LNCH | TS_TYPEN) + +/* Extras. */ +#define TS_CAN_BYPASS_L_RINT 0x010000 /* Device in "raw" mode. */ +#define TS_CONNECTED 0x020000 /* Connection open. */ +#define TS_SNOOP 0x040000 /* Device is being snooped on. */ +#define TS_SO_OCOMPLETE 0x080000 /* Wake up when output completes. */ +#define TS_ZOMBIE 0x100000 /* Connection lost. */ + +/* Hardware flow-control-invoked bits. */ +#define TS_CAR_OFLOW 0x200000 /* For MDMBUF (XXX handle in driver). */ +#ifdef notyet +#define TS_CTS_OFLOW 0x400000 /* For CCTS_OFLOW. */ +#define TS_DSR_OFLOW 0x800000 /* For CDSR_OFLOW. */ +#endif + +/* Character type information. */ +#define ORDINARY 0 +#define CONTROL 1 +#define BACKSPACE 2 +#define NEWLINE 3 +#define TAB 4 +#define VTAB 5 +#define RETURN 6 + +struct speedtab { + int sp_speed; /* Speed. */ + int sp_code; /* Code. */ +}; + +/* Modem control commands (driver). */ +#define DMSET 0 +#define DMBIS 1 +#define DMBIC 2 +#define DMGET 3 + +/* Flags on a character passed to ttyinput. */ +#define TTY_CHARMASK 0x000000ff /* Character mask */ +#define TTY_QUOTE 0x00000100 /* Character quoted */ +#define TTY_ERRORMASK 0xff000000 /* Error mask */ +#define TTY_FE 0x01000000 /* Framing error */ +#define TTY_PE 0x02000000 /* Parity error */ +#define TTY_OE 0x04000000 /* Overrun error */ +#define TTY_BI 0x08000000 /* Break condition */ + +/* Is tp controlling terminal for p? */ +#define isctty(p, tp) \ + ((p)->p_session == (tp)->t_session && (p)->p_flag & P_CONTROLT) + +/* Is p in background of tp? */ +#define isbackground(p, tp) \ + (isctty((p), (tp)) && (p)->p_pgrp != (tp)->t_pgrp) + +/* Unique sleep addresses. */ +#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq) +#define TSA_HUP_OR_INPUT(tp) ((void *)&(tp)->t_rawq.c_cf) +#define TSA_OCOMPLETE(tp) ((void *)&(tp)->t_outq.c_cl) +#define TSA_OLOWAT(tp) ((void *)&(tp)->t_outq) +#define TSA_PTC_READ(tp) ((void *)&(tp)->t_outq.c_cf) +#define TSA_PTC_WRITE(tp) ((void *)&(tp)->t_rawq.c_cl) +#define TSA_PTS_READ(tp) ((void *)&(tp)->t_canq) + +#ifdef KERNEL +extern struct tty *constty; /* Temporary virtual console. */ + +int b_to_q __P((char *cp, int cc, struct clist *q)); +void catq __P((struct clist *from, struct clist *to)); +void clist_alloc_cblocks __P((struct clist *q, int ccmax, int ccres)); +void clist_free_cblocks __P((struct clist *q)); +/* void clist_init __P((void)); */ /* defined in systm.h for main() */ +int getc __P((struct clist *q)); +void ndflush __P((struct clist *q, int cc)); +int ndqb __P((struct clist *q, int flag)); +char *nextc __P((struct clist *q, char *cp, int *c)); +int putc __P((int c, struct clist *q)); +int q_to_b __P((struct clist *q, char *cp, int cc)); +int unputc __P((struct clist *q)); + +int ttcompat __P((struct tty *tp, int com, caddr_t data, int flag)); +int ttsetcompat __P((struct tty *tp, int *com, caddr_t data, struct termios *term)); + +void termioschars __P((struct termios *t)); +int tputchar __P((int c, struct tty *tp)); +int ttioctl __P((struct tty *tp, int com, void *data, int flag)); +int ttread __P((struct tty *tp, struct uio *uio, int flag)); +void ttrstrt __P((void *tp)); +int ttyselect __P((struct tty *tp, int rw, struct proc *p)); +int ttselect __P((dev_t dev, int rw, struct proc *p)); +void ttsetwater __P((struct tty *tp)); +int ttspeedtab __P((int speed, struct speedtab *table)); +int ttstart __P((struct tty *tp)); +void ttwakeup __P((struct tty *tp)); +int ttwrite __P((struct tty *tp, struct uio *uio, int flag)); +void ttwwakeup __P((struct tty *tp)); +void ttyblock __P((struct tty *tp)); +void ttychars __P((struct tty *tp)); +int ttycheckoutq __P((struct tty *tp, int wait)); +int ttyclose __P((struct tty *tp)); +void ttyflush __P((struct tty *tp, int rw)); +void ttyinfo __P((struct tty *tp)); +int ttyinput __P((int c, struct tty *tp)); +int ttylclose __P((struct tty *tp, int flag)); +int ttymodem __P((struct tty *tp, int flag)); +int ttyopen __P((dev_t device, struct tty *tp)); +int ttysleep __P((struct tty *tp, + void *chan, int pri, char *wmesg, int timeout)); +int ttywait __P((struct tty *tp)); +int ttywflush __P((struct tty *tp)); +struct tty *ttymalloc __P((void)); +void ttyfree __P((struct tty *)); + +/* From tty_tty.c. */ +/* + * XXX misplaced - these are just the cdev functions for a particular + * driver. + */ +int cttyioctl __P((dev_t dev, int cmd, caddr_t addr, int flag, + struct proc *p)); +int cttyopen __P((dev_t dev, int flag, int mode, struct proc *p)); +int cttyread __P((dev_t dev, struct uio *uio, int flag)); +int cttyselect __P((dev_t dev, int flag, struct proc *p)); +int cttywrite __P((dev_t dev, struct uio *uio, int flag)); + +#endif /* KERNEL */ + +#endif /* !_SYS_TTY_H_ */ diff --git a/include/sys/ttychars.h b/include/sys/ttychars.h new file mode 100644 index 0000000..6898c6b --- /dev/null +++ b/include/sys/ttychars.h @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 1982, 1986, 1990, 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. + * + * @(#)ttychars.h 8.2 (Berkeley) 1/4/94 + * $Id: ttychars.h,v 1.1 1997/02/28 04:42:16 gdr Exp $ + */ + +#ifndef _SYS_TTYCHARS_H_ +#define _SYS_TTYCHARS_H_ + +/* + * 4.3 COMPATIBILITY FILE + * + * User visible structures and constants related to terminal handling. + */ + +struct ttychars { + char tc_erase; /* erase last character */ + char tc_kill; /* erase entire line */ + char tc_intrc; /* interrupt */ + char tc_quitc; /* quit */ + char tc_startc; /* start output */ + char tc_stopc; /* stop output */ + char tc_eofc; /* end-of-file */ + char tc_brkc; /* input delimiter (like nl) */ + char tc_suspc; /* stop process signal */ + char tc_dsuspc; /* delayed stop process signal */ + char tc_rprntc; /* reprint line */ + char tc_flushc; /* flush output (toggles) */ + char tc_werasc; /* word erase */ + char tc_lnextc; /* literal next character */ +}; +#if defined(USE_OLD_TTY) && !defined(_SYS_TTYDEFAULTS_H_) +#include /* to pick up character defaults */ +#endif +#endif /* !_SYS_TTYCHARS_H_ */ diff --git a/include/sys/ttycom.h b/include/sys/ttycom.h new file mode 100644 index 0000000..5650552 --- /dev/null +++ b/include/sys/ttycom.h @@ -0,0 +1,142 @@ +/*- + * Copyright (c) 1982, 1986, 1990, 1993, 1994 + * 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. + * + * @(#)ttycom.h 8.1 (Berkeley) 3/28/94 + * $Id: ttycom.h,v 1.1 1997/02/28 04:42:16 gdr Exp $ + */ + +#ifndef _SYS_TTYCOM_H_ +#define _SYS_TTYCOM_H_ + +#ifndef _SYS_IOCCOM_H_ +#include +#endif + +/* + * Tty ioctl's except for those supported only for backwards compatibility + * with the old tty driver. + */ + +/* + * Window/terminal size structure. This information is stored by the kernel + * in order to provide a consistent interface, but is not used by the kernel. + */ +struct winsize { + unsigned short ws_row; /* rows, in characters */ + unsigned short ws_col; /* columns, in characters */ + unsigned short ws_xpixel; /* horizontal size, pixels */ + unsigned short ws_ypixel; /* vertical size, pixels */ +}; + +#define TIOCMODG _IOR('t', 3, int) /* get modem control state */ +#define TIOCMODS _IOW('t', 4, int) /* set modem control state */ +#define TIOCM_LE 0001 /* line enable */ +#define TIOCM_DTR 0002 /* data terminal ready */ +#define TIOCM_RTS 0004 /* request to send */ +#define TIOCM_ST 0010 /* secondary transmit */ +#define TIOCM_SR 0020 /* secondary receive */ +#define TIOCM_CTS 0040 /* clear to send */ +#define TIOCM_CAR 0100 /* carrier detect */ +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RNG 0200 /* ring */ +#define TIOCM_RI TIOCM_RNG +#define TIOCM_DSR 0400 /* data set ready */ + /* 8-10 compat */ +#define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ +#define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ + /* 15 unused */ +#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */ + /* 17-18 compat */ +#define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */ +#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ +#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ +#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ +#define TIOCGETD _IOR('t', 26, int) /* get line discipline */ +#define TIOCSETD _IOW('t', 27, int) /* set line discipline */ + /* 127-124 compat */ +#define TIOCSBRK _IO('t', 123) /* set break bit */ +#define TIOCCBRK _IO('t', 122) /* clear break bit */ +#define TIOCSDTR _IO('t', 121) /* set data terminal ready */ +#define TIOCCDTR _IO('t', 120) /* clear data terminal ready */ +#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ +#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ + /* 117-116 compat */ +#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ +#define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */ +#define TIOCNOTTY _IO('t', 113) /* void tty association */ +#define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ +#define TIOCPKT_DATA 0x00 /* data packet */ +#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ +#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ +#define TIOCPKT_STOP 0x04 /* stop output */ +#define TIOCPKT_START 0x08 /* start output */ +#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ +#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ +#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ +#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ +#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ +#define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ +#define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */ +#define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */ +#define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ +#define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */ +#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ +#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ +#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ +#define TIOCSTAT _IO('t', 101) /* simulate a control-T status msg */ +#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ +#define TIOCCONS _IOW('t', 98, int) /* become virtual console */ +#define TIOCSCTTY _IO('t', 97) /* become controlling tty */ +#define TIOCEXT _IOW('t', 96, int) /* pty: external processing */ +#define TIOCSIG _IO('t', 95) /* pty: generate signal */ +#define TIOCDRAIN _IO('t', 94) /* wait till output drained */ +#define TIOCMSDTRWAIT _IOW('t', 91, int) /* modem: set wait on close */ +#define TIOCMGDTRWAIT _IOR('t', 90, int) /* modem: get wait on close */ +#define TIOCTIMESTAMP _IOR('t', 89, struct timeval) /* get timestamp of + last interrupt for xntp. */ +#define TIOCDSIMICROCODE _IO('t', 85) /* Download microcode to + DSI Softmodem */ +#define TIOCSDRAINWAIT _IOW('t', 87, int) /* set ttywait timeout */ +#define TIOCGDRAINWAIT _IOR('t', 86, int) /* get ttywait timeout */ + +#define TTYDISC 0 /* termios tty line discipline */ +#define TABLDISC 3 /* tablet discipline */ +#define SLIPDISC 4 /* serial IP discipline */ +#define PPPDISC 5 /* PPP discipline */ + + +#endif /* !_SYS_TTYCOM_H_ */ diff --git a/include/sys/ttydefaults.h b/include/sys/ttydefaults.h new file mode 100644 index 0000000..14b754f --- /dev/null +++ b/include/sys/ttydefaults.h @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 1982, 1986, 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. + * + * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 + * $Id: ttydefaults.h,v 1.1 1997/02/28 04:42:16 gdr Exp $ + */ + +/* + * System wide defaults for terminal state. + */ +#ifndef _SYS_TTYDEFAULTS_H_ +#define _SYS_TTYDEFAULTS_H_ + +/* + * Defaults on "first" open. + */ +#define TTYDEF_IFLAG (BRKINT | ICRNL | IMAXBEL | IXON | IXANY) +#define TTYDEF_OFLAG (OPOST | ONLCR) +#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) +#define TTYDEF_CFLAG (CREAD | CS8 | HUPCL) +#define TTYDEF_SPEED (B9600) + +/* + * Control Character Defaults + */ +#define CTRL(x) (x&037) +#define CEOF CTRL('d') +#define CEOL 0xff /* XXX avoid _POSIX_VDISABLE */ +#ifdef __GNO__ +#define CERASE CTRL('H') +#else +#define CERASE 0177 +#endif +#define CINTR CTRL('c') +#define CSTATUS 0xff /* XXX avoid _POSIX_VDISABLE */ +#ifdef __GNO__ +#define CKILL CTRL('^') +#else +#define CKILL CTRL('u') +#endif +#define CMIN 1 +#define CQUIT 034 /* FS, ^\ */ +#define CSUSP CTRL('z') +#define CTIME 0 +#define CDSUSP CTRL('y') +#define CSTART CTRL('q') +#define CSTOP CTRL('s') +#define CLNEXT 0xff /* not implemented; was CTRL('v') */ +#define CDISCARD 0xff /* not implemented; was CTRL('o') */ +#define CWERASE 0xff /* not implemented; was CTRL('w') */ +#define CREPRINT CTRL('r') +#define CEOT CEOF +/* compat */ +#define CBRK CEOL +#define CRPRNT CREPRINT +#define CFLUSH CDISCARD + +/* PROTECTED INCLUSION ENDS HERE */ +#endif /* !_SYS_TTYDEFAULTS_H_ */ + +/* + * #define TTYDEFCHARS to include an array of default control characters. + */ +#ifdef TTYDEFCHARS +static cc_t ttydefchars[NCCS] = { + CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, + _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, + CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE +}; +#undef TTYDEFCHARS +#endif diff --git a/include/sys/ttydev.h b/include/sys/ttydev.h new file mode 100644 index 0000000..0a8871e --- /dev/null +++ b/include/sys/ttydev.h @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 1982, 1986, 1990, 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. + * + * @(#)ttydev.h 8.2 (Berkeley) 1/4/94 + * $Id: ttydev.h,v 1.1 1997/02/28 04:42:17 gdr Exp $ + */ + +/* COMPATABILITY HEADER FILE */ + +#ifndef _SYS_TTYDEV_H_ +#define _SYS_TTYDEV_H_ + +#ifdef USE_OLD_TTY +#define B0 0 +#define B50 1 +#define B75 2 +#define B110 3 +#define B134 4 +#define B150 5 +#define B200 6 /* This is really 57600 baud. */ +#define B300 7 +#define B600 8 +#define B1200 9 +#define B1800 10 +#define B2400 11 +#define B4800 12 +#define B9600 13 +#define B19200 14 +#define EXTA 14 +#define B38400 15 +#define EXTB 15 +#define B57600 16 +#define B115200 17 +#endif /* USE_OLD_TTY */ + +#endif /* !_SYS_TTYDEV_H_ */ diff --git a/include/sys/types.h b/include/sys/types.h new file mode 100644 index 0000000..26f0dd9 --- /dev/null +++ b/include/sys/types.h @@ -0,0 +1,210 @@ +/*- + * Copyright (c) 1982, 1986, 1991, 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. + * + * @(#)types.h 8.4 (Berkeley) 1/21/94 + * $Id: types.h,v 1.1 1997/02/28 04:42:17 gdr Exp $ + */ + +#ifndef _SYS_TYPES_H_ +#define _SYS_TYPES_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +/* Machine type dependent parameters. */ +#ifndef _MACHINE_ENDIAN_H_ +#include +#endif + +#ifndef _POSIX_SOURCE +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +#endif + +/* quads */ +typedef struct u_quad_t { /* non-BSD */ + unsigned long hi; /* BSD uses "unsigned long long" */ + unsigned long lo; +} u_quad_t; +typedef struct quad_t { + signed long hi; /* BSD uses "long long" */ + signed long lo; /* ...signedness is probably broken */ +} quad_t, *qaddr_t; + +typedef char * caddr_t; /* core address */ +typedef long daddr_t; /* disk address */ +typedef unsigned short dev_t; /* device number */ /* non-BSD */ +typedef unsigned long fixpt_t; /* fixed point number */ +typedef unsigned short gid_t; /* group id */ +typedef unsigned long ino_t; /* inode number */ +typedef unsigned short mode_t; /* permissions */ +typedef unsigned short nlink_t; /* link count */ +typedef long off_t; /* file offset */ +typedef short pid_t; /* process id */ +typedef long segsz_t; /* segment size */ +typedef long swblk_t; /* swap offset */ +typedef unsigned short uid_t; /* user id */ + +/* + * This belongs in unistd.h, but is placed here to ensure that programs + * casting the second parameter of lseek to off_t will get the correct + * version of lseek. + */ +#ifndef KERNEL +__BEGIN_DECLS +off_t lseek __P((int, off_t, int)); +__END_DECLS +#endif + +#ifndef _POSIX_SOURCE +/* non-BSD: these macros aren't set up for 32-bit values */ +#define minor(x) (x & 0xFF) /* minor number */ +#define major(x) ((x >> 8) & 0xFF) /* major number */ +#endif + +#ifndef _MACHINE_ANSI_H_ +#include +#endif + +#ifndef _MACHINE_TYPES_H_ +#include +#endif + +#ifdef _BSD_CLOCK_T_ +typedef _BSD_CLOCK_T_ clock_t; +#undef _BSD_CLOCK_T_ +#endif + +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +#ifdef _BSD_SSIZE_T_ +typedef _BSD_SSIZE_T_ ssize_t; +#undef _BSD_SSIZE_T_ +#endif + +#ifdef _BSD_TIME_T_ +typedef _BSD_TIME_T_ time_t; +#undef _BSD_TIME_T_ +#endif + +#ifndef _POSIX_SOURCE +#define NBBY 8 /* number of bits in a byte */ + +/* + * Select uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here should + * be enough for most uses. + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 32 /* non-BSD: was 256 */ +#endif + +typedef long fd_mask; +#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ + +#ifndef howmany +#define howmany(x, y) (((x)+((y)-1))/(y)) +#endif + +typedef struct fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} fd_set; + +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) +#define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) +#define FD_ZERO(p) bzero(p, sizeof(*(p))) + +#if defined(__STDC__) && defined(KERNEL) +/* + * Forward structure declarations for function prototypes. We include the + * common structures that cross subsystem boundaries here; others are mostly + * used in the same place that the structure is defined. + */ +struct proc; +struct pgrp; +struct ucred; +struct rusage; +struct file; +struct buf; +struct tty; +struct uio; +#endif + +/* + * This is a BSD system. If you're defining _SYSV_SOURCE, you're probably + * doing something wrong ... + */ +#if (__STDC__ != 1) || defined(_SYSV_SOURCE) +typedef unsigned char uchar_t; +typedef unsigned short ushort_t; +typedef unsigned int uint_t; +typedef unsigned long ulong_t; + +typedef char * addr_t; +typedef short cnt_t; +typedef ulong_t paddr_t; +typedef short sysid_t; +typedef short index_t; +typedef short lock_t; +typedef long id_t; +typedef short o_dev_t; +typedef unsigned short o_gid_t; +typedef unsigned short o_ino_t; +typedef unsigned short o_mode_t; +typedef short o_nlink_t; +typedef short o_pid_t; +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned char unchar; +typedef unsigned int uint; +typedef unsigned short ushort; +typedef unsigned long ulong; +#endif /* defined(_SYSV_SOURCE) */ + +#endif /* !_POSIX_SOURCE */ +#endif /* !_SYS_TYPES_H_ */ diff --git a/include/sys/uio.h b/include/sys/uio.h new file mode 100644 index 0000000..fc6ddbf --- /dev/null +++ b/include/sys/uio.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 1982, 1986, 1993, 1994 + * 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. + * + * @(#)uio.h 8.5 (Berkeley) 2/22/94 + * $Id: uio.h,v 1.1 1997/02/28 04:42:17 gdr Exp $ + */ + +#ifndef _SYS_UIO_H_ +#define _SYS_UIO_H_ + +/* + * XXX + * iov_base should be a void *. + */ +struct iovec { + char *iov_base; /* Base address. */ + size_t iov_len; /* Length. */ +}; + +enum uio_rw { UIO_READ, UIO_WRITE }; + +/* Segment flag values. */ +enum uio_seg { + UIO_USERSPACE, /* from user data space */ + UIO_SYSSPACE, /* from system space */ + UIO_USERISPACE, /* from user I space */ + UIO_NOCOPY /* don't copy, already in object */ +}; + +#ifdef KERNEL +struct uio { + struct iovec *uio_iov; + int uio_iovcnt; + off_t uio_offset; + int uio_resid; + enum uio_seg uio_segflg; + enum uio_rw uio_rw; + struct proc *uio_procp; +}; + +/* + * Limits + */ +#define UIO_MAXIOV 1024 /* max 1K of iov's */ +#define UIO_SMALLIOV 8 /* 8 on stack, else malloc */ +#endif /* KERNEL */ + +#ifdef KERNEL + +int uiomove __P((caddr_t, int, struct uio *)); + +#else /* !KERNEL */ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +size_t readv __P((int, const struct iovec *, int)); /* non-BSD */ +size_t writev __P((int, const struct iovec *, int)); /* non-BSD */ +__END_DECLS + +#endif /* KERNEL */ + +#endif /* !_SYS_UIO_H_ */ diff --git a/include/sys/unistd.h b/include/sys/unistd.h new file mode 100644 index 0000000..2ea6d2c --- /dev/null +++ b/include/sys/unistd.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 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. + * + * @(#)unistd.h 8.2 (Berkeley) 1/7/94 + * $Id: unistd.h,v 1.1 1997/02/28 04:42:17 gdr Exp $ + */ + +#ifndef _SYS_UNISTD_H_ +#define _SYS_UNISTD_H_ + +/* compile-time symbolic constants */ +#define _POSIX_JOB_CONTROL /* implementation supports job control */ + +/* + * This feature does not work for root according to POSIX 1003.1. + * We use the saved IDs in seteuid/setegid, which are not currently + * part of the POSIX 1003.1 specification. + */ +#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ + +#define _POSIX_VERSION 198808L +#undef _POSIX2_VERSION /* 199212L */ /* non-BSD */ + +/* execution-time symbolic constants */ + /* chown requires appropriate privileges */ +#define _POSIX_CHOWN_RESTRICTED 1 + /* too-long path components generate errors */ +#define _POSIX_NO_TRUNC 1 + /* may disable terminal special characters */ +#define _POSIX_VDISABLE 0xff + +/* access function */ +#define F_OK 0 /* test for existence of file */ +#define X_OK 0x01 /* test for execute or search permission */ +#define W_OK 0x02 /* test for write permission */ +#define R_OK 0x04 /* test for read permission */ + +/* whence values for lseek(2) */ +#define SEEK_SET 0 /* set file offset to offset */ +#define SEEK_CUR 1 /* set file offset to current plus offset */ +#define SEEK_END 2 /* set file offset to EOF plus offset */ + +#ifndef _POSIX_SOURCE +/* whence values for lseek(2); renamed by POSIX 1003.1 */ +#define L_SET SEEK_SET +#define L_INCR SEEK_CUR +#define L_XTND SEEK_END +#endif + +/* configurable pathname variables */ +#define _PC_LINK_MAX 1 +#define _PC_MAX_CANON 2 +#define _PC_MAX_INPUT 3 +#define _PC_NAME_MAX 4 +#define _PC_PATH_MAX 5 +#define _PC_PIPE_BUF 6 +#define _PC_CHOWN_RESTRICTED 7 +#define _PC_NO_TRUNC 8 +#define _PC_VDISABLE 9 + +/* configurable system variables */ +#define _SC_ARG_MAX 1 +#define _SC_CHILD_MAX 2 +#define _SC_CLK_TCK 3 +#define _SC_NGROUPS_MAX 4 +#define _SC_OPEN_MAX 5 +#define _SC_JOB_CONTROL 6 +#define _SC_SAVED_IDS 7 +#define _SC_VERSION 8 +#define _SC_BC_BASE_MAX 9 +#define _SC_BC_DIM_MAX 10 +#define _SC_BC_SCALE_MAX 11 +#define _SC_BC_STRING_MAX 12 +#define _SC_COLL_WEIGHTS_MAX 13 +#define _SC_EXPR_NEST_MAX 14 +#define _SC_LINE_MAX 15 +#define _SC_RE_DUP_MAX 16 +#define _SC_2_VERSION 17 +#define _SC_2_C_BIND 18 +#define _SC_2_C_DEV 19 +#define _SC_2_CHAR_TERM 20 +#define _SC_2_FORT_DEV 21 +#define _SC_2_FORT_RUN 22 +#define _SC_2_LOCALEDEF 23 +#define _SC_2_SW_DEV 24 +#define _SC_2_UPE 25 +#define _SC_STREAM_MAX 26 +#define _SC_TZNAME_MAX 27 + +/* configurable system strings */ +#define _CS_PATH 1 + +#endif /* !_SYS_UNISTD_H_ */ diff --git a/include/sys/wait.h b/include/sys/wait.h new file mode 100644 index 0000000..b4a5e80 --- /dev/null +++ b/include/sys/wait.h @@ -0,0 +1,157 @@ +/* + * 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 + * $Id: wait.h,v 1.1 1997/02/28 04:42:17 gdr Exp $ + */ + +#ifndef _SYS_WAIT_H_ +#define _SYS_WAIT_H_ + +/* + * 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. + */ +#ifdef _POSIX_SOURCE +#define _W_INT(i) (i) +#else +#define _W_INT(w) (*(int *)&(w)) /* convert union wait to int */ +#ifdef __GNO__ +#define WCOREFLAG 0000 /* no core dump under GNO */ +#else +#define WCOREFLAG 0200 +#endif +#endif /* ! _POSIX_SOURCE */ + +#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 +/* POSIX extensions and 4.2/4.3 compatability: */ + +/* + * 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 */ + +#ifndef _MACHINE_ENDIAN_H_ +#include +#endif + +/* + * Deprecated: + * Structure of the information in the status word returned by wait4. + * If w_stopval==WSTOPPED, then the second structure describes + * the information returned, else the first. + */ +union wait { + int w_status; /* used in syscall */ + /* + * Terminated process status. + */ + struct { + unsigned int w_Termsig:7, /* termination signal */ + w_Coredump:1, /* core dump indicator */ + w_Retcode:8; /* exit code if w_termsig==0 */ + } w_T; + /* + * Stopped process status. Returned + * only for traced children unless requested + * with the WUNTRACED option bit. + */ + struct { + unsigned int w_Stopval:8, /* == W_STOPPED if stopped */ + w_Stopsig:8; /* signal that stopped us */ + } w_S; +}; +#define w_termsig w_T.w_Termsig +#define w_coredump w_T.w_Coredump +#define w_retcode w_T.w_Retcode +#define w_stopval w_S.w_Stopval +#define w_stopsig w_S.w_Stopsig + +#define WSTOPPED _WSTOPPED +#endif /* _POSIX_SOURCE */ + +#ifndef KERNEL +#ifndef _SYS_TYPES_H_ +#include +#endif +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +struct rusage; /* forward declaration */ + +#ifndef KERNEL /* for GNO kernel */ +pid_t wait __P((union wait *)); +#endif +pid_t waitpid __P((pid_t, union wait *, int)); +#ifndef _POSIX_SOURCE +pid_t wait3 __P((union wait *, int, struct rusage *)); +pid_t wait4 __P((pid_t, union wait *, int, struct rusage *)); +#endif +__END_DECLS +#endif + +#endif diff --git a/include/syslog.h b/include/syslog.h new file mode 100644 index 0000000..1efe022 --- /dev/null +++ b/include/syslog.h @@ -0,0 +1,14 @@ +/* + * Too bad we don't have symlinks for GNO ... + * + * $Id: syslog.h,v 1.1 1997/02/28 04:42:03 gdr Exp $ + */ + +#ifndef _SYSLOG_H_ +#define _SYSLOG_H_ + +#ifndef _SYS_SYSLOG_H_ +#include +#endif + +#endif diff --git a/include/termcap.h b/include/termcap.h new file mode 100644 index 0000000..ba65b16 --- /dev/null +++ b/include/termcap.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 1994,1995 by Andrey A. Chernov, Moscow, Russia. + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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: termcap.h,v 1.1 1997/02/28 04:42:03 gdr Exp $ */ + +#ifndef _TERMCAP_H_ +#define _TERMCAP_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS + +extern char PC, *UP, *BC; +extern short ospeed; + +extern int tgetent __P((char *, const char *)); +extern int tgetflag __P((const char *)); +extern int tgetnum __P((const char *)); +extern char *tgetstr __P((const char *, char **)); + +extern int tputs __P((const char *, int, int (*)(int))); + +extern char *tgoto __P((const char *, int, int)); +extern char *tparm __P((const char *, ...)); + +__END_DECLS + +#endif /* _TERMCAP_H_ */ diff --git a/include/termios.h b/include/termios.h new file mode 100644 index 0000000..5bbc900 --- /dev/null +++ b/include/termios.h @@ -0,0 +1,14 @@ +/* + * Too bad we don't have symlinks for GNO ... + * + * $Id: termios.h,v 1.1 1997/02/28 04:42:03 gdr Exp $ + */ + +#ifndef _TERMIOS_H_ +#define _TERMIOS_H_ + +#ifndef _SYS_TERMIOS_H_ +#include +#endif + +#endif diff --git a/include/time.h b/include/time.h new file mode 100644 index 0000000..964a89d --- /dev/null +++ b/include/time.h @@ -0,0 +1,125 @@ +/* + * 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. + * + * @(#)time.h 8.3 (Berkeley) 1/21/94 + */ + +#ifndef _TIME_H_ +#define _TIME_H_ + +#ifndef _MACHINE_ANSI_H_ +#include +#endif + +#ifndef _ANSI_SOURCE +/* + * Frequency of the clock ticks reported by times(). Deprecated - use + * sysconf(_SC_CLK_TCK) instead. + */ +#define CLK_TCK _BSD_CLK_TCK_ +#endif + +/* Frequency of the clock ticks reported by clock(). */ +#define CLOCKS_PER_SEC _BSD_CLOCKS_PER_SEC_ + +#ifndef NULL +#define NULL (void *) 0L +#endif + +#ifdef _BSD_CLOCK_T_ +typedef _BSD_CLOCK_T_ clock_t; +#undef _BSD_CLOCK_T_ +#endif + +#ifdef _BSD_TIME_T_ +typedef _BSD_TIME_T_ time_t; +#undef _BSD_TIME_T_ +#endif + +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +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 */ +#if 0 + /* + * We're currently using Byteworks' time routines, and these two + * aren't implemented in that version. + */ + long tm_gmtoff; /* offset from CUT in seconds */ + char *tm_zone; /* timezone abbreviation */ +#endif +}; + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +char *asctime __P((const struct tm *)); +clock_t clock __P((void)); +char *ctime __P((const time_t *)); +double difftime __P((time_t, time_t)); +struct tm *gmtime __P((const time_t *)); +struct tm *localtime __P((const time_t *)); +time_t mktime __P((struct tm *)); +size_t strftime __P((char *, size_t, const char *, const struct tm *)); +time_t time __P((time_t *)); + +#ifndef _ANSI_SOURCE +void tzset __P((void)); +#endif /* not ANSI */ + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +char *timezone __P((int, int)); +void tzsetwall __P((void)); +time_t timelocal __P((struct tm * const)); +time_t timegm __P((struct tm * const)); +#endif /* neither ANSI nor POSIX */ +__END_DECLS + +#endif /* !_TIME_H_ */ diff --git a/include/ttyent.h b/include/ttyent.h new file mode 100644 index 0000000..5ddd963 --- /dev/null +++ b/include/ttyent.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 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. + * + * @(#)ttyent.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _TTYENT_H_ +#define _TTYENT_H_ + +#define _PATH_TTYS "/etc/ttys" + +#define _TTYS_OFF "off" +#define _TTYS_ON "on" +#define _TTYS_SECURE "secure" +#define _TTYS_WINDOW "window" + +struct ttyent { + char *ty_name; /* terminal device name */ + char *ty_getty; /* command to execute, usually getty */ + char *ty_type; /* terminal type for termcap */ +#define TTY_ON 0x01 /* enable logins (start ty_getty program) */ +#define TTY_SECURE 0x02 /* allow uid of 0 to login */ + int ty_status; /* status flags */ + char *ty_window; /* command to start up window manager */ + char *ty_comment; /* comment field */ +}; + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +struct ttyent *getttyent __P((void)); +struct ttyent *getttynam __P((const char *)); +int setttyent __P((void)); +int endttyent __P((void)); +__END_DECLS + +#endif /* !_TTYENT_H_ */ diff --git a/include/types.h b/include/types.h new file mode 100644 index 0000000..620fadb --- /dev/null +++ b/include/types.h @@ -0,0 +1,307 @@ +/******************************************** +* +* Types, defines used in more that one header file. +* +* Copyright Apple Computer, Inc.1986-90 +* All Rights Reserved +* +* Copyright 1992, 1993, Byte Works, Inc. +* +********************************************/ + +#ifndef __TYPES__ +#define __TYPES__ + +#ifndef noError +#define noError 0x0000 +#endif +#ifndef nil +#define nil 0x0L +#endif +#ifndef NULL +#define NULL 0x0L +#endif +#ifndef NIL +#define NIL 0x0L +#endif + +#define dispatcher 0xE10000L /* tool locator dispatch address */ + +#define TRUE 1 +#define true TRUE +#define FALSE 0 +#define false FALSE + +/* RefDescriptors */ +#define refIsPointer 0x0000 +#define refIsHandle 0x0001 +#define refIsResource 0x0002 +#define refIsNewHandle 0x0003 + +typedef unsigned char byte, Byte; +typedef unsigned int word, Word; +typedef int integer, Integer; +typedef long longint, Longint; +typedef long Long; +typedef unsigned long longword, Longword, LongWord; +typedef unsigned long Dblword, DblWord; /* retained for back compatibility */ +typedef long Fixed; +typedef long Frac; +typedef extended Extended; +typedef extended *ExtendedPtr; +typedef char *ptr, *Ptr, *pointer, *Pointer; +typedef ptr *handle, *Handle; +typedef Handle *HandlePtr; +typedef char *CStringPtr, **CStringHndl, ***CStringHndlPtr; +typedef long (*ProcPtr)(void); /* retained for back compatibility */ +typedef pascal void (*VoidProcPtr)(void); +typedef pascal Word (*WordProcPtr)(void); +typedef pascal LongWord (*LongProcPtr)(void); + +typedef unsigned int boolean, Boolean, BOOLEAN; +typedef short OSErr; +typedef int *IntPtr ; +typedef Ptr FPTPtr; + +#define String(size) struct {unsigned char textLength; unsigned char text[size];} +typedef String(255) Str255, *StringPtr, **StringHandle; +typedef String(32) Str32, *String32Ptr, **String32Handle; + +struct Point { + short v; + short h; + }; +typedef struct Point Point, *PointPtr; + +struct Rect { + short v1; + short h1; + short v2; + short h2; + }; +typedef struct Rect Rect, *RectPtr, **RectHndl; + +struct TimeRec { + Byte second; + Byte minute; + Byte hour; + Byte year; + Byte day; + Byte month; + Byte extra; + Byte weekDay; + }; +typedef struct TimeRec TimeRec, *TimeRecPtr, **TimeRecHndl; + +typedef Word RefDescriptor; + +extern unsigned _ownerid; +extern int _toolErr; + +#ifndef Ref +#define Ref Long +#endif + +/* Formerly in GSOS.h */ + +#ifdef __GNO__ +typedef struct GSString { /* don't use "struct GSString"; use pointers */ + Word length; /* Number of chars in text field */ + char text[1]; /* Is enlarged dynamically */ +} *GSStringPtr, **GSStringHndl; +typedef GSStringHndl *GSStringHndlPtr; +#endif + +typedef struct GSString255 { + Word length; /* Number of Chars in text field */ + char text[255]; + } GSString255, *GSString255Ptr, **GSString255Hndl; +typedef GSString255Hndl *GSString255HndlPtr; + +typedef struct GSString32 { + Word length; /* Number of characters in text field */ + char text[32]; + } GSString32, *GSString32Ptr, **GSString32Hndl; + +#ifdef __GNO__ +typedef struct ResultBuf { /* don't use "struct ResultBuf"; use pointers */ + Word bufSize; /* Maximum number of chars in text field */ + struct GSString bufString; /* This one is enlarged dynamically */ +} *ResultBufPtr, **ResultBufHndl; +typedef ResultBufHndl *ResultBufHndlPtr ; +#endif + +typedef struct ResultBuf255 { + Word bufSize; + GSString255 bufString; + } ResultBuf255, *ResultBuf255Ptr, **ResultBuf255Hndl; +typedef ResultBuf255Hndl *ResultBuf255HndlPtr ; + +typedef struct ResultBuf32 { + Word bufSize; + GSString32 bufString; + } ResultBuf32, *ResultBuf32Ptr, **ResultBuf32Hndl; + +/* Formerly in QuickDraw.h */ + +typedef unsigned char Pattern[32], *PatternPtr; +typedef unsigned char Mask[8]; +typedef Word ColorTable[16], *ColorTablePtr, **ColorTableHndl; + +/* TextStyle */ +#define plainMask 0x0000 /* Mask for plain text bit */ +#define boldMask 0x0001 /* Mask for bold bit */ +#define italicMask 0x0002 /* Mask for italic bit */ +#define underlineMask 0x0004 /* Mask for underline bit */ +#define outlineMask 0x0008 /* Mask for outline bit */ +#define shadowMask 0x0010 /* Mask for shadow bit */ +#define fUseShadowing 0x8000 /* corrected 26-May-92 DAL */ +#define fFastPortAware 0x4000 + +typedef Integer TextStyle; + +struct LocInfo { + Word portSCB; /* SCBByte in low byte */ + Pointer ptrToPixImage; /* ImageRef */ + Word width; /* Width */ + Rect boundsRect; /* BoundsRect */ + }; +typedef struct LocInfo LocInfo, *LocInfoPtr, **LocInfoHndl; + +struct Region { + Word rgnSize; /* size in bytes */ + Rect rgnBBox; /* enclosing rectangle */ + }; +typedef struct Region Region, *RegionPtr, **RegionHndl; + +struct Font { + Word offseToMF; /* fully defined front of the Font record. */ + Word family; + TextStyle style; + Word size; + Word version; + Word fbrExtent; + Word highowTLoc; + }; +typedef struct Font Font, *FontPtr, **FontHndl; + +union FontID { + struct { + Word famNum; + Byte fontStyle; + Byte fontSize; + } fidRec; + Long fidLong; + }; +typedef union FontID FontID, *FontIDPtr, **FontIDHndl; + +struct QDProcs { + VoidProcPtr stdText; + VoidProcPtr stdLine; + VoidProcPtr stdRect; + VoidProcPtr stdRRect; + VoidProcPtr stdOval; + VoidProcPtr stdArc; + VoidProcPtr stdPoly; + VoidProcPtr stdRgn; + VoidProcPtr stdPixels; + VoidProcPtr stdComment; + VoidProcPtr stdTxMeas; + VoidProcPtr stdTxBnds; + VoidProcPtr stdGetPic; + VoidProcPtr stdPutPic; + }; +typedef struct QDProcs QDProcs, *QDProcsPtr, **QDProcsHndl; + +struct GrafPort { + LocInfo portInfo; + Rect portRect; /* PortRect */ + RegionHndl clipRgn; /* Clip Rgn. Pointer */ + RegionHndl visRgn; /* Vis. Rgn. Pointer */ + Pattern bkPat; /* BackGround Pattern */ + Point pnLoc; /* Pen Location */ + Point pnSize; /* Pen Size */ + Word pnMode; /* Pen Mode */ + Pattern pnPat; /* Pen Pattern */ + Mask pnMask; /* Pen Mask */ + Word pnVis; /* Pen Visable */ + FontHndl fontHandle; + FontID fontID; /* Font ID */ + Word fontFlags; /* FontFlags */ + Word txSize; /* Text Size */ + TextStyle txFace; /* Text Face */ + Word txMode; /* Text Mode */ + Fixed spExtra; /* Fixed Point Value */ + Fixed chExtra; /* Fixed Point Value */ + Word fgColor; /* ForeGround Color */ + Word bgColor; /* BackGround Color */ + Handle picSave; /* PicSave */ + Handle rgnSave; /* RgnSave */ + Handle polySave; /* PolySave */ + QDProcsPtr grafProcs; + Word arcRot; /* ArcRot */ + Longint userField; /* UserField */ + Longint sysField; /* SysField */ + }; +typedef struct GrafPort GrafPort, *GrafPortPtr, **GrafPortHndl; + +/* Formerly in Control.h */ + +typedef GrafPortPtr WindowPtr; + +struct CtlRec { + struct CtlRec **ctlNext; /* Handle of next control. */ + WindowPtr ctlOwner; /* Pointer to control's window. */ + Rect ctlRect; /* Enclosing rectangle. */ + Byte ctlFlag; /* Bit flags. */ + Byte ctlHilite; /* Highlighted part. */ + Word ctlValue; /* Control's value. */ + LongProcPtr ctlProc; /* Control's definition procedure. */ + LongProcPtr ctlAction; /* Control's action procedure. */ + Longint ctlData; /* Reserved for CtrlProc's use. */ + Longint ctlRefCon; /* Reserved for application's use. */ + Pointer ctlColor; /* Pointer to appropriate color table. */ + Byte ctlReserved[16]; /* Reserved for future expansion */ + LongWord ctlID; + Word ctlMoreFlags; + Word ctlVersion; + }; +typedef struct CtlRec CtlRec, *CtlRecPtr, **CtlRecHndl, ***CtlRecHndlPtr; + +struct BarColors { + Word barOutline; /* color for outlining bar, arrows, and thumb */ + Word barNorArrow; /* color of arrows when not highlighted */ + Word barSelArrow; /* color of arrows when highlighted */ + Word barArrowBack; /* color of arrow box's background */ + Word barNorThumb; /* color of thumb's background when not highlighted */ + Word barSelThumb; /* color of thumb's background when highlighted */ + Word barPageRgn; /* color and pattern page region: high byte - 1= dither, 0 = solid */ + Word barInactive; /* color of scroll bar's interior when inactive */ + }; +typedef struct BarColors BarColors, *BarColorsPtr, **BarColorsHndl; + +/* Formerly in Event.h */ + +struct EventRecord { + Word what; /* event code */ + LongWord message; /* event message */ + LongWord when; /* ticks since startup */ + Point where; /* mouse location */ + Word modifiers; /* modifier flags */ + LongWord wmTaskData; + LongWord wmTaskMask; + LongWord wmLastClickTick; + Word wmClickCount; + LongWord wmTaskData2; + LongWord wmTaskData3; + LongWord wmTaskData4; + Point wmLastClickPt; + }; +typedef struct EventRecord EventRecord, *EventRecordPtr, **EventRecordHndl; + +/* Formerly in Window.h */ + +typedef EventRecord WmTaskRec; +typedef EventRecordPtr WmTaskRecPtr; + +#endif diff --git a/include/unistd.h b/include/unistd.h new file mode 100644 index 0000000..2dc9d3f --- /dev/null +++ b/include/unistd.h @@ -0,0 +1,204 @@ +/*- + * Copyright (c) 1991, 1993, 1994 + * 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 8.10 (Berkeley) 4/16/94 + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +#ifndef _SYS_TYPES_H_ +#include +#endif + +#ifndef _SYS_UNISTD_H_ +#include +#endif + +#define STDIN_FILENO 1 /* standard input file descriptor */ +#define STDOUT_FILENO 2 /* standard output file descriptor */ +#define STDERR_FILENO 3 /* standard error file descriptor */ + +#ifndef NULL +#define NULL (void *) 0L /* null pointer constant */ +#endif + +__BEGIN_DECLS +__dead void + _exit __P((int)) __dead2; +int access __P((const char *, int)); +unsigned long alarm __P((unsigned long)); /* non-POSIX types */ +#ifndef _POSIX_SOURCE +unsigned long alarm10 __P((unsigned long)); /* GNO-specific */ +char *basename __P((const char *path)); /* non-BSD */ +#endif +int chdir __P((const char *)); +int chown __P((const char *, uid_t, gid_t)); +int close __P((int)); +size_t confstr __P((int, char *, size_t)); +#ifndef _POSIX_SOURCE +char *dirname __P((const char *path)); /* non-BSD */ +#endif +int dup __P((int)); +int dup2 __P((int, int)); +#ifndef _POSIX_SOURCE +int exec __P((const char *, const char *)); +#endif +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 execve __P((const char *, char * const *, char * const *)); +#ifndef _POSIX_SOURCE +int _execve __P((const char *, const char *)); /* GNO specific */ +#endif +int execvp __P((const char *, char * const *)); +pid_t fork __P((void *)); /* non-POSIX */ +#ifndef _POSIX_SOURCE /* GNO specific */ +pid_t fork2 __P((void *, unsigned short, unsigned short, const char *, unsigned short, ...)); +#endif +long fpathconf __P((int, int)); +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 [])); +char *getlogin __P((void)); +#ifndef _POSIX_SOURCE +pid_t _getpgrp __P((pid_t)); /* was getpgrp() in GNO v2.0.4 and 4.3BSD */ +#endif +pid_t getpgrp __P((void)); +pid_t getpid __P((void)); +pid_t getppid __P((void)); +uid_t getuid __P((void)); +int isatty __P((int)); +int link __P((const char *, const char *)); +off_t lseek __P((int, off_t, int)); +long pathconf __P((const char *, int)); +int pause __P((void)); +int pipe __P((int *)); +ssize_t read __P((int, void *, size_t)); /* non-POSIX? */ +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)); +unsigned int sleep __P((unsigned int)); +long sysconf __P((int)); +pid_t tcgetpgrp __P((int)); +int tcsetpgrp __P((int, pid_t)); +char *ttyname __P((int)); +int unlink __P((const char *)); +ssize_t write __P((int, const void *, size_t)); + +#ifndef _POSIX_SOURCE +#ifdef __STDC__ +struct timeval; /* select(2) */ +#endif +int acct __P((const char *)); +int async_daemon __P((void)); +char *brk __P((const char *)); +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)); +void encrypt __P((char *, int)); /* non-BSD */ +void endusershell __P((void)); +int exect __P((const char *, char * const *, char * const *)); +int fchdir __P((int)); +int fchown __P((int, uid_t, gid_t)); +int fsync __P((int)); +int ftruncate __P((int, off_t)); +int getdomainname __P((char *, int)); +int getdtablesize __P((void)); +long gethostid __P((void)); +int gethostname __P((char *, int)); +mode_t getmode __P((const void *, mode_t)); +__pure 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 iruserok __P((unsigned long, int, const char *, const char *)); +int mknod __P((const char *, mode_t, dev_t)); +int mkstemp __P((char *)); +char *mktemp __P((char *)); +int nfssvc __P((int, void *)); +int nice __P((int)); +void psignal __P((unsigned int, const char *)); +extern __const char *__const sys_siglist[]; +int profil __P((char *, int, int, int)); +int rcmd __P((char **, u_short, const char *, /* non-BSD */ + 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 select __P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); +int setdomainname __P((const char *, 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 *)); /* non-BSD */ +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((gid_t, gid_t)); +int setreuid __P((uid_t, uid_t)); +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 int ualarm __P((unsigned int, unsigned int)); +void usleep __P((unsigned int)); +void *valloc __P((size_t)); /* obsoleted by malloc() */ +pid_t vfork __P((void *)); /* non-BSD */ +#endif /* !_POSIX_SOURCE */ +__END_DECLS + +#endif /* !_UNISTD_H_ */ diff --git a/include/utime.h b/include/utime.h new file mode 100644 index 0000000..be8ff9f --- /dev/null +++ b/include/utime.h @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 1990, 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. + * + * @(#)utime.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _UTIME_H_ +#define _UTIME_H_ + +struct utimbuf { + time_t actime; /* Access time */ + time_t modtime; /* Modification time */ +}; + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +__BEGIN_DECLS +int utime __P((const char *, const struct utimbuf *)); +__END_DECLS + +#endif /* !_UTIME_H_ */ diff --git a/include/utmp.h b/include/utmp.h new file mode 100644 index 0000000..d41e066 --- /dev/null +++ b/include/utmp.h @@ -0,0 +1,83 @@ +/* + * GNO/ME utmp/wtmp/lastlog definitions. These structures and _PATH* + * locations aren't even close to being BSD-ish. + * + * $Id: utmp.h,v 1.1 1997/02/28 04:42:04 gdr Exp $ + */ + +#ifndef _UTMP_H_ +#define _UTMP_H_ + +#ifndef _SYS_CDEFS_H_ +#include +#endif + +#ifndef _TIME_H_ +#include +#endif + +#ifndef _SYS_TYPES_H_ +#include +#endif + +#define _PATH_UTMP "/var/adm/utmp" +#define _PATH_WTMP "/var/adm/wtmp" +#define _PATH_LASTLOG "/var/adm/lastlog" + +#define UT_NAMESIZE 8 +#define UT_LINESIZE 8 +#define UT_HOSTSIZE 16 + +/* In the hopes that this will help keep old programs from breaking if the + format is expanded, these values are actually bitmapped. The masks which + can be used to obtain certain characteristics about a process are listed + below, after the types themselves */ + +#define USER_PROCESS 1 +#define LOCK_PROCESS 32 +#define DEAD_PROCESS 128 +#define CRASHED_PROCESS 129 +#define WTMP_EXTENSION 256 +#define GETTY_PROCESS 96 +#define NOT_DEAD_YET 257 + +#define UT_SPECIAL 256 /* special */ +#define UT_HAS_NO_WTMPENT 64 /* lock which is not recorded in wtmp */ +#define UT_INVISIBLE 32 /* does not apply to wtmp, only to utmp */ +#define UT_LOGOUT_PROC 128 /* anything valid as ut_offtype */ +#define WTMP_CONTINUED 32768 /* continued in the next entry */ + +struct wtmp { + unsigned int ut_type; + time_t ut_time; + unsigned int ut_offtype; + time_t ut_offtime; + char ut_name[UT_NAMESIZE]; + char ut_line[UT_LINESIZE]; + char ut_host[UT_HOSTSIZE]; +}; + +struct utmp { + unsigned int ut_type; + time_t ut_time; + pid_t ut_pid; + unsigned long ut_wtmpent; + char ut_name[UT_NAMESIZE]; + char ut_line[UT_LINESIZE]; + char ut_host[UT_HOSTSIZE]; +}; + +struct lastlog { + time_t ll_time; + char ll_line[UT_LINESIZE]; + char ll_host[UT_HOSTSIZE]; + unsigned long ll_wtmpent; +}; + +#ifndef _POSIX_SOURCE +int locktty __P((unsigned ut_type, pid_t ut_pid, char *name, char *line, + char *host, int slot)); +int unlocktty __P((int slot, pid_t ut_pid)); +#endif + +#endif /* _UTMP_H_ */ diff --git a/orcacdefs/defaults.h b/orcacdefs/defaults.h new file mode 100644 index 0000000..8741c36 --- /dev/null +++ b/orcacdefs/defaults.h @@ -0,0 +1,34 @@ +/************************************************* + * Start of GNO v2.0.6 definitions. + * + * $Id: defaults.h,v 1.1 1997/02/28 04:42:19 gdr Exp $ + */ + +#define __appleiigs__ +#define __GNO__ + +/* + * __ORCAC_VERSION should be: + * undefined for Orca/C earlier than v2.1.0 + * 210 for Orca/C v2.1.0 - v2.1.1b1 + * 210 for Orca/C v2.1.1b2 and higher + * Note that if you have Orca/C v2.0.x or earlier, it doesn't even + * include this file by default. + */ +#define __ORCAC_VERSION 211 + +/* + * These should be identically equal. Orca/C headers use one, BSD headers + * use the other. Unfortunately, this construct will miss definitions + * given in source files -- it is only caught on the occ command line. + */ +#if defined(__KeepNamespacePure__) && !defined(_ANSI_SOURCE) +#define _ANSI_SOURCE +#endif +#if defined(_ANSI_SOURCE) && !defined(__KeepNamespacePure__) +#define __KeepNamespacePure__ +#endif + +/* + * End of GNO v2.0.6 definitions. + *************************************************/