summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-07-06 19:22:49 +0000
committerEric Andersen <andersen@codepoet.org>2000-07-06 19:22:49 +0000
commitffb96c090015f49059d146deefbbd7e1f6baa642 (patch)
tree53229e8793e289f18a7453b144850b6583078c32
parentafb85e9d6ca1de8f1ecb267e8c30b88ba4382820 (diff)
Some more major updates to further superate ucLibc from the kernel
headers (the way it has been done in GNU libc). -Erik
-rw-r--r--include/dirent.h342
-rw-r--r--include/elf.h1585
-rw-r--r--include/endian.h19
-rw-r--r--include/features.h3
-rw-r--r--include/limits.h171
-rw-r--r--include/netinet/ether.h54
-rw-r--r--include/netinet/icmp6.h232
-rw-r--r--include/netinet/if_ether.h109
-rw-r--r--include/netinet/if_fddi.h37
-rw-r--r--include/netinet/if_tr.h41
-rw-r--r--include/netinet/igmp.h95
-rw-r--r--include/netinet/in.h289
-rw-r--r--include/netinet/in_systm.h42
-rw-r--r--include/netinet/ip.h291
-rw-r--r--include/netinet/ip6.h106
-rw-r--r--include/netinet/ip_icmp.h288
-rw-r--r--include/netinet/tcp.h167
-rw-r--r--include/netinet/udp.h56
-rw-r--r--include/rpc/auth.h110
-rw-r--r--include/rpc/auth_des.h81
-rw-r--r--include/rpc/auth_unix.h56
-rw-r--r--include/rpc/clnt.h234
-rw-r--r--include/rpc/des_crypt.h97
-rw-r--r--include/rpc/key_prot.h346
-rw-r--r--include/rpc/netdb.h74
-rw-r--r--include/rpc/pmap_clnt.h59
-rw-r--r--include/rpc/pmap_prot.h32
-rw-r--r--include/rpc/pmap_rmt.h28
-rw-r--r--include/rpc/rpc.h21
-rw-r--r--include/rpc/rpc_des.h72
-rw-r--r--include/rpc/rpc_msg.h35
-rw-r--r--include/rpc/svc.h142
-rw-r--r--include/rpc/svc_auth.h26
-rw-r--r--include/rpc/types.h44
-rw-r--r--include/rpc/xdr.h323
-rw-r--r--include/setjmp.h4
-rw-r--r--include/signal.h426
-rw-r--r--include/stdint.h318
-rw-r--r--include/stdlib.h2
-rw-r--r--include/sys/bitypes.h95
-rw-r--r--include/sys/ioctl.h47
-rw-r--r--include/sys/select.h95
-rw-r--r--include/sys/socket.h261
-rw-r--r--include/sys/socketvar.h9
-rw-r--r--include/sys/stat.h432
-rw-r--r--include/sys/sysmacros.h49
-rw-r--r--include/sys/time.h204
-rw-r--r--include/sys/ttydefaults.h104
-rw-r--r--include/sys/types.h222
-rw-r--r--include/sys/wait.h2
-rw-r--r--libc/sysdeps/linux/i386/bits/byteswap.h95
-rw-r--r--libc/sysdeps/linux/i386/bits/dirent.h53
-rw-r--r--libc/sysdeps/linux/i386/bits/endian.h7
-rw-r--r--libc/sysdeps/linux/i386/bits/in.h128
-rw-r--r--libc/sysdeps/linux/i386/bits/ioctl-types.h77
-rw-r--r--libc/sysdeps/linux/i386/bits/ioctls.h108
-rw-r--r--libc/sysdeps/linux/i386/bits/local_lim.h55
-rw-r--r--libc/sysdeps/linux/i386/bits/posix1_lim.h141
-rw-r--r--libc/sysdeps/linux/i386/bits/posix2_lim.h100
-rw-r--r--libc/sysdeps/linux/i386/bits/select.h72
-rw-r--r--libc/sysdeps/linux/i386/bits/sigaction.h77
-rw-r--r--libc/sysdeps/linux/i386/bits/sigcontext.h29
-rw-r--r--libc/sysdeps/linux/i386/bits/siginfo.h279
-rw-r--r--libc/sysdeps/linux/i386/bits/signum.h80
-rw-r--r--libc/sysdeps/linux/i386/bits/sigstack.h55
-rw-r--r--libc/sysdeps/linux/i386/bits/sigthread.h37
-rw-r--r--libc/sysdeps/linux/i386/bits/sockaddr.h44
-rw-r--r--libc/sysdeps/linux/i386/bits/socket.h305
-rw-r--r--libc/sysdeps/linux/i386/bits/stat.h127
-rw-r--r--libc/sysdeps/linux/i386/bits/stdio_lim.h37
-rw-r--r--libc/sysdeps/linux/i386/bits/time.h59
-rw-r--r--libc/sysdeps/linux/i386/bits/types.h155
-rw-r--r--libc/sysdeps/linux/i386/bits/wordsize.h19
-rw-r--r--libc/sysdeps/linux/i386/bits/xopen_lim.h96
-rw-r--r--libc/sysdeps/linux/i386/setjmp.S2
75 files changed, 9066 insertions, 1148 deletions
diff --git a/include/dirent.h b/include/dirent.h
index 460ba0c5e..519373a55 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -1,155 +1,317 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991,92,93,94,95,96,97,98,2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/*
* POSIX Standard: 5.1.2 Directory Operations <dirent.h>
*/
#ifndef _DIRENT_H
-
#define _DIRENT_H 1
+
#include <features.h>
__BEGIN_DECLS
-#include <gnu/types.h>
+#include <bits/types.h>
+
+#ifdef __USE_XOPEN
+# ifndef ino_t
+# ifndef __USE_FILE_OFFSET64
+typedef __ino_t ino_t;
+# else
+typedef __ino64_t ino_t;
+# endif
+# define ino_t ino_t
+# endif
+# if defined __USE_LARGEFILE64 && !defined ino64_t
+typedef __ino64_t ino64_t;
+# define ino64_t ino64_t
+# endif
+#endif
-#define __need_size_t
-#include <stddef.h>
+/* This file defines `struct dirent'.
-#include <sys/types.h>
-#include <linux/limits.h>
-#include <linux/dirent.h>
+ It defines the macro `_DIRENT_HAVE_D_NAMLEN' iff there is a `d_namlen'
+ member that gives the length of `d_name'.
-#if defined(__USE_GNU)
-#define d_fileno d_ino /* glibc compatibility. */
-#if 0
-#define d_namlen d_reclen /* glibc compatibility. */
-#endif
-#endif
+ It defines the macro `_DIRENT_HAVE_D_RECLEN' iff there is a `d_reclen'
+ member that gives the size of the entire directory entry.
-#if defined(DIRENT_ILLEGAL_ACCESS) || \
- (defined(__SVR4_I386_ABI_L1__) && !defined(INTERNAL_LINUX_C_LIB))
+ It defines the macro `_DIRENT_HAVE_D_OFF' iff there is a `d_off'
+ member that gives the file offset of the next directory entry.
-/* Use it at your own risk. */
-typedef struct DIR
-{
- /* file descriptor */
- int dd_fd;
+ It defines the macro `_DIRENT_HAVE_D_TYPE' iff there is a `d_type'
+ member that gives the type of the file.
+ */
+
+#include <bits/dirent.h>
+
+#if (defined __USE_BSD || defined __USE_MISC) && !defined d_fileno
+# define d_ino d_fileno /* Backward compatibility. */
+#endif
- /* offset of the next dir entry in buffer */
- off_t dd_loc;
+/* These macros extract size information from a `struct dirent *'.
+ They may evaluate their argument multiple times, so it must not
+ have side effects. Each of these may involve a relatively costly
+ call to `strlen' on some systems, so these values should be cached.
- /* bytes of valid entries in buffer */
- size_t dd_size;
+ _D_EXACT_NAMLEN (DP) returns the length of DP->d_name, not including
+ its terminating null character.
- /* -> directory buffer */
- struct dirent *dd_buf;
-} DIR;
+ _D_ALLOC_NAMLEN (DP) returns a size at least (_D_EXACT_NAMLEN (DP) + 1);
+ that is, the allocation size needed to hold the DP->d_name string.
+ Use this macro when you don't need the exact length, just an upper bound.
+ This macro is less likely to require calling `strlen' than _D_EXACT_NAMLEN.
+ */
+#ifdef _DIRENT_HAVE_D_NAMLEN
+# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
+# define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1)
#else
+# define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name))
+# ifdef _DIRENT_HAVE_D_RECLEN
+# define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name[0])
+# else
+# define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \
+ _D_EXACT_NAMLEN (d) + 1)
+# endif
+#endif
-/* The internal is hidden from the user. */
-typedef struct DIR DIR;
+#ifdef __USE_BSD
+/* File types for `d_type'. */
+enum
+ {
+ DT_UNKNOWN = 0,
+# define DT_UNKNOWN DT_UNKNOWN
+ DT_FIFO = 1,
+# define DT_FIFO DT_FIFO
+ DT_CHR = 2,
+# define DT_CHR DT_CHR
+ DT_DIR = 4,
+# define DT_DIR DT_DIR
+ DT_BLK = 6,
+# define DT_BLK DT_BLK
+ DT_REG = 8,
+# define DT_REG DT_REG
+ DT_LNK = 10,
+# define DT_LNK DT_LNK
+ DT_SOCK = 12
+# define DT_SOCK DT_SOCK
+ };
+
+/* Convert between stat structure types and directory types. */
+# define IFTODT(mode) (((mode) & 0170000) >> 12)
+# define DTTOIF(dirtype) ((dirtype) << 12)
#endif
+/* This is the data type of directory stream objects.
+ The actual structure is opaque to users. */
+typedef struct __dirstream DIR;
+
/* Open a directory stream on NAME.
Return a DIR stream on the directory, or NULL if it could not be opened. */
extern DIR *opendir __P ((__const char *__name));
/* Close the directory stream DIRP.
Return 0 if successful, -1 if not. */
-extern int closedir __P ((DIR * __dirp));
-
-/* Read a directory entry from DIRP.
- Return a pointer to a `struct dirent' describing the entry,
- or NULL for EOF or error. The storage returned may be overwritten
- by a later readdir call on the same DIR stream. */
-extern struct dirent *readdir __P ((DIR * __dirp));
-
-/* Rewind DIRP to the beginning of the directory. */
-extern void rewinddir __P ((DIR * __dirp));
-
-#if defined(__USE_BSD) || defined(__USE_MISC)
+extern int closedir __P ((DIR *__dirp));
-#ifndef MAXNAMLEN
-/* Get the definitions of the POSIX.1 limits. */
-#include <posix1_lim.h>
+/* Read a directory entry from DIRP. Return a pointer to a `struct
+ dirent' describing the entry, or NULL for EOF or error. The
+ storage returned may be overwritten by a later readdir call on the
+ same DIR stream.
-/* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */
-#ifdef NAME_MAX
-#define MAXNAMLEN NAME_MAX
+ If the Large File Support API is selected we have to use the
+ appropriate interface. */
+#ifndef __USE_FILE_OFFSET64
+extern struct dirent *readdir __P ((DIR *__dirp));
#else
-#define MAXNAMLEN 255
+# ifdef __REDIRECT
+extern struct dirent *__REDIRECT (readdir, __P ((DIR *__dirp)), readdir64);
+# else
+# define readdir readdir64
+# endif
#endif
+
+#ifdef __USE_LARGEFILE64
+extern struct dirent64 *readdir64 __P ((DIR *__dirp));
#endif
-#include <gnu/types.h>
+#if defined __USE_POSIX || defined __USE_MISC
+/* Reentrant version of `readdir'. Return in RESULT a pointer to the
+ next entry. */
+# ifndef __USE_FILE_OFFSET64
+extern int readdir_r __P ((DIR *__restrict __dirp,
+ struct dirent *__restrict __entry,
+ struct dirent **__restrict __result));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (readdir_r, __P ((DIR *__restrict __dirp,
+ struct dirent *__restrict __entry,
+ struct dirent **__restrict __result)),
+ readdir64_r);
+# else
+# define readdir_r readdir64_r
+# endif
+# endif
+
+# ifdef __USE_LARGEFILE64
+extern int readdir64_r __P ((DIR *__restrict __dirp,
+ struct dirent64 *__restrict __entry,
+ struct dirent64 **__restrict __result));
+# endif
+#endif /* POSIX or misc */
+
+/* Rewind DIRP to the beginning of the directory. */
+extern void rewinddir __P ((DIR *__dirp));
+
+#if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN
+# include <bits/types.h>
/* Seek to position POS on DIRP. */
-extern void seekdir __P ((DIR * __dirp, __off_t __pos));
+extern void seekdir __P ((DIR *__dirp, long int __pos));
/* Return the current position of DIRP. */
-extern __off_t telldir __P ((DIR * __dirp));
+extern long int telldir __P ((DIR *__dirp));
+#endif
+
+#if defined __USE_BSD || defined __USE_MISC
+
+/* Return the file descriptor used by DIRP. */
+extern int dirfd __P ((DIR *__dirp));
-typedef int (*__dir_select_fn_t) __P ((__const struct dirent *));
+# if defined __OPTIMIZE__ && defined _DIR_dirfd
+# define dirfd(dirp) _DIR_dirfd (dirp)
+# endif
-typedef int (*__dir_compar_fn_t) __P ((
- __const struct dirent * __const *,
- __const struct dirent * __const *
- ));
+# ifndef MAXNAMLEN
+/* Get the definitions of the POSIX.1 limits. */
+# include <bits/posix1_lim.h>
+
+/* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */
+# ifdef NAME_MAX
+# define MAXNAMLEN NAME_MAX
+# else
+# define MAXNAMLEN 255
+# endif
+# endif
+
+# define __need_size_t
+# include <stddef.h>
-/* Scan the directory DIR, calling SELECT on each directory entry.
+/* Scan the directory DIR, calling SELECTOR on each directory entry.
Entries for which SELECT returns nonzero are individually malloc'd,
sorted using qsort with CMP, and collected in a malloc'd array in
*NAMELIST. Returns the number of entries selected, or -1 on error. */
-extern int scandir __P ((__const char *__dir,
- struct dirent ***__namelist,
- __dir_select_fn_t __dir_select_fn,
- __dir_compar_fn_t __dir_compar_fn));
+# ifndef __USE_FILE_OFFSET64
+extern int scandir __P ((__const char *__restrict __dir,
+ struct dirent ***__restrict __namelist,
+ int (*__selector) (__const struct dirent *),
+ int (*__cmp) (__const __ptr_t, __const __ptr_t)));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (scandir,
+ __P ((__const char *__restrict __dir,
+ struct dirent ***__restrict __namelist,
+ int (*__selector) (__const struct dirent *),
+ int (*__cmp) (__const __ptr_t, __const __ptr_t))),
+ scandir64);
+# else
+# define scandir scandir64
+# endif
+# endif
+
+# if defined __USE_GNU && defined __USE_LARGEFILE64
+/* This function is like `scandir' but it uses the 64bit dirent structure.
+ Please note that the CMP function must now work with struct dirent64 **. */
+extern int scandir64 __P ((__const char *__restrict __dir,
+ struct dirent64 ***__restrict __namelist,
+ int (*__selector) (__const struct dirent64 *),
+ int (*__cmp) (__const __ptr_t, __const __ptr_t)));
+# endif
/* Function to compare two `struct dirent's alphabetically. */
-extern int alphasort __P ((
- __const struct dirent * __const *,
- __const struct dirent * __const *
- ));
-
+# ifndef __USE_FILE_OFFSET64
+extern int alphasort __P ((__const __ptr_t __e1, __const __ptr_t __e2));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (alphasort,
+ __P ((__const __ptr_t __e1, __const __ptr_t __e2)),
+ alphasort64);
+# else
+# define alphasort alphasort64
+# endif
+# endif
+
+# if defined __USE_GNU && defined __USE_LARGEFILE64
+extern int alphasort64 __P ((__const __ptr_t __e1, __const __ptr_t __e2));
+# endif
+
+# ifdef __USE_GNU
+/* Function to compare two `struct dirent's by name & version. */
+# ifndef __USE_FILE_OFFSET64
+extern int versionsort __P ((__const __ptr_t __e1, __const __ptr_t __e2));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (versionsort,
+ __P ((__const __ptr_t __e1, __const __ptr_t __e2)),
+ versionsort64);
+# else
+# define versionsort versionsort64
+# endif
+# endif
+
+# ifdef __USE_LARGEFILE64
+extern int versionsort64 __P ((__const __ptr_t __e1, __const __ptr_t __e2));
+# endif
+# endif
/* Read directory entries from FD into BUF, reading at most NBYTES.
Reading starts at offset *BASEP, and *BASEP is updated with the new
position after reading. Returns the number of bytes read; zero when at
end of directory; or -1 for errors. */
-extern __ssize_t __getdirentries __P ((int __fd, char *__buf,
- size_t __nbytes, __off_t *__basep));
-extern __ssize_t getdirentries __P ((int __fd, char *__buf,
- size_t __nbytes, __off_t *__basep));
-extern int dirfd __P ((DIR *__dirp));
+# ifndef __USE_FILE_OFFSET64
+extern __ssize_t getdirentries __P ((int __fd, char *__restrict __buf,
+ size_t __nbytes,
+ __off_t *__restrict __basep));
+# else
+# ifdef __REDIRECT
+extern __ssize_t __REDIRECT (getdirentries,
+ __P ((int __fd, char *__restrict __buf,
+ size_t __nbytes,
+ __off64_t *__restrict __basep)),
+ getdirentries64);
+# else
+# define getdirentries getdirentries64
+# endif
+# endif
+
+# ifdef __USE_LARGEFILE64
+extern __ssize_t getdirentries64 __P ((int __fd, char *__restrict __buf,
+ size_t __nbytes,
+ __off64_t *__restrict __basep));
+# endif
#endif /* Use BSD or misc. */
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
-extern int readdir_r __P((DIR *__dirp, struct dirent *__entry,
- struct dirent **__result));
-#endif
-
__END_DECLS
#endif /* dirent.h */
diff --git a/include/elf.h b/include/elf.h
new file mode 100644
index 000000000..232cd89a7
--- /dev/null
+++ b/include/elf.h
@@ -0,0 +1,1585 @@
+/* This file defines standard ELF types, structures, and macros.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ian Lance Taylor <ian@cygnus.com>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _ELF_H
+#define _ELF_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Standard ELF types. */
+
+#include <stdint.h>
+
+/* Type for a 16-bit quantity. */
+typedef uint16_t Elf32_Half;
+typedef uint16_t Elf64_Half;
+
+/* Types for signed and unsigned 32-bit quantities. */
+typedef uint32_t Elf32_Word;
+typedef int32_t Elf32_Sword;
+typedef uint32_t Elf64_Word;
+typedef int32_t Elf64_Sword;
+
+/* Types for signed and unsigned 64-bit quantities. */
+typedef uint64_t Elf32_Xword;
+typedef int64_t Elf32_Sxword;
+typedef uint64_t Elf64_Xword;
+typedef int64_t Elf64_Sxword;
+
+/* Type of addresses. */
+typedef uint32_t Elf32_Addr;
+typedef uint64_t Elf64_Addr;
+
+/* Type of file offsets. */
+typedef uint32_t Elf32_Off;
+typedef uint64_t Elf64_Off;
+
+/* Type for section indices, which are 16-bit quantities. */
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+
+/* Type of symbol indices. */
+typedef uint32_t Elf32_Symndx;
+typedef uint64_t Elf64_Symndx;
+
+
+/* The ELF file header. This appears at the start of every ELF file. */
+
+#define EI_NIDENT (16)
+
+typedef struct
+{
+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
+ Elf32_Half e_type; /* Object file type */
+ Elf32_Half e_machine; /* Architecture */
+ Elf32_Word e_version; /* Object file version */
+ Elf32_Addr e_entry; /* Entry point virtual address */
+ Elf32_Off e_phoff; /* Program header table file offset */
+ Elf32_Off e_shoff; /* Section header table file offset */
+ Elf32_Word e_flags; /* Processor-specific flags */
+ Elf32_Half e_ehsize; /* ELF header size in bytes */
+ Elf32_Half e_phentsize; /* Program header table entry size */
+ Elf32_Half e_phnum; /* Program header table entry count */
+ Elf32_Half e_shentsize; /* Section header table entry size */
+ Elf32_Half e_shnum; /* Section header table entry count */
+ Elf32_Half e_shstrndx; /* Section header string table index */
+} Elf32_Ehdr;
+
+typedef struct
+{
+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
+ Elf64_Half e_type; /* Object file type */
+ Elf64_Half e_machine; /* Architecture */
+ Elf64_Word e_version; /* Object file version */
+ Elf64_Addr e_entry; /* Entry point virtual address */
+ Elf64_Off e_phoff; /* Program header table file offset */
+ Elf64_Off e_shoff; /* Section header table file offset */
+ Elf64_Word e_flags; /* Processor-specific flags */
+ Elf64_Half e_ehsize; /* ELF header size in bytes */
+ Elf64_Half e_phentsize; /* Program header table entry size */
+ Elf64_Half e_phnum; /* Program header table entry count */
+ Elf64_Half e_shentsize; /* Section header table entry size */
+ Elf64_Half e_shnum; /* Section header table entry count */
+ Elf64_Half e_shstrndx; /* Section header string table index */
+} Elf64_Ehdr;
+
+/* Fields in the e_ident array. The EI_* macros are indices into the
+ array. The macros under each EI_* macro are the values the byte
+ may have. */
+
+#define EI_MAG0 0 /* File identification byte 0 index */
+#define ELFMAG0 0x7f /* Magic number byte 0 */
+
+#define EI_MAG1 1 /* File identification byte 1 index */
+#define ELFMAG1 'E' /* Magic number byte 1 */
+
+#define EI_MAG2 2 /* File identification byte 2 index */
+#define ELFMAG2 'L' /* Magic number byte 2 */
+
+#define EI_MAG3 3 /* File identification byte 3 index */
+#define ELFMAG3 'F' /* Magic number byte 3 */
+
+/* Conglomeration of the identification bytes, for easy testing as a word. */
+#define ELFMAG "\177ELF"
+#define SELFMAG 4
+
+#define EI_CLASS 4 /* File class byte index */
+#define ELFCLASSNONE 0 /* Invalid class */
+#define ELFCLASS32 1 /* 32-bit objects */
+#define ELFCLASS64 2 /* 64-bit objects */
+#define ELFCLASSNUM 3
+
+#define EI_DATA 5 /* Data encoding byte index */
+#define ELFDATANONE 0 /* Invalid data encoding */
+#define ELFDATA2LSB 1 /* 2's complement, little endian */
+#define ELFDATA2MSB 2 /* 2's complement, big endian */
+#define ELFDATANUM 3
+
+#define EI_VERSION 6 /* File version byte index */
+ /* Value must be EV_CURRENT */
+
+#define EI_OSABI 7 /* OS ABI identification */
+#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
+#define ELFOSABI_HPUX 1 /* HP-UX */
+#define ELFOSABI_ARM 97 /* ARM */
+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
+
+#define EI_ABIVERSION 8 /* ABI version */
+
+#define EI_PAD 9 /* Byte index of padding bytes */
+
+/* Legal values for e_type (object file type). */
+
+#define ET_NONE 0 /* No file type */
+#define ET_REL 1 /* Relocatable file */
+#define ET_EXEC 2 /* Executable file */
+#define ET_DYN 3 /* Shared object file */
+#define ET_CORE 4 /* Core file */
+#define ET_NUM 5 /* Number of defined types */
+#define ET_LOPROC 0xff00 /* Processor-specific */
+#define ET_HIPROC 0xffff /* Processor-specific */
+
+/* Legal values for e_machine (architecture). */
+
+#define EM_NONE 0 /* No machine */
+#define EM_M32 1 /* AT&T WE 32100 */
+#define EM_SPARC 2 /* SUN SPARC */
+#define EM_386 3 /* Intel 80386 */
+#define EM_68K 4 /* Motorola m68k family */
+#define EM_88K 5 /* Motorola m88k family */
+#define EM_486 6 /* Intel 80486 */
+#define EM_860 7 /* Intel 80860 */
+#define EM_MIPS 8 /* MIPS R3000 big-endian */
+#define EM_S370 9 /* Amdahl */
+#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
+#define EM_RS6000 11 /* RS6000 */
+
+#define EM_PARISC 15 /* HPPA */
+#define EM_nCUBE 16 /* nCUBE */
+#define EM_VPP500 17 /* Fujitsu VPP500 */
+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
+#define EM_960 19 /* Intel 80960 */
+#define EM_PPC 20 /* PowerPC */
+
+#define EM_V800 36 /* NEC V800 series */
+#define EM_FR20 37 /* Fujitsu FR20 */
+#define EM_RH32 38 /* TRW RH32 */
+#define EM_MMA 39 /* Fujitsu MMA */
+#define EM_ARM 40 /* ARM */
+#define EM_FAKE_ALPHA 41 /* Digital Alpha */
+#define EM_SH 42 /* Hitachi SH */
+#define EM_SPARCV9 43 /* SPARC v9 64-bit */
+#define EM_TRICORE 44 /* Siemens Tricore */
+#define EM_ARC 45 /* Argonaut RISC Core */
+#define EM_H8_300 46 /* Hitachi H8/300 */
+#define EM_H8_300H 47 /* Hitachi H8/300H */
+#define EM_H8S 48 /* Hitachi H8S */
+#define EM_H8_500 49 /* Hitachi H8/500 */
+#define EM_IA_64 50 /* Intel Merced */
+#define EM_MIPS_X 51 /* Stanford MIPS-X */
+#define EM_COLDFIRE 52 /* Motorola Coldfire */
+#define EM_68HC12 53 /* Motorola M68HC12 */
+#define EM_NUM 54
+
+/* If it is necessary to assign new unofficial EM_* values, please
+ pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
+ chances of collision with official or non-GNU unofficial values. */
+
+#define EM_ALPHA 0x9026
+
+/* Legal values for e_version (version). */
+
+#define EV_NONE 0 /* Invalid ELF version */
+#define EV_CURRENT 1 /* Current version */
+#define EV_NUM 2
+
+/* Section header. */
+
+typedef struct
+{
+ Elf32_Word sh_name; /* Section name (string tbl index) */
+ Elf32_Word sh_type; /* Section type */
+ Elf32_Word sh_flags; /* Section flags */
+ Elf32_Addr sh_addr; /* Section virtual addr at execution */
+ Elf32_Off sh_offset; /* Section file offset */
+ Elf32_Word sh_size; /* Section size in bytes */
+ Elf32_Word sh_link; /* Link to another section */
+ Elf32_Word sh_info; /* Additional section information */
+ Elf32_Word sh_addralign; /* Section alignment */
+ Elf32_Word sh_entsize; /* Entry size if section holds table */
+} Elf32_Shdr;
+
+typedef struct
+{
+ Elf64_Word sh_name; /* Section name (string tbl index) */
+ Elf64_Word sh_type; /* Section type */
+ Elf64_Xword sh_flags; /* Section flags */
+ Elf64_Addr sh_addr; /* Section virtual addr at execution */
+ Elf64_Off sh_offset; /* Section file offset */
+ Elf64_Xword sh_size; /* Section size in bytes */
+ Elf64_Word sh_link; /* Link to another section */
+ Elf64_Word sh_info; /* Additional section information */
+ Elf64_Xword sh_addralign; /* Section alignment */
+ Elf64_Xword sh_entsize; /* Entry size if section holds table */
+} Elf64_Shdr;
+
+/* Special section indices. */
+
+#define SHN_UNDEF 0 /* Undefined section */
+#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
+#define SHN_LOPROC 0xff00 /* Start of processor-specific */
+#define SHN_HIPROC 0xff1f /* End of processor-specific */
+#define SHN_ABS 0xfff1 /* Associated symbol is absolute */
+#define SHN_COMMON 0xfff2 /* Associated symbol is common */
+#define SHN_HIRESERVE 0xffff /* End of reserved indices */
+
+/* Legal values for sh_type (section type). */
+
+#define SHT_NULL 0 /* Section header table entry unused */
+#define SHT_PROGBITS 1 /* Program data */
+#define SHT_SYMTAB 2 /* Symbol table */
+#define SHT_STRTAB 3 /* String table */
+#define SHT_RELA 4 /* Relocation entries with addends */
+#define SHT_HASH 5 /* Symbol hash table */
+#define SHT_DYNAMIC 6 /* Dynamic linking information */
+#define SHT_NOTE 7 /* Notes */
+#define SHT_NOBITS 8 /* Program space with no data (bss) */
+#define SHT_REL 9 /* Relocation entries, no addends */
+#define SHT_SHLIB 10 /* Reserved */
+#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
+#define SHT_NUM 12 /* Number of defined types. */
+#define SHT_LOOS 0x60000000 /* Start OS-specific */
+#define SHT_LOSUNW 0x6ffffffb /* Sun-specific low bound. */
+#define SHT_SUNW_COMDAT 0x6ffffffb
+#define SHT_SUNW_syminfo 0x6ffffffc
+#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */
+#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */
+#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */
+#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */
+#define SHT_HIOS 0x6fffffff /* End OS-specific type */
+#define SHT_LOPROC 0x70000000 /* Start of processor-specific */
+#define SHT_HIPROC 0x7fffffff /* End of processor-specific */
+#define SHT_LOUSER 0x80000000 /* Start of application-specific */
+#define SHT_HIUSER 0x8fffffff /* End of application-specific */
+
+/* Legal values for sh_flags (section flags). */
+
+#define SHF_WRITE (1 << 0) /* Writable */
+#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
+#define SHF_EXECINSTR (1 << 2) /* Executable */
+#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
+
+/* Symbol table entry. */
+
+typedef struct
+{
+ Elf32_Word st_name; /* Symbol name (string tbl index) */
+ Elf32_Addr st_value; /* Symbol value */
+ Elf32_Word st_size; /* Symbol size */
+ unsigned char st_info; /* Symbol type and binding */
+ unsigned char st_other; /* No defined meaning, 0 */
+ Elf32_Section st_shndx; /* Section index */
+} Elf32_Sym;
+
+typedef struct
+{
+ Elf64_Word st_name; /* Symbol name (string tbl index) */
+ unsigned char st_info; /* Symbol type and binding */
+ unsigned char st_other; /* No defined meaning, 0 */
+ Elf64_Section st_shndx; /* Section index */
+ Elf64_Addr st_value; /* Symbol value */
+ Elf64_Xword st_size; /* Symbol size */
+} Elf64_Sym;
+
+/* The syminfo section if available contains additional information about
+ every dynamic symbol. */
+
+typedef struct
+{
+ Elf32_Half si_boundto; /* Direct bindings, symbol bound to */
+ Elf32_Half si_flags; /* Per symbol flags */
+} Elf32_Syminfo;
+
+typedef struct
+{
+ Elf64_Half si_boundto; /* Direct bindings, symbol bound to */
+ Elf64_Half si_flags; /* Per symbol flags */
+} Elf64_Syminfo;
+
+/* Possible values for si_boundto. */
+#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
+#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
+#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
+
+/* Possible bitmasks for si_flags. */
+#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
+#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */
+#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy
+ loaded */
+/* Syminfo version values. */
+#define SYMINFO_NONE 0
+#define SYMINFO_CURRENT 1
+#define SYMINFO_NUM 2
+
+
+/* Special section index. */
+
+#define SHN_UNDEF 0 /* No section, undefined symbol. */
+
+/* How to extract and insert information held in the st_info field. */
+
+#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
+#define ELF32_ST_TYPE(val) ((val) & 0xf)
+#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
+
+/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
+#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
+#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
+#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
+
+/* Legal values for ST_BIND subfield of st_info (symbol binding). */
+
+#define STB_LOCAL 0 /* Local symbol */
+#define STB_GLOBAL 1 /* Global symbol */
+#define STB_WEAK 2 /* Weak symbol */
+#define STB_NUM 3 /* Number of defined types. */
+#define STB_LOOS 10 /* Start of OS-specific */
+#define STB_HIOS 12 /* End of OS-specific */
+#define STB_LOPROC 13 /* Start of processor-specific */
+#define STB_HIPROC 15 /* End of processor-specific */
+
+/* Legal values for ST_TYPE subfield of st_info (symbol type). */
+
+#define STT_NOTYPE 0 /* Symbol type is unspecified */
+#define STT_OBJECT 1 /* Symbol is a data object */
+#define STT_FUNC 2 /* Symbol is a code object */
+#define STT_SECTION 3 /* Symbol associated with a section */
+#define STT_FILE 4 /* Symbol's name is file name */
+#define STT_NUM 5 /* Number of defined types. */
+#define STT_LOOS 11 /* Start of OS-specific */
+#define STT_HIOS 12 /* End of OS-specific */
+#define STT_LOPROC 13 /* Start of processor-specific */
+#define STT_HIPROC 15 /* End of processor-specific */
+
+
+/* Symbol table indices are found in the hash buckets and chain table
+ of a symbol hash table section. This special index value indicates
+ the end of a chain, meaning no further symbols are found in that bucket. */
+
+#define STN_UNDEF 0 /* End of a chain. */
+
+
+/* Relocation table entry without addend (in section of type SHT_REL). */
+
+typedef struct
+{
+ Elf32_Addr r_offset; /* Address */
+ Elf32_Word r_info; /* Relocation type and symbol index */
+} Elf32_Rel;
+
+/* I have seen two different definitions of the Elf64_Rel and
+ Elf64_Rela structures, so we'll leave them out until Novell (or
+ whoever) gets their act together. */
+/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */
+
+typedef struct
+{
+ Elf64_Addr r_offset; /* Address */
+ Elf64_Xword r_info; /* Relocation type and symbol index */
+} Elf64_Rel;
+
+/* Relocation table entry with addend (in section of type SHT_RELA). */
+
+typedef struct
+{
+ Elf32_Addr r_offset; /* Address */
+ Elf32_Word r_info; /* Relocation type and symbol index */
+ Elf32_Sword r_addend; /* Addend */
+} Elf32_Rela;
+
+typedef struct
+{
+ Elf64_Addr r_offset; /* Address */
+ Elf64_Xword r_info; /* Relocation type and symbol index */
+ Elf64_Sxword r_addend; /* Addend */
+} Elf64_Rela;
+
+/* How to extract and insert information held in the r_info field. */
+
+#define ELF32_R_SYM(val) ((val) >> 8)
+#define ELF32_R_TYPE(val) ((val) & 0xff)
+#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
+
+#define ELF64_R_SYM(i) ((i) >> 32)
+#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
+#define ELF64_R_INFO(sym,type) (((sym) << 32) + (type))
+
+/* Program segment header. */
+
+typedef struct
+{
+ Elf32_Word p_type; /* Segment type */
+ Elf32_Off p_offset; /* Segment file offset */
+ Elf32_Addr p_vaddr; /* Segment virtual address */
+ Elf32_Addr p_paddr; /* Segment physical address */
+ Elf32_Word p_filesz; /* Segment size in file */
+ Elf32_Word p_memsz; /* Segment size in memory */
+ Elf32_Word p_flags; /* Segment flags */
+ Elf32_Word p_align; /* Segment alignment */
+} Elf32_Phdr;
+
+typedef struct
+{
+ Elf64_Word p_type; /* Segment type */
+ Elf64_Word p_flags; /* Segment flags */
+ Elf64_Off p_offset; /* Segment file offset */
+ Elf64_Addr p_vaddr; /* Segment virtual address */
+ Elf64_Addr p_paddr; /* Segment physical address */
+ Elf64_Xword p_filesz; /* Segment size in file */
+ Elf64_Xword p_memsz; /* Segment size in memory */
+ Elf64_Xword p_align; /* Segment alignment */
+} Elf64_Phdr;
+
+/* Legal values for p_type (segment type). */
+
+#define PT_NULL 0 /* Program header table entry unused */
+#define PT_LOAD 1 /* Loadable program segment */
+#define PT_DYNAMIC 2 /* Dynamic linking information */
+#define PT_INTERP 3 /* Program interpreter */
+#define PT_NOTE 4 /* Auxiliary information */
+#define PT_SHLIB 5 /* Reserved */
+#define PT_PHDR 6 /* Entry for header table itself */
+#define PT_NUM 7 /* Number of defined types. */
+#define PT_LOOS 0x60000000 /* Start of OS-specific */
+#define PT_HIOS 0x6fffffff /* End of OS-specific */
+#define PT_LOPROC 0x70000000 /* Start of processor-specific */
+#define PT_HIPROC 0x7fffffff /* End of processor-specific */
+
+/* Legal values for p_flags (segment flags). */
+
+#define PF_X (1 << 0) /* Segment is executable */
+#define PF_W (1 << 1) /* Segment is writable */
+#define PF_R (1 << 2) /* Segment is readable */
+#define PF_MASKPROC 0xf0000000 /* Processor-specific */
+
+/* Legal values for note segment descriptor types for core files. */
+
+#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
+#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
+#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
+#define NT_PRXREG 4 /* Contains copy of prxregset struct */
+#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */
+#define NT_AUXV 6 /* Contains copy of auxv array */
+#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */
+#define NT_PSTATUS 10 /* Contains copy of pstatus struct */
+#define NT_PSINFO 13 /* Contains copy of psinfo struct */
+#define NT_PRCRED 14 /* Contains copy of prcred struct */
+#define NT_UTSNAME 15 /* Contains copy of utsname struct */
+#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
+#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
+
+/* Legal values for the note segment descriptor types for object files. */
+
+#define NT_VERSION 1 /* Contains a version string. */
+
+
+/* Dynamic section entry. */
+
+typedef struct
+{
+ Elf32_Sword d_tag; /* Dynamic entry type */
+ union
+ {
+ Elf32_Word d_val; /* Integer value */
+ Elf32_Addr d_ptr; /* Address value */
+ } d_un;
+} Elf32_Dyn;
+
+typedef struct
+{
+ Elf64_Sxword d_tag; /* Dynamic entry type */
+ union
+ {
+ Elf64_Xword d_val; /* Integer value */
+ Elf64_Addr d_ptr; /* Address value */
+ } d_un;
+} Elf64_Dyn;
+
+/* Legal values for d_tag (dynamic entry type). */
+
+#define DT_NULL 0 /* Marks end of dynamic section */
+#define DT_NEEDED 1 /* Name of needed library */
+#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
+#define DT_PLTGOT 3 /* Processor defined value */
+#define DT_HASH 4 /* Address of symbol hash table */
+#define DT_STRTAB 5 /* Address of string table */
+#define DT_SYMTAB 6 /* Address of symbol table */
+#define DT_RELA 7 /* Address of Rela relocs */
+#define DT_RELASZ 8 /* Total size of Rela relocs */
+#define DT_RELAENT 9 /* Size of one Rela reloc */
+#define DT_STRSZ 10 /* Size of string table */
+#define DT_SYMENT 11 /* Size of one symbol table entry */
+#define DT_INIT 12 /* Address of init function */
+#define DT_FINI 13 /* Address of termination function */
+#define DT_SONAME 14 /* Name of shared object */
+#define DT_RPATH 15 /* Library search path */
+#define DT_SYMBOLIC 16 /* Start symbol search here */
+#define DT_REL 17 /* Address of Rel relocs */
+#define DT_RELSZ 18 /* Total size of Rel relocs */
+#define DT_RELENT 19 /* Size of one Rel reloc */
+#define DT_PLTREL 20 /* Type of reloc in PLT */
+#define DT_DEBUG 21 /* For debugging; unspecified */
+#define DT_TEXTREL 22 /* Reloc might modify .text */
+#define DT_JMPREL 23 /* Address of PLT relocs */
+#define DT_BIND_NOW 24 /* Process relocations of object */
+#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
+#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
+#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
+#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
+#define DT_NUM 29 /* Number used */
+#define DT_LOOS 0x60000000 /* Start of OS-specific */
+#define DT_HIOS 0x6fffffff /* End of OS-specific */
+#define DT_LOPROC 0x70000000 /* Start of processor-specific */
+#define DT_HIPROC 0x7fffffff /* End of processor-specific */
+#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */
+
+/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
+ Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's
+ approach. */
+#define DT_VALRNGLO 0x6ffffd00
+#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting
+ the following DT_* entry. */
+#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
+#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
+#define DT_VALRNGHI 0x6ffffdff
+
+/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
+ Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
+
+ If any adjustment is made to the ELF object after it has been
+ built these entries will need to be adjusted. */
+#define DT_ADDRRNGLO 0x6ffffe00
+#define DT_SYMINFO 0x6ffffeff /* syminfo table */
+#define DT_ADDRRNGHI 0x6ffffeff
+
+/* The versioning entry types. The next are defined as part of the
+ GNU extension. */
+#define DT_VERSYM 0x6ffffff0
+
+/* These were chosen by Sun. */
+#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */
+#define DT_VERDEF 0x6ffffffc /* Address of version definition
+ table */
+#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */
+#define DT_VERNEED 0x6ffffffe /* Address of table with needed
+ versions */
+#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */
+#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
+#define DT_VERSIONTAGNUM 16
+
+/* Sun added these machine-independent extensions in the "processor-specific"
+ range. Be compatible. */
+#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
+#define DT_FILTER 0x7fffffff /* Shared object to get values from */
+#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
+#define DT_EXTRANUM 3
+
+/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
+ entry in the dynamic section. */
+#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
+#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */
+#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */
+#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/
+#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/
+#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/
+#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */
+
+/* Version definition sections. */
+
+typedef struct
+{
+ Elf32_Half vd_version; /* Version revision */
+ Elf32_Half vd_flags; /* Version information */
+ Elf32_Half vd_ndx; /* Version Index */
+ Elf32_Half vd_cnt; /* Number of associated aux entries */
+ Elf32_Word vd_hash; /* Version name hash value */
+ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */
+ Elf32_Word vd_next; /* Offset in bytes to next verdef
+ entry */
+} Elf32_Verdef;
+
+typedef struct
+{
+ Elf64_Half vd_version; /* Version revision */
+ Elf64_Half vd_flags; /* Version information */
+ Elf64_Half vd_ndx; /* Version Index */
+ Elf64_Half vd_cnt; /* Number of associated aux entries */
+ Elf64_Word vd_hash; /* Version name hash value */
+ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */
+ Elf64_Word vd_next; /* Offset in bytes to next verdef
+ entry */
+} Elf64_Verdef;
+
+
+/* Legal values for vd_version (version revision). */
+#define VER_DEF_NONE 0 /* No version */
+#define VER_DEF_CURRENT 1 /* Current version */
+#define VER_DEF_NUM 2 /* Given version number */
+
+/* Legal values for vd_flags (version information flags). */
+#define VER_FLG_BASE 0x1 /* Version definition of file itself */
+#define VER_FLG_WEAK 0x2 /* Weak version identifier */
+
+/* Auxialiary version information. */
+
+typedef struct
+{
+ Elf32_Word vda_name; /* Version or dependency names */
+ Elf32_Word vda_next; /* Offset in bytes to next verdaux
+ entry */
+} Elf32_Verdaux;
+
+typedef struct
+{
+ Elf64_Word vda_name; /* Version or dependency names */
+ Elf64_Word vda_next; /* Offset in bytes to next verdaux
+ entry */
+} Elf64_Verdaux;
+
+
+/* Version dependency section. */
+
+typedef struct
+{
+ Elf32_Half vn_version; /* Version of structure */
+ Elf32_Half vn_cnt; /* Number of associated aux entries */
+ Elf32_Word vn_file; /* Offset of filename for this
+ dependency */
+ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */
+ Elf32_Word vn_next; /* Offset in bytes to next verneed
+ entry */
+} Elf32_Verneed;
+
+typedef struct
+{
+ Elf64_Half vn_version; /* Version of structure */
+ Elf64_Half vn_cnt; /* Number of associated aux entries */
+ Elf64_Word vn_file; /* Offset of filename for this
+ dependency */
+ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */
+ Elf64_Word vn_next; /* Offset in bytes to next verneed
+ entry */
+} Elf64_Verneed;
+
+
+/* Legal values for vn_version (version revision). */
+#define VER_NEED_NONE 0 /* No version */
+#define VER_NEED_CURRENT 1 /* Current version */
+#define VER_NEED_NUM 2 /* Given version number */
+
+/* Auxiliary needed version information. */
+
+typedef struct
+{
+ Elf32_Word vna_hash; /* Hash value of dependency name */
+ Elf32_Half vna_flags; /* Dependency specific information */
+ Elf32_Half vna_other; /* Unused */
+ Elf32_Word vna_name; /* Dependency name string offset */
+ Elf32_Word vna_next; /* Offset in bytes to next vernaux
+ entry */
+} Elf32_Vernaux;
+
+typedef struct
+{
+ Elf64_Word vna_hash; /* Hash value of dependency name */
+ Elf64_Half vna_flags; /* Dependency specific information */
+ Elf64_Half vna_other; /* Unused */
+ Elf64_Word vna_name; /* Dependency name string offset */
+ Elf64_Word vna_next; /* Offset in bytes to next vernaux
+ entry */
+} Elf64_Vernaux;
+
+
+/* Legal values for vna_flags. */
+#define VER_FLG_WEAK 0x2 /* Weak version identifier */
+
+
+/* Auxiliary vector. */
+
+/* This vector is normally only used by the program interpreter. The
+ usual definition in an ABI supplement uses the name auxv_t. The
+ vector is not usually defined in a standard <elf.h> file, but it
+ can't hurt. We rename it to avoid conflicts. The sizes of these
+ types are an arrangement between the exec server and the program
+ interpreter, so we don't fully specify them here. */
+
+typedef struct
+{
+ int a_type; /* Entry type */
+ union
+ {
+ long int a_val; /* Integer value */
+ void *a_ptr; /* Pointer value */
+ void (*a_fcn) (void); /* Function pointer value */
+ } a_un;
+} Elf32_auxv_t;
+
+typedef struct
+{
+ long int a_type; /* Entry type */
+ union
+ {
+ long int a_val; /* Integer value */
+ void *a_ptr; /* Pointer value */
+ void (*a_fcn) (void); /* Function pointer value */
+ } a_un;
+} Elf64_auxv_t;
+
+/* Legal values for a_type (entry type). */
+
+#define AT_NULL 0 /* End of vector */
+#define AT_IGNORE 1 /* Entry should be ignored */
+#define AT_EXECFD 2 /* File descriptor of program */
+#define AT_PHDR 3 /* Program headers for program */
+#define AT_PHENT 4 /* Size of program header entry */
+#define AT_PHNUM 5 /* Number of program headers */
+#define AT_PAGESZ 6 /* System page size */
+#define AT_BASE 7 /* Base address of interpreter */
+#define AT_FLAGS 8 /* Flags */
+#define AT_ENTRY 9 /* Entry point of program */
+#define AT_NOTELF 10 /* Program is not ELF */
+#define AT_UID 11 /* Real uid */
+#define AT_EUID 12 /* Effective uid */
+#define AT_GID 13 /* Real gid */
+#define AT_EGID 14 /* Effective gid */
+
+/* Some more special a_type values describing the hardware. */
+#define AT_PLATFORM 15 /* String identifying platform. */
+#define AT_HWCAP 16 /* Machine dependent hints about
+ processor capabilities. */
+
+/* This entry gives some information about the FPU initialization
+ performed by the kernel. */
+#define AT_FPUCW 17 /* Used FPU control word. */
+
+
+/* Note section contents. Each entry in the note section begins with
+ a header of a fixed form. */
+
+typedef struct
+{
+ Elf32_Word n_namesz; /* Length of the note's name. */
+ Elf32_Word n_descsz; /* Length of the note's descriptor. */
+ Elf32_Word n_type; /* Type of the note. */
+} Elf32_Nhdr;
+
+typedef struct
+{
+ Elf64_Word n_namesz; /* Length of the note's name. */
+ Elf64_Word n_descsz; /* Length of the note's descriptor. */
+ Elf64_Word n_type; /* Type of the note. */
+} Elf64_Nhdr;
+
+/* Known names of notes. */
+
+/* Solaris entries in the note section have this name. */
+#define ELF_NOTE_SOLARIS "SUNW Solaris"
+
+/* Note entries for GNU systems have this name. */
+#define ELF_NOTE_GNU "GNU"
+
+
+/* Defined types of notes for Solaris. */
+
+/* Value of descriptor (one word) is desired pagesize for the binary. */
+#define ELF_NOTE_PAGESIZE_HINT 1
+
+
+/* Defined note types for GNU systems. */
+
+/* ABI information. The descriptor consists of words:
+ word 0: OS descriptor
+ word 1: major version of the ABI
+ word 2: minor version of the ABI
+ word 3: subminor version of the ABI
+*/
+#define ELF_NOTE_ABI 1
+
+/* Known OSes. These value can appear in word 0 of an ELF_NOTE_ABI
+ note section entry. */
+#define ELF_NOTE_OS_LINUX 0
+#define ELF_NOTE_OS_GNU 1
+#define ELF_NOTE_OS_SOLARIS2 2
+
+
+/* Motorola 68k specific definitions. */
+
+/* m68k relocs. */
+
+#define R_68K_NONE 0 /* No reloc */
+#define R_68K_32 1 /* Direct 32 bit */
+#define R_68K_16 2 /* Direct 16 bit */
+#define R_68K_8 3 /* Direct 8 bit */
+#define R_68K_PC32 4 /* PC relative 32 bit */
+#define R_68K_PC16 5 /* PC relative 16 bit */
+#define R_68K_PC8 6 /* PC relative 8 bit */
+#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
+#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
+#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
+#define R_68K_GOT32O 10 /* 32 bit GOT offset */
+#define R_68K_GOT16O 11 /* 16 bit GOT offset */
+#define R_68K_GOT8O 12 /* 8 bit GOT offset */
+#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
+#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
+#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
+#define R_68K_PLT32O 16 /* 32 bit PLT offset */
+#define R_68K_PLT16O 17 /* 16 bit PLT offset */
+#define R_68K_PLT8O 18 /* 8 bit PLT offset */
+#define R_68K_COPY 19 /* Copy symbol at runtime */
+#define R_68K_GLOB_DAT 20 /* Create GOT entry */
+#define R_68K_JMP_SLOT 21 /* Create PLT entry */
+#define R_68K_RELATIVE 22 /* Adjust by program base */
+/* Keep this the last entry. */
+#define R_68K_NUM 23
+
+/* Intel 80386 specific definitions. */
+
+/* i386 relocs. */
+
+#define R_386_NONE 0 /* No reloc */
+#define R_386_32 1 /* Direct 32 bit */
+#define R_386_PC32 2 /* PC relative 32 bit */
+#define R_386_GOT32 3 /* 32 bit GOT entry */
+#define R_386_PLT32 4 /* 32 bit PLT address */
+#define R_386_COPY 5 /* Copy symbol at runtime */
+#define R_386_GLOB_DAT 6 /* Create GOT entry */
+#define R_386_JMP_SLOT 7 /* Create PLT entry */
+#define R_386_RELATIVE 8 /* Adjust by program base */
+#define R_386_GOTOFF 9 /* 32 bit offset to GOT */
+#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
+/* Keep this the last entry. */
+#define R_386_NUM 11
+
+/* SUN SPARC specific definitions. */
+
+/* Values for Elf64_Ehdr.e_flags. */
+
+#define EF_SPARCV9_MM 3
+#define EF_SPARCV9_TSO 0
+#define EF_SPARCV9_PSO 1
+#define EF_SPARCV9_RMO 2
+#define EF_SPARC_EXT_MASK 0xFFFF00
+#define EF_SPARC_SUN_US1 0x000200
+#define EF_SPARC_HAL_R1 0x000400
+
+/* SPARC relocs. */
+
+#define R_SPARC_NONE 0 /* No reloc */
+#define R_SPARC_8 1 /* Direct 8 bit */
+#define R_SPARC_16 2 /* Direct 16 bit */
+#define R_SPARC_32 3 /* Direct 32 bit */
+#define R_SPARC_DISP8 4 /* PC relative 8 bit */
+#define R_SPARC_DISP16 5 /* PC relative 16 bit */
+#define R_SPARC_DISP32 6 /* PC relative 32 bit */
+#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */
+#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */
+#define R_SPARC_HI22 9 /* High 22 bit */
+#define R_SPARC_22 10 /* Direct 22 bit */
+#define R_SPARC_13 11 /* Direct 13 bit */
+#define R_SPARC_LO10 12 /* Truncated 10 bit */
+#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */
+#define R_SPARC_GOT13 14 /* 13 bit GOT entry */
+#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */
+#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */
+#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */
+#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */
+#define R_SPARC_COPY 19 /* Copy symbol at runtime */
+#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */
+#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */
+#define R_SPARC_RELATIVE 22 /* Adjust by program base */
+#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */
+
+/* Additional Sparc64 relocs. */
+
+#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */
+#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */
+#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */
+#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */
+#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */
+#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */
+#define R_SPARC_10 30 /* Direct 10 bit */
+#define R_SPARC_11 31 /* Direct 11 bit */
+#define R_SPARC_64 32 /* Direct 64 bit */
+#define R_SPARC_OLO10 33 /* ?? */
+#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */
+#define R_SPARC_HM10 35 /* High middle 10 bits of ... */
+#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */
+#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */
+#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */
+#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */
+#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */
+#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */
+#define R_SPARC_7 43 /* Direct 7 bit */
+#define R_SPARC_5 44 /* Direct 5 bit */
+#define R_SPARC_6 45 /* Direct 6 bit */
+#define R_SPARC_DISP64 46 /* PC relative 64 bit */
+#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */
+#define R_SPARC_HIX22 48 /* High 22 bit complemented */
+#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */
+#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */
+#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */
+#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */
+#define R_SPARC_REGISTER 53 /* Global register usage */
+#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */
+#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */
+/* Keep this the last entry. */
+#define R_SPARC_NUM 56
+
+/* For Sparc64, legal values for d_tag of Elf64_Dyn. */
+
+#define DT_SPARC_REGISTER 0x70000001
+#define DT_SPARC_NUM 2
+
+/* Bits present in AT_HWCAP, primarily for Sparc32. */
+
+#define HWCAP_SPARC_FLUSH 1 /* The cpu supports flush insn. */
+#define HWCAP_SPARC_STBAR 2
+#define HWCAP_SPARC_SWAP 4
+#define HWCAP_SPARC_MULDIV 8
+#define HWCAP_SPARC_V9 16 /* The cpu is v9, so v8plus is ok. */
+
+/* MIPS R3000 specific definitions. */
+
+/* Legal values for e_flags field of Elf32_Ehdr. */
+
+#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */
+#define EF_MIPS_PIC 2 /* Contains PIC code */
+#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */
+#define EF_MIPS_XGOT 8
+#define EF_MIPS_64BIT_WHIRL 16
+#define EF_MIPS_ABI2 32
+#define EF_MIPS_ABI_ON32 64
+#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
+
+/* Legal values for MIPS architecture level. */
+
+#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
+#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
+#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
+#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
+#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
+
+/* The following are non-official names and should not be used. */
+
+#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
+#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
+#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
+#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
+#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
+
+/* Special section indices. */
+
+#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
+#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
+#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
+#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
+#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
+
+/* Legal values for sh_type field of Elf32_Shdr. */
+
+#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
+#define SHT_MIPS_MSYM 0x70000001
+#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
+#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
+#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
+#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/
+#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
+#define SHT_MIPS_PACKAGE 0x70000007
+#define SHT_MIPS_PACKSYM 0x70000008
+#define SHT_MIPS_RELD 0x70000009
+#define SHT_MIPS_IFACE 0x7000000b
+#define SHT_MIPS_CONTENT 0x7000000c
+#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */
+#define SHT_MIPS_SHDR 0x70000010
+#define SHT_MIPS_FDESC 0x70000011
+#define SHT_MIPS_EXTSYM 0x70000012
+#define SHT_MIPS_DENSE 0x70000013
+#define SHT_MIPS_PDESC 0x70000014
+#define SHT_MIPS_LOCSYM 0x70000015
+#define SHT_MIPS_AUXSYM 0x70000016
+#define SHT_MIPS_OPTSYM 0x70000017
+#define SHT_MIPS_LOCSTR 0x70000018
+#define SHT_MIPS_LINE 0x70000019
+#define SHT_MIPS_RFDESC 0x7000001a
+#define SHT_MIPS_DELTASYM 0x7000001b
+#define SHT_MIPS_DELTAINST 0x7000001c
+#define SHT_MIPS_DELTACLASS 0x7000001d
+#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */
+#define SHT_MIPS_DELTADECL 0x7000001f
+#define SHT_MIPS_SYMBOL_LIB 0x70000020
+#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */
+#define SHT_MIPS_TRANSLATE 0x70000022
+#define SHT_MIPS_PIXIE 0x70000023
+#define SHT_MIPS_XLATE 0x70000024
+#define SHT_MIPS_XLATE_DEBUG 0x70000025
+#define SHT_MIPS_WHIRL 0x70000026
+#define SHT_MIPS_EH_REGION 0x70000027
+#define SHT_MIPS_XLATE_OLD 0x70000028
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+
+/* Legal values for sh_flags field of Elf32_Shdr. */
+
+#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
+#define SHF_MIPS_MERGE 0x20000000
+#define SHF_MIPS_ADDR 0x40000000
+#define SHF_MIPS_STRINGS 0x80000000
+#define SHF_MIPS_NOSTRIP 0x08000000
+#define SHF_MIPS_LOCAL 0x04000000
+#define SHF_MIPS_NAMES 0x02000000
+#define SHF_MIPS_NODUPE 0x01000000
+
+
+/* Symbol tables. */
+
+/* MIPS specific values for `st_other'. */
+#define STO_MIPS_DEFAULT 0x0
+#define STO_MIPS_INTERNAL 0x1
+#define STO_MIPS_HIDDEN 0x2
+#define STO_MIPS_PROTECTED 0x3
+#define STO_MIPS_SC_ALIGN_UNUSED 0xff
+
+/* MIPS specific values for `st_info'. */
+#define STB_MIPS_SPLIT_COMMON 13
+
+/* Entries found in sections of type SHT_MIPS_GPTAB. */
+
+typedef union
+{
+ struct
+ {
+ Elf32_Word gt_current_g_value; /* -G value used for compilation */
+ Elf32_Word gt_unused; /* Not used */
+ } gt_header; /* First entry in section */
+ struct
+ {
+ Elf32_Word gt_g_value; /* If this value were used for -G */
+ Elf32_Word gt_bytes; /* This many bytes would be used */
+ } gt_entry; /* Subsequent entries in section */
+} Elf32_gptab;
+
+/* Entry found in sections of type SHT_MIPS_REGINFO. */
+
+typedef struct
+{
+ Elf32_Word ri_gprmask; /* General registers used */
+ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
+ Elf32_Sword ri_gp_value; /* $gp register value */
+} Elf32_RegInfo;
+
+/* Entries found in sections of type SHT_MIPS_OPTIONS. */
+
+typedef struct
+{
+ unsigned char kind; /* Determines interpretation of the
+ variable part of descriptor. */
+ unsigned char size; /* Size of descriptor, including header. */
+ Elf32_Section section; /* Section header index of section affected,
+ 0 for global options. */
+ Elf32_Word info; /* Kind-specific information. */
+} Elf_Options;
+
+/* Values for `kind' field in Elf_Options. */
+
+#define ODK_NULL 0 /* Undefined. */
+#define ODK_REGINFO 1 /* Register usage information. */
+#define ODK_EXCEPTIONS 2 /* Exception processing options. */
+#define ODK_PAD 3 /* Section padding options. */
+#define ODK_HWPATCH 4 /* Hardware workarounds performed */
+#define ODK_FILL 5 /* record the fill value used by the linker. */
+#define ODK_TAGS 6 /* reserve space for desktop tools to write. */
+#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */
+#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */
+
+/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */
+
+#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */
+#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */
+#define OEX_PAGE0 0x10000 /* page zero must be mapped. */
+#define OEX_SMM 0x20000 /* Force sequential memory mode? */
+#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */
+#define OEX_PRECISEFP OEX_FPDBUG
+#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */
+
+#define OEX_FPU_INVAL 0x10
+#define OEX_FPU_DIV0 0x08
+#define OEX_FPU_OFLO 0x04
+#define OEX_FPU_UFLO 0x02
+#define OEX_FPU_INEX 0x01
+
+/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */
+
+#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */
+#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */
+#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */
+#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */
+
+#define OPAD_PREFIX 0x1
+#define OPAD_POSTFIX 0x2
+#define OPAD_SYMBOL 0x4
+
+/* Entry found in `.options' section. */
+
+typedef struct
+{
+ Elf32_Word hwp_flags1; /* Extra flags. */
+ Elf32_Word hwp_flags2; /* Extra flags. */
+} Elf_Options_Hw;
+
+/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */
+
+#define OHWA0_R4KEOP_CHECKED 0x00000001
+#define OHWA1_R4KEOP_CLEAN 0x00000002
+
+/* MIPS relocs. */
+
+#define R_MIPS_NONE 0 /* No reloc */
+#define R_MIPS_16 1 /* Direct 16 bit */
+#define R_MIPS_32 2 /* Direct 32 bit */
+#define R_MIPS_REL32 3 /* PC relative 32 bit */
+#define R_MIPS_26 4 /* Direct 26 bit shifted */
+#define R_MIPS_HI16 5 /* High 16 bit */
+#define R_MIPS_LO16 6 /* Low 16 bit */
+#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
+#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
+#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
+#define R_MIPS_PC16 10 /* PC relative 16 bit */
+#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
+#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
+
+#define R_MIPS_SHIFT5 16
+#define R_MIPS_SHIFT6 17
+#define R_MIPS_64 18
+#define R_MIPS_GOT_DISP 19
+#define R_MIPS_GOT_PAGE 20
+#define R_MIPS_GOT_OFST 21
+#define R_MIPS_GOT_HI16 22
+#define R_MIPS_GOT_LO16 23
+#define R_MIPS_SUB 24
+#define R_MIPS_INSERT_A 25
+#define R_MIPS_INSERT_B 26
+#define R_MIPS_DELETE 27
+#define R_MIPS_HIGHER 28
+#define R_MIPS_HIGHEST 29
+#define R_MIPS_CALL_HI16 30
+#define R_MIPS_CALL_LO16 31
+#define R_MIPS_SCN_DISP 32
+#define R_MIPS_REL16 33
+#define R_MIPS_ADD_IMMEDIATE 34
+#define R_MIPS_PJUMP 35
+#define R_MIPS_RELGOT 36
+#define R_MIPS_JALR 37
+/* Keep this the last entry. */
+#define R_MIPS_NUM 38
+
+/* Legal values for p_type field of Elf32_Phdr. */
+
+#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
+#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */
+#define PT_MIPS_OPTIONS 0x70000002
+
+/* Special program header types. */
+
+#define PF_MIPS_LOCAL 0x10000000
+
+/* Legal values for d_tag field of Elf32_Dyn. */
+
+#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */
+#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
+#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */
+#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
+#define DT_MIPS_FLAGS 0x70000005 /* Flags */
+#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
+#define DT_MIPS_MSYM 0x70000007
+#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */
+#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */
+#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */
+#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */
+#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */
+#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */
+#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
+#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
+#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
+#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */
+#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */
+#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in
+ DT_MIPS_DELTA_CLASS. */
+#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */
+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in
+ DT_MIPS_DELTA_INSTANCE. */
+#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */
+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in
+ DT_MIPS_DELTA_RELOC. */
+#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta
+ relocations refer to. */
+#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in
+ DT_MIPS_DELTA_SYM. */
+#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the
+ class declaration. */
+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in
+ DT_MIPS_DELTA_CLASSSYM. */
+#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */
+#define DT_MIPS_PIXIE_INIT 0x70000023
+#define DT_MIPS_SYMBOL_LIB 0x70000024
+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
+#define DT_MIPS_LOCAL_GOTIDX 0x70000026
+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
+#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */
+#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */
+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
+#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */
+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve
+ function stored in GOT. */
+#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added
+ by rld on dlopen() calls. */
+#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
+#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
+#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
+#define DT_MIPS_NUM 0x32
+
+/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */
+
+#define RHF_NONE 0 /* No flags */
+#define RHF_QUICKSTART (1 << 0) /* Use quickstart */
+#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */
+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */
+#define RHF_NO_MOVE (1 << 3)
+#define RHF_SGI_ONLY (1 << 4)
+#define RHF_GUARANTEE_INIT (1 << 5)
+#define RHF_DELTA_C_PLUS_PLUS (1 << 6)
+#define RHF_GUARANTEE_START_INIT (1 << 7)
+#define RHF_PIXIE (1 << 8)
+#define RHF_DEFAULT_DELAY_LOAD (1 << 9)
+#define RHF_REQUICKSTART (1 << 10)
+#define RHF_REQUICKSTARTED (1 << 11)
+#define RHF_CORD (1 << 12)
+#define RHF_NO_UNRES_UNDEF (1 << 13)
+#define RHF_RLD_ORDER_SAFE (1 << 14)
+
+/* Entries found in sections of type SHT_MIPS_LIBLIST. */
+
+typedef struct
+{
+ Elf32_Word l_name; /* Name (string table index) */
+ Elf32_Word l_time_stamp; /* Timestamp */
+ Elf32_Word l_checksum; /* Checksum */
+ Elf32_Word l_version; /* Interface version */
+ Elf32_Word l_flags; /* Flags */
+} Elf32_Lib;
+
+typedef struct
+{
+ Elf64_Word l_name; /* Name (string table index) */
+ Elf64_Word l_time_stamp; /* Timestamp */
+ Elf64_Word l_checksum; /* Checksum */
+ Elf64_Word l_version; /* Interface version */
+ Elf64_Word l_flags; /* Flags */
+} Elf64_Lib;
+
+
+/* Legal values for l_flags. */
+
+#define LL_NONE 0
+#define LL_EXACT_MATCH (1 << 0) /* Require exact match */
+#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
+#define LL_REQUIRE_MINOR (1 << 2)
+#define LL_EXPORTS (1 << 3)
+#define LL_DELAY_LOAD (1 << 4)
+#define LL_DELTA (1 << 5)
+
+/* Entries found in sections of type SHT_MIPS_CONFLICT. */
+
+typedef Elf32_Addr Elf32_Conflict;
+
+
+/* HPPA specific definitions. */
+
+/* Legal values for e_flags field of Elf32_Ehdr. */
+
+#define EF_PARISC_TRAPNL 1 /* Trap nil pointer dereference. */
+#define EF_PARISC_EXT 2 /* Program uses arch. extensions. */
+#define EF_PARISC_ARCH 0xffff0000 /* Architecture version. */
+/* Defined values are:
+ 0x020b PA-RISC 1.0 big-endian
+ 0x0210 PA-RISC 1.1 big-endian
+ 0x028b PA-RISC 1.0 little-endian
+ 0x0290 PA-RISC 1.1 little-endian
+*/
+
+/* Legal values for sh_type field of Elf32_Shdr. */
+
+#define SHT_PARISC_GOT 0x70000000 /* GOT for external data. */
+#define SHT_PARISC_ARCH 0x70000001 /* Architecture extensions. */
+#define SHT_PARISC_GLOBAL 0x70000002 /* Definition of $global$. */
+#define SHT_PARISC_MILLI 0x70000003 /* Millicode routines. */
+#define SHT_PARISC_UNWIND 0x70000004 /* Unwind information. */
+#define SHT_PARISC_PLT 0x70000005 /* Procedure linkage table. */
+#define SHT_PARISC_SDATA 0x70000006 /* Short initialized data. */
+#define SHT_PARISC_SBSS 0x70000007 /* Short uninitialized data. */
+#define SHT_PARISC_SYMEXTN 0x70000008 /* Argument/relocation info. */
+#define SHT_PARISC_STUBS 0x70000009 /* Linker stubs. */
+
+/* Legal values for sh_flags field of Elf32_Shdr. */
+
+#define SHF_PARISC_GLOBAL 0x10000000 /* Section defines dp. */
+#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */
+
+/* Legal values for ST_TYPE subfield of st_info (symbol type). */
+
+#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */
+
+/* HPPA relocs. */
+
+#define R_PARISC_NONE 0 /* No reloc. */
+#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */
+#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */
+#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */
+#define R_PARISC_DIR14R 4 /* Right 14 bits of eff. address. */
+#define R_PARISC_PCREL21L 5 /* PC-relative, left 21 bits. */
+#define R_PARISC_PCREL14R 6 /* PC-relative, right 14 bits. */
+#define R_PARISC_PCREL17C 7 /* Conditional PC-relative, ignore
+ if displacement > 17bits. */
+#define R_PARISC_PCREL17F 8 /* Conditional PC-relative, must
+ fit in 17bits. */
+#define R_PARISC_DPREL21L 9 /* DP-relative, left 21 bits. */
+#define R_PARISC_DPREL14R 10 /* DP-relative, right 14 bits. */
+#define R_PARISC_DPREL14F 11 /* DP-relative, must bit in 14 bits. */
+#define R_PARISC_DLTREL21L 12 /* DLT-relative, left 21 bits. */
+#define R_PARISC_DLTREL14R 13 /* DLT-relative, right 14 bits. */
+#define R_PARISC_DLTREL14F 14 /* DLT-relative, must fit in 14 bits.*/
+#define R_PARISC_DLTIND21L 15 /* DLT-relative indirect, left
+ 21 bits. */
+#define R_PARISC_DLTIND14R 16 /* DLT-relative indirect, right
+ 14 bits. */
+#define R_PARISC_DLTIND14F 17 /* DLT-relative indirect, must fit
+ int 14 bits. */
+#define R_PARISC_PLABEL32 18 /* Direct 32-bit reference to proc. */
+
+/* Alpha specific definitions. */
+
+/* Legal values for e_flags field of Elf64_Ehdr. */
+
+#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */
+#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */
+
+/* Legal values for sh_type field of Elf64_Shdr. */
+
+/* These two are primerily concerned with ECOFF debugging info. */
+#define SHT_ALPHA_DEBUG 0x70000001
+#define SHT_ALPHA_REGINFO 0x70000002
+
+/* Legal values for sh_flags field of Elf64_Shdr. */
+
+#define SHF_ALPHA_GPREL 0x10000000
+
+/* Legal values for st_other field of Elf64_Sym. */
+#define STO_ALPHA_NOPV 0x80 /* No PV required. */
+#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */
+
+/* Alpha relocs. */
+
+#define R_ALPHA_NONE 0 /* No reloc */
+#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
+#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
+#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
+#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
+#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
+#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
+#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
+#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
+#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
+#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
+#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
+#define R_ALPHA_OP_PUSH 12 /* OP stack push */
+#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */
+#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */
+#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */
+#define R_ALPHA_GPVALUE 16
+#define R_ALPHA_GPRELHIGH 17
+#define R_ALPHA_GPRELLOW 18
+#define R_ALPHA_IMMED_GP_16 19
+#define R_ALPHA_IMMED_GP_HI32 20
+#define R_ALPHA_IMMED_SCN_HI32 21
+#define R_ALPHA_IMMED_BR_HI32 22
+#define R_ALPHA_IMMED_LO32 23
+#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
+#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
+#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
+#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
+/* Keep this the last entry. */
+#define R_ALPHA_NUM 28
+
+
+/* PowerPC specific declarations */
+
+/* PowerPC relocations defined by the ABIs */
+#define R_PPC_NONE 0
+#define R_PPC_ADDR32 1 /* 32bit absolute address */
+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
+#define R_PPC_ADDR16 3 /* 16bit absolute address */
+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
+#define R_PPC_ADDR14_BRTAKEN 8
+#define R_PPC_ADDR14_BRNTAKEN 9
+#define R_PPC_REL24 10 /* PC relative 26 bit */
+#define R_PPC_REL14 11 /* PC relative 16 bit */
+#define R_PPC_REL14_BRTAKEN 12
+#define R_PPC_REL14_BRNTAKEN 13
+#define R_PPC_GOT16 14
+#define R_PPC_GOT16_LO 15
+#define R_PPC_GOT16_HI 16
+#define R_PPC_GOT16_HA 17
+#define R_PPC_PLTREL24 18
+#define R_PPC_COPY 19
+#define R_PPC_GLOB_DAT 20
+#define R_PPC_JMP_SLOT 21
+#define R_PPC_RELATIVE 22
+#define R_PPC_LOCAL24PC 23
+#define R_PPC_UADDR32 24
+#define R_PPC_UADDR16 25
+#define R_PPC_REL32 26
+#define R_PPC_PLT32 27
+#define R_PPC_PLTREL32 28
+#define R_PPC_PLT16_LO 29
+#define R_PPC_PLT16_HI 30
+#define R_PPC_PLT16_HA 31
+#define R_PPC_SDAREL16 32
+#define R_PPC_SECTOFF 33
+#define R_PPC_SECTOFF_LO 34
+#define R_PPC_SECTOFF_HI 35
+#define R_PPC_SECTOFF_HA 36
+/* Keep this the last entry. */
+#define R_PPC_NUM 37
+
+/* The remaining relocs are from the Embedded ELF ABI, and are not
+ in the SVR4 ELF ABI. */
+#define R_PPC_EMB_NADDR32 101
+#define R_PPC_EMB_NADDR16 102
+#define R_PPC_EMB_NADDR16_LO 103
+#define R_PPC_EMB_NADDR16_HI 104
+#define R_PPC_EMB_NADDR16_HA 105
+#define R_PPC_EMB_SDAI16 106
+#define R_PPC_EMB_SDA2I16 107
+#define R_PPC_EMB_SDA2REL 108
+#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
+#define R_PPC_EMB_MRKREF 110
+#define R_PPC_EMB_RELSEC16 111
+#define R_PPC_EMB_RELST_LO 112
+#define R_PPC_EMB_RELST_HI 113
+#define R_PPC_EMB_RELST_HA 114
+#define R_PPC_EMB_BIT_FLD 115
+#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
+
+/* Diab tool relocations. */
+#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
+#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
+#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
+#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
+#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
+#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
+
+/* This is a phony reloc to handle any old fashioned TOC16 references
+ that may still be in object files. */
+#define R_PPC_TOC16 255
+
+
+/* ARM specific declarations */
+
+/* Processor specific flags for the ELF header e_flags field. */
+#define EF_ARM_RELEXEC 0x01
+#define EF_ARM_HASENTRY 0x02
+#define EF_ARM_INTERWORK 0x04
+#define EF_ARM_APCS_26 0x08
+#define EF_ARM_APCS_FLOAT 0x10
+#define EF_ARM_PIC 0x20
+#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use */
+#define EF_NEW_ABI 0x80
+#define EF_OLD_ABI 0x100
+
+/* Additional symbol types for Thumb */
+#define STT_ARM_TFUNC 0xd
+
+/* ARM-specific values for sh_flags */
+#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */
+#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined
+ in the input to a link step */
+
+/* ARM-specific program header flags */
+#define PF_ARM_SB 0x10000000 /* Segment contains the location
+ addressed by the static base */
+
+/* ARM relocs. */
+#define R_ARM_NONE 0 /* No reloc */
+#define R_ARM_PC24 1 /* PC relative 26 bit branch */
+#define R_ARM_ABS32 2 /* Direct 32 bit */
+#define R_ARM_REL32 3 /* PC relative 32 bit */
+#define R_ARM_PC13 4
+#define R_ARM_ABS16 5 /* Direct 16 bit */
+#define R_ARM_ABS12 6 /* Direct 12 bit */
+#define R_ARM_THM_ABS5 7
+#define R_ARM_ABS8 8 /* Direct 8 bit */
+#define R_ARM_SBREL32 9
+#define R_ARM_THM_PC22 10
+#define R_ARM_THM_PC8 11
+#define R_ARM_AMP_VCALL9 12
+#define R_ARM_SWI24 13
+#define R_ARM_THM_SWI8 14
+#define R_ARM_XPC25 15
+#define R_ARM_THM_XPC22 16
+#define R_ARM_COPY 20 /* Copy symbol at runtime */
+#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
+#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
+#define R_ARM_RELATIVE 23 /* Adjust by program base */
+#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */
+#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */
+#define R_ARM_GOT32 26 /* 32 bit GOT entry */
+#define R_ARM_PLT32 27 /* 32 bit PLT address */
+#define R_ARM_GNU_VTENTRY 100
+#define R_ARM_GNU_VTINHERIT 101
+#define R_ARM_THM_PC11 102 /* thumb unconditional branch */
+#define R_ARM_THM_PC9 103 /* thumb conditional branch */
+#define R_ARM_RXPC25 249
+#define R_ARM_RSBREL32 250
+#define R_ARM_THM_RPC22 251
+#define R_ARM_RREL32 252
+#define R_ARM_RABS22 253
+#define R_ARM_RPC24 254
+#define R_ARM_RBASE 255
+/* Keep this the last entry. */
+#define R_ARM_NUM 256
+
+__END_DECLS
+
+#endif /* elf.h */
diff --git a/include/endian.h b/include/endian.h
index 593b41963..109678aea 100644
--- a/include/endian.h
+++ b/include/endian.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,7 @@
#ifndef _ENDIAN_H
#define _ENDIAN_H 1
+
#include <features.h>
/* Definitions for byte order, according to significance of bytes, from low
@@ -31,13 +32,19 @@
#define __PDP_ENDIAN 3412
/* This file defines `__BYTE_ORDER' for the particular machine. */
-#include <bytesex.h>
+#include <bits/endian.h>
+
+/* Some machines may need to use a different endianness for floating point
+ values. */
+#ifndef __FLOAT_WORD_ORDER
+# define __FLOAT_WORD_ORDER __BYTE_ORDER
+#endif
#ifdef __USE_BSD
-#define LITTLE_ENDIAN __LITTLE_ENDIAN
-#define BIG_ENDIAN __BIG_ENDIAN
-#define PDP_ENDIAN __PDP_ENDIAN
-#define BYTE_ORDER __BYTE_ORDER
+# define LITTLE_ENDIAN __LITTLE_ENDIAN
+# define BIG_ENDIAN __BIG_ENDIAN
+# define PDP_ENDIAN __PDP_ENDIAN
+# define BYTE_ORDER __BYTE_ORDER
#endif
#endif /* endian.h */
diff --git a/include/features.h b/include/features.h
index b14e8e224..e890edebe 100644
--- a/include/features.h
+++ b/include/features.h
@@ -38,6 +38,9 @@
#define __CONSTVALUE
#define __CONSTVALUE2
+#define __USE_BSD
+#define __USE_MISC
+#define __USE_POSIX
#define _POSIX_THREAD_SAFE_FUNCTIONS
#include <sys/cdefs.h>
diff --git a/include/limits.h b/include/limits.h
index e03e558fd..21520f3c9 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -1,54 +1,59 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/*
- * ANSI Standard: 4.14/2.2.4.2 Limits of integral types <limits.h>
+ * ISO C Standard: 4.14/2.2.4.2 Limits of integral types <limits.h>
*/
-#ifndef _LIMITS_H
+#ifndef _LIBC_LIMITS_H_
+#define _LIBC_LIMITS_H_ 1
-#define _LIMITS_H 1
#include <features.h>
#ifdef __USE_POSIX
/* POSIX adds things to <limits.h>. */
-#include <posix1_lim.h>
+# include <bits/posix1_lim.h>
#endif
#ifdef __USE_POSIX2
-#include <posix2_lim.h>
+# include <bits/posix2_lim.h>
#endif
+#ifdef __USE_XOPEN
+# include <bits/xopen_lim.h>
+#endif
+
+
+/* Maximum length of any multibyte character in any locale.
+ We define this value here since the gcc header does not define
+ the correct value. */
+#define MB_LEN_MAX 6
-/* Only if gcc 2.x is used and -traditional is not used, we can use
- * #include_next.
-#if __GNUC__ >= 2 && __STDC__
- */
-#if __GNUC__ >= 2 && !defined(_GCC_LIMITS_H_) && !defined(_GCC_LIMITS_H)
- /* Get the compiler's limits.h, which defines all the ANSI
- * constants.
- */
- /* This tells it not to look for another. */
-# define _LIBC_LIMITS_H
-# define _LIBC_LIMITS_H_
-# include_next <limits.h>
-#else /* Not GCC 2. */
+/* If we are not using GNU CC we have to define all the symbols ourself.
+ Otherwise use gcc's definitions (see below). */
+#if !defined __GNUC__ || __GNUC__ < 2
+
+/* We only protect from multiple inclusion here, because all the other
+ #include's protect themselves, and in GCC 2 we may #include_next through
+ multiple copies of this file before we get to GCC's. */
+# ifndef _LIMITS_H
+# define _LIMITS_H 1
/* We don't have #include_next.
Define ANSI <limits.h> for standard 32-bit words. */
@@ -57,80 +62,72 @@ Cambridge, MA 02139, USA. */
and 32-bit `int's and `long int's. */
/* Number of bits in a `char'. */
-#define CHAR_BIT 8
-
-/* Maximum length of any multibyte character in any locale.
- Locale-writers should change this as necessary. */
-#define MB_LEN_MAX 1
+# define CHAR_BIT 8
/* Minimum and maximum values a `signed char' can hold. */
-#define SCHAR_MIN (-128)
-#define SCHAR_MAX 127
+# define SCHAR_MIN (-128)
+# define SCHAR_MAX 127
/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
-#ifdef __STDC__
-#define UCHAR_MAX 255U
-#else
-#define UCHAR_MAX 255
-#endif
+# define UCHAR_MAX 255
/* Minimum and maximum values a `char' can hold. */
-#ifdef __CHAR_UNSIGNED__
-#define CHAR_MIN 0
-#define CHAR_MAX UCHAR_MAX
-#else
-#define CHAR_MIN SCHAR_MIN
-#define CHAR_MAX SCHAR_MAX
-#endif
+# ifdef __CHAR_UNSIGNED__
+# define CHAR_MIN 0
+# define CHAR_MAX UCHAR_MAX
+# else
+# define CHAR_MIN SCHAR_MIN
+# define CHAR_MAX SCHAR_MAX
+# endif
/* Minimum and maximum values a `signed short int' can hold. */
-#define SHRT_MIN (-32768)
-#define SHRT_MAX 32767
+# define SHRT_MIN (-32768)
+# define SHRT_MAX 32767
/* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */
-#define USHRT_MAX 65535
+# define USHRT_MAX 65535
/* Minimum and maximum values a `signed int' can hold. */
-#define INT_MIN (- INT_MAX - 1)
-#define INT_MAX 2147483647
+# define INT_MIN (-INT_MAX - 1)
+# define INT_MAX 2147483647
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
-#ifdef __STDC__
-#define UINT_MAX 4294967295U
-#else
-#define UINT_MAX 4294967295
-#endif
+# ifdef __STDC__
+# define UINT_MAX 4294967295U
+# else
+# define UINT_MAX 4294967295
+# endif
/* Minimum and maximum values a `signed long int' can hold. */
-#define LONG_MIN INT_MIN
-#define LONG_MAX INT_MAX
+# ifdef __alpha__
+# define LONG_MAX 9223372036854775807L
+# else
+# define LONG_MAX 2147483647L
+# endif
+# define LONG_MIN (-LONG_MAX - 1L)
/* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
-#define ULONG_MAX UINT_MAX
-
+# ifdef __alpha__
+# define ULONG_MAX 18446744073709551615UL
+# else
+# ifdef __STDC__
+# define ULONG_MAX 4294967295UL
+# else
+# define ULONG_MAX 4294967295L
+# endif
+# endif
+
+# endif /* limits.h */
#endif /* GCC 2. */
+#endif /* !_LIBC_LIMITS_H_ */
-#ifndef RAND_MAX
-/* The largest number rand will return (same as INT_MAX). */
-#define RAND_MAX INT_MAX
-#endif
-
-#ifdef __SVR4_I386_ABI_L1__
-
-#define NL_ARGMAX 9
-#define NL_LANGMAX 14
-#define NL_MSGMAX 32767
-#define NL_NMAX 1
-#define NL_SETMAX 255
-#define NL_TEXTMAX 255
-#define NZERO 20
+ /* Get the compiler's limits.h, which defines almost all the ISO constants.
-#define WORD_BIT 32
-#define LONG_BIT 32
-
-#define FCHR_MAX 1048576
-
-#endif /* __SVR4_I386_ABI_L1__ */
-
-#endif /* limits.h */
+ We put this #include_next outside the double inclusion check because
+ it should be possible to include this file more than once and still get
+ the definitions from gcc's header. */
+#if defined __GNUC__ && !defined _GCC_LIMITS_H_
+/* `_GCC_LIMITS_H_' is what GCC's file defines. */
+# include_next <limits.h>
+#endif
diff --git a/include/netinet/ether.h b/include/netinet/ether.h
new file mode 100644
index 000000000..c7985d7ac
--- /dev/null
+++ b/include/netinet/ether.h
@@ -0,0 +1,54 @@
+/* Functions for storing Ethernet addresses in ASCII and mapping to hostnames.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _NETINET_ETHER_H
+#define _NETINET_ETHER_H 1
+
+#include <features.h>
+
+/* Get definition of `struct ether_addr'. */
+#include <netinet/if_ether.h>
+
+__BEGIN_DECLS
+
+/* Convert 48 bit Ethernet ADDRess to ASCII. */
+extern char *ether_ntoa __P ((__const struct ether_addr *__addr));
+extern char *ether_ntoa_r __P ((__const struct ether_addr *__addr,
+ char *__buf));
+
+/* Convert ASCII string S to 48 bit Ethernet address. */
+extern struct ether_addr *ether_aton __P ((__const char *__asc));
+extern struct ether_addr *ether_aton_r __P ((__const char *__asc,
+ struct ether_addr *__addr));
+
+/* Map 48 bit Ethernet number ADDR to HOSTNAME. */
+extern int ether_ntohost __P ((char *__hostname,
+ __const struct ether_addr *__addr));
+
+/* Map HOSTNAME to 48 bit Ethernet address. */
+extern int ether_hostton __P ((__const char *__hostname,
+ struct ether_addr *__addr));
+
+/* Scan LINE and set ADDR and HOSTNAME. */
+extern int ether_line __P ((__const char *__line, struct ether_addr *__addr,
+ char *__hostname));
+
+__END_DECLS
+
+#endif /* netinet/ether.h */
diff --git a/include/netinet/icmp6.h b/include/netinet/icmp6.h
new file mode 100644
index 000000000..5a3863953
--- /dev/null
+++ b/include/netinet/icmp6.h
@@ -0,0 +1,232 @@
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _NETINET_ICMP6_H
+#define _NETINET_ICMP6_H 1
+
+#include <inttypes.h>
+#include <string.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#define ICMP6_FILTER 1
+
+#define ICMP6_FILTER_BLOCK 1
+#define ICMP6_FILTER_PASS 2
+#define ICMP6_FILTER_BLOCKOTHERS 3
+#define ICMP6_FILTER_PASSONLY 4
+
+struct icmp6_filter
+ {
+ uint32_t data[8];
+ };
+
+struct icmp6_hdr
+ {
+ uint8_t icmp6_type; /* type field */
+ uint8_t icmp6_code; /* code field */
+ uint16_t icmp6_cksum; /* checksum field */
+ union
+ {
+ uint32_t icmp6_un_data32[1]; /* type-specific field */
+ uint16_t icmp6_un_data16[2]; /* type-specific field */
+ uint8_t icmp6_un_data8[4]; /* type-specific field */
+ } icmp6_dataun;
+ };
+
+#define icmp6_data32 icmp6_dataun.icmp6_un_data32
+#define icmp6_data16 icmp6_dataun.icmp6_un_data16
+#define icmp6_data8 icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr icmp6_data32[0] /* parameter prob */
+#define icmp6_mtu icmp6_data32[0] /* packet too big */
+#define icmp6_id icmp6_data16[0] /* echo request/reply */
+#define icmp6_seq icmp6_data16[1] /* echo request/reply */
+#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
+
+#define ICMP6_DST_UNREACH 1
+#define ICMP6_PACKET_TOO_BIG 2
+#define ICMP6_TIME_EXCEEDED 3
+#define ICMP6_PARAM_PROB 4
+
+#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */
+
+#define ICMP6_ECHO_REQUEST 128
+#define ICMP6_ECHO_REPLY 129
+#define ICMP6_MEMBERSHIP_QUERY 130
+#define ICMP6_MEMBERSHIP_REPORT 131
+#define ICMP6_MEMBERSHIP_REDUCTION 132
+
+#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
+#define ICMP6_DST_UNREACH_ADMIN 1 /* communication with destination */
+ /* administratively prohibited */
+#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor */
+#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
+#define ICMP6_DST_UNREACH_NOPORT 4 /* bad port */
+
+#define ICMP6_TIME_EXCEED_TRANSIT 0 /* Hop Limit == 0 in transit */
+#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* Reassembly time out */
+
+#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
+#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized Next Header */
+#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized IPv6 option */
+
+#define ICMP6_FILTER_WILLPASS(type, filterp) \
+ ((((filterp)->data[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+
+#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
+ ((((filterp)->data[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+
+#define ICMP6_FILTER_SETPASS(type, filterp) \
+ ((((filterp)->data[(type) >> 5]) &= ~(1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETBLOCK(type, filterp) \
+ ((((filterp)->data[(type) >> 5]) |= (1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETPASSALL(filterp) \
+ memset (filterp, 0, sizeof (struct icmp6_filter));
+
+#define ICMP6_FILTER_SETBLOCKALL(filterp) \
+ memset (filterp, 0xFF, sizeof (struct icmp6_filter));
+
+#define ND_ROUTER_SOLICIT 133
+#define ND_ROUTER_ADVERT 134
+#define ND_NEIGHBOR_SOLICIT 135
+#define ND_NEIGHBOR_ADVERT 136
+#define ND_REDIRECT 137
+
+struct nd_router_solicit /* router solicitation */
+ {
+ struct icmp6_hdr nd_rs_hdr;
+ /* could be followed by options */
+ };
+
+#define nd_rs_type nd_rs_hdr.icmp6_type
+#define nd_rs_code nd_rs_hdr.icmp6_code
+#define nd_rs_cksum nd_rs_hdr.icmp6_cksum
+#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]
+
+struct nd_router_advert /* router advertisement */
+ {
+ struct icmp6_hdr nd_ra_hdr;
+ uint32_t nd_ra_reachable; /* reachable time */
+ uint32_t nd_ra_retransmit; /* retransmit timer */
+ /* could be followed by options */
+ };
+
+#define nd_ra_type nd_ra_hdr.icmp6_type
+#define nd_ra_code nd_ra_hdr.icmp6_code
+#define nd_ra_cksum nd_ra_hdr.icmp6_cksum
+#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]
+#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
+#define ND_RA_FLAG_MANAGED 0x80
+#define ND_RA_FLAG_OTHER 0x40
+#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
+
+struct nd_neighbor_solicit /* neighbor solicitation */
+ {
+ struct icmp6_hdr nd_ns_hdr;
+ struct in6_addr nd_ns_target; /* target address */
+ /* could be followed by options */
+ };
+
+#define nd_ns_type nd_ns_hdr.icmp6_type
+#define nd_ns_code nd_ns_hdr.icmp6_code
+#define nd_ns_cksum nd_ns_hdr.icmp6_cksum
+#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
+
+struct nd_neighbor_advert /* neighbor advertisement */
+ {
+ struct icmp6_hdr nd_na_hdr;
+ struct in6_addr nd_na_target; /* target address */
+ /* could be followed by options */
+ };
+
+#define nd_na_type nd_na_hdr.icmp6_type
+#define nd_na_code nd_na_hdr.icmp6_code
+#define nd_na_cksum nd_na_hdr.icmp6_cksum
+#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
+#if BYTE_ORDER == BIG_ENDIAN
+#define ND_NA_FLAG_ROUTER 0x80000000
+#define ND_NA_FLAG_SOLICITED 0x40000000
+#define ND_NA_FLAG_OVERRIDE 0x20000000
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#define ND_NA_FLAG_ROUTER 0x00000080
+#define ND_NA_FLAG_SOLICITED 0x00000040
+#define ND_NA_FLAG_OVERRIDE 0x00000020
+#endif
+
+struct nd_redirect /* redirect */
+ {
+ struct icmp6_hdr nd_rd_hdr;
+ struct in6_addr nd_rd_target; /* target address */
+ struct in6_addr nd_rd_dst; /* destination address */
+ /* could be followed by options */
+ };
+
+#define nd_rd_type nd_rd_hdr.icmp6_type
+#define nd_rd_code nd_rd_hdr.icmp6_code
+#define nd_rd_cksum nd_rd_hdr.icmp6_cksum
+#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
+
+struct nd_opt_hdr /* Neighbor discovery option header */
+ {
+ uint8_t nd_opt_type;
+ uint8_t nd_opt_len; /* in units of 8 octets */
+ /* followed by option specific data */
+ };
+
+#define ND_OPT_SOURCE_LINKADDR 1
+#define ND_OPT_TARGET_LINKADDR 2
+#define ND_OPT_PREFIX_INFORMATION 3
+#define ND_OPT_REDIRECTED_HEADER 4
+#define ND_OPT_MTU 5
+
+struct nd_opt_prefix_info /* prefix information */
+ {
+ uint8_t nd_opt_pi_type;
+ uint8_t nd_opt_pi_len;
+ uint8_t nd_opt_pi_prefix_len;
+ uint8_t nd_opt_pi_flags_reserved;
+ uint32_t nd_opt_pi_valid_time;
+ uint32_t nd_opt_pi_preferred_time;
+ uint32_t nd_opt_pi_reserved2;
+ struct in6_addr nd_opt_pi_prefix;
+ };
+
+#define ND_OPT_PI_FLAG_ONLINK 0x80
+#define ND_OPT_PI_FLAG_AUTO 0x40
+
+struct nd_opt_rd_hdr /* redirected header */
+ {
+ uint8_t nd_opt_rh_type;
+ uint8_t nd_opt_rh_len;
+ uint16_t nd_opt_rh_reserved1;
+ uint32_t nd_opt_rh_reserved2;
+ /* followed by IP header and data */
+ };
+
+struct nd_opt_mtu /* MTU option */
+ {
+ uint8_t nd_opt_mtu_type;
+ uint8_t nd_opt_mtu_len;
+ uint16_t nd_opt_mtu_reserved;
+ uint32_t nd_opt_mtu_mtu;
+ };
+
+
+#endif /* netinet/icmpv6.h */
diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
new file mode 100644
index 000000000..7194490f5
--- /dev/null
+++ b/include/netinet/if_ether.h
@@ -0,0 +1,109 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef __NETINET_IF_ETHER_H
+
+#define __NETINET_IF_ETHER_H 1
+#include <features.h>
+#include <sys/types.h>
+
+/* Get definitions from kernel header file. */
+#include <linux/if_ether.h>
+
+#ifdef __USE_BSD
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)if_ether.h 8.3 (Berkeley) 5/2/95
+ * $FreeBSD$
+ */
+
+#include <net/ethernet.h>
+#include <net/if_arp.h>
+
+__BEGIN_DECLS
+/*
+ * Ethernet Address Resolution Protocol.
+ *
+ * See RFC 826 for protocol description. Structure below is adapted
+ * to resolving internet addresses. Field names used correspond to
+ * RFC 826.
+ */
+struct ether_arp {
+ struct arphdr ea_hdr; /* fixed-size header */
+ u_int8_t arp_sha[ETH_ALEN]; /* sender hardware address */
+ u_int8_t arp_spa[4]; /* sender protocol address */
+ u_int8_t arp_tha[ETH_ALEN]; /* target hardware address */
+ u_int8_t arp_tpa[4]; /* target protocol address */
+};
+#define arp_hrd ea_hdr.ar_hrd
+#define arp_pro ea_hdr.ar_pro
+#define arp_hln ea_hdr.ar_hln
+#define arp_pln ea_hdr.ar_pln
+#define arp_op ea_hdr.ar_op
+
+/*
+ * Macro to map an IP multicast address to an Ethernet multicast address.
+ * The high-order 25 bits of the Ethernet address are statically assigned,
+ * and the low-order 23 bits are taken from the low end of the IP address.
+ */
+#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
+ /* struct in_addr *ipaddr; */ \
+ /* u_char enaddr[ETH_ALEN]; */ \
+{ \
+ (enaddr)[0] = 0x01; \
+ (enaddr)[1] = 0x00; \
+ (enaddr)[2] = 0x5e; \
+ (enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \
+ (enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \
+ (enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \
+}
+
+__END_DECLS
+#endif /* __USE_BSD */
+
+#endif /* netinet/if_ether.h */
diff --git a/include/netinet/if_fddi.h b/include/netinet/if_fddi.h
new file mode 100644
index 000000000..d5d6dbdbe
--- /dev/null
+++ b/include/netinet/if_fddi.h
@@ -0,0 +1,37 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _NETINET_IF_FDDI_H
+#define _NETINET_IF_FDDI_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <asm/types.h>
+
+#include <linux/if_fddi.h>
+
+#ifdef __USE_BSD
+
+struct fddi_header {
+ u_int8_t fddi_fc; /* Frame Control (FC) value */
+ u_int8_t fddi_dhost[FDDI_K_ALEN]; /* Destination host */
+ u_int8_t fddi_shost[FDDI_K_ALEN]; /* Source host */
+};
+#endif
+
+#endif /* netinet/if_fddi.h */
diff --git a/include/netinet/if_tr.h b/include/netinet/if_tr.h
new file mode 100644
index 000000000..3c1be2102
--- /dev/null
+++ b/include/netinet/if_tr.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _NETINET_IF_TR_H
+#define _NETINET_IF_TR_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <asm/types.h>
+
+#include <linux/if_tr.h>
+
+#ifdef __USE_BSD
+
+struct trn_hdr {
+ u_int8_t trn_ac; /* access control field */
+ u_int8_t trn_fc; /* field control field */
+ u_int8_t trn_dhost[TR_ALEN]; /* destination host */
+ u_int8_t trn_shost[TR_ALEN]; /* source host */
+ u_int16_t trn_rcf; /* route control field */
+ u_int16_t trn_rseg[8]; /* routing registers */
+};
+
+#endif
+
+#endif /* netinet/if_tr.h */
diff --git a/include/netinet/igmp.h b/include/netinet/igmp.h
index 4525630e1..7a6ed6e8c 100644
--- a/include/netinet/igmp.h
+++ b/include/netinet/igmp.h
@@ -1,24 +1,93 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
#ifndef _NETINET_IGMP_H
-#define _NETINET_IGMP_H
+#define _NETINET_IGMP_H 1
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <asm/types.h>
#include <linux/igmp.h>
-#ifdef __BSD_SOURCE
+#ifdef __USE_BSD
+
+#include <netinet/in.h>
+
+__BEGIN_DECLS
+
+/*
+ * Copyright (c) 1988 Stephen Deering.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * 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.
+ *
+ * @(#)igmp.h 8.1 (Berkeley) 6/10/93
+ * $FreeBSD$
+ */
-struct igmp
-{
- __u8 igmp_type;
- __u8 igmp_code;
- __u16 igmp_cksum;
- struct in_addr igmp_group;
+struct igmp {
+ u_int8_t igmp_type; /* IGMP type */
+ u_int8_t igmp_code; /* routing code */
+ u_int16_t igmp_cksum; /* checksum */
+ struct in_addr igmp_group; /* group address */
};
-#define IGMP_MINLEN 8
-#define IGMP_MAX_HOST_REPORT_DELAY 10
-#define IGMP_TIMER_SCALE 10
+/*
+ * Message types, including version number.
+ */
+#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */
+#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */
+#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */
+#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */
-#define IGMP_AGE_THRESHOLD 540
+__END_DECLS
#endif
-#endif /* _NETINET_IGMP_H */
+#endif /* netinet/igmp.h */
diff --git a/include/netinet/in.h b/include/netinet/in.h
index d666c67ac..3dea92632 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -1,29 +1,66 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library 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 1, or (at your option)
-any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with the GNU C Library; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#ifndef _NETINET_IN_H
-
#define _NETINET_IN_H 1
+
#include <features.h>
+#include <limits.h>
+#include <stdint.h>
+
+#include <sys/types.h>
+#include <bits/socket.h>
-#include <sys/socket.h>
__BEGIN_DECLS
+/* Standard well-defined IP protocols. */
+enum
+ {
+ IPPROTO_IP = 0, /* Dummy protocol for TCP. */
+ IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
+ IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */
+ IPPROTO_IGMP = 2, /* Internet Group 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_TP = 29, /* SO Transport Protocol Class 4. */
+ IPPROTO_IPV6 = 41, /* IPv6 header. */
+ IPPROTO_ROUTING = 43, /* IPv6 routing header. */
+ IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
+ IPPROTO_RSVP = 46, /* Reservation Protocol. */
+ IPPROTO_GRE = 47, /* General Routing Encapsulation. */
+ IPPROTO_ESP = 50, /* encapsulating security payload. */
+ IPPROTO_AH = 51, /* authentication header. */
+ IPPROTO_ICMPV6 = 58, /* ICMPv6. */
+ IPPROTO_NONE = 59, /* IPv6 no next header. */
+ IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */
+ IPPROTO_MTP = 92, /* Multicast Transport Protocol. */
+ IPPROTO_ENCAP = 98, /* Encapsulation Header. */
+ IPPROTO_PIM = 103, /* Protocol Independent Multicast. */
+ IPPROTO_COMP = 108, /* Compression Header Protocol. */
+ IPPROTO_RAW = 255, /* Raw IP packets. */
+ IPPROTO_MAX
+ };
+
/* Standard well-known ports. */
enum
{
@@ -65,23 +102,217 @@ enum
};
-/* Link numbers. */
-#define IMPLINK_IP 155
-#define IMPLINK_LOWEXPER 156
-#define IMPLINK_HIGHEXPER 158
+/* Internet address. */
+struct in_addr
+ {
+ uint32_t s_addr;
+ };
+
+
+/* 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) ((((uint32_t) (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) ((((uint32_t) (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) ((((uint32_t) (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) ((((uint32_t) (a)) & 0xf0000000) == 0xe0000000)
+#define IN_MULTICAST(a) IN_CLASSD(a)
+
+#define IN_EXPERIMENTAL(a) ((((uint32_t) (a)) & 0xe0000000) == 0xe0000000)
+#define IN_BADCLASS(a) ((((uint32_t) (a)) & 0xf0000000) == 0xf0000000)
+
+/* Address to accept any incoming messages. */
+#define INADDR_ANY ((uint32_t) 0x00000000)
+/* Address to send to all hosts. */
+#define INADDR_BROADCAST ((uint32_t) 0xffffffff)
+/* Address indicating an error return. */
+#define INADDR_NONE ((uint32_t) 0xffffffff)
+
+/* Network number for local host loopback. */
+#define IN_LOOPBACKNET 127
+/* Address to loopback in software to local host. */
+#ifndef INADDR_LOOPBACK
+# define INADDR_LOOPBACK ((uint32_t) 0x7f000001) /* Inet 127.0.0.1. */
+#endif
+
+/* Defines for Multicast INADDR. */
+#define INADDR_UNSPEC_GROUP ((uint32_t) 0xe0000000) /* 224.0.0.0 */
+#define INADDR_ALLHOSTS_GROUP ((uint32_t) 0xe0000001) /* 224.0.0.1 */
+#define INADDR_ALLRTRS_GROUP ((uint32_t) 0xe0000002) /* 224.0.0.2 */
+#define INADDR_MAX_LOCAL_GROUP ((uint32_t) 0xe00000ff) /* 224.0.0.255 */
+
+
+/* IPv6 address */
+struct in6_addr
+ {
+ union
+ {
+ uint8_t u6_addr8[16];
+ uint16_t u6_addr16[8];
+ uint32_t u6_addr32[4];
+#if ULONG_MAX > 0xffffffff
+ uint64_t u6_addr64[2];
+#endif
+ } in6_u;
+#define s6_addr in6_u.u6_addr8
+#define s6_addr16 in6_u.u6_addr16
+#define s6_addr32 in6_u.u6_addr32
+#define s6_addr64 in6_u.u6_addr64
+ };
+
+extern const struct in6_addr in6addr_any; /* :: */
+extern const struct in6_addr in6addr_loopback; /* ::1 */
+#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
+#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
+
+#define INET_ADDRSTRLEN 16
+#define INET6_ADDRSTRLEN 46
+
+/* Get the definition of the macro to define the common sockaddr members. */
+#include <bits/sockaddr.h>
+
+
+/* Structure describing an Internet socket address. */
+struct sockaddr_in
+ {
+ __SOCKADDR_COMMON (sin_);
+ uint16_t sin_port; /* Port number. */
+ struct in_addr sin_addr; /* Internet address. */
+
+ /* Pad to size of `struct sockaddr'. */
+ unsigned char sin_zero[sizeof (struct sockaddr) -
+ __SOCKADDR_COMMON_SIZE -
+ sizeof (uint16_t) -
+ sizeof (struct in_addr)];
+ };
+
+/* Ditto, for IPv6. */
+struct sockaddr_in6
+ {
+ __SOCKADDR_COMMON (sin6_);
+ uint16_t sin6_port; /* Transport layer port # */
+ uint32_t sin6_flowinfo; /* IPv6 flow information */
+ struct in6_addr sin6_addr; /* IPv6 address */
+ };
+
+/* IPv6 multicast request. */
+struct ipv6_mreq
+ {
+ /* IPv6 multicast address of group */
+ struct in6_addr ipv6mr_multiaddr;
+
+ /* local interface */
+ unsigned int ipv6mr_interface;
+ };
+
+/* Get system-specific definitions. */
+#include <bits/in.h>
+
+/* Functions to convert between host and network byte order.
+
+ Please note that these functions normally take `unsigned long int' or
+ `unsigned short int' values as arguments and also return them. But
+ this was a short-sighted decision since on different systems the types
+ may have different representations but the values are always the same. */
+
+extern uint32_t ntohl __P ((uint32_t __netlong));
+extern uint16_t ntohs __P ((uint16_t __netshort));
+extern uint32_t htonl __P ((uint32_t __hostlong));
+extern uint16_t htons __P ((uint16_t __hostshort));
+
+#include <endian.h>
+
+/* Get machine dependent optimized versions of byte swapping functions. */
+#include <bits/byteswap.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN && defined __OPTIMIZE__
+/* The host byte order is the same as network byte order,
+ so these functions are all just identity. */
+# define ntohl(x) (x)
+# define ntohs(x) (x)
+# define htonl(x) (x)
+# define htons(x) (x)
+#else
+# if __BYTE_ORDER == __LITTLE_ENDIAN && defined __OPTIMIZE__
+# define ntohl(x) __bswap_32 (x)
+# define ntohs(x) __bswap_16 (x)
+# define htonl(x) __bswap_32 (x)
+# define htons(x) __bswap_16 (x)
+# endif
+#endif
+
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+ (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+ ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
+#define IN6_IS_ADDR_LOOPBACK(a) \
+ (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+ ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == htonl (1))
-/*
- * Many other definitions have been moved to <linux/in.h>,
- * because several parts of the kernel need them. -FvK
- */
-#include <linux/in.h>
+#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff)
-/*
- * Bind a socket to a privileged IP port
- */
-extern int bindresvport __P ((int __sockfd,
- struct sockaddr_in * __sin));
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+ ((((uint32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000))
+
+#define IN6_IS_ADDR_SITELOCAL(a) \
+ ((((uint32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfec00000))
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+ ((((uint32_t *) (a))[0] == 0) && (((uint32_t *) (a))[1] == 0) && \
+ (((uint32_t *) (a))[2] == htonl (0xffff)))
+
+#define IN6_IS_ADDR_V4COMPAT(a) \
+ ((((uint32_t *) (a))[0] == 0) && (((uint32_t *) (a))[1] == 0) && \
+ (((uint32_t *) (a))[2] == 0) && (ntohl (((uint32_t *) (a))[3]) > 1))
+
+#define IN6_ARE_ADDR_EQUAL(a,b) \
+ ((((uint32_t *) (a))[0] == ((uint32_t *) (b))[0]) && \
+ (((uint32_t *) (a))[1] == ((uint32_t *) (b))[2]) && \
+ (((uint32_t *) (a))[2] == ((uint32_t *) (b))[1]) && \
+ (((uint32_t *) (a))[3] == ((uint32_t *) (b))[3]))
+
+/* Bind socket to a privileged IP port. */
+extern int bindresvport __P ((int __sockfd, struct sockaddr_in *__sock_in));
+
+
+
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0x1))
+
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0x2))
+
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0x5))
+
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0x8))
+
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0xe))
+
+/* IPv6 packet information. */
+struct in6_pktinfo
+ {
+ struct in6_addr ipi6_addr; /* src/dst IPv6 address */
+ unsigned int ipi6_ifindex; /* send/recv interface index */
+ };
__END_DECLS
diff --git a/include/netinet/in_systm.h b/include/netinet/in_systm.h
index f481c5511..902fe6ea0 100644
--- a/include/netinet/in_systm.h
+++ b/include/netinet/in_systm.h
@@ -1 +1,41 @@
-#include <linux/in_systm.h>
+/* System specific type definitions for networking code.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _NETINET_IN_SYSTM_H
+#define _NETINET_IN_SYSTM_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+/*
+ * Network order versions of various data types. Unfortunately, BSD
+ * assumes specific sizes for shorts (16 bit) and longs (32 bit) which
+ * don't hold in general. As a consequence, the network order versions
+ * may not reflect the actual size of the native data types.
+ */
+
+typedef u_int16_t n_short; /* short as received from the net */
+typedef u_int32_t n_long; /* long as received from the net */
+typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
+
+__END_DECLS
+
+#endif /* netinet/in_systm.h */
diff --git a/include/netinet/ip.h b/include/netinet/ip.h
index a6c49b6af..246a56a5d 100644
--- a/include/netinet/ip.h
+++ b/include/netinet/ip.h
@@ -1,39 +1,276 @@
-#ifndef _NETINET_IP_H
-#define _NETINET_IP_H
+/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef __NETINET_IP_H
+#define __NETINET_IP_H 1
#include <features.h>
+#include <sys/types.h>
+
#include <netinet/in.h>
-#include <linux/ip.h>
-#ifdef _BSD_SOURCE
+__BEGIN_DECLS
+
+struct timestamp
+ {
+ u_int8_t len;
+ u_int8_t ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int flags:4;
+ unsigned int overflow:4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int overflow:4;
+ unsigned int flags:4;
+#else
+# error "Please fix <bits/endian.h>"
+#endif
+ u_int32_t data[9];
+ };
+
+struct ip_options
+ {
+ u_int32_t faddr; /* Saved first hop address */
+ u_int8_t optlen;
+ u_int8_t srr;
+ u_int8_t rr;
+ u_int8_t ts;
+ unsigned int is_setbyuser:1; /* Set by setsockopt? */
+ unsigned int is_data:1; /* Options in __data, rather than skb */
+ unsigned int is_strictroute:1; /* Strict source route */
+ unsigned int srr_is_hit:1; /* Packet destination addr was our one */
+ unsigned int is_changed:1; /* IP checksum more not valid */
+ unsigned int rr_needaddr:1; /* Need to record addr of outgoing dev */
+ unsigned int ts_needtime:1; /* Need to record timestamp */
+ unsigned int ts_needaddr:1; /* Need to record addr of outgoing dev */
+ u_int8_t router_alert;
+ u_int8_t __pad1;
+ u_int8_t __pad2;
+#ifdef __GNUC__
+ u_int8_t __data[0];
+#endif
+ };
+
+struct iphdr
+ {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int ihl:4;
+ unsigned int version:4;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int version:4;
+ unsigned int ihl:4;
+#else
+# error "Please fix <bits/endian.h>"
+#endif
+ u_int8_t tos;
+ u_int16_t tot_len;
+ u_int16_t id;
+ u_int16_t frag_off;
+ u_int8_t ttl;
+ u_int8_t protocol;
+ u_int16_t check;
+ u_int32_t saddr;
+ u_int32_t daddr;
+ /*The options start here. */
+ };
+#ifdef __USE_BSD
/*
- * BSD has the following structure
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ip.h 8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Definitions for internet protocol version 4.
+ * Per RFC 791, September 1981.
+ */
+
+/*
+ * Structure of an internet header, naked of options.
*/
-
struct ip
-{
-#if defined(__LITTLE_ENDIAN_BITFIELD)
- __u8 ip_hl:4,
- ip_v:4;
-#else
- __u8 ip_v:4,
- ip_hl:4;
+ {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int ip_hl:4; /* header length */
+ unsigned int ip_v:4; /* version */
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int ip_v:4; /* version */
+ unsigned int ip_hl:4; /* header length */
#endif
-#define IPVERSION 4
- __u8 ip_tos;
- __u16 ip_len;
- __u16 ip_id;
- __u16 ip_off;
- __u8 ip_ttl;
- __u8 ip_p;
- __u16 ip_csum;
- struct in_addr ip_src,ip_dst;
-};
-
-#define IP_DF 0x4000 /* dont fragment flag */
-#define IP_MF 0x2000 /* more fragments flag */
+ u_int8_t ip_tos; /* type of service */
+ u_short ip_len; /* total length */
+ u_short ip_id; /* identification */
+ u_short ip_off; /* fragment offset field */
+#define IP_RF 0x8000 /* reserved fragment flag */
+#define IP_DF 0x4000 /* dont fragment flag */
+#define IP_MF 0x2000 /* more fragments flag */
+#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
+ u_int8_t ip_ttl; /* time to live */
+ u_int8_t ip_p; /* protocol */
+ u_short ip_sum; /* checksum */
+ struct in_addr ip_src, ip_dst; /* source and dest address */
+ };
+/*
+ * Time stamp option structure.
+ */
+struct ip_timestamp
+ {
+ u_int8_t ipt_code; /* IPOPT_TS */
+ u_int8_t ipt_len; /* size of structure (variable) */
+ u_int8_t ipt_ptr; /* index of current entry */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int ipt_flg:4; /* flags, see below */
+ unsigned int ipt_oflw:4; /* overflow counter */
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int ipt_oflw:4; /* overflow counter */
+ unsigned int ipt_flg:4; /* flags, see below */
#endif
+ u_int32_t data[9];
+ };
+#endif /* __USE_BSD */
+
+#define IPVERSION 4 /* IP version number */
+#define IP_MAXPACKET 65535 /* maximum packet size */
+
+/*
+ * Definitions for IP type of service (ip_tos)
+ */
+#define IPTOS_TOS_MASK 0x1E
+#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
+#define IPTOS_LOWDELAY 0x10
+#define IPTOS_THROUGHPUT 0x08
+#define IPTOS_RELIABILITY 0x04
+#define IPTOS_LOWCOST 0x02
+#define IPTOS_MINCOST IPTOS_LOWCOST
+
+/*
+ * Definitions for IP precedence (also in ip_tos) (hopefully unused)
+ */
+#define IPTOS_PREC_MASK 0xe0
+#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK)
+#define IPTOS_PREC_NETCONTROL 0xe0
+#define IPTOS_PREC_INTERNETCONTROL 0xc0
+#define IPTOS_PREC_CRITIC_ECP 0xa0
+#define IPTOS_PREC_FLASHOVERRIDE 0x80
+#define IPTOS_PREC_FLASH 0x60
+#define IPTOS_PREC_IMMEDIATE 0x40
+#define IPTOS_PREC_PRIORITY 0x20
+#define IPTOS_PREC_ROUTINE 0x00
+
+/*
+ * Definitions for options.
+ */
+#define IPOPT_COPY 0x80
+#define IPOPT_CLASS_MASK 0x60
+#define IPOPT_NUMBER_MASK 0x1f
+
+#define IPOPT_COPIED(o) ((o) & IPOPT_COPY)
+#define IPOPT_CLASS(o) ((o) & IPOPT_CLASS_MASK)
+#define IPOPT_NUMBER(o) ((o) & IPOPT_NUMBER_MASK)
+
+#define IPOPT_CONTROL 0x00
+#define IPOPT_RESERVED1 0x20
+#define IPOPT_DEBMEAS 0x40
+#define IPOPT_MEASUREMENT IPOPT_DEBMEAS
+#define IPOPT_RESERVED2 0x60
+
+#define IPOPT_EOL 0 /* end of option list */
+#define IPOPT_END IPOPT_EOL
+#define IPOPT_NOP 1 /* no operation */
+#define IPOPT_NOOP IPOPT_NOP
+
+#define IPOPT_RR 7 /* record packet route */
+#define IPOPT_TS 68 /* timestamp */
+#define IPOPT_TIMESTAMP IPOPT_TS
+#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
+#define IPOPT_SEC IPOPT_SECURITY
+#define IPOPT_LSRR 131 /* loose source route */
+#define IPOPT_SATID 136 /* satnet id */
+#define IPOPT_SID IPOPT_SATID
+#define IPOPT_SSRR 137 /* strict source route */
+#define IPOPT_RA 148 /* router alert */
+
+/*
+ * Offsets to fields in options other than EOL and NOP.
+ */
+#define IPOPT_OPTVAL 0 /* option ID */
+#define IPOPT_OLEN 1 /* option length */
+#define IPOPT_OFFSET 2 /* offset within option */
+#define IPOPT_MINOFF 4 /* min value of above */
+
+#define MAX_IPOPTLEN 40
+
+/* flag bits for ipt_flg */
+#define IPOPT_TS_TSONLY 0 /* timestamps only */
+#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
+#define IPOPT_TS_PRESPEC 3 /* specified modules only */
+
+/* bits for security (not byte swapped) */
+#define IPOPT_SECUR_UNCLASS 0x0000
+#define IPOPT_SECUR_CONFID 0xf135
+#define IPOPT_SECUR_EFTO 0x789a
+#define IPOPT_SECUR_MMMM 0xbc4d
+#define IPOPT_SECUR_RESTR 0xaf13
+#define IPOPT_SECUR_SECRET 0xd788
+#define IPOPT_SECUR_TOPSECRET 0x6bc5
+
+/*
+ * Internet implementation parameters.
+ */
+#define MAXTTL 255 /* maximum time to live (seconds) */
+#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
+#define IPFRAGTTL 60 /* time to live for frags, slowhz */
+#define IPTTLDEC 1 /* subtracted when forwarding */
+
+#define IP_MSS 576 /* default maximum segment size */
+
+__END_DECLS
-#endif /* _NETINET_IP_H */
+#endif /* netinet/ip.h */
diff --git a/include/netinet/ip6.h b/include/netinet/ip6.h
new file mode 100644
index 000000000..cd42ef64b
--- /dev/null
+++ b/include/netinet/ip6.h
@@ -0,0 +1,106 @@
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _NETINET_IP6_H
+#define _NETINET_IP6_H 1
+
+#include <inttypes.h>
+#include <netinet/in.h>
+
+struct ip6_hdr
+ {
+ union
+ {
+ struct ip6_hdrctl
+ {
+ uint32_t ip6_un1_flow; /* 24 bits of flow-ID */
+ uint16_t ip6_un1_plen; /* payload length */
+ uint8_t ip6_un1_nxt; /* next header */
+ uint8_t ip6_un1_hlim; /* hop limit */
+ } ip6_un1;
+ uint8_t ip6_un2_vfc; /* 4 bits version, 4 bits priority */
+ } ip6_ctlun;
+ struct in6_addr ip6_src; /* source address */
+ struct in6_addr ip6_dst; /* destination address */
+ };
+
+#define ip6_vfc ip6_ctlun.ip6_un2_vfc
+#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
+
+/* Hop-by-Hop options header. */
+struct ip6_hbh
+ {
+ uint8_t ip6h_nxt; /* next hesder. */
+ uint8_t ip6h_len; /* length in units of 8 octets. */
+ /* followed by options */
+ };
+
+/* Destination options header */
+struct ip6_dest
+ {
+ uint8_t ip6d_nxt; /* next header */
+ uint8_t ip6d_len; /* length in units of 8 octets */
+ /* followed by options */
+ };
+
+/* Routing header */
+struct ip6_rthdr
+ {
+ uint8_t ip6r_nxt; /* next header */
+ uint8_t ip6r_len; /* length in units of 8 octets */
+ uint8_t ip6r_type; /* routing type */
+ uint8_t ip6r_segleft; /* segments left */
+ /* followed by routing type specific data */
+ };
+
+/* Type 0 Routing header */
+struct ip6_rthdr0
+ {
+ uint8_t ip6r0_nxt; /* next header */
+ uint8_t ip6r0_len; /* length in units of 8 octets */
+ uint8_t ip6r0_type; /* always zero */
+ uint8_t ip6r0_segleft; /* segments left */
+ uint8_t ip6r0_reserved; /* reserved field */
+ uint8_t ip6r0_slmap[3]; /* strict/loose bit map */
+ struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */
+ };
+
+/* Fragment header */
+struct ip6_frag
+ {
+ uint8_t ip6f_nxt; /* next header */
+ uint8_t ip6f_reserved; /* reserved field */
+ uint16_t ip6f_offlg; /* offset, reserved, and flag */
+ uint32_t ip6f_ident; /* identification */
+ };
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */
+#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
+#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */
+#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */
+#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */
+#endif
+
+#endif /* netinet/ip6.h */
diff --git a/include/netinet/ip_icmp.h b/include/netinet/ip_icmp.h
index 1662e3f7f..be7959ee7 100644
--- a/include/netinet/ip_icmp.h
+++ b/include/netinet/ip_icmp.h
@@ -1 +1,287 @@
-#include <linux/icmp.h>
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef __NETINET_IP_ICMP_H
+#define __NETINET_IP_ICMP_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+struct icmphdr
+{
+ u_int8_t type; /* message type */
+ u_int8_t code; /* type sub-code */
+ u_int16_t checksum;
+ union
+ {
+ struct
+ {
+ u_int16_t id;
+ u_int16_t sequence;
+ } echo; /* echo datagram */
+ u_int32_t gateway; /* gateway address */
+ struct
+ {
+ u_int16_t __unused;
+ u_int16_t mtu;
+ } frag; /* path mtu discovery */
+ } un;
+};
+
+#define ICMP_ECHOREPLY 0 /* Echo Reply */
+#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */
+#define ICMP_SOURCE_QUENCH 4 /* Source Quench */
+#define ICMP_REDIRECT 5 /* Redirect (change route) */
+#define ICMP_ECHO 8 /* Echo Request */
+#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */
+#define ICMP_PARAMETERPROB 12 /* Parameter Problem */
+#define ICMP_TIMESTAMP 13 /* Timestamp Request */
+#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */
+#define ICMP_INFO_REQUEST 15 /* Information Request */
+#define ICMP_INFO_REPLY 16 /* Information Reply */
+#define ICMP_ADDRESS 17 /* Address Mask Request */
+#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */
+#define NR_ICMP_TYPES 18
+
+
+/* Codes for UNREACH. */
+#define ICMP_NET_UNREACH 0 /* Network Unreachable */
+#define ICMP_HOST_UNREACH 1 /* Host Unreachable */
+#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */
+#define ICMP_PORT_UNREACH 3 /* Port Unreachable */
+#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */
+#define ICMP_SR_FAILED 5 /* Source Route failed */
+#define ICMP_NET_UNKNOWN 6
+#define ICMP_HOST_UNKNOWN 7
+#define ICMP_HOST_ISOLATED 8
+#define ICMP_NET_ANO 9
+#define ICMP_HOST_ANO 10
+#define ICMP_NET_UNR_TOS 11
+#define ICMP_HOST_UNR_TOS 12
+#define ICMP_PKT_FILTERED 13 /* Packet filtered */
+#define ICMP_PREC_VIOLATION 14 /* Precedence violation */
+#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */
+#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */
+
+/* Codes for REDIRECT. */
+#define ICMP_REDIR_NET 0 /* Redirect Net */
+#define ICMP_REDIR_HOST 1 /* Redirect Host */
+#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */
+#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */
+
+/* Codes for TIME_EXCEEDED. */
+#define ICMP_EXC_TTL 0 /* TTL count exceeded */
+#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */
+
+
+#ifdef __USE_BSD
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
+ */
+
+#include <netinet/in.h>
+#include <netinet/ip.h>
+
+/*
+ * Internal of an ICMP Router Advertisement
+ */
+struct icmp_ra_addr
+{
+ u_int32_t ira_addr;
+ u_int32_t ira_preference;
+};
+
+struct icmp
+{
+ u_int8_t icmp_type; /* type of message, see below */
+ u_int8_t icmp_code; /* type sub code */
+ u_int16_t icmp_cksum; /* ones complement checksum of struct */
+ union
+ {
+ u_char ih_pptr; /* ICMP_PARAMPROB */
+ struct in_addr ih_gwaddr; /* gateway address */
+ struct ih_idseq /* echo datagram */
+ {
+ u_int16_t icd_id;
+ u_int16_t icd_seq;
+ } ih_idseq;
+ u_int32_t ih_void;
+
+ /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
+ struct ih_pmtu
+ {
+ u_int16_t ipm_void;
+ u_int16_t ipm_nextmtu;
+ } ih_pmtu;
+
+ struct ih_rtradv
+ {
+ u_int8_t irt_num_addrs;
+ u_int8_t irt_wpa;
+ u_int16_t irt_lifetime;
+ } ih_rtradv;
+ } icmp_hun;
+#define icmp_pptr icmp_hun.ih_pptr
+#define icmp_gwaddr icmp_hun.ih_gwaddr
+#define icmp_id icmp_hun.ih_idseq.icd_id
+#define icmp_seq icmp_hun.ih_idseq.icd_seq
+#define icmp_void icmp_hun.ih_void
+#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
+#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
+#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
+#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
+#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
+ union
+ {
+ struct
+ {
+ u_int32_t its_otime;
+ u_int32_t its_rtime;
+ u_int32_t its_ttime;
+ } id_ts;
+ struct
+ {
+ struct ip idi_ip;
+ /* options and then 64 bits of data */
+ } id_ip;
+ struct icmp_ra_addr id_radv;
+ u_int32_t id_mask;
+ u_int8_t id_data[1];
+ } icmp_dun;
+#define icmp_otime icmp_dun.id_ts.its_otime
+#define icmp_rtime icmp_dun.id_ts.its_rtime
+#define icmp_ttime icmp_dun.id_ts.its_ttime
+#define icmp_ip icmp_dun.id_ip.idi_ip
+#define icmp_radv icmp_dun.id_radv
+#define icmp_mask icmp_dun.id_mask
+#define icmp_data icmp_dun.id_data
+};
+
+/*
+ * Lower bounds on packet lengths for various types.
+ * For the error advice packets must first insure that the
+ * packet is large enough to contain the returned ip header.
+ * Only then can we do the check to see if 64 bits of packet
+ * data have been returned, since we need to check the returned
+ * ip header length.
+ */
+#define ICMP_MINLEN 8 /* abs minimum */
+#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
+#define ICMP_MASKLEN 12 /* address mask */
+#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
+#ifndef _IP_VHL
+#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+ /* N.B.: must separately check that ip_hl >= 5 */
+#else
+#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8)
+ /* N.B.: must separately check that header length >= 5 */
+#endif
+
+/* Definition of type and code fields. */
+/* defined above: ICMP_ECHOREPLY, ICMP_REDIRECT, ICMP_ECHO */
+#define ICMP_UNREACH 3 /* dest unreachable, codes: */
+#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
+#define ICMP_ROUTERADVERT 9 /* router advertisement */
+#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
+#define ICMP_TIMXCEED 11 /* time exceeded, code: */
+#define ICMP_PARAMPROB 12 /* ip header bad */
+#define ICMP_TSTAMP 13 /* timestamp request */
+#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
+#define ICMP_IREQ 15 /* information request */
+#define ICMP_IREQREPLY 16 /* information reply */
+#define ICMP_MASKREQ 17 /* address mask request */
+#define ICMP_MASKREPLY 18 /* address mask reply */
+
+#define ICMP_MAXTYPE 18
+
+/* UNREACH codes */
+#define ICMP_UNREACH_NET 0 /* bad net */
+#define ICMP_UNREACH_HOST 1 /* bad host */
+#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
+#define ICMP_UNREACH_PORT 3 /* bad port */
+#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
+#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
+#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */
+#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */
+#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */
+#define ICMP_UNREACH_NET_PROHIB 9 /* net denied */
+#define ICMP_UNREACH_HOST_PROHIB 10 /* host denied */
+#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */
+#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */
+#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */
+#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */
+#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */
+
+/* REDIRECT codes */
+#define ICMP_REDIRECT_NET 0 /* for network */
+#define ICMP_REDIRECT_HOST 1 /* for host */
+#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
+#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
+
+/* TIMEXCEED codes */
+#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
+#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
+
+/* PARAMPROB code */
+#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */
+
+#define ICMP_INFOTYPE(type) \
+ ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+ (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+ (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+ (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+ (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+#endif /* __USE_BSD */
+
+__END_DECLS
+
+#endif /* netinet/ip_icmp.h */
diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
index 8636ec7d0..36976369e 100644
--- a/include/netinet/tcp.h
+++ b/include/netinet/tcp.h
@@ -1 +1,166 @@
-#include <netinet/ip_tcp.h>
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)tcp.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_H
+#define _NETINET_TCP_H 1
+
+#include <features.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+#ifdef __FAVOR_BSD
+typedef u_int32_t tcp_seq;
+/*
+ * TCP header.
+ * Per RFC 793, September, 1981.
+ */
+struct tcphdr
+ {
+ u_int16_t th_sport; /* source port */
+ u_int16_t th_dport; /* destination port */
+ tcp_seq th_seq; /* sequence number */
+ tcp_seq th_ack; /* acknowledgement number */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ u_int8_t th_x2:4; /* (unused) */
+ u_int8_t th_off:4; /* data offset */
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+ u_int8_t th_off:4; /* data offset */
+ u_int8_t th_x2:4; /* (unused) */
+#endif
+ u_int8_t th_flags;
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+ u_int16_t th_win; /* window */
+ u_int16_t th_sum; /* checksum */
+ u_int16_t th_urp; /* urgent pointer */
+};
+
+#else /* !__FAVOR_BSD */
+struct tcphdr
+ {
+ u_int16_t source;
+ u_int16_t dest;
+ u_int32_t seq;
+ u_int32_t ack_seq;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ u_int16_t res1:4;
+ u_int16_t doff:4;
+ u_int16_t fin:1;
+ u_int16_t syn:1;
+ u_int16_t rst:1;
+ u_int16_t psh:1;
+ u_int16_t ack:1;
+ u_int16_t urg:1;
+ u_int16_t res2:2;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ u_int16_t doff:4;
+ u_int16_t res1:4;
+ u_int16_t res2:2;
+ u_int16_t urg:1;
+ u_int16_t ack:1;
+ u_int16_t psh:1;
+ u_int16_t rst:1;
+ u_int16_t syn:1;
+ u_int16_t fin:1;
+#else
+#error "Adjust your <bits/endian.h> defines"
+#endif
+ u_int16_t window;
+ u_int16_t check;
+ u_int16_t urg_ptr;
+};
+#endif /* __FAVOR_BSD */
+
+enum
+{
+ TCP_ESTABLISHED = 1,
+ TCP_SYN_SENT,
+ TCP_SYN_RECV,
+ TCP_FIN_WAIT1,
+ TCP_FIN_WAIT2,
+ TCP_TIME_WAIT,
+ TCP_CLOSE,
+ TCP_CLOSE_WAIT,
+ TCP_LAST_ACK,
+ TCP_LISTEN,
+ TCP_CLOSING /* now a valid state */
+};
+
+#define TCPOPT_EOL 0
+#define TCPOPT_NOP 1
+#define TCPOPT_MAXSEG 2
+#define TCPOLEN_MAXSEG 4
+#define TCPOPT_WINDOW 3
+#define TCPOLEN_WINDOW 3
+#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
+#define TCPOLEN_SACK_PERMITTED 2
+#define TCPOPT_SACK 5 /* Experimental */
+#define TCPOPT_TIMESTAMP 8
+#define TCPOLEN_TIMESTAMP 10
+#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
+
+#define TCPOPT_TSTAMP_HDR \
+ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
+
+/*
+ * Default maximum segment size for TCP.
+ * With an IP MSS of 576, this is 536,
+ * but 512 is probably more convenient.
+ * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
+ */
+#define TCP_MSS 512
+
+#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
+
+#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
+
+/*
+ * User-settable options (used with setsockopt).
+ */
+#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
+#define TCP_MAXSEG 0x02 /* set maximum segment size */
+#define TCP_CORK 0x03 /* control sending of partial frames */
+
+#define SOL_TCP 6 /* TCP level */
+
+__END_DECLS
+
+#endif /* netinet/tcp.h */
diff --git a/include/netinet/udp.h b/include/netinet/udp.h
index 39a57a3c7..9ee66f0fc 100644
--- a/include/netinet/udp.h
+++ b/include/netinet/udp.h
@@ -1 +1,55 @@
-#include <netinet/ip_udp.h>
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef __NETINET_UDP_H
+#define __NETINET_UDP_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+/* UDP header as specified by RFC 768, August 1980. */
+#ifdef __FAVOR_BSD
+struct udphdr {
+ u_int16_t uh_sport; /* source port */
+ u_int16_t uh_dport; /* destination port */
+ u_int16_t uh_ulen; /* udp length */
+ u_int16_t uh_sum; /* udp checksum */
+};
+#else
+
+struct udphdr {
+ u_int16_t source;
+ u_int16_t dest;
+ u_int16_t len;
+ u_int16_t check;
+};
+#endif
+
+#define SOL_UDP 17 /* sockopt level for UDP */
+
+__END_DECLS
+
+#endif /* netinet/udp.h */
diff --git a/include/rpc/auth.h b/include/rpc/auth.h
index 33cb42951..35f30e4a3 100644
--- a/include/rpc/auth.h
+++ b/include/rpc/auth.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -38,6 +38,13 @@
* "sessions".
*/
+#ifndef _RPC_AUTH_H
+
+#define _RPC_AUTH_H 1
+#include <features.h>
+#include <rpc/xdr.h>
+
+__BEGIN_DECLS
#define MAX_AUTH_BYTES 400
#define MAXNETNAMELEN 255 /* maximum length of network user's name */
@@ -62,19 +69,15 @@ enum auth_stat {
AUTH_FAILED=7 /* some unknown reason */
};
-#if (mc68000 || sparc || vax || i386)
-typedef u_long u_int32; /* 32-bit unsigned integers */
-#endif
-
union des_block {
struct {
- u_int32 high;
- u_int32 low;
+ u_int32_t high;
+ u_int32_t low;
} key;
char c[8];
};
typedef union des_block des_block;
-extern bool_t xdr_des_block();
+extern bool_t xdr_des_block __P ((XDR *__xdrs, des_block *__blkp));
/*
* Authentication info. Opaque to client.
@@ -85,23 +88,24 @@ struct opaque_auth {
u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
};
-
/*
* Auth handle, interface to client side authenticators.
*/
-typedef struct {
- struct opaque_auth ah_cred;
- struct opaque_auth ah_verf;
- union des_block ah_key;
- struct auth_ops {
- void (*ah_nextverf)();
- int (*ah_marshal)(); /* nextverf & serialize */
- int (*ah_validate)(); /* validate varifier */
- int (*ah_refresh)(); /* refresh credentials */
- void (*ah_destroy)(); /* destroy this structure */
- } *ah_ops;
- caddr_t ah_private;
-} AUTH;
+typedef struct AUTH AUTH;
+struct AUTH {
+ struct opaque_auth ah_cred;
+ struct opaque_auth ah_verf;
+ union des_block ah_key;
+ struct auth_ops {
+ void (*ah_nextverf) __P ((AUTH *));
+ int (*ah_marshal) __P ((AUTH *, XDR *)); /* nextverf & serialize */
+ int (*ah_validate) __P ((AUTH *, struct opaque_auth *));
+ /* validate verifier */
+ int (*ah_refresh) __P ((AUTH *)); /* refresh credentials */
+ void (*ah_destroy) __P ((AUTH *)); /* destroy this structure */
+ } *ah_ops;
+ caddr_t ah_private;
+};
/*
@@ -154,13 +158,57 @@ extern struct opaque_auth _null_auth;
* int len;
* int *aup_gids;
*/
-extern AUTH *authunix_create();
-extern AUTH *authunix_create_default(); /* takes no parameters */
-extern AUTH *authnone_create(); /* takes no parameters */
-extern AUTH *authdes_create();
+extern AUTH *authunix_create __P ((char *__machname, __uid_t __uid,
+ __gid_t __gid, int __len,
+ __gid_t *__aup_gids));
+extern AUTH *authunix_create_default __P ((void));
+extern AUTH *authnone_create __P ((void));
+extern AUTH *authdes_create __P ((const char *__servername, u_int __window,
+ struct sockaddr *__syncaddr,
+ des_block *__ckey));
+extern AUTH *authdes_pk_create __P ((const char *, netobj *, u_int,
+ struct sockaddr *, des_block *));
+
#define AUTH_NONE 0 /* no authentication */
#define AUTH_NULL 0 /* backward compatibility */
-#define AUTH_UNIX 1 /* unix style (uid, gids) */
+#define AUTH_SYS 1 /* unix style (uid, gids) */
+#define AUTH_UNIX AUTH_SYS
#define AUTH_SHORT 2 /* short hand unix style */
#define AUTH_DES 3 /* des style (encrypted timestamps) */
+#define AUTH_DH AUTH_DES /* Diffie-Hellman (this is DES) */
+#define AUTH_KERB 4 /* kerberos style */
+
+/*
+ * Netname manipulating functions
+ *
+ */
+extern int getnetname __P ((char *));
+extern int host2netname __P ((char *, __const char *, __const char *));
+extern int user2netname __P ((char *, __const uid_t, __const char *));
+extern int netname2user __P ((__const char *, uid_t *, gid_t *, int *,
+ gid_t *));
+extern int netname2host __P ((__const char *, char *, __const int));
+
+/*
+ *
+ * These routines interface to the keyserv daemon
+ *
+ */
+extern int key_decryptsession __P ((char *, des_block *));
+extern int key_decryptsession_pk __P ((char *, netobj *, des_block *));
+extern int key_encryptsession __P ((char *, des_block *));
+extern int key_encryptsession_pk __P ((char *, netobj *, des_block *));
+extern int key_gendes __P ((des_block *));
+extern int key_setsecret __P ((char *));
+extern int key_secretkey_is_set __P ((void));
+extern int key_get_conv __P ((char *, des_block *));
+
+/*
+ * XDR an opaque authentication struct.
+ */
+extern bool_t xdr_opaque_auth __P ((XDR *, struct opaque_auth *));
+
+__END_DECLS
+
+#endif /* rpc/auth.h */
diff --git a/include/rpc/auth_des.h b/include/rpc/auth_des.h
index 8c2f79469..b94bafb67 100644
--- a/include/rpc/auth_des.h
+++ b/include/rpc/auth_des.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,30 +17,97 @@
Boston, MA 02111-1307, USA. */
#ifndef _RPC_AUTH_DES_H
-
#define _RPC_AUTH_DES_H 1
+
#include <sys/cdefs.h>
+#include <rpc/auth.h>
__BEGIN_DECLS
-/* This is no complete version of this header. More definitions with
- the real authentication stuff will come in 1997. For now we only
- need to define the function for handling public keys. */
+/* There are two kinds of "names": fullnames and nicknames */
+enum authdes_namekind
+ {
+ ADN_FULLNAME,
+ ADN_NICKNAME
+ };
+
+/* A fullname contains the network name of the client,
+ a conversation key and the window */
+struct authdes_fullname
+ {
+ char *name; /* network name of client, up to MAXNETNAMELEN */
+ des_block key; /* conversation key */
+ uint32_t window; /* associated window */
+ };
+
+/* A credential */
+struct authdes_cred
+ {
+ enum authdes_namekind adc_namekind;
+ struct authdes_fullname adc_fullname;
+ uint32_t adc_nickname;
+ };
+
+/* A timeval replacement for !32bit platforms */
+struct rpc_timeval
+ {
+ uint32_t tv_sec; /* Seconds. */
+ uint32_t tv_usec; /* Microseconds. */
+ };
+
+/* A des authentication verifier */
+struct authdes_verf
+ {
+ union
+ {
+ struct rpc_timeval adv_ctime; /* clear time */
+ des_block adv_xtime; /* crypt time */
+ }
+ adv_time_u;
+ uint32_t adv_int_u;
+ };
+/* des authentication verifier: client variety
+
+ adv_timestamp is the current time.
+ adv_winverf is the credential window + 1.
+ Both are encrypted using the conversation key. */
+#define adv_timestamp adv_time_u.adv_ctime
+#define adv_xtimestamp adv_time_u.adv_xtime
+#define adv_winverf adv_int_u
+
+/* des authentication verifier: server variety
+
+ adv_timeverf is the client's timestamp + client's window
+ adv_nickname is the server's nickname for the client.
+ adv_timeverf is encrypted using the conversation key. */
+#define adv_timeverf adv_time_u.adv_ctime
+#define adv_xtimeverf adv_time_u.adv_xtime
+#define adv_nickname adv_int_u
+
+/* Map a des credential into a unix cred. */
+extern int authdes_getucred __P ((__const struct authdes_cred * __adc,
+ uid_t * __uid, gid_t * __gid,
+ short *__grouplen, gid_t * __groups));
/* Get the public key for NAME and place it in KEY. NAME can only be
up to MAXNETNAMELEN bytes long and the destination buffer KEY should
- have HEXKEYBATES + 1 bytes long to fit all characters from the key. */
+ have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */
extern int getpublickey __P ((__const char *__name, char *__key));
/* Get the secret key for NAME and place it in KEY. PASSWD is used to
decrypt the encrypted key stored in the database. NAME can only be
up to MAXNETNAMELEN bytes long and the destination buffer KEY
- should have HEXKEYBATES + 1 bytes long to fit all characters from
+ should have HEXKEYBYTES + 1 bytes long to fit all characters from
the key. */
extern int getsecretkey __P ((__const char *__name, char *__key,
__const char *__passwd));
+extern int rtime __P ((struct sockaddr_in *__addrp,
+ struct rpc_timeval *__timep,
+ struct rpc_timeval *__timeout));
+
__END_DECLS
+
#endif /* rpc/auth_des.h */
diff --git a/include/rpc/auth_unix.h b/include/rpc/auth_unix.h
index 705741e13..ed3b9322c 100644
--- a/include/rpc/auth_unix.h
+++ b/include/rpc/auth_unix.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -42,6 +42,17 @@
* for the credentials.
*/
+#ifndef _RPC_AUTH_UNIX_H
+#define _RPC_AUTH_UNIX_H 1
+
+#include <features.h>
+#include <sys/types.h>
+#include <rpc/types.h>
+#include <rpc/auth.h>
+#include <rpc/xdr.h>
+
+__BEGIN_DECLS
+
/* The machine name is part of a credential; it may not exceed 255 bytes */
#define MAX_MACHINE_NAME 255
@@ -51,22 +62,29 @@
/*
* Unix style credentials.
*/
-struct authunix_parms {
- u_long aup_time;
- char *aup_machname;
- int aup_uid;
- int aup_gid;
- u_int aup_len;
- int *aup_gids;
-};
+struct authunix_parms
+ {
+ u_long aup_time;
+ char *aup_machname;
+ __uid_t aup_uid;
+ __gid_t aup_gid;
+ u_int aup_len;
+ __gid_t *aup_gids;
+ };
-extern bool_t xdr_authunix_parms();
+extern bool_t xdr_authunix_parms __P ((XDR *__xdrs,
+ struct authunix_parms *__p));
-/*
- * If a response verifier has flavor AUTH_SHORT,
+/*
+ * If a response verifier has flavor AUTH_SHORT,
* then the body of the response verifier encapsulates the following structure;
* again it is serialized in the obvious fashion.
*/
-struct short_hand_verf {
- struct opaque_auth new_cred;
-};
+struct short_hand_verf
+ {
+ struct opaque_auth new_cred;
+ };
+
+__END_DECLS
+
+#endif /* rpc/auth_unix.h */
diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h
index 8c002a19f..b3852927a 100644
--- a/include/rpc/clnt.h
+++ b/include/rpc/clnt.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -34,8 +34,16 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#ifndef _CLNT_
-#define _CLNT_
+#ifndef _RPC_CLNT_H
+#define _RPC_CLNT_H 1
+
+#include <features.h>
+#include <sys/types.h>
+#include <rpc/types.h>
+#include <rpc/auth.h>
+#include <sys/un.h>
+
+__BEGIN_DECLS
/*
* Rpc calls return an enum clnt_stat. This should be looked at more,
@@ -62,22 +70,33 @@ enum clnt_stat {
RPC_PROCUNAVAIL=10, /* procedure unavailable */
RPC_CANTDECODEARGS=11, /* decode arguments error */
RPC_SYSTEMERROR=12, /* generic "other problem" */
-
+ RPC_NOBROADCAST = 21, /* Broadcasting not supported */
/*
* callrpc & clnt_create errors
*/
RPC_UNKNOWNHOST=13, /* unknown host name */
- RPC_UNKNOWNPROTO=17, /* unkown protocol */
+ RPC_UNKNOWNPROTO=17, /* unknown protocol */
+ RPC_UNKNOWNADDR = 19, /* Remote address unknown */
/*
- * _ create errors
+ * rpcbind errors
*/
- RPC_PMAPFAILURE=14, /* the pmapper failed in its call */
+ RPC_RPCBFAILURE=14, /* portmapper failed in its call */
+#define RPC_PMAPFAILURE RPC_RPCBFAILURE
RPC_PROGNOTREGISTERED=15, /* remote program is not registered */
+ RPC_N2AXLATEFAILURE = 22, /* Name to addr translation failed */
/*
* unspecified error
*/
- RPC_FAILED=16
+ RPC_FAILED=16,
+ RPC_INTR=18,
+ RPC_TLIERROR=20,
+ RPC_UDERROR=23,
+ /*
+ * asynchronous errors
+ */
+ RPC_INPROGRESS = 24,
+ RPC_STALERACHANDLE = 25
};
@@ -85,19 +104,19 @@ enum clnt_stat {
* Error info.
*/
struct rpc_err {
- enum clnt_stat re_status;
- union {
- int RE_errno; /* realated system error */
- enum auth_stat RE_why; /* why the auth error occurred */
- struct {
- u_long low; /* lowest verion supported */
- u_long high; /* highest verion supported */
- } RE_vers;
- struct { /* maybe meaningful if RPC_FAILED */
- long s1;
- long s2;
- } RE_lb; /* life boot & debugging only */
- } ru;
+ enum clnt_stat re_status;
+ union {
+ int RE_errno; /* related system error */
+ enum auth_stat RE_why; /* why the auth error occurred */
+ struct {
+ u_long low; /* lowest verion supported */
+ u_long high; /* highest verion supported */
+ } RE_vers;
+ struct { /* maybe meaningful if RPC_FAILED */
+ long s1;
+ long s2;
+ } RE_lb; /* life boot & debugging only */
+ } ru;
#define re_errno ru.RE_errno
#define re_why ru.RE_why
#define re_vers ru.RE_vers
@@ -110,18 +129,25 @@ struct rpc_err {
* Created by individual implementations, see e.g. rpc_udp.c.
* Client is responsible for initializing auth, see e.g. auth_none.c.
*/
-typedef struct {
- AUTH *cl_auth; /* authenticator */
- struct clnt_ops {
- enum clnt_stat (*cl_call)(); /* call remote procedure */
- void (*cl_abort)(); /* abort a call */
- void (*cl_geterr)(); /* get specific error code */
- bool_t (*cl_freeres)(); /* frees results */
- void (*cl_destroy)();/* destroy this structure */
- bool_t (*cl_control)();/* the ioctl() of rpc */
- } *cl_ops;
- caddr_t cl_private; /* private stuff */
-} CLIENT;
+typedef struct CLIENT CLIENT;
+struct CLIENT {
+ AUTH *cl_auth; /* authenticator */
+ struct clnt_ops {
+ enum clnt_stat (*cl_call) __PMT ((CLIENT *, u_long, xdrproc_t,
+ caddr_t, xdrproc_t,
+ caddr_t, struct timeval));
+ /* call remote procedure */
+ void (*cl_abort) __PMT ((void)); /* abort a call */
+ void (*cl_geterr) __PMT ((CLIENT *, struct rpc_err *));
+ /* get specific error code */
+ bool_t (*cl_freeres) __PMT ((CLIENT *, xdrproc_t, caddr_t));
+ /* frees results */
+ void (*cl_destroy) __PMT ((CLIENT *)); /* destroy this structure */
+ bool_t (*cl_control) __PMT ((CLIENT *, int, char *));
+ /* the ioctl() of rpc */
+ } *cl_ops;
+ caddr_t cl_private; /* private stuff */
+};
/*
@@ -185,16 +211,33 @@ typedef struct {
#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
/*
- * control operations that apply to both udp and tcp transports
+ * control operations that apply to all transports
+ *
+ * Note: options marked XXX are no-ops in this implementation of RPC.
+ * The are present in TI-RPC but can't be implemented here since they
+ * depend on the presence of STREAMS/TLI, which we don't have.
*/
-#define CLSET_TIMEOUT 1 /* set timeout (timeval) */
-#define CLGET_TIMEOUT 2 /* get timeout (timeval) */
-#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */
+#define CLSET_TIMEOUT 1 /* set timeout (timeval) */
+#define CLGET_TIMEOUT 2 /* get timeout (timeval) */
+#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */
+#define CLGET_FD 6 /* get connections file descriptor */
+#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) XXX */
+#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */
+#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy*/
+#define CLGET_XID 10 /* Get xid */
+#define CLSET_XID 11 /* Set xid */
+#define CLGET_VERS 12 /* Get version number */
+#define CLSET_VERS 13 /* Set version number */
+#define CLGET_PROG 14 /* Get program number */
+#define CLSET_PROG 15 /* Set program number */
+#define CLSET_SVC_ADDR 16 /* get server's address (netbuf) XXX */
+#define CLSET_PUSH_TIMOD 17 /* push timod if not already present XXX */
+#define CLSET_POP_TIMOD 18 /* pop timod XXX */
/*
- * udp only control operations
+ * Connectionless only control operations
*/
-#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
-#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
+#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
+#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
/*
* void
@@ -206,7 +249,7 @@ typedef struct {
/*
- * RPCTEST is a test program which is accessable on every rpc
+ * RPCTEST is a test program which is accessible on every rpc
* transport/port. It is used for testing, performance evaluation,
* and network administration.
*/
@@ -224,7 +267,7 @@ typedef struct {
/*
* Below are the client handle creation routines for the various
- * implementations of client side rpc. They can return NULL if a
+ * implementations of client side rpc. They can return NULL if a
* creation failure occurs.
*/
@@ -235,21 +278,22 @@ typedef struct {
* u_long prog;
* u_long vers;
*/
-extern CLIENT *clntraw_create();
+extern CLIENT *clntraw_create __P ((__const u_long __prog,
+ __const u_long __vers));
/*
- * Generic client creation routine. Supported protocols are "udp" and "tcp"
+ * Generic client creation routine. Supported protocols are "udp", "tcp" and
+ * "unix"
+ * CLIENT *
+ * clnt_create(host, prog, vers, prot)
+ * char *host; -- hostname
+ * u_long prog; -- program number
+ * u_ong vers; -- version number
+ * char *prot; -- protocol
*/
-extern CLIENT *
-clnt_create(/*host, prog, vers, prot*/); /*
- char *host; -- hostname
- u_long prog; -- program number
- u_long vers; -- version number
- char *prot; -- protocol
-*/
-
-
+extern CLIENT *clnt_create __P ((__const char *__host, __const u_long __prog,
+ __const u_long __vers, __const char *__prot));
/*
@@ -263,7 +307,10 @@ clnt_create(/*host, prog, vers, prot*/); /*
* u_int sendsz;
* u_int recvsz;
*/
-extern CLIENT *clnttcp_create();
+extern CLIENT *clnttcp_create __P ((struct sockaddr_in *__raddr,
+ u_long __prog, u_long __version,
+ int *__sockp, u_int __sendsz,
+ u_int __recvsz));
/*
* UDP based rpc.
@@ -272,7 +319,7 @@ extern CLIENT *clnttcp_create();
* struct sockaddr_in *raddr;
* u_long program;
* u_long version;
- * struct timeval wait;
+ * struct timeval wait_resend;
* int *sockp;
*
* Same as above, but you specify max packet sizes.
@@ -281,32 +328,65 @@ extern CLIENT *clnttcp_create();
* struct sockaddr_in *raddr;
* u_long program;
* u_long version;
- * struct timeval wait;
+ * struct timeval wait_resend;
* int *sockp;
* u_int sendsz;
* u_int recvsz;
*/
-extern CLIENT *clntudp_create();
-extern CLIENT *clntudp_bufcreate();
+extern CLIENT *clntudp_create __P ((struct sockaddr_in *__raddr,
+ u_long __program, u_long __version,
+ struct timeval __wait_resend,
+ int *__sockp));
+extern CLIENT *clntudp_bufcreate __P ((struct sockaddr_in *__raddr,
+ u_long __program, u_long __version,
+ struct timeval __wait_resend,
+ int *__sockp, u_int __sendsz,
+ u_int __recvsz));
+
+
+/*
+ * AF_UNIX based rpc
+ * CLIENT *
+ * clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
+ * struct sockaddr_un *raddr;
+ * u_long prog;
+ * u_long version;
+ * register int *sockp;
+ * u_int sendsz;
+ * u_int recvsz;
+ */
+extern CLIENT *clntunix_create __P ((struct sockaddr_un *__raddr,
+ u_long __program, u_long __version,
+ int *__sockp, u_int __sendsz,
+ u_int __recvsz));
+
+
+extern int callrpc __P ((__const char *__host, __const u_long __prognum,
+ __const u_long __versnum, __const u_long __procnum,
+ __const xdrproc_t __inproc, __const char *__in,
+ __const xdrproc_t __outproc, char *__out));
+extern int _rpc_dtablesize __P ((void));
/*
* Print why creation failed
*/
-void clnt_pcreateerror(/* char *msg */); /* stderr */
-char *clnt_spcreateerror(/* char *msg */); /* string */
+extern void clnt_pcreateerror __P ((__const char *__msg)); /* stderr */
+extern char *clnt_spcreateerror __P ((__const char *__msg)); /* string */
/*
* Like clnt_perror(), but is more verbose in its output
- */
-void clnt_perrno(/* enum clnt_stat num */); /* stderr */
+ */
+extern void clnt_perrno __P ((enum clnt_stat __num)); /* stderr */
/*
* Print an English error message, given the client error code
*/
-void clnt_perror(/* CLIENT *clnt, char *msg */); /* stderr */
-char *clnt_sperror(/* CLIENT *clnt, char *msg */); /* string */
+extern void clnt_perror __P ((CLIENT *__clnt, __const char *__msg));
+ /* stderr */
+extern char *clnt_sperror __P ((CLIENT *__clnt, __const char *__msg));
+ /* string */
-/*
+/*
* If a creation fails, the following allows the user to figure out why.
*/
struct rpc_createerr {
@@ -321,11 +401,23 @@ extern struct rpc_createerr rpc_createerr;
/*
* Copy error message to buffer.
*/
-char *clnt_sperrno(/* enum clnt_stat num */); /* string */
+extern char *clnt_sperrno __P ((enum clnt_stat __num)); /* string */
+/*
+ * get the port number on the host for the rpc program,version and proto
+ */
+extern int getrpcport __P ((__const char * __host, u_long __prognum,
+ u_long __versnum, u_int proto));
+/*
+ * get the local host's IP address without consulting
+ * name service library functions
+ */
+extern void get_myaddress __P ((struct sockaddr_in *));
#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */
#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */
-#endif /*!_CLNT_*/
+__END_DECLS
+
+#endif /* rpc/clnt.h */
diff --git a/include/rpc/des_crypt.h b/include/rpc/des_crypt.h
new file mode 100644
index 000000000..e20cc3824
--- /dev/null
+++ b/include/rpc/des_crypt.h
@@ -0,0 +1,97 @@
+/*
+ * @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI
+ *
+ * des_crypt.h, des library routine interface
+ * Copyright (C) 1986, Sun Microsystems, Inc.
+ */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#ifndef __DES_CRYPT_H__
+#define __DES_CRYPT_H__ 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+#define DES_MAXDATA 8192 /* max bytes encrypted in one call */
+#define DES_DIRMASK (1 << 0)
+#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */
+#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */
+
+
+#define DES_DEVMASK (1 << 1)
+#define DES_HW (0*DES_DEVMASK) /* Use hardware device */
+#define DES_SW (1*DES_DEVMASK) /* Use software device */
+
+
+#define DESERR_NONE 0 /* succeeded */
+#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */
+#define DESERR_HWERROR 2 /* failed, hardware/driver error */
+#define DESERR_BADPARAM 3 /* failed, bad parameter to call */
+
+#define DES_FAILED(err) \
+ ((err) > DESERR_NOHWDEVICE)
+
+/*
+ * cbc_crypt()
+ * ecb_crypt()
+ *
+ * Encrypt (or decrypt) len bytes of a buffer buf.
+ * The length must be a multiple of eight.
+ * The key should have odd parity in the low bit of each byte.
+ * ivec is the input vector, and is updated to the new one (cbc only).
+ * The mode is created by oring together the appropriate parameters.
+ * DESERR_NOHWDEVICE is returned if DES_HW was specified but
+ * there was no hardware to do it on (the data will still be
+ * encrypted though, in software).
+ */
+
+
+/*
+ * Cipher Block Chaining mode
+ */
+extern int cbc_crypt __P ((char *__key, char *__buf, unsigned __len,
+ unsigned __mode, char *__ivec));
+
+/*
+ * Electronic Code Book mode
+ */
+extern int ecb_crypt __P ((char *__key, char *__buf, unsigned __len,
+ unsigned __mode));
+
+/*
+ * Set des parity for a key.
+ * DES parity is odd and in the low bit of each byte
+ */
+extern void des_setparity __P ((char *__key));
+
+__END_DECLS
+
+#endif
diff --git a/include/rpc/key_prot.h b/include/rpc/key_prot.h
new file mode 100644
index 000000000..3e2eb7208
--- /dev/null
+++ b/include/rpc/key_prot.h
@@ -0,0 +1,346 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _KEY_PROT_H_RPCGEN
+#define _KEY_PROT_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+#if 0
+#pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI"
+#endif
+/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */
+
+/*
+ * Compiled from key_prot.x using rpcgen.
+ * DO NOT EDIT THIS FILE!
+ * This is NOT source code!
+ */
+#define PROOT 3
+#define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"
+#define HEXKEYBYTES 48
+#define KEYSIZE 192
+#define KEYBYTES 24
+#define KEYCHECKSUMSIZE 16
+
+enum keystatus {
+ KEY_SUCCESS = 0,
+ KEY_NOSECRET = 1,
+ KEY_UNKNOWN = 2,
+ KEY_SYSTEMERR = 3,
+};
+typedef enum keystatus keystatus;
+#ifdef __cplusplus
+extern "C" bool_t xdr_keystatus(XDR *, keystatus*);
+#elif __STDC__
+extern bool_t xdr_keystatus(XDR *, keystatus*);
+#else /* Old Style C */
+bool_t xdr_keystatus();
+#endif /* Old Style C */
+
+
+typedef char keybuf[HEXKEYBYTES];
+#ifdef __cplusplus
+extern "C" bool_t xdr_keybuf(XDR *, keybuf);
+#elif __STDC__
+extern bool_t xdr_keybuf(XDR *, keybuf);
+#else /* Old Style C */
+bool_t xdr_keybuf();
+#endif /* Old Style C */
+
+
+typedef char *netnamestr;
+#ifdef __cplusplus
+extern "C" bool_t xdr_netnamestr(XDR *, netnamestr*);
+#elif __STDC__
+extern bool_t xdr_netnamestr(XDR *, netnamestr*);
+#else /* Old Style C */
+bool_t xdr_netnamestr();
+#endif /* Old Style C */
+
+
+struct cryptkeyarg {
+ netnamestr remotename;
+ des_block deskey;
+};
+typedef struct cryptkeyarg cryptkeyarg;
+#ifdef __cplusplus
+extern "C" bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*);
+#elif __STDC__
+extern bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*);
+#else /* Old Style C */
+bool_t xdr_cryptkeyarg();
+#endif /* Old Style C */
+
+
+struct cryptkeyarg2 {
+ netnamestr remotename;
+ netobj remotekey;
+ des_block deskey;
+};
+typedef struct cryptkeyarg2 cryptkeyarg2;
+#ifdef __cplusplus
+extern "C" bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*);
+#elif __STDC__
+extern bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*);
+#else /* Old Style C */
+bool_t xdr_cryptkeyarg2();
+#endif /* Old Style C */
+
+
+struct cryptkeyres {
+ keystatus status;
+ union {
+ des_block deskey;
+ } cryptkeyres_u;
+};
+typedef struct cryptkeyres cryptkeyres;
+#ifdef __cplusplus
+extern "C" bool_t xdr_cryptkeyres(XDR *, cryptkeyres*);
+#elif __STDC__
+extern bool_t xdr_cryptkeyres(XDR *, cryptkeyres*);
+#else /* Old Style C */
+bool_t xdr_cryptkeyres();
+#endif /* Old Style C */
+
+#define MAXGIDS 16
+
+struct unixcred {
+ u_int uid;
+ u_int gid;
+ struct {
+ u_int gids_len;
+ u_int *gids_val;
+ } gids;
+};
+typedef struct unixcred unixcred;
+#ifdef __cplusplus
+extern "C" bool_t xdr_unixcred(XDR *, unixcred*);
+#elif __STDC__
+extern bool_t xdr_unixcred(XDR *, unixcred*);
+#else /* Old Style C */
+bool_t xdr_unixcred();
+#endif /* Old Style C */
+
+
+struct getcredres {
+ keystatus status;
+ union {
+ unixcred cred;
+ } getcredres_u;
+};
+typedef struct getcredres getcredres;
+#ifdef __cplusplus
+extern "C" bool_t xdr_getcredres(XDR *, getcredres*);
+#elif __STDC__
+extern bool_t xdr_getcredres(XDR *, getcredres*);
+#else /* Old Style C */
+bool_t xdr_getcredres();
+#endif /* Old Style C */
+
+
+struct key_netstarg {
+ keybuf st_priv_key;
+ keybuf st_pub_key;
+ netnamestr st_netname;
+};
+typedef struct key_netstarg key_netstarg;
+#ifdef __cplusplus
+extern "C" bool_t xdr_key_netstarg(XDR *, key_netstarg*);
+#elif __STDC__
+extern bool_t xdr_key_netstarg(XDR *, key_netstarg*);
+#else /* Old Style C */
+bool_t xdr_key_netstarg();
+#endif /* Old Style C */
+
+
+struct key_netstres {
+ keystatus status;
+ union {
+ key_netstarg knet;
+ } key_netstres_u;
+};
+typedef struct key_netstres key_netstres;
+#ifdef __cplusplus
+extern "C" bool_t xdr_key_netstres(XDR *, key_netstres*);
+#elif __STDC__
+extern bool_t xdr_key_netstres(XDR *, key_netstres*);
+#else /* Old Style C */
+bool_t xdr_key_netstres();
+#endif /* Old Style C */
+
+
+#ifndef opaque
+#define opaque char
+#endif
+
+
+#define KEY_PROG ((u_long)100029)
+#define KEY_VERS ((u_long)1)
+
+#ifdef __cplusplus
+#define KEY_SET ((u_long)1)
+extern "C" keystatus * key_set_1(opaque *, CLIENT *);
+extern "C" keystatus * key_set_1_svc(opaque *, struct svc_req *);
+#define KEY_ENCRYPT ((u_long)2)
+extern "C" cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *);
+extern "C" cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *);
+#define KEY_DECRYPT ((u_long)3)
+extern "C" cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *);
+extern "C" cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *);
+#define KEY_GEN ((u_long)4)
+extern "C" des_block * key_gen_1(void *, CLIENT *);
+extern "C" des_block * key_gen_1_svc(void *, struct svc_req *);
+#define KEY_GETCRED ((u_long)5)
+extern "C" getcredres * key_getcred_1(netnamestr *, CLIENT *);
+extern "C" getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *);
+
+#elif __STDC__
+#define KEY_SET ((u_long)1)
+extern keystatus * key_set_1(opaque *, CLIENT *);
+extern keystatus * key_set_1_svc(opaque *, struct svc_req *);
+#define KEY_ENCRYPT ((u_long)2)
+extern cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *);
+extern cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *);
+#define KEY_DECRYPT ((u_long)3)
+extern cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *);
+extern cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *);
+#define KEY_GEN ((u_long)4)
+extern des_block * key_gen_1(void *, CLIENT *);
+extern des_block * key_gen_1_svc(void *, struct svc_req *);
+#define KEY_GETCRED ((u_long)5)
+extern getcredres * key_getcred_1(netnamestr *, CLIENT *);
+extern getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *);
+
+#else /* Old Style C */
+#define KEY_SET ((u_long)1)
+extern keystatus * key_set_1();
+extern keystatus * key_set_1_svc();
+#define KEY_ENCRYPT ((u_long)2)
+extern cryptkeyres * key_encrypt_1();
+extern cryptkeyres * key_encrypt_1_svc();
+#define KEY_DECRYPT ((u_long)3)
+extern cryptkeyres * key_decrypt_1();
+extern cryptkeyres * key_decrypt_1_svc();
+#define KEY_GEN ((u_long)4)
+extern des_block * key_gen_1();
+extern des_block * key_gen_1_svc();
+#define KEY_GETCRED ((u_long)5)
+extern getcredres * key_getcred_1();
+extern getcredres * key_getcred_1_svc();
+#endif /* Old Style C */
+#define KEY_VERS2 ((u_long)2)
+
+#ifdef __cplusplus
+extern "C" keystatus * key_set_2(opaque *, CLIENT *);
+extern "C" keystatus * key_set_2_svc(opaque *, struct svc_req *);
+extern "C" cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *);
+extern "C" cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *);
+extern "C" cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *);
+extern "C" cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *);
+extern "C" des_block * key_gen_2(void *, CLIENT *);
+extern "C" des_block * key_gen_2_svc(void *, struct svc_req *);
+extern "C" getcredres * key_getcred_2(netnamestr *, CLIENT *);
+extern "C" getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *);
+#define KEY_ENCRYPT_PK ((u_long)6)
+extern "C" cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *);
+extern "C" cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
+#define KEY_DECRYPT_PK ((u_long)7)
+extern "C" cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *);
+extern "C" cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
+#define KEY_NET_PUT ((u_long)8)
+extern "C" keystatus * key_net_put_2(key_netstarg *, CLIENT *);
+extern "C" keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *);
+#define KEY_NET_GET ((u_long)9)
+extern "C" key_netstres * key_net_get_2(void *, CLIENT *);
+extern "C" key_netstres * key_net_get_2_svc(void *, struct svc_req *);
+#define KEY_GET_CONV ((u_long)10)
+extern "C" cryptkeyres * key_get_conv_2(opaque *, CLIENT *);
+extern "C" cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *);
+
+#elif __STDC__
+extern keystatus * key_set_2(opaque *, CLIENT *);
+extern keystatus * key_set_2_svc(opaque *, struct svc_req *);
+extern cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *);
+extern cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *);
+extern cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *);
+extern cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *);
+extern des_block * key_gen_2(void *, CLIENT *);
+extern des_block * key_gen_2_svc(void *, struct svc_req *);
+extern getcredres * key_getcred_2(netnamestr *, CLIENT *);
+extern getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *);
+#define KEY_ENCRYPT_PK ((u_long)6)
+extern cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *);
+extern cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
+#define KEY_DECRYPT_PK ((u_long)7)
+extern cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *);
+extern cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
+#define KEY_NET_PUT ((u_long)8)
+extern keystatus * key_net_put_2(key_netstarg *, CLIENT *);
+extern keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *);
+#define KEY_NET_GET ((u_long)9)
+extern key_netstres * key_net_get_2(void *, CLIENT *);
+extern key_netstres * key_net_get_2_svc(void *, struct svc_req *);
+#define KEY_GET_CONV ((u_long)10)
+extern cryptkeyres * key_get_conv_2(opaque *, CLIENT *);
+extern cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *);
+
+#else /* Old Style C */
+extern keystatus * key_set_2();
+extern keystatus * key_set_2_svc();
+extern cryptkeyres * key_encrypt_2();
+extern cryptkeyres * key_encrypt_2_svc();
+extern cryptkeyres * key_decrypt_2();
+extern cryptkeyres * key_decrypt_2_svc();
+extern des_block * key_gen_2();
+extern des_block * key_gen_2_svc();
+extern getcredres * key_getcred_2();
+extern getcredres * key_getcred_2_svc();
+#define KEY_ENCRYPT_PK ((u_long)6)
+extern cryptkeyres * key_encrypt_pk_2();
+extern cryptkeyres * key_encrypt_pk_2_svc();
+#define KEY_DECRYPT_PK ((u_long)7)
+extern cryptkeyres * key_decrypt_pk_2();
+extern cryptkeyres * key_decrypt_pk_2_svc();
+#define KEY_NET_PUT ((u_long)8)
+extern keystatus * key_net_put_2();
+extern keystatus * key_net_put_2_svc();
+#define KEY_NET_GET ((u_long)9)
+extern key_netstres * key_net_get_2();
+extern key_netstres * key_net_get_2_svc();
+#define KEY_GET_CONV ((u_long)10)
+extern cryptkeyres * key_get_conv_2();
+extern cryptkeyres * key_get_conv_2_svc();
+#endif /* Old Style C */
+
+#endif /* !_KEY_PROT_H_RPCGEN */
diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h
new file mode 100644
index 000000000..6b820c84d
--- /dev/null
+++ b/include/rpc/netdb.h
@@ -0,0 +1,74 @@
+/* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+/* @(#)rpc.h 1.8 87/07/24 SMI */
+
+/* Cleaned up for GNU C library roland@gnu.ai.mit.edu:
+ added multiple inclusion protection and use of <sys/cdefs.h>.
+ In GNU this file is #include'd by <netdb.h>. */
+
+#ifndef _RPC_NETDB_H
+#define _RPC_NETDB_H 1
+
+#include <features.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+__BEGIN_DECLS
+
+struct rpcent
+{
+ char *r_name; /* Name of server for this rpc program. */
+ char **r_aliases; /* Alias list. */
+ int r_number; /* RPC program number. */
+};
+
+extern void setrpcent __P ((int _stayopen));
+extern void endrpcent __P ((void));
+extern struct rpcent *getrpcbyname __P ((__const char *__name));
+extern struct rpcent *getrpcbynumber __P ((int __number));
+extern struct rpcent *getrpcent __P ((void));
+
+#ifdef __USE_MISC
+extern int getrpcbyname_r __P ((__const char *__name,
+ struct rpcent *__result_buf, char *__buffer,
+ size_t __buflen, struct rpcent **__result));
+
+extern int getrpcbynumber_r __P ((int __number, struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct rpcent **__result));
+
+extern int getrpcent_r __P ((struct rpcent *__result_buf, char *__buffer,
+ size_t __buflen, struct rpcent **__result));
+#endif
+
+__END_DECLS
+
+#endif /* rpc/netdb.h */
diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index d2ea2a88e..d9800d400 100644
--- a/include/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -35,6 +35,19 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
+#ifndef _RPC_PMAP_CLNT_H
+#define _RPC_PMAP_CLNT_H 1
+
+#include <features.h>
+#include <rpc/types.h>
+#include <rpc/xdr.h>
+#include <rpc/clnt.h>
+
+__BEGIN_DECLS
+
+typedef bool_t (*resultproc_t) __PMT ((caddr_t resp,
+ struct sockaddr_in *raddr));
+
/*
* Usage:
* success = pmap_set(program, version, protocol, port);
@@ -43,7 +56,7 @@
* head = pmap_getmaps(address);
* clnt_stat = pmap_rmtcall(address, program, version, procedure,
* xdrargs, argsp, xdrres, resp, tout, port_ptr)
- * (works for udp only.)
+ * (works for udp only.)
* clnt_stat = clnt_broadcast(program, version, procedure,
* xdrargs, argsp, xdrres, resp, eachresult)
* (like pmap_rmtcall, except the call is broadcasted to all
@@ -57,9 +70,31 @@
* address if the responder to the broadcast.
*/
-extern bool_t pmap_set();
-extern bool_t pmap_unset();
-extern struct pmaplist *pmap_getmaps();
-enum clnt_stat pmap_rmtcall();
-enum clnt_stat clnt_broadcast();
-extern u_short pmap_getport();
+extern bool_t pmap_set __P ((__const u_long __program, __const u_long __vers,
+ int __protocol, u_short __port));
+extern bool_t pmap_unset __P ((__const u_long __program, __const u_long __vers));
+extern struct pmaplist *pmap_getmaps __P ((struct sockaddr_in *__address));
+extern enum clnt_stat pmap_rmtcall __P ((struct sockaddr_in *__addr,
+ __const u_long __prog,
+ __const u_long __vers,
+ __const u_long __proc,
+ xdrproc_t __xdrargs,
+ caddr_t __argsp, xdrproc_t __xdrres,
+ caddr_t __resp, struct timeval __tout,
+ u_long *__port_ptr));
+extern enum clnt_stat clnt_broadcast __P ((__const u_long __prog,
+ __const u_long __vers,
+ __const u_long __proc,
+ xdrproc_t __xargs,
+ caddr_t __argsp,
+ xdrproc_t __xresults,
+ caddr_t __resultsp,
+ resultproc_t __eachresult));
+extern u_short pmap_getport __P ((struct sockaddr_in *__address,
+ __const u_long __program,
+ __const u_long __version,
+ u_int __protocol));
+
+__END_DECLS
+
+#endif /* rpc/pmap_clnt.h */
diff --git a/include/rpc/pmap_prot.h b/include/rpc/pmap_prot.h
index ccf7a77b4..52185d319 100644
--- a/include/rpc/pmap_prot.h
+++ b/include/rpc/pmap_prot.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -33,8 +33,18 @@
* Protocol for the local binder service, or pmap.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * The following procedures are supported by the protocol:
+ */
+
+#ifndef _RPC_PMAP_PROT_H
+#define _RPC_PMAP_PROT_H 1
+
+#include <features.h>
+
+#include <rpc/xdr.h>
+
+__BEGIN_DECLS
+
+/* The following procedures are supported by the protocol:
*
* PMAPPROC_NULL() returns ()
* takes nothing, returns nothing
@@ -84,11 +94,15 @@ struct pmap {
long unsigned pm_port;
};
-extern bool_t xdr_pmap();
+extern bool_t xdr_pmap __P ((XDR *__xdrs, struct pmap *__regs));
struct pmaplist {
struct pmap pml_map;
struct pmaplist *pml_next;
};
-extern bool_t xdr_pmaplist();
+extern bool_t xdr_pmaplist __P ((XDR *__xdrs, struct pmaplist **__rp));
+
+__END_DECLS
+
+#endif /* rpc/pmap_prot.h */
diff --git a/include/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h
index ee68cebec..bb35ad63e 100644
--- a/include/rpc/pmap_rmt.h
+++ b/include/rpc/pmap_rmt.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -35,13 +35,23 @@
* Copyright (C) 1986, Sun Microsystems, Inc.
*/
+#ifndef _RPC_PMAP_RMT_H
+#define _RPC_PMAP_RMT_H 1
+
+#include <features.h>
+#include <sys/types.h>
+#include <rpc/types.h>
+#include <rpc/xdr.h>
+
+__BEGIN_DECLS
+
struct rmtcallargs {
u_long prog, vers, proc, arglen;
caddr_t args_ptr;
xdrproc_t xdr_args;
};
-bool_t xdr_rmtcall_args();
+extern bool_t xdr_rmtcall_args __P ((XDR *__xdrs, struct rmtcallargs *__crp));
struct rmtcallres {
u_long *port_ptr;
@@ -50,4 +60,8 @@ struct rmtcallres {
xdrproc_t xdr_results;
};
-bool_t xdr_rmtcallres();
+extern bool_t xdr_rmtcallres __P ((XDR *__xdrs, struct rmtcallres *__crp));
+
+__END_DECLS
+
+#endif /* rpc/pmap_rmt.h */
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index f1da8fa7f..a966d2e23 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -6,11 +6,11 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
@@ -34,12 +34,9 @@
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#ifndef __RPC_HEADER__
-#define __RPC_HEADER__
-#ifdef __linux__
-#include <sys/time.h>
-#endif
+#ifndef _RPC_RPC_H
+#define _RPC_RPC_H 1
#include <rpc/types.h> /* some typedefs */
#include <netinet/in.h>
@@ -56,11 +53,7 @@
/* semi-private protocol headers */
#include <rpc/rpc_msg.h> /* protocol for rpc messages */
#include <rpc/auth_unix.h> /* protocol for unix style cred */
-/*
- * Uncomment-out the next line if you are building the rpc library with
- * DES Authentication (see the README file in the secure_rpc/ directory).
- */
-/*#include <rpc/auth_des.h>*/ /* protocol for des style cred */
+#include <rpc/auth_des.h> /* protocol for des style cred */
/* Server side only remote procedure callee */
#include <rpc/svc.h> /* service manager and multiplexer */
@@ -72,8 +65,6 @@
* defined by <rpc/netdb.h> included in <netdb.h>.
*/
/* routines for parsing /etc/rpc */
-#if 0
#include <rpc/netdb.h> /* structures and routines to parse /etc/rpc */
-#endif
-#endif /* ndef __RPC_HEADER__ */
+#endif /* rpc/rpc.h */
diff --git a/include/rpc/rpc_des.h b/include/rpc/rpc_des.h
new file mode 100644
index 000000000..0f36d1697
--- /dev/null
+++ b/include/rpc/rpc_des.h
@@ -0,0 +1,72 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+/*
+ * Generic DES driver interface
+ * Keep this file hardware independent!
+ * Copyright (c) 1986 by Sun Microsystems, Inc.
+ */
+
+#ifndef _DES_H
+#define _DES_H
+
+#include <sys/types.h>
+
+#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
+#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
+
+enum desdir
+ {
+ ENCRYPT, DECRYPT
+ };
+enum desmode
+ {
+ CBC, ECB
+ };
+
+/*
+ * parameters to ioctl call
+ */
+struct desparams
+ {
+ u_char des_key[8]; /* key (with low bit parity) */
+ enum desdir des_dir; /* direction */
+ enum desmode des_mode; /* mode */
+ u_char des_ivec[8]; /* input vector */
+ unsigned des_len; /* number of bytes to crypt */
+ union
+ {
+ u_char UDES_data[DES_QUICKLEN];
+ u_char *UDES_buf;
+ }
+ UDES;
+#define des_data UDES.UDES_data /* direct data here if quick */
+#define des_buf UDES.UDES_buf /* otherwise, pointer to data */
+ };
+
+#endif
diff --git a/include/rpc/rpc_msg.h b/include/rpc/rpc_msg.h
index b78872b6a..e2908ac9c 100644
--- a/include/rpc/rpc_msg.h
+++ b/include/rpc/rpc_msg.h
@@ -6,29 +6,37 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/* @(#)rpc_msg.h 1.7 86/07/16 SMI */
+#ifndef _RPC_MSG_H
+#define _RPC_MSG_H 1
+
+#include <sys/cdefs.h>
+
+#include <rpc/xdr.h>
+#include <rpc/clnt.h>
+
/*
* rpc_msg.h
* rpc message definition
@@ -39,9 +47,11 @@
#define RPC_MSG_VERSION ((u_long) 2)
#define RPC_SERVICE_PORT ((u_short) 2048)
+__BEGIN_DECLS
+
/*
* Bottom up definition of an rpc message.
- * NOTE: call and reply use the same overall stuct but
+ * NOTE: call and reply use the same overall struct but
* different parts of unions within it.
*/
@@ -160,7 +170,7 @@ struct rpc_msg {
* XDR *xdrs;
* struct rpc_msg *cmsg;
*/
-extern bool_t xdr_callmsg();
+extern bool_t xdr_callmsg __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
/*
* XDR routine to pre-serialize the static part of a rpc message.
@@ -168,7 +178,7 @@ extern bool_t xdr_callmsg();
* XDR *xdrs;
* struct rpc_msg *cmsg;
*/
-extern bool_t xdr_callhdr();
+extern bool_t xdr_callhdr __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
/*
* XDR routine to handle a rpc reply.
@@ -176,7 +186,7 @@ extern bool_t xdr_callhdr();
* XDR *xdrs;
* struct rpc_msg *rmsg;
*/
-extern bool_t xdr_replymsg();
+extern bool_t xdr_replymsg __P ((XDR *__xdrs, struct rpc_msg *__rmsg));
/*
* Fills in the error part of a reply message.
@@ -184,4 +194,9 @@ extern bool_t xdr_replymsg();
* struct rpc_msg *msg;
* struct rpc_err *error;
*/
-extern void _seterr_reply();
+extern void _seterr_reply __P ((struct rpc_msg *__msg,
+ struct rpc_err *__error));
+
+__END_DECLS
+
+#endif /* rpc/rpc_msg.h */
diff --git a/include/rpc/svc.h b/include/rpc/svc.h
index a36a24ba0..4ac2a5cdf 100644
--- a/include/rpc/svc.h
+++ b/include/rpc/svc.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -34,8 +34,13 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#ifndef __SVC_HEADER__
-#define __SVC_HEADER__
+#ifndef _RPC_SVC_H
+#define _RPC_SVC_H 1
+
+#include <features.h>
+#include <rpc/rpc_msg.h>
+
+__BEGIN_DECLS
/*
* This interface must manage two items concerning remote procedure calling:
@@ -68,23 +73,31 @@ enum xprt_stat {
/*
* Server side transport handle
*/
-typedef struct {
- int xp_sock;
- u_short xp_port; /* associated port number */
- struct xp_ops {
- bool_t (*xp_recv)(); /* receive incomming requests */
- enum xprt_stat (*xp_stat)(); /* get transport status */
- bool_t (*xp_getargs)(); /* get arguments */
- bool_t (*xp_reply)(); /* send reply */
- bool_t (*xp_freeargs)();/* free mem allocated for args */
- void (*xp_destroy)(); /* destroy this struct */
- } *xp_ops;
- int xp_addrlen; /* length of remote address */
- struct sockaddr_in xp_raddr; /* remote address */
- struct opaque_auth xp_verf; /* raw response verifier */
- caddr_t xp_p1; /* private */
- caddr_t xp_p2; /* private */
-} SVCXPRT;
+typedef struct SVCXPRT SVCXPRT;
+struct SVCXPRT {
+ int xp_sock;
+ u_short xp_port; /* associated port number */
+ const struct xp_ops {
+ bool_t (*xp_recv) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+ /* receive incoming requests */
+ enum xprt_stat (*xp_stat) __PMT ((SVCXPRT *__xprt));
+ /* get transport status */
+ bool_t (*xp_getargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+ caddr_t args_ptr)); /* get arguments */
+ bool_t (*xp_reply) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+ /* send reply */
+ bool_t (*xp_freeargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+ caddr_t args_ptr));
+ /* free mem allocated for args */
+ void (*xp_destroy) __PMT ((SVCXPRT *__xprt));
+ /* destroy this struct */
+ } *xp_ops;
+ int xp_addrlen; /* length of remote address */
+ struct sockaddr_in xp_raddr; /* remote address */
+ struct opaque_auth xp_verf; /* raw response verifier */
+ caddr_t xp_p1; /* private */
+ caddr_t xp_p2; /* private */
+};
/*
* Approved way of getting address of caller
@@ -142,6 +155,10 @@ struct svc_req {
SVCXPRT *rq_xprt; /* associated transport */
};
+#ifndef __DISPATCH_FN_T
+#define __DISPATCH_FN_T
+typedef void (*__dispatch_fn_t) __PMT ((struct svc_req*, SVCXPRT*));
+#endif
/*
* Service registration
@@ -151,8 +168,11 @@ struct svc_req {
* u_long prog;
* u_long vers;
* void (*dispatch)();
- * int protocol; */ /* like TCP or UDP, zero means do not register*/
-extern bool_t svc_register();
+ * u_long protocol; like TCP or UDP, zero means do not register
+ */
+extern bool_t svc_register __P ((SVCXPRT *__xprt, u_long __prog,
+ u_long __vers, __dispatch_fn_t __dispatch,
+ u_long __protocol));
/*
* Service un-registration
@@ -161,7 +181,7 @@ extern bool_t svc_register();
* u_long prog;
* u_long vers;
*/
-extern void svc_unregister();
+extern void svc_unregister __P ((u_long __prog, u_long __vers));
/*
* Transport registration.
@@ -169,7 +189,7 @@ extern void svc_unregister();
* xprt_register(xprt)
* SVCXPRT *xprt;
*/
-extern void xprt_register();
+extern void xprt_register __P ((SVCXPRT *__xprt));
/*
* Transport un-register
@@ -177,7 +197,7 @@ extern void xprt_register();
* xprt_unregister(xprt)
* SVCXPRT *xprt;
*/
-extern void xprt_unregister();
+extern void xprt_unregister __P ((SVCXPRT *__xprt));
@@ -185,7 +205,7 @@ extern void xprt_unregister();
/*
* When the service routine is called, it must first check to see if it
* knows about the procedure; if not, it should call svcerr_noproc
- * and return. If so, it should deserialize its arguments via
+ * and return. If so, it should deserialize its arguments via
* SVC_GETARGS (defined above). If the deserialization does not work,
* svcerr_decode should be called followed by a return. Successful
* decoding of the arguments should be followed the execution of the
@@ -196,7 +216,7 @@ extern void xprt_unregister();
* Note: do not confuse access-control failure with weak authentication!
*
* NB: In pure implementations of rpc, the caller always waits for a reply
- * msg. This message is sent when svc_sendreply is called.
+ * msg. This message is sent when svc_sendreply is called.
* Therefore pure service implementations should always call
* svc_sendreply even if the function logically returns void; use
* xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
@@ -208,21 +228,30 @@ extern void xprt_unregister();
* deadlock the caller and server processes!
*/
-extern bool_t svc_sendreply();
-extern void svcerr_decode();
-extern void svcerr_weakauth();
-extern void svcerr_noproc();
-extern void svcerr_progvers();
-extern void svcerr_auth();
-extern void svcerr_noprog();
-extern void svcerr_systemerr();
-
+extern bool_t svc_sendreply __P ((SVCXPRT *xprt, xdrproc_t __xdr_results,
+ caddr_t __xdr_location));
+
+extern void svcerr_decode __P ((SVCXPRT *__xprt));
+
+extern void svcerr_weakauth __P ((SVCXPRT *__xprt));
+
+extern void svcerr_noproc __P ((SVCXPRT *__xprt));
+
+extern void svcerr_progvers __P ((SVCXPRT *__xprt, u_long __low_vers,
+ u_long __high_vers));
+
+extern void svcerr_auth __P ((SVCXPRT *__xprt, enum auth_stat __why));
+
+extern void svcerr_noprog __P ((SVCXPRT *__xprt));
+
+extern void svcerr_systemerr __P ((SVCXPRT *__xprt));
+
/*
* Lowest level dispatching -OR- who owns this process anyway.
* Somebody has to wait for incoming requests and then call the correct
* service routine. The routine svc_run does infinite waiting; i.e.,
* svc_run never returns.
- * Since another (co-existant) package may wish to selectively wait for
+ * Since another (coexistent) package may wish to selectively wait for
* incoming calls or other events outside of the rpc architecture, the
* routine svc_getreq is provided. It must be passed readfds, the
* "in-place" results of a select system call (see select, section 2).
@@ -230,7 +259,7 @@ extern void svcerr_systemerr();
/*
* Global keeper of rpc service descriptors in use
- * dynamic; must be inspected before each call to select
+ * dynamic; must be inspected before each call to select
*/
#ifdef FD_SETSIZE
extern fd_set svc_fdset;
@@ -243,11 +272,10 @@ extern int svc_fds;
* a small program implemented by the svc_rpc implementation itself;
* also see clnt.h for protocol numbers.
*/
-extern void rpctest_service();
-
-extern void svc_getreq();
-extern void svc_getreqset(); /* takes fdset instead of int */
-extern void svc_run(); /* never returns */
+extern void svc_getreq __P ((int __rdfds));
+extern void svc_getreqset __P ((fd_set *__readfds));
+extern void svc_exit __P ((void));
+extern void svc_run __P ((void));
/*
* Socket to use on svcxxx_create call to get default socket
@@ -261,19 +289,29 @@ extern void svc_run(); /* never returns */
/*
* Memory based rpc for testing and timing.
*/
-extern SVCXPRT *svcraw_create();
+extern SVCXPRT *svcraw_create __P ((void));
/*
* Udp based rpc.
*/
-extern SVCXPRT *svcudp_create();
-extern SVCXPRT *svcudp_bufcreate();
+extern SVCXPRT *svcudp_create __P ((int __sock));
+extern SVCXPRT *svcudp_bufcreate __P ((int __sock, u_int __sendsz,
+ u_int __recvsz));
/*
* Tcp based rpc.
*/
-extern SVCXPRT *svctcp_create();
+extern SVCXPRT *svctcp_create __P ((int __sock, u_int __sendsize,
+ u_int __recvsize));
+
+
+/*
+ * Unix based rpc.
+ */
+extern SVCXPRT *svcunix_create __P ((int __sock, u_int __sendsize,
+ u_int __recvsize, char *__path));
+__END_DECLS
-#endif !__SVC_HEADER__
+#endif /* rpc/svc.h */
diff --git a/include/rpc/svc_auth.h b/include/rpc/svc_auth.h
index a36a01aba..ad08b71c7 100644
--- a/include/rpc/svc_auth.h
+++ b/include/rpc/svc_auth.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -31,12 +31,24 @@
/*
* svc_auth.h, Service side of rpc authentication.
- *
+ *
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
+#ifndef _RPC_SVC_AUTH_H
+#define _RPC_SVC_AUTH_H 1
+
+#include <features.h>
+#include <rpc/svc.h>
+
+__BEGIN_DECLS
/*
* Server side authenticator
*/
-extern enum auth_stat _authenticate();
+extern enum auth_stat _authenticate __P ((struct svc_req *__rqst,
+ struct rpc_msg *__msg));
+
+__END_DECLS
+
+#endif /* rpc/svc_auth.h */
diff --git a/include/rpc/types.h b/include/rpc/types.h
index 96d92428c..61ea3c19f 100644
--- a/include/rpc/types.h
+++ b/include/rpc/types.h
@@ -6,45 +6,54 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/* @(#)types.h 1.18 87/07/24 SMI */
+/* fixincludes should not add extern "C" to this file */
/*
* Rpc additions to <sys/types.h>
*/
-#ifndef __TYPES_RPC_HEADER__
-#define __TYPES_RPC_HEADER__
+#ifndef _RPC_TYPES_H
+#define _RPC_TYPES_H 1
+
+typedef int bool_t;
+typedef int enum_t;
+
+#define __dontcare__ -1
+
+#ifndef FALSE
+# define FALSE (0)
+#endif
+
+#ifndef TRUE
+# define TRUE (1)
+#endif
-#define bool_t int
-#define enum_t int
-#define FALSE (0)
-#define TRUE (1)
-#define __dontcare__ -1
#ifndef NULL
-# define NULL 0
+# define NULL 0
#endif
-#include <stdlib.h>
+#include <stdlib.h> /* For malloc decl. */
#define mem_alloc(bsize) malloc(bsize)
#define mem_free(ptr, bsize) free(ptr)
@@ -52,14 +61,15 @@
#include <sys/types.h>
#endif
#include <sys/time.h>
+#include <sys/param.h>
+
+#include <netinet/in.h>
-#ifndef linux
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK (u_long)0x7F000001
#endif
-#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
-#endif /* ndef __TYPES_RPC_HEADER__ */
+#endif /* rpc/types.h */
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index 6cd3e6fe0..c2505ca95 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -1,4 +1,3 @@
-/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -6,28 +5,27 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
-/* @(#)xdr.h 1.19 87/04/22 SMI */
/*
* xdr.h, External Data Representation Serialization Routines.
@@ -35,8 +33,17 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#ifndef __XDR_HEADER__
-#define __XDR_HEADER__
+#ifndef _RPC_XDR_H
+#define _RPC_XDR_H 1
+
+#include <features.h>
+#include <sys/types.h>
+#include <rpc/types.h>
+
+/* We need FILE. */
+#include <stdio.h>
+
+__BEGIN_DECLS
/*
* XDR provides a conventional way for converting between C data
@@ -47,10 +54,10 @@
*
* Each data type provides a single procedure which takes two arguments:
*
- * bool_t
- * xdrproc(xdrs, argresp)
- * XDR *xdrs;
- * <type> *argresp;
+ * bool_t
+ * xdrproc(xdrs, argresp)
+ * XDR *xdrs;
+ * <type> *argresp;
*
* xdrs is an instance of a XDR handle, to which or from which the data
* type is to be converted. argresp is a pointer to the structure to be
@@ -74,17 +81,68 @@
* request.
*/
enum xdr_op {
- XDR_ENCODE=0,
- XDR_DECODE=1,
- XDR_FREE=2
+ XDR_ENCODE = 0,
+ XDR_DECODE = 1,
+ XDR_FREE = 2
};
/*
* This is the number of bytes per unit of external data.
*/
#define BYTES_PER_XDR_UNIT (4)
+/*
+ * This only works if the above is a power of 2. But it's defined to be
+ * 4 by the appropriate RFCs. So it will work. And it's normally quicker
+ * than the old routine.
+ */
+#if 1
+#define RNDUP(x) (((x) + BYTES_PER_XDR_UNIT - 1) & ~(BYTES_PER_XDR_UNIT - 1))
+#else /* this is the old routine */
#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
* BYTES_PER_XDR_UNIT)
+#endif
+
+/*
+ * The XDR handle.
+ * Contains operation which is being applied to the stream,
+ * an operations vector for the particular implementation (e.g. see xdr_mem.c),
+ * and two private fields for the use of the particular implementation.
+ */
+typedef struct XDR XDR;
+struct XDR
+ {
+ enum xdr_op x_op; /* operation; fast additional param */
+ struct xdr_ops
+ {
+ bool_t (*x_getlong) __P ((XDR *__xdrs, long *__lp));
+ /* get a long from underlying stream */
+ bool_t (*x_putlong) __P ((XDR *__xdrs, __const long *__lp));
+ /* put a long to " */
+ bool_t (*x_getbytes) __P ((XDR *__xdrs, caddr_t __addr,
+ u_int __len));
+ /* get some bytes from " */
+ bool_t (*x_putbytes) __P ((XDR *__xdrs, __const char *__addr,
+ u_int __len));
+ /* put some bytes to " */
+ u_int (*x_getpostn) __P ((__const XDR *__xdrs));
+ /* returns bytes off from beginning */
+ bool_t (*x_setpostn) __P ((XDR *__xdrs, u_int pos));
+ /* lets you reposition the stream */
+ int32_t *(*x_inline) __P ((XDR *__xdrs, int len));
+ /* buf quick ptr to buffered data */
+ void (*x_destroy) __P ((XDR *__xdrs));
+ /* free privates of this xdr_stream */
+ bool_t (*x_getint32) __P ((XDR *__xdrs, int32_t *__ip));
+ /* get a int from underlying stream */
+ bool_t (*x_putint32) __P ((XDR *__xdrs, __const int32_t *__ip));
+ /* put a int to " */
+ }
+ *x_ops;
+ caddr_t x_public; /* users' data */
+ caddr_t x_private; /* pointer to private data */
+ caddr_t x_base; /* private used for position info */
+ int x_handy; /* extra private word */
+ };
/*
* A xdrproc_t exists for each data type which is to be encoded or decoded.
@@ -93,43 +151,31 @@ enum xdr_op {
* The opaque pointer generally points to a structure of the data type
* to be decoded. If this pointer is 0, then the type routines should
* allocate dynamic storage of the appropriate size and return it.
- * bool_t (*xdrproc_t)(XDR *, caddr_t *);
+ * bool_t (*xdrproc_t)(XDR *, caddr_t *);
*/
-typedef bool_t (*xdrproc_t)();
+typedef bool_t (*xdrproc_t) __P ((XDR *, void *,...));
-/*
- * The XDR handle.
- * Contains operation which is being applied to the stream,
- * an operations vector for the paticular implementation (e.g. see xdr_mem.c),
- * and two private fields for the use of the particular impelementation.
- */
-typedef struct {
- enum xdr_op x_op; /* operation; fast additional param */
- struct xdr_ops {
- bool_t (*x_getlong)(); /* get a long from underlying stream */
- bool_t (*x_putlong)(); /* put a long to " */
- bool_t (*x_getbytes)();/* get some bytes from " */
- bool_t (*x_putbytes)();/* put some bytes to " */
- u_int (*x_getpostn)();/* returns bytes off from beginning */
- bool_t (*x_setpostn)();/* lets you reposition the stream */
- long * (*x_inline)(); /* buf quick ptr to buffered data */
- void (*x_destroy)(); /* free privates of this xdr_stream */
- } *x_ops;
- caddr_t x_public; /* users' data */
- caddr_t x_private; /* pointer to private data */
- caddr_t x_base; /* private used for position info */
- int x_handy; /* extra private word */
-} XDR;
/*
* Operations defined on a XDR handle
*
- * XDR *xdrs;
- * long *longp;
- * caddr_t addr;
- * u_int len;
- * u_int pos;
+ * XDR *xdrs;
+ * int32_t *int32p;
+ * long *longp;
+ * caddr_t addr;
+ * u_int len;
+ * u_int pos;
*/
+#define XDR_GETINT32(xdrs, int32p) \
+ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
+#define xdr_getint32(xdrs, int32p) \
+ (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
+
+#define XDR_PUTINT32(xdrs, int32p) \
+ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
+#define xdr_putint32(xdrs, int32p) \
+ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
+
#define XDR_GETLONG(xdrs, longp) \
(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
#define xdr_getlong(xdrs, longp) \
@@ -165,12 +211,16 @@ typedef struct {
#define xdr_inline(xdrs, len) \
(*(xdrs)->x_ops->x_inline)(xdrs, len)
-#define XDR_DESTROY(xdrs) \
- if ((xdrs)->x_ops->x_destroy) \
- (*(xdrs)->x_ops->x_destroy)(xdrs)
-#define xdr_destroy(xdrs) \
- if ((xdrs)->x_ops->x_destroy) \
- (*(xdrs)->x_ops->x_destroy)(xdrs)
+#define XDR_DESTROY(xdrs) \
+ do { \
+ if ((xdrs)->x_ops->x_destroy) \
+ (*(xdrs)->x_ops->x_destroy)(xdrs); \
+ } while (0)
+#define xdr_destroy(xdrs) \
+ do { \
+ if ((xdrs)->x_ops->x_destroy) \
+ (*(xdrs)->x_ops->x_destroy)(xdrs); \
+ } while (0)
/*
* Support struct for discriminated unions.
@@ -183,88 +233,149 @@ typedef struct {
* If there is no match and no default routine it is an error.
*/
#define NULL_xdrproc_t ((xdrproc_t)0)
-struct xdr_discrim {
- int value;
- xdrproc_t proc;
+struct xdr_discrim
+{
+ int value;
+ xdrproc_t proc;
};
/*
- * In-line routines for fast encode/decode of primitve data types.
+ * Inline routines for fast encode/decode of primitive data types.
* Caveat emptor: these use single memory cycles to get the
* data from the underlying buffer, and will fail to operate
* properly if the data is not aligned. The standard way to use these
* is to say:
- * if ((buf = XDR_INLINE(xdrs, count)) == NULL)
- * return (FALSE);
- * <<< macro calls >>>
+ * if ((buf = XDR_INLINE(xdrs, count)) == NULL)
+ * return (FALSE);
+ * <<< macro calls >>>
* where ``count'' is the number of bytes of data occupied
* by the primitive data types.
*
* N.B. and frozen for all time: each data type here uses 4 bytes
* of external representation.
*/
-#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++))
-#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v))
-#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
-#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
-#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
-#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
-#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
+#define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++))
+#define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)(v)))
+#define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf))
+#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32(buf, (int32_t)(v))
-#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
+/* WARNING: The IXDR_*_LONG defines are removed by Sun for new platforms
+ * and shouldn't be used any longer. Code which use this defines or longs
+ * in the RPC code will not work on 64bit Solaris platforms !
+ */
+#define IXDR_GET_LONG(buf) \
+ ((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))
+#define IXDR_PUT_LONG(buf, v) \
+ (*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))
+#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
+#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v))
+
+
+#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
+#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
+#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
+#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
+
+#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG(buf, (long)(v))
+#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG(buf, (long)(v))
+#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v))
+#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v))
/*
* These are the "generic" xdr routines.
+ * None of these can have const applied because it's not possible to
+ * know whether the call is a read or a write to the passed parameter
+ * also, the XDR structure is always updated by some of these calls.
*/
-extern bool_t xdr_void();
-extern bool_t xdr_int();
-extern bool_t xdr_u_int();
-extern bool_t xdr_long();
-extern bool_t xdr_u_long();
-extern bool_t xdr_short();
-extern bool_t xdr_u_short();
-extern bool_t xdr_bool();
-extern bool_t xdr_enum();
-extern bool_t xdr_array();
-extern bool_t xdr_bytes();
-extern bool_t xdr_opaque();
-extern bool_t xdr_string();
-extern bool_t xdr_union();
-extern bool_t xdr_char();
-extern bool_t xdr_u_char();
-extern bool_t xdr_vector();
-extern bool_t xdr_float();
-extern bool_t xdr_double();
-extern bool_t xdr_reference();
-extern bool_t xdr_pointer();
-extern bool_t xdr_wrapstring();
+extern bool_t xdr_void __P ((void));
+extern bool_t xdr_short __P ((XDR *__xdrs, short *__sp));
+extern bool_t xdr_u_short __P ((XDR *__xdrs, u_short *__usp));
+extern bool_t xdr_int __P ((XDR *__xdrs, int *__ip));
+extern bool_t xdr_u_int __P ((XDR *__xdrs, u_int *__up));
+extern bool_t xdr_long __P ((XDR *__xdrs, long *__lp));
+extern bool_t xdr_u_long __P ((XDR *__xdrs, u_long *__ulp));
+extern bool_t xdr_hyper __P ((XDR *__xdrs, quad_t *__llp));
+extern bool_t xdr_u_hyper __P ((XDR *__xdrs, u_quad_t *__ullp));
+extern bool_t xdr_longlong_t __P ((XDR *__xdrs, quad_t *__llp));
+extern bool_t xdr_u_longlong_t __P ((XDR *__xdrs, u_quad_t *__ullp));
+extern bool_t xdr_int8_t __P ((XDR *__xdrs, int8_t *__ip));
+extern bool_t xdr_uint8_t __P ((XDR *__xdrs, uint8_t *__up));
+extern bool_t xdr_int16_t __P ((XDR *__xdrs, int16_t *__ip));
+extern bool_t xdr_uint16_t __P ((XDR *__xdrs, uint16_t *__up));
+extern bool_t xdr_int32_t __P ((XDR *__xdrs, int32_t *__ip));
+extern bool_t xdr_uint32_t __P ((XDR *__xdrs, uint32_t *__up));
+extern bool_t xdr_int64_t __P ((XDR *__xdrs, int64_t *__ip));
+extern bool_t xdr_uint64_t __P ((XDR *__xdrs, uint64_t *__up));
+extern bool_t xdr_bool __P ((XDR *__xdrs, bool_t *__bp));
+extern bool_t xdr_enum __P ((XDR *__xdrs, enum_t *__ep));
+extern bool_t xdr_array __P ((XDR * _xdrs, caddr_t *__addrp, u_int *__sizep,
+ u_int __maxsize, u_int __elsize,
+ xdrproc_t __elproc));
+extern bool_t xdr_bytes __P ((XDR *__xdrs, char **__cpp, u_int *__sizep,
+ u_int __maxsize));
+extern bool_t xdr_opaque __P ((XDR *__xdrs, caddr_t __cp, u_int __cnt));
+extern bool_t xdr_string __P ((XDR *__xdrs, char **__cpp, u_int __maxsize));
+extern bool_t xdr_union __P ((XDR *__xdrs, enum_t *__dscmp, char *__unp,
+ __const struct xdr_discrim *__choices,
+ xdrproc_t dfault));
+extern bool_t xdr_char __P ((XDR *__xdrs, char *__cp));
+extern bool_t xdr_u_char __P ((XDR *__xdrs, u_char *__cp));
+extern bool_t xdr_vector __P ((XDR *__xdrs, char *__basep, u_int __nelem,
+ u_int __elemsize, xdrproc_t __xdr_elem));
+extern bool_t xdr_float __P ((XDR *__xdrs, float *__fp));
+extern bool_t xdr_double __P ((XDR *__xdrs, double *__dp));
+extern bool_t xdr_reference __P ((XDR *__xdrs, caddr_t *__xpp, u_int __size,
+ xdrproc_t __proc));
+extern bool_t xdr_pointer __P ((XDR *__xdrs, char **__objpp,
+ u_int __obj_size, xdrproc_t __xdr_obj));
+extern bool_t xdr_wrapstring __P ((XDR *__xdrs, char **__cpp));
+extern u_long xdr_sizeof __P ((xdrproc_t, void *));
/*
* Common opaque bytes objects used by many rpc protocols;
* declared here due to commonality.
*/
-#define MAX_NETOBJ_SZ 1024
-struct netobj {
- u_int n_len;
- char *n_bytes;
+#define MAX_NETOBJ_SZ 1024
+struct netobj
+{
+ u_int n_len;
+ char *n_bytes;
};
typedef struct netobj netobj;
-extern bool_t xdr_netobj();
+extern bool_t xdr_netobj __P ((XDR *__xdrs, struct netobj *__np));
/*
* These are the public routines for the various implementations of
* xdr streams.
*/
-extern void xdrmem_create(); /* XDR using memory buffers */
-extern void xdrstdio_create(); /* XDR using stdio library */
-extern void xdrrec_create(); /* XDR pseudo records for tcp */
-extern bool_t xdrrec_endofrecord(); /* make end of xdr record */
-extern bool_t xdrrec_skiprecord(); /* move to beginning of next record */
-extern bool_t xdrrec_eof(); /* true if no more input */
-
-#endif !__XDR_HEADER__
+
+/* XDR using memory buffers */
+extern void xdrmem_create __P ((XDR *__xdrs, __const caddr_t __addr,
+ u_int __size, enum xdr_op __xop));
+
+/* XDR using stdio library */
+extern void xdrstdio_create __P ((XDR *__xdrs, FILE *__file,
+ enum xdr_op __xop));
+
+/* XDR pseudo records for tcp */
+extern void xdrrec_create __P ((XDR *__xdrs, u_int __sendsize,
+ u_int __recvsize, caddr_t __tcp_handle,
+ int (*__readit) (char *, char *, int),
+ int (*__writeit) (char *, char *, int)));
+
+/* make end of xdr record */
+extern bool_t xdrrec_endofrecord __P ((XDR *__xdrs, bool_t __sendnow));
+
+/* move to beginning of next record */
+extern bool_t xdrrec_skiprecord __P ((XDR *__xdrs));
+
+/* true if no more input */
+extern bool_t xdrrec_eof __P ((XDR *__xdrs));
+
+/* free memory buffers for xdr */
+extern void xdr_free __P ((xdrproc_t __proc, char *__objp));
+
+__END_DECLS
+
+#endif /* rpc/xdr.h */
diff --git a/include/setjmp.h b/include/setjmp.h
index 821e20bb7..33bcfc539 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -27,8 +27,8 @@
__BEGIN_DECLS
-#include <machine/setjmp.h> /* Get `__jmp_buf'. */
-#include <machine/sigset.h> /* Get `__sigset_t'. */
+#include <bits/setjmp.h> /* Get `__jmp_buf'. */
+#include <bits/sigset.h> /* Get `__sigset_t'. */
/* Calling environment, plus possibly a saved signal mask. */
typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */
diff --git a/include/signal.h b/include/signal.h
index 9daf0c07c..03a4e096e 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -1,166 +1,358 @@
-/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/*
- * ANSI Standard: 4.7 SIGNAL HANDLING <signal.h>
+ * ISO C Standard: 4.7 SIGNAL HANDLING <signal.h>
*/
-#ifndef _SIGNAL_H
-#define _SIGNAL_H
+#ifndef _SIGNAL_H
+
+#if !defined __need_sig_atomic_t && !defined __need_sigset_t
+# define _SIGNAL_H
+#endif
#include <features.h>
#include <sys/types.h>
-#include <linux/signal.h>
-#ifndef SIGCLD
-#define SIGCLD SIGCHLD
+__BEGIN_DECLS
+
+//#include <asm/signal.h>
+#include <bits/sigset.h> /* __sigset_t, __sig_atomic_t. */
+
+/* An integral type that can be modified atomically, without the
+ possibility of a signal arriving in the middle of the operation. */
+typedef __sig_atomic_t sig_atomic_t;
+
+typedef __sigset_t sigset_t;
+
+#ifdef _SIGNAL_H
+
+//#include <bits/types.h>
+#include <bits/signum.h>
+
+#ifdef __USE_XOPEN
+# ifndef pid_t
+typedef __pid_t pid_t;
+# define pid_t pid_t
+# endif
+# ifndef uid_t
+typedef __uid_t uid_t;
+# define uid_t uid_t
+# endif
+#endif /* Unix98 */
+
+
+/* Type of a signal handler. */
+typedef void (*__sighandler_t) __P ((int));
+
+/* The X/Open definition of `signal' specifies the SVID semantic. Use
+ the additional function `sysv_signal' when X/Open compatibility is
+ requested. */
+extern __sighandler_t __sysv_signal __P ((int __sig,
+ __sighandler_t __handler));
+#ifdef __USE_GNU
+extern __sighandler_t sysv_signal __P ((int __sig, __sighandler_t __handler));
#endif
-/* SVR4 */
-#ifndef SA_RESETHAND
-#define SA_RESETHAND SA_ONESHOT
+/* Set the handler for the signal SIG to HANDLER, returning the old
+ handler, or SIG_ERR on error.
+ By default `signal' has the BSD semantic. */
+#ifdef __USE_BSD
+extern __sighandler_t signal __P ((int __sig, __sighandler_t __handler));
+#else
+/* Make sure the used `signal' implementation is the SVID version. */
+# ifdef __REDIRECT
+extern __sighandler_t __REDIRECT (signal,
+ __P ((int __sig, __sighandler_t __handler)),
+ __sysv_signal);
+# else
+# define signal __sysv_signal
+# endif
#endif
-/* SVR4 */
-#ifndef SA_NODEFER
-#define SA_NODEFER SA_NOMASK
+#ifdef __USE_XOPEN
+/* The X/Open definition of `signal' conflicts with the BSD version.
+ So they defined another function `bsd_signal'. */
+extern __sighandler_t bsd_signal __P ((int __sig, __sighandler_t __handler));
#endif
-typedef int sig_atomic_t;
+/* Send signal SIG to process number PID. If PID is zero,
+ send SIG to all processes in the current process's process group.
+ If PID is < -1, send SIG to all processes in process group - PID. */
+#ifdef __USE_POSIX
+extern int kill __P ((__pid_t __pid, int __sig));
+#endif /* Use POSIX. */
-typedef __sighandler_t SignalHandler;
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* Send SIG to all processes in process group PGRP.
+ If PGRP is zero, send SIG to all processes in
+ the current process's process group. */
+extern int killpg __P ((__pid_t __pgrp, int __sig));
+#endif /* Use BSD || X/Open Unix. */
-#ifndef BADSIG
-#define BADSIG SIG_ERR
-#endif
+/* Raise signal SIG, i.e., send SIG to yourself. */
+extern int raise __P ((int __sig));
-/* The Interviews version also has these ... */
+#ifdef __USE_SVID
+/* SVID names for the same things. */
+extern __sighandler_t ssignal __P ((int __sig, __sighandler_t __handler));
+extern int gsignal __P ((int __sig));
+#endif /* Use SVID. */
-#define SignalBad ((SignalHandler)-1)
-#define SignalDefault ((SignalHandler)0)
-#define SignalIgnore ((SignalHandler)1)
+#ifdef __USE_MISC
+/* Print a message describing the meaning of the given signal number. */
+extern void psignal __P ((int __sig, __const char *__s));
+#endif /* Use misc. */
-__BEGIN_DECLS
-extern __const char * __const sys_siglist[];
-extern __const char * __const _sys_siglist[];
-
-extern __sighandler_t
- signal __P ((int __sig, __sighandler_t));
-extern __sighandler_t
- __signal __P ((int __sig, __sighandler_t, int flags));
-extern int raise __P ((int __sig));
-extern int __kill __P ((pid_t __pid, int __sig));
-extern int kill __P ((pid_t __pid, int __sig));
-extern int killpg __P ((int __pgrp, int __sig));
-extern int sigaddset __P ((sigset_t *__mask, int __sig));
-extern int sigdelset __P ((sigset_t *__mask, int __sig));
-extern int sigemptyset __P ((sigset_t *__mask));
-extern int sigfillset __P ((sigset_t *__mask));
-extern int sigismember __P ((__const sigset_t *__mask, int __sig));
-extern int sigpending __P ((sigset_t *__set));
+/* The `sigpause' function has two different interfaces. The original
+ BSD definition defines the argument as a mask of the signal, while
+ the more modern interface in X/Open defines it as the signal
+ number. We go with the BSD version unless the user explicitly
+ selects the X/Open version. */
+extern int __sigpause __P ((int __sig_or_mask, int __is_sig));
-extern int __sigprocmask __P ((int __how, __const sigset_t *__set,
- sigset_t *__oldset));
-extern int sigprocmask __P ((int __how, __const sigset_t *__set,
- sigset_t *__oldset));
+#ifdef __USE_BSD
+/* Set the mask of blocked signals to MASK,
+ wait for a signal to arrive, and then restore the mask. */
+extern int sigpause __P ((int __mask));
+# define sigpause(mask) __sigpause ((mask), 0)
+#else
+# ifdef __USE_XOPEN
+/* Remove a signal from the signal mask and suspend the process. */
+# define sigpause(sig) __sigpause ((sig), 1)
+# endif
+#endif
-extern int sigsuspend __P ((__const sigset_t *sigmask));
-extern int __sigaction __P ((int __sig, struct sigaction *__act,
- struct sigaction *__oldact));
-extern int sigaction __P ((int __sig, struct sigaction *__act,
- struct sigaction *__oldact));
+#ifdef __USE_BSD
+/* None of the following functions should be used anymore. They are here
+ only for compatibility. A single word (`int') is not guaranteed to be
+ enough to hold a complete signal mask and therefore these functions
+ simply do not work in many situations. Use `sigprocmask' instead. */
-#define __sigemptyset(set) ((*(set) = 0L), 0)
-#define __sigfillset(set) ((*(set) = -1L), 0)
-#define __sigaddset(set, sig) ((*(set) |= __sigmask (sig)), 0)
-#define __sigdelset(set, sig) ((*(set) &= ~__sigmask (sig)), 0)
-#define __sigismember(set, sig) ((*(set) & __sigmask (sig)) ? 1 : 0)
+/* Compute mask for signal SIG. */
+# define sigmask(sig) __sigmask(sig)
+/* Block signals in MASK, returning the old mask. */
+extern int sigblock __P ((int __mask));
-#if 1
-#define sigemptyset __sigemptyset
-#define sigfillset __sigfillset
+/* Set the mask of blocked signals to MASK, returning the old mask. */
+extern int sigsetmask __P ((int __mask));
-/* We don't do that any more since it causes problems due to
- * "sig" > _NSIG and "sig" < 1. It isn't worth the touble to make
- * them inline and static. Use __sigxxxxx if you want speed with
- * correct "sig".
- */
-#if 1
-#define sigaddset __sigaddset
-#define sigdelset __sigdelset
-#define sigismember __sigismember
+/* Return currently selected signal mask. */
+extern int siggetmask __P ((void));
+#endif /* Use BSD. */
+
+
+#ifdef __USE_MISC
+# define NSIG _NSIG
+#endif
+
+#ifdef __USE_GNU
+typedef __sighandler_t sighandler_t;
#endif
+/* 4.4 BSD uses the name `sig_t' for this. */
+#ifdef __USE_BSD
+typedef __sighandler_t sig_t;
#endif
+#ifdef __USE_POSIX
-/* Return a mask that includes SIG only. */
-#define __sigmask(sig) (1 << ((sig) - 1))
+# ifdef __USE_POSIX199309
+/* We need `struct timespec' later on. */
+# define __need_timespec
+# include <time.h>
-extern int __sigsetmask __P ((int __mask));
-extern int __siggetmask __P ((void));
-extern int __sigblock __P ((int __mask));
-extern int __sigpause __P ((int __mask));
+/* Get the `siginfo_t' type plus the needed symbols. */
+# include <bits/siginfo.h>
+# endif
-#ifdef __USE_SVID
-/* SVID names for the same things. */
-extern __sighandler_t ssignal __P ((int __sig, __sighandler_t __handler));
-extern int gsignal __P ((int __sig));
+/* Clear all signals from SET. */
+extern int sigemptyset __P ((sigset_t *__set));
+
+/* Set all signals in SET. */
+extern int sigfillset __P ((sigset_t *__set));
+
+/* Add SIGNO to SET. */
+extern int sigaddset __P ((sigset_t *__set, int __signo));
+
+/* Remove SIGNO from SET. */
+extern int sigdelset __P ((sigset_t *__set, int __signo));
+
+/* Return 1 if SIGNO is in SET, 0 if not. */
+extern int sigismember __P ((__const sigset_t *__set, int __signo));
+
+# ifdef __USE_GNU
+/* Return non-empty value is SET is not empty. */
+extern int sigisemptyset __P ((__const sigset_t *__set));
+
+/* Build new signal set by combining the two inputs set using logical AND. */
+extern int sigandset __P ((sigset_t *__set, __const sigset_t *__left,
+ __const sigset_t *__right));
+
+/* Build new signal set by combining the two inputs set using logical OR. */
+extern int sigorset __P ((sigset_t *__set, __const sigset_t *__left,
+ __const sigset_t *__right));
+# endif /* GNU */
+
+/* Get the system-specific definitions of `struct sigaction'
+ and the `SA_*' and `SIG_*'. constants. */
+# include <bits/sigaction.h>
+
+/* Get and/or change the set of blocked signals. */
+extern int sigprocmask __P ((int __how,
+ __const sigset_t *__set, sigset_t *__oset));
+
+/* Change the set of blocked signals to SET,
+ wait until a signal arrives, and restore the set of blocked signals. */
+extern int sigsuspend __P ((__const sigset_t *__set));
+
+/* Get and/or set the action for signal SIG. */
+extern int __sigaction __P ((int __sig, __const struct sigaction *__act,
+ struct sigaction *__oact));
+extern int sigaction __P ((int __sig, __const struct sigaction *__act,
+ struct sigaction *__oact));
+
+/* Put in SET all signals that are blocked and waiting to be delivered. */
+extern int sigpending __P ((sigset_t *__set));
+
+
+/* Select any of pending signals from SET or wait for any to arrive. */
+extern int sigwait __P ((__const sigset_t *__set, int *__sig));
+
+# ifdef __USE_POSIX199309
+/* Select any of pending signals from SET and place information in INFO. */
+extern int sigwaitinfo __P ((__const sigset_t *__set, siginfo_t *__info));
+
+/* Select any of pending signals from SET and place information in INFO.
+ Wait the imte specified by TIMEOUT if no signal is pending. */
+extern int sigtimedwait __P ((__const sigset_t *__set, siginfo_t *__info,
+ __const struct timespec *__timeout));
+
+/* Send signal SIG to the process PID. Associate data in VAL with the
+ signal. */
+extern int sigqueue __P ((__pid_t __pid, int __sig,
+ __const union sigval __val));
+# endif /* Use POSIX 199306. */
+
+#endif /* Use POSIX. */
-#endif /* Use SVID. */
-
-/* BSD */
#ifdef __USE_BSD
-#define sigmask __sigmask
-extern int sigblock __P ((int __mask));
-extern int sigpause __P ((int __mask));
-extern int sigsetmask __P ((int __mask));
-extern int siggetmask __P ((void));
-extern void psignal __P ((int __sig, __const char *__str));
+/* Names of the signals. This variable exists only for compatibility.
+ Use `strsignal' instead (see <string.h>). */
+extern __const char *__const _sys_siglist[_NSIG];
+extern __const char *__const sys_siglist[_NSIG];
-extern int siginterrupt __P ((int __sig, int __flag));
+/* Structure passed to `sigvec'. */
+struct sigvec
+ {
+ __sighandler_t sv_handler; /* Signal handler. */
+ int sv_mask; /* Mask of signals to be blocked. */
-/* The `sig' bit is set if the interrupt on it
- * is enabled via siginterrupt (). */
-extern sigset_t _sigintr;
+ int sv_flags; /* Flags (see below). */
+# define sv_onstack sv_flags /* 4.2 BSD compatibility. */
+ };
-#endif /* Use BSD. */
+/* Bits in `sv_flags'. */
+# define SV_ONSTACK (1 << 0)/* Take the signal on the signal stack. */
+# define SV_INTERRUPT (1 << 1)/* Do not restart system calls. */
+# define SV_RESETHAND (1 << 2)/* Reset handler to SIG_DFL on receipt. */
-#ifdef __USE_BSD_SIGNAL
-extern __sighandler_t
- __bsd_signal __P ((int __sig, __sighandler_t));
-#define signal __bsd_signal
+/* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member
+ of VEC. The signals in `sv_mask' will be blocked while the handler runs.
+ If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be
+ reset to SIG_DFL before `sv_handler' is entered. If OVEC is non-NULL,
+ it is filled in with the old information for SIG. */
+extern int sigvec __P ((int __sig, __const struct sigvec *__vec,
+ struct sigvec *__ovec));
-#endif /* __USE_BSD_SIGNAL */
-__END_DECLS
+/* Get machine-dependent `struct sigcontext' and signal subcodes. */
+# include <bits/sigcontext.h>
-#if _MIT_POSIX_THREADS
-#define __SIGFILLSET 0xffffffff
-#define __SIGEMPTYSET 0
-#define __SIGADDSET(s,n) ((*s) |= (1 << ((n) - 1)))
-#define __SIGDELSET(s,n) ((*s) &= ~(1 << ((n) - 1)))
-#define __SIGISMEMBER(s,n) ((*s) & (1 << ((n) - 1)))
-#endif
+/* Restore the state saved in SCP. */
+extern int sigreturn __P ((struct sigcontext *__scp));
+
+#endif /* use BSD. */
+
+
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+
+/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
+ (causing them to fail with EINTR); if INTERRUPT is zero, make system
+ calls be restarted after signal SIG. */
+extern int siginterrupt __P ((int __sig, int __interrupt));
+
+# include <bits/sigstack.h>
+# ifdef __USE_GNU
+# include <ucontext.h>
+# endif
+
+/* Run signals handlers on the stack specified by SS (if not NULL).
+ If OSS is not NULL, it is filled in with the old signal stack status.
+ This interface is obsolete and on many platform not implemented. */
+extern int sigstack __P ((struct sigstack *__ss, struct sigstack *__oss));
+
+/* Alternate signal handler stack interface.
+ This interface should always be preferred over `sigstack'. */
+extern int sigaltstack __P ((__const struct sigaltstack *__ss,
+ struct sigaltstack *__oss));
+
+#endif /* use BSD or X/Open Unix. */
+
+#ifdef __USE_UNIX98
+/* Simplified interface for signal management. */
+
+/* Add SIG to the calling process' signal mask. */
+extern int sighold __P ((int __sig));
+
+/* Remove SIG from the calling process' signal mask. */
+extern int sigrelse __P ((int __sig));
+
+/* Set the disposition of SIG to SIG_IGN. */
+extern int sigignore __P ((int __sig));
+
+/* Set the disposition of SIG. */
+extern __sighandler_t sigset __P ((int __sig, __sighandler_t __disp));
+
+/* Some of the functions for handling signals in threaded programs must
+ be defined here. */
+# include <bits/sigthread.h>
+#endif /* use Unix98 */
+
+/* The following functions are used internally in the C library and in
+ other code which need deep insights. */
+
+/* Return number of available real-time signal with highest priority. */
+extern int __libc_current_sigrtmin __P ((void));
+/* Return number of available real-time signal with lowest priority. */
+extern int __libc_current_sigrtmax __P ((void));
+
+extern int __sigprocmask __P ((int __how, __const sigset_t *__set,
+ sigset_t *__oldset));
+extern int sigprocmask __P ((int __how, __const sigset_t *__set,
+ sigset_t *__oldset));
+#endif /* signal.h */
+
+__END_DECLS
-#endif /* _SIGNAL_H */
+#endif /* not signal.h */
diff --git a/include/stdint.h b/include/stdint.h
new file mode 100644
index 000000000..af73866e3
--- /dev/null
+++ b/include/stdint.h
@@ -0,0 +1,318 @@
+/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * ISO C 9X: 7.18 Integer types <stdint.h>
+ */
+
+#ifndef _STDINT_H
+#define _STDINT_H 1
+
+#include <features.h>
+#define __need_wchar_t
+#include <stddef.h>
+#include <bits/wordsize.h>
+
+/* Exact integral types. */
+
+/* Signed. */
+
+/* There is some amount of overlap with <sys/types.h> as known by inet code */
+#ifndef __int8_t_defined
+# define __int8_t_defined
+typedef signed char int8_t;
+typedef short int int16_t;
+typedef int int32_t;
+# if __WORDSIZE == 64
+typedef long int int64_t;
+# else
+__extension__
+typedef long long int int64_t;
+# endif
+#endif
+
+/* Unsigned. */
+typedef unsigned char uint8_t;
+typedef unsigned short int uint16_t;
+typedef unsigned int uint32_t;
+#if __WORDSIZE == 64
+typedef unsigned long int uint64_t;
+#else
+__extension__
+typedef unsigned long long int uint64_t;
+#endif
+
+
+/* Small types. */
+
+/* Signed. */
+typedef signed char int_least8_t;
+typedef short int int_least16_t;
+typedef int int_least32_t;
+#if __WORDSIZE == 64
+typedef long int int_least64_t;
+#else
+__extension__
+typedef long long int int_least64_t;
+#endif
+
+/* Unsigned. */
+typedef unsigned char uint_least8_t;
+typedef unsigned short int uint_least16_t;
+typedef unsigned int uint_least32_t;
+#if __WORDSIZE == 64
+typedef unsigned long int uint_least64_t;
+#else
+__extension__
+typedef unsigned long long int uint_least64_t;
+#endif
+
+
+/* Fast types. */
+
+/* Signed. */
+typedef signed char int_fast8_t;
+#if __WORDSIZE == 64
+typedef long int int_fast16_t;
+typedef long int int_fast32_t;
+typedef long int int_fast64_t;
+#else
+typedef int int_fast16_t;
+typedef int int_fast32_t;
+__extension__
+typedef long long int int_fast64_t;
+#endif
+
+/* Unsigned. */
+typedef unsigned char uint_fast8_t;
+#if __WORDSIZE == 64
+typedef unsigned long int uint_fast16_t;
+typedef unsigned long int uint_fast32_t;
+typedef unsigned long int uint_fast64_t;
+#else
+typedef unsigned int uint_fast16_t;
+typedef unsigned int uint_fast32_t;
+__extension__
+typedef unsigned long long int uint_fast64_t;
+#endif
+
+
+/* Types for `void *' pointers. */
+#if __WORDSIZE == 64
+# ifndef intptr_t
+typedef long int intptr_t;
+# define intptr_t intptr_t
+# endif
+typedef unsigned long int uintptr_t;
+#else
+# ifndef intptr_t
+typedef int intptr_t;
+# define intptr_t intptr_t
+# endif
+typedef unsigned int uintptr_t;
+#endif
+
+
+/* Largest integral types. */
+#if __WORDSIZE == 64
+typedef long int intmax_t;
+typedef unsigned long int uintmax_t;
+#else
+__extension__
+typedef long long int intmax_t;
+__extension__
+typedef unsigned long long int uintmax_t;
+#endif
+
+
+/* The ISO C 9X standard specifies that in C++ implementations these
+ macros should only be defined if explicitly requested. */
+#if !defined __cplusplus || defined __STDC_LIMIT_MACROS
+
+# if __WORDSIZE == 64
+# define __INT64_C(c) c ## L
+# define __UINT64_C(c) c ## UL
+# else
+# define __INT64_C(c) c ## LL
+# define __UINT64_C(c) c ## ULL
+# endif
+
+/* Limits of integral types. */
+
+/* Minimum of signed integral types. */
+# define INT8_MIN (-128)
+# define INT16_MIN (-32767-1)
+# define INT32_MIN (-2147483647-1)
+# define INT64_MIN (-__INT64_C(9223372036854775807)-1)
+/* Maximum of signed integral types. */
+# define INT8_MAX (127)
+# define INT16_MAX (32767)
+# define INT32_MAX (2147483647)
+# define INT64_MAX (__INT64_C(9223372036854775807))
+
+/* Maximum of unsigned integral types. */
+# define UINT8_MAX (255U)
+# define UINT16_MAX (65535U)
+# define UINT32_MAX (4294967295U)
+# define UINT64_MAX (__UINT64_C(18446744073709551615))
+
+
+/* Minimum of signed integral types having a minimum size. */
+# define INT_LEAST8_MIN (-128)
+# define INT_LEAST16_MIN (-32767-1)
+# define INT_LEAST32_MIN (-2147483647-1)
+# define INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1)
+/* Maximum of signed integral types having a minimum size. */
+# define INT_LEAST8_MAX (127)
+# define INT_LEAST16_MAX (32767)
+# define INT_LEAST32_MAX (2147483647)
+# define INT_LEAST64_MAX (__INT64_C(9223372036854775807))
+
+/* Maximum of unsigned integral types having a minimum size. */
+# define UINT_LEAST8_MAX (255U)
+# define UINT_LEAST16_MAX (65535U)
+# define UINT_LEAST32_MAX (4294967295U)
+# define UINT_LEAST64_MAX (__UINT64_C(18446744073709551615))
+
+
+/* Minimum of fast signed integral types having a minimum size. */
+# define INT_FAST8_MIN (-128)
+# if __WORDSIZE == 64
+# define INT_FAST16_MIN (-9223372036854775807L-1)
+# define INT_FAST32_MIN (-9223372036854775807L-1)
+# else
+# define INT_FAST16_MIN (-2147483647-1)
+# define INT_FAST32_MIN (-2147483647-1)
+# endif
+# define INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1)
+/* Maximum of fast signed integral types having a minimum size. */
+# define INT_FAST8_MAX (127)
+# if __WORDSIZE == 64
+# define INT_FAST16_MAX (9223372036854775807L)
+# define INT_FAST32_MAX (9223372036854775807L)
+# else
+# define INT_FAST16_MAX (2147483647)
+# define INT_FAST32_MAX (2147483647)
+# endif
+# define INT_FAST64_MAX (__INT64_C(9223372036854775807))
+
+/* Maximum of fast unsigned integral types having a minimum size. */
+# define UINT_FAST8_MAX (255U)
+# if __WORDSIZE == 64
+# define UINT_FAST16_MAX (18446744073709551615UL)
+# define UINT_FAST32_MAX (18446744073709551615UL)
+# else
+# define UINT_FAST16_MAX (4294967295U)
+# define UINT_FAST32_MAX (4294967295U)
+# endif
+# define UINT_FAST64_MAX (__UINT64_C(18446744073709551615))
+
+
+/* Values to test for integral types holding `void *' pointer. */
+# if __WORDSIZE == 64
+# define INTPTR_MIN (-9223372036854775807L-1)
+# define INTPTR_MAX (9223372036854775807L)
+# define UINTPTR_MAX (18446744073709551615UL)
+# else
+# define INTPTR_MIN (-2147483647-1)
+# define INTPTR_MAX (2147483647)
+# define UINTPTR_MAX (4294967295U)
+# endif
+
+
+/* Minimum for largest signed integral type. */
+# define INTMAX_MIN (-__INT64_C(9223372036854775807)-1)
+/* Maximum for largest signed integral type. */
+# define INTMAX_MAX (__INT64_C(9223372036854775807))
+
+/* Maximum for largest unsigned integral type. */
+# define UINTMAX_MAX (__UINT64_C(18446744073709551615))
+
+
+/* Limits of other integer types. */
+
+/* Limits of `ptrdiff_t' type. */
+# if __WORDSIZE == 64
+# define PTRDIFF_MIN (-9223372036854775807L-1)
+# define PTRDIFF_MAX (9223372036854775807L)
+# else
+# define PTRDIFF_MIN (-2147483647-1)
+# define PTRDIFF_MAX (2147483647)
+# endif
+
+/* Limits of `sig_atomic_t'. */
+# define SIG_ATOMIC_MIN (-2147483647-1)
+# define SIG_ATOMIC_MAX (2147483647)
+
+/* Limit of `size_t' type. */
+# if __WORDSIZE == 64
+# define SIZE_MAX (18446744073709551615UL)
+# else
+# define SIZE_MAX (4294967295U)
+# endif
+
+/* Limits of `wchar_t'. */
+# ifndef WCHAR_MIN
+/* These constants might also be defined in <wchar.h>. */
+# define WCHAR_MIN (0)
+# define WCHAR_MAX (2147483647)
+# endif
+
+/* Limits of `wint_t'. */
+# define WINT_MIN (0)
+# define WINT_MAX (2147483647)
+
+#endif /* C++ && limit macros */
+
+
+/* The ISO C 9X standard specifies that in C++ implementations these
+ should only be defined if explicitly requested. */
+#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
+
+/* Signed. */
+# define INT8_C(c) c
+# define INT16_C(c) c
+# define INT32_C(c) c
+# if __WORDSIZE == 64
+# define INT64_C(c) c ## L
+# else
+# define INT64_C(c) c ## LL
+# endif
+
+/* Unsigned. */
+# define UINT8_C(c) c ## U
+# define UINT16_C(c) c ## U
+# define UINT32_C(c) c ## U
+# if __WORDSIZE == 64
+# define UINT64_C(c) c ## UL
+# else
+# define UINT64_C(c) c ## ULL
+# endif
+
+/* Maximal type. */
+# if __WORDSIZE == 64
+# define INTMAX_C(c) c ## L
+# define UINTMAX_C(c) c ## UL
+# else
+# define INTMAX_C(c) c ## LL
+# define UINTMAX_C(c) c ## ULL
+# endif
+
+#endif /* C++ && constant macros */
+
+#endif /* stdint.h */
diff --git a/include/stdlib.h b/include/stdlib.h
index f3c00ab31..daff04b07 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -68,9 +68,7 @@ extern char * gcvt __P ((float number, size_t ndigit, char * buf));
#define atof(x) strtod((x),(char**)0)
#define atoi(x) (int)strtol((x),(char**)0,10)
#define atol(x) strtol((x),(char**)0,10)
-#ifdef __LIBC__
char* itoa(int i);
-#endif
/* Returned by `div'. */
typedef struct
diff --git a/include/sys/bitypes.h b/include/sys/bitypes.h
index ec7781a9d..21aaf7436 100644
--- a/include/sys/bitypes.h
+++ b/include/sys/bitypes.h
@@ -1,94 +1 @@
-/*
- * bitypes.h,v 1.4 1995/08/24 01:58:54 hjl Exp
- */
-
-/*
- * ++Copyright++ 1993
- * -
- * Copyright (c) 1993 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * -
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- * -
- * --Copyright--
- */
-
-/*
-#ifdef __USE_BSD
-*/
-
-/*
-#ifndef __BIT_TYPES_DEFINED__
-# if (defined(BSD) && (BSD >= 199306)) || \
- (defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199312))
-# define __BIT_TYPES_DEFINED__
-# endif
-#endif
-*/
-
-#ifndef __BIT_TYPES_DEFINED__
-#define __BIT_TYPES_DEFINED__
-
- /*
- * Basic integral types. Omit the typedef if
- * not possible for a machine/compiler combination.
- */
- typedef /*signed*/ char int8_t;
- typedef unsigned char u_int8_t;
- typedef short int16_t;
- typedef unsigned short u_int16_t;
- typedef int int32_t;
- typedef unsigned int u_int32_t;
-#if 0
-# if __GNUC__ >= 2 && !defined(__STRICT_ANSI__)
- typedef long long int64_t;
- typedef unsigned long long u_int64_t;
-# endif
-#endif
-#endif /* __BIT_TYPES_DEFINED__ */
-
-/* #endif __USE_BSD */
+#include <stddef.h>
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
index 11dd06edb..acb42f2b3 100644
--- a/include/sys/ioctl.h
+++ b/include/sys/ioctl.h
@@ -1,17 +1,46 @@
-#ifndef _SYS_IOCTL_H
-#define _SYS_IOCTL_H
+/* Copyright (C) 1991, 92, 93, 94, 96, 98 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_IOCTL_H
+#define _SYS_IOCTL_H 1
-#include <linux/ioctl.h>
#include <features.h>
-#include <termios.h>
-#include <sys/socketio.h>
__BEGIN_DECLS
-extern int ioctl __P ((int __fildes, int __cmd, ...));
-extern int __ioctl __P ((int __fildes, int __cmd, ...));
+/* Get the list of `ioctl' requests and related constants. */
+#include <bits/ioctls.h>
-__END_DECLS
+/* Define some types used by `ioctl' requests. */
+#include <bits/ioctl-types.h>
+
+/* On a Unix system, the system <sys/ioctl.h> probably defines some of
+ the symbols we define in <sys/ttydefaults.h> (usually with the same
+ values). The code to generate <bits/ioctls.h> has omitted these
+ symbols to avoid the conflict, but a Unix program expects <sys/ioctl.h>
+ to define them, so we must include <sys/ttydefaults.h> here. */
+#include <sys/ttydefaults.h>
+/* Perform the I/O control operation specified by REQUEST on FD.
+ One argument may follow; its presence and type depend on REQUEST.
+ Return value depends on REQUEST. Usually -1 indicates error. */
+extern int ioctl __P ((int __fd, unsigned long int __request, ...));
+
+__END_DECLS
-#endif
+#endif /* sys/ioctl.h */
diff --git a/include/sys/select.h b/include/sys/select.h
new file mode 100644
index 000000000..0972560b9
--- /dev/null
+++ b/include/sys/select.h
@@ -0,0 +1,95 @@
+/* `fd_set' type and related macros, and `select'/`pselect' declarations.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h> */
+
+#ifndef _SYS_SELECT_H
+#define _SYS_SELECT_H 1
+
+#include <features.h>
+
+/* Get definition of needed basic types. */
+#include <bits/types.h>
+
+/* Get __FD_* definitions. */
+#include <bits/select.h>
+
+/* Get __sigset_t. */
+#include <bits/sigset.h>
+
+/* Get definition of timer specification structures. */
+#define __need_timespec
+#include <time.h>
+
+__BEGIN_DECLS
+
+/* This declaration puts `struct timeval' in global scope even if
+ <sys/time.h> has not been included to define it. That way the
+ `select' prototype below will not conflict with a later definition
+ of `struct timeval'. */
+struct timeval;
+
+typedef __fd_mask fd_mask;
+
+/* Representation of a set of file descriptors. */
+typedef __fd_set fd_set;
+
+/* Maximum number of file descriptors in `fd_set'. */
+#define FD_SETSIZE __FD_SETSIZE
+
+#ifdef __USE_MISC
+/* Number of bits per word of `fd_set' (some code assumes this is 32). */
+# define NFDBITS __NFDBITS
+#endif
+
+
+/* Access macros for `fd_set'. */
+#define FD_SET(fd, fdsetp) __FD_SET ((fd), (fdsetp))
+#define FD_CLR(fd, fdsetp) __FD_CLR ((fd), (fdsetp))
+#define FD_ISSET(fd, fdsetp) __FD_ISSET ((fd), (fdsetp))
+#define FD_ZERO(fdsetp) __FD_ZERO (fdsetp)
+
+
+/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
+ readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
+ (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
+ after waiting the interval specified therein. Returns the number of ready
+ descriptors, or -1 for errors. */
+extern int __select __P ((int __nfds, __fd_set *__readfds,
+ __fd_set *__writefds, __fd_set *__exceptfds,
+ struct timeval *__timeout));
+extern int select __P ((int __nfds, __fd_set *__readfds,
+ __fd_set *__writefds, __fd_set *__exceptfds,
+ struct timeval *__timeout));
+
+#ifdef __USE_GNU
+/* XXX Once/if POSIX.1g gets official this prototype will be available
+ when defining __USE_POSIX. */
+/* Same as above only that the TIMEOUT value is given with higher
+ resolution and a sigmask which is been set temporarily. This version
+ should be used. */
+extern int pselect __P ((int __nfds, __fd_set *__readfds,
+ __fd_set *__writefds, __fd_set *__exceptfds,
+ const struct timespec *__timeout,
+ const __sigset_t *__sigmask));
+#endif
+
+__END_DECLS
+
+#endif /* sys/select.h */
diff --git a/include/sys/socket.h b/include/sys/socket.h
index 3a898ee13..7642e7502 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -1,136 +1,207 @@
-#ifndef _SYS_SOCKET_H
-#define _SYS_SOCKET_H
+/* Declarations of socket constants, types, and functions.
+ Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_SOCKET_H
+#define _SYS_SOCKET_H 1
#include <features.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <linux/socket.h>
-#ifdef _MIT_POSIX_THREADS
-#include <pthread/mit/posix.h>
+__BEGIN_DECLS
+
+#define __need_size_t
+#include <stddef.h>
+
+
+/* This operating system-specific header file defines the SOCK_*, PF_*,
+ AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr',
+ `struct msghdr', and `struct linger' types. */
+#include <bits/socket.h>
+
+#ifdef __USE_BSD
+/* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
+ format in the grotty old 4.3 `talk' protocol. */
+struct osockaddr
+ {
+ unsigned short int sa_family;
+ unsigned char sa_data[14];
+ };
#endif
-__BEGIN_DECLS
+/* The following constants should be used for the second parameter of
+ `shutdown'. */
+enum
+{
+ SHUT_RD = 0, /* No more receptions. */
+#define SHUT_RD SHUT_RD
+ SHUT_WR, /* No more transmissions. */
+#define SHUT_WR SHUT_WR
+ SHUT_RDWR /* No more receptions or transmissions. */
+#define SHUT_RDWR SHUT_RDWR
+};
+
+/* This is the type we use for generic socket address arguments.
+
+ With GCC 2.7 and later, the funky union causes redeclarations or
+ uses with any of the listed types to be allowed without complaint.
+ G++ 2.7 does not support transparent unions so there we want the
+ old-style declaration, too. */
+#if (!defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus || \
+ (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
+# define __SOCKADDR_ARG struct sockaddr *
+# define __CONST_SOCKADDR_ARG __const struct sockaddr *
+#else
+/* Add more `struct sockaddr_AF' types here as necessary.
+ These are all the ones I found on NetBSD and Linux. */
+# define __SOCKADDR_ALLTYPES \
+ __SOCKADDR_ONETYPE (sockaddr) \
+ __SOCKADDR_ONETYPE (sockaddr_at) \
+ __SOCKADDR_ONETYPE (sockaddr_ax25) \
+ __SOCKADDR_ONETYPE (sockaddr_dl) \
+ __SOCKADDR_ONETYPE (sockaddr_eon) \
+ __SOCKADDR_ONETYPE (sockaddr_in) \
+ __SOCKADDR_ONETYPE (sockaddr_in6) \
+ __SOCKADDR_ONETYPE (sockaddr_inarp) \
+ __SOCKADDR_ONETYPE (sockaddr_ipx) \
+ __SOCKADDR_ONETYPE (sockaddr_iso) \
+ __SOCKADDR_ONETYPE (sockaddr_ns) \
+ __SOCKADDR_ONETYPE (sockaddr_un) \
+ __SOCKADDR_ONETYPE (sockaddr_x25)
+
+# define __SOCKADDR_ONETYPE(type) struct type *__##type##__;
+typedef union { __SOCKADDR_ALLTYPES
+ } __SOCKADDR_ARG __attribute__ ((__transparent_union__));
+# undef __SOCKADDR_ONETYPE
+# define __SOCKADDR_ONETYPE(type) __const struct type *__##type##__;
+typedef union { __SOCKADDR_ALLTYPES
+ } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
+# undef __SOCKADDR_ONETYPE
+#endif
-/* struct msghdr is not defined in linux 1.2. This will allow sendmsg
- and recvmsg in libc 5.2.9 to compile under 1.2.x and shouldn't cause
- any problem for 1.3.x */
-struct msghdr;
/* Create a new socket of type TYPE in domain DOMAIN, using
- protocol PROTOCOL. If PROTOCOL is zero, one is chosen
- automatically. Returns a file descriptor for the new socket,
- or -1 for errors. */
-int socket __P ((int __family, int __type, int __protocol));
+ protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically.
+ Returns a file descriptor for the new socket, or -1 for errors. */
+extern int socket __P ((int __domain, int __type, int __protocol));
/* Create two new sockets, of type TYPE in domain DOMAIN and using
protocol PROTOCOL, which are connected to each other, and put file
descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
- one will be chosen automatically. Returns 0 on success, -1
- for errors. */
-int socketpair __P ((int __family, int __type, int __protocol,
- int __sockvec[2]));
-
-/* Give the socket FD the local address ADDR (which is LEN bytes
- long). */
-int bind __P ((int __sockfd, __const struct sockaddr *__my_addr,
- int __addrlen));
-
-/* Open a connection on socket FD to peer at ADDR (which LEN bytes
- long). For connectionless socket types, just set the default
- address to send to and the only address from which to accept
- transmissions. Return 0 on success, -1 for errors. */
-int connect __P ((int __sockfd, __const struct sockaddr *__serv_addr,
- int __addrlen));
+ one will be chosen automatically. Returns 0 on success, -1 for errors. */
+extern int socketpair __P ((int __domain, int __type, int __protocol,
+ int __fds[2]));
-/* Prepare to accept connections on socket FD.
- N connection requests will be queued before further requests are
- refused. Returns 0 on success, -1 for errors. */
-int listen __P ((int __sockfd, int __n));
-
-/* Await a connection on socket FD.
- When a connection arrives, open a new socket to communicate with it,
- set *ADDR (which is *ADDR_LEN bytes long) to the address of the
- connecting peer and *ADDR_LEN to the address's actual length, and
- return the new socket's descriptor, or -1 for errors. */
-int accept __P ((int __sockfd, __const struct sockaddr *__peer,
- int *__paddrlen));
-
-/* Put the current value for socket FD's option OPTNAME at protocol
- level LEVEL into OPTVAL (which is *OPTLEN bytes long), and set
- *OPTLEN to the value's actual length. Returns 0 on success, -1 for
- errors. */
-int getsockopt __P ((int __s, int __level, int __optname,
- void *__optval, int *__optlen));
-
-/* Set socket FD's option OPTNAME at protocol level LEVEL
- to *OPTVAL (which is OPTLEN bytes long).
- Returns 0 on success, -1 for errors. */
-int setsockopt __P ((int __s, int __level, int __optname,
- __const void *__optval, int optlen));
+/* Give the socket FD the local address ADDR (which is LEN bytes long). */
+extern int bind __P ((int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len));
/* Put the local address of FD into *ADDR and its length in *LEN. */
-int getsockname __P ((int __sockfd, struct sockaddr *__addr,
- int *__paddrlen));
+extern int getsockname __P ((int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__len));
+
+/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
+ For connectionless socket types, just set the default address to send to
+ and the only address from which to accept transmissions.
+ Return 0 on success, -1 for errors. */
+extern int __connect __P ((int __fd,
+ __CONST_SOCKADDR_ARG __addr, socklen_t __len));
+extern int connect __P ((int __fd,
+ __CONST_SOCKADDR_ARG __addr, socklen_t __len));
/* Put the address of the peer connected to socket FD into *ADDR
(which is *LEN bytes long), and its actual length into *LEN. */
-int getpeername __P ((int __sockfd, struct sockaddr *__peer,
- int *__paddrlen));
+extern int getpeername __P ((int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__len));
+
-/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
-int send __P ((int __sockfd, __const void *__buff, size_t __len,
- unsigned int __flags));
+/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
+extern int __send __P ((int __fd, __const __ptr_t __buf, size_t __n,
+ int __flags));
+extern int send __P ((int __fd, __const __ptr_t __buf, size_t __n,
+ int __flags));
/* Read N bytes into BUF from socket FD.
Returns the number read or -1 for errors. */
-int recv __P ((int __sockfd, void *__buff, size_t __len,
- unsigned int __flags));
+extern int recv __P ((int __fd, __ptr_t __buf, size_t __n, int __flags));
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
- ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
-int sendto __P ((int __sockfd, __const void *__buff, size_t __len,
- unsigned int __flags, __const struct sockaddr *__to,
- int __tolen));
+ ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
+extern int sendto __P ((int __fd, __const __ptr_t __buf, size_t __n,
+ int __flags, __CONST_SOCKADDR_ARG __addr,
+ socklen_t __addr_len));
/* Read N bytes into BUF through socket FD.
- If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address
- of the sender, and store the actual size of the address in
- *ADDR_LEN. Returns the number of bytes read or -1 for errors. */
-int recvfrom __P ((int __sockfd, void *__buff, size_t __len,
- unsigned int __flags, struct sockaddr *__from,
- int *__fromlen));
+ If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
+ the sender, and store the actual size of the address in *ADDR_LEN.
+ Returns the number of bytes read or -1 for errors. */
+extern int recvfrom __P ((int __fd, __ptr_t __buf, size_t __n, int __flags,
+ __SOCKADDR_ARG __addr, socklen_t *__addr_len));
+
/* Send a message described MESSAGE on socket FD.
Returns the number of bytes sent, or -1 for errors. */
extern int sendmsg __P ((int __fd, __const struct msghdr *__message,
- unsigned int __flags));
+ int __flags));
/* Receive a message as described by MESSAGE from socket FD.
Returns the number of bytes read or -1 for errors. */
-extern int recvmsg __P ((int __fd, struct msghdr *__message,
- unsigned int __flags));
-
+extern int recvmsg __P ((int __fd, struct msghdr *__message, int __flags));
+
+
+/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
+ into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
+ actual length. Returns 0 on success, -1 for errors. */
+extern int getsockopt __P ((int __fd, int __level, int __optname,
+ __ptr_t __optval, socklen_t *__optlen));
+
+/* Set socket FD's option OPTNAME at protocol level LEVEL
+ to *OPTVAL (which is OPTLEN bytes long).
+ Returns 0 on success, -1 for errors. */
+extern int setsockopt __P ((int __fd, int __level, int __optname,
+ __const __ptr_t __optval, socklen_t __optlen));
+
+
+/* Prepare to accept connections on socket FD.
+ N connection requests will be queued before further requests are refused.
+ Returns 0 on success, -1 for errors. */
+extern int listen __P ((int __fd, unsigned int __n));
+
+/* Await a connection on socket FD.
+ When a connection arrives, open a new socket to communicate with it,
+ set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
+ peer and *ADDR_LEN to the address's actual length, and return the
+ new socket's descriptor, or -1 for errors. */
+extern int accept __P ((int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__addr_len));
+
/* Shut down all or part of the connection open on socket FD.
HOW determines what to shut down:
- 0 = No more receptions;
- 1 = No more transmissions;
- 2 = No more receptions or transmissions.
+ SHUT_RD = No more receptions;
+ SHUT_WR = No more transmissions;
+ SHUT_RDWR = No more receptions or transmissions.
Returns 0 on success, -1 for errors. */
-int shutdown __P ((int __sockfd, int __how));
+extern int shutdown __P ((int __fd, int __how));
-/* belongs here or elsewhere? */
-int rcmd __P ((char **__ahost, unsigned short __inport,
- __const char *__locuser, __const char *__remuser,
- __const char *__cmd, int *__fd2p));
-int rresvport __P ((int *__port));
-int ruserok __P ((__const char *__rhost, int __superuser,
- __const char *__ruser, __const char *__luser));
-int rexec __P ((char **__ahost, int __inport, __const char *__user,
- __const char *__passwd, __const char *__cmd,
- int *__fd2p));
+/* FDTYPE is S_IFSOCK or another S_IF* macro defined in <sys/stat.h>;
+ returns 1 if FD is open on an object of the indicated type, 0 if not,
+ or -1 for errors (setting errno). */
+extern int isfdtype __P ((int __fd, int __fdtype));
__END_DECLS
-#endif /* _SYS_SOCKET_H */
+#endif /* sys/socket.h */
diff --git a/include/sys/socketvar.h b/include/sys/socketvar.h
index 283356534..b177158d0 100644
--- a/include/sys/socketvar.h
+++ b/include/sys/socketvar.h
@@ -1,8 +1,3 @@
-/*
- * This seems the best way to handle this. sys/socket.h already has
- * all the right bits in it. In fact there isn't a single useful thing
- * in the BSD net-2 sys/socketvar.h anyway but people persist in including
- * it...
- * Alan
- */
+/* This header is used on many systems but for GNU we have everything
+ already defined in the standard header. */
#include <sys/socket.h>
diff --git a/include/sys/stat.h b/include/sys/stat.h
index e486d755c..13c50411d 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -1,192 +1,368 @@
-#ifndef _SYS_STAT_H
-#define _SYS_STAT_H
+/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * POSIX Standard: 5.6 File Characteristics <sys/stat.h>
+ */
+
+#ifndef _SYS_STAT_H
+#define _SYS_STAT_H 1
#include <features.h>
-#include <sys/types.h>
-#undef __NOT_KERNEL
-#define __NOT_KERNEL
-#include <linux/stat.h>
-#undef __NOT_KERNEL
-#ifdef __SVR4_I386_ABI_L1__
-#include <sys/time.h> /* For timestruc_t */
-#endif /* __SVR4_I386_ABI_L1__ */
+#include <bits/types.h> /* For __mode_t and __dev_t. */
+
+#ifdef __USE_XOPEN
+# define __need_time_t
+# include <time.h> /* For time_t. */
+
+/* The Single Unix specification says that some more types are
+ available here. */
+# ifndef dev_t
+typedef __dev_t dev_t;
+# define dev_t dev_t
+# endif
+
+# ifndef gid_t
+typedef __gid_t gid_t;
+# define gid_t gid_t
+# endif
+
+# ifndef ino_t
+# ifndef __USE_FILE_OFFSET64
+typedef __ino_t ino_t;
+# else
+typedef __ino64_t ino_t;
+# endif
+# define ino_t ino_t
+# endif
+
+# ifndef mode_t
+typedef __mode_t mode_t;
+# define mode_t mode_t
+# endif
+
+# ifndef nlink_t
+typedef __nlink_t nlink_t;
+# define nlink_t nlink_t
+# endif
+
+# ifndef off_t
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+# define off_t off_t
+# endif
+
+# ifndef uid_t
+typedef __uid_t uid_t;
+# define uid_t uid_t
+# endif
+#endif /* X/Open */
+
+#ifdef __USE_UNIX98
+# ifndef pid_t
+typedef __pid_t pid_t;
+# define pid_t pid_t
+# endif
+#endif /* Unix98 */
__BEGIN_DECLS
-struct stat {
- dev_t st_dev;
-
-#ifdef __SVR4_I386_ABI_L1__
- long st_pad1[3];
-#else
- unsigned short __pad1;
+#include <bits/stat.h>
+
+#if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN
+# define S_IFMT __S_IFMT
+# define S_IFDIR __S_IFDIR
+# define S_IFCHR __S_IFCHR
+# define S_IFBLK __S_IFBLK
+# define S_IFREG __S_IFREG
+# ifdef __S_IFIFO
+# define S_IFIFO __S_IFIFO
+# endif
+# if defined __USE_BSD || defined __USE_MISC
+# ifdef __S_IFLNK
+# define S_IFLNK __S_IFLNK
+# endif
+# ifdef __S_IFSOCK
+# define S_IFSOCK __S_IFSOCK
+# endif
+# endif
#endif
- ino_t st_ino;
- umode_t st_mode;
- nlink_t st_nlink;
- uid_t st_uid;
- gid_t st_gid;
- dev_t st_rdev;
+/* Test macros for file types. */
-#ifdef __SVR4_I386_ABI_L1__
- long st_pad2[2];
-#else
- unsigned short __pad2;
+#define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
+
+#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
+#define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR)
+#define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK)
+#define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG)
+#ifdef __S_IFIFO
+# define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO)
#endif
- off_t st_size;
+#ifdef __USE_BSD
+# ifdef __S_IFLNK
+# define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK)
+# else
+# define S_ISLNK(mode) 0
+# endif
+# ifdef __S_IFSOCK
+# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK)
+# endif
+#endif
-#ifdef __SVR4_I386_ABI_L1__
- timestruc_t st_atim;
- timestruc_t st_mtim;
- timestruc_t st_ctim;
- long st_blksize;
- long st_blocks;
-#define FSTYPSZ 16
+/* Protection bits. */
- char st_fstype[FSTYPSZ];
- long st_pad4[8];
+#define S_ISUID __S_ISUID /* Set user ID on execution. */
+#define S_ISGID __S_ISGID /* Set group ID on execution. */
-#define st_atime st_atim.tv_sec
-#define st_mtime st_mtim.tv_sec
-#define st_ctime st_ctim.tv_sec
+#if defined __USE_BSD || defined __USE_MISC
+/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
+# define S_ISVTX __S_ISVTX
+#endif
-#else /*! __SVR4_I386_ABI_L1__*/
- unsigned long st_blksize;
- unsigned long st_blocks;
- time_t st_atime;
- unsigned long __unused1;
- time_t st_mtime;
- unsigned long __unused2;
- time_t st_ctime;
- unsigned long __unused3;
- unsigned long __unused4;
- unsigned long __unused5;
-#endif /*! __SVR4_I386_ABI_L1__*/
-};
+#define S_IRUSR __S_IREAD /* Read by owner. */
+#define S_IWUSR __S_IWRITE /* Write by owner. */
+#define S_IXUSR __S_IEXEC /* Execute by owner. */
+/* Read, write, and execute by owner. */
+#define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
+#if defined __USE_MISC && defined __USE_BSD
+# define S_IREAD S_IRUSR
+# define S_IWRITE S_IWUSR
+# define S_IEXEC S_IXUSR
+#endif
-#define LINUX_MKNOD_VERSION 1 /* SVr4 */
-#define LINUX_STAT_VERSION 1 /* SVr4 */
+#define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
+#define S_IWGRP (S_IWUSR >> 3) /* Write by group. */
+#define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */
+/* Read, write, and execute by group. */
+#define S_IRWXG (S_IRWXU >> 3)
-extern int _fxstat __P ((int __ver, int __fildes,
- struct stat *__stat_buf));
+#define S_IROTH (S_IRGRP >> 3) /* Read by others. */
+#define S_IWOTH (S_IWGRP >> 3) /* Write by others. */
+#define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */
+/* Read, write, and execute by others. */
+#define S_IRWXO (S_IRWXG >> 3)
-extern int _xstat __P ((int __ver, __const char *__filename,
- struct stat *__stat_buf));
-extern int _lxstat __P ((int __ver, __const char *__filename,
- struct stat *__stat_buf));
+#ifdef __USE_BSD
+/* Macros for common mode bit masks. */
+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
+# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
-#ifdef _MIT_POSIX_THREADS
-extern int __machdep_sys__fxstat __P ((int __ver, int __fd,
- struct stat *__stat_buf));
+# define S_BLKSIZE 512 /* Block size for `st_blocks'. */
#endif
-extern int _xmknod __P ((int __ver, __const char *__path,
- mode_t __mode, dev_t *__dev));
-
-/* Some synonyms used historically in the kernel and elsewhere */
-#define S_IREAD S_IRUSR /* read permission, owner */
-#define S_IWRITE S_IWUSR /* write permission, owner */
-#define S_IEXEC S_IXUSR /* execute/search permission, owner */
-extern int __chmod __P ((__const char *__path, mode_t __mode));
-extern int chmod __P ((__const char *__path, mode_t __mode));
+#ifndef __USE_FILE_OFFSET64
+/* Get file attributes for FILE and put them in BUF. */
+extern int stat __P ((__const char *__file, struct stat *__buf));
-extern int __fchmod __P ((int __fildes, mode_t __mode));
-extern int fchmod __P ((int __fildes, mode_t __mode));
+/* Get file attributes for the file, device, pipe, or socket
+ that file descriptor FD is open on and put them in BUF. */
+extern int fstat __P ((int __fd, struct stat *__buf));
+#else
+# ifdef __REDIRECT
+extern int __REDIRECT (stat, __P ((__const char *__file, struct stat *__buf)),
+ stat64);
+extern int __REDIRECT (fstat, __P ((int __fd, struct stat *__buf)), fstat64);
+# else
+# define stat stat64
+# define fstat fstat64
+# endif
+#endif
+#ifdef __USE_LARGEFILE64
+extern int stat64 __P ((__const char *__file, struct stat64 *__buf));
+extern int fstat64 __P ((int __fd, struct stat64 *__buf));
+#endif
-extern int __mkdir __P ((__const char *__path, mode_t __mode));
-extern int mkdir __P ((__const char *__path, mode_t __mode));
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+# ifndef __USE_FILE_OFFSET64
+/* Get file attributes about FILE and put them in BUF.
+ If FILE is a symbolic link, do not follow it. */
+extern int lstat __P ((__const char *__file, struct stat *__buf));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (lstat, __P ((__const char *__file, struct stat *__buf)),
+ lstat64);
+# else
+# define lstat lstat64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int lstat64 __P ((__const char *__file, struct stat64 *__buf));
+# endif
+#endif
-extern int mkfifo __P ((__const char *__path, mode_t __mode));
+/* Set file access permissions for FILE to MODE.
+ This takes an `int' MODE argument because that
+ is what `mode_t's get widened to. */
+extern int chmod __P ((__const char *__file, __mode_t __mode));
-#if 1
+/* Set file access permissions of the file FD is open on to MODE. */
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+extern int fchmod __P ((int __fd, __mode_t __mode));
+#endif
-extern int __fstat __P ((int __fildes, struct stat *__stat_buf));
-extern int fstat __P ((int __fildes, struct stat *__stat_buf));
-extern int __stat __P ((__const char *__filename,
- struct stat *__stat_buf));
-extern int stat __P ((__const char *__filename,
- struct stat *__stat_buf));
+/* Set the file creation mask of the current process to MASK,
+ and return the old creation mask. */
+extern __mode_t umask __P ((__mode_t __mask));
-extern int __lstat __P ((__const char *__filename,
- struct stat *__stat_buf));
-extern int lstat __P ((__const char *__filename,
- struct stat *__stat_buf));
+#ifdef __USE_GNU
+/* Get the current `umask' value without changing it.
+ This function is only available under the GNU Hurd. */
+extern __mode_t getumask __P ((void));
+#endif
-extern int __mknod __P ((__const char *__path, mode_t __mode,
- dev_t __dev));
-extern int mknod __P ((__const char *__path, mode_t __mode,
- dev_t __dev));
-#endif /* #if 0 */
+/* Create a new directory named PATH, with permission bits MODE. */
+extern int mkdir __P ((__const char *__path, __mode_t __mode));
-extern mode_t __umask __P ((mode_t __mask));
-extern mode_t umask __P ((mode_t __mask));
+/* Create a device file named PATH, with permission and special bits MODE
+ and device number DEV (which can be constructed from major and minor
+ device numbers with the `makedev' macro above). */
+#if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+extern int mknod __P ((__const char *__path,
+ __mode_t __mode, __dev_t __dev));
+#endif
-__END_DECLS
-#if 0
+/* Create a new FIFO named PATH, with permission bits MODE. */
+extern int mkfifo __P ((__const char *__path, __mode_t __mode));
+
+/* To allow the `struct stat' structure and the file type `mode_t'
+ bits to vary without changing shared library major version number,
+ the `stat' family of functions and `mknod' are in fact inline
+ wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod',
+ which all take a leading version-number argument designating the
+ data structure and bits used. <bits/stat.h> defines _STAT_VER with
+ the version number corresponding to `struct stat' as defined in
+ that file; and _MKNOD_VER with the version number corresponding to
+ the S_IF* macros defined therein. It is arranged that when not
+ inlined these function are always statically linked; that way a
+ dynamically-linked executable always encodes the version number
+ corresponding to the data structures it uses, so the `x' functions
+ in the shared library can adapt without needing to recompile all
+ callers. */
+
+#ifndef _STAT_VER
+# define _STAT_VER 0
+#endif
+#ifndef _MKNOD_VER
+# define _MKNOD_VER 0
+#endif
-static __inline__ int __stat(__const char * __path, struct stat * __statbuf)
-{
- return _xstat(LINUX_STAT_VERSION, __path, __statbuf);
-}
+/* Wrappers for stat and mknod system calls. */
+#ifndef __USE_FILE_OFFSET64
+extern int __fxstat __P ((int __ver, int __fildes,
+ struct stat *__stat_buf));
+extern int __xstat __P ((int __ver, __const char *__filename,
+ struct stat *__stat_buf));
+extern int __lxstat __P ((int __ver, __const char *__filename,
+ struct stat *__stat_buf));
+#else
+# ifdef __REDIRECT
+extern int __REDIRECT (__fxstat, __P ((int __ver, int __fildes,
+ struct stat *__stat_buf)), __fxstat64);
+extern int __REDIRECT (__xstat, __P ((int __ver, __const char *__filename,
+ struct stat *__stat_buf)), __xstat64);
+extern int __REDIRECT (__lxstat, __P ((int __ver, __const char *__filename,
+ struct stat *__stat_buf)), __lxstat64);
+
+# else
+# define __fxstat __fxstat64
+# define __xstat __xstat64
+# define __lxstat __lxstat64
+# endif
+#endif
-static __inline__ int stat(__const char * __path, struct stat * __statbuf)
-{
- return _xstat(LINUX_STAT_VERSION, __path, __statbuf);
-}
+#ifdef __USE_LARGEFILE64
+extern int __fxstat64 __P ((int __ver, int __fildes,
+ struct stat64 *__stat_buf));
+extern int __xstat64 __P ((int __ver, __const char *__filename,
+ struct stat64 *__stat_buf));
+extern int __lxstat64 __P ((int __ver, __const char *__filename,
+ struct stat64 *__stat_buf));
+#endif
+extern int __xmknod __P ((int __ver, __const char *__path,
+ __mode_t __mode, __dev_t *__dev));
-static __inline__ int __lstat(__const char * __path, struct stat * __statbuf)
-{
- return _lxstat(LINUX_STAT_VERSION, __path, __statbuf);
-}
+#if defined __GNUC__ && __GNUC__ >= 2
+/* Inlined versions of the real stat and mknod functions. */
-static __inline__ int lstat(__const char * __path, struct stat * __statbuf)
+extern __inline__ int stat (__const char *__path,
+ struct stat *__statbuf)
{
- return _lxstat(LINUX_STAT_VERSION, __path, __statbuf);
+ return __xstat (_STAT_VER, __path, __statbuf);
}
-static __inline__ int __fstat(int __fd, struct stat * __statbuf)
+# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+extern __inline__ int lstat (__const char *__path,
+ struct stat *__statbuf)
{
- return _fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
+ return __lxstat (_STAT_VER, __path, __statbuf);
}
+# endif
-static __inline__ int fstat(int __fd, struct stat * __statbuf)
+extern __inline__ int fstat (int __fd, struct stat *__statbuf)
{
- return _fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
+ return __fxstat (_STAT_VER, __fd, __statbuf);
}
-static __inline__ int __mknod(__const char * __path, mode_t __mode, dev_t __dev)
+# if defined __USE_MISC || defined __USE_BSD
+extern __inline__ int mknod (__const char *__path, __mode_t __mode,
+ __dev_t __dev)
{
- return _xmknod(LINUX_MKNOD_VERSION, __path, __mode, &__dev);
+ return __xmknod (_MKNOD_VER, __path, __mode, &__dev);
}
+# endif
-static __inline__ int mknod(__const char * __path, mode_t __mode, dev_t __dev)
+# ifdef __USE_LARGEFILE64
+extern __inline__ int stat64 (__const char *__path,
+ struct stat64 *__statbuf)
{
- return _xmknod(LINUX_MKNOD_VERSION, __path, __mode, &__dev);
+ return __xstat64 (_STAT_VER, __path, __statbuf);
}
-#ifdef _MIT_POSIX_THREADS
-
-static __inline__ int __machdep_sys_fstat(int __fd, struct stat * __statbuf)
+# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+extern __inline__ int lstat64 (__const char *__path,
+ struct stat64 *__statbuf)
{
- return __machdep_sys__fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
+ return __lxstat64 (_STAT_VER, __path, __statbuf);
}
+# endif
-static __inline__ int machdep_sys_fstat(int __fd, struct stat * __statbuf)
+extern __inline__ int fstat64 (int __fd, struct stat64 *__statbuf)
{
- return __machdep_sys__fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
+ return __fxstat64 (_STAT_VER, __fd, __statbuf);
}
+# endif
#endif
-#endif
+__END_DECLS
-#endif
+
+#endif /* sys/stat.h */
diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
new file mode 100644
index 000000000..35760e5e0
--- /dev/null
+++ b/include/sys/sysmacros.h
@@ -0,0 +1,49 @@
+/* Definitions of macros to access `dev_t' values.
+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_SYSMACROS_H
+#define _SYS_SYSMACROS_H 1
+
+/* For compatibility we provide alternative names.
+
+ The problem here is that compilers other than GCC probably don't
+ have the `long long' type and so `dev_t' is actually an array. */
+#if defined __GNUC__ && __GNUC__ >= 2
+# define major(dev) ((int)(((dev) >> 8) & 0xff))
+# define minor(dev) ((int)((dev) & 0xff))
+# define makedev(major, minor) ((((unsigned int) (major)) << 8) \
+ | ((unsigned int) (minor)))
+#else
+/* We need to know the word order here. This assumes that the word order
+ is consistent with the byte order. */
+# include <endian.h>
+# if __BYTE_ORDER == __BIG_ENDIAN
+# define major(dev) (((dev).__val[1] >> 8) & 0xff)
+# define minor(dev) ((dev).__val[1] & 0xff)
+# define makedev(major, minor) { 0, ((((unsigned int) (major)) << 8) \
+ | ((unsigned int) (minor))) }
+# else
+# define major(dev) (((dev).__val[0] >> 8) & 0xff)
+# define minor(dev) ((dev).__val[0] & 0xff)
+# define makedev(major, minor) { ((((unsigned int) (major)) << 8) \
+ | ((unsigned int) (minor))), 0 }
+# endif
+#endif
+
+#endif /* sys/sysmacros.h */
diff --git a/include/sys/time.h b/include/sys/time.h
index 98e51c07c..83be23fb4 100644
--- a/include/sys/time.h
+++ b/include/sys/time.h
@@ -1,81 +1,145 @@
+/* Copyright (C) 1991, 92, 93, 94, 96, 97, 98 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
#ifndef _SYS_TIME_H
-#define _SYS_TIME_H
+#define _SYS_TIME_H 1
#include <features.h>
-#include <linux/types.h>
-#include <linux/time.h>
-
-#define DST_NONE 0 /* not on dst */
-#define DST_USA 1 /* USA style dst */
-#define DST_AUST 2 /* Australian style dst */
-#define DST_WET 3 /* Western European dst */
-#define DST_MET 4 /* Middle European dst */
-#define DST_EET 5 /* Eastern European dst */
-#define DST_CAN 6 /* Canada */
-#define DST_GB 7 /* Great Britain and Eire */
-#define DST_RUM 8 /* Rumania */
-#define DST_TUR 9 /* Turkey */
-#define DST_AUSTALT 10 /* Australian style with shift in 1986 */
-
-#ifdef __SVR4_I386_ABI_L1__
-typedef struct timestruc {
- time_t tv_sec;
- long tv_nsec;
-} timestruc_t;
-#endif /* __SVR4_I386_ABI_L1__ */
-
-/*
- * Operations on timevals.
- *
- * NB: timercmp does not work for >= or <=.
- *
- */
-#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
-#define timercmp(tvp, uvp, cmp) \
- (((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) \
- || (tvp)->tv_sec cmp (uvp)->tv_sec)
-#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
#include <time.h>
-#include <sys/types.h>
+#include <sys/select.h>
+
+#define __need_timeval
+#include <bits/time.h>
+
__BEGIN_DECLS
-extern int __gettimeofday __P ((struct timeval * __tp,
- struct timezone * __tz));
-extern int gettimeofday __P ((struct timeval * __tp,
- struct timezone * __tz));
-extern int __settimeofday __P ((__const struct timeval *__tv,
- __const struct timezone *__tz));
-extern int settimeofday __P ((__const struct timeval *__tv,
- __const struct timezone *__tz));
-
-extern int __select __P ((int __width, fd_set * __readfds,
- fd_set * __writefds, fd_set * __exceptfds,
- struct timeval * __timeout));
-extern int select __P ((int __width, fd_set * __readfds,
- fd_set * __writefds, fd_set * __exceptfds,
- struct timeval * __timeout));
-
-extern int __getitimer __P ((int __which,
- struct itimerval *__value));
-extern int getitimer __P ((int __which,
- struct itimerval *__value));
-extern int __setitimer __P ((int __which,
- __const struct itimerval *__value,
- struct itimerval *__ovalue));
-extern int setitimer __P ((int __which,
- __const struct itimerval *__value,
- struct itimerval *__ovalue));
-
-extern int __adjtime __P ((struct timeval * __itv,
- struct timeval * __otv));
-extern int adjtime __P ((struct timeval * __itv,
- struct timeval * __otv));
-
-extern int __utimes __P((char *__path, struct timeval *tvp));
-extern int utimes __P((char *__path, struct timeval *tvp));
+/* Macros for converting between `struct timeval' and `struct timespec'. */
+#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
+ (ts)->tv_sec = (tv)->tv_sec; \
+ (ts)->tv_nsec = (tv)->tv_usec * 1000; \
+}
+#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
+ (tv)->tv_sec = (ts)->tv_sec; \
+ (tv)->tv_usec = (ts)->tv_nsec / 1000; \
+}
+
+
+/* Structure crudely representing a timezone.
+ This is obsolete and should never be used. */
+struct timezone
+ {
+ int tz_minuteswest; /* Minutes west of GMT. */
+ int tz_dsttime; /* Nonzero if DST is ever in effect. */
+ };
+
+/* Get the current time of day and timezone information,
+ putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled.
+ Returns 0 on success, -1 on errors.
+ NOTE: This form of timezone information is obsolete.
+ Use the functions and variables declared in <time.h> instead. */
+extern int gettimeofday __P ((struct timeval *__tv,
+ struct timezone *__tz));
+
+/* Set the current time of day and timezone information.
+ This call is restricted to the super-user. */
+extern int settimeofday __P ((__const struct timeval *__tv,
+ __const struct timezone *__tz));
+
+/* Adjust the current time of day by the amount in DELTA.
+ If OLDDELTA is not NULL, it is filled in with the amount
+ of time adjustment remaining to be done from the last `adjtime' call.
+ This call is restricted to the super-user. */
+extern int adjtime __P ((__const struct timeval *__delta,
+ struct timeval *__olddelta));
+
+
+/* Values for the first argument to `getitimer' and `setitimer'. */
+enum __itimer_which
+ {
+ /* Timers run in real time. */
+ ITIMER_REAL = 0,
+#define ITIMER_REAL ITIMER_REAL
+ /* Timers run only when the process is executing. */
+ ITIMER_VIRTUAL = 1,
+#define ITIMER_VIRTUAL ITIMER_VIRTUAL
+ /* Timers run when the process is executing and when
+ the system is executing on behalf of the process. */
+ ITIMER_PROF = 2
+#define ITIMER_PROF ITIMER_PROF
+ };
+
+/* Type of the second argument to `getitimer' and
+ the second and third arguments `setitimer'. */
+struct itimerval
+ {
+ /* Value to put into `it_value' when the timer expires. */
+ struct timeval it_interval;
+ /* Time to the next timer expiration. */
+ struct timeval it_value;
+ };
+
+/* Set *VALUE to the current setting of timer WHICH.
+ Return 0 on success, -1 on errors. */
+extern int getitimer __P ((enum __itimer_which __which,
+ struct itimerval *__value));
+
+/* Set the timer WHICH to *NEW. If OLD is not NULL,
+ set *OLD to the old value of timer WHICH.
+ Returns 0 on success, -1 on errors. */
+extern int setitimer __P ((enum __itimer_which __which,
+ __const struct itimerval *__new,
+ struct itimerval *__old));
+
+/* Change the access time of FILE to TVP[0] and
+ the modification time of FILE to TVP[1]. */
+extern int utimes __P ((__const char *__file, struct timeval __tvp[2]));
+
+
+/* Convenience macros for operations on timevals.
+ NOTE: `timercmp' does not work for >= or <=. */
+#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
+#define timercmp(a, b, CMP) \
+ (((a)->tv_sec == (b)->tv_sec) ? \
+ ((a)->tv_usec CMP (b)->tv_usec) : \
+ ((a)->tv_sec CMP (b)->tv_sec))
+#define timeradd(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
+ if ((result)->tv_usec >= 1000000) \
+ { \
+ ++(result)->tv_sec; \
+ (result)->tv_usec -= 1000000; \
+ } \
+ } while (0)
+#define timersub(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
+ } while (0)
__END_DECLS
-#endif /*_SYS_TIME_H*/
+#endif /* sys/time.h */
diff --git a/include/sys/ttydefaults.h b/include/sys/ttydefaults.h
new file mode 100644
index 000000000..b21c6d568
--- /dev/null
+++ b/include/sys/ttydefaults.h
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94
+ */
+
+/*
+ * System wide defaults for terminal state. Linux version.
+ */
+#ifndef _SYS_TTYDEFAULTS_H_
+#define _SYS_TTYDEFAULTS_H_
+
+/*
+ * Defaults on "first" open.
+ */
+#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
+#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
+#define TTYDEF_SPEED (B9600)
+
+/*
+ * Control Character Defaults
+ */
+#define CTRL(x) (x&037)
+#define CEOF CTRL('d')
+#ifdef _POSIX_VDISABLE
+# define CEOL _POSIX_VDISABLE
+#else
+# define CEOL '\0' /* XXX avoid _POSIX_VDISABLE */
+#endif
+#define CERASE 0177
+#define CINTR CTRL('c')
+#ifdef _POSIX_VDISABLE
+# define CSTATUS _POSIX_VDISABLE
+#else
+# define CSTATUS '\0' /* XXX avoid _POSIX_VDISABLE */
+#endif
+#define CKILL CTRL('u')
+#define CMIN 1
+#define CQUIT 034 /* FS, ^\ */
+#define CSUSP CTRL('z')
+#define CTIME 0
+#define CDSUSP CTRL('y')
+#define CSTART CTRL('q')
+#define CSTOP CTRL('s')
+#define CLNEXT CTRL('v')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
+#define CEOT CEOF
+/* compat */
+#define CBRK CEOL
+#define CRPRNT CREPRINT
+#define CFLUSH CDISCARD
+
+/* PROTECTED INCLUSION ENDS HERE */
+#endif /* !_SYS_TTYDEFAULTS_H_ */
+
+/*
+ * #define TTYDEFCHARS to include an array of default control characters.
+ */
+#ifdef TTYDEFCHARS
+cc_t ttydefchars[NCCS] = {
+ CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT,
+ _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT,
+ CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE
+};
+#undef TTYDEFCHARS
+#endif
diff --git a/include/sys/types.h b/include/sys/types.h
index 4a5cdfab6..2aec0f698 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -1,4 +1,220 @@
+/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
+ */
+
+#ifndef _SYS_TYPES_H
+#define _SYS_TYPES_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+#include <bits/types.h>
+
+#ifdef __USE_BSD
+typedef __u_char u_char;
+typedef __u_short u_short;
+typedef __u_int u_int;
+typedef __u_long u_long;
+typedef __quad_t quad_t;
+typedef __u_quad_t u_quad_t;
+typedef __fsid_t fsid_t;
+#endif
+
+typedef __loff_t loff_t;
+
+#ifndef ino_t
+# ifndef __USE_FILE_OFFSET64
+typedef __ino_t ino_t;
+# else
+typedef __ino64_t ino_t;
+# endif
+# define ino_t ino_t
+#endif
+#if defined __USE_LARGEFILE64 && !defined ino64_t
+typedef __ino64_t ino64_t;
+# define ino64_t ino64_t
+#endif
+
+#ifndef dev_t
+typedef __dev_t dev_t;
+# define dev_t dev_t
+#endif
+
+#ifndef gid_t
+typedef __gid_t gid_t;
+# define gid_t gid_t
+#endif
+
+#ifndef mode_t
+typedef __mode_t mode_t;
+# define mode_t mode_t
+#endif
+
+#ifndef nlink_t
+typedef __nlink_t nlink_t;
+# define nlink_t nlink_t
+#endif
+
+#ifndef uid_t
+typedef __uid_t uid_t;
+# define uid_t uid_t
+#endif
+
+#ifndef off_t
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+# define off_t off_t
+#endif
+#if defined __USE_LARGEFILE64 && !defined off64_t
+typedef __off64_t off64_t;
+# define off64_t off64_t
+#endif
+
+#ifndef pid_t
+typedef __pid_t pid_t;
+# define pid_t pid_t
+#endif
+
+#if defined __USE_SVID || defined __USE_XOPEN
+typedef __id_t id_t;
+#endif
+
+#ifndef ssize_t
+typedef __ssize_t ssize_t;
+# define ssize_t ssize_t
+#endif
+
+#ifdef __USE_BSD
+typedef __daddr_t daddr_t;
+typedef __caddr_t caddr_t;
+#endif
+
+#if defined __USE_SVID || defined __USE_XOPEN
+typedef __key_t key_t;
+#endif
+
+#ifdef __USE_XOPEN
+# define __need_clock_t
+#endif
+#define __need_time_t
+#include <time.h>
+
+#define __need_size_t
#include <stddef.h>
-#include <sys/bitypes.h>
-#include <linux/types.h>
-#include <gnu/types.h>
+
+#ifdef __USE_MISC
+/* Old compatibility names for C types. */
+typedef unsigned long int ulong;
+typedef unsigned short int ushort;
+typedef unsigned int uint;
+#endif
+
+/* These size-specific names are used by some of the inet code. */
+
+#if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+
+/* These types are defined by the ISO C 9x header <inttypes.h>. */
+# ifndef __int8_t_defined
+# define __int8_t_defined
+typedef char int8_t;
+typedef short int int16_t;
+typedef int int32_t;
+# ifdef __GNUC__
+__extension__ typedef long long int int64_t;
+# endif
+# endif
+
+/* But these were defined by ISO C without the first `_'. */
+typedef unsigned char u_int8_t;
+typedef unsigned short int u_int16_t;
+typedef unsigned int u_int32_t;
+# ifdef __GNUC__
+__extension__ typedef unsigned long long int u_int64_t;
+# endif
+
+typedef int register_t;
+
+#else
+
+/* For GCC 2.7 and later, we can use specific type-size attributes. */
+# define __intN_t(N, MODE) \
+ typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
+# define __u_intN_t(N, MODE) \
+ typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
+
+# ifndef __int8_t_defined
+# define __int8_t_defined
+__intN_t (8, __QI__);
+__intN_t (16, __HI__);
+__intN_t (32, __SI__);
+__intN_t (64, __DI__);
+# endif
+
+__u_intN_t (8, __QI__);
+__u_intN_t (16, __HI__);
+__u_intN_t (32, __SI__);
+__u_intN_t (64, __DI__);
+
+typedef int register_t __attribute__ ((__mode__ (__word__)));
+
+
+/* Some code from BIND tests this macro to see if the types above are
+ defined. */
+#endif
+#define __BIT_TYPES_DEFINED__ 1
+
+
+#ifdef __USE_BSD
+/* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
+# include <endian.h>
+
+/* It also defines `fd_set' and the FD_* macros for `select'. */
+# include <sys/select.h>
+
+/* BSD defines these symbols, so we follow. */
+# include <sys/sysmacros.h>
+#endif /* Use BSD. */
+
+
+/* Types from the Large File Support interface. */
+#ifndef __USE_FILE_OFFSET64
+typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
+typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
+typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
+#else
+typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
+typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
+typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
+#endif
+
+#ifdef __USE_LARGEFILE64
+typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
+typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
+typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
+#endif
+
+__END_DECLS
+
+#endif /* sys/types.h */
diff --git a/include/sys/wait.h b/include/sys/wait.h
index 14c237307..be95c2202 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -28,7 +28,7 @@ Cambridge, MA 02139, USA. */
__BEGIN_DECLS
-#include <gnu/types.h>
+#include <sys/types.h>
/* This will define the `W*' macros for the flag
bits to `waitpid', `wait3', and `wait4'. */
diff --git a/libc/sysdeps/linux/i386/bits/byteswap.h b/libc/sysdeps/linux/i386/bits/byteswap.h
new file mode 100644
index 000000000..a1ba6b874
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/byteswap.h
@@ -0,0 +1,95 @@
+/* Macros to swap the order of bytes in integer values.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+#endif
+
+/* Swap bytes in 16 bit value. */
+#define __bswap_constant_16(x) \
+ ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+
+#if defined __GNUC__ && __GNUC__ >= 2
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ register unsigned short int __v; \
+ if (__builtin_constant_p (x)) \
+ __v = __bswap_constant_16 (x); \
+ else \
+ __asm__ __volatile__ ("rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" ((unsigned short int) (x)) \
+ : "cc"); \
+ __v; }))
+#else
+/* This is better than nothing. */
+# define __bswap_16(x) __bswap_constant_16 (x)
+#endif
+
+
+/* Swap bytes in 32 bit value. */
+#define __bswap_constant_32(x) \
+ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
+ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
+
+#if defined __GNUC__ && __GNUC__ >= 2
+/* To swap the bytes in a word the i486 processors and up provide the
+ `bswap' opcode. On i386 we have to use three instructions. */
+# if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__
+# define __bswap_32(x) \
+ (__extension__ \
+ ({ register unsigned int __v; \
+ if (__builtin_constant_p (x)) \
+ __v = __bswap_constant_32 (x); \
+ else \
+ __asm__ __volatile__ ("rorw $8, %w0;" \
+ "rorl $16, %0;" \
+ "rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" ((unsigned int) (x)) \
+ : "cc"); \
+ __v; }))
+# else
+# define __bswap_32(x) \
+ (__extension__ \
+ ({ register unsigned int __v; \
+ if (__builtin_constant_p (x)) \
+ __v = __bswap_constant_32 (x); \
+ else \
+ __asm__ __volatile__ ("bswap %0" \
+ : "=r" (__v) \
+ : "0" ((unsigned int) (x))); \
+ __v; }))
+# endif
+#else
+# define __bswap_32(x) __bswap_constant_32 (x)
+#endif
+
+
+#if defined __GNUC__ && __GNUC__ >= 2
+/* Swap bytes in 64 bit value. */
+# define __bswap_64(x) \
+ (__extension__ \
+ ({ union { __extension__ unsigned long long int __ll; \
+ unsigned long int __l[2]; } __w, __r; \
+ __w.__ll = (x); \
+ __r.__l[0] = __bswap_32 (__w.__l[1]); \
+ __r.__l[1] = __bswap_32 (__w.__l[0]); \
+ __r.__ll; }))
+#endif
diff --git a/libc/sysdeps/linux/i386/bits/dirent.h b/libc/sysdeps/linux/i386/bits/dirent.h
new file mode 100644
index 000000000..30e020328
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/dirent.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
+struct dirent
+ {
+#ifndef __USE_FILE_OFFSET64
+ __ino_t d_ino;
+ __off_t d_off;
+#else
+ __ino64_t d_ino;
+ __off64_t d_off;
+#endif
+ unsigned short int d_reclen;
+ unsigned char d_type;
+ char d_name[256]; /* We must not include limits.h! */
+ };
+
+#ifdef __USE_LARGEFILE64
+struct dirent64
+ {
+ __ino64_t d_ino;
+ __off64_t d_off;
+ unsigned short int d_reclen;
+ unsigned char d_type;
+ char d_name[256]; /* We must not include limits.h! */
+ };
+#endif
+
+#define d_fileno d_ino /* Backwards compatibility. */
+
+#undef _DIRENT_HAVE_D_NAMLEN
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
diff --git a/libc/sysdeps/linux/i386/bits/endian.h b/libc/sysdeps/linux/i386/bits/endian.h
new file mode 100644
index 000000000..54bd9d14b
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/endian.h
@@ -0,0 +1,7 @@
+/* i386 is little-endian. */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/libc/sysdeps/linux/i386/bits/in.h b/libc/sysdeps/linux/i386/bits/in.h
new file mode 100644
index 000000000..38e2a2e00
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/in.h
@@ -0,0 +1,128 @@
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* Linux version. */
+
+#ifndef _NETINET_IN_H
+# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
+#endif
+
+/* Options for use with `getsockopt' and `setsockopt' at the IP level.
+ The first word in the comment at the right is the data type used;
+ "bool" means a boolean value stored in an `int'. */
+#define IP_TOS 1 /* int; IP type of service and precedence. */
+#define IP_TTL 2 /* int; IP time to live. */
+#define IP_HDRINCL 3 /* int; Header is included with data. */
+#define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */
+#define IP_ROUTER_ALERT 5 /* bool */
+#define IP_RECVOPTS 6 /* bool */
+#define IP_RETOPTS 7 /* bool */
+#define IP_PKTINFO 8 /* bool */
+#define IP_PKTOPTIONS 9
+#define IP_PMTUDISC 10 /* obsolete name? */
+#define IP_MTU_DISCOVER 10 /* int; see below */
+#define IP_RECVERR 11 /* bool */
+#define IP_RECVTTL 12 /* bool */
+#define IP_RECVTOS 13 /* bool */
+#define IP_MULTICAST_IF 32 /* in_addr; set/get IP multicast i/f */
+#define IP_MULTICAST_TTL 33 /* u_char; set/get IP multicast ttl */
+#define IP_MULTICAST_LOOP 34 /* i_char; set/get IP multicast loopback */
+#define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */
+#define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */
+
+/* For BSD compatibility. */
+#define IP_RECVRETOPTS IP_RETOPTS
+
+/* IP_MTU_DISCOVER arguments. */
+#define IP_PMTUDISC_DONT 0 /* Never send DF frames. */
+#define IP_PMTUDISC_WANT 1 /* Use per route hints. */
+#define IP_PMTUDISC_DO 2 /* Always DF. */
+
+/* To select the IP level. */
+#define SOL_IP 0
+
+#define IP_DEFAULT_MULTICAST_TTL 1
+#define IP_DEFAULT_MULTICAST_LOOP 1
+#define IP_MAX_MEMBERSHIPS 20
+
+/* Structure used to describe IP options for IP_OPTIONS. The `ip_dst'
+ field is used for the first-hop gateway when using a source route
+ (this gets put into the header proper). */
+struct ip_opts
+ {
+ struct in_addr ip_dst; /* First hop; zero without source route. */
+ char ip_opts[40]; /* Actually variable in size. */
+ };
+
+/* Structure used for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */
+struct ip_mreq
+ {
+ struct in_addr imr_multiaddr; /* IP multicast address of group */
+ struct in_addr imr_interface; /* local IP address of interface */
+ };
+
+/* As above but including interface specification by index. */
+struct ip_mreqn
+ {
+ struct in_addr imr_multiaddr; /* IP multicast address of group */
+ struct in_addr imr_address; /* local IP address of interface */
+ int imr_ifindex; /* Interface index */
+ };
+
+/* Structure used for IP_PKTINFO. */
+struct in_pktinfo
+ {
+ int ipi_ifindex; /* Interface index */
+ struct in_addr ipi_spec_dst; /* Routing destination address */
+ struct in_addr ipi_addr; /* Header destination address */
+ };
+
+/* Options for use with `getsockopt' and `setsockopt' at the IPv6 level.
+ The first word in the comment at the right is the data type used;
+ "bool" means a boolean value stored in an `int'. */
+#define IPV6_ADDRFORM 1
+#define IPV6_PKTINFO 2
+#define IPV6_HOPOPTS 3
+#define IPV6_DSTOPTS 4
+#define IPV6_RXSRCRT 5
+#define IPV6_PKTOPTIONS 6
+#define IPV6_CHECKSUM 7
+#define IPV6_HOPLIMIT 8
+#define IPV6_NEXTHOP 9
+#define IPV6_AUTHHDR 10
+#define IPV6_UNICAST_HOPS 16
+#define IPV6_MULTICAST_IF 17
+#define IPV6_MULTICAST_HOPS 18
+#define IPV6_MULTICAST_LOOP 19
+#define IPV6_ADD_MEMBERSHIP 20
+#define IPV6_DROP_MEMBERSHIP 21
+#define IPV6_ROUTER_ALERT 22
+
+#define SCM_SRCRT IPV6_RXSRCRT
+
+#define IPV6_RXHOPOPTS IPV6_HOPOPTS /* obsolete name */
+#define IPV6_RXDSTOPTS IPV6_DSTOPTS /* obsolete name */
+
+/* IPV6_MTU_DISCOVER values. */
+#define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */
+#define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */
+#define IPV6_PMTUDISC_DO 2 /* Always DF. */
+
+/* Socket level values for IPv6. */
+#define SOL_IPV6 41
+#define SOL_ICMPV6 58
diff --git a/libc/sysdeps/linux/i386/bits/ioctl-types.h b/libc/sysdeps/linux/i386/bits/ioctl-types.h
new file mode 100644
index 000000000..59c79df81
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/ioctl-types.h
@@ -0,0 +1,77 @@
+/* Structure types for pre-termios terminal ioctls. Linux version.
+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
+#endif
+
+/* Get definition of constants for use with `ioctl'. */
+#include <asm/ioctls.h>
+
+
+struct winsize
+ {
+ unsigned short int ws_row;
+ unsigned short int ws_col;
+ unsigned short int ws_xpixel;
+ unsigned short int ws_ypixel;
+ };
+
+#define NCC 8
+struct termio
+ {
+ unsigned short int c_iflag; /* input mode flags */
+ unsigned short int c_oflag; /* output mode flags */
+ unsigned short int c_cflag; /* control mode flags */
+ unsigned short int c_lflag; /* local mode flags */
+ unsigned char c_line; /* line discipline */
+ unsigned char c_cc[NCC]; /* control characters */
+};
+
+/* modem lines */
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x008
+#define TIOCM_SR 0x010
+#define TIOCM_CTS 0x020
+#define TIOCM_CAR 0x040
+#define TIOCM_RNG 0x080
+#define TIOCM_DSR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RI TIOCM_RNG
+
+/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+
+/* line disciplines */
+#define N_TTY 0
+#define N_SLIP 1
+#define N_MOUSE 2
+#define N_PPP 3
+#define N_STRIP 4
+#define N_AX25 5
+#define N_X25 6 /* X.25 async */
+#define N_6PACK 7
+#define N_MASC 8 /* Mobitex module */
+#define N_R3964 9 /* Simatic R3964 module */
+#define N_PROFIBUS_FDL 10 /* Profibus */
+#define N_IRDA 11 /* Linux IR */
+#define N_SMSBLOCK 12 /* SMS block mode */
+#define N_HDLC 13 /* synchronous HDLC */
+#define N_SYNC_PPP 14 /* synchronous PPP */
diff --git a/libc/sysdeps/linux/i386/bits/ioctls.h b/libc/sysdeps/linux/i386/bits/ioctls.h
new file mode 100644
index 000000000..c103645f6
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/ioctls.h
@@ -0,0 +1,108 @@
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
+
+/* Use the definitions from the kernel header files. */
+#include <asm/ioctls.h>
+
+/* Routing table calls. */
+#define SIOCADDRT 0x890B /* add routing table entry */
+#define SIOCDELRT 0x890C /* delete routing table entry */
+#define SIOCRTMSG 0x890D /* call to routing system */
+
+/* Socket configuration controls. */
+#define SIOCGIFNAME 0x8910 /* get iface name */
+#define SIOCSIFLINK 0x8911 /* set iface channel */
+#define SIOCGIFCONF 0x8912 /* get iface list */
+#define SIOCGIFFLAGS 0x8913 /* get flags */
+#define SIOCSIFFLAGS 0x8914 /* set flags */
+#define SIOCGIFADDR 0x8915 /* get PA address */
+#define SIOCSIFADDR 0x8916 /* set PA address */
+#define SIOCGIFDSTADDR 0x8917 /* get remote PA address */
+#define SIOCSIFDSTADDR 0x8918 /* set remote PA address */
+#define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
+#define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
+#define SIOCGIFNETMASK 0x891b /* get network PA mask */
+#define SIOCSIFNETMASK 0x891c /* set network PA mask */
+#define SIOCGIFMETRIC 0x891d /* get metric */
+#define SIOCSIFMETRIC 0x891e /* set metric */
+#define SIOCGIFMEM 0x891f /* get memory address (BSD) */
+#define SIOCSIFMEM 0x8920 /* set memory address (BSD) */
+#define SIOCGIFMTU 0x8921 /* get MTU size */
+#define SIOCSIFMTU 0x8922 /* set MTU size */
+#define SIOCSIFHWADDR 0x8924 /* set hardware address */
+#define SIOCGIFENCAP 0x8925 /* get/set encapsulations */
+#define SIOCSIFENCAP 0x8926
+#define SIOCGIFHWADDR 0x8927 /* Get hardware address */
+#define SIOCGIFSLAVE 0x8929 /* Driver slaving support */
+#define SIOCSIFSLAVE 0x8930
+#define SIOCADDMULTI 0x8931 /* Multicast address lists */
+#define SIOCDELMULTI 0x8932
+#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */
+#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */
+#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */
+#define SIOCGIFPFLAGS 0x8935
+#define SIOCDIFADDR 0x8936 /* delete PA address */
+#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */
+#define SIOCGIFCOUNT 0x8938 /* get number of devices */
+
+#define SIOCGIFBR 0x8940 /* Bridging support */
+#define SIOCSIFBR 0x8941 /* Set bridging options */
+
+#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
+#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
+
+
+/* ARP cache control calls. */
+ /* 0x8950 - 0x8952 * obsolete calls, don't re-use */
+#define SIOCDARP 0x8953 /* delete ARP table entry */
+#define SIOCGARP 0x8954 /* get ARP table entry */
+#define SIOCSARP 0x8955 /* set ARP table entry */
+
+/* RARP cache control calls. */
+#define SIOCDRARP 0x8960 /* delete RARP table entry */
+#define SIOCGRARP 0x8961 /* get RARP table entry */
+#define SIOCSRARP 0x8962 /* set RARP table entry */
+
+/* Driver configuration calls */
+
+#define SIOCGIFMAP 0x8970 /* Get device parameters */
+#define SIOCSIFMAP 0x8971 /* Set device parameters */
+
+/* DLCI configuration calls */
+
+#define SIOCADDDLCI 0x8980 /* Create new DLCI device */
+#define SIOCDELDLCI 0x8981 /* Delete DLCI device */
+
+/* Device private ioctl calls. */
+
+/* These 16 ioctls are available to devices via the do_ioctl() device
+ vector. Each device should include this file and redefine these
+ names as their own. Because these are device dependent it is a good
+ idea _NOT_ to issue them to random objects and hope. */
+
+#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */
+
+/*
+ * These 16 ioctl calls are protocol private
+ */
+
+#define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */
diff --git a/libc/sysdeps/linux/i386/bits/local_lim.h b/libc/sysdeps/linux/i386/bits/local_lim.h
new file mode 100644
index 000000000..545a90b2e
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/local_lim.h
@@ -0,0 +1,55 @@
+/* Minimum guaranteed maximum values for system limits. Linux version.
+ Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* The kernel header pollutes the namespace with the NR_OPEN symbol.
+ Remove this after including the header if necessary. */
+#ifndef NR_OPEN
+# define __undef_NR_OPEN
+#endif
+
+/* The kernel sources contain a file with all the needed information. */
+#include <linux/limits.h>
+
+/* Have to remove NR_OPEN? */
+#ifdef __undef_NR_OPEN
+# undef NR_OPEN
+# undef __undef_NR_OPEN
+#endif
+
+/* The number of data keys per process. */
+#define _POSIX_THREAD_KEYS_MAX 128
+/* This is the value this implementation supports. */
+#define PTHREAD_KEYS_MAX 1024
+
+/* Controlling the iterations of destructors for thread-specific data. */
+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
+/* Number of iterations this implementation does. */
+#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
+
+/* The number of threads per process. */
+#define _POSIX_THREAD_THREADS_MAX 64
+/* This is the value this implementation supports. */
+#define PTHREAD_THREADS_MAX 1024
+
+/* Maximum amount by which a process can descrease its asynchronous I/O
+ priority level. */
+#define AIO_PRIO_DELTA_MAX 20
+
+/* Minimum size for a thread. We are free to choose a reasonable value. */
+#define PTHREAD_STACK_MIN 16384
diff --git a/libc/sysdeps/linux/i386/bits/posix1_lim.h b/libc/sysdeps/linux/i386/bits/posix1_lim.h
new file mode 100644
index 000000000..ee84b94a7
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/posix1_lim.h
@@ -0,0 +1,141 @@
+/* Copyright (C) 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * POSIX Standard: 2.9.2 Minimum Values Added to <limits.h>
+ *
+ * Never include this file directly; use <limits.h> instead.
+ */
+
+#ifndef _BITS_POSIX1_LIM_H
+#define _BITS_POSIX1_LIM_H 1
+
+
+/* These are the standard-mandated minimum values. */
+
+/* Minimum number of operations in one list I/O call. */
+#define _POSIX_AIO_LISTIO_MAX 2
+
+/* Minimal number of outstanding asynchronous I/O operations. */
+#define _POSIX_AIO_MAX 1
+
+/* Maximum length of arguments to `execve', including environment. */
+#define _POSIX_ARG_MAX 4096
+
+/* Maximum simultaneous processes per real user ID. */
+#define _POSIX_CHILD_MAX 6
+
+/* Minimal number of timer expiration overruns. */
+#define _POSIX_DELAYTIMER_MAX 32
+
+/* Maximum link count of a file. */
+#define _POSIX_LINK_MAX 8
+
+/* Number of bytes in a terminal canonical input queue. */
+#define _POSIX_MAX_CANON 255
+
+/* Number of bytes for which space will be
+ available in a terminal input queue. */
+#define _POSIX_MAX_INPUT 255
+
+/* Maximum number of message queues open for a process. */
+#define _POSIX_MQ_OPEN_MAX 8
+
+/* Maximum number of supported message priorities. */
+#define _POSIX_MQ_PRIO_MAX 32
+
+/* Number of simultaneous supplementary group IDs per process. */
+#define _POSIX_NGROUPS_MAX 0
+
+/* Number of files one process can have open at once. */
+#define _POSIX_OPEN_MAX 16
+
+/* Number of descriptors that a process may examine with `pselect' or
+ `select'. */
+#define _POSIX_FD_SETSIZE _POSIX_OPEN_MAX
+
+/* Number of bytes in a filename. */
+#define _POSIX_NAME_MAX 14
+
+/* Number of bytes in a pathname. */
+#define _POSIX_PATH_MAX 255
+
+/* Number of bytes than can be written atomically to a pipe. */
+#define _POSIX_PIPE_BUF 512
+
+/* Minimal number of realtime signals reserved for the application. */
+#define _POSIX_RTSIG_MAX 8
+
+/* Number of semaphores a process can have. */
+#define _POSIX_SEM_NSEMS_MAX 256
+
+/* Maximal value of a semaphore. */
+#define _POSIX_SEM_VALUE_MAX 32767
+
+/* Number of pending realtime signals. */
+#define _POSIX_SIGQUEUE_MAX 32
+
+/* Largest value of a `ssize_t'. */
+#define _POSIX_SSIZE_MAX 32767
+
+/* Number of streams a process can have open at once. */
+#define _POSIX_STREAM_MAX 8
+
+/* Maximum length of a timezone name (element of `tzname'). */
+#define _POSIX_TZNAME_MAX 3
+
+/* Maximum number of connections that can be queued on a socket. */
+#define _POSIX_QLIMIT 1
+
+/* Maximum number of bytes that can be buffered on a socket for send
+ or receive. */
+#define _POSIX_HIWAT _POSIX_PIPE_BUF
+
+/* Maximum number of elements in an `iovec' array. */
+#define _POSIX_UIO_MAXIOV 16
+
+/* Maximum number of characters in a tty name. */
+#define _POSIX_TTY_NAME_MAX 9
+
+/* Number of timer for a process. */
+#define _POSIX_TIMER_MAX 32
+
+/* Maximum length of login name. */
+#define _POSIX_LOGIN_NAME_MAX 9
+
+/* Maximum clock resolution in nanoseconds. */
+#define _POSIX_CLOCKRES_MIN 20000000
+
+
+/* Get the implementation-specific values for the above. */
+#include <bits/local_lim.h>
+
+
+#ifndef SSIZE_MAX
+# define SSIZE_MAX INT_MAX
+#endif
+
+
+/* This value is a guaranteed minimum maximum.
+ The current maximum can be got from `sysconf'. */
+
+#ifndef NGROUPS_MAX
+# define NGROUPS_MAX _POSIX_NGROUPS_MAX
+#endif
+
+#endif /* bits/posix1_lim.h */
diff --git a/libc/sysdeps/linux/i386/bits/posix2_lim.h b/libc/sysdeps/linux/i386/bits/posix2_lim.h
new file mode 100644
index 000000000..eaaf67129
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/posix2_lim.h
@@ -0,0 +1,100 @@
+/* Copyright (C) 1991, 1996, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * Never include this file directly; include <limits.h> instead.
+ */
+
+#ifndef _BITS_POSIX2_LIM_H
+#define _BITS_POSIX2_LIM_H 1
+
+
+/* The maximum `ibase' and `obase' values allowed by the `bc' utility. */
+#define _POSIX2_BC_BASE_MAX 99
+
+/* The maximum number of elements allowed in an array by the `bc' utility. */
+#define _POSIX2_BC_DIM_MAX 2048
+
+/* The maximum `scale' value allowed by the `bc' utility. */
+#define _POSIX2_BC_SCALE_MAX 99
+
+/* The maximum length of a string constant accepted by the `bc' utility. */
+#define _POSIX2_BC_STRING_MAX 1000
+
+/* The maximum number of weights that can be assigned to an entry of
+ the LC_COLLATE `order' keyword in the locale definition file.
+ We have no fixed limit, 255 is very high. */
+#define _POSIX2_COLL_WEIGHTS_MAX 255
+
+/* The maximum number of weights that can be assigned to an entry of
+ the LC_COLLATE category `order' keyword in a locale definition.
+ We have no fixed limit, 255 is a high number. */
+#define _POSIX2_EQUIV_CLASS_MAX 255
+
+/* The maximum number of expressions that can be nested
+ within parentheses by the `expr' utility. */
+#define _POSIX2_EXPR_NEST_MAX 32
+
+/* The maximum length, in bytes, of an input line. */
+#define _POSIX2_LINE_MAX 2048
+
+/* The maximum number of repeated occurrences of a regular expression
+ permitted when using the interval notation `\{M,N\}'. */
+#define _POSIX2_RE_DUP_MAX 255
+
+/* The maximum number of bytes in a character class name. We have no
+ fixed limit, 2048 is a high number. */
+#define _POSIX2_CHARCLASS_NAME_MAX 2048
+
+
+/* These values are implementation-specific,
+ and may vary within the implementation.
+ Their precise values can be obtained from sysconf. */
+
+#ifndef BC_BASE_MAX
+#define BC_BASE_MAX _POSIX2_BC_BASE_MAX
+#endif
+#ifndef BC_DIM_MAX
+#define BC_DIM_MAX _POSIX2_BC_DIM_MAX
+#endif
+#ifndef BC_SCALE_MAX
+#define BC_SCALE_MAX _POSIX2_BC_SCALE_MAX
+#endif
+#ifndef BC_STRING_MAX
+#define BC_STRING_MAX _POSIX2_BC_STRING_MAX
+#endif
+#ifndef COLL_WEIGHTS_MAX
+#define COLL_WEIGHTS_MAX _POSIX2_COLL_WEIGHTS_MAX
+#endif
+#ifndef EQUIV_CLASS_MAX
+#define EQUIV_CLASS_MAX _POSIX2_EQUIV_CLASS_MAX
+#endif
+#ifndef EXPR_NEST_MAX
+#define EXPR_NEST_MAX _POSIX2_EXPR_NEST_MAX
+#endif
+#ifndef LINE_MAX
+#define LINE_MAX _POSIX2_LINE_MAX
+#endif
+#ifndef CHARCLASS_NAME_MAX
+#define CHARCLASS_NAME_MAX _POSIX2_CHARCLASS_NAME_MAX
+#endif
+
+/* This value is defined like this in regex.h. */
+#define RE_DUP_MAX (0x7fff)
+
+#endif /* bits/posix2_lim.h */
diff --git a/libc/sysdeps/linux/i386/bits/select.h b/libc/sysdeps/linux/i386/bits/select.h
new file mode 100644
index 000000000..6acfc5b9a
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/select.h
@@ -0,0 +1,72 @@
+/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_SELECT_H
+# error "Never use <bits/select.h> directly; include <sys/select.h> instead."
+#endif
+
+
+#if defined __GNUC__ && __GNUC__ >= 2
+
+# define __FD_ZERO(fdsp) \
+ do { \
+ int __d0, __d1; \
+ __asm__ __volatile__ ("cld; rep; stosl" \
+ : "=c" (__d0), "=D" (__d1) \
+ : "a" (0), "0" (sizeof (__fd_set) \
+ / sizeof (__fd_mask)), \
+ "1" (&__FDS_BITS (fdsp)[0]) \
+ : "memory"); \
+ } while (0)
+
+# define __FD_SET(fd, fdsp) \
+ __asm__ __volatile__ ("btsl %1,%0" \
+ : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
+ : "r" (((int) (fd)) % __NFDBITS) \
+ : "cc","memory")
+# define __FD_CLR(fd, fdsp) \
+ __asm__ __volatile__ ("btrl %1,%0" \
+ : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
+ : "r" (((int) (fd)) % __NFDBITS) \
+ : "cc","memory")
+# define __FD_ISSET(fd, fdsp) \
+ (__extension__ \
+ ({register char __result; \
+ __asm__ __volatile__ ("btl %1,%2 ; setcb %b0" \
+ : "=q" (__result) \
+ : "r" (((int) (fd)) % __NFDBITS), \
+ "m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \
+ : "cc"); \
+ __result; }))
+
+#else /* ! GNU CC */
+
+/* We don't use `memset' because this would require a prototype and
+ the array isn't too big. */
+# define __FD_ZERO(set) \
+ do { \
+ unsigned int __i; \
+ __fd_set *__arr = (set); \
+ for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
+ __FDS_BITS (__arr)[__i] = 0; \
+ } while (0)
+# define __FD_SET(d, set) (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))
+# define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))
+# define __FD_ISSET(d, set) (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d))
+
+#endif /* GNU CC */
diff --git a/libc/sysdeps/linux/i386/bits/sigaction.h b/libc/sysdeps/linux/i386/bits/sigaction.h
new file mode 100644
index 000000000..250bdd146
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/sigaction.h
@@ -0,0 +1,77 @@
+/* The proper definitions for Linux's sigaction.
+ Copyright (C) 1993, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
+/* Structure describing the action to be taken when a signal arrives. */
+struct sigaction
+ {
+ /* Signal handler. */
+#ifdef __USE_POSIX199309
+ union
+ {
+ /* Used if SA_SIGINFO is not set. */
+ __sighandler_t sa_handler;
+ /* Used if SA_SIGINFO is set. */
+ void (*sa_sigaction) __PMT ((int, siginfo_t *, void *));
+ }
+ __sigaction_handler;
+# define sa_handler __sigaction_handler.sa_handler
+# define sa_sigaction __sigaction_handler.sa_sigaction
+#else
+ __sighandler_t sa_handler;
+#endif
+
+ /* Additional set of signals to be blocked. */
+ __sigset_t sa_mask;
+
+ /* Special flags. */
+ int sa_flags;
+
+ /* Restore handler. */
+ void (*sa_restorer) __P ((void));
+ };
+
+/* Bits in `sa_flags'. */
+#define SA_NOCLDSTOP 1 /* Don't send SIGCHLD when children stop. */
+#define SA_NOCLDWAIT 2 /* Don't create zombie on child death. */
+#define SA_SIGINFO 4 /* Invoke signal-catching function with
+ three arguments instead of one. */
+#if defined __USE_UNIX98 || defined __USE_MISC
+# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */
+# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */
+# define SA_NODEFER 0x40000000 /* Don't automatically block the signal when
+ its handler is being executed. */
+# define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */
+#endif
+#ifdef __USE_MISC
+# define SA_INTERRUPT 0x20000000 /* Historical no-op. */
+
+/* Some aliases for the SA_ constants. */
+# define SA_NOMASK SA_NODEFER
+# define SA_ONESHOT SA_RESETHAND
+# define SA_STACK SA_ONSTACK
+#endif
+
+/* Values for the HOW argument to `sigprocmask'. */
+#define SIG_BLOCK 0 /* Block signals. */
+#define SIG_UNBLOCK 1 /* Unblock signals. */
+#define SIG_SETMASK 2 /* Set the set of blocked signals. */
diff --git a/libc/sysdeps/linux/i386/bits/sigcontext.h b/libc/sysdeps/linux/i386/bits/sigcontext.h
new file mode 100644
index 000000000..97cbf4b30
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/sigcontext.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+#ifndef sigcontext_struct
+/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
+ we need sigcontext. */
+# define sigcontext_struct sigcontext
+
+# include <asm/sigcontext.h>
+#endif
diff --git a/libc/sysdeps/linux/i386/bits/siginfo.h b/libc/sysdeps/linux/i386/bits/siginfo.h
new file mode 100644
index 000000000..66e626199
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/siginfo.h
@@ -0,0 +1,279 @@
+/* siginfo_t, sigevent and constants. Linux version.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#if !defined _SIGNAL_H && !defined __need_siginfo_t
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+#if (!defined __have_siginfo_t \
+ && (defined _SIGNAL_H || defined __need_siginfo_t))
+# define __have_siginfo_t 1
+
+/* Type for data associated with a signal. */
+typedef union sigval
+ {
+ int sival_int;
+ void *sival_ptr;
+ } sigval_t;
+
+# define __SI_MAX_SIZE 128
+# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
+
+typedef struct siginfo
+ {
+ int si_signo; /* Signal number. */
+ int si_errno; /* If non-zero, an errno value associated with
+ this signal, as defined in <errno.h>. */
+ int si_code; /* Signal code. */
+
+ union
+ {
+ int _pad[__SI_PAD_SIZE];
+
+ /* kill(). */
+ struct
+ {
+ __pid_t si_pid; /* Sending process ID. */
+ __uid_t si_uid; /* Real user ID of sending process. */
+ } _kill;
+
+ /* POSIX.1b timers. */
+ struct
+ {
+ unsigned int _timer1;
+ unsigned int _timer2;
+ } _timer;
+
+ /* POSIX.1b signals. */
+ struct
+ {
+ __pid_t si_pid; /* Sending process ID. */
+ __uid_t si_uid; /* Real user ID of sending process. */
+ sigval_t si_sigval; /* Signal value. */
+ } _rt;
+
+ /* SIGCHLD. */
+ struct
+ {
+ __pid_t si_pid; /* Which child. */
+ __uid_t si_uid; /* Real user ID of sending process. */
+ int si_status; /* Exit value or signal. */
+ __clock_t si_utime;
+ __clock_t si_stime;
+ } _sigchld;
+
+ /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
+ struct
+ {
+ void *si_addr; /* Faulting insn/memory ref. */
+ } _sigfault;
+
+ /* SIGPOLL. */
+ struct
+ {
+ int si_band; /* Band event for SIGPOLL. */
+ int si_fd;
+ } _sigpoll;
+ } _sifields;
+ } siginfo_t;
+
+
+/* X/Open requires some more fields with fixed names. */
+# define si_pid _sifields._kill.si_pid
+# define si_uid _sifields._kill.si_uid
+# define si_status _sifields._sigchld.si_status
+# define si_utime _sifields._sigchld.si_utime
+# define si_stime _sifields._sigchld.si_stime
+# define si_value _sifields._rt.si_sigval
+# define si_int _sifields._rt.si_sigval.sival_int
+# define si_ptr _sifields._rt.si_sigval.sival_ptr
+# define si_addr _sifields._sigfault.si_addr
+# define si_band _sifields._sigpoll.si_band
+# define si_fd _sifields._sigpoll.si_fd
+
+
+/* Values for `si_code'. Positive values are reserved for kernel-generated
+ signals. */
+enum
+{
+ SI_SIGIO = -5, /* Sent by queued SIGIO. */
+# define SI_SIGIO SI_SIGIO
+ SI_ASYNCIO, /* Sent by AIO completion. */
+# define SI_ASYNCIO SI_ASYNCIO
+ SI_MESGQ, /* Sent by real time mesq state change. */
+# define SI_MESGQ SI_MESGQ
+ SI_TIMER, /* Sent by timer expiration. */
+# define SI_TIMER SI_TIMER
+ SI_QUEUE, /* Sent by sigqueue. */
+# define SI_QUEUE SI_QUEUE
+ SI_USER /* Sent by kill, sigsend, raise. */
+# define SI_USER SI_USER
+};
+
+
+/* `si_code' values for SIGILL signal. */
+enum
+{
+ ILL_ILLOPC = 1, /* Illegal opcode. */
+# define ILL_ILLOPC ILL_ILLOPC
+ ILL_ILLOPN, /* Illegal operand. */
+# define ILL_ILLOPN ILL_ILLOPN
+ ILL_ILLADR, /* Illegal addressing mode. */
+# define ILL_ILLADR ILL_ILLADR
+ ILL_ILLTRP, /* Illegal trap. */
+# define ILL_ILLTRP ILL_ILLTRP
+ ILL_PRVOPC, /* Privileged opcode. */
+# define ILL_PRVOPC ILL_PRVOPC
+ ILL_PRVREG, /* Privileged register. */
+# define ILL_PRVREG ILL_PRVREG
+ ILL_COPROC, /* Coprocessor error. */
+# define ILL_COPROC ILL_COPROC
+ ILL_BADSTK /* Internal stack error. */
+# define ILL_BADSTK ILL_BADSTK
+};
+
+/* `si_code' values for SIGFPE signal. */
+enum
+{
+ FPE_INTDIV = 1, /* Integer divide by zero. */
+# define FPE_INTDIV FPE_INTDIV
+ FPE_INTOVF, /* Integer overflow. */
+# define FPE_INTOVF FPE_INTOVF
+ FPE_FLTDIV, /* Floating point divide by zero. */
+# define FPE_FLTDIV FPE_FLTDIV
+ FPE_FLTOVF, /* Floating point overflow. */
+# define FPE_FLTOVF FPE_FLTOVF
+ FPE_FLTUND, /* Floating point underflow. */
+# define FPE_FLTUND FPE_FLTUND
+ FPE_FLTRES, /* Floating point inexact result. */
+# define FPE_FLTRES FPE_FLTRES
+ FPE_FLTINV, /* Floating point invalid operation. */
+# define FPE_FLTINV FPE_FLTINV
+ FPE_FLTSUB /* Subscript out of range. */
+# define FPE_FLTSUB FPE_FLTSUB
+};
+
+/* `si_code' values for SIGSEGV signal. */
+enum
+{
+ SEGV_MAPERR = 1, /* Address not mapped to object. */
+# define SEGV_MAPERR SEGV_MAPERR
+ SEGV_ACCERR /* Invalid permissions for mapped object. */
+# define SEGV_ACCERR SEGV_ACCERR
+};
+
+/* `si_code' values for SIGBUS signal. */
+enum
+{
+ BUS_ADRALN = 1, /* Invalid address alignment. */
+# define BUS_ADRALN BUS_ADRALN
+ BUS_ADRERR, /* Non-existant physical address. */
+# define BUS_ADRERR BUS_ADRERR
+ BUS_OBJERR /* Object specific hardware error. */
+# define BUS_OBJERR BUS_OBJERR
+};
+
+/* `si_code' values for SIGTRAP signal. */
+enum
+{
+ TRAP_BRKPT = 1, /* Process breakpoint. */
+# define TRAP_BRKPT TRAP_BRKPT
+ TRAP_TRACE /* Process trace trap. */
+# define TRAP_TRACE TRAP_TRACE
+};
+
+/* `si_code' values for SIGCHLD signal. */
+enum
+{
+ CLD_EXITED = 1, /* Child has exited. */
+# define CLD_EXITED CLD_EXITED
+ CLD_KILLED, /* Child was killed. */
+# define CLD_KILLED CLD_KILLED
+ CLD_DUMPED, /* Child terminated abnormally. */
+# define CLD_DUMPED CLD_DUMPED
+ CLD_TRAPPED, /* Traced child has trapped. */
+# define CLD_TRAPPED CLD_TRAPPED
+ CLD_STOPPED, /* Child has stopped. */
+# define CLD_STOPPED CLD_STOPPED
+ CLD_CONTINUED /* Stopped child has continued. */
+# define CLD_CONTINUED CLD_CONTINUED
+};
+
+/* `si_code' values for SIGPOLL signal. */
+enum
+{
+ POLL_IN = 1, /* Data input available. */
+# define POLL_IN POLL_IN
+ POLL_OUT, /* Output buffers available. */
+# define POLL_OUT POLL_OUT
+ POLL_MSG, /* Input message available. */
+# define POLL_MSG POLL_MSG
+ POLL_ERR, /* I/O error. */
+# define POLL_ERR POLL_ERR
+ POLL_PRI, /* High priority input available. */
+# define POLL_PRI POLL_PRI
+ POLL_HUP /* Device disconnected. */
+# define POLL_HUP POLL_HUP
+};
+
+# undef __need_siginfo_t
+#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */
+
+
+#if defined _SIGNAL_H && !defined __have_sigevent_t
+# define __have_sigevent_t 1
+
+/* Structure to transport application-defined values with signals. */
+# define __SIGEV_MAX_SIZE 64
+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
+
+typedef struct sigevent
+ {
+ sigval_t sigev_value;
+ int sigev_signo;
+ int sigev_notify;
+
+ union
+ {
+ int _pad[__SIGEV_PAD_SIZE];
+
+ struct
+ {
+ void (*_function) __PMT ((sigval_t)); /* Function to start. */
+ void *_attribute; /* Really pthread_attr_t. */
+ } _sigev_thread;
+ } _sigev_un;
+ } sigevent_t;
+
+/* POSIX names to access some of the members. */
+# define sigev_notify_function _sigev_un._sigev_thread._function
+# define sigev_notify_attributes _sigev_un._sigev_thread._attribute
+
+/* `sigev_notify' values. */
+enum
+{
+ SIGEV_SIGNAL = 0, /* Notify via signal. */
+# define SIGEV_SIGNAL SIGEV_SIGNAL
+ SIGEV_NONE, /* Other notification: meaningless. */
+# define SIGEV_NONE SIGEV_NONE
+ SIGEV_THREAD /* Deliver via thread creation. */
+# define SIGEV_THREAD SIGEV_THREAD
+};
+
+#endif /* have _SIGNAL_H. */
diff --git a/libc/sysdeps/linux/i386/bits/signum.h b/libc/sysdeps/linux/i386/bits/signum.h
new file mode 100644
index 000000000..fb26703d0
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/signum.h
@@ -0,0 +1,80 @@
+/* Signal number definitions. Linux version.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifdef _SIGNAL_H
+
+/* Fake signal functions. */
+#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
+#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
+#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
+
+#ifdef __USE_UNIX98
+# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#endif
+
+
+/* Signals. */
+#define SIGHUP 1 /* Hangup (POSIX). */
+#define SIGINT 2 /* Interrupt (ANSI). */
+#define SIGQUIT 3 /* Quit (POSIX). */
+#define SIGILL 4 /* Illegal instruction (ANSI). */
+#define SIGTRAP 5 /* Trace trap (POSIX). */
+#define SIGABRT 6 /* Abort (ANSI). */
+#define SIGIOT 6 /* IOT trap (4.2 BSD). */
+#define SIGBUS 7 /* BUS error (4.2 BSD). */
+#define SIGFPE 8 /* Floating-point exception (ANSI). */
+#define SIGKILL 9 /* Kill, unblockable (POSIX). */
+#define SIGUSR1 10 /* User-defined signal 1 (POSIX). */
+#define SIGSEGV 11 /* Segmentation violation (ANSI). */
+#define SIGUSR2 12 /* User-defined signal 2 (POSIX). */
+#define SIGPIPE 13 /* Broken pipe (POSIX). */
+#define SIGALRM 14 /* Alarm clock (POSIX). */
+#define SIGTERM 15 /* Termination (ANSI). */
+#define SIGSTKFLT 16 /* Stack fault. */
+#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
+#define SIGCHLD 17 /* Child status has changed (POSIX). */
+#define SIGCONT 18 /* Continue (POSIX). */
+#define SIGSTOP 19 /* Stop, unblockable (POSIX). */
+#define SIGTSTP 20 /* Keyboard stop (POSIX). */
+#define SIGTTIN 21 /* Background read from tty (POSIX). */
+#define SIGTTOU 22 /* Background write to tty (POSIX). */
+#define SIGURG 23 /* Urgent condition on socket (4.2 BSD). */
+#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */
+#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */
+#define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */
+#define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */
+#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */
+#define SIGPOLL SIGIO /* Pollable event occurred (System V). */
+#define SIGIO 29 /* I/O now possible (4.2 BSD). */
+#define SIGPWR 30 /* Power failure restart (System V). */
+#define SIGSYS 31 /* Bad system call. */
+#define SIGUNUSED 31
+
+#define _NSIG 64 /* Biggest signal number + 1
+ (including real-time signals). */
+
+#define SIGRTMIN (__libc_current_sigrtmin ())
+#define SIGRTMAX (__libc_current_sigrtmax ())
+
+/* These are the hard limits of the kernel. These values should not be
+ used directly at user level. */
+#define __SIGRTMIN 32
+#define __SIGRTMAX (_NSIG - 1)
+
+#endif /* <signal.h> included. */
diff --git a/libc/sysdeps/linux/i386/bits/sigstack.h b/libc/sysdeps/linux/i386/bits/sigstack.h
new file mode 100644
index 000000000..905e87fd9
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/sigstack.h
@@ -0,0 +1,55 @@
+/* sigstack, sigaltstack definitions.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+
+/* Structure describing a signal stack (obsolete). */
+struct sigstack
+ {
+ __ptr_t ss_sp; /* Signal stack pointer. */
+ int ss_onstack; /* Nonzero if executing on this stack. */
+ };
+
+
+/* Possible values for `ss_flags.'. */
+enum
+{
+ SS_ONSTACK = 1,
+#define SS_ONSTACK SS_ONSTACK
+ SS_DISABLE
+#define SS_DISABLE SS_DISABLE
+};
+
+/* Minimum stack size for a signal handler. */
+#define MINSIGSTKSZ 2048
+
+/* System default stack size. */
+#define SIGSTKSZ 8192
+
+
+/* Alternate, preferred interface. */
+typedef struct sigaltstack
+ {
+ __ptr_t ss_sp;
+ int ss_flags;
+ size_t ss_size;
+ } stack_t;
diff --git a/libc/sysdeps/linux/i386/bits/sigthread.h b/libc/sysdeps/linux/i386/bits/sigthread.h
new file mode 100644
index 000000000..c9b1dcf1b
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/sigthread.h
@@ -0,0 +1,37 @@
+/* Signal handling function for threaded programs.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _BITS_SIGTHREAD_H
+#define _BITS_SIGTHREAD_H 1
+
+#if !defined _SIGNAL_H && !defined _PTHREAD_H
+# error "Never include this file directly. Use <pthread.h> instead"
+#endif
+
+/* Functions for handling signals. */
+
+/* Modify the signal mask for the calling thread. The arguments have
+ the same meaning as for sigprocmask(2). */
+extern int pthread_sigmask __P ((int __how, __const __sigset_t *__newmask,
+ __sigset_t *__oldmask));
+
+/* Send signal SIGNO to the given thread. */
+extern int pthread_kill __P ((pthread_t __thread, int __signo));
+
+#endif /* bits/sigthread.h */
diff --git a/libc/sysdeps/linux/i386/bits/sockaddr.h b/libc/sysdeps/linux/i386/bits/sockaddr.h
new file mode 100644
index 000000000..1c523444b
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/sockaddr.h
@@ -0,0 +1,44 @@
+/* Definition of `struct sockaddr_*' common members. Generic/4.2 BSD version.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * Never include this file directly; use <sys/socket.h> instead.
+ */
+
+#ifndef _BITS_SOCKADDR_H
+#define _BITS_SOCKADDR_H 1
+
+
+/* POSIX.1g specifies this type name for the `sa_family' member. */
+typedef unsigned short int sa_family_t;
+
+/* This macro is used to declare the initial common members
+ of the data types used for socket addresses, `struct sockaddr',
+ `struct sockaddr_in', `struct sockaddr_un', etc. */
+
+#define __SOCKADDR_COMMON(sa_prefix) \
+ sa_family_t sa_prefix##family
+
+#define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int))
+
+/* Return the length of a `sockaddr' structure. */
+#define SA_LEN(_x) __libc_sa_len((_x)->sa_family)
+extern int __libc_sa_len __P ((sa_family_t __af));
+
+#endif /* bits/sockaddr.h */
diff --git a/libc/sysdeps/linux/i386/bits/socket.h b/libc/sysdeps/linux/i386/bits/socket.h
new file mode 100644
index 000000000..491b133b7
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/socket.h
@@ -0,0 +1,305 @@
+/* System-specific socket constants and types. Linux version.
+ Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef __BITS_SOCKET_H
+#define __BITS_SOCKET_H
+
+#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
+#define __need_size_t
+#define __need_NULL
+#include <stddef.h>
+
+#include <limits.h>
+#include <sys/types.h>
+
+/* Type for length arguments in socket calls. */
+typedef unsigned int socklen_t;
+
+/* Types of sockets. */
+enum __socket_type
+{
+ SOCK_STREAM = 1, /* Sequenced, reliable, connection-based
+ byte streams. */
+#define SOCK_STREAM SOCK_STREAM
+ SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams
+ of fixed maximum length. */
+#define SOCK_DGRAM SOCK_DGRAM
+ SOCK_RAW = 3, /* Raw protocol interface. */
+#define SOCK_RAW SOCK_RAW
+ SOCK_RDM = 4, /* Reliably-delivered messages. */
+#define SOCK_RDM SOCK_RDM
+ SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based,
+ datagrams of fixed maximum length. */
+#define SOCK_SEQPACKET SOCK_SEQPACKET
+ SOCK_PACKET = 10 /* Linux specific way of getting packets
+ at the dev level. For writing rarp and
+ other similar things on the user level. */
+#define SOCK_PACKET SOCK_PACKET
+};
+
+/* Protocol families. */
+#define PF_UNSPEC 0 /* Unspecified. */
+#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */
+#define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */
+#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */
+#define PF_INET 2 /* IP protocol family. */
+#define PF_AX25 3 /* Amateur Radio AX.25. */
+#define PF_IPX 4 /* Novell Internet Protocol. */
+#define PF_APPLETALK 5 /* Appletalk DDP. */
+#define PF_NETROM 6 /* Amateur radio NetROM. */
+#define PF_BRIDGE 7 /* Multiprotocol bridge. */
+#define PF_ATMPVC 8 /* ATM PVCs. */
+#define PF_X25 9 /* Reserved for X.25 project. */
+#define PF_INET6 10 /* IP version 6. */
+#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */
+#define PF_DECnet 12 /* Reserved for DECnet project. */
+#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */
+#define PF_SECURITY 14 /* Security callback pseudo AF. */
+#define PF_KEY 15 /* PF_KEY key management API. */
+#define PF_NETLINK 16
+#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */
+#define PF_PACKET 17 /* Packet family. */
+#define PF_ASH 18 /* Ash. */
+#define PF_ECONET 19 /* Acorn Econet. */
+#define PF_ATMSVC 20 /* ATM SVCs. */
+#define PF_SNA 22 /* Linux SNA Project */
+#define PF_IRDA 23 /* IRDA sockets. */
+#define PF_MAX 32 /* For now.. */
+
+/* Address families. */
+#define AF_UNSPEC PF_UNSPEC
+#define AF_LOCAL PF_LOCAL
+#define AF_UNIX PF_UNIX
+#define AF_FILE PF_FILE
+#define AF_INET PF_INET
+#define AF_AX25 PF_AX25
+#define AF_IPX PF_IPX
+#define AF_APPLETALK PF_APPLETALK
+#define AF_NETROM PF_NETROM
+#define AF_BRIDGE PF_BRIDGE
+#define AF_ATMPVC PF_ATMPVC
+#define AF_X25 PF_X25
+#define AF_INET6 PF_INET6
+#define AF_ROSE PF_ROSE
+#define AF_DECnet PF_DECnet
+#define AF_NETBEUI PF_NETBEUI
+#define AF_SECURITY PF_SECURITY
+#define AF_KEY PF_KEY
+#define AF_NETLINK PF_NETLINK
+#define AF_ROUTE PF_ROUTE
+#define AF_PACKET PF_PACKET
+#define AF_ASH PF_ASH
+#define AF_ECONET PF_ECONET
+#define AF_ATMSVC PF_ATMSVC
+#define AF_SNA PF_SNA
+#define AF_IRDA PF_IRDA
+#define AF_MAX PF_MAX
+
+/* Socket level values. Others are defined in the appropriate headers.
+
+ XXX These definitions also should go into the appropriate headers as
+ far as they are available. */
+#define SOL_RAW 255
+#define SOL_DECNET 261
+#define SOL_X25 262
+#define SOL_PACKET 263
+#define SOL_ATM 264 /* ATM layer (cell level). */
+#define SOL_AAL 265 /* ATM Adaption Layer (packet level). */
+#define SOL_IRDA 266
+
+/* Maximum queue length specifiable by listen. */
+#define SOMAXCONN 128
+
+/* Get the definition of the macro to define the common sockaddr members. */
+#include <bits/sockaddr.h>
+
+/* Structure describing a generic socket address. */
+struct sockaddr
+ {
+ __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
+ char sa_data[14]; /* Address data. */
+ };
+
+
+/* Structure large enough to hold any socket address (with the historical
+ exception of AF_UNIX). We reserve 128 bytes. */
+#if ULONG_MAX > 0xffffffff
+# define __ss_aligntype __uint64_t
+#else
+# define __ss_aligntype __uint32_t
+#endif
+#define _SS_SIZE 128
+#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype)))
+
+struct sockaddr_storage
+ {
+ __SOCKADDR_COMMON (__ss_); /* Address family, etc. */
+ __ss_aligntype __ss_align; /* Force desired alignment. */
+ char __ss_padding[_SS_PADSIZE];
+ };
+
+
+/* Bits in the FLAGS argument to `send', `recv', et al. */
+enum
+ {
+ MSG_OOB = 0x01, /* Process out-of-band data. */
+#define MSG_OOB MSG_OOB
+ MSG_PEEK = 0x02, /* Peek at incoming messages. */
+#define MSG_PEEK MSG_PEEK
+ MSG_DONTROUTE = 0x04, /* Don't use local routing. */
+#define MSG_DONTROUTE MSG_DONTROUTE
+#ifdef __USE_GNU
+ /* DECnet uses a different name. */
+ MSG_TRYHARD = MSG_DONTROUTE,
+# define MSG_TRYHARD MSG_DONTROUTE
+#endif
+ MSG_CTRUNC = 0x08, /* Control data lost before delivery. */
+#define MSG_CTRUNC MSG_CTRUNC
+ MSG_PROXY = 0x10, /* Supply or ask second address. */
+#define MSG_PROXY MSG_PROXY
+ MSG_TRUNC = 0x20,
+#define MSG_TRUNC MSG_TRUNC
+ MSG_DONTWAIT = 0x40, /* Nonblocking IO. */
+#define MSG_DONTWAIT MSG_DONTWAIT
+ MSG_EOR = 0x80, /* End of record. */
+#define MSG_EOR MSG_EOR
+ MSG_WAITALL = 0x100, /* Wait for a full request. */
+#define MSG_WAITALL MSG_WAITALL
+ MSG_FIN = 0x200,
+#define MSG_FIN MSG_FIN
+ MSG_SYN = 0x400,
+#define MSG_SYN MSG_SYN
+ MSG_URG = 0x800,
+#define MSG_URG MSG_URG
+ MSG_RST = 0x1000,
+#define MSG_RST MSG_RST
+ MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */
+#define MSG_ERRQUEUE MSG_ERRQUEUE
+ MSG_NOSIGNAL = 0x4000 /* Do not generate SIGPIPE. */
+#define MSG_NOSIGNAL MSG_NOSIGNAL
+ };
+
+
+/* Structure describing messages sent by
+ `sendmsg' and received by `recvmsg'. */
+struct msghdr
+ {
+ __ptr_t msg_name; /* Address to send to/receive from. */
+ socklen_t msg_namelen; /* Length of address data. */
+
+ struct iovec *msg_iov; /* Vector of data to send/receive into. */
+ size_t msg_iovlen; /* Number of elements in the vector. */
+
+ __ptr_t msg_control; /* Ancillary data (eg BSD filedesc passing). */
+ size_t msg_controllen; /* Ancillary data buffer length. */
+
+ int msg_flags; /* Flags on received message. */
+ };
+
+/* Structure used for storage of ancillary data object information. */
+struct cmsghdr
+ {
+ size_t cmsg_len; /* Length of data in cmsg_data plus length
+ of cmsghdr structure. */
+ int cmsg_level; /* Originating protocol. */
+ int cmsg_type; /* Protocol specific type. */
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+ unsigned char __cmsg_data[0]; /* Ancillary data. */
+ /* XXX Perhaps this should be removed. */
+#endif
+ };
+
+/* Ancillary data object manipulation macros. */
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+#else
+# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
+#endif
+#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+#define CMSG_FIRSTHDR(mhdr) \
+ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
+ ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
+ & ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+ + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr,
+ struct cmsghdr *__cmsg));
+#ifdef __USE_EXTERN_INLINES
+# ifndef _EXTERN_INLINE
+# define _EXTERN_INLINE extern __inline
+# endif
+_EXTERN_INLINE struct cmsghdr *
+__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
+{
+ if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+ /* The kernel header does this so there may be a reason. */
+ return 0;
+
+ __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ + CMSG_ALIGN (__cmsg->cmsg_len));
+ if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
+ + __mhdr->msg_controllen)
+ || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
+ >= ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
+ /* No more entries. */
+ return 0;
+ return __cmsg;
+}
+#endif /* Use `extern inline'. */
+
+/* Socket level message types. This must match the definitions in
+ <linux/socket.h>. */
+enum
+ {
+ SCM_RIGHTS = 0x01, /* Transfer file descriptors. */
+#define SCM_RIGHTS SCM_RIGHTS
+#ifdef __USE_BSD
+ SCM_CREDENTIALS = 0x02, /* Credentials passing. */
+# define SCM_CREDENTIALS SCM_CREDENTIALS
+#endif
+ __SCM_CONNECT = 0x03 /* Data array is `struct scm_connect'. */
+ };
+
+/* User visible structure for SCM_CREDENTIALS message */
+
+struct ucred
+{
+ pid_t pid; /* PID of sending process. */
+ uid_t uid; /* UID of sending process. */
+ gid_t gid; /* GID of sending process. */
+};
+
+/* Get socket manipulation related informations from kernel headers. */
+#include <asm/socket.h>
+
+
+/* Structure used to manipulate the SO_LINGER option. */
+struct linger
+ {
+ int l_onoff; /* Nonzero to linger on close. */
+ int l_linger; /* Time to linger. */
+ };
+
+#endif /* bits/socket.h */
diff --git a/libc/sysdeps/linux/i386/bits/stat.h b/libc/sysdeps/linux/i386/bits/stat.h
new file mode 100644
index 000000000..c175668a0
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/stat.h
@@ -0,0 +1,127 @@
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+/* Versions of the `struct stat' data structure. */
+#define _STAT_VER_LINUX_OLD 1
+#define _STAT_VER_KERNEL 1
+#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
+#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
+
+/* Versions of the `xmknod' interface. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
+
+
+struct stat
+ {
+ __dev_t st_dev; /* Device. */
+ unsigned short int __pad1;
+#ifndef __USE_FILE_OFFSET64
+ __ino_t st_ino; /* File serial number. */
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+#ifndef __USE_FILE_OFFSET64
+ __off_t st_size; /* Size of file, in bytes. */
+#else
+ __off64_t st_size; /* Size of file, in bytes. */
+#endif
+ unsigned long int st_blksize; /* Optimal block size for I/O. */
+
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
+#else
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+#endif
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+ };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ __dev_t st_dev; /* Device. */
+ unsigned short int __pad1;
+
+ __ino64_t st_ino; /* File serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+ __off64_t st_size; /* Size of file, in bytes. */
+ unsigned long int st_blksize; /* Optimal block size for I/O. */
+
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+ };
+#endif
+
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+
+/* Encoding of the file mode. */
+
+#define __S_IFMT 0170000 /* These bits determine file type. */
+
+/* File types. */
+#define __S_IFDIR 0040000 /* Directory. */
+#define __S_IFCHR 0020000 /* Character device. */
+#define __S_IFBLK 0060000 /* Block device. */
+#define __S_IFREG 0100000 /* Regular file. */
+#define __S_IFIFO 0010000 /* FIFO. */
+
+/* These don't actually exist on System V, but having them doesn't hurt. */
+#define __S_IFLNK 0120000 /* Symbolic link. */
+#define __S_IFSOCK 0140000 /* Socket. */
+
+/* Protection bits. */
+
+#define __S_ISUID 04000 /* Set user ID on execution. */
+#define __S_ISGID 02000 /* Set group ID on execution. */
+#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
+#define __S_IREAD 0400 /* Read by owner. */
+#define __S_IWRITE 0200 /* Write by owner. */
+#define __S_IEXEC 0100 /* Execute by owner. */
diff --git a/libc/sysdeps/linux/i386/bits/stdio_lim.h b/libc/sysdeps/linux/i386/bits/stdio_lim.h
new file mode 100644
index 000000000..bf79f2062
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/stdio_lim.h
@@ -0,0 +1,37 @@
+/* Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#if !defined _STDIO_H && !defined __need_FOPEN_MAX
+# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
+#endif
+
+#ifdef _STDIO_H
+# define L_tmpnam 20
+# define TMP_MAX 238328
+# define FILENAME_MAX 4095
+
+# ifdef __USE_POSIX
+# define L_ctermid 9
+# define L_cuserid 9
+# endif
+#endif
+
+#if defined __need_FOPEN_MAX || defined _STDIO_H
+# undef FOPEN_MAX
+# define FOPEN_MAX 256
+#endif
diff --git a/libc/sysdeps/linux/i386/bits/time.h b/libc/sysdeps/linux/i386/bits/time.h
new file mode 100644
index 000000000..cc9df6ea8
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/time.h
@@ -0,0 +1,59 @@
+/* System-dependent timing definitions. Linux version.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * Never include this file directly; use <time.h> instead.
+ */
+
+#ifndef __need_timeval
+# ifndef _BITS_TIME_H
+# define _BITS_TIME_H 1
+
+/* ISO/IEC 9899:1990 7.12.1: <time.h>
+ The macro `CLOCKS_PER_SEC' is the number per second of the value
+ returned by the `clock' function. */
+/* CAE XSH, Issue 4, Version 2: <time.h>
+ The value of CLOCKS_PER_SEC is required to be 1 million on all
+ XSI-conformant systems. */
+# define CLOCKS_PER_SEC 1000000
+
+# ifndef __STRICT_ANSI__
+/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
+ presents the real value for clock ticks per second for the system. */
+# define CLK_TCK 100
+# endif
+
+# endif /* machine/time.h */
+#endif
+
+#ifdef __need_timeval
+# undef __need_timeval
+# ifndef _STRUCT_TIMEVAL
+# define _STRUCT_TIMEVAL 1
+# include <bits/types.h>
+
+/* A time value that is accurate to the nearest
+ microsecond but also has a range of years. */
+struct timeval
+ {
+ __time_t tv_sec; /* Seconds. */
+ __time_t tv_usec; /* Microseconds. */
+ };
+# endif /* struct timeval */
+#endif /* need timeval */
diff --git a/libc/sysdeps/linux/i386/bits/types.h b/libc/sysdeps/linux/i386/bits/types.h
new file mode 100644
index 000000000..52174d421
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/types.h
@@ -0,0 +1,155 @@
+/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
+
+#ifndef _BITS_TYPES_H
+#define _BITS_TYPES_H 1
+
+#include <features.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+/* Convenience types. */
+typedef unsigned char __u_char;
+typedef unsigned short __u_short;
+typedef unsigned int __u_int;
+typedef unsigned long __u_long;
+#ifdef __GNUC__
+__extension__ typedef unsigned long long int __u_quad_t;
+__extension__ typedef long long int __quad_t;
+#else
+typedef struct
+ {
+ long int __val[2];
+ } __quad_t;
+typedef struct
+ {
+ __u_long __val[2];
+ } __u_quad_t;
+#endif
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#ifdef __GNUC__
+__extension__ typedef signed long long int __int64_t;
+__extension__ typedef unsigned long long int __uint64_t;
+#endif
+typedef __quad_t *__qaddr_t;
+
+typedef __u_quad_t __dev_t; /* Type of device numbers. */
+typedef __u_int __uid_t; /* Type of user identifications. */
+typedef __u_int __gid_t; /* Type of group identifications. */
+typedef __u_long __ino_t; /* Type of file serial numbers. */
+typedef __u_int __mode_t; /* Type of file attribute bitmasks. */
+typedef __u_int __nlink_t; /* Type of file link counts. */
+typedef long int __off_t; /* Type of file sizes and offsets. */
+typedef __quad_t __loff_t; /* Type of file sizes and offsets. */
+typedef int __pid_t; /* Type of process identifications. */
+typedef int __ssize_t; /* Type of a byte count, or error. */
+typedef __u_long __rlim_t; /* Type of resource counts. */
+typedef __u_quad_t __rlim64_t; /* Type of resource counts (LFS). */
+typedef __u_int __id_t; /* General type for ID. */
+
+typedef struct
+ {
+ int __val[2];
+ } __fsid_t; /* Type of file system IDs. */
+
+/* Everythin' else. */
+typedef int __daddr_t; /* The type of a disk address. */
+typedef char *__caddr_t;
+typedef long int __time_t;
+typedef long int __swblk_t; /* Type of a swap block maybe? */
+
+typedef long int __clock_t;
+
+/* One element in the file descriptor mask array. */
+typedef unsigned long int __fd_mask;
+
+/* Number of descriptors that can fit in an `fd_set'. */
+#define __FD_SETSIZE 1024
+
+/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
+#ifndef __NFDBITS
+#define __NFDBITS (8 * sizeof (__fd_mask))
+#define __FDELT(d) ((d) / __NFDBITS)
+#define __FDMASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS))
+#endif
+
+/* fd_set for select and pselect. */
+typedef struct
+ {
+ /* XPG4.2 requires this member name. Otherwise avoid the name
+ from the global namespace. */
+#ifdef __USE_XOPEN
+ __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
+# define __FDS_BITS(set) ((set)->fds_bits)
+#else
+ __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
+# define __FDS_BITS(set) ((set)->__fds_bits)
+#endif
+ } __fd_set;
+
+
+typedef int __key_t;
+
+/* Used in `struct shmid_ds'. */
+typedef unsigned short int __ipc_pid_t;
+
+
+/* Types from the Large File Support interface. */
+
+/* Type to count number os disk blocks. */
+typedef long int __blkcnt_t;
+typedef __quad_t __blkcnt64_t;
+
+/* Type to count file system blocks. */
+typedef __u_long __fsblkcnt_t;
+typedef __u_quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes. */
+typedef __u_long __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
+/* Type of file serial numbers. */
+typedef __u_long __ino64_t;
+
+/* Type of file sizes and offsets. */
+typedef __loff_t __off64_t;
+
+/* Used in XTI. */
+typedef long int __t_scalar_t;
+typedef unsigned long int __t_uscalar_t;
+
+/* Duplicates info from stdint.h but this is used in unistd.h. */
+typedef int __intptr_t;
+
+
+/* Now add the thread types. */
+#ifdef __USE_UNIX98
+# include <bits/pthreadtypes.h>
+#endif
+
+#endif /* bits/types.h */
diff --git a/libc/sysdeps/linux/i386/bits/wordsize.h b/libc/sysdeps/linux/i386/bits/wordsize.h
new file mode 100644
index 000000000..62dad0c71
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/wordsize.h
@@ -0,0 +1,19 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define __WORDSIZE 32
diff --git a/libc/sysdeps/linux/i386/bits/xopen_lim.h b/libc/sysdeps/linux/i386/bits/xopen_lim.h
new file mode 100644
index 000000000..9f22e44e2
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/xopen_lim.h
@@ -0,0 +1,96 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/*
+ * Never include this file directly; use <limits.h> instead.
+ */
+
+/* Additional definitions from X/Open Portability Guide, Issue 4, Version 2
+ System Interfaces and Headers, 4.16 <limits.h>
+
+ Please note only the values which are not greater than the minimum
+ stated in the standard document are listed. The `sysconf' functions
+ should be used to obtain the actual value. */
+
+#ifndef _XOPEN_LIM_H
+#define _XOPEN_LIM_H 1
+
+#define __need_FOPEN_MAX
+#include <bits/stdio_lim.h>
+
+/* We do not provide fixed values for
+
+ ARG_MAX Maximum length of argument to the `exec' function
+ including environment data.
+
+ ATEXIT_MAX Maximum number of functions that may be registered
+ with `atexit'.
+
+ CHILD_MAX Maximum number of simultaneous processes per real
+ user ID.
+
+ OPEN_MAX Maximum number of files that one process can have open
+ at anyone time.
+
+ PAGESIZE
+ PAGE_SIZE Size of bytes of a page.
+
+ PASS_MAX Maximum number of significant bytes in a password.
+*/
+
+
+/* Maximum number of `iovec' structures that one process has available
+ for use with `readv' or writev'. */
+#define IOV_MAX _XOPEN_IOV_MAX
+
+/* The number of streams that one process can have open at one time. */
+#define STREAM_MAX FOPEN_MAX
+
+/* Maximum number of bytes supported for the name of a time zone. */
+#define TZNAME_MAX _POSIX_TZNAME_MAX
+
+
+/* Maximum number of `iovec' structures that one process has available
+ for use with `readv' or writev'. */
+#define _XOPEN_IOV_MAX _POSIX_UIO_MAXIOV
+
+
+/* Maximum value of `digit' in calls to the `printf' and `scanf'
+ functions. We have no limit, so return a reasonable value. */
+#define NL_ARGMAX _POSIX_ARG_MAX
+
+/* Maximum number of bytes in a `LANG' name. We have no limit. */
+#define NL_LANGMAX _POSIX2_LINE_MAX
+
+/* Maximum message number. We have no limit. */
+#define NL_MSGMAX INT_MAX
+
+/* Maximum number of bytes in N-to-1 collation mapping. We have no
+ limit. */
+#define NL_NMAX INT_MAX
+
+/* Maximum set number. We have no limit. */
+#define NL_SETMAX INT_MAX
+
+/* Maximum number of bytes in a message. We have no limit. */
+#define NL_TEXTMAX INT_MAX
+
+/* Default process priority. */
+#define NZERO 20
+
+#endif /* bits/xopen_lim.h */
diff --git a/libc/sysdeps/linux/i386/setjmp.S b/libc/sysdeps/linux/i386/setjmp.S
index d6f2cba8b..d5139d7fe 100644
--- a/libc/sysdeps/linux/i386/setjmp.S
+++ b/libc/sysdeps/linux/i386/setjmp.S
@@ -20,7 +20,7 @@
#include <sysdep.h>
#define _ASM
#define _SETJMP_H
-#include <machine/setjmp.h>
+#include <bits/setjmp.h>
ENTRY (__setjmp)
popl %eax /* Pop return address. */