diff options
Diffstat (limited to 'winsup/cygwin/include')
67 files changed, 4011 insertions, 0 deletions
diff --git a/winsup/cygwin/include/a.out.h b/winsup/cygwin/include/a.out.h new file mode 100644 index 000000000..493c63cce --- /dev/null +++ b/winsup/cygwin/include/a.out.h @@ -0,0 +1,421 @@ +#ifndef _A_OUT_H_ +#define _A_OUT_H_ + +#ifdef __cplusplus +extern "C" { +#endif +#define COFF_IMAGE_WITH_PE +#define COFF_LONG_SECTION_NAMES + +/*** coff information for Intel 386/486. */ + + +/********************** FILE HEADER **********************/ + +struct external_filehdr { + short f_magic; /* magic number */ + short f_nscns; /* number of sections */ + unsigned long f_timdat; /* time & date stamp */ + unsigned long f_symptr; /* file pointer to symtab */ + unsigned long f_nsyms; /* number of symtab entries */ + short f_opthdr; /* sizeof(optional hdr) */ + short f_flags; /* flags */ +}; + +/* Bits for f_flags: + * F_RELFLG relocation info stripped from file + * F_EXEC file is executable (no unresolved external references) + * F_LNNO line numbers stripped from file + * F_LSYMS local symbols stripped from file + * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) + */ + +#define F_RELFLG (0x0001) +#define F_EXEC (0x0002) +#define F_LNNO (0x0004) +#define F_LSYMS (0x0008) + + + +#define I386MAGIC 0x14c +#define I386PTXMAGIC 0x154 +#define I386AIXMAGIC 0x175 + +/* This is Lynx's all-platform magic number for executables. */ + +#define LYNXCOFFMAGIC 0415 + +#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \ + && (x).f_magic != I386AIXMAGIC \ + && (x).f_magic != I386PTXMAGIC \ + && (x).f_magic != LYNXCOFFMAGIC) + +#define FILHDR struct external_filehdr +#define FILHSZ 20 + + +/********************** AOUT "OPTIONAL HEADER"= + **********************/ + + +typedef struct +{ + unsigned short magic; /* type of file */ + unsigned short vstamp; /* version stamp */ + unsigned long tsize; /* text size in bytes, padded to FW bdry*/ + unsigned long dsize; /* initialized data " " */ + unsigned long bsize; /* uninitialized data " " */ + unsigned long entry; /* entry pt. */ + unsigned long text_start; /* base of text used for this file */ + unsigned long data_start; /* base of data used for this file= + */ +} +AOUTHDR; + +#define AOUTSZ 28 +#define AOUTHDRSZ 28 + +#define OMAGIC 0404 /* object files, eg as output */ +#define ZMAGIC 0413 /* demand load format, eg normal ld output */ +#define STMAGIC 0401 /* target shlib */ +#define SHMAGIC 0443 /* host shlib */ + + +/* define some NT default values */ +/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ +#define NT_SECTION_ALIGNMENT 0x1000 +#define NT_FILE_ALIGNMENT 0x200 +#define NT_DEF_RESERVE 0x100000 +#define NT_DEF_COMMIT 0x1000 + +/********************** SECTION HEADER **********************/ + + +struct external_scnhdr { + char s_name[8]; /* section name */ + unsigned long s_paddr; /* physical address, offset + of last addr in scn */ + unsigned long s_vaddr; /* virtual address */ + unsigned long s_size; /* section size */ + unsigned long s_scnptr; /* file ptr to raw data for section */ + unsigned long s_relptr; /* file ptr to relocation */ + unsigned long s_lnnoptr; /* file ptr to line numbers */ + unsigned short s_nreloc; /* number of relocation entries */ + unsigned short s_nlnno; /* number of line number entries*/ + unsigned long s_flags; /* flags */ +}; + +#define SCNHDR struct external_scnhdr +#define SCNHSZ 40 + +/* + * names of "special" sections + */ +#define _TEXT ".text" +#define _DATA ".data" +#define _BSS ".bss" +#define _COMMENT ".comment" +#define _LIB ".lib" + +/********************** LINE NUMBERS **********************/ + +/* 1 line number entry for every "breakpointable" source line in a section. + * Line numbers are grouped on a per function basis; first entry in a function + * grouping will have l_lnno = 0 and in place of physical address will be the + * symbol table index of the function name. + */ +struct external_lineno { + union { + unsigned long l_symndx; /* function name symbol index, iff l_lnno 0 */ + unsigned long l_paddr; /* (physical) address of line number */ + } l_addr; + unsigned short l_lnno; /* line number */ +}; + +#define LINENO struct external_lineno +#define LINESZ 6 + +/********************** SYMBOLS **********************/ + +#define E_SYMNMLEN 8 /* # characters in a symbol name */ +#define E_FILNMLEN 14 /* # characters in a file name */ +#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ + +struct external_syment +{ + union { + char e_name[E_SYMNMLEN]; + struct { + unsigned long e_zeroes; + unsigned long e_offset; + } e; + } e; + unsigned long e_value; + unsigned short e_scnum; + unsigned short e_type; + char e_sclass[1]; + char e_numaux[1]; +}; + +#define N_BTMASK (0xf) +#define N_TMASK (0x30) +#define N_BTSHFT (4) +#define N_TSHIFT (2) + +union external_auxent { + struct { + unsigned long x_tagndx; /* str, un, or enum tag indx */ + union { + struct { + unsigned short x_lnno; /* declaration line number */ + unsigned short x_size; /* str/union/array size */ + } x_lnsz; + unsigned long x_fsize; /* size of function */ + } x_misc; + union { + struct { /* if ISFCN, tag, or .bb */ + unsigned long x_lnnoptr;/* ptr to fcn line # */ + unsigned long x_endndx; /* entry ndx past block end */ + } x_fcn; + struct { /* if ISARY, up to 4 dimen. */ + char x_dimen[E_DIMNUM][2]; + } x_ary; + } x_fcnary; + unsigned short x_tvndx; /* tv index */ + } x_sym; + + union { + char x_fname[E_FILNMLEN]; + struct { + unsigned long x_zeroes; + unsigned long x_offset; + } x_n; + } x_file; + + struct { + unsigned long x_scnlen; /* section length */ + unsigned short x_nreloc; /* # relocation entries */ + unsigned short x_nlinno; /* # line numbers */ + unsigned long x_checksum; /* section COMDAT checksum */ + unsigned short x_associated;/* COMDAT associated section index */ + char x_comdat[1]; /* COMDAT selection number */ + } x_scn; + + struct { + unsigned long x_tvfill; /* tv fill value */ + unsigned short x_tvlen; /* length of .tv */ + char x_tvran[2][2]; /* tv range */ + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ + +}; + +#define SYMENT struct external_syment +#define SYMESZ 18 +#define AUXENT union external_auxent +#define AUXESZ 18 + +#define _ETEXT "etext" + +/********************** RELOCATION DIRECTIVES **********************/ + +struct external_reloc { + char r_vaddr[4]; + char r_symndx[4]; + char r_type[2]; +}; + +#define RELOC struct external_reloc +#define RELSZ 10 + +/* end of coff/i386.h */ + +/* PE COFF header information */ + +#ifndef _PE_H +#define _PE_H + +/* NT specific file attributes */ +#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 +#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 +#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 +#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 +#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 +#define IMAGE_FILE_32BIT_MACHINE 0x0100 +#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 +#define IMAGE_FILE_SYSTEM 0x1000 +#define IMAGE_FILE_DLL 0x2000 +#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 + +/* additional flags to be set for section headers to allow the NT loader to + read and write to the section data (to replace the addresses of data in + dlls for one thing); also to execute the section in .text's case= + */ +#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 +#define IMAGE_SCN_MEM_EXECUTE 0x20000000 +#define IMAGE_SCN_MEM_READ 0x40000000 +#define IMAGE_SCN_MEM_WRITE 0x80000000 + +/* + * Section characteristics added for ppc-nt + */ + +#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved. */ + +#define IMAGE_SCN_CNT_CODE 0x00000020 /* Section contains code. */ +#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* Section contains initialized data. */ +#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* Section contains uninitialized data. */ + +#define IMAGE_SCN_LNK_OTHER 0x00000100 /* Reserved. */ +#define IMAGE_SCN_LNK_INFO 0x00000200 /* Section contains comments or some other type of information. */ +#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */ +#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */ + +#define IMAGE_SCN_MEM_FARDATA 0x00008000 + +#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 +#define IMAGE_SCN_MEM_16BIT 0x00020000 +#define IMAGE_SCN_MEM_LOCKED 0x00040000 +#define IMAGE_SCN_MEM_PRELOAD 0x00080000 + +#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 +#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 +#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 +#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 +#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */ +#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 +#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 + + +#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */ +#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */ +#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* Section is not pageable. */ +#define IMAGE_SCN_MEM_SHARED 0x10000000 /* Section is shareable. */ + +/* COMDAT selection codes. */ + +#define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */ +#define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */ +#define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */ +#define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */ +#define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */ + +/* Magic values that are true for all dos/nt implementations */ +#define DOSMAGIC 0x5a4d +#define NT_SIGNATURE 0x00004550 + +/* NT allows long filenames, we want to accommodate this. This may break + some of the bfd functions */ +#undef FILNMLEN +#define FILNMLEN 18 /* # characters in a file name */ + + +#ifdef COFF_IMAGE_WITH_PE +/* The filehdr is only weired in images */ + +#undef FILHDR +struct external_PE_filehdr +{ + /* DOS header fields */ + unsigned short e_magic; /* Magic number, 0x5a4d */ + unsigned short e_cblp; /* Bytes on last page of file, 0x90 */ + unsigned short e_cp; /* Pages in file, 0x3 */ + unsigned short e_crlc; /* Relocations, 0x0 */ + unsigned short e_cparhdr; /* Size of header in paragraphs, 0x4 */ + unsigned short e_minalloc; /* Minimum extra paragraphs needed, 0x0 */ + unsigned short e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */ + unsigned short e_ss; /* Initial (relative) SS value, 0x0 */ + unsigned short e_sp; /* Initial SP value, 0xb8 */ + unsigned short e_csum; /* Checksum, 0x0 */ + unsigned short e_ip; /* Initial IP value, 0x0 */ + unsigned short e_cs; /* Initial (relative) CS value, 0x0 */ + unsigned short e_lfarlc; /* File address of relocation table, 0x40 */ + unsigned short e_ovno; /* Overlay number, 0x0 */ + char e_res[4][2]; /* Reserved words, all 0x0 */ + unsigned short e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */ + unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */ + char e_res2[10][2]; /* Reserved words, all 0x0 */ + unsigned long e_lfanew; /* File address of new exe header, 0x80 */ + char dos_message[16][4]; /* other stuff, always follow DOS header */ + unsigned int nt_signature; /* required NT signature, 0x4550 */ + + /* From standard header */ + + unsigned short f_magic; /* magic number */ + unsigned short f_nscns; /* number of sections */ + unsigned long f_timdat; /* time & date stamp */ + unsigned long f_symptr; /* file pointer to symtab */ + unsigned long f_nsyms; /* number of symtab entries */ + unsigned short f_opthdr; /* sizeof(optional hdr) */ + unsigned short f_flags; /* flags */ +}; + + +#define FILHDR struct external_PE_filehdr +#undef FILHSZ +#define FILHSZ 152 + +#endif + +typedef struct +{ + unsigned short magic; /* type of file */ + unsigned short vstamp; /* version stamp */ + unsigned long tsize; /* text size in bytes, padded to FW bdry*/ + unsigned long dsize; /* initialized data " " */ + unsigned long bsize; /* uninitialized data " " */ + unsigned long entry; /* entry pt. */ + unsigned long text_start; /* base of text used for this file */ + unsigned long data_start; /* base of all data used for this file */ + + /* NT extra fields; see internal.h for descriptions */ + unsigned long ImageBase; + unsigned long SectionAlignment; + unsigned long FileAlignment; + unsigned short MajorOperatingSystemVersion; + unsigned short MinorOperatingSystemVersion; + unsigned short MajorImageVersion; + unsigned short MinorImageVersion; + unsigned short MajorSubsystemVersion; + unsigned short MinorSubsystemVersion; + char Reserved1[4]; + unsigned long SizeOfImage; + unsigned long SizeOfHeaders; + unsigned long CheckSum; + unsigned short Subsystem; + unsigned short DllCharacteristics; + unsigned long SizeOfStackReserve; + unsigned long SizeOfStackCommit; + unsigned long SizeOfHeapReserve; + unsigned long SizeOfHeapCommit; + unsigned long LoaderFlags; + unsigned long NumberOfRvaAndSizes; + /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */ + char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */ + +} PEAOUTHDR; + + +#undef AOUTSZ +#define AOUTSZ (AOUTHDRSZ + 196) + +#undef E_FILNMLEN +#define E_FILNMLEN 18 /* # characters in a file name */ +#endif + +/* end of coff/pe.h */ + +#define DT_NON (0) /* no derived type */ +#define DT_PTR (1) /* pointer */ +#define DT_FCN (2) /* function */ +#define DT_ARY (3) /* array */ + +#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) +#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) +#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) + +#ifdef __cplusplus +} +#endif + +#endif /* _A_OUT_H_ */ + diff --git a/winsup/cygwin/include/arpa/ftp.h b/winsup/cygwin/include/arpa/ftp.h new file mode 100644 index 000000000..7d39a3e7a --- /dev/null +++ b/winsup/cygwin/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 /* !_ARPA_FTP_H */ diff --git a/winsup/cygwin/include/arpa/inet.h b/winsup/cygwin/include/arpa/inet.h new file mode 100644 index 000000000..5b6966ce3 --- /dev/null +++ b/winsup/cygwin/include/arpa/inet.h @@ -0,0 +1,25 @@ +#ifndef _ARPA_INET_H +#define _ARPA_INET_H + +#include <netinet/in.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef __INSIDE_CYGWIN_NET__ +unsigned long inet_addr (const char *); +int inet_aton (const char *, struct in_addr *); +unsigned long inet_lnaof (struct in_addr); +struct in_addr inet_makeaddr (unsigned long , unsigned long); +unsigned int inet_netof (struct in_addr); +unsigned int inet_network (const char *); +char *inet_ntoa (struct in_addr); +#endif + +#ifdef __cplusplus +}; +#endif + +#endif /* _ARPA_INET_H */ diff --git a/winsup/cygwin/include/arpa/telnet.h b/winsup/cygwin/include/arpa/telnet.h new file mode 100644 index 000000000..3e523ea97 --- /dev/null +++ b/winsup/cygwin/include/arpa/telnet.h @@ -0,0 +1,322 @@ +/* + * 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", 0, +}; +#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 TELOPT_ENVIRON TELOPT_OLD_ENVIRON + +#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", + 0, +}; +#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", 0, +#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 + +#define ENV_VALUE 0 +#define ENV_VAR 1 + +/* + * 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 /* _ARPA_TELNET_H */ diff --git a/winsup/cygwin/include/asm/byteorder.h b/winsup/cygwin/include/asm/byteorder.h new file mode 100644 index 000000000..5ccd9850a --- /dev/null +++ b/winsup/cygwin/include/asm/byteorder.h @@ -0,0 +1,93 @@ +#ifndef _I386_BYTEORDER_H +#define _I386_BYTEORDER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if 0 +#undef ntohl +#undef ntohs +#undef htonl +#undef htons +#endif + +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN 1234 +#endif + +#ifndef __LITTLE_ENDIAN_BITFIELD +#define __LITTLE_ENDIAN_BITFIELD +#endif + +#if 1 +extern unsigned long int ntohl(unsigned long int); +extern unsigned short int ntohs(unsigned short int); +extern unsigned long int htonl(unsigned long int); +extern unsigned short int htons(unsigned short int); + +extern __inline__ unsigned long int __ntohl(unsigned long int); +extern __inline__ unsigned short int __ntohs(unsigned short int); +extern __inline__ unsigned long int __constant_ntohl(unsigned long int); +extern __inline__ unsigned short int __constant_ntohs(unsigned short int); + +extern __inline__ unsigned long int +__ntohl(unsigned long int x) +{ + __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ + "rorl $16,%0\n\t" /* swap words */ + "xchgb %b0,%h0" /* swap higher bytes */ + :"=q" (x) + : "0" (x)); + return x; +} + +#define __constant_ntohl(x) \ + ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ + (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ + (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ + (((unsigned long int)(x) & 0xff000000U) >> 24))) + +extern __inline__ unsigned short int +__ntohs(unsigned short int x) +{ + __asm__("xchgb %b0,%h0" /* swap bytes */ + : "=q" (x) + : "0" (x)); + return x; +} + +#define __constant_ntohs(x) \ + ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ + (((unsigned short int)(x) & 0xff00) >> 8))) \ + +#define __htonl(x) __ntohl(x) +#define __htons(x) __ntohs(x) +#define __constant_htonl(x) __constant_ntohl(x) +#define __constant_htons(x) __constant_ntohs(x) + +#ifdef __OPTIMIZE__ +# define ntohl(x) \ +(__builtin_constant_p((long)(x)) ? \ + __constant_ntohl((x)) : \ + __ntohl((x))) +# define ntohs(x) \ +(__builtin_constant_p((short)(x)) ? \ + __constant_ntohs((x)) : \ + __ntohs((x))) +# define htonl(x) \ +(__builtin_constant_p((long)(x)) ? \ + __constant_htonl((x)) : \ + __htonl((x))) +# define htons(x) \ +(__builtin_constant_p((short)(x)) ? \ + __constant_htons((x)) : \ + __htons((x))) +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/winsup/cygwin/include/asm/socket.h b/winsup/cygwin/include/asm/socket.h new file mode 100644 index 000000000..167919765 --- /dev/null +++ b/winsup/cygwin/include/asm/socket.h @@ -0,0 +1,58 @@ +#ifndef _ASM_SOCKET_H +#define _ASM_SOCKET_H + +#include <cygwin/if.h> + +#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ + +#define _IO(x,y) (IOC_VOID|(x<<8)|y) +#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) +#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) + +#define SIOCATMARK _IOR('s', 7, u_long) /* at oob mark? */ +#define FIONREAD _IOR('f', 127, u_long) /* get # bytes to read */ +#define FIONBIO 0x8004667e /* To be compatible with termiost version */ +#define REAL_FIONBIO _IOW('f', 126, u_long) /* set/clear non-blocking i/o */ +#define FIOASYNC _IOW('f', 125, u_long) /* set/clear async i/o */ +#define SIOCSHIWAT _IOW('s', 0, u_long) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, u_long) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, u_long) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, u_long) /* get low watermark */ + +/* Needed for if queries */ +#define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */ +#define SIOCGIFFLAGS _IOW('s', 101, struct ifreq) /* Get if flags */ +#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */ +#define SIOCGIFBRDADDR _IOW('s', 103, struct ifreq) /* Get if broadcastaddr */ +#define SIOCGIFNETMASK _IOW('s', 104, struct ifreq) /* Get if netmask */ + +#define SOL_SOCKET 0xffff /* options for socket level */ + +#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_DONTLINGER (u_int)(~SO_LINGER) + +/* + * Additional 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 */ + +#endif /* _ASM_SOCKET_H */ + diff --git a/winsup/cygwin/include/asm/types.h b/winsup/cygwin/include/asm/types.h new file mode 100644 index 000000000..be1177d3c --- /dev/null +++ b/winsup/cygwin/include/asm/types.h @@ -0,0 +1,13 @@ +#ifndef _ASM_TYPES_H +#define _ASM_TYPES_H + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#endif /* _ASM_TYPES_H */ diff --git a/winsup/cygwin/include/cygwin/acl.h b/winsup/cygwin/include/cygwin/acl.h new file mode 100644 index 000000000..d54655a5a --- /dev/null +++ b/winsup/cygwin/include/cygwin/acl.h @@ -0,0 +1,81 @@ +/* cygwin/acl.h header file for Cygwin. + + Copyright 1999, 2000 Cygnus Solutions. + Written by C. Vinschen. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _CYGWIN_ACL_H +#ifdef __cplusplus +extern "C" { +#endif +#define _CYGWIN_ACL_H + +#include <_ansi.h> + +#include <sys/types.h> +#include <sys/stat.h> + +/* Values for `cmd' in calls to acl(2) and facl(2) */ +#define SETACL (0x0) +#define GETACL (0x1) +#define GETACLCNT (0x2) + +#define MIN_ACL_ENTRIES (4) // minimal acl entries from GETACLCNT +#define MAX_ACL_ENTRIES (256) // max entries of each type + +// Return values of aclcheck(3) in case of error */ +#define GRP_ERROR (0x1) +#define USER_ERROR (0x2) +#define CLASS_ERROR (0x3) +#define OTHER_ERROR (0x4) +#define DUPLICATE_ERROR (0x5) +#define ENTRY_ERROR (0x6) +#define MISS_ERROR (0x7) // which = -1 +#define MEM_ERROR (0x8) // which = -1 + +// Values for entry type of struct acl +#define USER_OBJ (0x0001) // owner +#define USER (0x0002) // additional user +#define GROUP_OBJ (0x0004) // owning group +#define GROUP (0x0008) // additional group +#define CLASS_OBJ (0x0010) // mask entry +#define OTHER_OBJ (0x0020) // others +#define ACL_DEFAULT (0x1000) // default flag +#define DEF_USER_OBJ (ACL_DEFAULT|USER_OBJ) // default owner +#define DEF_USER (ACL_DEFAULT|USER) // default additional user +#define DEF_GROUP_OBJ (ACL_DEFAULT|GROUP_OBJ) // default owning group +#define DEF_GROUP (ACL_DEFAULT|GROUP) // default additional group +#define DEF_CLASS_OBJ (ACL_DEFAULT|CLASS_OBJ) // default mask entry +#define DEF_OTHER_OBJ (ACL_DEFAULT|OTHER_OBJ) // default others +// Values with equivalent meanings +#define USER_OWNER USER_OBJ +#define GROUP_OWNER GROUP_OBJ +#define MASK CLASS_OBJ +#define OTHER OTHER_OBJ + +typedef struct acl { + int a_type; /* entry type */ + uid_t a_id; /* UID | GID */ + mode_t a_perm; /* permissions */ +} aclent_t; + +int _EXFUN(acl,(const char *path, int cmd, int nentries, aclent_t *aclbufp)); +int _EXFUN(facl,(int fd, int cmd, int nentries, aclent_t *aclbufp)); +int _EXFUN(aclcheck,(aclent_t *aclbufp, int nentries, int *which)); +int _EXFUN(aclsort,(int nentries, int calclass, aclent_t *aclbufp)); +int _EXFUN(acltomode,(aclent_t *aclbufp, int nentries, mode_t *modep)); +int _EXFUN(aclfrommode,(aclent_t *aclbufp, int nentries, mode_t *modep)); +int _EXFUN(acltopbits,(aclent_t *aclbufp, int nentries, mode_t *pbitsp)); +int _EXFUN(aclfrompbits,(aclent_t *aclbufp, int nentries, mode_t *pbitsp)); +char *_EXFUN(acltotext,(aclent_t *aclbufp, int aclcnt)); +aclent_t *_EXFUN(aclfromtext,(char *acltextp, int *aclcnt)); + +#ifdef __cplusplus +} +#endif +#endif /* _CYGWIN_ACL_H */ diff --git a/winsup/cygwin/include/cygwin/cygwin_dll.h b/winsup/cygwin/include/cygwin/cygwin_dll.h new file mode 100644 index 000000000..08cdbdf00 --- /dev/null +++ b/winsup/cygwin/include/cygwin/cygwin_dll.h @@ -0,0 +1,96 @@ +/* cygwin_dll.h + + Copyright 1998 Cygnus Solutions + +This file is part of Cygwin32. + +This software is a copyrighted work licensed under the terms of the +Cygwin32 license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef __CYGWIN_CYGWIN_DLL_H__ +#define __CYGWIN_CYGWIN_DLL_H__ + +#include <windows.h> + +#ifdef __cplusplus +#define CDECL_BEGIN extern "C" { +#define CDECL_END } +#else +#define CDECL_BEGIN +#define CDECL_END +#endif + +#define DECLARE_CYGWIN_DLL(Entry) \ + \ +CDECL_BEGIN \ + int WINAPI _cygwin_dll_entry (HANDLE h, DWORD reason, void *ptr); \ + int WINAPI _cygwin_noncygwin_dll_entry (HANDLE h, DWORD reason, void *ptr); \ + \ + int WINAPI Entry (HANDLE h, DWORD reason, void *ptr); \ + extern int cygwin_attach_dll (); \ + extern void cygwin_detach_dll (); \ +CDECL_END \ + \ +static HANDLE storedHandle; \ +static DWORD storedReason; \ +static void* storedPtr; \ + \ +static int __dllMain (int a, char **b, char **c) \ +{ \ + return Entry (storedHandle, storedReason, storedPtr); \ +} \ + \ +static int dll_index; \ + \ +int WINAPI _cygwin_dll_entry (HANDLE h, DWORD reason, void *ptr) \ +{ \ + int ret; \ + ret = 1; \ + \ + switch (reason) \ + { \ + case DLL_PROCESS_ATTACH: \ + { \ + storedHandle = h; \ + storedReason = reason; \ + storedPtr = ptr; \ + dll_index = cygwin_attach_dll (h, &__dllMain); \ + if (dll_index == -1) \ + ret = 0; \ + } \ + break; \ + \ + case DLL_PROCESS_DETACH: \ + { \ + ret = Entry (h, reason, ptr); \ + if (ret) \ + { \ + cygwin_detach_dll (dll_index); \ + dll_index = -1; \ + } \ + } \ + break; \ + \ + case DLL_THREAD_ATTACH: \ + { \ + ret = Entry (h, reason, ptr); \ + } \ + break; \ + \ + case DLL_THREAD_DETACH: \ + { \ + ret = Entry (h, reason, ptr); \ + } \ + break; \ + } \ + return ret; \ +} \ + \ +/* OBSOLETE: This is only provided for source level compatibility. */ \ +int WINAPI _cygwin_noncygwin_dll_entry (HANDLE h, DWORD reason, void *ptr) \ +{ \ + return _cygwin_dll_entry (h, reason, ptr); \ +} \ + +#endif /* __CYGWIN_CYGWIN_DLL_H__ */ diff --git a/winsup/cygwin/include/cygwin/icmp.h b/winsup/cygwin/include/cygwin/icmp.h new file mode 100644 index 000000000..7e7aedccd --- /dev/null +++ b/winsup/cygwin/include/cygwin/icmp.h @@ -0,0 +1 @@ +/* icmp.h */ diff --git a/winsup/cygwin/include/cygwin/if.h b/winsup/cygwin/include/cygwin/if.h new file mode 100644 index 000000000..f16b82992 --- /dev/null +++ b/winsup/cygwin/include/cygwin/if.h @@ -0,0 +1,74 @@ +#ifndef _CYGWIN_IF_H_ +#define _CYGWIN_IF_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <sys/types.h> +#include <sys/socket.h> + +/* Standard interface flags. */ +#define IFF_UP 0x1 /* interface is up */ +#define IFF_BROADCAST 0x2 /* broadcast address valid */ +#define IFF_LOOPBACK 0x8 /* is a loopback net */ +#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ +#define IFF_RUNNING 0x40 /* resources allocated */ +#define IFF_PROMISC 0x100 /* receive all packets */ +#define IFF_MULTICAST 0x1000 /* Supports multicast */ + +/* + * 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 + union + { + char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + } ifr_ifrn; + + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + short ifru_flags; + int ifru_metric; + int ifru_mtu; + } ifr_ifru; +}; + +#define ifr_name ifr_ifrn.ifrn_name /* interface name */ +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ + +/* + * 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 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 */ + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#endif /* _CYGWIN_IF_H_ */ diff --git a/winsup/cygwin/include/cygwin/in.h b/winsup/cygwin/include/cygwin/in.h new file mode 100644 index 000000000..d9ab331b3 --- /dev/null +++ b/winsup/cygwin/include/cygwin/in.h @@ -0,0 +1,188 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions of the Internet Protocol. + * + * Version: @(#)in.h 1.0.1 04/21/93 + * + * Authors: Original taken from the GNU Project <netinet/in.h> file. + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _CYGWIN_IN_H +#define _CYGWIN_IN_H + +#include <cygwin/types.h> + +/* Standard well-defined IP protocols. */ +enum { + IPPROTO_IP = 0, /* Dummy protocol for TCP */ + IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ + IPPROTO_IGMP = 2, /* Internet Gateway Management Protocol */ + IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */ + IPPROTO_TCP = 6, /* Transmission Control Protocol */ + IPPROTO_EGP = 8, /* Exterior Gateway Protocol */ + IPPROTO_PUP = 12, /* PUP protocol */ + IPPROTO_UDP = 17, /* User Datagram Protocol */ + IPPROTO_IDP = 22, /* XNS IDP protocol */ + + IPPROTO_RAW = 255, /* Raw IP packets */ + IPPROTO_MAX +}; + +/* Standard well-known ports. *//* from winsup/include/netinet/in.h */ +enum + { + IPPORT_ECHO = 7, /* Echo service. */ + IPPORT_DISCARD = 9, /* Discard transmissions service. */ + IPPORT_SYSTAT = 11, /* System status service. */ + IPPORT_DAYTIME = 13, /* Time of day service. */ + IPPORT_NETSTAT = 15, /* Network status service. */ + IPPORT_FTP = 21, /* File Transfer Protocol. */ + IPPORT_TELNET = 23, /* Telnet protocol. */ + IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */ + IPPORT_TIMESERVER = 37, /* Timeserver service. */ + IPPORT_NAMESERVER = 42, /* Domain Name Service. */ + IPPORT_WHOIS = 43, /* Internet Whois service. */ + IPPORT_MTP = 57, + + IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */ + IPPORT_RJE = 77, + IPPORT_FINGER = 79, /* Finger service. */ + IPPORT_TTYLINK = 87, + IPPORT_SUPDUP = 95, /* SUPDUP protocol. */ + + + IPPORT_EXECSERVER = 512, /* execd service. */ + IPPORT_LOGINSERVER = 513, /* rlogind service. */ + IPPORT_CMDSERVER = 514, + IPPORT_EFSSERVER = 520, + + /* UDP ports. */ + IPPORT_BIFFUDP = 512, + IPPORT_WHOSERVER = 513, + IPPORT_ROUTESERVER = 520, + + /* Ports less than this value are reserved for privileged processes. */ + IPPORT_RESERVED = 1024, + + /* Ports greater this value are reserved for (non-privileged) servers. */ + IPPORT_USERRESERVED = 5000 + }; + + +/* Internet address. */ +struct in_addr { + unsigned int s_addr; +}; + +/* Request struct for multicast socket ops */ + +struct ip_mreq +{ + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + + +/* Structure describing an Internet (IP) socket address. */ +#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ +struct sockaddr_in { + short int sin_family; /* Address family */ + unsigned short int sin_port; /* Port number */ + struct in_addr sin_addr; /* Internet address */ + + /* Pad to size of `struct sockaddr'. */ + unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - + sizeof(unsigned short int) - sizeof(struct in_addr)]; +}; +#define sin_zero __pad /* for BSD UNIX comp. -FvK */ + + +/* + * Definitions of the bits in an Internet address integer. + * On subnets, host and network parts are found according + * to the subnet mask, not these masks. + */ +#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) + +#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(a) IN_CLASSD(a) +#define IN_MULTICAST_NET 0xF0000000 + +#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) + +/* Address to accept any incoming messages. */ +#define INADDR_ANY ((unsigned long int) 0x00000000) + +/* Address to send to all hosts. */ +#define INADDR_BROADCAST ((unsigned long int) 0xffffffff) + +/* Address indicating an error return. */ +#define INADDR_NONE 0xffffffff + +/* Network number for local host loopback. */ +#define IN_LOOPBACKNET 127 + +/* Address to loopback in software to local host. */ +#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */ +#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) + +/* Defines for Multicast INADDR */ +#define INADDR_UNSPEC_GROUP 0xe0000000 /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP 0xe0000001 /* 224.0.0.1 */ +#define INADDR_MAX_LOCAL_GROUP 0xe00000ff /* 224.0.0.255 */ + +/* <asm/byteorder.h> contains the htonl type stuff.. */ + +#include <asm/byteorder.h> + +/* Some random defines to make it easier in the kernel.. */ +#ifdef __KERNEL__ + +#define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000)) +#define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000)) + +#endif + +/* + * IPv6 definitions as we start to include them. This is just + * a beginning dont get excited 8) + */ + +struct in_addr6 +{ + unsigned char s6_addr[16]; +}; + +struct sockaddr_in6 +{ + unsigned short sin6_family; + unsigned short sin6_port; + unsigned long sin6_flowinfo; + struct in_addr6 sin6_addr; +}; + +#endif /* _CYGWIN_IN_H */ diff --git a/winsup/cygwin/include/cygwin/mtio.h b/winsup/cygwin/include/cygwin/mtio.h new file mode 100644 index 000000000..53ed42c76 --- /dev/null +++ b/winsup/cygwin/include/cygwin/mtio.h @@ -0,0 +1,190 @@ +/* + * cygwin/mtio.h header file for Cygwin. + * + * Original written by H. Bergman for Linux. + * Changed for Cygwin by C. Vinschen. + */ + +#ifndef _CYGWIN_MTIO_H +#define _CYGWIN_MTIO_H + +#include <sys/ioctl.h> +#include <asm/socket.h> + +/* + * Structures and definitions for mag tape io control commands + */ + +/* structure for MTIOCTOP - mag tape op command */ +struct mtop { + short mt_op; /* operations defined below */ + int mt_count; /* how many of them */ +}; + +/* Magnetic Tape operations [Not all operations supported by all drivers]: */ +#define MTRESET 0 /* +reset drive in case of problems */ +#define MTFSF 1 /* forward space over FileMark, + * position at first record of next file + */ +#define MTBSF 2 /* backward space FileMark (position before FM) */ +#define MTFSR 3 /* forward space record */ +#define MTBSR 4 /* backward space record */ +#define MTWEOF 5 /* write an end-of-file record (mark) */ +#define MTREW 6 /* rewind */ +#define MTOFFL 7 /* rewind and put the drive offline (eject?) */ +#define MTNOP 8 /* no op, set status only (read with MTIOCGET) */ +#define MTRETEN 9 /* retension tape */ +#define MTBSFM 10 /* +backward space FileMark, position at FM */ +#define MTFSFM 11 /* +forward space FileMark, position at FM */ +#define MTEOM 12 /* goto end of recorded media (for appending files). + * MTEOM positions after the last FM, ready for + * appending another file. + */ +#define MTERASE 13 /* erase tape -- be careful! */ + +#define MTRAS1 14 /* run self test 1 (nondestructive) */ +#define MTRAS2 15 /* run self test 2 (destructive) */ +#define MTRAS3 16 /* reserved for self test 3 */ + +#define MTSETBLK 20 /* set block length (SCSI) */ +#define MTSETDENSITY 21 /* set tape density (SCSI) */ +#define MTSEEK 22 /* seek to block (Tandberg, etc.) */ +#define MTTELL 23 /* tell block (Tandberg, etc.) */ +#define MTSETDRVBUFFER 24 /* set the drive buffering according to SCSI-2 */ + /* ordinary buffered operation with code 1 */ +#define MTFSS 25 /* space forward over setmarks */ +#define MTBSS 26 /* space backward over setmarks */ +#define MTWSM 27 /* write setmarks */ + +#define MTLOCK 28 /* lock the drive door */ +#define MTUNLOCK 29 /* unlock the drive door */ +#define MTLOAD 30 /* execute the SCSI load command */ +#define MTUNLOAD 31 /* execute the SCSI unload command */ +#define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */ +#define MTSETPART 33 /* Change the active tape partition */ +#define MTMKPART 34 /* Format the tape with one or two partitions */ + +/* structure for MTIOCGET - mag tape get status command */ + +struct mtget { + long mt_type; /* type of magtape device + * Cygwin: MT_ISUNKNOWN */ + long mt_resid; /* residual count: (not sure) + * number of bytes ignored, or + * number of files not skipped, or + * number of records not skipped. + * Cygwin: remaining KB. + */ + /* the following registers are device dependent */ + long mt_dsreg; /* status register */ + long mt_gstat; /* generic (device independent) status */ + long mt_erreg; /* error register */ + /* The next two fields are not always used */ + long mt_fileno; /* number of current file on tape */ + long mt_blkno; /* current block number */ + /* The next are Windows NT specific */ + long long mt_capacity; /* Tape capacity in bytes */ + long long mt_remaining; /* Remaining bytes */ + int mt_minblksize; + int mt_maxblksize; + int mt_defblksize; + unsigned long mt_featureslow; + unsigned long mt_featureshigh; +}; + +/* structure for MTIOCPOS - mag tape get position command */ + +struct mtpos { + long mt_blkno; /* current block number */ +}; + + +/* mag tape io control commands */ +#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ +#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ +#define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */ + +/* Generic Mag Tape (device independent) status macros for examining + * mt_gstat -- HP-UX compatible. + * There is room for more generic status bits here, but I don't + * know which of them are reserved. At least three or so should + * be added to make this really useful. + */ +#define GMT_EOF(x) ((x) & 0x80000000) +#define GMT_BOT(x) ((x) & 0x40000000) +#define GMT_EOT(x) ((x) & 0x20000000) +#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ +#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ +#define GMT_WR_PROT(x) ((x) & 0x04000000) +/* #define GMT_ ? ((x) & 0x02000000) */ +#define GMT_ONLINE(x) ((x) & 0x01000000) +#define GMT_D_6250(x) ((x) & 0x00800000) +#define GMT_D_1600(x) ((x) & 0x00400000) +#define GMT_D_800(x) ((x) & 0x00200000) +#define GMT_PADDING(x) ((x) & 0x00100000) /* data padding */ +#define GMT_HW_ECC(x) ((x) & 0x00080000) /* HW error correction */ +#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */ +#define GMT_HW_COMP(x) ((x) & 0x00020000) /* HW compression */ +#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */ +/* 16 generic status bits unused */ + + +/* SCSI-tape specific definitions */ +/* Bitfield shifts in the status mt_dsreg */ +#define MT_ST_BLKSIZE_SHIFT 0 +#define MT_ST_BLKSIZE_MASK 0xffffff +#define MT_ST_DENSITY_SHIFT 24 +#define MT_ST_DENSITY_MASK 0xff000000 + +#define MT_ST_SOFTERR_SHIFT 0 +#define MT_ST_SOFTERR_MASK 0xffff + +/* + * Constants for mt_type. Not all of these are supported, + * and these are not all of the ones that are supported. + */ +#define MT_ISUNKNOWN 0x01 +#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer */ +#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02 */ +#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02? */ +#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?) */ +#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24 */ +#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02 */ +#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L */ +#define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L */ +#define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller */ +#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features */ +#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24 */ +#define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type) */ +#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */ +#define MT_ISDDS1 0x51 /* DDS device without partitions */ +#define MT_ISDDS2 0x52 /* DDS device with partitions */ +#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */ +#define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */ + +struct mt_tape_info { + long t_type; /* device type id (mt_type) */ + char *t_name; /* descriptive name */ +}; + +#define MT_TAPE_INFO { \ + {MT_ISUNKNOWN, "Unknown type of tape device"}, \ + {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ + {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \ + {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ + {MT_ISCMSJ500, "CMS Jumbo 500"}, \ + {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ + {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ + {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \ + {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ + {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ + {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ + {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ + {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ + {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ + {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ + {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ + {0, NULL} \ +} + +#endif /* _CYGWIN_MTIO_H */ diff --git a/winsup/cygwin/include/cygwin/rdevio.h b/winsup/cygwin/include/cygwin/rdevio.h new file mode 100644 index 000000000..49726fe0e --- /dev/null +++ b/winsup/cygwin/include/cygwin/rdevio.h @@ -0,0 +1,30 @@ +/* + * cygwin/rdevio.h header file for Cygwin. + * + * Written by C. Vinschen. + */ + +#ifndef _CYGWIN_RDEVIO_H +#define _CYGWIN_RDEVIO_H + +/* structure for RDIOCDOP - raw device operation */ +struct rdop { + short rd_op; + unsigned long rd_parm; +}; + +/* Raw device operations */ +#define RDSETBLK 1 /* set buffer for driver */ + +/* structure for RDIOCGET - get raw device */ +struct rdget { + unsigned long bufsiz; +}; + +/* + * ioctl commands +*/ +#define RDIOCDOP _IOW('r', 128, struct rdop) +#define RDIOCGET _IOR('r', 129, struct rdget) + +#endif /* _CYGWIN_RDEVIO_H */ diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h new file mode 100644 index 000000000..fad1efdf0 --- /dev/null +++ b/winsup/cygwin/include/cygwin/socket.h @@ -0,0 +1,152 @@ +#ifndef _CYGWIN_SOCKET_H +#define _CYGWIN_SOCKET_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +struct sockaddr { + unsigned short sa_family; /* address family, AF_xxx */ + char sa_data[14]; /* 14 bytes of protocol address */ +}; + +#include <asm/socket.h> /* arch-dependent defines */ +#include <cygwin/sockios.h> /* the SIOCxxx I/O controls */ +#include <cygwin/uio.h> /* iovec support */ +#include <sys/types.h> + +struct linger { + unsigned short l_onoff; /* Linger active */ + unsigned short l_linger; /* How long to linger for */ +}; + +struct msghdr +{ + void * msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + struct iovec * msg_iov; /* Data blocks */ + int msg_iovlen; /* Number of blocks */ + void * msg_accrights; /* Per protocol magic (eg BSD file descriptor passing) */ + int msg_accrightslen; /* Length of rights list */ +}; + +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* CYGWIN specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ + +/* Supported address families. */ +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_LOCAL 1 /* POSIX name for AF_UNIX */ +#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 /* OSI is ISO */ +#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 /* Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* AppleTalk */ +#define AF_NETBIOS 17 /* NetBios-style addresses */ + +#define AF_MAX 18 +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_LOCAL AF_LOCAL +#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_OSI +#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_NETBIOS AF_NETBIOS + +#define PF_MAX AF_MAX + +/* Maximum queue length specificable by listen. */ +#define SOMAXCONN 5 + +/* Flags we can use with send/ and recv. */ +#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 */ + +/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ +#define SOL_IP 0 +#define SOL_IPX 256 +#define SOL_AX25 257 +#define SOL_ATALK 258 +#define SOL_NETROM 259 +#define SOL_TCP 6 +#define SOL_UDP 17 + +/* IP options */ +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 + +/* These need to appear somewhere around here */ +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +/* IP options for use with WinSock */ + +#define IP_OPTIONS 1 +#define IP_MULTICAST_IF 2 +#define IP_MULTICAST_TTL 3 +#define IP_MULTICAST_LOOP 4 +#define IP_ADD_MEMBERSHIP 5 +#define IP_DROP_MEMBERSHIP 6 +#define IP_TTL 7 +#define IP_TOS 8 +#define IP_DONTFRAGMENT 9 + +/* IPX options */ +#define IPX_TYPE 1 + +/* TCP options - this way around because someone left a set in the c library includes */ +#define TCP_NODELAY 0x0001 +#define TCP_MAXSEG 2 + +/* The various priorities. */ +#define SOPRI_INTERACTIVE 0 +#define SOPRI_NORMAL 1 +#define SOPRI_BACKGROUND 2 + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#endif /* _CYGWIN_SOCKET_H */ diff --git a/winsup/cygwin/include/cygwin/sockios.h b/winsup/cygwin/include/cygwin/sockios.h new file mode 100644 index 000000000..2e756954e --- /dev/null +++ b/winsup/cygwin/include/cygwin/sockios.h @@ -0,0 +1 @@ +/* sockios.h */ diff --git a/winsup/cygwin/include/cygwin/types.h b/winsup/cygwin/include/cygwin/types.h new file mode 100644 index 000000000..51e349710 --- /dev/null +++ b/winsup/cygwin/include/cygwin/types.h @@ -0,0 +1 @@ +/* types.h */ diff --git a/winsup/cygwin/include/cygwin/uio.h b/winsup/cygwin/include/cygwin/uio.h new file mode 100644 index 000000000..18c77ae65 --- /dev/null +++ b/winsup/cygwin/include/cygwin/uio.h @@ -0,0 +1 @@ +/* uio.h */ diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h new file mode 100644 index 000000000..eea5d9b91 --- /dev/null +++ b/winsup/cygwin/include/cygwin/version.h @@ -0,0 +1,159 @@ +/* version.h -- Cygwin version numbers and accompanying documentation. + + Copyright 1996, 1997, 1998, 1999 Cygnus Solutions. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +/* Cygwin versioning is relatively complicated because of its status + as a shared library. Let's start with how versioning used to be done. + + Historical versioning in Cygwin 16.0 to 19.5: + + In the olden days of Cygwin, we had a dll major and minor version + and a registry version. The major number started at 16 because the + "b15" GNU-Win32 release of the compiler tools was out when this + scheme was started. We incremented the DLL name frequently (for + every official release) and towards the end of this period every + release used a different shared memory area to prevent DLLs from + interfering with each other (embedding a build timestamp into the + name of the shared memory area). This turned out to be a Bad Idea + (tm) because people needed to mingle separate releases and have + them work together more than we thought they would. This was + especially problematic when tty info needed to be retained when an + old Cygwin executable executed a newer one. + + In the old scheme, we incremented the major number whenever a + change to the dll invalidated existing executables. This can + happen for a number of reasons, including when functions are + removed from the export list of the dll. The minor number was + incremented when a change was made that we wanted to record, but + that didn't invalidate existing executables. Both numbers were + recorded in the executable and in the dll. + + In October 1998 (starting with Cygwin 19.6), we started a new + means of Cygwin versioning: */ + + /* The DLL major and minor numbers correspond to the "version of + the Cygwin library". This version is used to track important + changes to the DLL and is mainly informative in nature. */ + + /* The current cygwin version is 1.1.0 */ + +#define CYGWIN_VERSION_DLL_MAJOR 1001 +#define CYGWIN_VERSION_DLL_MINOR 0 + + /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are + incompatible. */ + +#define CYGWIN_VERSION_DLL_EPOCH 19 + + /* CYGWIN_VERSION_DLL_COMBINED gives us a single number + representing the combined DLL major and minor numbers. */ + +#define CYGWIN_VERSION_DLL_MAKE_COMBINED(maj, min) (((maj) * 1000) + min) +#define CYGWIN_VERSION_DLL_COMBINED \ + CYGWIN_VERSION_DLL_MAKE_COMBINED (CYGWIN_DLL_VERSION_MAJOR, CYGWIN_DLL_VERSION_MINOR) + + /* Every version of cygwin <= this uses an old, incorrect method + to determine signal masks. */ + +#define CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK 19005 + + /* API versions <= this had a termios structure whose members were + too small to accomodate modern settings. */ +#define CYGWIN_VERSION_DLL_OLD_TERMIOS 00005 +#define CYGWIN_VERSION_DLL_IS_OLD_TERMIOS \ + (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \ + CYGWIN_VERSION_DLL_OLD_TERMIOS) + + /* We used to use the DLL major/minor to track + non-backward-compatible interface changes to the API. Now we + use an API major/minor number for this purpose. */ + + /* API_MAJOR 0.0: Initial version. API_MINOR changes: + 1: Export cygwin32_ calls as cygwin_ as well. + 2: Export j1, jn, y1, yn. + 3: Export dll_noncygwin_dllcrt0. + 4: New socket ioctls, revamped ifconf support. + 5: Thread support/exports. + 6: Change in termios handling. + 7: Export scandir and alphasort. + 8: Export _ctype_, _sys_errlist, _sys_nerr. + 9: Mount-related changes, new cygwin_umount export. + Raw device support (tape, floppies). + 10: Fast math routine support added. + 11: Export seekdir, telldir. + 12: Export pthread_join, pthread_detach. + 13: Export math funcs gamma and friends, also _j0, _j1, etc. + 14: Export snprintf and vnsprintf. + 15: Export glob + 16: Export cygwin_stackdump + */ + +#define CYGWIN_VERSION_API_MAJOR 0 +#define CYGWIN_VERSION_API_MINOR 16 + + /* There is also a compatibity version number associated with the + shared memory regions. It is incremented when incompatible + changes are made to the shared memory region *or* to any named + shared mutexes, semaphores, etc. The arbitrary starting + version was 0 (cygwin release 98r2). */ + +#define CYGWIN_VERSION_SHARED_DATA 3 + + /* An identifier used in the names used to create shared objects. + The full names include the CYGWIN_VERSION_SHARED_DATA version + as well as this identifier. */ + +#define CYGWIN_VERSION_DLL_IDENTIFIER "cygwin1" + + /* The Cygwin mount table interface in the Win32 registry also + has a version number associated with it in case that is + changed in a non-backwards compatible fashion. Increment this + version number whenever incompatible changes in mount table + registry usage are made. + + 1: Original number version. + 2: New mount registry layout, system-wide mount accessibility. + */ + +#define CYGWIN_VERSION_MOUNT_REGISTRY 2 + + /* Identifiers used in the Win32 registry. */ + +#define CYGWIN_INFO_CYGNUS_REGISTRY_NAME "Cygnus Solutions" +#define CYGWIN_INFO_CYGWIN_REGISTRY_NAME "Cygwin" +#define CYGWIN_INFO_PROGRAM_OPTIONS_NAME "Program Options" +#define CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME "mounts v2" + + /* In addition to the above version number strings, the build + process adds some strings that may be useful in + debugging/identifying a particular Cygwin DLL: + + The mkvers.sh script at the top level produces a .cc file + which initializes a cygwin_version structure based on the + above version information and creates a string table for + grepping via "fgrep '%%%' cygwinwhatever.dll" if you are + using GNU grep. Otherwise you may want to do a + "strings cygwinwhatever.dll | fgrep '%%%'" instead. + + This will produce output such as: + + %%% Cygwin dll_identifier: cygwin + %%% Cygwin api_major: 0 + %%% Cygwin api_minor: 0 + %%% Cygwin dll_major: 19 + %%% Cygwin dll_minor: 6 + %%% Cygwin shared_data: 1 + %%% Cygwin registry: b15 + %%% Cygwin build date: Wed Oct 14 16:26:51 EDT 1998 + %%% Cygwin shared id: cygwinS1 + + This information can also be obtained through a call to + cygwin_internal (CW_GETVERSIONINFO). + */ + diff --git a/winsup/cygwin/include/dlfcn.h b/winsup/cygwin/include/dlfcn.h new file mode 100644 index 000000000..753da0277 --- /dev/null +++ b/winsup/cygwin/include/dlfcn.h @@ -0,0 +1,41 @@ +/* dlfcn.h + + Copyright 1998 Cygnus Solutions + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _DLFCN_H +#define _DLFCN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* declarations used for dynamic linking support routines */ +extern void *dlopen (const char *, int); +extern void *dlsym (void *, const char *); +extern int dlclose (void *); +extern char *dlerror (void); + +/* specific to CYGWIN */ +#define FORK_RELOAD 1 +#define FORK_NO_RELOAD 0 + +extern void dlfork (int); + +/* following doesn't exist in Win32 API .... */ + +/* valid values for mode argument to dlopen */ +#define RTLD_LAZY 1 /* lazy function call binding */ +#define RTLD_NOW 2 /* immediate function call binding */ +#define RTLD_GLOBAL 4 /* symbols in this dlopen'ed obj are visible to other dlopen'ed objs */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DLFCN_H */ diff --git a/winsup/cygwin/include/exceptions.h b/winsup/cygwin/include/exceptions.h new file mode 100644 index 000000000..44528bb25 --- /dev/null +++ b/winsup/cygwin/include/exceptions.h @@ -0,0 +1,120 @@ +/* exceptions.h + + Copyright 1996, 1997, 1998 Cygnus Solutions. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _EXCEPTIONS_H +#define _EXCEPTIONS_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Documentation on the innards of exception handling (i.e. from the + perspective of a compiler implementor) apparently doesn't exist. Sigh. + However, the following came from Onno Hovers <onno@stack.urc.tue.nl> + +The first pointer to the chain of handlers is in the thread environment block +at FS:[0]. This chain has the following format: + +typedef struct __EXCEPTION_FRAME +{ + struct __EXCEPTION_FRAME *Prev; /-* pointer to the previous frame *-/ + PEXCEPTION_HANDLER Handler; /-* handler function *-/ +} + +You register an exception handler in your compiler with this simple ASM +sequence: + PUSH _MyExceptionHandler + PUSH FS:[0] + MOV FS:[0],ESP +An exception frame MUST be on the stack! The frame may have more fields and +both Visual C++ and Borland C++ use more fields for themselves. + +When an exception occurs the system calls all handlers starting with the +handler at FS:0, and then the previous etc. until one handler returns +ExceptionContinueExecution, which is 0. If a handler does not want to handle +the exception it should just return ExceptionContinueSearch, which is 1. + +The handler has the following parameters: +ehandler ( + PEXCEPTION_RECORD erecord, + PEXCEPTION_FRAME myframe, + PCONTEXT context, /-* context before and after *-/ + PVOID dispatch ) /-* something *-/ + +When a handler wants to handle the exception, it has some alternatives: + +-one is to do do something about the exception condition, like emulating +an invalid instruction, mapping memory where there was a page fault, etc. +If the handler wants to have the context of the thread that causes the +exception changed, it should make that change in the context passed to the +handler. + +-the second alternative is to call all exception handlers again, indicating +that you want them to clean up. This way all the __finally blocks get +executed. After doing that you change the context passed to the handler so +the code starts executing in the except block. For this purpose you could +call RtlUnwind. This (undocumented) function calls all exception handlers +up to but not including the exception frame passed to it. If NULL is passed +as exception frame RtlUnwind calls all exception handlers and then exits the +process. The parameters to RtlUnwind are: + +RtlUnwind ( + PEXCEPTION_FRAME endframe, + PVOID unusedEip, + PEXCEPTION_RECORD erecord, + DWORD returnEax) + +You should set unusedEip to the address where RtlUnwind should return like +this: + PUSH 0 + PUSH OFFSET ReturnUnwind + PUSH 0 + PUSH 0 + CALL RtlUnwind +ReturnUnwind: + ..... + +If no EXCEPTION_RECORD is passed, RtlUnwind makes a default exception +record. In any case, the ExceptionFlags part of this record has the +EH_UNWINDING (=2), flag set. (and EH_EXIT_UNWIND (=4), when NULL is passed as the end +frame.). + +The handler for a exception as well as a for unwinds may be executed in the +thread causing the exception, but may also be executed in another (special +exception) thread. So it is not wise to make any assumptions about that! + +As an alternative you may consider the SetUnhandledExceptionFilter API +to install your own exception filter. This one is documented. +*/ + +/* The January 1994 MSJ has an article entitled "Clearer, More Comprehensive + Error Processing with Win32 Structured Exception Handling". It goes into + a teensy bit of detail of the innards of exception handling (i.e. what we + have to do). */ + +typedef int (exception_handler) + (EXCEPTION_RECORD *, void *, CONTEXT *, void *); + +typedef struct _exception_list +{ + struct _exception_list *prev; + exception_handler *handler; + + /* We're apparently free to add more stuff here. + At present we don't need any. */ +} exception_list; + +void init_exceptions (exception_list *); + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#endif /* _EXCEPTIONS_H */ diff --git a/winsup/cygwin/include/fcntl.h b/winsup/cygwin/include/fcntl.h new file mode 100644 index 000000000..90cfab0d4 --- /dev/null +++ b/winsup/cygwin/include/fcntl.h @@ -0,0 +1,7 @@ +#ifndef _FCNTL_H +#define _FCNTL_H + +#include <sys/fcntl.h> +#define O_NDELAY _FNDELAY + +#endif /* _FCNTL_H */ diff --git a/winsup/cygwin/include/features.h b/winsup/cygwin/include/features.h new file mode 100644 index 000000000..206902f7d --- /dev/null +++ b/winsup/cygwin/include/features.h @@ -0,0 +1 @@ +/* features.h */ diff --git a/winsup/cygwin/include/getopt.h b/winsup/cygwin/include/getopt.h new file mode 100644 index 000000000..851ac67e2 --- /dev/null +++ b/winsup/cygwin/include/getopt.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1987, 1993, 1994, 1996 + * 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. + */ + +#ifndef __GETOPT_H__ +#define __GETOPT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +struct option { + char * name; + int has_arg; + int * flag; + int val; +}; + +extern int opterr; /* if error message should be printed */ +extern int optind; /* index into parent argv vector */ +extern int optopt; /* character checked for validity */ +extern int optreset; /* reset getopt */ +extern char *optarg; /* argument associated with option */ + +int getopt (int, char * const *, const char *); + +int getopt_long (int, char **, char *, struct option *, int *); + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#ifdef __cplusplus +} +#endif + +#endif /* __GETOPT_H__ */ diff --git a/winsup/cygwin/include/glob.h b/winsup/cygwin/include/glob.h new file mode 100644 index 000000000..3fdf3e8ae --- /dev/null +++ b/winsup/cygwin/include/glob.h @@ -0,0 +1,111 @@ +/* $NetBSD: glob.h,v 1.6.2.2 1997/11/04 23:38:33 thorpej Exp $ */ + +/* + * 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_ + +/* CYGNUS LOCAL: end */ + +#include <sys/cdefs.h> +#include <sys/types.h> +#include <sys/stat.h> + +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 *)); +#ifdef __LIBC12_SOURCE__ + int (*gl_lstat) __P((const char *, struct stat12 *)); + int (*gl_stat) __P((const char *, struct stat12 *)); +#else + int (*gl_lstat) __P((const char *, struct stat *)); + int (*gl_stat) __P((const char *, struct stat *)); +#endif +} 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 +/* CYGNUS LOCAL: normal protos */ + +#undef DLLEXPORT +#ifdef __INSIDE_CYGWIN__ +# define DLLEXPORT +#else +# define DLLEXPORT __declspec(dllimport) +#endif +int DLLEXPORT glob(const char *, int, int (*)(const char *, int), glob_t *); +void DLLEXPORT globfree(glob_t *); + +#undef DLLEXPORT +/* end CYGNUS LOCAL */ +__END_DECLS + +#endif /* !_GLOB_H_ */ diff --git a/winsup/cygwin/include/icmp.h b/winsup/cygwin/include/icmp.h new file mode 100644 index 000000000..7e7aedccd --- /dev/null +++ b/winsup/cygwin/include/icmp.h @@ -0,0 +1 @@ +/* icmp.h */ diff --git a/winsup/cygwin/include/io.h b/winsup/cygwin/include/io.h new file mode 100644 index 000000000..e757816b3 --- /dev/null +++ b/winsup/cygwin/include/io.h @@ -0,0 +1,28 @@ +/* io.h + + Copyright 1999, 2000 Cygnus Solutions. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _IO_H_ +#define _IO_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Function to return a Win32 HANDLE from a fd. + */ +extern long get_osfhandle(int); +extern int setmode (int __fd, int __mode); + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#endif /* _IO_H_ */ diff --git a/winsup/cygwin/include/lastlog.h b/winsup/cygwin/include/lastlog.h new file mode 100644 index 000000000..4a5a8f87f --- /dev/null +++ b/winsup/cygwin/include/lastlog.h @@ -0,0 +1,12 @@ +#ifndef _LASTLOG_H +#define _LASTLOG_H + +#include <utmp.h> + +struct lastlog { + long ll_time; + char ll_line[UT_LINESIZE]; + char ll_host[UT_HOSTSIZE]; +}; + +#endif diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h new file mode 100644 index 000000000..397ba2030 --- /dev/null +++ b/winsup/cygwin/include/limits.h @@ -0,0 +1,144 @@ +/* limits.h + + Copyright 1999, 2000 Cygnus Solutions. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _LIMITS_H___ +#ifndef _MACH_MACHLIMITS_H_ + +/* _MACH_MACHLIMITS_H_ is used on OSF/1. */ +#define _LIMITS_H___ +#define _MACH_MACHLIMITS_H_ + +/* Number of bits in a `char'. */ +#undef CHAR_BIT +#define CHAR_BIT 8 + +/* Maximum length of a multibyte character. */ +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 1 +#endif + +/* Minimum and maximum values a `signed char' can hold. */ +#undef SCHAR_MIN +#define SCHAR_MIN (-128) +#undef SCHAR_MAX +#define SCHAR_MAX 127 + +/* Maximum value an `unsigned char' can hold. (Minimum is 0). */ +#undef UCHAR_MAX +#define UCHAR_MAX 255 + +/* Minimum and maximum values a `char' can hold. */ +#ifdef __CHAR_UNSIGNED__ +#undef CHAR_MIN +#define CHAR_MIN 0 +#undef CHAR_MAX +#define CHAR_MAX 255 +#else +#undef CHAR_MIN +#define CHAR_MIN (-128) +#undef CHAR_MAX +#define CHAR_MAX 127 +#endif + +/* Minimum and maximum values a `signed short int' can hold. */ +#undef SHRT_MIN +#define SHRT_MIN (-32768) +#undef SHRT_MAX +#define SHRT_MAX 32767 + +/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ +#undef USHRT_MAX +#define USHRT_MAX 65535 + +/* Minimum and maximum values a `signed int' can hold. */ +#ifndef __INT_MAX__ +#define __INT_MAX__ 2147483647 +#endif +#undef INT_MIN +#define INT_MIN (-INT_MAX-1) +#undef INT_MAX +#define INT_MAX __INT_MAX__ + +/* Maximum value an `unsigned int' can hold. (Minimum is 0). */ +#undef UINT_MAX +#define UINT_MAX (INT_MAX * 2U + 1) + +/* Minimum and maximum values a `signed long int' can hold. + (Same as `int'). */ +#ifndef __LONG_MAX__ +#ifndef __alpha__ +#define __LONG_MAX__ 2147483647L +#else +#define __LONG_MAX__ 9223372036854775807L +# endif /* __alpha__ */ +#endif +#undef LONG_MIN +#define LONG_MIN (-LONG_MAX-1) +#undef LONG_MAX +#define LONG_MAX __LONG_MAX__ + +/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ +#undef ULONG_MAX +#define ULONG_MAX (LONG_MAX * 2UL + 1) + +#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__) +/* Minimum and maximum values a `signed long long int' can hold. */ +#ifndef __LONG_LONG_MAX__ +#define __LONG_LONG_MAX__ 9223372036854775807LL +#endif +#undef LONG_LONG_MIN +#define LONG_LONG_MIN (-LONG_LONG_MAX-1) +#undef LONG_LONG_MAX +#define LONG_LONG_MAX __LONG_LONG_MAX__ + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ +#undef ULONG_LONG_MAX +#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1) +#endif + +/* Maximum number of iovcnt in a writev */ +#undef IOV_MAX +#define IOV_MAX (__INT_MAX__-1) + +/* Maximum size of ssize_t */ +#undef SSIZE_MAX +#define SSIZE_MAX (__LONG_MAX__) + +/* Maximum length of a path */ +#define PATH_MAX (260 - 1 /*NUL*/) + +/* Max num groups for a user, value taken from NT documentation */ +/* Must match <sys/param.h> NGROUPS */ +#define NGROUPS_MAX 16 + +/* WaitForMultipleObjects can't handle waiting for more than 64 objects. + This limits how many children we can fork/spawn off. */ +#define CHILD_MAX 63 + +/* POSIX values */ +/* These should never vary from one system type to another */ +/* They represent the minimum values that POSIX systems must support. + POSIX-conforming apps must not require larger values. */ +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 6 +#define _POSIX_LINK_MAX 8 +#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 + +#endif /* _MACH_MACHLIMITS_H_ */ +#endif /* _LIMITS_H___ */ diff --git a/winsup/cygwin/include/mapi.h b/winsup/cygwin/include/mapi.h new file mode 100644 index 000000000..5e1769f1d --- /dev/null +++ b/winsup/cygwin/include/mapi.h @@ -0,0 +1,102 @@ +/* mapi.h + + Copyright 1997, 1998 Cygnus Solutions. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _MAPI_H +#define _MAPI_H + +/* Currently this doesn't include all the definitions. It does cover + the parts of Simple MAPI required to send mail. */ + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* FIXME: should this be elsewhere? */ +typedef unsigned long FLAGS; + + /* FIXME: should this be elsewhere? */ +#define SUCCESS_SUCCESS 0 + + /* FIXME: should this be elsewhere? */ +typedef unsigned long LHANDLE, FAR *LPLHANDLE; + + +#define MAPI_E_AMBIGUOUS_RECIPIENT 0x15 +#define MAPI_E_ATTACHMENT_NOT_FOUND 0xb +#define MAPI_E_ATTACHMENT_OPEN_FAILURE 0xc +#define MAPI_E_BAD_RECIPTYPE 0xf +#define MAPI_E_FAILURE 0x2 +#define MAPI_E_INSUFFICIENT_MEMORY 0x5 +#define MAPI_E_INVALID_RECIPS 0x19 +#define MAPI_E_LOGIN_FAILURE 0x3 +#define MAPI_E_TEXT_TOO_LARGE 0x12 +#define MAPI_E_TOO_MANY_FILES 0x9 +#define MAPI_E_TOO_MANY_RECIPIENTS 0xa +#define MAPI_E_UNKNOWN_RECIPIENT 0xe +#define MAPI_E_USER_ABORT 0x1 +#define MAPI_E_TEXT_TOO_LARGE 0x12 +#define MAPI_DIALOG 0x8 +#define MAPI_NEW_SESSION 0x2 +#define MAPI_LOGON_UI 0x1 +#define MAPI_RECEIPT_REQUESTED 0x2 +#define MAPI_SENT 0x4 +#define MAPI_UNREAD 0x1 +#define MAPI_OLE 0x1 +#define MAPI_OLE_STATIC 0x2 + +#define MAPI_ORIG 0 +#define MAPI_TO 1 +#define MAPI_CC 2 +#define MAPI_BCC 3 + +typedef struct +{ + ULONG ulReserved; + ULONG flFlags; + ULONG nPosition; + LPTSTR lpszPathName; + LPTSTR lpszFileName; + LPVOID lpFileType; +} MapiFileDesc, FAR *lpMapiFileDesc; + +typedef struct +{ + ULONG ulReserved; + ULONG ulRecipClass; + LPTSTR lpszName; + LPTSTR lpszAddress; + ULONG ulEIDSize; + LPVOID lpEntryID; +} MapiRecipDesc, FAR *lpMapiRecipDesc; + +typedef struct +{ + ULONG ulReserved; + LPTSTR lpszSubject; + LPTSTR lpszNoteText; + LPTSTR lpszMessageType; + LPTSTR lpszDateReceived; + LPTSTR lpszConversationID; + FLAGS flFlags; + lpMapiRecipDesc lpOriginator; + ULONG nRecipCount; + lpMapiRecipDesc lpRecips; + ULONG nFileCount; + lpMapiFileDesc lpFiles; +} MapiMessage, FAR *lpMapiMessage; + +ULONG FAR PASCAL MAPISendMail (LHANDLE, ULONG, lpMapiMessage, FLAGS, ULONG); + +#ifdef __cplusplus +} +#endif + +#endif /* _MAPI_H */ diff --git a/winsup/cygwin/include/memory.h b/winsup/cygwin/include/memory.h new file mode 100644 index 000000000..dd2bd6cbf --- /dev/null +++ b/winsup/cygwin/include/memory.h @@ -0,0 +1,7 @@ +#ifndef _MEMORY_H +#define _MEMORY_H + +/* This allows more things to compile. */ +#include <string.h> + +#endif /* _MEMORY_H */ diff --git a/winsup/cygwin/include/mntent.h b/winsup/cygwin/include/mntent.h new file mode 100644 index 000000000..0f0580a8e --- /dev/null +++ b/winsup/cygwin/include/mntent.h @@ -0,0 +1,35 @@ +#ifndef _MNTENT_H +#define _MNTENT_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct mntent +{ + char *mnt_fsname; + char *mnt_dir; + char *mnt_type; + char *mnt_opts; + int mnt_freq; + int mnt_passno; +}; + +FILE *setmntent (const char *__filep, const char *__type); +struct mntent *getmntent (FILE *__filep); +int addmntent (FILE *__filep, const struct mntent *__mnt); +int endmntent (FILE *__filep); +char *hasmntopt (const struct mntent *__mnt, const char *__opt); + +/* This next file doesn't exist, it is in the registry, + however applications need the define to pass to + the above calls. +*/ +#ifndef MOUNTED +#define MOUNTED "/etc/mtab" +#endif +#ifdef __cplusplus +}; +#endif + +#endif /* _MNTENT_H */ diff --git a/winsup/cygwin/include/net/if.h b/winsup/cygwin/include/net/if.h new file mode 100644 index 000000000..b7df5264e --- /dev/null +++ b/winsup/cygwin/include/net/if.h @@ -0,0 +1,6 @@ +#ifndef _NET_IF_H +#define _NET_IF_H + +#include <cygwin/if.h> + +#endif /* _NET_IF_H */ diff --git a/winsup/cygwin/include/netdb.h b/winsup/cygwin/include/netdb.h new file mode 100644 index 000000000..d1acc5e0a --- /dev/null +++ b/winsup/cygwin/include/netdb.h @@ -0,0 +1,167 @@ +/* Original linux netdb.h merged with winsock.h types */ + +/*- + * 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 + * netdb.h,v 1.1.1.1 1995/02/18 05:34:07 hjl 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_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 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). + */ + + /* Different from the linux versions - note the shorts.. */ +struct hostent { + const char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + short h_addrtype; /* host address type */ + short 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 */ + short n_addrtype; /* net address type */ + unsigned long n_net; /* network # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + short s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +struct protoent +{ + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + short p_proto; /* protocol # */ +}; + +struct rpcent { + char *r_name; /* name of server for this rpc program */ + char **r_aliases; /* alias list */ + int r_number; /* rpc program number */ +}; + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (left in extern int h_errno). + */ + +#ifdef __INSIDE_CYGWIN_NET__ +extern int h_errno; +#else +extern __declspec(dllimport) int h_errno; +#endif + +#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 __INSIDE_CYGWIN_NET__ +void endhostent (void); +void endnetent (void); +void endprotoent (void); +void endservent (void); +void endrpcent (void); +struct hostent *gethostbyaddr (const char *, int, int); +struct hostent *gethostbyname (const char *); +struct hostent *gethostent (void); +struct netent *getnetbyaddr (long, int); /* u_long? */ +struct netent *getnetbyname (const char *); +struct netent *getnetent (void); +struct protoent *getprotobyname (const char *); +struct protoent *getprotobynumber (int); +struct protoent *getprotoent (void); +struct servent *getservbyname (const char *, const char *); +struct servent *getservbyport (int, const char *); +struct servent *getservent (void); +struct rpcent *getrpcent (void); +struct rpcent *getrpcbyname (const char *); +struct rpcent *getrpcbynumber (int); +void herror (const char *); +void sethostent (int); +void setnetent (int); +void setprotoent (int); +void setservent (int); +void setrpcent (int); +#endif + +#ifdef __cplusplus +}; +#endif + +#endif /* !_NETDB_H_ */ + diff --git a/winsup/cygwin/include/netinet/in.h b/winsup/cygwin/include/netinet/in.h new file mode 100644 index 000000000..8536f551e --- /dev/null +++ b/winsup/cygwin/include/netinet/in.h @@ -0,0 +1,6 @@ +#ifndef _NETINET_IN_H +#define _NETINET_IN_H + +#include <cygwin/in.h> + +#endif /* _NETINET_IN_H */ diff --git a/winsup/cygwin/include/netinet/ip.h b/winsup/cygwin/include/netinet/ip.h new file mode 100644 index 000000000..f50d7da2b --- /dev/null +++ b/winsup/cygwin/include/netinet/ip.h @@ -0,0 +1,6 @@ +#ifndef _NETINET_IP_H +#define _NETINET_IP_H + +#include <cygwin/ip.h> + +#endif /* _NETINET_IP_H */ diff --git a/winsup/cygwin/include/netinet/ip_icmp.h b/winsup/cygwin/include/netinet/ip_icmp.h new file mode 100644 index 000000000..547a03a85 --- /dev/null +++ b/winsup/cygwin/include/netinet/ip_icmp.h @@ -0,0 +1,6 @@ +#ifndef _NETINET_IP_ICMP_H +#define _NETINET_IP_ICMP_H + +#include <cygwin/icmp.h> + +#endif /* _NETINET_IP_ICMP_H */ diff --git a/winsup/cygwin/include/paths.h b/winsup/cygwin/include/paths.h new file mode 100644 index 000000000..c4180873f --- /dev/null +++ b/winsup/cygwin/include/paths.h @@ -0,0 +1,9 @@ +#ifndef _PATHS_H_ +#define _PATHS_H_ + +#define _PATH_DEV "/dev/" +#define _PATH_BSHELL "/bin/sh" +#define _PATH_LASTLOG "/var/log/lastlog" +#define _PATH_UTMP "/var/run/utmp" +#define _PATH_WTMP "/var/log/wtmp" +#endif /* _PATHS_H_ */ diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h new file mode 100644 index 000000000..4826e0897 --- /dev/null +++ b/winsup/cygwin/include/pthread.h @@ -0,0 +1,92 @@ +/* pthread.h: POSIX pthread interface + + Copyright 1996, 1997, 1998 Cygnus Solutions. + + Written by Marco Fuykschot <marco@ddi.nl> + + This file is part of Cygwin. + + This software is a copyrighted work licensed under the terms of the + Cygwin license. Please consult the file "CYGWIN_LICENSE" for + details. */ + +#include <sys/types.h> +#include <signal.h> + +#ifndef _PTHREAD_H +#define _PTHREAD_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define TFD(n) void*(*n)(void*) + +typedef int pthread_t; +typedef int pthread_mutex_t; +typedef int sem_t; + +typedef struct pthread_key + { + } +pthread_key_t; + +typedef struct pthread_attr + { + size_t stacksize; + } +pthread_attr_t; + +typedef struct pthread_mutexattr + { + } +pthread_mutexattr_t; + +/* ThreadCreation */ +int pthread_create (pthread_t * thread, const pthread_attr_t * attr, TFD (function), void *arg); +int pthread_attr_init (pthread_attr_t * attr); +int pthread_attr_destroy (pthread_attr_t * attr); +int pthread_attr_setstacksize (pthread_attr_t * attr, size_t size); +int pthread_attr_getstacksize (pthread_attr_t * attr, size_t * size); +/* + pthread_attr_setstackaddr(...); + pthread_attr_getstackaddr(...); +*/ + +/* Thread Exit */ +int pthread_exit (void *value_ptr); + +/* Thread SpecificData */ +int pthread_key_create (pthread_key_t * key); +int pthread_key_delete (pthread_key_t * key); +int pthread_setspecific (pthread_key_t * key, const void *value); +void *pthread_getspecific (pthread_key_t * key); + +/* Thread signal */ +int pthread_kill (pthread_t * thread, int sig); +int pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set); + +/* ID */ +pthread_t pthread_self (); +int pthread_equal (pthread_t t1, pthread_t t2); + +/* Mutexes */ +int pthread_mutex_init (pthread_mutex_t * mutex, const pthread_mutexattr_t *); +int pthread_mutex_lock (pthread_mutex_t * mutext); +int pthread_mutex_trylock (pthread_mutex_t * mutext); +int pthread_mutex_unlock (pthread_mutex_t * mutext); +int pthread_mutex_destroy (pthread_mutex_t * mutext); + +/* Solaris Semaphores */ +int sem_init (sem_t * sem, int pshared, unsigned int value); +int sem_destroy (sem_t * sem); +int sem_wait (sem_t * sem); +int sem_trywait (sem_t * sem); +int sem_post (sem_t * sem); + +#ifdef __cplusplus +} +#endif + +#endif /* _PTHREAD_H */ diff --git a/winsup/cygwin/include/strings.h b/winsup/cygwin/include/strings.h new file mode 100644 index 000000000..e9d2839f2 --- /dev/null +++ b/winsup/cygwin/include/strings.h @@ -0,0 +1,6 @@ +#ifndef _STRINGS_H +#define _STRINGS_H + +#include <string.h> + +#endif /* _STRINGS_H */ diff --git a/winsup/cygwin/include/sys/acl.h b/winsup/cygwin/include/sys/acl.h new file mode 100644 index 000000000..3fbef06da --- /dev/null +++ b/winsup/cygwin/include/sys/acl.h @@ -0,0 +1,17 @@ +/* sys/acl.h header file for Cygwin. + + Copyright 1999, 2000 Cygnus Solutions. + Written by C. Vinschen. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _SYS_ACL_H +#define _SYS_ACL_H + +#include <cygwin/acl.h> + +#endif /* _SYS_ACL_H */ diff --git a/winsup/cygwin/include/sys/cdefs.h b/winsup/cygwin/include/sys/cdefs.h new file mode 100644 index 000000000..bb99f7d0b --- /dev/null +++ b/winsup/cygwin/include/sys/cdefs.h @@ -0,0 +1,12 @@ +#ifndef _SYS_CDEFS_H +#define _SYS_CDEFS_H +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif +#define __P(protos) protos /* full-blown ANSI C */ +#endif + diff --git a/winsup/cygwin/include/sys/copying.dj b/winsup/cygwin/include/sys/copying.dj new file mode 100644 index 000000000..7d048f70d --- /dev/null +++ b/winsup/cygwin/include/sys/copying.dj @@ -0,0 +1,41 @@ +This is the file "copying.dj". It does not apply to any sources +copyrighted by UCB Berkeley or the Free Software Foundation. + + Copyright Information for sources and executables that are marked + Copyright (C) DJ Delorie + 24 Kirsten Ave + Rochester NH 03867-2954 + +This document is Copyright (C) DJ Delorie and may be distributed +verbatim, but changing it is not allowed. + +Source code copyright DJ Delorie is distributed under the terms of the +GNU General Public Licence, with the following exceptions: + +* Any existing copyright or authorship information in any given source +file must remain intact. If you modify a source file, a notice to that +effect must be added to the authorship information in the source file. + +* binaries provided in djgpp may be distributed without sources ONLY if +the recipient is given sufficient information to obtain a copy of djgpp +themselves. This primarily applies to go32.exe, emu387, stub.exe, and +the graphics drivers. + +* modified versions of the binaries provided in djgpp must be +distributed under the terms of the GPL. + +* objects and libraries linked into an application may be distributed +without sources. + +----- + +Changes to source code copyright BSD or FSF are copyright DJ Delorie, but +fall under the terms of the original copyright. + +A copy of the file "COPYING" is included with this document. If you did not +receive a copy of "COPYING", you may obtain one from whence this document +was obtained, or by writing: + Free Software Foundation + 675 Mass Ave + Cambridge, MA 02139 + USA diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h new file mode 100644 index 000000000..3a3dd6e9b --- /dev/null +++ b/winsup/cygwin/include/sys/cygwin.h @@ -0,0 +1,44 @@ +#ifndef _SYS_CYGWIN_H +#define _SYS_CYGWIN_H + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern pid_t cygwin32_winpid_to_pid (int); +extern void cygwin32_win32_to_posix_path_list (const char *, char *); +extern int cygwin32_win32_to_posix_path_list_buf_size (const char *); +extern void cygwin32_posix_to_win32_path_list (const char *, char *); +extern int cygwin32_posix_to_win32_path_list_buf_size (const char *); +extern int cygwin32_conv_to_win32_path (const char *, char *); +extern int cygwin32_conv_to_full_win32_path (const char *, char *); +extern void cygwin32_conv_to_posix_path (const char *, char *); +extern void cygwin32_conv_to_full_posix_path (const char *, char *); +extern int cygwin32_posix_path_list_p (const char *); +extern void cygwin32_split_path (const char *, char *, char *); + +extern pid_t cygwin_winpid_to_pid (int); +extern int cygwin_win32_to_posix_path_list (const char *, char *); +extern int cygwin_win32_to_posix_path_list_buf_size (const char *); +extern int cygwin_posix_to_win32_path_list (const char *, char *); +extern int cygwin_posix_to_win32_path_list_buf_size (const char *); +extern int cygwin_conv_to_win32_path (const char *, char *); +extern int cygwin_conv_to_full_win32_path (const char *, char *); +extern int cygwin_conv_to_posix_path (const char *, char *); +extern int cygwin_conv_to_full_posix_path (const char *, char *); +extern int cygwin_posix_path_list_p (const char *); +extern void cygwin_split_path (const char *, char *, char *); + +#ifdef _GNU_H_WINDOWS32_BASE +/* included if <windows.h> is included */ +extern int cygwin32_attach_handle_to_fd (char *, int, HANDLE, int, int); +extern int cygwin_attach_handle_to_fd (char *, int, HANDLE, mode_t, unsigned); +#endif + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_CYGWIN_H */ diff --git a/winsup/cygwin/include/sys/file.h b/winsup/cygwin/include/sys/file.h new file mode 100644 index 000000000..79f5f65f5 --- /dev/null +++ b/winsup/cygwin/include/sys/file.h @@ -0,0 +1,31 @@ +/* This is file FILE.H */ +/* +** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 +** +** This file is distributed under the terms listed in the document +** "copying.dj", available from DJ Delorie at the address above. +** A copy of "copying.dj" should accompany this file; if not, a copy +** should be available from where this file was obtained. This file +** may not be distributed without a verbatim copy of "copying.dj". +** +** This file is distributed WITHOUT ANY WARRANTY; without even the implied +** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef _FILE_H_ +#define _FILE_H_ + +#include <fcntl.h> + +#define L_SET 0 +#define L_CURR 1 +#define L_INCR 1 +#define L_XTND 2 + + +#define F_OK 0 /* does file exist */ +#define X_OK 1 /* is it executable by caller */ +#define W_OK 2 /* is it writable by caller */ +#define R_OK 4 /* is it readable by caller */ + +#endif diff --git a/winsup/cygwin/include/sys/ioctl.h b/winsup/cygwin/include/sys/ioctl.h new file mode 100644 index 000000000..8164de85e --- /dev/null +++ b/winsup/cygwin/include/sys/ioctl.h @@ -0,0 +1,20 @@ +/* sys/ioctl.h */ + +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + +#include <sys/cdefs.h> + +/* /dev/windows ioctls */ + +#define WINDOWS_POST 0 /* Set write() behavior to PostMessage() */ +#define WINDOWS_SEND 1 /* Set write() behavior to SendMessage() */ +#define WINDOWS_HWND 2 /* Set hWnd for read() calls */ + +__BEGIN_DECLS + +int ioctl (int __fd, int __cmd, void *); + +__END_DECLS + +#endif diff --git a/winsup/cygwin/include/sys/mman.h b/winsup/cygwin/include/sys/mman.h new file mode 100644 index 000000000..9f36bc323 --- /dev/null +++ b/winsup/cygwin/include/sys/mman.h @@ -0,0 +1,40 @@ +#ifndef _SYS_MMAN_H_ +#define _SYS_MMAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <stddef.h> +#include <sys/types.h> + +#define PROT_NONE 0 +#define PROT_READ 1 +#define PROT_WRITE 2 +#define PROT_EXEC 4 + +#define MAP_FILE 0 +#define MAP_SHARED 1 +#define MAP_PRIVATE 2 +#define MAP_TYPE 0xF +#define MAP_FIXED 0x10 +#define MAP_ANONYMOUS 0x20 +#define MAP_ANON MAP_ANONYMOUS + +/* + * Flags for msync. + */ +#define MS_ASYNC 1 +#define MS_SYNC 2 +#define MS_INVALIDATE 4 + +extern caddr_t mmap (caddr_t __addr, size_t __len, int __prot, int __flags, int __fd, off_t __off); +extern int munmap (caddr_t __addr, size_t __len); +extern int mprotect (caddr_t __addr, size_t __len, int __prot); +extern int msync (caddr_t __addr, size_t __len, int __flags); + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#endif /* _SYS_MMAN_H_ */ diff --git a/winsup/cygwin/include/sys/mount.h b/winsup/cygwin/include/sys/mount.h new file mode 100644 index 000000000..2c4ad30a3 --- /dev/null +++ b/winsup/cygwin/include/sys/mount.h @@ -0,0 +1,25 @@ +#ifndef _SYS_MOUNT_H +#define _SYS_MOUNT_H + +#ifdef __cplusplus +extern "C" { +#endif + +enum + { + /* MOUNT_SYMLINK = 1, place holder. Do not use it. */ + MOUNT_BINARY = 2, /* "binary" format read/writes */ + MOUNT_SYSTEM = 8, /* mount point came from system table */ + MOUNT_EXEC = 16, /* Any file in the mounted directory gets 'x' bit */ + MOUNT_AUTO = 32 /* mount point refers to auto device mount */ + }; + +int mount (const char *, const char *, unsigned __flags); +int umount (const char *); +int cygwin_umount (const char *__path, unsigned __flags); + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_MOUNT_H */ diff --git a/winsup/cygwin/include/sys/mtio.h b/winsup/cygwin/include/sys/mtio.h new file mode 100644 index 000000000..e21e4fff5 --- /dev/null +++ b/winsup/cygwin/include/sys/mtio.h @@ -0,0 +1,11 @@ +/* + * sys/mtio.h header file for Cygwin. + * + */ + +#ifndef _SYS_MTIO_H +#define _SYS_MTIO_H + +#include <cygwin/mtio.h> + +#endif /* _SYS_MTIO_H */ diff --git a/winsup/cygwin/include/sys/resource.h b/winsup/cygwin/include/sys/resource.h new file mode 100644 index 000000000..42907bc7b --- /dev/null +++ b/winsup/cygwin/include/sys/resource.h @@ -0,0 +1,40 @@ +#ifndef _SYS_RESOURCE_H_ +#define _SYS_RESOURCE_H_ + +#include <sys/time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define RUSAGE_SELF 0 /* calling process */ +#define RUSAGE_CHILDREN -1 /* terminated child processes */ + +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ + long ru_maxrss; + long ru_ixrss; /* XXX: 0 */ + long ru_idrss; /* XXX: sum of rm_asrss */ + long ru_isrss; /* XXX: 0 */ + long ru_minflt; /* any page faults not requiring I/O */ + long ru_majflt; /* any page faults requiring I/O */ + long ru_nswap; /* swaps */ + long ru_inblock; /* block input operations */ + long ru_oublock; /* block output operations */ + long ru_msgsnd; /* messages sent */ + long ru_msgrcv; /* messages received */ + long ru_nsignals; /* signals received */ + long ru_nvcsw; /* voluntary context switches */ + long ru_nivcsw; /* involuntary " */ +#define ru_last ru_nivcsw +}; + +int getrusage (int __who, struct rusage *__rusage); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/winsup/cygwin/include/sys/select.h b/winsup/cygwin/include/sys/select.h new file mode 100644 index 000000000..d4e811437 --- /dev/null +++ b/winsup/cygwin/include/sys/select.h @@ -0,0 +1,35 @@ +/* select.h + Copyright 1998 Cygnus Solutions. + + Written by Geoffrey Noer <noer@cygnus.com> + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H + +#if !defined (_POSIX_SOURCE) && !defined (__INSIDE_CYGWIN_NET__) + +#include <sys/cdefs.h> + +/* Get fd_set, and macros like FD_SET */ +#include <sys/types.h> + +/* Get definition of timeval. */ +#include <sys/time.h> +#include <time.h> + +__BEGIN_DECLS + +int select __P ((int __n, fd_set *__readfds, fd_set *__writefds, + fd_set *__exceptfds, struct timeval *__timeout)); + +__END_DECLS + +#endif /* !_POSIX_SOURCE, !__INSIDE_CYGWIN_NET__ */ + +#endif /* sys/select.h */ diff --git a/winsup/cygwin/include/sys/smallprint.h b/winsup/cygwin/include/sys/smallprint.h new file mode 100644 index 000000000..617e12a8c --- /dev/null +++ b/winsup/cygwin/include/sys/smallprint.h @@ -0,0 +1,17 @@ +#ifndef _SYS_SMALLPRINT_H +#define _SYS_SMALLPRINT_H + +#include <stdarg.h> + +#ifdef __cplusplus +extern "C" { +#endif + +int __small_sprintf (char *__dst, const char *__fmt, ...); +int __small_vsprintf (char *__dst, const char *__fmt, va_list __ap); + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_SMALLPRINT_H */ diff --git a/winsup/cygwin/include/sys/socket.h b/winsup/cygwin/include/sys/socket.h new file mode 100644 index 000000000..13217a068 --- /dev/null +++ b/winsup/cygwin/include/sys/socket.h @@ -0,0 +1,38 @@ +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H + +#include <features.h> +#include <cygwin/socket.h> +#include <sys/time.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef __INSIDE_CYGWIN_NET__ + int accept (int, struct sockaddr *__peer, int *); + int bind (int, struct sockaddr *__my_addr, int __addrlen); + int connect (int, const struct sockaddr *, int); + int getpeername (int, struct sockaddr *__peer, int *); + int getsockname (int, struct sockaddr *__addr, int *); + int listen (int, int __n); + int recv (int, void *__buff, int __len, unsigned int __flags); + int recvfrom (int, char *__buff, int __len, int __flags, + struct sockaddr *__from, int *__fromlen); + int send (int, const void *__buff, int __len, unsigned int __flags); + int sendto (int, const void *, int, unsigned int, const struct sockaddr *, int); + int setsockopt (int __s, int __level, int __optname, const void *optval, int __optlen); + int getsockopt (int __s, int __level, int __optname, void *__optval, int *__optlen); + int shutdown (int, int); + int socket (int __family, int __type, int __protocol); + int socketpair (int __domain, int __type, int __protocol, int *__socket_vec); + + struct servent *getservbyname (const char *__name, const char *__proto); +#endif + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_SOCKET_H */ diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h new file mode 100644 index 000000000..7ee509983 --- /dev/null +++ b/winsup/cygwin/include/sys/strace.h @@ -0,0 +1,96 @@ +/* sys/strace.h */ + +/* This file contains routines for tracing system calls and other internal + phenomenon. + + When tracing system calls, try to use the same style throughout: + + result = syscall (arg1, arg2, arg3) [optional extra stuff] + + If a system call can block (eg: read, write, wait), print another message + before hanging so the user will know why the program has stopped. + + Note: __seterrno will also print a trace message. Have that printed + *first*. This will make it easy to always know what __seterrno is + refering to. For the same reason, try not to have __seterrno messages + printed alone. +*/ + +#ifndef _SYS_STRACE_H +#define _SYS_STRACE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define _STRACE_INTERFACE_ACTIVATE_ADDR -1 + +/* Bitmasks of tracing messages to print. */ + +#define _STRACE_ALL 0x00001 // so behaviour of strace=1 is unchanged +#define _STRACE_FLUSH 0x00002 // flush output buffer after every message +#define _STRACE_INHERIT 0x00004 // children inherit mask from parent +#define _STRACE_UHOH 0x00008 // unusual or weird phenomenon +#define _STRACE_SYSCALL 0x00010 // system calls +#define _STRACE_STARTUP 0x00020 // argc/envp printout at startup +#define _STRACE_DEBUG 0x00040 // info to help debugging +#define _STRACE_PARANOID 0x00080 // paranoid info +#define _STRACE_TERMIOS 0x00100 // info for debugging termios stuff +#define _STRACE_SELECT 0x00200 // info on ugly select internals +#define _STRACE_WM 0x00400 // trace windows messages (enable _strace_wm) +#define _STRACE_SIGP 0x00800 // trace signal and process handling +#define _STRACE_MINIMAL 0x01000 // very minimal strace output +#define _STRACE_EXITDUMP 0x04000 // dump strace cache on exit +#define _STRACE_CACHE 0x08000 // cache strace messages +#define _STRACE_NOMUTEX 0x10000 // don't use mutex for synchronization +#define _STRACE_MALLOC 0x20000 // trace malloc calls +#define _STRACE_THREAD 0x40000 // thread-locking calls +#define _STRACE_NOTALL 0x80000 // don't include if _STRACE_ALL + +void small_printf (const char *, ...); + +#ifdef NOSTRACE +#define strace_printf(category, fmt...) 0 +#define strace_printf_wrap(category, fmt...) 0 +#define strace_printf_wrap1(category, fmt...) 0 +#define strace_wm(category, msg...) 0 +#else +/* Output message to strace log */ +void strace_printf (unsigned, const char *, ...); +void __system_printf (const char *, ...); + +#define system_printf(fmt, args...) \ + __system_printf("%F: " fmt, __PRETTY_FUNCTION__ , ## args) + +void _strace_wm (int __message, int __word, int __lon); + +#define strace_printf_wrap(what, fmt, args...) \ + ((void) ({\ + if (strace_active) \ + strace_printf(_STRACE_ ## what, "%F: " fmt, __PRETTY_FUNCTION__ , ## args); \ + 0; \ + })) +#define strace_printf_wrap1(what, fmt, args...) \ + ((void) ({\ + if (strace_active) \ + strace_printf((_STRACE_ ## what) | _STRACE_NOTALL, "%F: " fmt, __PRETTY_FUNCTION__ , ## args); \ + 0; \ + })) +#endif /*NOSTRACE*/ + +#define debug_printf(fmt, args...) strace_printf_wrap(DEBUG, fmt , ## args) +#define syscall_printf(fmt, args...) strace_printf_wrap(SYSCALL, fmt , ## args) +#define paranoid_printf(fmt, args...) strace_printf_wrap(PARANOID, fmt , ## args) +#define termios_printf(fmt, args...) strace_printf_wrap(TERMIOS, fmt , ## args) +#define select_printf(fmt, args...) strace_printf_wrap(SELECT, fmt , ## args) +#define wm_printf(fmt, args...) strace_printf_wrap(WM, fmt , ## args) +#define sigproc_printf(fmt, args...) strace_printf_wrap(SIGP, fmt , ## args) +#define minimal_printf(fmt, args...) strace_printf_wrap1(MINIMAL, fmt , ## args) +#define malloc_printf(fmt, args...) strace_printf_wrap1(MALLOC, fmt , ## args) +#define thread_printf(fmt, args...) strace_printf_wrap1(THREAD, fmt , ## args) + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_STRACE_H */ diff --git a/winsup/cygwin/include/sys/syslog.h b/winsup/cygwin/include/sys/syslog.h new file mode 100644 index 000000000..65c6688f2 --- /dev/null +++ b/winsup/cygwin/include/sys/syslog.h @@ -0,0 +1,73 @@ +#ifndef _SYS_LOG_H +#define _SYS_LOG_H + +#include <sys/cdefs.h> +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_PRIMASK 0x07 + +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +#define LOG_KERN (0<<3) +#define LOG_USER (1<<3) +#define LOG_MAIL (2<<3) +#define LOG_DAEMON (3<<3) +#define LOG_AUTH (4<<3) +#define LOG_SYSLOG (5<<3) +#define LOG_LPR (6<<3) +#define LOG_NEWS (7<<3) +#define LOG_UUCP (8<<3) +#define LOG_CRON (9<<3) +#define LOG_AUTHPRIV (10<<3) +#define LOG_FTP (11<<3) + +/* Codes through 15 are reserved for system use */ +#define LOG_LOCAL0 (16<<3) +#define LOG_LOCAL1 (17<<3) +#define LOG_LOCAL2 (18<<3) +#define LOG_LOCAL3 (19<<3) +#define LOG_LOCAL4 (20<<3) +#define LOG_LOCAL5 (21<<3) +#define LOG_LOCAL6 (22<<3) +#define LOG_LOCAL7 (23<<3) + +#define LOG_NFACILITIES 24 +#define LOG_FACMASK 0x03f8 +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) + +#define LOG_MASK(pri) (1 << (pri)) +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) + +/* + * 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 */ + +__BEGIN_DECLS + + +void closelog (void); +void openlog (const char *, int, int); +int setlogmask (int); +void syslog (int, const char *, ...); + +__END_DECLS + + +#endif /* _SYS_LOG_H */ diff --git a/winsup/cygwin/include/sys/sysmacros.h b/winsup/cygwin/include/sys/sysmacros.h new file mode 100644 index 000000000..ecf3a3ae7 --- /dev/null +++ b/winsup/cygwin/include/sys/sysmacros.h @@ -0,0 +1,8 @@ +#ifndef _SYS_SYSMACROS_H +#define _SYS_SYSMACROS_H + +#define major(dev) ((int)(((dev) >> 8) & 0xff)) +#define minor(dev) ((int)((dev) & 0xff)) +#define makedev(major, minor) (((major) << 8) | (minor)) + +#endif /* _SYS_SYSMACROS_H */ diff --git a/winsup/cygwin/include/sys/termio.h b/winsup/cygwin/include/sys/termio.h new file mode 100644 index 000000000..75b815146 --- /dev/null +++ b/winsup/cygwin/include/sys/termio.h @@ -0,0 +1,2 @@ +#include <sys/termios.h> + diff --git a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h new file mode 100644 index 000000000..b0a242a33 --- /dev/null +++ b/winsup/cygwin/include/sys/termios.h @@ -0,0 +1,295 @@ +/* sys/termios.h */ + +#ifndef _SYS_TERMIOS_H +#define _SYS_TERMIOS_H + +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +#define TCGETA 5 +#define TCSETA 6 +#define TCSETAW 7 +#define TCSETAF 8 + +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 +#define TCFLSH 3 + +#define TCSAFLUSH 1 +#define TCSANOW 2 +#define TCSADRAIN 3 +#define TCSADFLUSH 4 + +#define TIOCPKT 6 + +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +#define FIONBIO 0x8004667e /* To be compatible with socket version */ + +#define CTRL(ch) ((ch)&0x1F) + +#define CNUL 0 +#define CDEL 0x0007f +#define CESC '\\' +#define CINTR CTRL('C') +#define CQUIT 0x0001c +#define CERASE CTRL('H') +#define CKILL CTRL('U') +#define CEOT CTRL('D') +#define CEOL 0 +#define CEOL2 0 +#define CEOF CTRL('D') +#define CSTART CTRL('Q') +#define CSTOP CTRL('S') +#define CSWTCH 0x0001a +#define NSWTCH 0 +#define CSUSP CTRL('Z') +#define CDSUSP CTRL('Y') +#define CRPRNT CTRL('R') +#define CFLUSH CTRL('O') +#define CWERASE CTRL('W') +#define CLNEXT CTRL('V') + +/* iflag bits */ +#define IGNBRK 0x00001 +#define BRKINT 0x00002 +#define IGNPAR 0x00004 +#define IMAXBEL 0x00008 +#define INPCK 0x00010 +#define ISTRIP 0x00020 +#define INLCR 0x00040 +#define IGNCR 0x00080 +#define ICRNL 0x00100 +#define IXON 0x00400 +#define IXOFF 0x01000 +#define IUCLC 0x04000 +#define IXANY 0x08000 +#define PARMRK 0x10000 + +/* oflag bits */ + +#define OPOST 0x00001 +#define OLCUC 0x00002 +#define OCRNL 0x00004 +#define ONLCR 0x00008 +#define ONOCR 0x00010 +#define ONLRET 0x00020 +#define OFILL 0x00040 +#define CRDLY 0x00180 +#define CR0 0x00000 +#define CR1 0x00080 +#define CR2 0x00100 +#define CR3 0x00180 +#define NLDLY 0x00200 +#define NL0 0x00000 +#define NL1 0x00200 +#define BSDLY 0x00400 +#define BS0 0x00000 +#define BS1 0x00400 +#define TABDLY 0x01800 +#define TAB0 0x00000 +#define TAB1 0x00800 +#define TAB2 0x01000 +#define TAB3 0x01800 +#define XTABS 0x01800 +#define VTDLY 0x02000 +#define VT0 0x00000 +#define VT1 0x02000 +#define FFDLY 0x04000 +#define FF0 0x00000 +#define FF1 0x04000 +#define OFDEL 0x08000 + +/* cflag bits */ + +/* Baud rate values. These must fit in speed_t, which is unsigned + char. See also the extended baud rates below. These baud rates + set an additional bit. */ +#define CBAUD 0x0100f +#define B0 0x00000 +#define B50 0x00001 +#define B75 0x00002 +#define B110 0x00003 +#define B134 0x00004 +#define B150 0x00005 +#define B200 0x00006 +#define B300 0x00007 +#define B600 0x00008 +#define B1200 0x00009 +#define B1800 0x0000a +#define B2400 0x0000b +#define B4800 0x0000c +#define B9600 0x0000d +#define B19200 0x0000e +#define B38400 0x0000f + +#define CSIZE 0x00030 +#define CS5 0x00000 +#define CS6 0x00010 +#define CS7 0x00020 +#define CS8 0x00030 +#define CSTOPB 0x00040 +#define CREAD 0x00080 +#define PARENB 0x00100 +#define PARODD 0x00200 +#define HUPCL 0x00400 +#define CLOCAL 0x00800 +#define CBAUDEX 0x0100f +#define B57600 0x01001 +#define B115200 0x01002 +#define B128000 0x01003 +#define B256000 0x01003 +#define CRTSXOFF 0x04000 +#define CRTSCTS 0x08000 + +/* lflag bits */ +#define ISIG 0x0001 +#define ICANON 0x0002 +#define ECHO 0x0004 +#define ECHOE 0x0008 +#define ECHOK 0x0010 +#define ECHONL 0x0020 +#define NOFLSH 0x0040 +#define TOSTOP 0x0080 +#define IEXTEN 0x0100 +#define FLUSHO 0x0200 +#define ECHOKE 0x0400 +#define ECHOCTL 0x0800 + +#define VDISCARD 1 +#define VEOL 2 +#define VEOL2 3 +#define VEOF 4 +#define VERASE 5 +#define VINTR 6 +#define VKILL 7 +#define VLNEXT 8 +#define VMIN 9 +#define VQUIT 10 +#define VREPRINT 11 +#define VSTART 12 +#define VSTOP 13 +#define VSUSP 14 +#define VSWTC 15 +#define VTIME 16 +#define VWERASE 17 + +#define NCCS 18 + +typedef unsigned char cc_t; +typedef unsigned int tcflag_t; +typedef unsigned int speed_t; +typedef unsigned short otcflag_t; +typedef unsigned char ospeed_t; + +struct __oldtermios { + otcflag_t c_iflag; + otcflag_t c_oflag; + otcflag_t c_cflag; + otcflag_t c_lflag; + char c_line; + cc_t c_cc[NCCS]; + ospeed_t c_ispeed; + ospeed_t c_ospeed; +}; + +struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + char c_line; + cc_t c_cc[NCCS]; + speed_t c_ispeed; + speed_t c_ospeed; +}; + +#ifdef CYGWIN_VERSION_DLL_IS_OLD_TERMIOS +#ifdef __GNUC__ +# define __tonew_termios(ti) \ + ({ \ + struct termios *__newti; \ + \ + if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \ + __newti = (struct termios *) ti; \ + else \ + { \ + __newti = (struct termios *) alloca(sizeof(struct termios)); \ + __newti->c_iflag = ((struct __oldtermios *)ti)->c_iflag; \ + __newti->c_oflag = ((struct __oldtermios *)ti)->c_oflag; \ + __newti->c_cflag = ((struct __oldtermios *)ti)->c_cflag; \ + __newti->c_lflag = ((struct __oldtermios *)ti)->c_lflag; \ + __newti->c_line = ((struct __oldtermios *)ti)->c_line; \ + __newti->c_ispeed = ((struct __oldtermios *)ti)->c_ispeed; \ + __newti->c_ospeed = ((struct __oldtermios *)ti)->c_ospeed; \ + memcpy (__newti->c_cc, ((struct __oldtermios *)ti)->c_cc, sizeof(__newti->c_cc)); \ + } \ + __newti; \ + }) + +# define __makenew_termios(ti) \ + (CYGWIN_VERSION_DLL_IS_OLD_TERMIOS ? \ + (struct termios *) alloca (sizeof (struct termios)) : (ti)) + +# define __toapp_termios(toti, fromti) \ + ({ \ + if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \ + toti = fromti; \ + else \ + { \ + ((struct __oldtermios *)toti)->c_iflag = fromti->c_iflag; \ + ((struct __oldtermios *)toti)->c_oflag = fromti->c_oflag; \ + ((struct __oldtermios *)toti)->c_cflag = fromti->c_cflag; \ + ((struct __oldtermios *)toti)->c_lflag = fromti->c_lflag; \ + ((struct __oldtermios *)toti)->c_line = fromti->c_line; \ + ((struct __oldtermios *)toti)->c_ispeed = fromti->c_ispeed; \ + ((struct __oldtermios *)toti)->c_ospeed = fromti->c_ospeed; \ + memcpy (((struct __oldtermios*)toti)->c_cc, fromti->c_cc, sizeof(fromti->c_cc)); \ + } \ + toti; \ + }) +#endif /*__GNUC__*/ +#endif + +#define termio termios + +#define cfgetospeed(tp) ((tp)->c_ospeed) +#define cfgetispeed(tp) ((tp)->c_ispeed) +#define cfsetospeed(tp,s) (((tp)->c_ospeed = (s)), 0) +#define cfsetispeed(tp,s) (((tp)->c_ispeed = (s)), 0) + +#ifdef __cplusplus +extern "C" { +#endif + +int tcgetattr (int, struct termios *); +int tcsetattr (int, int, const struct termios *); +int tcsendbreak (int, int); +int tcdrain (int); +int tcflush (int, int); +int tcflow (int, int); + +#ifdef __cplusplus +} +#endif + +/* Extra stuff to make porting stuff easier. */ +struct winsize +{ + unsigned short ws_row, ws_col; + unsigned short ws_xpixel, ws_ypixel; +}; + +#define TIOCGWINSZ (('T' << 8) | 1) +#define TIOCSWINSZ (('T' << 8) | 2) + +#endif /* _SYS_TERMIOS_H */ diff --git a/winsup/cygwin/include/sys/ttychars.h b/winsup/cygwin/include/sys/ttychars.h new file mode 100644 index 000000000..2d313646f --- /dev/null +++ b/winsup/cygwin/include/sys/ttychars.h @@ -0,0 +1 @@ +/* ttychars.h */ diff --git a/winsup/cygwin/include/sys/uio.h b/winsup/cygwin/include/sys/uio.h new file mode 100644 index 000000000..dad9dc17f --- /dev/null +++ b/winsup/cygwin/include/sys/uio.h @@ -0,0 +1,25 @@ +#ifndef _UIO_H_ +#define _UIO_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For size_t */ +#include <stddef.h> +/* For ssize_t */ +#include <sys/types.h> + +/* + * Define the uio buffers used for writev, readv. + */ + +struct iovec { + caddr_t iov_base; + int iov_len; +}; + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ +#endif /* _UIO_H_ */ diff --git a/winsup/cygwin/include/sys/un.h b/winsup/cygwin/include/sys/un.h new file mode 100644 index 000000000..6f49c7b06 --- /dev/null +++ b/winsup/cygwin/include/sys/un.h @@ -0,0 +1,16 @@ +#ifndef _SYS_UN_H +#define _SYS_UN_H + +/* POSIX requires only at least 100 bytes */ +#define UNIX_PATH_LEN 108 + +struct sockaddr_un { + unsigned short sun_family; /* address family AF_LOCAL/AF_UNIX */ + char sun_path[UNIX_PATH_LEN]; /* 108 bytes of socket address */ +}; + +/* Evaluates the actual length of `sockaddr_un' structure. */ +#define SUN_LEN(p) ((size_t)(((struct sockaddr_un *) NULL)->sun_path) \ + + strlen ((p)->sun_path)) + +#endif diff --git a/winsup/cygwin/include/sys/utsname.h b/winsup/cygwin/include/sys/utsname.h new file mode 100644 index 000000000..bbfa9a6d0 --- /dev/null +++ b/winsup/cygwin/include/sys/utsname.h @@ -0,0 +1,23 @@ +#ifndef _SYS_UTSNAME_H +#define _SYS_UTSNAME_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct utsname +{ + char sysname[20]; + char nodename[20]; + char release[20]; + char version[20]; + char machine[20]; +}; + +int uname (struct utsname *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/winsup/cygwin/include/sys/vfs.h b/winsup/cygwin/include/sys/vfs.h new file mode 100644 index 000000000..4d3b0b6e0 --- /dev/null +++ b/winsup/cygwin/include/sys/vfs.h @@ -0,0 +1,28 @@ +#ifndef _SYS_VFS_H_ +#define _SYS_VFS_H_ + +struct statfs { + long f_type; /* type of filesystem (see below) */ + long f_bsize; /* optimal transfer block size */ + long f_blocks; /* total data blocks in file system */ + long f_bfree; /* free blocks in fs */ + long f_bavail; /* free blocks avail to non-superuser */ + long f_files; /* total file nodes in file system */ + long f_ffree; /* free file nodes in fs */ + long f_fsid; /* file system id */ + long f_namelen; /* maximum length of filenames */ + long f_spare[6]; /* spare for later */ +}; + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +int statfs (const char *__path, struct statfs *__buf); +int fstatfs (int __fd, struct statfs *__buf); + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#endif /*_SYS_VFS_H_*/ diff --git a/winsup/cygwin/include/sys/wait.h b/winsup/cygwin/include/sys/wait.h new file mode 100644 index 000000000..a9648eec2 --- /dev/null +++ b/winsup/cygwin/include/sys/wait.h @@ -0,0 +1,63 @@ +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H + +#include <sys/types.h> +#include <sys/resource.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define WNOHANG 1 +#define WUNTRACED 2 + +/* A status looks like: + <2 bytes info> <2 bytes code> + + <code> == 0, child has exited, info is the exit value + <code> == 1..7e, child has exited, info is the signal number. + <code> == 7f, child has stopped, info was the signal number. + <code> == 80, there was a core dump. +*/ + +#define WIFEXITED(w) (((w) & 0xff) == 0) +#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) +#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) +#define WEXITSTATUS(w) (((w) >> 8) & 0xff) +#define WTERMSIG(w) ((w) & 0x7f) +#define WSTOPSIG WEXITSTATUS + +pid_t wait (int *); +pid_t waitpid (pid_t, int *, int); +pid_t wait3 (int *__status, int __options, struct rusage *__rusage); +pid_t wait4 (pid_t __pid, int *__status, int __options, struct rusage *__rusage); + +union wait + { + int w_status; + struct + { + unsigned int __w_termsig:7; /* Terminating signal. */ + unsigned int __w_coredump:1; /* Set if dumped core. */ + unsigned int __w_retcode:8; /* Return code if exited normally. */ + unsigned int:16; + } __wait_terminated; + struct + { + unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ + unsigned int __w_stopsig:8; /* Stopping signal. */ + unsigned int:16; + } __wait_stopped; + }; + +#define w_termsig __wait_terminated.__w_termsig +#define w_coredump __wait_terminated.__w_coredump +#define w_retcode __wait_terminated.__w_retcode +#define w_stopsig __wait_stopped.__w_stopsig +#define w_stopval __wait_stopped.__w_stopval + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/winsup/cygwin/include/syslog.h b/winsup/cygwin/include/syslog.h new file mode 100644 index 000000000..ac2c0dc49 --- /dev/null +++ b/winsup/cygwin/include/syslog.h @@ -0,0 +1,6 @@ +#ifndef _SYSLOG_H +#define _SYSLOG_H + +#include <sys/syslog.h> + +#endif /* _SYSLOG_H */ diff --git a/winsup/cygwin/include/termio.h b/winsup/cygwin/include/termio.h new file mode 100644 index 000000000..8a9b3395f --- /dev/null +++ b/winsup/cygwin/include/termio.h @@ -0,0 +1,6 @@ +#ifndef _TERMIO_H +#define _TERMIO_H + +#include <sys/termio.h> + +#endif diff --git a/winsup/cygwin/include/tzfile.h b/winsup/cygwin/include/tzfile.h new file mode 100644 index 000000000..9cce33cd1 --- /dev/null +++ b/winsup/cygwin/include/tzfile.h @@ -0,0 +1,10 @@ +#ifndef _TZFILE_H +#define _TZFILE_H + +#define SECSPERDAY (60*60*24) +#define DAYSPERNYEAR 365 +#define DAYSPERLYEAR 366 + +#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) +#endif + |