Bläddra i källkod

Rev all the header files to sync things with glibc 2.2.4

Eric Andersen 23 år sedan
förälder
incheckning
e83a36ce9f
100 ändrade filer med 6401 tillägg och 2897 borttagningar
  1. 10 10
      include/alloca.h
  2. 8 8
      include/ar.h
  3. 0 4
      include/arpa/ftp.h
  4. 55 44
      include/arpa/inet.h
  5. 446 241
      include/arpa/nameser.h
  6. 0 4
      include/arpa/telnet.h
  7. 0 4
      include/arpa/tftp.h
  8. 22 0
      include/assert.h
  9. 0 11
      include/cfgfile.h
  10. 8 9
      include/cpio.h
  11. 10 14
      include/crypt.h
  12. 23 2
      include/ctype.h
  13. 71 63
      include/dirent.h
  14. 31 42
      include/dlfcn.h
  15. 29 13
      include/elf.h
  16. 22 14
      include/endian.h
  17. 56 5
      include/err.h
  18. 60 10
      include/errno.h
  19. 58 21
      include/fcntl.h
  20. 286 70
      include/features.h
  21. 61 23
      include/fnmatch.h
  22. 5 9
      include/fstab.h
  23. 100 29
      include/getopt.h
  24. 51 25
      include/glob.h
  25. 46 22
      include/gnu-versions.h
  26. 136 23
      include/grp.h
  27. 11 10
      include/langinfo.h
  28. 61 36
      include/limits.h
  29. 29 9
      include/link.h
  30. 5 3
      include/locale.h
  31. 235 10
      include/malloc.h
  32. 34 1
      include/memory.h
  33. 85 97
      include/mntent.h
  34. 8 8
      include/net/ethernet.h
  35. 74 62
      include/net/if.h
  36. 15 12
      include/net/if_arp.h
  37. 8 8
      include/net/if_packet.h
  38. 8 8
      include/net/if_shaper.h
  39. 8 8
      include/net/if_slip.h
  40. 1 1
      include/net/pppio.h
  41. 8 8
      include/net/route.h
  42. 1 5
      include/net/slcompress.h
  43. 1 5
      include/net/vjcompress.h
  44. 497 196
      include/netdb.h
  45. 21 21
      include/netinet/ether.h
  46. 35 13
      include/netinet/icmp6.h
  47. 9 13
      include/netinet/if_ether.h
  48. 8 8
      include/netinet/if_fddi.h
  49. 8 8
      include/netinet/if_tr.h
  50. 9 13
      include/netinet/igmp.h
  51. 121 72
      include/netinet/in.h
  52. 8 8
      include/netinet/in_systm.h
  53. 9 36
      include/netinet/ip.h
  54. 20 19
      include/netinet/ip6.h
  55. 9 13
      include/netinet/ip_icmp.h
  56. 108 49
      include/netinet/tcp.h
  57. 8 8
      include/netinet/udp.h
  58. 11 11
      include/nl_types.h
  59. 64 12
      include/paths.h
  60. 11 10
      include/pty.h
  61. 120 36
      include/pwd.h
  62. 40 17
      include/regex.h
  63. 12 12
      include/regexp.h
  64. 354 66
      include/resolv.h
  65. 30 31
      include/rpc/auth.h
  66. 16 17
      include/rpc/auth_des.h
  67. 2 2
      include/rpc/auth_unix.h
  68. 41 43
      include/rpc/clnt.h
  69. 12 12
      include/rpc/des_crypt.h
  70. 13 13
      include/rpc/netdb.h
  71. 24 26
      include/rpc/pmap_clnt.h
  72. 2 2
      include/rpc/pmap_prot.h
  73. 3 2
      include/rpc/pmap_rmt.h
  74. 30 1
      include/rpc/rpc.h
  75. 5 5
      include/rpc/rpc_msg.h
  76. 55 56
      include/rpc/svc.h
  77. 2 2
      include/rpc/svc_auth.h
  78. 23 3
      include/rpc/types.h
  79. 67 69
      include/rpc/xdr.h
  80. 142 66
      include/search.h
  81. 37 32
      include/setjmp.h
  82. 92 74
      include/signal.h
  83. 0 205
      include/stdarg.h
  84. 30 26
      include/stdint.h
  85. 393 190
      include/stdio.h
  86. 844 101
      include/stdlib.h
  87. 334 109
      include/string.h
  88. 65 1
      include/strings.h
  89. 3 1
      include/sys/bitypes.h
  90. 195 27
      include/sys/cdefs.h
  91. 8 8
      include/sys/dir.h
  92. 38 17
      include/sys/file.h
  93. 20 19
      include/sys/io.h
  94. 10 10
      include/sys/ioctl.h
  95. 32 12
      include/sys/ipc.h
  96. 8 8
      include/sys/kd.h
  97. 10 10
      include/sys/kdaemon.h
  98. 10 10
      include/sys/klog.h
  99. 120 20
      include/sys/mman.h
  100. 17 15
      include/sys/mount.h

+ 10 - 10
include/alloca.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_ALLOCA_H
 #define	_ALLOCA_H	1
@@ -30,7 +30,7 @@ __BEGIN_DECLS
 #undef	alloca
 
 /* Allocate a block that will be freed when the calling function exits.  */
-extern __ptr_t alloca __P ((size_t __size));
+extern void *alloca (size_t __size) __THROW;
 
 #ifdef	__GNUC__
 # define alloca(size)	__builtin_alloca (size)

+ 8 - 8
include/ar.h

@@ -3,19 +3,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _AR_H
 #define _AR_H 1

+ 0 - 4
include/arpa/ftp.h

@@ -10,10 +10,6 @@
  * 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.

+ 55 - 44
include/arpa/inet.h

@@ -1,94 +1,105 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000, 2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _ARPA_INET_H
 #define	_ARPA_INET_H	1
 
 #include <features.h>
-
-#include <sys/types.h>
 #include <netinet/in.h>		/* To define `struct in_addr'.  */
 
+/* Type for length arguments in socket calls.  */
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
+
 __BEGIN_DECLS
 
 /* Convert Internet host address from numbers-and-dots notation in CP
    into binary data in network byte order.  */
-extern u_int32_t inet_addr __P ((__const char *__cp));
-
-/* Convert Internet host address from numbers-and-dots notation in CP
-   into binary data and store the result in the structure INP.  */
-extern int inet_aton __P ((__const char *__cp, struct in_addr *__inp));
+extern in_addr_t inet_addr (__const char *__cp) __THROW;
 
 /* Return the local host address part of the Internet address in IN.  */
-extern u_int32_t inet_lnaof __P ((struct in_addr __in));
+extern in_addr_t inet_lnaof (struct in_addr __in) __THROW;
 
 /* Make Internet host address in network byte order by combining the
    network number NET with the local address HOST.  */
-extern struct in_addr inet_makeaddr __P ((u_int32_t __net, u_int32_t __host));
-
-/* Format a network number NET into presentation format and place result
-   in buffer starting at BUF with length of LEN bytes.  */
-extern char *inet_neta __P ((u_int32_t __net, char *__buf, size_t __len));
+extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host)
+     __THROW;
 
 /* Return network number part of the Internet address IN.  */
-extern u_int32_t inet_netof __P ((struct in_addr __in));
+extern in_addr_t inet_netof (struct in_addr __in) __THROW;
 
 /* Extract the network number in network byte order from the address
    in numbers-and-dots natation starting at CP.  */
-extern u_int32_t inet_network __P ((__const char *__cp));
-
-/* Convert network number for interface type AF in buffer starting at
-   CP to presentation format.  The result will specifiy BITS bits of
-   the number.  */
-extern char *inet_net_ntop __P ((int __af, __const void *__cp, int __bits,
-				 char *__buf, size_t __len));
-
-/* Convert network number for interface type AF from presentation in
-   buffer starting at CP to network format and store result int
-   buffer starting at BUF of size LEN.  */
-extern int inet_net_pton __P ((int __af, __const char *__cp,
-			       void *__buf, size_t __len));
+extern in_addr_t inet_network (__const char *__cp) __THROW;
 
 /* Convert Internet number in IN to ASCII representation.  The return value
    is a pointer to an internal array containing the string.  */
-extern char *inet_ntoa __P ((struct in_addr __in));
+extern char *inet_ntoa (struct in_addr __in) __THROW;
 
 /* Convert from presentation format of an Internet number in buffer
    starting at CP to the binary network format and store result for
    interface type AF in buffer starting at BUF.  */
-extern int inet_pton __P ((int __af, __const char *__cp, void *__buf));
+extern int inet_pton (int __af, __const char *__restrict __cp,
+		      void *__restrict __buf) __THROW;
 
 /* Convert a Internet address in binary network format for interface
    type AF in buffer starting at CP to presentation form and place
    result in buffer of length LEN astarting at BUF.  */
-extern __const char *inet_ntop __P ((int __af, __const void *__cp,
-				     char *__buf, size_t __len));
+extern __const char *inet_ntop (int __af, __const void *__restrict __cp,
+				char *__restrict __buf, socklen_t __len)
+     __THROW;
+
+
+/* The following functions are not part of XNS 5.2.  */
+#ifdef __USE_MISC
+/* Convert Internet host address from numbers-and-dots notation in CP
+   into binary data and store the result in the structure INP.  */
+extern in_addr_t inet_aton (__const char *__cp, struct in_addr *__inp) __THROW;
+
+/* Format a network number NET into presentation format and place result
+   in buffer starting at BUF with length of LEN bytes.  */
+extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW;
+
+/* Convert network number for interface type AF in buffer starting at
+   CP to presentation format.  The result will specifiy BITS bits of
+   the number.  */
+extern char *inet_net_ntop (int __af, __const void *__cp, int __bits,
+			    char *__buf, size_t __len) __THROW;
+
+/* Convert network number for interface type AF from presentation in
+   buffer starting at CP to network format and store result int
+   buffer starting at BUF of size LEN.  */
+extern int inet_net_pton (int __af, __const char *__cp,
+			  void *__buf, size_t __len) __THROW;
 
 /* Convert ASCII representation in hexadecimal form of the Internet
    address to binary form and place result in buffer of length LEN
    starting at BUF.  */
-extern unsigned int inet_nsap_addr __P ((__const char *__cp,
-					 unsigned char *__buf, int __len));
+extern unsigned int inet_nsap_addr (__const char *__cp,
+				    unsigned char *__buf, int __len) __THROW;
 
 /* Convert internet address in binary form in LEN bytes starting at CP
    a presentation form and place result in BUF.  */
-extern char *inet_nsap_ntoa __P ((int __len, __const unsigned char *__cp,
-				  char *__buf));
+extern char *inet_nsap_ntoa (int __len, __const unsigned char *__cp,
+			     char *__buf) __THROW;
+#endif
 
 __END_DECLS
 

+ 446 - 241
include/arpa/nameser.h

@@ -1,9 +1,7 @@
 /*
- * ++Copyright++ 1983, 1989, 1993
- * -
  * Copyright (c) 1983, 1989, 1993
  *    The Regents of the University of California.  All rights reserved.
- *
+ * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -12,14 +10,10 @@
  * 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
@@ -31,320 +25,531 @@
  * 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.
+ */
+
+/*
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
  *
  * 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.
+ * copyright notice and this permission notice appear in all copies.
  *
- * 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
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM 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.
- * -
- * Portions Copyright (c) 1995 by International Business Machines, Inc.
- *
- * International Business Machines, Inc. (hereinafter called IBM) grants
- * permission under its copyrights to use, copy, modify, and distribute this
- * Software with or without fee, provided that the above copyright notice and
- * all paragraphs of this notice appear in all copies, and that the name of IBM
- * not be used in connection with the marketing of any product incorporating
- * the Software or modifications thereof, without specific, written prior
- * permission.
- *
- * To the extent it has a right to do so, IBM grants an immunity from suit
- * under its patents, if any, for the use, sale or manufacture of products to
- * the extent that such products are used for performing Domain Name System
- * dynamic updates in TCP/IP networks by means of the Software.  No immunity is
- * granted for any product per se or for any other function of any product.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE.  IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
- * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
- * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
- * --Copyright--
  */
 
 /*
- *      @(#)nameser.h	8.1 (Berkeley) 6/2/93
- *	$Id: nameser.h,v 1.3 2000/07/09 06:39:14 andersen Exp $
+ *	$BINDId: nameser.h,v 8.37 2000/03/30 21:16:49 vixie Exp $
  */
 
-#ifndef _ARPA_NAMESER_H
-#define	_ARPA_NAMESER_H 1
+#ifndef _ARPA_NAMESER_H_
+#define _ARPA_NAMESER_H_
+
+#define BIND_4_COMPAT
 
-#include <features.h>
 #include <sys/param.h>
-#include <sys/types.h>
+#if (!defined(BSD)) || (BSD < 199306)
+# include <sys/bitypes.h>
+#else
+# include <sys/types.h>
+#endif
+#include <sys/cdefs.h>
 
 /*
- * revision information.  this is the release date in YYYYMMDD format.
- * it can change every day so the right thing to do with it is use it
- * in preprocessor commands such as "#if (__BIND > 19931104)".  do not
- * compare for equality; rather, use it to determine whether your resolver
- * is new enough to contain a certain feature.
+ * Revision information.  This is the release date in YYYYMMDD format.
+ * It can change every day so the right thing to do with it is use it
+ * in preprocessor commands such as "#if (__NAMESER > 19931104)".  Do not
+ * compare for equality; rather, use it to determine whether your libbind.a
+ * contains a new enough lib/nameser/ to support the feature you need.
  */
 
-#define __BIND		19960801	/* interface version stamp */
+#define __NAMESER	19991006	/* New interface version stamp. */
 
 /*
- * Define constants based on rfc883
+ * Define constants based on RFC 883, RFC 1034, RFC 1035
  */
-#define PACKETSZ	512		/* maximum packet size */
-#define MAXDNAME	1025		/* maximum domain name */
-#define MAXCDNAME	255		/* maximum compressed domain name */
-#define MAXLABEL	63		/* maximum length of domain label */
-#define HFIXEDSZ	12		/* #/bytes of fixed data in header */
-#define QFIXEDSZ	4		/* #/bytes of fixed data in query */
-#define RRFIXEDSZ	10		/* #/bytes of fixed data in r record */
-#define INT32SZ		4		/* for systems without 32-bit ints */
-#define INT16SZ		2		/* for systems without 16-bit ints */
-#define INADDRSZ	4		/* IPv4 T_A */
-#define IN6ADDRSZ	16		/* IPv6 T_AAAA */
+#define NS_PACKETSZ	512	/* maximum packet size */
+#define NS_MAXDNAME	1025	/* maximum domain name */
+#define NS_MAXCDNAME	255	/* maximum compressed domain name */
+#define NS_MAXLABEL	63	/* maximum length of domain label */
+#define NS_HFIXEDSZ	12	/* #/bytes of fixed data in header */
+#define NS_QFIXEDSZ	4	/* #/bytes of fixed data in query */
+#define NS_RRFIXEDSZ	10	/* #/bytes of fixed data in r record */
+#define NS_INT32SZ	4	/* #/bytes of data in a u_int32_t */
+#define NS_INT16SZ	2	/* #/bytes of data in a u_int16_t */
+#define NS_INT8SZ	1	/* #/bytes of data in a u_int8_t */
+#define NS_INADDRSZ	4	/* IPv4 T_A */
+#define NS_IN6ADDRSZ	16	/* IPv6 T_AAAA */
+#define NS_CMPRSFLGS	0xc0	/* Flag bits indicating name compression. */
+#define NS_DEFAULTPORT	53	/* For both TCP and UDP. */
 
 /*
- * Internet nameserver port number
+ * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
+ * in synch with it.
  */
-#define NAMESERVER_PORT	53
+typedef enum __ns_sect {
+	ns_s_qd = 0,		/* Query: Question. */
+	ns_s_zn = 0,		/* Update: Zone. */
+	ns_s_an = 1,		/* Query: Answer. */
+	ns_s_pr = 1,		/* Update: Prerequisites. */
+	ns_s_ns = 2,		/* Query: Name servers. */
+	ns_s_ud = 2,		/* Update: Update. */
+	ns_s_ar = 3,		/* Query|Update: Additional records. */
+	ns_s_max = 4
+} ns_sect;
 
 /*
- * Currently defined opcodes
+ * This is a message handle.  It is caller allocated and has no dynamic data.
+ * This structure is intended to be opaque to all but ns_parse.c, thus the
+ * leading _'s on the member names.  Use the accessor functions, not the _'s.
  */
-#define QUERY		0x0		/* standard query */
-#define IQUERY		0x1		/* inverse query */
-#define STATUS		0x2		/* nameserver status query */
-/*#define xxx		0x3*/		/* 0x3 reserved */
-#define NS_NOTIFY_OP	0x4		/* notify secondary of SOA change */
+typedef struct __ns_msg {
+	const u_char	*_msg, *_eom;
+	u_int16_t	_id, _flags, _counts[ns_s_max];
+	const u_char	*_sections[ns_s_max];
+	ns_sect		_sect;
+	int		_rrnum;
+	const u_char	*_ptr;
+} ns_msg;
+
+/* Private data structure - do not use from outside library. */
+struct _ns_flagdata {  int mask, shift;  };
+extern struct _ns_flagdata _ns_flagdata[];
+
+/* Accessor macros - this is part of the public interface. */
+#define ns_msg_getflag(handle, flag) ( \
+			((handle)._flags & _ns_flagdata[flag].mask) \
+			 >> _ns_flagdata[flag].shift \
+			)
+#define ns_msg_id(handle) ((handle)._id + 0)
+#define ns_msg_base(handle) ((handle)._msg + 0)
+#define ns_msg_end(handle) ((handle)._eom + 0)
+#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
+#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
+
 /*
- * Currently defined response codes
+ * This is a parsed record.  It is caller allocated and has no dynamic data.
  */
-#define NOERROR		0		/* no error */
-#define FORMERR		1		/* format error */
-#define SERVFAIL	2		/* server failure */
-#define NXDOMAIN	3		/* non existent domain */
-#define NOTIMP		4		/* not implemented */
-#define REFUSED		5		/* query refused */
+typedef	struct __ns_rr {
+	char		name[NS_MAXDNAME];
+	u_int16_t	type;
+	u_int16_t	rr_class;
+	u_int32_t	ttl;
+	u_int16_t	rdlength;
+	const u_char *	rdata;
+} ns_rr;
+
+/* Accessor macros - this is part of the public interface. */
+#define ns_rr_name(rr)	(((rr).name[0] != '\0') ? (rr).name : ".")
+#define ns_rr_type(rr)	((ns_type)((rr).type + 0))
+#define ns_rr_class(rr)	((ns_class)((rr).rr_class + 0))
+#define ns_rr_ttl(rr)	((rr).ttl + 0)
+#define ns_rr_rdlen(rr)	((rr).rdlength + 0)
+#define ns_rr_rdata(rr)	((rr).rdata + 0)
 
 /*
- * Type values for resources and queries
+ * These don't have to be in the same order as in the packet flags word,
+ * and they can even overlap in some cases, but they will need to be kept
+ * in synch with ns_parse.c:ns_flagdata[].
  */
-#define T_A		1		/* host address */
-#define T_NS		2		/* authoritative server */
-#define T_MD		3		/* mail destination */
-#define T_MF		4		/* mail forwarder */
-#define T_CNAME		5		/* canonical name */
-#define T_SOA		6		/* start of authority zone */
-#define T_MB		7		/* mailbox domain name */
-#define T_MG		8		/* mail group member */
-#define T_MR		9		/* mail rename name */
-#define T_NULL		10		/* null resource record */
-#define T_WKS		11		/* well known service */
-#define T_PTR		12		/* domain name pointer */
-#define T_HINFO		13		/* host information */
-#define T_MINFO		14		/* mailbox information */
-#define T_MX		15		/* mail routing information */
-#define T_TXT		16		/* text strings */
-#define T_RP		17		/* responsible person */
-#define T_AFSDB		18		/* AFS cell database */
-#define T_X25		19		/* X_25 calling address */
-#define T_ISDN		20		/* ISDN calling address */
-#define T_RT		21		/* router */
-#define T_NSAP		22		/* NSAP address */
-#define T_NSAP_PTR	23		/* reverse NSAP lookup (deprecated) */
-#define T_SIG		24		/* security signature */
-#define T_KEY		25		/* security key */
-#define T_PX		26		/* X.400 mail mapping */
-#define T_GPOS		27		/* geographical position (withdrawn) */
-#define T_AAAA		28		/* IP6 Address */
-#define T_LOC		29		/* Location Information */
-#define T_NXT		30		/* Next Valid Name in Zone */
-#define T_EID		31		/* Endpoint identifier */
-#define T_NIMLOC	32		/* Nimrod locator */
-#define T_SRV		33		/* Server selection */
-#define T_ATMA		34		/* ATM Address */
-#define T_NAPTR		35		/* Naming Authority PoinTeR */
-	/* non standard */
-#define T_UINFO		100		/* user (finger) information */
-#define T_UID		101		/* user ID */
-#define T_GID		102		/* group ID */
-#define T_UNSPEC	103		/* Unspecified format (binary data) */
-	/* Query type values which do not appear in resource records */
-#define	T_IXFR		251		/* incremental zone transfer */
-#define T_AXFR		252		/* transfer zone of authority */
-#define T_MAILB		253		/* transfer mailbox records */
-#define T_MAILA		254		/* transfer mail agent records */
-#define T_ANY		255		/* wildcard match */
+typedef enum __ns_flag {
+	ns_f_qr,		/* Question/Response. */
+	ns_f_opcode,		/* Operation code. */
+	ns_f_aa,		/* Authoritative Answer. */
+	ns_f_tc,		/* Truncation occurred. */
+	ns_f_rd,		/* Recursion Desired. */
+	ns_f_ra,		/* Recursion Available. */
+	ns_f_z,			/* MBZ. */
+	ns_f_ad,		/* Authentic Data (DNSSEC). */
+	ns_f_cd,		/* Checking Disabled (DNSSEC). */
+	ns_f_rcode,		/* Response code. */
+	ns_f_max
+} ns_flag;
 
 /*
- * Values for class field
+ * Currently defined opcodes.
  */
-
-#define C_IN		1		/* the arpa internet */
-#define C_CHAOS		3		/* for chaos net (MIT) */
-#define C_HS		4		/* for Hesiod name server (MIT) (XXX) */
-	/* Query class values which do not appear in resource records */
-#define C_ANY		255		/* wildcard match */
+typedef enum __ns_opcode {
+	ns_o_query = 0,		/* Standard query. */
+	ns_o_iquery = 1,	/* Inverse query (deprecated/unsupported). */
+	ns_o_status = 2,	/* Name server status query (unsupported). */
+				/* Opcode 3 is undefined/reserved. */
+	ns_o_notify = 4,	/* Zone change notification. */
+	ns_o_update = 5,	/* Zone update message. */
+	ns_o_max = 6
+} ns_opcode;
 
 /*
- * Flags field of the KEY RR rdata
+ * Currently defined response codes.
  */
-#define	KEYFLAG_TYPEMASK	0xC000	/* Mask for "type" bits */
-#define	KEYFLAG_TYPE_AUTH_CONF	0x0000	/* Key usable for both */
-#define	KEYFLAG_TYPE_CONF_ONLY	0x8000	/* Key usable for confidentiality */
-#define	KEYFLAG_TYPE_AUTH_ONLY	0x4000	/* Key usable for authentication */
-#define	KEYFLAG_TYPE_NO_KEY	0xC000	/* No key usable for either; no key */
-/* The type bits can also be interpreted independently, as single bits: */
-#define	KEYFLAG_NO_AUTH		0x8000	/* Key not usable for authentication */
-#define	KEYFLAG_NO_CONF		0x4000	/* Key not usable for confidentiality */
-
-#define	KEYFLAG_EXPERIMENTAL	0x2000	/* Security is *mandatory* if bit=0 */
-#define	KEYFLAG_RESERVED3	0x1000  /* reserved - must be zero */
-#define	KEYFLAG_RESERVED4	0x0800  /* reserved - must be zero */
-#define	KEYFLAG_USERACCOUNT	0x0400	/* key is assoc. with a user acct */
-#define	KEYFLAG_ENTITY		0x0200	/* key is assoc. with entity eg host */
-#define	KEYFLAG_ZONEKEY		0x0100	/* key is zone key for the zone named */
-#define	KEYFLAG_IPSEC		0x0080  /* key is for IPSEC use (host or user)*/
-#define	KEYFLAG_EMAIL		0x0040  /* key is for email (MIME security) */
-#define	KEYFLAG_RESERVED10	0x0020  /* reserved - must be zero */
-#define	KEYFLAG_RESERVED11	0x0010  /* reserved - must be zero */
-#define	KEYFLAG_SIGNATORYMASK	0x000F	/* key can sign DNS RR's of same name */
-
-#define  KEYFLAG_RESERVED_BITMASK ( KEYFLAG_RESERVED3 | \
-				    KEYFLAG_RESERVED4 | \
-				    KEYFLAG_RESERVED10| KEYFLAG_RESERVED11)
+typedef	enum __ns_rcode {
+	ns_r_noerror = 0,	/* No error occurred. */
+	ns_r_formerr = 1,	/* Format error. */
+	ns_r_servfail = 2,	/* Server failure. */
+	ns_r_nxdomain = 3,	/* Name error. */
+	ns_r_notimpl = 4,	/* Unimplemented. */
+	ns_r_refused = 5,	/* Operation refused. */
+	/* these are for BIND_UPDATE */
+	ns_r_yxdomain = 6,	/* Name exists */
+	ns_r_yxrrset = 7,	/* RRset exists */
+	ns_r_nxrrset = 8,	/* RRset does not exist */
+	ns_r_notauth = 9,	/* Not authoritative for zone */
+	ns_r_notzone = 10,	/* Zone of record different from zone section */
+	ns_r_max = 11,
+	/* The following are TSIG extended errors */
+	ns_r_badsig = 16,
+	ns_r_badkey = 17,
+	ns_r_badtime = 18
+} ns_rcode;
 
-/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
-#define	ALGORITHM_MD5RSA	1	/* MD5 with RSA */
-#define	ALGORITHM_EXPIRE_ONLY	253	/* No alg, no security */
-#define	ALGORITHM_PRIVATE_OID	254	/* Key begins with OID indicating alg */
+/* BIND_UPDATE */
+typedef enum __ns_update_operation {
+	ns_uop_delete = 0,
+	ns_uop_add = 1,
+	ns_uop_max = 2
+} ns_update_operation;
 
-/* Signatures */
-					/* Size of a mod or exp in bits */
-#define	MIN_MD5RSA_KEY_PART_BITS	 512
-#define	MAX_MD5RSA_KEY_PART_BITS	2552
-					/* Total of binary mod and exp, bytes */
-#define	MAX_MD5RSA_KEY_BYTES		((MAX_MD5RSA_KEY_PART_BITS+7/8)*2+3)
-					/* Max length of text sig block */
-#define	MAX_KEY_BASE64			(((MAX_MD5RSA_KEY_BYTES+2)/3)*4)
+/*
+ * This structure is used for TSIG authenticated messages
+ */
+struct ns_tsig_key {
+        char name[NS_MAXDNAME], alg[NS_MAXDNAME];
+        unsigned char *data;
+        int len;
+};
+typedef struct ns_tsig_key ns_tsig_key;
 
 /*
- * Status return codes for T_UNSPEC conversion routines
+ * This structure is used for TSIG authenticated TCP messages
  */
-#define CONV_SUCCESS	0
-#define CONV_OVERFLOW	(-1)
-#define CONV_BADFMT	(-2)
-#define CONV_BADCKSUM	(-3)
-#define CONV_BADBUFLEN	(-4)
+struct ns_tcp_tsig_state {
+	int counter;
+	struct dst_key *key;
+	void *ctx;
+	unsigned char sig[NS_PACKETSZ];
+	int siglen;
+};
+typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
 
-/* glibc always has byte order info in <endian.h> */
-#include <endian.h>
+#define NS_TSIG_FUDGE 300
+#define NS_TSIG_TCP_COUNT 100
+#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
 
-__BEGIN_DECLS
+#define NS_TSIG_ERROR_NO_TSIG -10
+#define NS_TSIG_ERROR_NO_SPACE -11
+#define NS_TSIG_ERROR_FORMERR -12
 
 /*
- * Structure for query header.  The order of the fields is machine- and
- * compiler-dependent, depending on the byte/bit order and the layout
- * of bit fields.  We use bit fields only in int variables, as this
- * is all ANSI requires.  This requires a somewhat confusing rearrangement.
+ * Currently defined type values for resources and queries.
  */
+typedef enum __ns_type {
+	ns_t_invalid = 0,	/* Cookie. */
+	ns_t_a = 1,		/* Host address. */
+	ns_t_ns = 2,		/* Authoritative server. */
+	ns_t_md = 3,		/* Mail destination. */
+	ns_t_mf = 4,		/* Mail forwarder. */
+	ns_t_cname = 5,		/* Canonical name. */
+	ns_t_soa = 6,		/* Start of authority zone. */
+	ns_t_mb = 7,		/* Mailbox domain name. */
+	ns_t_mg = 8,		/* Mail group member. */
+	ns_t_mr = 9,		/* Mail rename name. */
+	ns_t_null = 10,		/* Null resource record. */
+	ns_t_wks = 11,		/* Well known service. */
+	ns_t_ptr = 12,		/* Domain name pointer. */
+	ns_t_hinfo = 13,	/* Host information. */
+	ns_t_minfo = 14,	/* Mailbox information. */
+	ns_t_mx = 15,		/* Mail routing information. */
+	ns_t_txt = 16,		/* Text strings. */
+	ns_t_rp = 17,		/* Responsible person. */
+	ns_t_afsdb = 18,	/* AFS cell database. */
+	ns_t_x25 = 19,		/* X_25 calling address. */
+	ns_t_isdn = 20,		/* ISDN calling address. */
+	ns_t_rt = 21,		/* Router. */
+	ns_t_nsap = 22,		/* NSAP address. */
+	ns_t_nsap_ptr = 23,	/* Reverse NSAP lookup (deprecated). */
+	ns_t_sig = 24,		/* Security signature. */
+	ns_t_key = 25,		/* Security key. */
+	ns_t_px = 26,		/* X.400 mail mapping. */
+	ns_t_gpos = 27,		/* Geographical position (withdrawn). */
+	ns_t_aaaa = 28,		/* Ip6 Address. */
+	ns_t_loc = 29,		/* Location Information. */
+	ns_t_nxt = 30,		/* Next domain (security). */
+	ns_t_eid = 31,		/* Endpoint identifier. */
+	ns_t_nimloc = 32,	/* Nimrod Locator. */
+	ns_t_srv = 33,		/* Server Selection. */
+	ns_t_atma = 34,		/* ATM Address */
+	ns_t_naptr = 35,	/* Naming Authority PoinTeR */
+	ns_t_kx = 36,		/* Key Exchange */
+	ns_t_cert = 37,		/* Certification record */
+	ns_t_a6 = 38,		/* IPv6 address (deprecates AAAA) */
+	ns_t_dname = 39,	/* Non-terminal DNAME (for IPv6) */
+	ns_t_sink = 40,		/* Kitchen sink (experimentatl) */
+	ns_t_opt = 41,		/* EDNS0 option (meta-RR) */
+	ns_t_tsig = 250,	/* Transaction signature. */
+	ns_t_ixfr = 251,	/* Incremental zone transfer. */
+	ns_t_axfr = 252,	/* Transfer zone of authority. */
+	ns_t_mailb = 253,	/* Transfer mailbox records. */
+	ns_t_maila = 254,	/* Transfer mail agent records. */
+	ns_t_any = 255,		/* Wildcard match. */
+	ns_t_zxfr = 256,	/* BIND-specific, nonstandard. */
+	ns_t_max = 65536
+} ns_type;
 
-typedef struct {
-	unsigned	id :16;		/* query identification number */
-#if BYTE_ORDER == BIG_ENDIAN
-			/* fields in third byte */
-	unsigned	qr: 1;		/* response flag */
-	unsigned	opcode: 4;	/* purpose of message */
-	unsigned	aa: 1;		/* authoritative answer */
-	unsigned	tc: 1;		/* truncated message */
-	unsigned	rd: 1;		/* recursion desired */
-			/* fields in fourth byte */
-	unsigned	ra: 1;		/* recursion available */
-	unsigned	unused :1;	/* unused bits (MBZ as of 4.9.3a3) */
-	unsigned	ad: 1;		/* authentic data from named */
-	unsigned	cd: 1;		/* checking disabled by resolver */
-	unsigned	rcode :4;	/* response code */
-#endif
-#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
-			/* fields in third byte */
-	unsigned	rd :1;		/* recursion desired */
-	unsigned	tc :1;		/* truncated message */
-	unsigned	aa :1;		/* authoritative answer */
-	unsigned	opcode :4;	/* purpose of message */
-	unsigned	qr :1;		/* response flag */
-			/* fields in fourth byte */
-	unsigned	rcode :4;	/* response code */
-	unsigned	cd: 1;		/* checking disabled by resolver */
-	unsigned	ad: 1;		/* authentic data from named */
-	unsigned	unused :1;	/* unused bits (MBZ as of 4.9.3a3) */
-	unsigned	ra :1;		/* recursion available */
-#endif
-			/* remaining bytes */
-	unsigned	qdcount :16;	/* number of question entries */
-	unsigned	ancount :16;	/* number of answer entries */
-	unsigned	nscount :16;	/* number of authority entries */
-	unsigned	arcount :16;	/* number of resource entries */
-} HEADER;
+/* Exclusively a QTYPE? (not also an RTYPE) */
+#define	ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
+		      (t) == ns_t_mailb || (t) == ns_t_maila)
+/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */
+#define	ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
+/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */
+#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
+#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
+#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
+		       (t) == ns_t_zxfr)
 
 /*
- * Defines for handling compressed domain names
+ * Values for class field
  */
-#define INDIR_MASK	0xc0
+typedef enum __ns_class {
+	ns_c_invalid = 0,	/* Cookie. */
+	ns_c_in = 1,		/* Internet. */
+	ns_c_2 = 2,		/* unallocated/unsupported. */
+	ns_c_chaos = 3,		/* MIT Chaos-net. */
+	ns_c_hs = 4,		/* MIT Hesiod. */
+	/* Query class values which do not appear in resource records */
+	ns_c_none = 254,	/* for prereq. sections in update requests */
+	ns_c_any = 255,		/* Wildcard match. */
+	ns_c_max = 65536
+} ns_class;
+
+/* DNSSEC constants. */
+
+typedef enum __ns_key_types {
+	ns_kt_rsa = 1,		/* key type RSA/MD5 */
+	ns_kt_dh  = 2,		/* Diffie Hellman */
+	ns_kt_dsa = 3,		/* Digital Signature Standard (MANDATORY) */
+	ns_kt_private = 254	/* Private key type starts with OID */
+} ns_key_types;
 
-extern	u_int16_t	_getshort __P((const u_char *));
-extern	u_int32_t	_getlong __P((const u_char *));
+typedef enum __ns_cert_types {
+	cert_t_pkix = 1,	/* PKIX (X.509v3) */
+	cert_t_spki = 2,	/* SPKI */
+	cert_t_pgp  = 3,	/* PGP */
+	cert_t_url  = 253,	/* URL private type */
+	cert_t_oid  = 254	/* OID private type */
+} ns_cert_types;
+
+/* Flags field of the KEY RR rdata. */
+#define	NS_KEY_TYPEMASK		0xC000	/* Mask for "type" bits */
+#define	NS_KEY_TYPE_AUTH_CONF	0x0000	/* Key usable for both */
+#define	NS_KEY_TYPE_CONF_ONLY	0x8000	/* Key usable for confidentiality */
+#define	NS_KEY_TYPE_AUTH_ONLY	0x4000	/* Key usable for authentication */
+#define	NS_KEY_TYPE_NO_KEY	0xC000	/* No key usable for either; no key */
+/* The type bits can also be interpreted independently, as single bits: */
+#define	NS_KEY_NO_AUTH		0x8000	/* Key unusable for authentication */
+#define	NS_KEY_NO_CONF		0x4000	/* Key unusable for confidentiality */
+#define	NS_KEY_RESERVED2	0x2000	/* Security is *mandatory* if bit=0 */
+#define	NS_KEY_EXTENDED_FLAGS	0x1000	/* reserved - must be zero */
+#define	NS_KEY_RESERVED4	0x0800  /* reserved - must be zero */
+#define	NS_KEY_RESERVED5	0x0400  /* reserved - must be zero */
+#define	NS_KEY_NAME_TYPE	0x0300	/* these bits determine the type */
+#define	NS_KEY_NAME_USER	0x0000	/* key is assoc. with user */
+#define	NS_KEY_NAME_ENTITY	0x0200	/* key is assoc. with entity eg host */
+#define	NS_KEY_NAME_ZONE	0x0100	/* key is zone key */
+#define	NS_KEY_NAME_RESERVED	0x0300	/* reserved meaning */
+#define	NS_KEY_RESERVED8	0x0080  /* reserved - must be zero */
+#define	NS_KEY_RESERVED9	0x0040  /* reserved - must be zero */
+#define	NS_KEY_RESERVED10	0x0020  /* reserved - must be zero */
+#define	NS_KEY_RESERVED11	0x0010  /* reserved - must be zero */
+#define	NS_KEY_SIGNATORYMASK	0x000F	/* key can sign RR's of same name */
+#define	NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
+				  NS_KEY_RESERVED4 | \
+				  NS_KEY_RESERVED5 | \
+				  NS_KEY_RESERVED8 | \
+				  NS_KEY_RESERVED9 | \
+				  NS_KEY_RESERVED10 | \
+				  NS_KEY_RESERVED11 )
+#define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */
+
+/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
+#define	NS_ALG_MD5RSA		1	/* MD5 with RSA */
+#define	NS_ALG_DH               2	/* Diffie Hellman KEY */
+#define	NS_ALG_DSA              3	/* DSA KEY */
+#define	NS_ALG_DSS              NS_ALG_DSA
+#define	NS_ALG_EXPIRE_ONLY	253	/* No alg, no security */
+#define	NS_ALG_PRIVATE_OID	254	/* Key begins with OID giving alg */
+
+/* Protocol values  */
+/* value 0 is reserved */
+#define NS_KEY_PROT_TLS         1
+#define NS_KEY_PROT_EMAIL       2
+#define NS_KEY_PROT_DNSSEC      3
+#define NS_KEY_PROT_IPSEC       4
+#define NS_KEY_PROT_ANY		255
+
+/* Signatures */
+#define	NS_MD5RSA_MIN_BITS	 512	/* Size of a mod or exp in bits */
+#define	NS_MD5RSA_MAX_BITS	2552
+	/* Total of binary mod and exp */
+#define	NS_MD5RSA_MAX_BYTES	((NS_MD5RSA_MAX_BITS+7/8)*2+3)
+	/* Max length of text sig block */
+#define	NS_MD5RSA_MAX_BASE64	(((NS_MD5RSA_MAX_BYTES+2)/3)*4)
+#define NS_MD5RSA_MIN_SIZE	((NS_MD5RSA_MIN_BITS+7)/8)
+#define NS_MD5RSA_MAX_SIZE	((NS_MD5RSA_MAX_BITS+7)/8)
+
+#define NS_DSA_SIG_SIZE         41
+#define NS_DSA_MIN_SIZE         213
+#define NS_DSA_MAX_BYTES        405
+
+/* Offsets into SIG record rdata to find various values */
+#define	NS_SIG_TYPE	0	/* Type flags */
+#define	NS_SIG_ALG	2	/* Algorithm */
+#define	NS_SIG_LABELS	3	/* How many labels in name */
+#define	NS_SIG_OTTL	4	/* Original TTL */
+#define	NS_SIG_EXPIR	8	/* Expiration time */
+#define	NS_SIG_SIGNED	12	/* Signature time */
+#define	NS_SIG_FOOT	16	/* Key footprint */
+#define	NS_SIG_SIGNER	18	/* Domain name of who signed it */
+
+/* How RR types are represented as bit-flags in NXT records */
+#define	NS_NXT_BITS 8
+#define	NS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_MAX 127
 
 /*
  * Inline versions of get/put short/long.  Pointer is advanced.
- *
- * These macros demonstrate the property of C whereby it can be
- * portable or it can be elegant but rarely both.
  */
-#define GETSHORT(s, cp) { \
+#define NS_GET16(s, cp) do { \
 	register u_char *t_cp = (u_char *)(cp); \
 	(s) = ((u_int16_t)t_cp[0] << 8) \
 	    | ((u_int16_t)t_cp[1]) \
 	    ; \
-	(cp) += INT16SZ; \
-}
+	(cp) += NS_INT16SZ; \
+} while (0)
 
-#define GETLONG(l, cp) { \
+#define NS_GET32(l, cp) do { \
 	register u_char *t_cp = (u_char *)(cp); \
 	(l) = ((u_int32_t)t_cp[0] << 24) \
 	    | ((u_int32_t)t_cp[1] << 16) \
 	    | ((u_int32_t)t_cp[2] << 8) \
 	    | ((u_int32_t)t_cp[3]) \
 	    ; \
-	(cp) += INT32SZ; \
-}
+	(cp) += NS_INT32SZ; \
+} while (0)
 
-#define PUTSHORT(s, cp) { \
+#define NS_PUT16(s, cp) do { \
 	register u_int16_t t_s = (u_int16_t)(s); \
 	register u_char *t_cp = (u_char *)(cp); \
 	*t_cp++ = t_s >> 8; \
 	*t_cp   = t_s; \
-	(cp) += INT16SZ; \
-}
+	(cp) += NS_INT16SZ; \
+} while (0)
 
-#define PUTLONG(l, cp) { \
+#define NS_PUT32(l, cp) do { \
 	register u_int32_t t_l = (u_int32_t)(l); \
 	register u_char *t_cp = (u_char *)(cp); \
 	*t_cp++ = t_l >> 24; \
 	*t_cp++ = t_l >> 16; \
 	*t_cp++ = t_l >> 8; \
 	*t_cp   = t_l; \
-	(cp) += INT32SZ; \
-}
+	(cp) += NS_INT32SZ; \
+} while (0)
 
+/*
+ * ANSI C identifier hiding for bind's lib/nameser.
+ */
+#define ns_get16		__ns_get16
+#define ns_get32		__ns_get32
+#define ns_put16		__ns_put16
+#define ns_put32		__ns_put32
+#define ns_initparse		__ns_initparse
+#define ns_skiprr		__ns_skiprr
+#define ns_parserr		__ns_parserr
+#define	ns_sprintrr		__ns_sprintrr
+#define	ns_sprintrrf		__ns_sprintrrf
+#define	ns_format_ttl		__ns_format_ttl
+#define	ns_parse_ttl		__ns_parse_ttl
+#define ns_datetosecs		__ns_datetosecs
+#define	ns_name_ntol		__ns_name_ntol
+#define	ns_name_ntop		__ns_name_ntop
+#define	ns_name_pton		__ns_name_pton
+#define	ns_name_unpack		__ns_name_unpack
+#define	ns_name_pack		__ns_name_pack
+#define	ns_name_compress	__ns_name_compress
+#define	ns_name_uncompress	__ns_name_uncompress
+#define	ns_name_skip		__ns_name_skip
+#define	ns_name_rollback	__ns_name_rollback
+#define	ns_sign			__ns_sign
+#define	ns_sign_tcp		__ns_sign_tcp
+#define	ns_sign_tcp_init	__ns_sign_tcp_init
+#define ns_find_tsig		__ns_find_tsig
+#define	ns_verify		__ns_verify
+#define	ns_verify_tcp		__ns_verify_tcp
+#define	ns_verify_tcp_init	__ns_verify_tcp_init
+#define	ns_samedomain		__ns_samedomain
+#define	ns_subdomain		__ns_subdomain
+#define	ns_makecanon		__ns_makecanon
+#define	ns_samename		__ns_samename
+
+__BEGIN_DECLS
+u_int		ns_get16 __P((const u_char *));
+u_long		ns_get32 __P((const u_char *));
+void		ns_put16 __P((u_int, u_char *));
+void		ns_put32 __P((u_long, u_char *));
+int		ns_initparse __P((const u_char *, int, ns_msg *));
+int		ns_skiprr __P((const u_char *, const u_char *, ns_sect, int));
+int		ns_parserr __P((ns_msg *, ns_sect, int, ns_rr *));
+int		ns_sprintrr __P((const ns_msg *, const ns_rr *,
+				 const char *, const char *, char *, size_t));
+int		ns_sprintrrf __P((const u_char *, size_t, const char *,
+				  ns_class, ns_type, u_long, const u_char *,
+				  size_t, const char *, const char *,
+				  char *, size_t));
+int		ns_format_ttl __P((u_long, char *, size_t));
+int		ns_parse_ttl __P((const char *, u_long *));
+u_int32_t	ns_datetosecs __P((const char *cp, int *errp));
+int		ns_name_ntol __P((const u_char *, u_char *, size_t));
+int		ns_name_ntop __P((const u_char *, char *, size_t));
+int		ns_name_pton __P((const char *, u_char *, size_t));
+int		ns_name_unpack __P((const u_char *, const u_char *,
+				    const u_char *, u_char *, size_t));
+int		ns_name_pack __P((const u_char *, u_char *, int,
+				  const u_char **, const u_char **));
+int		ns_name_uncompress __P((const u_char *, const u_char *,
+					const u_char *, char *, size_t));
+int		ns_name_compress __P((const char *, u_char *, size_t,
+				      const u_char **, const u_char **));
+int		ns_name_skip __P((const u_char **, const u_char *));
+void		ns_name_rollback __P((const u_char *, const u_char **,
+				      const u_char **));
+int		ns_sign __P((u_char *, int *, int, int, void *,
+			     const u_char *, int, u_char *, int *, time_t));
+int		ns_sign_tcp __P((u_char *, int *, int, int,
+				 ns_tcp_tsig_state *, int));
+int		ns_sign_tcp_init __P((void *, const u_char *, int,
+					ns_tcp_tsig_state *));
+u_char		*ns_find_tsig __P((u_char *, u_char *));
+int		ns_verify __P((u_char *, int *, void *,
+			       const u_char *, int, u_char *, int *,
+			       time_t *, int));
+int		ns_verify_tcp __P((u_char *, int *, ns_tcp_tsig_state *, int));
+int		ns_verify_tcp_init __P((void *, const u_char *, int,
+					ns_tcp_tsig_state *));
+int		ns_samedomain __P((const char *, const char *));
+int		ns_subdomain __P((const char *, const char *));
+int		ns_makecanon __P((const char *, char *, size_t));
+int		ns_samename __P((const char *, const char *));
 __END_DECLS
 
-#endif /* arpa/nameser.h */
+#ifdef BIND_4_COMPAT
+#include <arpa/nameser_compat.h>
+#endif
+
+#endif /* !_ARPA_NAMESER_H_ */

+ 0 - 4
include/arpa/telnet.h

@@ -10,10 +10,6 @@
  * 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.

+ 0 - 4
include/arpa/tftp.h

@@ -10,10 +10,6 @@
  * 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.

+ 22 - 0
include/assert.h

@@ -1,3 +1,25 @@
+/* Copyright (C) 1991,1992,1994-1999,2000,2001 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ *	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
+ */
+
 #ifndef	__ASSERT_H
 #define	__ASSERT_H
 #include <features.h>

+ 0 - 11
include/cfgfile.h

@@ -1,11 +0,0 @@
-#ifndef __CFGFILE_H__
-#define __CFGFILE_H__
-
-#include <stdio.h>
-
-__BEGIN_DECLS
-char ** cfgread(FILE *fp);
-char ** cfgfind(FILE *fp, char *var);
-__END_DECLS
-
-#endif /* __CFGFILE_H__ */

+ 8 - 9
include/cpio.h

@@ -1,24 +1,23 @@
 /* Extended cpio format from POSIX.1.
    This file is part of the GNU C Library.
    Copyright (C) 1992, 1998 Free Software Foundation, Inc.
-
    NOTE: The canonical source of this file is maintained with the GNU cpio.
    Bugs can be reported to bug-glibc@gnu.org.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _CPIO_H
 #define _CPIO_H 1

+ 10 - 14
include/crypt.h

@@ -1,24 +1,20 @@
 /*
- * UFC-crypt: ultra fast crypt(3) implementation
+ * crypt(3) implementation for uClibc
  *
- * Copyright (C) 1991, 92, 93, 96, 97, 98, 2000 Free Software Foundation, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * The uClibc Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * 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.
+ * Lesser General Public License for more details.
  *
- * @(#)crypt.h	1.5 12/20/96
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the GNU C Library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
  *
  */
 

+ 23 - 2
include/ctype.h

@@ -1,5 +1,26 @@
-/* ctype.h
- * Character classification and conversion */
+/* vi: set sw=4 ts=4: */
+/*
+ * ctype.h
+ * Character classification and conversion
+ *
+ * Copyright (C) 2000 by Lineo, inc.  
+ * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
 
 #ifndef __CTYPE_H
 #define __CTYPE_H

+ 71 - 63
include/dirent.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,2000 Free Software Foundation, Inc.
+/* 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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>
@@ -30,17 +30,17 @@ __BEGIN_DECLS
 #include <bits/types.h>
 
 #ifdef __USE_XOPEN
-# ifndef ino_t
+# ifndef __ino_t_defined
 #  ifndef __USE_FILE_OFFSET64
 typedef __ino_t ino_t;
 #  else
 typedef __ino64_t ino_t;
 #  endif
-#  define ino_t ino_t
+#  define __ino_t_defined
 # endif
-# if defined __USE_LARGEFILE64 && !defined ino64_t
+# if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
 typedef __ino64_t ino64_t;
-#  define ino64_t ino64_t
+#  define __ino64_t_defined
 # endif
 #endif
 
@@ -111,8 +111,10 @@ enum
 # define DT_REG		DT_REG
     DT_LNK = 10,
 # define DT_LNK		DT_LNK
-    DT_SOCK = 12
+    DT_SOCK = 12,
 # define DT_SOCK	DT_SOCK
+    DT_WHT = 14
+# define DT_WHT		DT_WHT
   };
 
 /* Convert between stat structure types and directory types.  */
@@ -127,11 +129,11 @@ 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));
+extern DIR *opendir (__const char *__name) __THROW;
 
 /* Close the directory stream DIRP.
    Return 0 if successful, -1 if not.  */
-extern int closedir __P ((DIR *__dirp));
+extern int closedir (DIR *__dirp) __THROW;
 
 /* Read a directory entry from DIRP.  Return a pointer to a `struct
    dirent' describing the entry, or NULL for EOF or error.  The
@@ -141,61 +143,62 @@ extern int closedir __P ((DIR *__dirp));
    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));
+extern struct dirent *readdir (DIR *__dirp) __THROW;
 #else
 # ifdef __REDIRECT
-extern struct dirent *__REDIRECT (readdir, __P ((DIR *__dirp)), readdir64);
+extern struct dirent *__REDIRECT (readdir, (DIR *__dirp) __THROW, readdir64);
 # else
 #  define readdir readdir64
 # endif
 #endif
 
 #ifdef __USE_LARGEFILE64
-extern struct dirent64 *readdir64 __P ((DIR *__dirp));
+extern struct dirent64 *readdir64 (DIR *__dirp) __THROW;
 #endif
 
 #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));
+extern int readdir_r (DIR *__restrict __dirp,
+		      struct dirent *__restrict __entry,
+		      struct dirent **__restrict __result) __THROW;
 # else
 #  ifdef __REDIRECT
-extern int __REDIRECT (readdir_r, __P ((DIR *__restrict __dirp,
-					struct dirent *__restrict __entry,
-					struct dirent **__restrict __result)),
-		    readdir64_r);
+extern int __REDIRECT (readdir_r,
+		       (DIR *__restrict __dirp,
+			struct dirent *__restrict __entry,
+			struct dirent **__restrict __result) __THROW,
+		       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));
+extern int readdir64_r (DIR *__restrict __dirp,
+			struct dirent64 *__restrict __entry,
+			struct dirent64 **__restrict __result) __THROW;
 # endif
 #endif	/* POSIX or misc */
 
 /* Rewind DIRP to the beginning of the directory.  */
-extern void rewinddir __P ((DIR *__dirp));
+extern void rewinddir (DIR *__dirp) __THROW;
 
 #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, long int __pos));
+extern void seekdir (DIR *__dirp, long int __pos) __THROW;
 
 /* Return the current position of DIRP.  */
-extern long int telldir __P ((DIR *__dirp));
+extern long int telldir (DIR *__dirp) __THROW;
 #endif
 
 #if defined __USE_BSD || defined __USE_MISC
 
 /* Return the file descriptor used by DIRP.  */
-extern int dirfd __P ((DIR *__dirp));
+extern int dirfd (DIR *__dirp) __THROW;
 
 # if defined __OPTIMIZE__ && defined _DIR_dirfd
 #  define dirfd(dirp)	_DIR_dirfd (dirp)
@@ -221,17 +224,17 @@ extern int dirfd __P ((DIR *__dirp));
    sorted using qsort with CMP, and collected in a malloc'd array in
    *NAMELIST.  Returns the number of entries selected, or -1 on error.  */
 # 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)));
+extern int scandir (__const char *__restrict __dir,
+		    struct dirent ***__restrict __namelist,
+		    int (*__selector) (__const struct dirent *),
+		    int (*__cmp) (__const void *, __const void *)) __THROW;
 # 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))),
+		       (__const char *__restrict __dir,
+			struct dirent ***__restrict __namelist,
+			int (*__selector) (__const struct dirent *),
+			int (*__cmp) (__const void *, __const void *)) __THROW,
 		       scandir64);
 #  else
 #   define scandir scandir64
@@ -241,45 +244,51 @@ extern int __REDIRECT (scandir,
 # 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)));
+extern int scandir64 (__const char *__restrict __dir,
+		      struct dirent64 ***__restrict __namelist,
+		      int (*__selector) (__const struct dirent64 *),
+		      int (*__cmp) (__const void *, __const void *)) __THROW;
 # endif
 
 /* Function to compare two `struct dirent's alphabetically.  */
 # ifndef __USE_FILE_OFFSET64
-extern int alphasort __P ((__const __ptr_t __e1, __const __ptr_t __e2));
+extern int alphasort (__const void *__e1, __const void *__e2)
+     __THROW __attribute_pure__;
 # else
 #  ifdef __REDIRECT
 extern int __REDIRECT (alphasort,
-		       __P ((__const __ptr_t __e1, __const __ptr_t __e2)),
-		       alphasort64);
+		       (__const void *__e1, __const void *__e2)
+		       __THROW,
+		       alphasort64) __attribute_pure__;
 #  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));
+extern int alphasort64 (__const void *__e1, __const void *__e2)
+     __THROW __attribute_pure__;
 # 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));
+extern int versionsort (__const void *__e1, __const void *__e2)
+     __THROW __attribute_pure__;
 #  else
 #   ifdef __REDIRECT
 extern int __REDIRECT (versionsort,
-		       __P ((__const __ptr_t __e1, __const __ptr_t __e2)),
-		       versionsort64);
+		       (__const void *__e1, __const void *__e2)
+		       __THROW,
+		       versionsort64) __attribute_pure__;
 #   else
 #    define versionsort versionsort64
 #   endif
 #  endif
 
 #  ifdef __USE_LARGEFILE64
-extern int versionsort64 __P ((__const __ptr_t __e1, __const __ptr_t __e2));
+extern int versionsort64 (__const void *__e1, __const void *__e2)
+     __THROW __attribute_pure__;
 #  endif
 # endif
 
@@ -287,17 +296,16 @@ extern int versionsort64 __P ((__const __ptr_t __e1, __const __ptr_t __e2));
    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.  */
-
 # ifndef __USE_FILE_OFFSET64
-extern __ssize_t getdirentries __P ((int __fd, char *__restrict __buf,
-				     size_t __nbytes,
-				     __off_t *__restrict __basep));
+extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
+				size_t __nbytes,
+				__off_t *__restrict __basep) __THROW;
 # else
 #  ifdef __REDIRECT
 extern __ssize_t __REDIRECT (getdirentries,
-			     __P ((int __fd, char *__restrict __buf,
-				   size_t __nbytes,
-				   __off64_t *__restrict __basep)),
+			     (int __fd, char *__restrict __buf,
+			      size_t __nbytes,
+			      __off64_t *__restrict __basep) __THROW,
 			     getdirentries64);
 #  else
 #   define getdirentries getdirentries64
@@ -305,9 +313,9 @@ extern __ssize_t __REDIRECT (getdirentries,
 # endif
 
 # ifdef __USE_LARGEFILE64
-extern __ssize_t getdirentries64 __P ((int __fd, char *__restrict __buf,
-				       size_t __nbytes,
-				       __off64_t *__restrict __basep));
+extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf,
+				  size_t __nbytes,
+				  __off64_t *__restrict __basep) __THROW;
 # endif
 
 #endif /* Use BSD or misc.  */

+ 31 - 42
include/dlfcn.h

@@ -3,19 +3,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_DLFCN_H
 #define	_DLFCN_H 1
@@ -25,72 +25,61 @@
 /* Collect various system dependent definitions and declarations.  */
 #include <bits/dlfcn.h>
 
+#ifdef __USE_GNU
 /* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT
    the run-time address of the symbol called NAME in the next shared
    object is returned.  The "next" relation is defined by the order
    the shared objects were loaded.  */
-#define RTLD_NEXT	((void *) -1l)
+# define RTLD_NEXT	((void *) -1l)
 
 /* If the first argument to `dlsym' or `dlvsym' is set to RTLD_DEFAULT
    the run-time address of the symbol called NAME in the global scope
    is returned.  */
-#define RTLD_DEFAULT	((void *) 0)
+# define RTLD_DEFAULT	((void *) 0)
+#endif
 
 __BEGIN_DECLS
 
 /* Open the shared object FILE and map it in; return a handle that can be
    passed to `dlsym' to get symbol values from it.  */
-extern void *dlopen __P ((__const char *__file, int __mode));
+extern void *dlopen (__const char *__file, int __mode) __THROW;
 
 /* Unmap and close a shared object opened by `dlopen'.
    The handle cannot be used again after calling `dlclose'.  */
-extern int dlclose __P ((void *__handle));
+extern int dlclose (void *__handle) __THROW;
 
 /* Find the run-time address in the shared object HANDLE refers to
    of the symbol called NAME.  */
-extern void *dlsym __P ((void *__restrict __handle,
-			 __const char *__restrict __name));
+extern void *dlsym (void *__restrict __handle,
+		    __const char *__restrict __name) __THROW;
 
 #ifdef __USE_GNU
 /* Find the run-time address in the shared object HANDLE refers to
    of the symbol called NAME with VERSION.  */
-extern void *dlvsym __P ((void *__restrict __handle,
-			  __const char *__restrict __name,
-			  __const char *__restrict __version));
+extern void *dlvsym (void *__restrict __handle,
+		     __const char *__restrict __name,
+		     __const char *__restrict __version) __THROW;
 #endif
 
 /* When any of the above functions fails, call this function
    to return a string describing the error.  Each call resets
    the error string so that a following call returns null.  */
-extern char *dlerror __P ((void));
+extern char *dlerror (void) __THROW;
 
 #ifdef __USE_GNU
+/* Structure containing information about object searched using
+   `dladdr'.  */
+typedef struct
+{
+  __const char *dli_fname;	/* File name of defining object.  */
+  void *dli_fbase;		/* Load address of that object.  */
+  __const char *dli_sname;	/* Name of nearest symbol.  */
+  void *dli_saddr;		/* Exact value of nearest symbol.  */
+} Dl_info;
+
 /* Fill in *INFO with the following information about ADDRESS.
    Returns 0 iff no shared object's segments contain that address.  */
-typedef struct
-  {
-    __const char *dli_fname;	/* File name of defining object.  */
-    void *dli_fbase;		/* Load address of that object.  */
-    __const char *dli_sname;	/* Name of nearest symbol.  */
-    void *dli_saddr;		/* Exact value of nearest symbol.  */
-  } Dl_info;
-extern int dladdr __P ((const void *__address, Dl_info *__info));
-
-/* To support profiling of shared objects it is a good idea to call
-   the function found using `dlsym' using the following macro since
-   these calls do not use the PLT.  But this would mean the dynamic
-   loader has no chance to find out when the function is called.  The
-   macro applies the necessary magic so that profiling is possible.
-   Rewrite
-	foo = (*fctp) (arg1, arg2);
-   into
-        foo = DL_CALL_FCT (fctp, (arg1, arg2));
-*/
-# define DL_CALL_FCT(fctp, args) \
-  (_dl_mcount_wrapper_check (fctp), (*(fctp)) args)
-
-/* This function calls the profiling functions.  */
-extern void _dl_mcount_wrapper_check __P ((void *__selfpc));
+extern int dladdr (const void *__address, Dl_info *__info) __THROW;
 #endif
 
 __END_DECLS

+ 29 - 13
include/elf.h

@@ -3,19 +3,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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
@@ -235,7 +235,10 @@ typedef struct
 #define EM_MN10300	89		/* Matsushita MN10300 */
 #define EM_MN10200	90		/* Matsushita MN10200 */
 #define EM_PJ		91		/* picoJava */
-#define EM_NUM		92
+#define EM_OPENRISC	92		/* OpenRISC 32-bit embedded processor */
+#define EM_ARC_A5	93		/* ARC Cores Tangent-A5 */
+#define EM_XTENSA	94		/* Tensilica Xtensa Architecture */
+#define EM_NUM		95
 
 /* If it is necessary to assign new unofficial EM_* values, please
    pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
@@ -663,7 +666,12 @@ typedef struct
    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_CONFIG	0x6ffffefa	/* Configuration information.  */
+#define DT_DEPAUDIT	0x6ffffefb	/* Dependency auditing.  */
+#define DT_AUDIT	0x6ffffefc	/* Object auditing.  */
+#define	DT_PLTPAD	0x6ffffefd	/* PLT padding.  */
+#define	DT_MOVETAB	0x6ffffefe	/* Move table.  */
+#define DT_SYMINFO	0x6ffffeff	/* Syminfo table.  */
 #define DT_ADDRRNGHI	0x6ffffeff
 
 /* The versioning entry types.  The next are defined as part of the
@@ -711,9 +719,11 @@ typedef struct
 #define DF_1_TRANS	0x00000200
 #define DF_1_INTERPOSE	0x00000400	/* Object is used to interpose.  */
 #define DF_1_NODEFLIB	0x00000800	/* Ignore default lib search path.  */
-#define DF_1_NODUMP	0x00001000
-#define DF_1_CONFALT	0x00002000
-#define DF_1_ENDFILTEE	0x00004000
+#define DF_1_NODUMP	0x00001000	/* Object can't be dldump'ed.  */
+#define DF_1_CONFALT	0x00002000	/* Configuration alternative created.*/
+#define DF_1_ENDFILTEE	0x00004000	/* Filtee terminates filters search. */
+#define	DF_1_DISPRELDNE	0x00008000	/* Disp reloc applied at build time. */
+#define	DF_1_DISPRELPND	0x00010000	/* Disp reloc applied at run-time.  */
 
 /* Flags for the feature selection in DT_FEATURE_1.  */
 #define DTF_1_PARINIT	0x00000001
@@ -760,6 +770,12 @@ typedef struct
 #define VER_FLG_BASE	0x1		/* Version definition of file itself */
 #define VER_FLG_WEAK	0x2		/* Weak version identifier */
 
+/* Versym symbol index values.  */
+#define	VER_NDX_LOCAL		0	/* Symbol is local.  */
+#define	VER_NDX_GLOBAL		1	/* Symbol is global.  */
+#define	VER_NDX_LORESERVE	0xff00	/* Beginning of reserved entries.  */
+#define	VER_NDX_ELIMINATE	0xff01	/* Symbol is to be eliminated.  */
+
 /* Auxialiary version information.  */
 
 typedef struct

+ 22 - 14
include/endian.h

@@ -1,31 +1,33 @@
-/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1997, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_ENDIAN_H
 #define	_ENDIAN_H	1
 
 #include <features.h>
 
-/* Definitions for byte order, according to significance of bytes, from low
-   addresses to high addresses.  The value is what you get by putting '4'
-   in the most significant byte, '3' in the second most significant byte,
-   '2' in the second least significant byte, and '1' in the least
-   significant byte.  */
+/* Definitions for byte order, according to significance of bytes,
+   from low addresses to high addresses.  The value is what you get by
+   putting '4' in the most significant byte, '3' in the second most
+   significant byte, '2' in the second least significant byte, and '1'
+   in the least significant byte, and then writing down one digit for
+   each byte, starting with the byte at the lowest address at the left,
+   and proceeding to the byte with the highest address at the right.  */
 
 #define	__LITTLE_ENDIAN	1234
 #define	__BIG_ENDIAN	4321
@@ -47,4 +49,10 @@
 # define BYTE_ORDER	__BYTE_ORDER
 #endif
 
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define __LONG_LONG_PAIR(HI, LO) LO, HI
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# define __LONG_LONG_PAIR(HI, LO) HI, LO
+#endif
+
 #endif	/* endian.h */

+ 56 - 5
include/err.h

@@ -1,7 +1,58 @@
-#ifndef __ERR_H__
-#define __ERR_H__
+/* 4.4BSD utility functions for error messages.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-#define warn(X,args...) ({char _buf[128]; sprintf(_buf, X,args); perror(_buf);})
-#define err(X,Y,args...) ({char _buf[128]; sprintf(_buf, Y,##args); perror(_buf); exit(X);})
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
-#endif /* __ERR_H__ */
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_ERR_H
+#define	_ERR_H	1
+
+#include <features.h>
+
+#define	__need___va_list
+#include <stdarg.h>
+#ifndef	__GNUC_VA_LIST
+# define __gnuc_va_list	__ptr_t
+#endif
+
+__BEGIN_DECLS
+
+/* Print "program: ", FORMAT, ": ", the standard error string for errno,
+   and a newline, on stderr.  */
+extern void warn (__const char *__format, ...)
+     __THROW __attribute__ ((__format__ (__printf__, 1, 2)));
+extern void vwarn (__const char *__format, __gnuc_va_list)
+     __THROW __attribute__ ((__format__ (__printf__, 1, 0)));
+
+/* Likewise, but without ": " and the standard error string.  */
+extern void warnx (__const char *__format, ...)
+     __THROW __attribute__ ((__format__ (__printf__, 1, 2)));
+extern void vwarnx (__const char *__format, __gnuc_va_list)
+     __THROW __attribute__ ((__format__ (__printf__, 1, 0)));
+
+/* Likewise, and then exit with STATUS.  */
+extern void err (int __status, __const char *__format, ...)
+     __THROW __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
+extern void verr (int __status, __const char *__format, __gnuc_va_list)
+     __THROW __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
+extern void errx (int __status, __const char *__format, ...)
+     __THROW __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
+extern void verrx (int __status, __const char *, __gnuc_va_list)
+     __THROW __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
+
+__END_DECLS
+
+#endif	/* err.h */

+ 60 - 10
include/errno.h

@@ -1,23 +1,73 @@
-#ifndef _ERRNO_H
-#define _ERRNO_H
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ *	ISO C99 Standard: 7.5 Errors	<errno.h>
+ */
+
+#ifndef	_ERRNO_H
+
+/* The includer defined __need_Emath if he wants only the definitions
+   of EDOM and ERANGE, and not everything else.  */
+#ifndef	__need_Emath
+#define	_ERRNO_H	1
 #include <features.h>
-#include <bits/errno.h>
+#endif
 
 __BEGIN_DECLS
 
-extern int sys_nerr;
-extern const char *const sys_errlist[];
+/* Get the error number constants from the system-specific file.
+   This file will test __need_Emath and _ERRNO_H.  */
+#include <bits/errno.h>
+#undef	__need_Emath
 
-#define _sys_nerr sys_nerr
-#define _sys_errlist sys_errlist
+#ifdef	_ERRNO_H
 
+/* Declare the `errno' variable, unless it's defined as a macro by
+   bits/errno.h.  This is the case in GNU, where it is a per-thread
+   variable.  This redeclaration using the macro still works, but it
+   will be a function declaration without a prototype and may trigger
+   a -Wstrict-prototypes warning.  */
 #ifndef	errno
-extern int	errno;
+extern int errno;
 #endif
-extern void	perror __P ((__const char* __s));
-extern char*	strerror __P ((int __errno));
+
+#ifdef __USE_GNU
+
+/* The full and simple forms of the name with which the program was
+   invoked.  These variables are set up automatically at startup based on
+   the value of ARGV[0] (this works only if you use GNU ld).  */
+extern char *program_invocation_name, *program_invocation_short_name;
+#endif /* __USE_GNU */
+#endif /* _ERRNO_H */
 
 __END_DECLS
 
+#endif /* _ERRNO_H */
+
+/* The Hurd <bits/errno.h> defines `error_t' as an enumerated type so
+   that printing `error_t' values in the debugger shows the names.  We
+   might need this definition sometimes even if this file was included
+   before.  */
+#if defined __USE_GNU || defined __need_error_t
+# ifndef __error_t_defined
+typedef int error_t;
+#  define __error_t_defined	1
+# endif
+# undef __need_error_t
 #endif

+ 58 - 21
include/fcntl.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
  *	POSIX Standard: 6.5 File Control Operations	<fcntl.h>
@@ -57,42 +57,40 @@ __BEGIN_DECLS
 
 /* Do the file control operation described by CMD on FD.
    The remaining arguments are interpreted depending on CMD.  */
-extern int __fcntl __P ((int __fd, int __cmd, ...));
-extern int fcntl __P ((int __fd, int __cmd, ...));
+extern int fcntl (int __fd, int __cmd, ...) __THROW;
 
 /* Open FILE and return a new file descriptor for it, or -1 on error.
    OFLAG determines the type of access used.  If O_CREAT is on OFLAG,
    the third argument is taken as a `mode_t', the mode of the created file.  */
-extern int __open __P ((__const char *__file, int __oflag, mode_t mode));
 #ifndef __USE_FILE_OFFSET64
-extern int open __P ((__const char *__file, int __oflag, ...));
+extern int open (__const char *__file, int __oflag, ...) __THROW;
 #else
 # ifdef __REDIRECT
-extern int __REDIRECT (open, __P ((__const char *__file, int __oflag, ...)),
+extern int __REDIRECT (open, (__const char *__file, int __oflag, ...) __THROW,
 		       open64);
 # else
 #  define open open64
 # endif
 #endif
 #ifdef __USE_LARGEFILE64
-extern int open64 __P ((__const char *__file, int __oflag, ...));
+extern int open64 (__const char *__file, int __oflag, ...) __THROW;
 #endif
 
 /* Create and open FILE, with mode MODE.
    This takes an `int' MODE argument because that is
    what `mode_t' will be widened to.  */
 #ifndef __USE_FILE_OFFSET64
-extern int creat __P ((__const char *__file, __mode_t __mode));
+extern int creat (__const char *__file, __mode_t __mode) __THROW;
 #else
 # ifdef __REDIRECT
-extern int __REDIRECT (creat, __P ((__const char *__file, __mode_t __mode)),
+extern int __REDIRECT (creat, (__const char *__file, __mode_t __mode) __THROW,
 		       creat64);
 # else
 #  define creat creat64
 # endif
 #endif
 #ifdef __USE_LARGEFILE64
-extern int creat64 __P ((__const char *__file, __mode_t __mode));
+extern int creat64 (__const char *__file, __mode_t __mode) __THROW;
 #endif
 
 #if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
@@ -111,17 +109,56 @@ extern int creat64 __P ((__const char *__file, __mode_t __mode));
 # define F_TEST  3	/* Test a region for other processes locks.  */
 
 # ifndef __USE_FILE_OFFSET64
-extern int lockf __P ((int __fd, int __cmd, __off_t __len));
+extern int lockf (int __fd, int __cmd, __off_t __len) __THROW;
 # else
 # ifdef __REDIRECT
-extern int __REDIRECT (lockf, __P ((int __fd, int __cmd, __off64_t __len)),
+extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len) __THROW,
 		       lockf64);
 # else
 #  define lockf lockf64
 # endif
 # endif
 # ifdef __USE_LARGEFILE64
-extern int lockf64 __P ((int __fd, int __cmd, __off64_t __len));
+extern int lockf64 (int __fd, int __cmd, __off64_t __len) __THROW;
+# endif
+#endif
+
+#ifdef __USE_XOPEN2K
+/* Advice the system about the expected behaviour of the application with
+   respect to the file associated with FD.  */
+# ifndef __USE_FILE_OFFSET64
+extern int posix_fadvise (int __fd, __off_t __offset, size_t __len,
+			  int __advise) __THROW;
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (posix_fadvise, (int __fd, __off64_t __offset,
+				       size_t __len, int __advise) __THROW,
+		       posix_fadvise64);
+# else
+#  define posix_fadvise posix_fadvise64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int posix_fadvise64 (int __fd, __off64_t __offset, size_t __len,
+			    int __advise) __THROW;
+# endif
+
+
+/* Reserve storage for the data of the file associated with FD.  */
+# ifndef __USE_FILE_OFFSET64
+extern int posix_fallocate (int __fd, __off_t __offset, size_t __len) __THROW;
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
+					 size_t __len) __THROW,
+		       posix_fallocate64);
+# else
+#  define posix_fallocate posix_fallocate64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int posix_fallocate64 (int __fd, __off64_t __offset, size_t __len)
+     __THROW;
 # endif
 #endif
 

+ 286 - 70
include/features.h

@@ -1,6 +1,250 @@
-#ifndef __FEATURES_H
-#define __FEATURES_H
+/* Copyright (C) 1991,92,93,95,96,97,98,99,2000,2001 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_FEATURES_H
+#define	_FEATURES_H	1
+
+/* These are defined by the user (or the compiler)
+   to specify the desired environment:
+
+   __STRICT_ANSI__	ISO Standard C.
+   _ISOC99_SOURCE	Extensions to ISO C89 from ISO C99.
+   _POSIX_SOURCE	IEEE Std 1003.1.
+   _POSIX_C_SOURCE	If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
+			if >=199309L, add IEEE Std 1003.1b-1993;
+			if >=199506L, add IEEE Std 1003.1c-1995
+   _XOPEN_SOURCE	Includes POSIX and XPG things.  Set to 500 if
+			Single Unix conformance is wanted, to 600 for the
+			upcoming sixth revision.
+   _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
+   _LARGEFILE_SOURCE	Some more functions for correct standard I/O.
+   _LARGEFILE64_SOURCE	Additional functionality from LFS for large files.
+   _FILE_OFFSET_BITS=N	Select default filesystem interface.
+   _BSD_SOURCE		ISO C, POSIX, and 4.3BSD things.
+   _SVID_SOURCE		ISO C, POSIX, and SVID things.
+   _GNU_SOURCE		All of the above, plus GNU extensions.
+   _REENTRANT		Select additionally reentrant object.
+   _THREAD_SAFE		Same as _REENTRANT, often used by other systems.
+
+   The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
+   If none of these are defined, the default is to have _SVID_SOURCE,
+   _BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
+   199506L.  If more than one of these are defined, they accumulate.
+   For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
+   together give you ISO C, 1003.1, and 1003.2, but nothing else.
+
+   These are defined by this file and are used by the
+   header files to decide what to declare or define:
+
+   __USE_ISOC99		Define ISO C99 things.
+   __USE_POSIX		Define IEEE Std 1003.1 things.
+   __USE_POSIX2		Define IEEE Std 1003.2 things.
+   __USE_POSIX199309	Define IEEE Std 1003.1, and .1b things.
+   __USE_POSIX199506	Define IEEE Std 1003.1, .1b, .1c and .1i things.
+   __USE_XOPEN		Define XPG things.
+   __USE_XOPEN_EXTENDED	Define X/Open Unix things.
+   __USE_UNIX98		Define Single Unix V2 things.
+   __USE_XOPEN2K        Define XPG6 things.
+   __USE_LARGEFILE	Define correct standard I/O things.
+   __USE_LARGEFILE64	Define LFS things with separate names.
+   __USE_FILE_OFFSET64	Define 64bit interface as default.
+   __USE_BSD		Define 4.3BSD things.
+   __USE_SVID		Define SVID things.
+   __USE_MISC		Define things common to BSD and System V Unix.
+   __USE_GNU		Define GNU extensions.
+   __USE_REENTRANT	Define reentrant/thread-safe *_r functions.
+   __FAVOR_BSD		Favor 4.3BSD things in cases of conflict.
+
+   The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
+   defined by this file unconditionally.  `__GNU_LIBRARY__' is provided
+   only for compatibility.  All new code should use the other symbols
+   to test for features.
+
+   All macros listed above as possibly being defined by this file are
+   explicitly undefined if they are not explicitly defined.
+   Feature-test macros that are not defined by the user or compiler
+   but are implied by the other feature-test macros defined (or by the
+   lack of any definitions) are defined by the file.  */
+
+
+/* Undefine everything, so we get a clean slate.  */
+#undef	__USE_ISOC99
+#undef	__USE_POSIX
+#undef	__USE_POSIX2
+#undef	__USE_POSIX199309
+#undef	__USE_POSIX199506
+#undef	__USE_XOPEN
+#undef	__USE_XOPEN_EXTENDED
+#undef	__USE_UNIX98
+#undef	__USE_XOPEN2K
+#undef	__USE_LARGEFILE
+#undef	__USE_LARGEFILE64
+#undef	__USE_FILE_OFFSET64
+#undef	__USE_BSD
+#undef	__USE_SVID
+#undef	__USE_MISC
+#undef	__USE_GNU
+#undef	__USE_REENTRANT
+#undef	__FAVOR_BSD
+#undef	__KERNEL_STRICT_NAMES
+
+/* Suppress kernel-name space pollution unless user expressedly asks
+   for it.  */
+#ifndef _LOOSE_KERNEL_NAMES
+# define __KERNEL_STRICT_NAMES
+#endif
+
+/* Always use ISO C things.  */
+#define	__USE_ANSI	1
+
+
+/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX.  */
+#if defined _BSD_SOURCE && \
+    !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
+      defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
+      defined _GNU_SOURCE || defined _SVID_SOURCE)
+# define __FAVOR_BSD	1
+#endif
+
+/* If _GNU_SOURCE was defined by the user, turn on all the other features.  */
+#ifdef _GNU_SOURCE
+# undef  _ISOC99_SOURCE
+# define _ISOC99_SOURCE	1
+# undef  _POSIX_SOURCE
+# define _POSIX_SOURCE	1
+# undef  _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE	199506L
+# undef  _XOPEN_SOURCE
+# define _XOPEN_SOURCE	600
+# undef  _XOPEN_SOURCE_EXTENDED
+# define _XOPEN_SOURCE_EXTENDED	1
+# undef	 _LARGEFILE64_SOURCE
+# define _LARGEFILE64_SOURCE	1
+# undef  _BSD_SOURCE
+# define _BSD_SOURCE	1
+# undef  _SVID_SOURCE
+# define _SVID_SOURCE	1
+#endif
+
+/* If nothing (other than _GNU_SOURCE) is defined,
+   define _BSD_SOURCE and _SVID_SOURCE.  */
+#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
+     !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
+     !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
+     !defined _BSD_SOURCE && !defined _SVID_SOURCE)
+# define _BSD_SOURCE	1
+# define _SVID_SOURCE	1
+#endif
+
+/* This is to enable the ISO C99 extension.  Also recognize the old macro
+   which was used prior to the standard acceptance.  This macro will
+   eventually go away and the features enabled by default once the ISO C99
+   standard is widely adopted.  */
+#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \
+     || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
+# define __USE_ISOC99	1
+#endif
+
+/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
+   (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined).  */
+#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
+     !defined _POSIX_C_SOURCE)
+# define _POSIX_SOURCE	1
+# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
+#  define _POSIX_C_SOURCE	2
+# else
+#  define _POSIX_C_SOURCE	199506L
+# endif
+#endif
+
+#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
+# define __USE_POSIX	1
+#endif
+
+#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
+# define __USE_POSIX2	1
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 199309L
+# define __USE_POSIX199309	1
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 199506L
+# define __USE_POSIX199506	1
+#endif
+
+#ifdef	_XOPEN_SOURCE
+# define __USE_XOPEN	1
+# if (_XOPEN_SOURCE - 0) >= 500
+#  define __USE_XOPEN_EXTENDED	1
+#  define __USE_UNIX98	1
+#  undef _LARGEFILE_SOURCE
+#  define _LARGEFILE_SOURCE	1
+#  if (_XOPEN_SOURCE - 0) >= 600
+#   define __USE_XOPEN2K	1
+#   undef __USE_ISOC99
+#   define __USE_ISOC99		1
+#  endif
+# else
+#  ifdef _XOPEN_SOURCE_EXTENDED
+#   define __USE_XOPEN_EXTENDED	1
+#  endif
+# endif
+#endif
+
+#ifdef _LARGEFILE_SOURCE
+# define __USE_LARGEFILE	1
+#endif
+
+#ifdef _LARGEFILE64_SOURCE
+# define __USE_LARGEFILE64	1
+#endif
+
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+# define __USE_FILE_OFFSET64	1
+#endif
+
+#if defined _BSD_SOURCE || defined _SVID_SOURCE
+# define __USE_MISC	1
+#endif
+
+#ifdef	_BSD_SOURCE
+# define __USE_BSD	1
+#endif
+
+#ifdef	_SVID_SOURCE
+# define __USE_SVID	1
+#endif
+
+#ifdef	_GNU_SOURCE
+# define __USE_GNU	1
+#endif
+
+#if defined _REENTRANT || defined _THREAD_SAFE
+# define __USE_REENTRANT	1
+#endif
+
+/* We do support the IEC 559 math functionality, real and complex.  */
+#define __STDC_IEC_559__		1
+#define __STDC_IEC_559_COMPLEX__	1
+
+/* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.0.  */
+#define __STDC_ISO_10646__		200009L
 
 /* Major and minor version number of the uClibc library package.  Use
    these macros to test for features in specific releases.  */
@@ -18,93 +262,67 @@
 #if !defined _LIBC || defined __FORCE_GLIBC__ 
 #   define __GNU_LIBRARY__ 6
 #   define __GLIBC__       2
-#   define __GLIBC_MINOR__ 1
+#   define __GLIBC_MINOR__ 2
 #endif	
 
-/* Make a half-hearted attempt to accomodate non-gcc compilers */
-#ifndef __GNUC__
-#define __attribute(foo)  /* Ignore */
-#endif
-
-/* Convenience macro to test the version of gcc.
- * Use it like this:
- * #if __GNUC_PREREQ (2,8)
- * ... code requiring gcc 2.8 or later ...
- * #endif
- * Note - they won't work for gcc1, since the _MINOR macros
- * were not defined then. */
+/* Convenience macros to test the versions of glibc and gcc.
+   Use them like this:
+   #if __GNUC_PREREQ (2,8)
+   ... code requiring gcc 2.8 or later ...
+   #endif
+   Note - they won't work for gcc1 or glibc1, since the _MINOR macros
+   were not defined then.  */
 #if defined __GNUC__ && defined __GNUC_MINOR__
-#define __GNUC_PREREQ(maj, min) \
+# define __GNUC_PREREQ(maj, min) \
 	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
 #else
-#define __GNUC_PREREQ(maj,min) 0
+# define __GNUC_PREREQ(maj, min) 0
 #endif
 
-/* __restrict is known in EGCS 1.2 and above. */
-#if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 92)
-# define __restrict     /* Ignore */
-#endif
+#define __GLIBC_PREREQ(maj, min) \
+	((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
 
-/* __extension__ is known in gcc 2.8 above. */
-#if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-# define __extension__     /* Ignore */
+/* This is here only because every header file already includes this one.  */
+#ifndef __ASSEMBLER__
+#ifndef _SYS_CDEFS_H
+# include <sys/cdefs.h>
 #endif
 
-#ifdef __STDC__
+/* If we don't have __REDIRECT, prototypes will be missing if
+   __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
+# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
+#  define __USE_LARGEFILE	1
+#  define __USE_LARGEFILE64	1
+# endif
 
-#define __P(x)	    x
-#define __PMT(x)    x
-#ifndef __const
-#define __const const
-#endif
+#endif	/* !ASSEMBLER */
 
-/* Almost ansi */
-#if __STDC__ != 1
-#ifndef const
-#define const
-#endif
-#define volatile
+/* Decide whether we can define 'extern inline' functions in headers.  */
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
+    && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
+# define __USE_EXTERN_INLINES	1
 #endif
 
-#else /* K&R */
+/* This is here only because every header file already includes this one.  */
+#if 0
+//#ifndef _LIBC
+/* Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
+   <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
+   which will always return failure (and set errno to ENOSYS).
 
-#define __P(x) ()
-#ifndef __const
-#define __const
-#endif
-#ifndef const
-#define const
-#endif
-#define volatile
+   We avoid including <gnu/stubs.h> when compiling the C library itself to
+   avoid a dependency loop.  stubs.h depends on every object file.  If
+   this #include were done for the library source code, then every object
+   file would depend on stubs.h.  */
 
+# include <gnu/stubs.h>
 #endif
 
-/* GNUish things */
-#define __CONSTVALUE
-#define __CONSTVALUE2
-
-#define __USE_BSD
-#define __USE_MISC
-#define __USE_POSIX
-#define __USE_POSIX2
-#define __USE_XOPEN
-
-#undef  __KERNEL_STRICT_NAMES
-#ifndef _LOOSE_KERNEL_NAMES
-# define __KERNEL_STRICT_NAMES
-#endif
-
-#ifdef  _GNU_SOURCE
-# define __USE_GNU      1
-#endif
-
-#include <sys/cdefs.h>
-
+/* Load up the current set of uClibc supported features */
 #define __need_uClibc_config_h
 #include <bits/uClibc_config.h>
 #undef __need_uClibc_config_h
 
-
 /* Some nice features only work properly with ELF */
 #if defined HAVE_ELF	
 #   define link_warning(symbol, msg) \
@@ -121,6 +339,4 @@
 	__asm__(".global alias\n.set alias,original");
 #endif
 
-
-#endif
-
+#endif	/* features.h  */

+ 61 - 23
include/fnmatch.h

@@ -1,47 +1,85 @@
-/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,96,97,98,99,2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-This 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
-This 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
+   Lesser General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with this 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 Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_FNMATCH_H
-
 #define	_FNMATCH_H	1
 
-#include <features.h>
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
+# if !defined __GLIBC__ || !defined __P
+#  undef	__P
+#  define __P(protos)	protos
+# endif
+#else /* Not C++ or ANSI C.  */
+# undef	__P
+# define __P(protos)	()
+/* We can get away without defining `const' here only because in this file
+   it is used only inside the prototype for `fnmatch', which is elided in
+   non-ANSI C where `const' is problematical.  */
+#endif /* C++ or ANSI C.  */
+
+#ifndef const
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
+#  define __const	const
+# else
+#  define __const
+# endif
+#endif
 
-__BEGIN_DECLS
+/* We #undef these before defining them because some losing systems
+   (HP-UX A.08.07 for example) define these in <unistd.h>.  */
+#undef	FNM_PATHNAME
+#undef	FNM_NOESCAPE
+#undef	FNM_PERIOD
 
 /* Bits set in the FLAGS argument to `fnmatch'.  */
 #define	FNM_PATHNAME	(1 << 0) /* No wildcard can ever match `/'.  */
 #define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
 #define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
 
-#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
-#define	FNM_FILE_NAME	FNM_PATHNAME /* Preferred GNU name.  */
-#define	FNM_LEADING_DIR	(1 << 3) /* Ignore `/...' after a match.  */
-#define	FNM_CASEFOLD	(1 << 4) /* Compare without regard to case.  */
+#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
+# define FNM_FILE_NAME	 FNM_PATHNAME	/* Preferred GNU name.  */
+# define FNM_LEADING_DIR (1 << 3)	/* Ignore `/...' after a match.  */
+# define FNM_CASEFOLD	 (1 << 4)	/* Compare without regard to case.  */
+# define FNM_EXTMATCH	 (1 << 5)	/* Use ksh-like extended matching. */
 #endif
 
 /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
 #define	FNM_NOMATCH	1
 
-/* Match STRING against the filename pattern PATTERN,
+/* This value is returned if the implementation does not support
+   `fnmatch'.  Since this is not the case here it will never be
+   returned but the conformance test suites still require the symbol
+   to be defined.  */
+#ifdef _XOPEN_SOURCE
+# define FNM_NOSYS	(-1)
+#endif
+
+/* Match NAME against the filename pattern PATTERN,
    returning zero if it matches, FNM_NOMATCH if not.  */
-extern int fnmatch __P ((__const char *__pattern, __const char *__string,
+extern int fnmatch __P ((__const char *__pattern, __const char *__name,
 			 int __flags));
 
-__END_DECLS
+#ifdef	__cplusplus
+}
+#endif
 
 #endif /* fnmatch.h */

+ 5 - 9
include/fstab.h

@@ -10,10 +10,6 @@
  * 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.
@@ -72,11 +68,11 @@ struct fstab
 
 __BEGIN_DECLS
 
-extern struct fstab *getfsent __P ((void));
-extern struct fstab *getfsspec __P ((__const char *__name));
-extern struct fstab *getfsfile __P ((__const char *__name));
-extern int setfsent __P ((void));
-extern void endfsent __P ((void));
+extern struct fstab *getfsent (void) __THROW;
+extern struct fstab *getfsspec (__const char *__name) __THROW;
+extern struct fstab *getfsfile (__const char *__name) __THROW;
+extern int setfsent (void) __THROW;
+extern void endfsent (void) __THROW;
 
 __END_DECLS
 

+ 100 - 29
include/getopt.h

@@ -1,27 +1,38 @@
 /* Declarations for getopt.
-   Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser 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 Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _GETOPT_H
-#define _GETOPT_H 1
 
-#include <features.h>
+#ifndef __need_getopt
+# define _GETOPT_H 1
+#endif
+
+/* If __GNU_LIBRARY__ is not already defined, either we are being used
+   standalone, or this is the first header included in the source file.
+   If we are being used with glibc, we need to include <features.h>, but
+   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
+   not defined, include <ctype.h>, which will pull in <features.h> for us
+   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
+   doesn't flood the namespace with stuff the way some other headers do.)  */
+#if !defined __GNU_LIBRARY__
+# include <ctype.h>
+#endif
 
 #ifdef	__cplusplus
 extern "C" {
@@ -41,7 +52,7 @@ extern char *optarg;
 
    On entry to `getopt', zero means this is the first call; initialize.
 
-   When `getopt' returns EOF, this is the index of the first of the
+   When `getopt' returns -1, this is the index of the first of the
    non-option elements that the caller should itself scan.
 
    Otherwise, `optind' communicates from one call to the next
@@ -58,6 +69,7 @@ extern int opterr;
 
 extern int optopt;
 
+#ifndef __need_getopt
 /* Describe the long-named options requested by the application.
    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
    of `struct option' terminated by an element containing a name which is
@@ -81,7 +93,11 @@ extern int optopt;
 
 struct option
 {
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
   const char *name;
+# else
+  char *name;
+# endif
   /* has_arg can't be an enum because some compilers complain about
      type mismatches in all the code that assumes it is an int.  */
   int has_arg;
@@ -91,19 +107,74 @@ struct option
 
 /* Names for the values of the `has_arg' field of `struct option'.  */
 
-#define	no_argument		0
-#define required_argument	1
-#define optional_argument	2
-
-extern int getopt __P((int argc, char *const *argv, const char *shortopts));
-extern int getopt_long __P((int argc, char *const *argv, const char *shortopts,
-							const struct option *longopts, int *longind));
-extern int getopt_long_only __P((int argc, char *const *argv,
-								 const char *shortopts,
-								 const struct option *longopts, int *longind));
+# define no_argument		0
+# define required_argument	1
+# define optional_argument	2
+#endif	/* need getopt */
+
+
+/* Get definitions and prototypes for functions to process the
+   arguments in ARGV (ARGC of them, minus the program name) for
+   options given in OPTS.
+
+   Return the option character from OPTS just read.  Return -1 when
+   there are no more options.  For unrecognized options, or options
+   missing arguments, `optopt' is set to the option letter, and '?' is
+   returned.
+
+   The OPTS string is a list of characters which are recognized option
+   letters, optionally followed by colons, specifying that that letter
+   takes an argument, to be placed in `optarg'.
+
+   If a letter in OPTS is followed by two colons, its argument is
+   optional.  This behavior is specific to the GNU `getopt'.
+
+   The argument `--' causes premature termination of argument
+   scanning, explicitly telling `getopt' that there are no more
+   options.
+
+   If OPTS begins with `--', then non-option arguments are treated as
+   arguments to the option '\0'.  This behavior is specific to the GNU
+   `getopt'.  */
+
+#if (defined __STDC__ && __STDC__) || defined __cplusplus
+# ifdef __GNU_LIBRARY__
+/* Many other libraries have conflicting prototypes for getopt, with
+   differences in the consts, in stdlib.h.  To avoid compilation
+   errors, only prototype getopt for the GNU C library.  */
+extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
+# else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+# endif /* __GNU_LIBRARY__ */
+
+# ifndef __need_getopt
+extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
+		        const struct option *__longopts, int *__longind);
+extern int getopt_long_only (int __argc, char *const *__argv,
+			     const char *__shortopts,
+		             const struct option *__longopts, int *__longind);
+
+/* Internal only.  Users should not call this directly.  */
+extern int _getopt_internal (int __argc, char *const *__argv,
+			     const char *__shortopts,
+		             const struct option *__longopts, int *__longind,
+			     int __long_only);
+# endif
+#else /* not __STDC__ */
+extern int getopt ();
+# ifndef __need_getopt
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+# endif
+#endif /* __STDC__ */
 
 #ifdef	__cplusplus
 }
 #endif
 
-#endif /* _GETOPT_H */
+/* Make sure we later can get all the definitions and declarations.  */
+#undef __need_getopt
+
+#endif /* getopt.h */

+ 51 - 25
include/glob.h

@@ -1,19 +1,20 @@
-/* Copyright (C) 1991, 92, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,95,96,97,98,2000,2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_GLOB_H
 #define	_GLOB_H	1
@@ -106,7 +107,9 @@ typedef unsigned long int __size_t;
 
 /* Structure describing a globbing run.  */
 #if !defined _AMIGA && !defined VMS /* Buggy compiler.   */
+# ifdef _GNU_SOURCE
 struct stat;
+# endif
 #endif
 typedef struct
   {
@@ -118,14 +121,26 @@ typedef struct
     /* If the GLOB_ALTDIRFUNC flag is set, the following functions
        are used instead of the normal file access functions.  */
     void (*gl_closedir) __PMT ((void *));
+#ifdef _GNU_SOURCE
     struct dirent *(*gl_readdir) __PMT ((void *));
+#else
+    void *(*gl_readdir) __PMT ((void *));
+#endif
     __ptr_t (*gl_opendir) __PMT ((__const char *));
-    int (*gl_lstat) __PMT ((__const char *, struct stat *));
-    int (*gl_stat) __PMT ((__const char *, struct stat *));
+#ifdef _GNU_SOURCE
+    int (*gl_lstat) __PMT ((__const char *__restrict,
+			    struct stat *__restrict));
+    int (*gl_stat) __PMT ((__const char *__restrict, struct stat *__restrict));
+#else
+    int (*gl_lstat) __PMT ((__const char *__restrict, void *__restrict));
+    int (*gl_stat) __PMT ((__const char *__restrict, void *__restrict));
+#endif
   } glob_t;
 
 #ifdef _LARGEFILE64_SOURCE
+# ifdef _GNU_SOURCE
 struct stat64;
+# endif
 typedef struct
   {
     __size_t gl_pathc;
@@ -136,13 +151,29 @@ typedef struct
     /* If the GLOB_ALTDIRFUNC flag is set, the following functions
        are used instead of the normal file access functions.  */
     void (*gl_closedir) __PMT ((void *));
+# ifdef _GNU_SOURCE
     struct dirent64 *(*gl_readdir) __PMT ((void *));
+# else
+    void *(*gl_readdir) __PMT ((void *));
+# endif
     __ptr_t (*gl_opendir) __PMT ((__const char *));
-    int (*gl_lstat) __PMT ((__const char *, struct stat64 *));
-    int (*gl_stat) __PMT ((__const char *, struct stat64 *));
+# ifdef _GNU_SOURCE
+    int (*gl_lstat) __PMT ((__const char *__restrict,
+			    struct stat64 *__restrict));
+    int (*gl_stat) __PMT ((__const char *__restrict,
+			   struct stat64 *__restrict));
+# else
+    int (*gl_lstat) __PMT ((__const char *__restrict, void *__restrict));
+    int (*gl_stat) __PMT ((__const char *__restrict, void *__restrict));
+# endif
   } glob64_t;
 #endif
 
+#if _FILE_OFFSET_BITS == 64 && __GNUC__ < 2
+# define glob glob64
+# define globfree globfree64
+#endif
+
 /* Do glob searching for PATTERN, placing results in PGLOB.
    The bits defined above may be set in FLAGS.
    If a directory cannot be opened or read and ERRFUNC is not nil,
@@ -151,30 +182,25 @@ typedef struct
    `glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
    If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
    Otherwise, `glob' returns zero.  */
-#if _FILE_OFFSET_BITS != 64
-extern int glob __P ((__const char *__pattern, int __flags,
+#if _FILE_OFFSET_BITS != 64 || __GNUC__ < 2
+extern int glob __P ((__const char *__restrict __pattern, int __flags,
 		      int (*__errfunc) (__const char *, int),
-		      glob_t *__pglob));
+		      glob_t *__restrict __pglob));
 
 /* Free storage allocated in PGLOB by a previous `glob' call.  */
 extern void globfree __P ((glob_t *__pglob));
 #else
-# if __GNUC__ >= 2
-extern int glob __P ((__const char *__pattern, int __flags,
+extern int glob __P ((__const char *__restrict __pattern, int __flags,
 		      int (*__errfunc) (__const char *, int),
-		      glob_t *__pglob)) __asm__ ("glob64");
+		      glob_t *__restrict __pglob)) __asm__ ("glob64");
 
 extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64");
-# else
-#  define glob glob64
-#  define globfree globfree64
-# endif
 #endif
 
 #ifdef _LARGEFILE64_SOURCE
-extern int glob64 __P ((__const char *__pattern, int __flags,
+extern int glob64 __P ((__const char *__restrict __pattern, int __flags,
 			int (*__errfunc) (__const char *, int),
-			glob64_t *__pglob));
+			glob64_t *__restrict __pglob));
 
 extern void globfree64 __P ((glob64_t *__pglob));
 #endif

+ 46 - 22
include/gnu-versions.h

@@ -1,29 +1,53 @@
-/* Header to ignore some special GNU libc interfaces not provided
- * by uClibc.  */
+/* Header with interface version macros for library pieces copied elsewhere.
+   Copyright (C) 1995, 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _GNU_VERSIONS_H
 #define	_GNU_VERSIONS_H	1
 
-/* This file exists to avoid uClibc getting into trouble these macros
-   such as the following:
-
-       #define OBSTACK_INTERFACE_VERSION 1
-       #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
-       #include <gnu-versions.h>
-       #if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
-       #define ELIDE_CODE
-       #endif
-       #endif
-
-   By defining bogus interface versions, I believe we can safely get
-   past such things while continuing to lie and define __GNU_LIBRARY__,
-   thereby getting better compatibility with the majority of the code
-   written for Linux.  */
-
-#define _GNU_OBSTACK_INTERFACE_VERSION	-1 /* vs malloc/obstack.c */
-#define _GNU_REGEX_INTERFACE_VERSION	-1 /* vs posix/regex.c */
-#define _GNU_GLOB_INTERFACE_VERSION	-1 /* vs posix/glob.c */
-#define _GNU_GETOPT_INTERFACE_VERSION	-1 /* vs posix/getopt.c and
+/* This file exists to define these few macros.  Each specifies a version
+   number associated with the library interface of a piece of the C library
+   which is also distributed with other GNU packages.  These pieces are
+   both part of the GNU C library and also distributed with other GNU
+   packages so those packages may use their facilities on systems lacking
+   the GNU C library.  The source files for each piece surround all their
+   code with `#ifndef ELIDE_CODE' after defining it with this:
+
+   #define OBSTACK_INTERFACE_VERSION 1
+   #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
+   #include <gnu-versions.h>
+   #if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
+   #define ELIDE_CODE
+   #endif
+   #endif
+
+   This allows those one to avoid compiling those files when part of a GNU
+   package not libc, on a system using a GNU C library that supports the
+   same interface.
+
+   Please preserve the format of the comments after each macro.  And
+   remember, if any of these versions change, the libc.so major version
+   number must change too (so avoid it)!  */
+
+#define _GNU_OBSTACK_INTERFACE_VERSION	1 /* vs malloc/obstack.c */
+#define _GNU_REGEX_INTERFACE_VERSION	1 /* vs posix/regex.c */
+#define _GNU_GLOB_INTERFACE_VERSION	1 /* vs posix/glob.c */
+#define _GNU_GETOPT_INTERFACE_VERSION	2 /* vs posix/getopt.c and
 					     posix/getopt1.c */
 
 #endif	/* gnu-versions.h */

+ 136 - 23
include/grp.h

@@ -1,41 +1,154 @@
-#ifndef	__GRP_H
-#define	__GRP_H
+/* Copyright (C) 1991,92,95,96,97,98,99,2000,01 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ *	POSIX Standard: 9.2.1 Group Database Access	<grp.h>
+ */
+
+#ifndef	_GRP_H
+#define	_GRP_H	1
 
-#include <sys/types.h>
 #include <features.h>
-#include <stdio.h>
 
 __BEGIN_DECLS
 
-/* The group structure */
+#include <bits/types.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+
+/* For the Single Unix specification we must define this type here.  */
+#if defined __USE_XOPEN && !defined __gid_t_defined
+typedef __gid_t gid_t;
+# define __gid_t_defined
+#endif
+
+/* The group structure.	 */
 struct group
-{
-  char *gr_name;		/* Group name.	*/
-  char *gr_passwd;		/* Password.	*/
-  gid_t gr_gid;			/* Group ID.	*/
-  char **gr_mem;		/* Member list.	*/
-};
+  {
+    char *gr_name;		/* Group name.	*/
+    char *gr_passwd;		/* Password.	*/
+    __gid_t gr_gid;		/* Group ID.	*/
+    char **gr_mem;		/* Member list.	*/
+  };
 
-extern void setgrent __P ((void));
-extern void endgrent __P ((void));
-extern struct group * getgrent __P ((void));
 
-extern struct group * getgrgid __P ((__const gid_t gid));
-extern struct group * getgrnam __P ((__const char * name));
+#if defined __USE_SVID || defined __USE_GNU
+# define __need_FILE
+# include <stdio.h>
+#endif
 
-extern struct group * fgetgrent __P ((FILE * file));
 
-extern int setgroups __P ((size_t n, __const gid_t * groups));
-extern int initgroups __P ((__const char * user, gid_t gid));
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* Rewind the group-file stream.  */
+extern void setgrent (void) __THROW;
 
+/* Close the group-file stream.  */
+extern void endgrent (void) __THROW;
 
-#ifdef _LIBC
-extern struct group * __getgrent __P ((int grp_fd));
+/* Read an entry from the group-file stream, opening it if necessary.  */
+extern struct group *getgrent (void) __THROW;
 #endif
 
-__END_DECLS
+#ifdef	__USE_SVID
+/* Read a group entry from STREAM.  */
+extern struct group *fgetgrent (FILE *__stream) __THROW;
+#endif
+
+#ifdef __USE_GNU
+/* Write the given entry onto the given stream.  */
+extern int putgrent (__const struct group *__restrict __p,
+		     FILE *__restrict __f) __THROW;
+#endif
+
+/* Search for an entry with a matching group ID.  */
+extern struct group *getgrgid (__gid_t __gid) __THROW;
 
-#endif /* _GRP_H */
+/* Search for an entry with a matching group name.  */
+extern struct group *getgrnam (__const char *__name) __THROW;
 
+#if defined __USE_POSIX || defined __USE_MISC
 
+# ifdef __USE_MISC
+/* Reasonable value for the buffer sized used in the reentrant
+   functions below.  But better use `sysconf'.  */
+#  define NSS_BUFLEN_GROUP	1024
+# endif
+
+/* Reentrant versions of some of the functions above.
+
+   PLEASE NOTE: the `getgrent_r' function is not (yet) standardized.
+   The interface may change in later versions of this library.  But
+   the interface is designed following the principals used for the
+   other reentrant functions so the chances are good this is what the
+   POSIX people would choose.  */
+
+# ifdef __USE_GNU
+extern int getgrent_r (struct group *__restrict __resultbuf,
+		       char *__restrict __buffer, size_t __buflen,
+		       struct group **__restrict __result) __THROW;
+# endif
+
+/* Search for an entry with a matching group ID.  */
+extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
+		       char *__restrict __buffer, size_t __buflen,
+		       struct group **__restrict __result) __THROW;
+
+/* Search for an entry with a matching group name.  */
+extern int getgrnam_r (__const char *__restrict __name,
+		       struct group *__restrict __resultbuf,
+		       char *__restrict __buffer, size_t __buflen,
+		       struct group **__restrict __result) __THROW;
+
+# ifdef	__USE_SVID
+/* Read a group entry from STREAM.  This function is not standardized
+   an probably never will.  */
+extern int fgetgrent_r (FILE *__restrict __stream,
+			struct group *__restrict __resultbuf,
+			char *__restrict __buffer, size_t __buflen,
+			struct group **__restrict __result) __THROW;
+# endif
+
+#endif	/* POSIX or reentrant */
+
+
+#ifdef	__USE_BSD
+
+# define __need_size_t
+# include <stddef.h>
+
+/* Set the group set for the current user to GROUPS (N of them).  */
+extern int setgroups (size_t __n, __const __gid_t *__groups) __THROW;
+
+/* Store at most *NGROUPS members of the group set for USER into
+   *GROUPS.  Also include GROUP.  The actual number of groups found is
+   returned in *NGROUPS.  Return -1 if the if *NGROUPS is too small.  */
+extern int getgrouplist (__const char *__user, __gid_t __group,
+			 __gid_t *__groups, int *__ngroups) __THROW;
+
+/* Initialize the group set for the current user
+   by reading the group database and using all groups
+   of which USER is a member.  Also include GROUP.  */
+extern int initgroups (__const char *__user, __gid_t __group) __THROW;
+
+#endif /* Use BSD.  */
+
+__END_DECLS
 
+#endif /* grp.h  */

+ 11 - 10
include/langinfo.h

@@ -3,19 +3,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _LANGINFO_H
 #define	_LANGINFO_H 1
@@ -572,10 +572,11 @@ enum
    The string returned will not change until `setlocale' is called;
    it is usually in read-only memory and cannot be modified.  */
 
-extern char *nl_langinfo (nl_item __item);
+extern char *nl_langinfo (nl_item __item) __THROW;
 
 
-#ifdef	__USE_GNU
+#if 0
+//#ifdef	__USE_GNU
 /* This interface is for the extended locale model.  See <locale.h> for
    more information.  */
 

+ 61 - 36
include/limits.h

@@ -1,23 +1,23 @@
-/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
- *	ISO C Standard: 4.14/2.2.4.2 Limits of integral types	<limits.h>
+ *	ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types	<limits.h>
  */
 
 #ifndef _LIBC_LIMITS_H_
@@ -25,32 +25,25 @@
 
 #include <features.h>
 
-#ifdef	__USE_POSIX
-/* POSIX adds things to <limits.h>.  */
-# include <bits/posix1_lim.h>
-#endif
-
-#ifdef	__USE_POSIX2
-# 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
+#define MB_LEN_MAX	16
 
 
+/* 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
 
+#include <bits/wordsize.h>
+
 /* We don't have #include_next.
    Define ANSI <limits.h> for standard 32-bit words.  */
 
@@ -88,14 +81,10 @@
 #  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
+#  define UINT_MAX	4294967295U
 
 /* Minimum and maximum values a `signed long int' can hold.  */
-#  ifdef __alpha__
+#  if __WORDSIZE == 64
 #   define LONG_MAX	9223372036854775807L
 #  else
 #   define LONG_MAX	2147483647L
@@ -103,17 +92,25 @@
 #  define LONG_MIN	(-LONG_MAX - 1L)
 
 /* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
-#  ifdef __alpha__
+#  if __WORDSIZE == 64
 #   define ULONG_MAX	18446744073709551615UL
 #  else
-#   ifdef __STDC__
-#    define ULONG_MAX	4294967295UL
-#   else
-#    define ULONG_MAX	4294967295L
-#   endif
+#   define ULONG_MAX	4294967295UL
 #  endif
 
+#  ifdef __USE_ISOC99
+
+/* Minimum and maximum values a `signed long long int' can hold.  */
+#   define LLONG_MAX	9223372036854775807LL
+#   define LLONG_MIN	(-LLONG_MAX - 1LL)
+
+/* Maximum value an `unsigned long long int' can hold.  (Minimum is 0.)  */
+#   define ULLONG_MAX	18446744073709551615ULL
+
+#  endif /* ISO C99 */
+
 # endif	/* limits.h  */
+#endif	/* GCC 2.  */
 
 #endif	/* !_LIBC_LIMITS_H_ */
 
@@ -125,4 +122,32 @@
 #if defined __GNUC__ && !defined _GCC_LIMITS_H_
 /* `_GCC_LIMITS_H_' is what GCC's file defines.  */
 # include_next <limits.h>
+
+/* The <limits.h> files in some gcc versions don't define LLONG_MIN,
+   LLONG_MAX, and ULLONG_MAX.  Instead only the values gcc defined for
+   ages are available.  */
+# ifdef __USE_ISOC99
+#  ifndef LLONG_MIN
+#   define LLONG_MIN	LONG_LONG_MIN
+#  endif
+#  ifndef LLONG_MAX
+#   define LLONG_MAX	LONG_LONG_MAX
+#  endif
+#  ifndef ULLONG_MAX
+#   define ULLONG_MAX	ULONG_LONG_MAX
+#  endif
+# endif
+#endif
+
+#ifdef	__USE_POSIX
+/* POSIX adds things to <limits.h>.  */
+# include <bits/posix1_lim.h>
+#endif
+
+#ifdef	__USE_POSIX2
+# include <bits/posix2_lim.h>
+#endif
+
+#ifdef	__USE_XOPEN
+# include <bits/xopen_lim.h>
 #endif

+ 29 - 9
include/link.h

@@ -1,22 +1,22 @@
 /* Data structure for communication from the run-time dynamic linker for
    loaded ELF shared objects.
-   Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000, 2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_LINK_H
 #define	_LINK_H	1
@@ -92,4 +92,24 @@ struct link_map
     struct link_map *l_next, *l_prev; /* Chain of loaded objects.  */
   };
 
+#ifdef __USE_GNU
+
+struct dl_phdr_info
+  {
+    ElfW(Addr) dlpi_addr;
+    const char *dlpi_name;
+    const ElfW(Phdr) *dlpi_phdr;
+    ElfW(Half) dlpi_phnum;
+  };
+
+__BEGIN_DECLS
+
+extern int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
+					     size_t size, void *data),
+			    void *data) __THROW;
+
+__END_DECLS
+
+#endif
+
 #endif /* link.h */

+ 5 - 3
include/locale.h

@@ -6,6 +6,8 @@
 
 #include <features.h>
 
+__BEGIN_DECLS
+
 #ifndef NULL
 #ifdef __cplusplus
 #define NULL    0
@@ -70,12 +72,12 @@ struct lconv
   char n_sign_posn;
 };
 
-__BEGIN_DECLS
 
-extern char *setlocale(int __category, __const char *__locale);
+/* Set and/or return the current locale.  */
+extern char *setlocale (int __category, __const char *__locale) __THROW;
 
 /* Return the numeric/monetary information for the current locale.  */
-extern struct lconv *localeconv __P ((void));
+extern struct lconv *localeconv (void) __THROW;
 
 __END_DECLS
 

+ 235 - 10
include/malloc.h

@@ -1,18 +1,243 @@
+/* Prototypes and definition for malloc implementation.
+   Copyright (C) 1996, 1997, 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _MALLOC_H
+#define _MALLOC_H 1
 
-#ifndef __MALLOC_H
-#define __MALLOC_H
 #include <features.h>
-#include <sys/types.h>
 
-__BEGIN_DECLS
+/*
+  `ptmalloc', a malloc implementation for multiple threads without
+  lock contention, by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>.
+  See the files `ptmalloc.c' or `COPYRIGHT' for copying conditions.
+
+  VERSION 2.6.4-pt Wed Dec  4 00:35:54 MET 1996
+
+  This work is mainly derived from malloc-2.6.4 by Doug Lea
+  <dl@cs.oswego.edu>, which is available from:
+
+                 ftp://g.oswego.edu/pub/misc/malloc.c
+
+  This trimmed-down header file only provides function prototypes and
+  the exported data structures.  For more detailed function
+  descriptions and compile-time options, see the source file
+  `ptmalloc.c'.
+*/
+
+#if defined(__STDC__) || defined (__cplusplus)
+# include <stddef.h>
+# define __malloc_ptr_t  void *
+#else
+# undef  size_t
+# define size_t          unsigned int
+# undef  ptrdiff_t
+# define ptrdiff_t       int
+# define __malloc_ptr_t  char *
+#endif
+
+#ifdef _LIBC
+/* Used by GNU libc internals. */
+# define __malloc_size_t size_t
+# define __malloc_ptrdiff_t ptrdiff_t
+#elif !defined __attribute_malloc__
+# define __attribute_malloc__
+#endif
+
+#ifdef __GNUC__
+
+/* GCC can always grok prototypes.  For C++ programs we add throw()
+   to help it optimize the function calls.  But this works only with
+   gcc 2.8.x and egcs.  */
+# if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8)
+#  define __THROW	throw ()
+# else
+#  define __THROW
+# endif
+# define __MALLOC_P(args)	args __THROW
+/* This macro will be used for functions which might take C++ callback
+   functions.  */
+# define __MALLOC_PMT(args)	args
 
-extern void free __P((void *));
-extern void *malloc __P((size_t));
-extern void *realloc __P((void *, size_t));
-extern void *alloca __P((size_t));
+#else	/* Not GCC.  */
 
-extern void *(*__alloca_alloc) __P((size_t));
+# define __THROW
 
-__END_DECLS
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
 
+#  define __MALLOC_P(args)	args
+#  define __MALLOC_PMT(args)	args
+
+# else	/* Not ANSI C or C++.  */
+
+#  define __MALLOC_P(args)	()	/* No prototypes.  */
+#  define __MALLOC_PMT(args)	()
+
+# endif	/* ANSI C or C++.  */
+
+#endif	/* GCC.  */
+
+#ifndef NULL
+# ifdef __cplusplus
+#  define NULL	0
+# else
+#  define NULL	((__malloc_ptr_t) 0)
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
 #endif
+
+/* Nonzero if the malloc is already initialized.  */
+#ifdef _LIBC
+/* In the GNU libc we rename the global variable
+   `__malloc_initialized' to `__libc_malloc_initialized'.  */
+# define __malloc_initialized __libc_malloc_initialized
+#endif
+extern int __malloc_initialized;
+
+/* Initialize global configuration.  Not needed with GNU libc. */
+#ifndef __GLIBC__
+extern void ptmalloc_init __MALLOC_P ((void));
+#endif
+
+/* Allocate SIZE bytes of memory.  */
+extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
+
+/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
+extern __malloc_ptr_t calloc __MALLOC_P ((size_t __nmemb, size_t __size))
+       __attribute_malloc__;
+
+/* Re-allocate the previously allocated block in __ptr, making the new
+   block SIZE bytes long.  */
+extern __malloc_ptr_t realloc __MALLOC_P ((__malloc_ptr_t __ptr,
+					   size_t __size))
+       __attribute_malloc__;
+
+/* Free a block allocated by `malloc', `realloc' or `calloc'.  */
+extern void free __MALLOC_P ((__malloc_ptr_t __ptr));
+
+/* Free a block allocated by `calloc'. */
+extern void cfree __MALLOC_P ((__malloc_ptr_t __ptr));
+
+/* Allocate SIZE bytes allocated to ALIGNMENT bytes.  */
+extern __malloc_ptr_t memalign __MALLOC_P ((size_t __alignment, size_t __size));
+
+/* Allocate SIZE bytes on a page boundary.  */
+extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
+
+/* Equivalent to valloc(minimum-page-that-holds(n)), that is, round up
+   __size to nearest pagesize. */
+extern __malloc_ptr_t  pvalloc __MALLOC_P ((size_t __size))
+       __attribute_malloc__;
+
+/* Underlying allocation function; successive calls should return
+   contiguous pieces of memory.  */
+extern __malloc_ptr_t (*__morecore) __MALLOC_PMT ((ptrdiff_t __size));
+
+/* Default value of `__morecore'.  */
+extern __malloc_ptr_t __default_morecore __MALLOC_P ((ptrdiff_t __size))
+       __attribute_malloc__;
+
+/* SVID2/XPG mallinfo structure */
+struct mallinfo {
+  int arena;    /* total space allocated from system */
+  int ordblks;  /* number of non-inuse chunks */
+  int smblks;   /* unused -- always zero */
+  int hblks;    /* number of mmapped regions */
+  int hblkhd;   /* total space in mmapped regions */
+  int usmblks;  /* unused -- always zero */
+  int fsmblks;  /* unused -- always zero */
+  int uordblks; /* total allocated space */
+  int fordblks; /* total non-inuse space */
+  int keepcost; /* top-most, releasable (via malloc_trim) space */
+};
+
+/* Returns a copy of the updated current mallinfo. */
+extern struct mallinfo mallinfo __MALLOC_P ((void));
+
+/* SVID2/XPG mallopt options */
+#ifndef M_MXFAST
+# define M_MXFAST  1	/* UNUSED in this malloc */
+#endif
+#ifndef M_NLBLKS
+# define M_NLBLKS  2	/* UNUSED in this malloc */
+#endif
+#ifndef M_GRAIN
+# define M_GRAIN   3	/* UNUSED in this malloc */
+#endif
+#ifndef M_KEEP
+# define M_KEEP    4	/* UNUSED in this malloc */
+#endif
+
+/* mallopt options that actually do something */
+#define M_TRIM_THRESHOLD    -1
+#define M_TOP_PAD           -2
+#define M_MMAP_THRESHOLD    -3
+#define M_MMAP_MAX          -4
+#define M_CHECK_ACTION      -5
+
+/* General SVID/XPG interface to tunable parameters. */
+extern int mallopt __MALLOC_P ((int __param, int __val));
+
+/* Release all but __pad bytes of freed top-most memory back to the
+   system. Return 1 if successful, else 0. */
+extern int malloc_trim __MALLOC_P ((size_t __pad));
+
+/* Report the number of usable allocated bytes associated with allocated
+   chunk __ptr. */
+extern size_t malloc_usable_size __MALLOC_P ((__malloc_ptr_t __ptr));
+
+/* Prints brief summary statistics on stderr. */
+extern void malloc_stats __MALLOC_P ((void));
+
+/* Record the state of all malloc variables in an opaque data structure. */
+extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void));
+
+/* Restore the state of all malloc variables from data obtained with
+   malloc_get_state(). */
+extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
+
+#if defined __GLIBC__ || defined MALLOC_HOOKS
+/* Called once when malloc is initialized; redefining this variable in
+   the application provides the preferred way to set up the hook
+   pointers. */
+extern void (*__malloc_initialize_hook) __MALLOC_PMT ((void));
+/* Hooks for debugging and user-defined versions. */
+extern void (*__free_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr,
+					__const __malloc_ptr_t));
+extern __malloc_ptr_t (*__malloc_hook) __MALLOC_PMT ((size_t __size,
+						    __const __malloc_ptr_t));
+extern __malloc_ptr_t (*__realloc_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr,
+						     size_t __size,
+						     __const __malloc_ptr_t));
+extern __malloc_ptr_t (*__memalign_hook) __MALLOC_PMT ((size_t __alignment,
+						      size_t __size,
+						      __const __malloc_ptr_t));
+extern void (*__after_morecore_hook) __MALLOC_PMT ((void));
+
+/* Activate a standard set of debugging hooks. */
+extern void __malloc_check_init __MALLOC_P ((void));
+#endif
+
+#ifdef __cplusplus
+}; /* end of extern "C" */
+#endif
+
+#endif /* malloc.h */

+ 34 - 1
include/memory.h

@@ -1 +1,34 @@
-#include <string.h>
+/* Copyright (C) 1991, 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ * SVID
+ */
+
+#ifndef	_MEMORY_H
+#define	_MEMORY_H	1
+
+#include <features.h>
+
+
+#ifndef	_STRING_H
+# include <string.h>
+#endif	/* string.h  */
+
+
+#endif	/* memory.h  */

+ 85 - 97
include/mntent.h

@@ -1,110 +1,98 @@
-#ifndef _MNTENT_H
-#define _MNTENT_H
+/* Utilities for reading/writing fstab, mtab, etc.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_MNTENT_H
+#define	_MNTENT_H	1
 
 #include <features.h>
+#define __need_FILE
+#include <stdio.h>
+#include <paths.h>
 
-#define MNTTAB "/etc/fstab"
-#define MOUNTED "/etc/mtab"
-
-#define MNTMAXSTR	512
-
-#define MNTTYPE_COHERENT	"coherent"	/* Coherent file system */
-#define MNTTYPE_EXT		"ext"		/* Extended file system */
-#define MNTTYPE_EXT2		"ext2"		/* Second Extended file system */
-#define MNTTYPE_HPFS		"hpfs"		/* OS/2's high performance file system */
-#define MNTTYPE_ISO9660		"iso9660"	/* ISO CDROM file system */
-#define MNTTYPE_MINIX		"minix"		/* MINIX file system */
-#define MNTTYPE_MSDOS		"msdos"		/* MS-DOS file system */
-#define	MNTTYPE_VFAT		"vfat"		/* VFAT (Win95) file system */
-#define MNTTYPE_SYSV		"sysv"		/* System V file system */
-#define MNTTYPE_UMSDOS		"umsdos"	/* U MS-DOS file system */
-#define MNTTYPE_XENIX		"xenix"		/* Xenix file system */
-#define MNTTYPE_XIAFS		"xiafs"		/* Frank Xia's file system */
-#define MNTTYPE_NFS		"nfs"		/* Network file system */
-#define MNTTYPE_PROC		"proc"		/* Linux process file system */
-#define MNTTYPE_IGNORE		"ignore"	/* Ignore this entry */
-#define MNTTYPE_SWAP		"swap"		/* Swap device */
-
-/* generic mount options */
-#define MNTOPT_DEFAULTS		"defaults"	/* use all default opts */
-#define MNTOPT_RO		"ro"		/* read only */
-#define MNTOPT_RW		"rw"		/* read/write */
-#define MNTOPT_SUID		"suid"		/* set uid allowed */
-#define MNTOPT_NOSUID		"nosuid"	/* no set uid allowed */
-#define MNTOPT_NOAUTO		"noauto"	/* don't auto mount */
-
-/* ext2 and msdos options */
-#define	MNTOPT_CHECK		"check"		/* filesystem check level */
-
-/* ext2 specific options */
-#define	MNTOPT_BSDDF		"bsddf"		/* disable MINIX compatibility disk free counting */
-#define	MNTOPT_BSDGROUPS	"bsdgroups"	/* set BSD group usage */
-#define	MNTOPT_ERRORS		"errors"	/* set behaviour on error */
-#define	MNTOPT_GRPID		"grpid"		/* set BSD group usage */
-#define	MNTOPT_MINIXDF		"minixdf"	/* enable MINIX compatibility disk free counting */
-#define	MNTOPT_NOCHECK		"nocheck"	/* reset filesystem checks */
-#define	MNTOPT_NOGRPID		"nogrpid"	/* set SYSV group usage */
-#define	MNTOPT_RESGID		"resgid"	/* group to consider like root for reserved blocks */
-#define	MNTOPT_RESUID		"resuid"	/* user to consider like root for reserved blocks */
-#define	MNTOPT_SB		"sb"		/* set used super block */
-#define	MNTOPT_SYSVGROUPS	"sysvgroups"	/* set SYSV group usage */
-
-/* options common to hpfs, isofs, and msdos */
-#define	MNTOPT_CONV		"conv"		/* convert specified types of data */
-#define	MNTOPT_GID		"gid"		/* use given gid */
-#define	MNTOPT_UID		"uid"		/* use given uid */
-#define	MNTOPT_UMASK		"umask"		/* use given umask, not isofs */
-
-/* hpfs specific options */
-#define	MNTOPT_CASE		"case"		/* case conversation */
-
-/* isofs specific options */
-#define	MNTOPT_BLOCK		"block"		/* use given block size */
-#define	MNTOPT_CRUFT		"cruft"		/* ??? */
-#define	MNTOPT_MAP		"map"		/* ??? */
-#define	MNTOPT_NOROCK		"norock"	/* not rockwell format ??? */
-
-/* msdos specific options */
-#define	MNTOPT_FAT		"fat"		/* set FAT size */
-#define	MNTOPT_QUIET		"quiet"		/* ??? */
-
-/* swap specific options */
-
-/* options common to ext, ext2, minix, xiafs, sysv, xenix, coherent */
-#define MNTOPT_NOQUOTA		"noquota"	/* don't use any quota on this partition */
-#define MNTOPT_USRQUOTA		"usrquota"	/* use userquota on this partition */
-#define MNTOPT_GRPQUOTA		"grpquota"	/* use groupquota on this partition */
-
-/* none defined yet */
 
-__BEGIN_DECLS
+/* File listing canonical interesting mount points.  */
+#define	MNTTAB		_PATH_MNTTAB	/* Deprecated alias.  */
 
-struct mntent{
-	char *mnt_fsname;
-	char *mnt_dir;
-	char *mnt_type;
-	char *mnt_opts;
-	int  mnt_freq;
-	int  mnt_passno;
-};
+/* File listing currently active mount points.  */
+#define	MOUNTED		_PATH_MOUNTED	/* Deprecated alias.  */
 
-__END_DECLS
 
-#define __need_file
-#include <stdio.h>
+/* General filesystem types.  */
+#define MNTTYPE_IGNORE	"ignore"	/* Ignore this entry.  */
+#define MNTTYPE_NFS	"nfs"		/* Network file system.  */
+#define MNTTYPE_SWAP	"swap"		/* Swap device.  */
+
+
+/* Generic mount options.  */
+#define MNTOPT_DEFAULTS	"defaults"	/* Use all default options.  */
+#define MNTOPT_RO	"ro"		/* Read only.  */
+#define MNTOPT_RW	"rw"		/* Read/write.  */
+#define MNTOPT_SUID	"suid"		/* Set uid allowed.  */
+#define MNTOPT_NOSUID	"nosuid"	/* No set uid allowed.  */
+#define MNTOPT_NOAUTO	"noauto"	/* Do not auto mount.  */
+
 
 __BEGIN_DECLS
 
-extern FILE	*setmntent __P ((__const char *__filep,
-			__const char *__type));
-extern struct mntent
-		*getmntent __P ((FILE *__filep));
-extern int	addmntent __P ((FILE *__filep,
-			__const struct mntent *__mnt));
-extern char	*hasmntopt __P ((__const struct mntent *__mnt,
-			__const char *__opt));
-extern int	endmntent __P ((FILE *__filep));
+/* Structure describing a mount table entry.  */
+struct mntent
+  {
+    char *mnt_fsname;		/* Device or server for filesystem.  */
+    char *mnt_dir;		/* Directory mounted on.  */
+    char *mnt_type;		/* Type of filesystem: ufs, nfs, etc.  */
+    char *mnt_opts;		/* Comma-separated options for fs.  */
+    int mnt_freq;		/* Dump frequency (in days).  */
+    int mnt_passno;		/* Pass number for `fsck'.  */
+  };
+
+
+/* Prepare to begin reading and/or writing mount table entries from the
+   beginning of FILE.  MODE is as for `fopen'.  */
+extern FILE *setmntent (__const char *__file, __const char *__mode) __THROW;
+
+/* Read one mount table entry from STREAM.  Returns a pointer to storage
+   reused on the next call, or null for EOF or error (use feof/ferror to
+   check).  */
+extern struct mntent *getmntent (FILE *__stream) __THROW;
+
+#ifdef __USE_MISC
+/* Reentrant version of the above function.  */
+extern struct mntent *getmntent_r (FILE *__restrict __stream,
+				   struct mntent *__restrict __result,
+				   char *__restrict __buffer,
+				   int __bufsize) __THROW;
+#endif
+
+/* Write the mount table entry described by MNT to STREAM.
+   Return zero on success, nonzero on failure.  */
+extern int addmntent (FILE *__restrict __stream,
+		      __const struct mntent *__restrict __mnt) __THROW;
+
+/* Close a stream opened with `setmntent'.  */
+extern int endmntent (FILE *__stream) __THROW;
+
+/* Search MNT->mnt_opts for an option matching OPT.
+   Returns the address of the substring, or null if none found.  */
+extern char *hasmntopt (__const struct mntent *__mnt,
+			__const char *__opt) __THROW;
+
 
 __END_DECLS
 
-#endif /* _MNTENT_H */
+#endif	/* mntent.h */

+ 8 - 8
include/net/ethernet.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /* Based on the FreeBSD version of this file. Curiously, that file
    lacks a copyright in the header. */

+ 74 - 62
include/net/if.h

@@ -1,67 +1,82 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* net/if.h -- declarations for inquiring about network interfaces
+   Copyright (C) 1997,98,99,2000,2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _NET_IF_H
-
 #define _NET_IF_H	1
+
 #include <features.h>
 
-#include <sys/types.h>
-#include <sys/socket.h>
+#ifdef __USE_MISC
+# include <sys/types.h>
+# include <sys/socket.h>
+#endif
+
+
+/* Length of interface name.  */
+#define IF_NAMESIZE	16
+
+struct if_nameindex
+  {
+    unsigned int if_index;	/* 1, 2, ... */
+    char *if_name;		/* null terminated name: "eth0", ... */
+  };
+
 
+#ifdef __USE_MISC
 /* Standard interface flags. */
 enum
   {
     IFF_UP = 0x1,		/* Interface is up.  */
-#define IFF_UP	IFF_UP
+# define IFF_UP	IFF_UP
     IFF_BROADCAST = 0x2,	/* Broadcast address valid.  */
-#define IFF_BROADCAST	IFF_BROADCAST
+# define IFF_BROADCAST	IFF_BROADCAST
     IFF_DEBUG = 0x4,		/* Turn on debugging.  */
-#define IFF_DEBUG	IFF_DEBUG
+# define IFF_DEBUG	IFF_DEBUG
     IFF_LOOPBACK = 0x8,		/* Is a loopback net.  */
-#define IFF_LOOPBACK	IFF_LOOPBACK
+# define IFF_LOOPBACK	IFF_LOOPBACK
     IFF_POINTOPOINT = 0x10,	/* Interface is point-to-point link.  */
-#define IFF_POINTOPOINT	IFF_POINTOPOINT
+# define IFF_POINTOPOINT IFF_POINTOPOINT
     IFF_NOTRAILERS = 0x20,	/* Avoid use of trailers.  */
-#define IFF_NOTRAILERS	IFF_NOTRAILERS
+# define IFF_NOTRAILERS	IFF_NOTRAILERS
     IFF_RUNNING = 0x40,		/* Resources allocated.  */
-#define IFF_RUNNING	IFF_RUNNING
+# define IFF_RUNNING	IFF_RUNNING
     IFF_NOARP = 0x80,		/* No address resolution protocol.  */
-#define IFF_NOARP	IFF_NOARP
+# define IFF_NOARP	IFF_NOARP
     IFF_PROMISC = 0x100,	/* Receive all packets.  */
-#define IFF_PROMISC	IFF_PROMISC
+# define IFF_PROMISC	IFF_PROMISC
 
     /* Not supported */
     IFF_ALLMULTI = 0x200,	/* Receive all multicast packets.  */
-#define IFF_ALLMULTI	IFF_ALLMULTI
+# define IFF_ALLMULTI	IFF_ALLMULTI
 
     IFF_MASTER = 0x400,		/* Master of a load balancer.  */
-#define IFF_MASTER	IFF_MASTER
+# define IFF_MASTER	IFF_MASTER
     IFF_SLAVE = 0x800,		/* Slave of a load balancer.  */
-#define IFF_SLAVE	IFF_SLAVE
+# define IFF_SLAVE	IFF_SLAVE
 
     IFF_MULTICAST = 0x1000,	/* Supports multicast.  */
-#define IFF_MULTICAST	IFF_MULTICAST
+# define IFF_MULTICAST	IFF_MULTICAST
 
     IFF_PORTSEL = 0x2000,	/* Can set media type.  */
-#define IFF_PORTSEL	IFF_PORTSEL
+# define IFF_PORTSEL	IFF_PORTSEL
     IFF_AUTOMEDIA = 0x4000	/* Auto media select active.  */
-#define IFF_AUTOMEDIA	IFF_AUTOMEDIA
+# define IFF_AUTOMEDIA	IFF_AUTOMEDIA
   };
 
 /* The ifaddr structure contains information about one address of an
@@ -81,8 +96,8 @@ struct ifaddr
     struct ifaddr *ifa_next;	/* Next address for interface.  */
   };
 
-#define	ifa_broadaddr	ifa_ifu.ifu_broadaddr	/* broadcast address	*/
-#define	ifa_dstaddr	ifa_ifu.ifu_dstaddr	/* other end of link	*/
+# define ifa_broadaddr	ifa_ifu.ifu_broadaddr	/* broadcast address	*/
+# define ifa_dstaddr	ifa_ifu.ifu_dstaddr	/* other end of link	*/
 
 /* Device mapping structure. I'd just gone off and designed a
    beautiful scheme using only loadable modules with arguments for
@@ -109,8 +124,8 @@ struct ifmap
 
 struct ifreq
   {
-#define IFHWADDRLEN	6
-#define	IFNAMSIZ	16
+# define IFHWADDRLEN	6
+# define IFNAMSIZ	IF_NAMESIZE
     union
       {
 	char ifrn_name[IFNAMSIZ];	/* Interface name, e.g. "en0".  */
@@ -128,25 +143,29 @@ struct ifreq
 	int ifru_mtu;
 	struct ifmap ifru_map;
 	char ifru_slave[IFNAMSIZ];	/* Just fits the size */
+	char ifru_newname[IFNAMSIZ];
 	__caddr_t ifru_data;
       } ifr_ifru;
   };
-
-#define ifr_name	ifr_ifrn.ifrn_name	/* interface name 	*/
-#define ifr_hwaddr	ifr_ifru.ifru_hwaddr	/* MAC address 		*/
-#define	ifr_addr	ifr_ifru.ifru_addr	/* address		*/
-#define	ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-p lnk	*/
-#define	ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address	*/
-#define	ifr_netmask	ifr_ifru.ifru_netmask	/* interface net mask	*/
-#define	ifr_flags	ifr_ifru.ifru_flags	/* flags		*/
-#define	ifr_metric	ifr_ifru.ifru_ivalue	/* metric		*/
-#define	ifr_mtu		ifr_ifru.ifru_mtu	/* mtu			*/
-#define ifr_map		ifr_ifru.ifru_map	/* device map		*/
-#define ifr_slave	ifr_ifru.ifru_slave	/* slave device		*/
-#define	ifr_data	ifr_ifru.ifru_data	/* for use by interface	*/
-#define ifr_ifindex	ifr_ifru.ifru_ivalue    /* interface index      */
-#define ifr_bandwidth	ifr_ifru.ifru_ivalue	/* link bandwidth	*/
-#define ifr_qlen	ifr_ifru.ifru_ivalue	/* queue length		*/
+# define ifr_name	ifr_ifrn.ifrn_name	/* interface name 	*/
+# define ifr_hwaddr	ifr_ifru.ifru_hwaddr	/* MAC address 		*/
+# define ifr_addr	ifr_ifru.ifru_addr	/* address		*/
+# define ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-p lnk	*/
+# define ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address	*/
+# define ifr_netmask	ifr_ifru.ifru_netmask	/* interface net mask	*/
+# define ifr_flags	ifr_ifru.ifru_flags	/* flags		*/
+# define ifr_metric	ifr_ifru.ifru_ivalue	/* metric		*/
+# define ifr_mtu	ifr_ifru.ifru_mtu	/* mtu			*/
+# define ifr_map	ifr_ifru.ifru_map	/* device map		*/
+# define ifr_slave	ifr_ifru.ifru_slave	/* slave device		*/
+# define ifr_data	ifr_ifru.ifru_data	/* for use by interface	*/
+# define ifr_ifindex	ifr_ifru.ifru_ivalue    /* interface index      */
+# define ifr_bandwidth	ifr_ifru.ifru_ivalue	/* link bandwidth	*/
+# define ifr_qlen	ifr_ifru.ifru_ivalue	/* queue length		*/
+# define ifr_newname	ifr_ifru.ifru_newname	/* New name		*/
+# define _IOT_ifreq	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0)
+# define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0)
+# define _IOT_ifreq_int	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
 
 
 /* Structure used in SIOCGIFCONF request.  Used to retrieve interface
@@ -162,29 +181,22 @@ struct ifconf
 	struct ifreq *ifcu_req;
       } ifc_ifcu;
   };
-#define	ifc_buf	ifc_ifcu.ifcu_buf	/* Buffer address.  */
-#define	ifc_req	ifc_ifcu.ifcu_req	/* Array of structures.  */
+# define ifc_buf	ifc_ifcu.ifcu_buf	/* Buffer address.  */
+# define ifc_req	ifc_ifcu.ifcu_req	/* Array of structures.  */
+# define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0) /* not right */
+#endif	/* Misc.  */
 
 __BEGIN_DECLS
 
 /* Convert an interface name to an index, and vice versa.  */
-
-extern unsigned int if_nametoindex __P ((__const char *__ifname));
-extern char *if_indextoname __P ((unsigned int __ifindex, char *__ifname));
+extern unsigned int if_nametoindex (__const char *__ifname) __THROW;
+extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW;
 
 /* Return a list of all interfaces and their indices.  */
-
-struct if_nameindex
-  {
-    unsigned int if_index;	/* 1, 2, ... */
-    char *if_name;		/* null terminated name: "eth0", ... */
-  };
-
-extern struct if_nameindex *if_nameindex __P ((void));
+extern struct if_nameindex *if_nameindex (void) __THROW;
 
 /* Free the data returned from if_nameindex.  */
-
-extern void if_freenameindex __P ((struct if_nameindex *__ptr));
+extern void if_freenameindex (struct if_nameindex *__ptr) __THROW;
 
 __END_DECLS
 

+ 15 - 12
include/net/if_arp.h

@@ -1,22 +1,22 @@
 /* Definitions for Address Resolution Protocol.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /* Based on the 4.4BSD and Linux version of this file.  */
 
@@ -93,10 +93,13 @@ struct arphdr
 #define ARPHRD_ADAPT	264
 #define ARPHRD_ROSE	270
 #define ARPHRD_X25	271		/* CCITT X.25.  */
+#define ARPHDR_HWX25	272		/* Boards with X.25 in firmware.  */
 #define ARPHRD_PPP	512
-#define ARPHRD_HDLC	513		/* (Cisco) HDLC.  */
+#define ARPHRD_CISCO	513		/* Cisco HDLC.  */
+#define ARPHRD_HDLC	ARPHRD_CISCO
 #define ARPHRD_LAPB	516		/* LAPB.  */
 #define ARPHRD_DDCMP	517		/* Digital's DDCMP.  */
+#define	ARPHRD_RAWHDLC	518		/* Raw HDLC.  */
 
 #define ARPHRD_TUNNEL	768		/* IPIP tunnel.  */
 #define ARPHRD_TUNNEL6	769		/* IPIP6 tunnel.  */
@@ -113,13 +116,13 @@ struct arphdr
 #define ARPHRD_HIPPI	780		/* High Performance Parallel I'face. */
 #define ARPHRD_ASH	781		/* (Nexus Electronics) Ash.  */
 #define ARPHRD_ECONET	782		/* Acorn Econet.  */
-#define ARPHRD_IRDA	783		/* Linux/IR.  */
+#define ARPHRD_IRDA	783		/* Linux-IrDA.  */
 #define ARPHRD_FCPP	784		/* Point to point fibrechanel.  */
 #define ARPHRD_FCAL	785		/* Fibrechanel arbitrated loop.  */
 #define ARPHRD_FCPL	786		/* Fibrechanel public loop.  */
 #define ARPHRD_FCPFABRIC 787		/* Fibrechanel fabric.  */
 #define ARPHRD_IEEE802_TR 800		/* Magic type ident for TR.  */
-
+#define ARPHRD_IEEE80211 801		/* IEEE 802.11.  */
 
 /* ARP ioctl request.  */
 struct arpreq

+ 8 - 8
include/net/if_packet.h

@@ -3,19 +3,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef __IF_PACKET_H
 #define __IF_PACKET_H

+ 8 - 8
include/net/if_shaper.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _NET_IF_SHAPER_H
 #define _NET_IF_SHAPER_H 1

+ 8 - 8
include/net/if_slip.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _NET_IF_SLIP_H
 #define _NET_IF_SLIP_H 1

+ 1 - 1
include/net/pppio.h

@@ -24,7 +24,7 @@
  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
  * OR MODIFICATIONS.
  *
- * $Id: pppio.h,v 1.1 2001/01/16 10:03:48 andersen Exp $
+ * $Id: pppio.h,v 1.2 2001/09/27 05:21:12 andersen Exp $
  */
 
 #define _PPPIO(n)	(('p' << 8) + (n))

+ 8 - 8
include/net/route.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /* Based on the 4.4BSD and Linux version of this file.  */
 

+ 1 - 5
include/net/slcompress.h

@@ -1,7 +1,7 @@
 /*
  * Definitions for tcp compression routines.
  *
- * $Id: slcompress.h,v 1.2 2001/07/11 13:47:42 davidm Exp $
+ * $Id: slcompress.h,v 1.3 2001/09/27 05:21:12 andersen Exp $
  *
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.
@@ -137,8 +137,6 @@ struct slcompress {
 /* flag values */
 #define SLF_TOSS 1		/* tossing rcvd frames because of input err */
 
-__BEGIN_DECLS
-
 void	sl_compress_init __P((struct slcompress *));
 void	sl_compress_setup __P((struct slcompress *, int));
 u_int	sl_compress_tcp __P((struct mbuf *,
@@ -147,6 +145,4 @@ int	sl_uncompress_tcp __P((u_char **, int, u_int, struct slcompress *));
 int	sl_uncompress_tcp_core __P((u_char *, int, int, u_int,
 	    struct slcompress *, u_char **, u_int *));
 
-__END_DECLS
-
 #endif /* _SLCOMPRESS_H_ */

+ 1 - 5
include/net/vjcompress.h

@@ -1,7 +1,7 @@
 /*
  * Definitions for tcp compression routines.
  *
- * $Id: vjcompress.h,v 1.2 2001/07/11 13:47:42 davidm Exp $
+ * $Id: vjcompress.h,v 1.3 2001/09/27 05:21:12 andersen Exp $
  *
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.
@@ -130,8 +130,6 @@ struct vjcompress {
 /* flag values */
 #define VJF_TOSS 1		/* tossing rcvd frames because of input err */
 
-__BEGIN_DECLS
-
 extern void  vj_compress_init __P((struct vjcompress *comp, int max_state));
 extern u_int vj_compress_tcp __P((struct ip *ip, u_int mlen,
 				struct vjcompress *comp, int compress_cid_flag,
@@ -143,6 +141,4 @@ extern int   vj_uncompress_tcp __P((u_char *buf, int buflen, int total_len,
 				struct vjcompress *comp, u_char **hdrp,
 				u_int *hlenp));
 
-__END_DECLS
-
 #endif /* _VJCOMPRESS_H_ */

+ 497 - 196
include/netdb.h

@@ -1,221 +1,522 @@
-/*-
- * Copyright (c) 1980, 1983, 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)netdb.h	8.1 (Berkeley) 6/2/93
- *      netdb.h,v 1.4 1995/08/14 04:05:04 hjl Exp
- * -
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
- * Permission to use, copy, modify and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- * -
- * --Copyright--
- */
-
-#ifndef _NETDB_H_
-#define _NETDB_H_
-
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
-#include <stdio.h>
+/* Copyright (C) 1996,1997,1998,1999,2000,2001 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* All data returned by the network data base library are supplied in
+   host order and returned in network order (suitable for use in
+   system calls).  */
+
+#ifndef	_NETDB_H
+#define	_NETDB_H	1
+
+#include <features.h>
+
 #include <netinet/in.h>
+#include <stdint.h>
+#ifdef __USE_MISC
+/* This is necessary to make this include file properly replace the
+   Sun version.  */
+# include <rpc/netdb.h>
+#endif
+
+#ifdef __USE_GNU
+# define __need_sigevent_t
+# include <bits/siginfo.h>
+# define __need_timespec
+# include <time.h>
+#endif
+
+#include <bits/netdb.h>
+
+/* Absolute file name for network data base files.  */
+#define	_PATH_HEQUIV		"/etc/hosts.equiv"
+#define	_PATH_HOSTS		"/etc/hosts"
+#define	_PATH_NETWORKS		"/etc/networks"
+#define	_PATH_NSSWITCH_CONF	"/etc/nsswitch.conf"
+#define	_PATH_PROTOCOLS		"/etc/protocols"
+#define	_PATH_SERVICES		"/etc/services"
+
+
+__BEGIN_DECLS
+
+/* Error status for non-reentrant lookup functions. 
+ * NOTE: uClibc reuses errno for h_errno. */
+#include <errno.h>
+#define h_errno errno
+
+
+#if 0
+/* Function to get address of global `h_errno' variable.  */
+extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
+
+#ifdef _LIBC
+# ifdef _LIBC_REENTRANT
+static inline int
+__set_h_errno (int __err)
+{
+  return *__h_errno_location () = __err;
+}
+# else
+#  define __set_h_errno(x) (h_errno = (x))
+# endif	/* _LIBC_REENTRANT */
+#endif /* _LIBC */
+
+
+#if !defined _LIBC || defined _LIBC_REENTRANT
+/* Use a macro to access always the thread specific `h_errno' variable.  */
+# define h_errno (*__h_errno_location ())
+#endif
 #endif
 
-#include <paths.h>
-
-#define __PATH_ETC_INET	"/etc"
-#define _PATH_HEQUIV	__PATH_ETC_INET"/hosts.equiv"
-#define _PATH_HOSTS	__PATH_ETC_INET"/hosts"
-#define _PATH_NETWORKS	__PATH_ETC_INET"/networks"
-#define _PATH_PROTOCOLS	__PATH_ETC_INET"/protocols"
-#define _PATH_SERVICES	__PATH_ETC_INET"/services"
-#define _PATH_RESCONF	__PATH_ETC_INET"/resolv.conf"
-#define _PATH_RPC	__PATH_ETC_INET"/rpc"
-
-
-/*
- * Structures returned by network data base library.  All addresses are
- * supplied in host order, and returned in network order (suitable for
- * use in system calls).
- */
-struct	hostent {
-	char	*h_name;	/* official name of host */
-	char	**h_aliases;	/* alias list */
-	int	h_addrtype;	/* host address type */
-	int	h_length;	/* length of address */
-	char	**h_addr_list;	/* list of addresses from name server */
-#define	h_addr	h_addr_list[0]	/* address, for backward compatiblity */
+
+/* Possible values left in `h_errno'.  */
+#define	NETDB_INTERNAL	-1	/* See errno.  */
+#define	NETDB_SUCCESS	0	/* No problem.  */
+#define	HOST_NOT_FOUND	1	/* Authoritative Answer Host not found.  */
+#define	TRY_AGAIN	2	/* Non-Authoritative Host not found,
+				   or SERVERFAIL.  */
+#define	NO_RECOVERY	3	/* Non recoverable errors, FORMERR, REFUSED,
+				   NOTIMP.  */
+#define	NO_DATA		4	/* Valid name, no data record of requested
+				   type.  */
+#define	NO_ADDRESS	NO_DATA	/* No address, look for MX record.  */
+
+#ifdef __USE_XOPEN2K
+/* Highest reserved Internet port number.  */
+# define IPPORT_RESERVED	1024
+#endif
+
+#ifdef __USE_GNU
+/* Scope delimiter for getaddrinfo(), getnameinfo().  */
+# define SCOPE_DELIMITER	'%'
+#endif
+
+/* Print error indicated by `h_errno' variable on standard error.  STR
+   if non-null is printed before the error string.  */
+extern void herror (__const char *__str) __THROW;
+
+/* Return string associated with error ERR_NUM.  */
+extern __const char *hstrerror (int __err_num) __THROW;
+
+
+
+/* Description of data base entry for a single host.  */
+struct hostent
+{
+  char *h_name;			/* Official name of host.  */
+  char **h_aliases;		/* Alias list.  */
+  int h_addrtype;		/* Host address type.  */
+  int h_length;			/* Length of address.  */
+  char **h_addr_list;		/* List of addresses from name server.  */
+#define	h_addr	h_addr_list[0]	/* Address, for backward compatibility.  */
 };
 
-/*
- * Assumption here is that a network number
- * fits in an unsigned long -- probably a poor one.
- */
-struct	netent {
-	char		*n_name;	/* official name of net */
-	char		**n_aliases;	/* alias list */
-	int		n_addrtype;	/* net address type */
-	unsigned long	n_net;		/* network # */
+/* Open host data base files and mark them as staying open even after
+   a later search if STAY_OPEN is non-zero.  */
+extern void sethostent (int __stay_open) __THROW;
+
+/* Close host data base files and clear `stay open' flag.  */
+extern void endhostent (void) __THROW;
+
+/* Get next entry from host data base file.  Open data base if
+   necessary.  */
+extern struct hostent *gethostent (void) __THROW;
+
+/* Return entry from host data base which address match ADDR with
+   length LEN and type TYPE.  */
+extern struct hostent *gethostbyaddr (__const void *__addr, __socklen_t __len,
+				      int __type) __THROW;
+
+/* Return entry from host data base for host with NAME.  */
+extern struct hostent *gethostbyname (__const char *__name) __THROW;
+
+#ifdef __USE_MISC
+/* Return entry from host data base for host with NAME.  AF must be
+   set to the address type which is `AF_INET' for IPv4 or `AF_INET6'
+   for IPv6.  */
+extern struct hostent *gethostbyname2 (__const char *__name, int __af) __THROW;
+
+/* Reentrant versions of the functions above.  The additional
+   arguments specify a buffer of BUFLEN starting at BUF.  The last
+   argument is a pointer to a variable which gets the value which
+   would be stored in the global variable `herrno' by the
+   non-reentrant functions.  */
+extern int gethostent_r (struct hostent *__restrict __result_buf,
+			 char *__restrict __buf, size_t __buflen,
+			 struct hostent **__restrict __result,
+			 int *__restrict __h_errnop) __THROW;
+
+extern int gethostbyaddr_r (__const void *__restrict __addr, __socklen_t __len,
+			    int __type,
+			    struct hostent *__restrict __result_buf,
+			    char *__restrict __buf, size_t __buflen,
+			    struct hostent **__restrict __result,
+			    int *__restrict __h_errnop) __THROW;
+
+extern int gethostbyname_r (__const char *__restrict __name,
+			    struct hostent *__restrict __result_buf,
+			    char *__restrict __buf, size_t __buflen,
+			    struct hostent **__restrict __result,
+			    int *__restrict __h_errnop) __THROW;
+
+extern int gethostbyname2_r (__const char *__restrict __name, int __af,
+			     struct hostent *__restrict __result_buf,
+			     char *__restrict __buf, size_t __buflen,
+			     struct hostent **__restrict __result,
+			     int *__restrict __h_errnop) __THROW;
+#endif	/* misc */
+
+
+/* Open network data base files and mark them as staying open even
+   after a later search if STAY_OPEN is non-zero.  */
+extern void setnetent (int __stay_open) __THROW;
+
+/* Close network data base files and clear `stay open' flag.  */
+extern void endnetent (void) __THROW;
+
+/* Get next entry from network data base file.  Open data base if
+   necessary.  */
+extern struct netent *getnetent (void) __THROW;
+
+/* Return entry from network data base which address match NET and
+   type TYPE.  */
+extern struct netent *getnetbyaddr (uint32_t __net, int __type)
+     __THROW;
+
+/* Return entry from network data base for network with NAME.  */
+extern struct netent *getnetbyname (__const char *__name) __THROW;
+
+#ifdef	__USE_MISC
+/* Reentrant versions of the functions above.  The additional
+   arguments specify a buffer of BUFLEN starting at BUF.  The last
+   argument is a pointer to a variable which gets the value which
+   would be stored in the global variable `herrno' by the
+   non-reentrant functions.  */
+extern int getnetent_r (struct netent *__restrict __result_buf,
+			char *__restrict __buf, size_t __buflen,
+			struct netent **__restrict __result,
+			int *__restrict __h_errnop) __THROW;
+
+extern int getnetbyaddr_r (uint32_t __net, int __type,
+			   struct netent *__restrict __result_buf,
+			   char *__restrict __buf, size_t __buflen,
+			   struct netent **__restrict __result,
+			   int *__restrict __h_errnop) __THROW;
+
+extern int getnetbyname_r (__const char *__restrict __name,
+			   struct netent *__restrict __result_buf,
+			   char *__restrict __buf, size_t __buflen,
+			   struct netent **__restrict __result,
+			   int *__restrict __h_errnop) __THROW;
+#endif	/* misc */
+
+
+/* Description of data base entry for a single service.  */
+struct servent
+{
+  char *s_name;			/* Official service name.  */
+  char **s_aliases;		/* Alias list.  */
+  int s_port;			/* Port number.  */
+  char *s_proto;		/* Protocol to use.  */
 };
 
-struct	servent {
-	char	*s_name;	/* official service name */
-	char	**s_aliases;	/* alias list */
-	int	s_port;		/* port # */
-	char	*s_proto;	/* protocol to use */
+/* Open service data base files and mark them as staying open even
+   after a later search if STAY_OPEN is non-zero.  */
+extern void setservent (int __stay_open) __THROW;
+
+/* Close service data base files and clear `stay open' flag.  */
+extern void endservent (void) __THROW;
+
+/* Get next entry from service data base file.  Open data base if
+   necessary.  */
+extern struct servent *getservent (void) __THROW;
+
+/* Return entry from network data base for network with NAME and
+   protocol PROTO.  */
+extern struct servent *getservbyname (__const char *__name,
+				      __const char *__proto) __THROW;
+
+/* Return entry from service data base which matches port PORT and
+   protocol PROTO.  */
+extern struct servent *getservbyport (int __port, __const char *__proto)
+     __THROW;
+
+
+#ifdef	__USE_MISC
+/* Reentrant versions of the functions above.  The additional
+   arguments specify a buffer of BUFLEN starting at BUF.  */
+extern int getservent_r (struct servent *__restrict __result_buf,
+			 char *__restrict __buf, size_t __buflen,
+			 struct servent **__restrict __result) __THROW;
+
+extern int getservbyname_r (__const char *__restrict __name,
+			    __const char *__restrict __proto,
+			    struct servent *__restrict __result_buf,
+			    char *__restrict __buf, size_t __buflen,
+			    struct servent **__restrict __result) __THROW;
+
+extern int getservbyport_r (int __port, __const char *__restrict __proto,
+			    struct servent *__restrict __result_buf,
+			    char *__restrict __buf, size_t __buflen,
+			    struct servent **__restrict __result) __THROW;
+#endif	/* misc */
+
+
+/* Description of data base entry for a single service.  */
+struct protoent
+{
+  char *p_name;			/* Official protocol name.  */
+  char **p_aliases;		/* Alias list.  */
+  int p_proto;			/* Protocol number.  */
 };
 
-struct	protoent {
-	char	*p_name;	/* official protocol name */
-	char	**p_aliases;	/* alias list */
-	int	p_proto;	/* protocol # */
+/* Open protocol data base files and mark them as staying open even
+   after a later search if STAY_OPEN is non-zero.  */
+extern void setprotoent (int __stay_open) __THROW;
+
+/* Close protocol data base files and clear `stay open' flag.  */
+extern void endprotoent (void) __THROW;
+
+/* Get next entry from protocol data base file.  Open data base if
+   necessary.  */
+extern struct protoent *getprotoent (void) __THROW;
+
+/* Return entry from protocol data base for network with NAME.  */
+extern struct protoent *getprotobyname (__const char *__name) __THROW;
+
+/* Return entry from protocol data base which number is PROTO.  */
+extern struct protoent *getprotobynumber (int __proto) __THROW;
+
+
+#ifdef	__USE_MISC
+/* Reentrant versions of the functions above.  The additional
+   arguments specify a buffer of BUFLEN starting at BUF.  */
+extern int getprotoent_r (struct protoent *__restrict __result_buf,
+			  char *__restrict __buf, size_t __buflen,
+			  struct protoent **__restrict __result) __THROW;
+
+extern int getprotobyname_r (__const char *__restrict __name,
+			     struct protoent *__restrict __result_buf,
+			     char *__restrict __buf, size_t __buflen,
+			     struct protoent **__restrict __result) __THROW;
+
+extern int getprotobynumber_r (int __proto,
+			       struct protoent *__restrict __result_buf,
+			       char *__restrict __buf, size_t __buflen,
+			       struct protoent **__restrict __result) __THROW;
+#endif	/* misc */
+
+
+/* Establish network group NETGROUP for enumeration.  */
+extern int setnetgrent (__const char *__netgroup) __THROW;
+
+/* Free all space allocated by previous `setnetgrent' call.  */
+extern void endnetgrent (void) __THROW;
+
+/* Get next member of netgroup established by last `setnetgrent' call
+   and return pointers to elements in HOSTP, USERP, and DOMAINP.  */
+extern int getnetgrent (char **__restrict __hostp,
+			char **__restrict __userp,
+			char **__restrict __domainp) __THROW;
+
+#ifdef	__USE_MISC
+/* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).  */
+extern int innetgr (__const char *__netgroup, __const char *__host,
+		    __const char *__user, __const char *domain) __THROW;
+
+/* Reentrant version of `getnetgrent' where result is placed in BUFFER.  */
+extern int getnetgrent_r (char **__restrict __hostp,
+			  char **__restrict __userp,
+			  char **__restrict __domainp,
+			  char *__restrict __buffer, size_t __buflen) __THROW;
+#endif	/* misc */
+
+
+#ifdef __USE_BSD
+/* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
+   The local user is LOCUSER, on the remote machine the command is
+   executed as REMUSER.  In *FD2P the descriptor to the socket for the
+   connection is returned.  The caller must have the right to use a
+   reserved port.  When the function returns *AHOST contains the
+   official host name.  */
+extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
+		 __const char *__restrict __locuser,
+		 __const char *__restrict __remuser,
+		 __const char *__restrict __cmd, int *__restrict __fd2p)
+     __THROW;
+
+/* This is the equivalent function where the protocol can be selected
+   and which therefore can be used for IPv6.  */
+extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
+		    __const char *__restrict __locuser,
+		    __const char *__restrict __remuser,
+		    __const char *__restrict __cmd, int *__restrict __fd2p,
+		    sa_family_t __af) __THROW;
+
+/* Call `rexecd' at port RPORT on remote machine *AHOST to execute
+   CMD.  The process runs at the remote machine using the ID of user
+   NAME whose cleartext password is PASSWD.  In *FD2P the descriptor
+   to the socket for the connection is returned.  When the function
+   returns *AHOST contains the official host name.  */
+extern int rexec (char **__restrict __ahost, int __rport,
+		  __const char *__restrict __name,
+		  __const char *__restrict __pass,
+		  __const char *__restrict __cmd, int *__restrict __fd2p)
+     __THROW;
+
+/* This is the equivalent function where the protocol can be selected
+   and which therefore can be used for IPv6.  */
+extern int rexec_af (char **__restrict __ahost, int __rport,
+		     __const char *__restrict __name,
+		     __const char *__restrict __pass,
+		     __const char *__restrict __cmd, int *__restrict __fd2p,
+		     sa_family_t __af) __THROW;
+
+/* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
+   If SUSER is not zero the user tries to become superuser.  Return 0 if
+   it is possible.  */
+extern int ruserok (__const char *__rhost, int __suser,
+		    __const char *__remuser, __const char *__locuser) __THROW;
+
+/* This is the equivalent function where the protocol can be selected
+   and which therefore can be used for IPv6.  */
+extern int ruserok_af (__const char *__rhost, int __suser,
+		       __const char *__remuser, __const char *__locuser,
+		       sa_family_t __af) __THROW;
+
+/* Try to allocate reserved port, returning a descriptor for a socket opened
+   at this port or -1 if unsuccessful.  The search for an available port
+   will start at ALPORT and continues with lower numbers.  */
+extern int rresvport (int *__alport) __THROW;
+
+/* This is the equivalent function where the protocol can be selected
+   and which therefore can be used for IPv6.  */
+extern int rresvport_af (int *__alport, sa_family_t __af) __THROW;
+#endif
+
+
+/* Extension from POSIX.1g.  */
+#ifdef	__USE_POSIX
+/* Structure to contain information about address of a service provider.  */
+struct addrinfo
+{
+  int ai_flags;			/* Input flags.  */
+  int ai_family;		/* Protocol family for socket.  */
+  int ai_socktype;		/* Socket type.  */
+  int ai_protocol;		/* Protocol for socket.  */
+  socklen_t ai_addrlen;		/* Length of socket address.  */
+  struct sockaddr *ai_addr;	/* Socket address for socket.  */
+  char *ai_canonname;		/* Canonical name for service location.  */
+  struct addrinfo *ai_next;	/* Pointer to next in list.  */
 };
 
-struct rpcent {
-	char	*r_name;	/* name of server for this rpc program */
-	char	**r_aliases;	/* alias list */
-	int	r_number;	/* rpc program number */
+# ifdef __USE_GNU
+/* Structure used as control block for asynchronous lookup.  */
+struct gaicb
+{
+  const char *ar_name;		/* Name to look up.  */
+  const char *ar_service;	/* Service name.  */
+  const struct addrinfo *ar_request; /* Additional request specification.  */
+  struct addrinfo *ar_result;	/* Pointer to result.  */
+  /* The following are internal elements.  */
+  int __return;
+  int __unused[5];
 };
 
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
+/* Lookup mode.  */
+#  define GAI_WAIT	0
+#  define GAI_NOWAIT	1
+# endif
 
-#define __NETDB_MAXALIASES	35
-#define __NETDB_MAXADDRS	35
+/* Possible values for `ai_flags' field in `addrinfo' structure.  */
+# define AI_PASSIVE	0x0001	/* Socket address is intended for `bind'.  */
+# define AI_CANONNAME	0x0002	/* Request for canonical name.  */
+# define AI_NUMERICHOST	0x0004	/* Don't use name resolution.  */
 
-#endif
+/* Error values for `getaddrinfo' function.  */
+# define EAI_BADFLAGS	  -1	/* Invalid value for `ai_flags' field.  */
+# define EAI_NONAME	  -2	/* NAME or SERVICE is unknown.  */
+# define EAI_AGAIN	  -3	/* Temporary failure in name resolution.  */
+# define EAI_FAIL	  -4	/* Non-recoverable failure in name res.  */
+# define EAI_NODATA	  -5	/* No address associated with NAME.  */
+# define EAI_FAMILY	  -6	/* `ai_family' not supported.  */
+# define EAI_SOCKTYPE	  -7	/* `ai_socktype' not supported.  */
+# define EAI_SERVICE	  -8	/* SERVICE not supported for `ai_socktype'.  */
+# define EAI_ADDRFAMILY	  -9	/* Address family for NAME not supported.  */
+# define EAI_MEMORY	  -10	/* Memory allocation failure.  */
+# define EAI_SYSTEM	  -11	/* System error returned in `errno'.  */
+# ifdef __USE_GNU
+#  define EAI_INPROGRESS  -100	/* Processing request in progress.  */
+#  define EAI_CANCELED	  -101	/* Request canceled.  */
+#  define EAI_NOTCANCELED -102	/* Request not canceled.  */
+#  define EAI_ALLDONE	  -103	/* All requests done.  */
+#  define EAI_INTR	  -104	/* Interrupted by a signal.  */
+# endif
 
-/*
- * Error return codes from gethostbyname() and gethostbyaddr()
- * (left in extern int h_errno).
- */
+# define NI_MAXHOST      1025
+# define NI_MAXSERV      32
 
-/* uClibc reuses errno for h_errno. */
-#include <errno.h>
-#define h_errno errno
+# define NI_NUMERICHOST	1	/* Don't try to look up hostname.  */
+# define NI_NUMERICSERV 2	/* Don't convert port number to name.  */
+# define NI_NOFQDN	4	/* Only return nodename portion.  */
+# define NI_NAMEREQD	8	/* Don't return numeric addresses.  */
+# define NI_DGRAM	16	/* Look up UDP service rather than TCP.  */
 
-#define	NETDB_INTERNAL -1 /* see errno */
-#define	NETDB_SUCCESS   0 /* no problem */
-#define	HOST_NOT_FOUND	1 /* Authoritative Answer Host not found */
-#define	TRY_AGAIN	2 /* Non-Authoritive Host not found, or SERVERFAIL */
-#define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
-#define	NO_DATA		4 /* Valid name, no data record of requested type */
-#define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
+/* Translate name of a service location and/or a service name to set of
+   socket addresses.  */
+extern int getaddrinfo (__const char *__restrict __name,
+			__const char *__restrict __service,
+			__const struct addrinfo *__restrict __req,
+			struct addrinfo **__restrict __pai) __THROW;
 
-#include <features.h>
+/* Free `addrinfo' structure AI including associated storage.  */
+extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
 
-__BEGIN_DECLS
+/* Convert error return from getaddrinfo() to a string.  */
+extern __const char *gai_strerror (int __ecode) __THROW;
 
-void		endhostent __P((void));
-void		endnetent __P((void));
-void		endprotoent __P((void));
-void		endservent __P((void));
-void		endrpcent __P ((void));
-struct hostent	*gethostbyaddr __P((__const char *, int, int));
-struct hostent	*gethostbyname __P((__const char *));
-struct hostent	*gethostbyname2 __P((__const char *, int));
-struct hostent	*gethostent __P((void));
-struct netent	*getnetbyaddr __P((long, int)); /* u_long? */
-struct netent	*getnetbyname __P((__const char *));
-struct netent	*getnetent __P((void));
-struct protoent	*getprotobyname __P((__const char *));
-struct protoent	*getprotobynumber __P((int));
-struct protoent	*getprotoent __P((void));
-struct servent	*getservbyname __P((__const char *, __const char *));
-struct servent	*getservbyport __P((int, __const char *));
-struct servent	*getservent __P((void));
-struct rpcent	*getrpcent __P((void));
-struct rpcent	*getrpcbyname __P((__const char *));
-struct rpcent	*getrpcbynumber __P((int));
-void		herror __P((__const char *));
-void		sethostent __P((int));
-/* void		sethostfile __P((__const char *)); */
-void		setnetent __P((int));
-void		setprotoent __P((int));
-void		setservent __P((int));
-void		setrpcent __P((int));
-
-#define hstrerror(x) strerror(x)
-
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
-struct hostent	*gethostbyaddr_r __P((const char *__addr,
-			int __length, int __type,
-			struct hostent *__result,
-			char *__buffer, int __buflen, int *__h_errnop));
-struct hostent	*gethostbyname_r __P((const char * __name,
-			struct hostent *__result, char *__buffer,
-			int __buflen, int *__h_errnop));
-struct hostent	*gethostent_r __P((struct hostent *__result,
-			char *__buffer, int __buflen, int *__h_errnop));
-struct netent	*getnetbyaddr_r __P((long __net, int __type,
-			struct netent *__result, char *__buffer,
-			int __buflen));
-struct netent	*getnetbyname_r __P((const char * __name,
-			struct netent *__result, char *__buffer,
-			int __buflen));
-struct netent	*getnetent_r __P((struct netent *__result,
-			char *__buffer, int __buflen));
-struct protoent	*getprotobyname_r __P((const char * __name,
-			struct protoent *__result, char *__buffer,
-			int __buflen));
-struct protoent	*getprotobynumber_r __P((int __proto,
-			struct protoent *__result, char *__buffer,
-			int __buflen));
-struct protoent	*getprotoent_r __P((struct protoent *__result,
-			char *__buffer, int __buflen));
-struct servent	*getservbyname_r __P((const char * __name,
-			const char *__proto, struct servent *__result,
-			char *__buffer, int __buflen));
-struct servent	*getservbyport_r __P((int __port,
-			const char *__proto, struct servent *__result,
-			char *__buffer, int __buflen));
-struct servent	*getservent_r __P((struct servent *__result,
-			char *__buffer, int __buflen));
-
-int *__h_errno_location __P((void));
+/* Translate a socket address to a location and service name.  */
+extern int getnameinfo (__const struct sockaddr *__restrict __sa,
+			socklen_t __salen, char *__restrict __host,
+			socklen_t __hostlen, char *__restrict __serv,
+			socklen_t __servlen, unsigned int __flags) __THROW;
 
-#endif
+# ifdef __USE_GNU
+/* Enqueue ENT requests from the LIST.  If MODE is GAI_WAIT wait until all
+   requests are handled.  If WAIT is GAI_NOWAIT return immediately after
+   queueing the requests and signal completion according to SIG.  */
+extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
+			  int __ent, struct sigevent *__restrict __sig)
+     __THROW;
+
+/* Suspend execution of the thread until at least one of the ENT requests
+   in LIST is handled.  If TIMEOUT is not a null pointer it specifies the
+   longest time the function keeps waiting before returning with an error.  */
+extern int gai_suspend (__const struct gaicb *__const __list[], int __ent,
+			__const struct timespec *__timeout) __THROW;
+
+/* Get the error status of the request REQ.  */
+extern int gai_error (struct gaicb *__req) __THROW;
+
+/* Cancel the requests associated with GAICBP.  */
+extern int gai_cancel (struct gaicb *__gaicbp) __THROW;
+# endif	/* GNU */
+#endif	/* POSIX */
 
 __END_DECLS
 
-#endif /* !_NETDB_H_ */
+#endif	/* netdb.h */

+ 21 - 21
include/netinet/ether.h

@@ -1,21 +1,21 @@
 /* Functions for storing Ethernet addresses in ASCII and mapping to hostnames.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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
@@ -28,26 +28,26 @@
 __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));
+extern char *ether_ntoa (__const struct ether_addr *__addr) __THROW;
+extern char *ether_ntoa_r (__const struct ether_addr *__addr, char *__buf)
+     __THROW;
 
 /* 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));
+extern struct ether_addr *ether_aton (__const char *__asc) __THROW;
+extern struct ether_addr *ether_aton_r (__const char *__asc,
+					struct ether_addr *__addr) __THROW;
 
 /* Map 48 bit Ethernet number ADDR to HOSTNAME.  */
-extern int ether_ntohost __P ((char *__hostname,
-			       __const struct ether_addr *__addr));
+extern int ether_ntohost (char *__hostname, __const struct ether_addr *__addr)
+     __THROW;
 
 /* Map HOSTNAME to 48 bit Ethernet address.  */
-extern int ether_hostton __P ((__const char *__hostname,
-			       struct ether_addr *__addr));
+extern int ether_hostton (__const char *__hostname, struct ether_addr *__addr)
+     __THROW;
 
 /* Scan LINE and set ADDR and HOSTNAME.  */
-extern int ether_line __P ((__const char *__line, struct ether_addr *__addr,
-			    char *__hostname));
+extern int ether_line (__const char *__line, struct ether_addr *__addr,
+		       char *__hostname) __THROW;
 
 __END_DECLS
 

+ 35 - 13
include/netinet/icmp6.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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
@@ -36,18 +36,18 @@ struct icmp6_filter
     uint32_t data[8];
   };
 
-struct icmp6_hdr 
+struct icmp6_hdr
   {
     uint8_t     icmp6_type;   /* type field */
     uint8_t     icmp6_code;   /* code field */
     uint16_t    icmp6_cksum;  /* checksum field */
-    union 
+    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
@@ -135,6 +135,7 @@ struct nd_router_advert       /* router advertisement */
 #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_FLAG_HOME_AGENT    0x20
 #define nd_ra_router_lifetime    nd_ra_hdr.icmp6_data16[1]
 
 struct nd_neighbor_solicit    /* neighbor solicitation */
@@ -177,7 +178,7 @@ struct nd_redirect            /* redirect */
     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
@@ -195,6 +196,8 @@ struct nd_opt_hdr             /* Neighbor discovery option header */
 #define  ND_OPT_PREFIX_INFORMATION    3
 #define  ND_OPT_REDIRECTED_HEADER     4
 #define  ND_OPT_MTU                   5
+#define  ND_OPT_RTR_ADV_INTERVAL      7
+#define  ND_OPT_HOME_AGENT_INFO       8
 
 struct nd_opt_prefix_info     /* prefix information */
   {
@@ -210,6 +213,7 @@ struct nd_opt_prefix_info     /* prefix information */
 
 #define ND_OPT_PI_FLAG_ONLINK        0x80
 #define ND_OPT_PI_FLAG_AUTO          0x40
+#define ND_OPT_PI_FLAG_RADDR         0x20
 
 struct nd_opt_rd_hdr          /* redirected header */
   {
@@ -228,5 +232,23 @@ struct nd_opt_mtu             /* MTU option */
     uint32_t  nd_opt_mtu_mtu;
   };
 
+/* Mobile IPv6 extension: Advertisement Interval.  */
+struct nd_opt_adv_interval
+  {
+    uint8_t   nd_opt_adv_interval_type;
+    uint8_t   nd_opt_adv_interval_len;
+    uint16_t  nd_opt_adv_interval_reserved;
+    uint32_t  nd_opt_adv_interval_ival;
+  };
+
+/* Mobile IPv6 extension: Home Agent Info.  */
+struct nd_opt_home_agent_info
+  {
+    uint8_t   nd_opt_home_agent_info_type;
+    uint8_t   nd_opt_home_agent_info_len;
+    uint16_t  nd_opt_home_agent_info_reserved;
+    int16_t   nd_opt_home_agent_info_preference;
+    uint16_t  nd_opt_home_agent_info_lifetime;
+  };
 
 #endif /* netinet/icmpv6.h */

+ 9 - 13
include/netinet/if_ether.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef __NETINET_IF_ETHER_H
 
@@ -38,10 +38,6 @@
  * 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.

+ 8 - 8
include/netinet/if_fddi.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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

+ 8 - 8
include/netinet/if_tr.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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

+ 9 - 13
include/netinet/igmp.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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 1
@@ -47,10 +47,6 @@ __BEGIN_DECLS
  * 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.

+ 121 - 72
include/netinet/in.h

@@ -1,30 +1,27 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000, 2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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 <bits/types.h>
 
 
 __BEGIN_DECLS
@@ -33,34 +30,64 @@ __BEGIN_DECLS
 enum
   {
     IPPROTO_IP = 0,	   /* Dummy protocol for TCP.  */
+#define IPPROTO_IP		IPPROTO_IP
     IPPROTO_HOPOPTS = 0,   /* IPv6 Hop-by-Hop options.  */
+#define IPPROTO_HOPOPTS		IPPROTO_HOPOPTS
     IPPROTO_ICMP = 1,	   /* Internet Control Message Protocol.  */
+#define IPPROTO_ICMP		IPPROTO_ICMP
     IPPROTO_IGMP = 2,	   /* Internet Group Management Protocol. */
+#define IPPROTO_IGMP		IPPROTO_IGMP
     IPPROTO_IPIP = 4,	   /* IPIP tunnels (older KA9Q tunnels use 94).  */
+#define IPPROTO_IPIP		IPPROTO_IPIP
     IPPROTO_TCP = 6,	   /* Transmission Control Protocol.  */
+#define IPPROTO_TCP		IPPROTO_TCP
     IPPROTO_EGP = 8,	   /* Exterior Gateway Protocol.  */
+#define IPPROTO_EGP		IPPROTO_EGP
     IPPROTO_PUP = 12,	   /* PUP protocol.  */
+#define IPPROTO_PUP		IPPROTO_PUP
     IPPROTO_UDP = 17,	   /* User Datagram Protocol.  */
+#define IPPROTO_UDP		IPPROTO_UDP
     IPPROTO_IDP = 22,	   /* XNS IDP protocol.  */
+#define IPPROTO_IDP		IPPROTO_IDP
     IPPROTO_TP = 29,	   /* SO Transport Protocol Class 4.  */
+#define IPPROTO_TP		IPPROTO_TP
     IPPROTO_IPV6 = 41,     /* IPv6 header.  */
+#define IPPROTO_IPV6		IPPROTO_IPV6
     IPPROTO_ROUTING = 43,  /* IPv6 routing header.  */
+#define IPPROTO_ROUTING		IPPROTO_ROUTING
     IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header.  */
+#define IPPROTO_FRAGMENT	IPPROTO_FRAGMENT
     IPPROTO_RSVP = 46,	   /* Reservation Protocol.  */
+#define IPPROTO_RSVP		IPPROTO_RSVP
     IPPROTO_GRE = 47,	   /* General Routing Encapsulation.  */
+#define IPPROTO_GRE		IPPROTO_GRE
     IPPROTO_ESP = 50,      /* encapsulating security payload.  */
+#define IPPROTO_ESP		IPPROTO_ESP
     IPPROTO_AH = 51,       /* authentication header.  */
+#define IPPROTO_AH		IPPROTO_AH
     IPPROTO_ICMPV6 = 58,   /* ICMPv6.  */
+#define IPPROTO_ICMPV6		IPPROTO_ICMPV6
     IPPROTO_NONE = 59,     /* IPv6 no next header.  */
+#define IPPROTO_NONE		IPPROTO_NONE
     IPPROTO_DSTOPTS = 60,  /* IPv6 destination options.  */
+#define IPPROTO_DSTOPTS		IPPROTO_DSTOPTS
     IPPROTO_MTP = 92,	   /* Multicast Transport Protocol.  */
+#define IPPROTO_MTP		IPPROTO_MTP
     IPPROTO_ENCAP = 98,	   /* Encapsulation Header.  */
+#define IPPROTO_ENCAP		IPPROTO_ENCAP
     IPPROTO_PIM = 103,	   /* Protocol Independent Multicast.  */
+#define IPPROTO_PIM		IPPROTO_PIM
     IPPROTO_COMP = 108,	   /* Compression Header Protocol.  */
+#define IPPROTO_COMP		IPPROTO_COMP
     IPPROTO_RAW = 255,	   /* Raw IP packets.  */
+#define IPPROTO_RAW		IPPROTO_RAW
     IPPROTO_MAX
   };
 
+
+/* Type to represent a port.  */
+typedef uint16_t in_port_t;
+
 /* Standard well-known ports.  */
 enum
   {
@@ -105,9 +132,9 @@ enum
 /* Internet address.  */
 typedef uint32_t in_addr_t;
 struct in_addr
-{
+  {
     in_addr_t s_addr;
-};
+  };
 
 
 /* Definitions of the bits in an Internet address integer.
@@ -115,48 +142,48 @@ struct in_addr
    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(a)		((((in_addr_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(a)		((((in_addr_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(a)		((((in_addr_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_CLASSD(a)		((((in_addr_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)
+#define	IN_EXPERIMENTAL(a)	((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
+#define	IN_BADCLASS(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
 
 /* Address to accept any incoming messages.  */
-#define	INADDR_ANY		((uint32_t) 0x00000000)
+#define	INADDR_ANY		((in_addr_t) 0x00000000)
 /* Address to send to all hosts.  */
-#define	INADDR_BROADCAST	((uint32_t) 0xffffffff)
+#define	INADDR_BROADCAST	((in_addr_t) 0xffffffff)
 /* Address indicating an error return.  */
-#define	INADDR_NONE		((uint32_t) 0xffffffff)
+#define	INADDR_NONE		((in_addr_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.  */
+# define INADDR_LOOPBACK	((in_addr_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 */
+#define INADDR_UNSPEC_GROUP	((in_addr_t) 0xe0000000) /* 224.0.0.0 */
+#define INADDR_ALLHOSTS_GROUP	((in_addr_t) 0xe0000001) /* 224.0.0.1 */
+#define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
+#define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
 
 
 /* IPv6 address */
@@ -164,17 +191,13 @@ 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
+	uint8_t	u6_addr8[16];
+	uint16_t u6_addr16[8];
+	uint32_t u6_addr32[4];
       } 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;        /* :: */
@@ -186,20 +209,20 @@ extern const struct in6_addr in6addr_loopback;   /* ::1 */
 #define INET6_ADDRSTRLEN 46
 
 /* Get the definition of the macro to define the common sockaddr members.  */
-#include <bits/sockaddr.h>
+#include <bits/socket.h>
 
 
 /* Structure describing an Internet socket address.  */
 struct sockaddr_in
   {
     __SOCKADDR_COMMON (sin_);
-    uint16_t sin_port;			/* Port number.  */
+    in_port_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 (in_port_t) -
 			   sizeof (struct in_addr)];
   };
 
@@ -207,9 +230,10 @@ struct sockaddr_in
 struct sockaddr_in6
   {
     __SOCKADDR_COMMON (sin6_);
-    uint16_t sin6_port;		/* Transport layer port # */
+    in_port_t sin6_port;	/* Transport layer port # */
     uint32_t sin6_flowinfo;	/* IPv6 flow information */
     struct in6_addr sin6_addr;	/* IPv6 address */
+    uint32_t sin6_scope_id;	/* IPv6 scope-id */
   };
 
 /* IPv6 multicast request.  */
@@ -232,81 +256,106 @@ struct ipv6_mreq
    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));
+extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));
+extern uint16_t ntohs (uint16_t __netshort)
+     __THROW __attribute__ ((__const__));
+extern uint32_t htonl (uint32_t __hostlong)
+     __THROW __attribute__ ((__const__));
+extern uint16_t htons (uint16_t __hostshort)
+     __THROW __attribute__ ((__const__));
 
 #include <endian.h>
 
 /* Get machine dependent optimized versions of byte swapping functions.  */
 #include <bits/byteswap.h>
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef __OPTIMIZE__
+/* We can optimize calls to the conversion functions.  Either nothing has
+   to be done or we are using directly the byte-swapping functions which
+   often can be inlined.  */
+# if __BYTE_ORDER == __BIG_ENDIAN
 /* 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
-#  define ntohl(x)	__bswap_32 (x)
-#  define ntohs(x)	__bswap_16 (x)
-#  define htonl(x)	__bswap_32 (x)
-#  define htons(x)	__bswap_16 (x)
+# else
+#  if __BYTE_ORDER == __LITTLE_ENDIAN
+#   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
 #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)
+	(((__const uint32_t *) (a))[0] == 0				      \
+	 && ((__const uint32_t *) (a))[1] == 0				      \
+	 && ((__const uint32_t *) (a))[2] == 0				      \
+	 && ((__const 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))
+	(((__const uint32_t *) (a))[0] == 0				      \
+	 && ((__const uint32_t *) (a))[1] == 0				      \
+	 && ((__const uint32_t *) (a))[2] == 0				      \
+	 && ((__const uint32_t *) (a))[3] == htonl (1))
 
-#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff)
+#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
 
 #define IN6_IS_ADDR_LINKLOCAL(a) \
-	((((uint32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000))
+	((((__const uint32_t *) (a))[0] & htonl (0xffc00000))		      \
+	 == htonl (0xfe800000))
 
 #define IN6_IS_ADDR_SITELOCAL(a) \
-	((((uint32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfec00000))
+	((((__const 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)))
+	((((__const uint32_t *) (a))[0] == 0)				      \
+	 && (((__const uint32_t *) (a))[1] == 0)			      \
+	 && (((__const 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))
+	((((__const uint32_t *) (a))[0] == 0)				      \
+	 && (((__const uint32_t *) (a))[1] == 0)			      \
+	 && (((__const uint32_t *) (a))[2] == 0)			      \
+	 && (ntohl (((__const 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]))
+	((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0])     \
+	 && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1])  \
+	 && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2])  \
+	 && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
 
 /* Bind socket to a privileged IP port.  */
-extern int bindresvport __P ((int __sockfd, struct sockaddr_in *__sock_in));
+extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
 
+/* The IPv6 version of this function.  */
+extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
+     __THROW;
 
 
 #define IN6_IS_ADDR_MC_NODELOCAL(a) \
-	(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0x1))
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
 
 #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
-	(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0x2))
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))
 
 #define IN6_IS_ADDR_MC_SITELOCAL(a) \
-	(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0x5))
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))
 
 #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
-	(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0x8))
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))
 
 #define IN6_IS_ADDR_MC_GLOBAL(a) \
-	(IN6_IS_ADDR_MULTICAST(a) && ((((u_int8_t *) (a))[1] & 0xf) == 0xe))
+	(IN6_IS_ADDR_MULTICAST(a)					      \
+	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
 
 /* IPv6 packet information.  */
 struct in6_pktinfo

+ 8 - 8
include/netinet/in_systm.h

@@ -3,19 +3,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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

+ 9 - 36
include/netinet/ip.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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
@@ -42,29 +42,6 @@ struct timestamp
     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
@@ -101,10 +78,6 @@ struct iphdr
  * 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.

+ 20 - 19
include/netinet/ip6.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1997, 2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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
@@ -22,18 +22,19 @@
 #include <inttypes.h>
 #include <netinet/in.h>
 
-struct ip6_hdr 
+struct ip6_hdr
   {
-    union 
+    union
       {
-	struct ip6_hdrctl 
+	struct ip6_hdrctl
 	  {
-	    uint32_t ip6_un1_flow;   /* 24 bits of flow-ID */
+	    uint32_t ip6_un1_flow;   /* 4 bits version, 8 bits TC,
+					20 bits 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 */
+	uint8_t ip6_un2_vfc;       /* 4 bits version, top 4 bits tclass */
       } ip6_ctlun;
     struct in6_addr ip6_src;      /* source address */
     struct in6_addr ip6_dst;      /* destination address */
@@ -47,7 +48,7 @@ struct ip6_hdr
 #define ip6_hops  ip6_ctlun.ip6_un1.ip6_un1_hlim
 
 /* Hop-by-Hop options header.  */
-struct ip6_hbh 
+struct ip6_hbh
   {
     uint8_t  ip6h_nxt;        /* next hesder.  */
     uint8_t  ip6h_len;        /* length in units of 8 octets.  */
@@ -55,7 +56,7 @@ struct ip6_hbh
   };
 
 /* Destination options header */
-struct ip6_dest 
+struct ip6_dest
   {
     uint8_t  ip6d_nxt;        /* next header */
     uint8_t  ip6d_len;        /* length in units of 8 octets */
@@ -63,7 +64,7 @@ struct ip6_dest
   };
 
 /* Routing header */
-struct ip6_rthdr 
+struct ip6_rthdr
   {
     uint8_t  ip6r_nxt;        /* next header */
     uint8_t  ip6r_len;        /* length in units of 8 octets */
@@ -73,7 +74,7 @@ struct ip6_rthdr
   };
 
 /* Type 0 Routing header */
-struct ip6_rthdr0 
+struct ip6_rthdr0
   {
     uint8_t  ip6r0_nxt;       /* next header */
     uint8_t  ip6r0_len;       /* length in units of 8 octets */
@@ -85,7 +86,7 @@ struct ip6_rthdr0
   };
 
 /* Fragment header */
-struct ip6_frag 
+struct ip6_frag
   {
     uint8_t   ip6f_nxt;       /* next header */
     uint8_t   ip6f_reserved;  /* reserved field */

+ 9 - 13
include/netinet/ip_icmp.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95, 96, 97, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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
@@ -104,10 +104,6 @@ struct icmphdr
  * 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.

+ 108 - 49
include/netinet/tcp.h

@@ -10,10 +10,6 @@
  * 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.
@@ -37,11 +33,27 @@
 #define _NETINET_TCP_H	1
 
 #include <features.h>
-#include <sys/types.h>
 
-__BEGIN_DECLS
+/*
+ * User-settable options (used with setsockopt).
+ */
+#define	TCP_NODELAY	 1	/* Don't delay send to coalesce packets  */
+#define	TCP_MAXSEG	 2	/* Set maximum segment size  */
+#define TCP_CORK	 3	/* Control sending of partial frames  */
+#define TCP_KEEPIDLE	 4	/* Start keeplives after this period */
+#define TCP_KEEPINTVL	 5	/* Interval between keepalives */
+#define TCP_KEEPCNT	 6	/* Number of keepalives before death */
+#define TCP_SYNCNT	 7	/* Number of SYN retransmits */
+#define TCP_LINGER2	 8	/* Life time of orphaned FIN-WAIT-2 state */
+#define TCP_DEFER_ACCEPT 9	/* Wake up listener only when data arrive */
+#define TCP_WINDOW_CLAMP 10	/* Bound advertised window */
+#define TCP_INFO	 11	/* Information about this connection. */
+#define	TCP_QUICKACK	 12	/* Bock/reenable quick ACKs.  */
 
-#ifdef __FAVOR_BSD
+#ifdef __USE_MISC
+# include <sys/types.h>
+
+# ifdef __FAVOR_BSD
 typedef	u_int32_t tcp_seq;
 /*
  * TCP header.
@@ -53,34 +65,34 @@ struct tcphdr
     u_int16_t th_dport;		/* destination port */
     tcp_seq th_seq;		/* sequence number */
     tcp_seq th_ack;		/* acknowledgement number */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#  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
+#  endif
+#  if __BYTE_ORDER == __BIG_ENDIAN
     u_int8_t th_off:4;		/* data offset */
     u_int8_t th_x2:4;		/* (unused) */
-#endif
+#  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
+#  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 */
+# 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
+#  if __BYTE_ORDER == __LITTLE_ENDIAN
     u_int16_t res1:4;
     u_int16_t doff:4;
     u_int16_t fin:1;
@@ -90,7 +102,7 @@ struct tcphdr
     u_int16_t ack:1;
     u_int16_t urg:1;
     u_int16_t res2:2;
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#  elif __BYTE_ORDER == __BIG_ENDIAN
     u_int16_t doff:4;
     u_int16_t res1:4;
     u_int16_t res2:2;
@@ -100,14 +112,14 @@ struct tcphdr
     u_int16_t rst:1;
     u_int16_t syn:1;
     u_int16_t fin:1;
-#else
-#error	"Adjust your <bits/endian.h> defines"
-#endif
+#  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 */
+# endif /* __FAVOR_BSD */
 
 enum
 {
@@ -124,20 +136,20 @@ enum
   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	\
+# 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)
 
 /*
@@ -146,21 +158,68 @@ enum
  * but 512 is probably more convenient.
  * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
  */
-#define	TCP_MSS	512
+# define TCP_MSS	512
 
-#define	TCP_MAXWIN	65535	/* largest value for (unscaled) window */
+# define TCP_MAXWIN	65535	/* largest value for (unscaled) window */
 
-#define TCP_MAX_WINSHIFT	14	/* maximum window shift */
+# 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 */
+
+
+# define TCPI_OPT_TIMESTAMPS	1
+# define TCPI_OPT_SACK		2
+# define TCPI_OPT_WSCALE	4
+# define TCPI_OPT_ECN		8
 
-#define SOL_TCP		6	/* TCP level */
+/* Values for tcpi_state.  */
+enum tcp_ca_state
+{
+  TCP_CA_Open = 0,
+  TCP_CA_Disorder = 1,
+  TCP_CA_CWR = 2,
+  TCP_CA_Recovery = 3,
+  TCP_CA_Loss = 4
+};
+
+struct tcp_info
+{
+  u_int8_t	tcpi_state;
+  u_int8_t	tcpi_ca_state;
+  u_int8_t	tcpi_retransmits;
+  u_int8_t	tcpi_probes;
+  u_int8_t	tcpi_backoff;
+  u_int8_t	tcpi_options;
+  u_int8_t	tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
+
+  u_int32_t	tcpi_rto;
+  u_int32_t	tcpi_ato;
+  u_int32_t	tcpi_snd_mss;
+  u_int32_t	tcpi_rcv_mss;
+
+  u_int32_t	tcpi_unacked;
+  u_int32_t	tcpi_sacked;
+  u_int32_t	tcpi_lost;
+  u_int32_t	tcpi_retrans;
+  u_int32_t	tcpi_fackets;
+
+  /* Times. */
+  u_int32_t	tcpi_last_data_sent;
+  u_int32_t	tcpi_last_ack_sent;	/* Not remembered, sorry.  */
+  u_int32_t	tcpi_last_data_recv;
+  u_int32_t	tcpi_last_ack_recv;
+
+  /* Metrics. */
+  u_int32_t	tcpi_pmtu;
+  u_int32_t	tcpi_rcv_ssthresh;
+  u_int32_t	tcpi_rtt;
+  u_int32_t	tcpi_rttvar;
+  u_int32_t	tcpi_snd_ssthresh;
+  u_int32_t	tcpi_snd_cwnd;
+  u_int32_t	tcpi_advmss;
+  u_int32_t	tcpi_reordering;
+};
 
-__END_DECLS
+#endif /* Misc.  */
 
 #endif /* netinet/tcp.h */

+ 8 - 8
include/netinet/udp.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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.

+ 11 - 11
include/nl_types.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _NL_TYPES_H
 #define _NL_TYPES_H 1
@@ -37,15 +37,15 @@ typedef void *nl_catd;
 typedef int nl_item;
 
 /* Open message catalog for later use, returning descriptor.  */
-extern nl_catd catopen (__const char *__cat_name, int __flag);
+extern nl_catd catopen (__const char *__cat_name, int __flag) __THROW;
 
 /* Return translation with NUMBER in SET of CATALOG; if not found
    return STRING.  */
 extern char *catgets (nl_catd __catalog, int __set, int __number,
-		      __const char *__string);
+		      __const char *__string) __THROW;
 
 /* Close message CATALOG.  */
-extern int catclose (nl_catd __catalog);
+extern int catclose (nl_catd __catalog) __THROW;
 
 __END_DECLS
 

+ 64 - 12
include/paths.h

@@ -1,22 +1,74 @@
-/* paths.h <ndf@linux.mit.edu> */
+/*
+ * Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)paths.h	8.1 (Berkeley) 6/2/93
+ */
 
-#ifndef ___PATHS_H
-#define	___PATHS_H
+#ifndef _PATHS_H_
+#define	_PATHS_H_
 
+/* Default search path. */
+#define	_PATH_DEFPATH	"/usr/bin:/bin"
+/* All standard utilities path. */
+#define	_PATH_STDPATH \
+	"/usr/bin:/bin:/usr/sbin:/sbin"
 
+#define	_PATH_BSHELL	"/bin/sh"
 #define	_PATH_CONSOLE	"/dev/console"
-#define	_PATH_TTY	"/dev/tty"
+#define	_PATH_CSHELL	"/bin/csh"
+#define	_PATH_DEVDB	"/var/run/dev.db"
+#define	_PATH_DEVNULL	"/dev/null"
+#define	_PATH_DRUM	"/dev/drum"
+#define	_PATH_KLOG	"/proc/kmsg"
+#define	_PATH_KMEM	"/dev/kmem"
+#define	_PATH_LASTLOG	"/var/log/lastlog"
+#define	_PATH_MAILDIR	"/var/mail"
+#define	_PATH_MAN	"/usr/share/man"
+#define	_PATH_MEM	"/dev/mem"
+#define	_PATH_MNTTAB	"/etc/fstab"
+#define	_PATH_MOUNTED	"/etc/mtab"
 #define	_PATH_NOLOGIN	"/etc/nologin"
-#define	_PATH_LOGIN	"/bin/login"
-#define	_PATH_BSHELL	"/bin/sh"
+#define	_PATH_PRESERVE	"/var/lib"
+#define	_PATH_RWHODIR	"/var/spool/rwho"
+#define	_PATH_SENDMAIL	"/usr/sbin/sendmail"
+#define	_PATH_SHADOW	"/etc/shadow"
+#define	_PATH_SHELLS	"/etc/shells"
+#define	_PATH_TTY	"/dev/tty"
+#define	_PATH_UNIX	"/boot/vmlinux"
 #define _PATH_UTMP	"/var/run/utmp"
+#define	_PATH_VI	"/usr/bin/vi"
 #define _PATH_WTMP	"/var/log/wtmp"
-#define	_PATH_DEFPATH	"/bin:/usr/bin:/usr/local/bin:."
+
+/* Provide trailing slash, since mostly used for building pathnames. */
 #define	_PATH_DEV	"/dev/"
-#define _PATH_DEVNULL	"/dev/null"
 #define	_PATH_TMP	"/tmp/"
-#define _PATH_LASTLOG	"/var/log/lastlog"
-#define _PATH_LOCALE	"/usr/lib/locale"
-#define _PATH_VARRUN	"/var/run/"
+#define	_PATH_VARDB	"/var/lib/misc/"
+#define	_PATH_VARRUN	"/var/run/"
+#define	_PATH_VARTMP	"/var/tmp/"
 
-#endif /* __PATHS_H */
+#endif /* !_PATHS_H_ */

+ 11 - 10
include/pty.h

@@ -3,19 +3,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _PTY_H
 #define _PTY_H	1
@@ -25,18 +25,19 @@
 #include <termios.h>
 #include <sys/ioctl.h>
 
+
 __BEGIN_DECLS
 
 /* Create pseudo tty master slave pair with NAME and set terminal
    attributes according to TERMP and WINP and return handles for both
    ends in AMASTER and ASLAVE.  */
 extern int openpty (int *__amaster, int *__aslave, char *__name,
-		    struct termios *__termp, struct winsize *__winp);
+		    struct termios *__termp, struct winsize *__winp) __THROW;
 
 /* Create child process and establish the slave pseudo terminal as the
    child's controlling terminal.  */
 extern int forkpty (int *__amaster, char *__name,
-		    struct termios *__termp, struct winsize *__winp);
+		    struct termios *__termp, struct winsize *__winp) __THROW;
 
 __END_DECLS
 

+ 120 - 36
include/pwd.h

@@ -1,63 +1,147 @@
-#ifndef	__PWD_H
-#define	__PWD_H
+/* Copyright (C) 1991,92,95,96,97,98,99,2001 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ *	POSIX Standard: 9.2.2 User Database Access	<pwd.h>
+ */
+
+#ifndef	_PWD_H
+#define	_PWD_H	1
 
-#include <sys/types.h>
 #include <features.h>
-#include <stdio.h>
 
 __BEGIN_DECLS
 
+#include <bits/types.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+#ifdef __USE_XOPEN
+/* The Single Unix specification says that some more types are
+   available here.  */
+# ifndef __gid_t_defined
+typedef __gid_t gid_t;
+#  define __gid_t_defined
+# endif
+
+# ifndef __uid_t_defined
+typedef __uid_t uid_t;
+#  define __uid_t_defined
+# endif
+#endif
+
 /* The passwd structure.  */
 struct passwd
 {
   char *pw_name;		/* Username.  */
   char *pw_passwd;		/* Password.  */
-  uid_t pw_uid;			/* User ID.  */
-  gid_t pw_gid;			/* Group ID.  */
+  __uid_t pw_uid;		/* User ID.  */
+  __gid_t pw_gid;		/* Group ID.  */
   char *pw_gecos;		/* Real name.  */
   char *pw_dir;			/* Home directory.  */
   char *pw_shell;		/* Shell program.  */
 };
 
 
-extern void setpwent __P ((void));
-extern void endpwent __P ((void));
-extern struct passwd * getpwent __P ((void));
+#if defined __USE_SVID || defined __USE_GNU
+# define __need_FILE
+# include <stdio.h>
+#endif
+
 
-extern int putpwent __P ((const struct passwd * __p, FILE * __f));
-extern int getpw __P ((uid_t uid, char *buf));
+#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+/* Rewind the password-file stream.  */
+extern void setpwent (void) __THROW;
 
-extern struct passwd * fgetpwent __P ((FILE * file));
+/* Close the password-file stream.  */
+extern void endpwent (void) __THROW;
 
-extern struct passwd * getpwuid __P ((const uid_t));
-extern struct passwd * getpwnam __P ((const char *));
+/* Read an entry from the password-file stream, opening it if necessary.  */
+extern struct passwd *getpwent (void) __THROW;
+#endif
 
+#ifdef	__USE_SVID
+/* Read an entry from STREAM.  */
+extern struct passwd *fgetpwent (FILE *__stream) __THROW;
 
-extern int getpwent_r __P ((struct passwd *__restrict __resultbuf,
-			    char *__restrict __buffer, size_t __buflen,
-			    struct passwd **__restrict __result));
-extern int getpwuid_r __P ((uid_t __uid,
-			    struct passwd *__restrict __resultbuf,
-			    char *__restrict __buffer, size_t __buflen,
-			    struct passwd **__restrict __result));
-extern int getpwnam_r __P ((const char *__restrict __name,
-			    struct passwd *__restrict __resultbuf,
-			    char *__restrict __buffer, size_t __buflen,
-			    struct passwd **__restrict __result));
-extern int fgetpwent_r __P ((FILE *__restrict __stream,
-			     struct passwd *__restrict __resultbuf,
-			     char *__restrict __buffer, size_t __buflen,
-			     struct passwd **__restrict __result));
+/* Write the given entry onto the given stream.  */
+extern int putpwent (__const struct passwd *__restrict __p,
+		     FILE *__restrict __f) __THROW;
+#endif
 
-#ifdef _LIBC
-/* This is used internally to uClibc */
-extern int __getpwent_r(struct passwd * passwd, char * line_buff, 
-	size_t buflen, int pwd_fd);
+/* Search for an entry with a matching user ID.  */
+extern struct passwd *getpwuid (__uid_t __uid) __THROW;
+
+/* Search for an entry with a matching username.  */
+extern struct passwd *getpwnam (__const char *__name) __THROW;
+
+#if defined __USE_POSIX || defined __USE_MISC
+
+# ifdef __USE_MISC
+/* Reasonable value for the buffer sized used in the reentrant
+   functions below.  But better use `sysconf'.  */
+#  define NSS_BUFLEN_PASSWD	1024
+# endif
+
+/* Reentrant versions of some of the functions above.
+
+   PLEASE NOTE: the `getpwent_r' function is not (yet) standardized.
+   The interface may change in later versions of this library.  But
+   the interface is designed following the principals used for the
+   other reentrant functions so the chances are good this is what the
+   POSIX people would choose.  */
+
+# if defined __USE_SVID || defined __USE_MISC
+extern int getpwent_r (struct passwd *__restrict __resultbuf,
+		       char *__restrict __buffer, size_t __buflen,
+		       struct passwd **__restrict __result) __THROW;
+# endif
+
+extern int getpwuid_r (__uid_t __uid,
+		       struct passwd *__restrict __resultbuf,
+		       char *__restrict __buffer, size_t __buflen,
+		       struct passwd **__restrict __result) __THROW;
+
+extern int getpwnam_r (__const char *__restrict __name,
+		       struct passwd *__restrict __resultbuf,
+		       char *__restrict __buffer, size_t __buflen,
+		       struct passwd **__restrict __result) __THROW;
+
+
+# ifdef	__USE_SVID
+/* Read an entry from STREAM.  This function is not standardized and
+   probably never will.  */
+extern int fgetpwent_r (FILE *__restrict __stream,
+			struct passwd *__restrict __resultbuf,
+			char *__restrict __buffer, size_t __buflen,
+			struct passwd **__restrict __result) __THROW;
+# endif
+
+#endif	/* POSIX or reentrant */
+
+#ifdef __USE_GNU
+/* Re-construct the password-file line for the given uid
+   in the given buffer.  This knows the format that the caller
+   will expect, but this need not be the format of the password file.  */
+extern int getpw (__uid_t __uid, char *__buffer) __THROW;
 #endif
 
 __END_DECLS
 
 #endif /* pwd.h  */
-
-
-

+ 40 - 17
include/regex.h

@@ -1,24 +1,23 @@
 /* Definitions for data structures and routines for the regular
    expression library, version 0.12.
-   Copyright (C) 1985,1989-1993,1995-1998,2000 Free Software Foundation, Inc.
-
+   Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.  Its master source is NOT part of
    the C library, however.  The master source lives in /gd/gnu/lib.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _REGEX_H
 #define _REGEX_H 1
@@ -160,6 +159,11 @@ typedef unsigned long int reg_syntax_t;
    this bit set, and it won't affect anything in the normal case. */
 #define RE_DEBUG (RE_NO_GNU_OPS << 1)
 
+/* If this bit is set, a syntactically invalid interval is treated as
+   a string of ordinary characters.  For example, the ERE 'a{1' is
+   treated as 'a\{1'.  */
+#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
+
 /* This global variable defines the particular regexp syntax to use (for
    some interfaces).  When a regexp is compiled, the syntax used is
    stored in the pattern buffer, so changing this does not affect
@@ -199,7 +203,8 @@ extern reg_syntax_t re_syntax_options;
    | RE_NO_BK_VBAR)
 
 #define RE_SYNTAX_POSIX_EGREP						\
-  (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
+  (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES			\
+   | RE_INVALID_INTERVAL_ORD)
 
 /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */
 #define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
@@ -226,8 +231,8 @@ extern reg_syntax_t re_syntax_options;
    | RE_NO_BK_PARENS        | RE_NO_BK_VBAR				\
    | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
 
-/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
-   replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added.  */
+/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
+   removed and RE_NO_BK_REFS is added.  */
 #define RE_SYNTAX_POSIX_MINIMAL_EXTENDED				\
   (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS			\
    | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES				\
@@ -513,13 +518,31 @@ extern int re_exec _RE_ARGS ((const char *));
 # endif
 #endif
 
+/* GCC 2.95 and later have "__restrict"; C99 compilers have
+   "restrict", and "configure" may have defined "restrict".  */
+#ifndef __restrict
+# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
+#  if defined restrict || 199901L <= __STDC_VERSION__
+#   define __restrict restrict
+#  else
+#   define __restrict
+#  endif
+# endif
+#endif
+/* For now unconditionally define __restrict_arr to expand to nothing.
+   Ideally we would have a test for the compiler which allows defining
+   it to restrict.  */
+#define __restrict_arr
+
 /* POSIX compatibility.  */
-extern int regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern,
+extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
+			      const char *__restrict __pattern,
 			      int __cflags));
 
-extern int regexec _RE_ARGS ((const regex_t *__preg,
-			      const char *__string, size_t __nmatch,
-			      regmatch_t __pmatch[], int __eflags));
+extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
+			      const char *__restrict __string, size_t __nmatch,
+			      regmatch_t __pmatch[__restrict_arr],
+			      int __eflags));
 
 extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
 				  char *__errbuf, size_t __errbuf_size));

+ 12 - 12
include/regexp.h

@@ -3,19 +3,19 @@
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _REGEXP_H
 #define _REGEXP_H	1
@@ -206,14 +206,14 @@ compile (char *__restrict instring, char *__restrict expbuf,
    found in the buffer starting at EXPBUF.  `loc1' will return the
    first character matched and `loc2' points to the next unmatched
    character.  */
-extern int step __P ((__const char *__restrict __string,
-		      __const char *__restrict __expbuf));
+extern int step (__const char *__restrict __string,
+		 __const char *__restrict __expbuf) __THROW;
 
 /* Match the beginning of STRING with the compiled regular expression
    in EXPBUF.  If the match is successful `loc2' will contain the
    position of the first unmatched character.  */
-extern int advance __P ((__const char *__restrict __string,
-			 __const char *__restrict __expbuf));
+extern int advance (__const char *__restrict __string,
+		    __const char *__restrict __expbuf) __THROW;
 
 
 __END_DECLS

+ 354 - 66
include/resolv.h

@@ -1,18 +1,56 @@
-/* resolv.h: DNS Resolver
+/*
+ * Copyright (c) 1983, 1987, 1989
+ *    The Regents of the University of California.  All rights reserved.
  *
- * Copyright (C) 1998  Kenneth Albanowski <kjahds@kjahds.com>,
- *                     The Silver Hammer Group, Ltd.
+ * 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.
+ * 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 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.
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
-#ifndef _RESOLV_H_
-#define _RESOLV_H_
+/*
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * 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.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM 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.
+ */
 
-#include <features.h>
+/*
+ *	@(#)resolv.h	8.1 (Berkeley) 6/2/93
+ *	$BINDId: resolv.h,v 8.31 2000/03/30 20:16:50 vixie Exp $
+ */
+
+#ifndef _RESOLV_H_
+#define	_RESOLV_H_
 
 #include <sys/param.h>
 #if (!defined(BSD)) || (BSD < 199306)
@@ -20,71 +58,321 @@
 #else
 # include <sys/types.h>
 #endif
+#include <sys/cdefs.h>
 #include <stdio.h>
+
 #include <netinet/in.h>
+#include <arpa/nameser.h>
 
-__BEGIN_DECLS
+/*
+ * Revision information.  This is the release date in YYYYMMDD format.
+ * It can change every day so the right thing to do with it is use it
+ * in preprocessor commands such as "#if (__RES > 19931104)".  Do not
+ * compare for equality; rather, use it to determine whether your resolver
+ * is new enough to contain a certain feature.
+ */
 
-struct resolv_header {
-	int id;
-	int qr,opcode,aa,tc,rd,ra,rcode;
-	int qdcount;
-	int ancount;
-	int nscount;
-	int arcount;
-};
+#define	__RES	19991006
 
-struct resolv_question {
-	char * dotted;
-	int qtype;
-	int qclass;
+/*
+ * Resolver configuration file.
+ * Normally not present, but may contain the address of the
+ * inital name server(s) to query and the domain search list.
+ */
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF        "/etc/resolv.conf"
+#endif
+
+typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
+	res_sendhookact;
+
+typedef res_sendhookact (*res_send_qhook) (struct sockaddr_in * const *ns,
+					   const u_char **query,
+					   int *querylen,
+					   u_char *ans,
+					   int anssiz,
+					   int *resplen);
+
+typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *ns,
+					   const u_char *query,
+					   int querylen,
+					   u_char *ans,
+					   int anssiz,
+					   int *resplen);
+
+struct res_sym {
+	int	number;		/* Identifying number, like T_MX */
+	char *	name;		/* Its symbolic name, like "MX" */
+	char *	humanname;	/* Its fun name, like "mail exchanger" */
 };
 
-struct resolv_answer {
-	char * dotted;
-	int atype;
-	int aclass;
-	int ttl;
-	int rdlength;
-	unsigned char * rdata;
-	int rdoffset;
+/*
+ * Global defines and variables for resolver stub.
+ */
+#define	MAXNS			3	/* max # name servers we'll track */
+#define	MAXDFLSRCH		3	/* # default domain levels to try */
+#define	MAXDNSRCH		6	/* max # domains in search path */
+#define	LOCALDOMAINPARTS	2	/* min levels in name that is "local" */
+
+#define	RES_TIMEOUT		5	/* min. seconds between retries */
+#define	MAXRESOLVSORT		10	/* number of net to sort on */
+#define	RES_MAXNDOTS		15	/* should reflect bit field size */
+#define	RES_MAXRETRANS		30	/* only for resolv.conf/RES_OPTIONS */
+#define	RES_MAXRETRY		5	/* only for resolv.conf/RES_OPTIONS */
+#define	RES_DFLRETRY		2	/* Default #/tries. */
+#define	RES_MAXTIME		65535	/* Infinity, in milliseconds. */
+
+struct __res_state {
+	int	retrans;	 	/* retransmition time interval */
+	int	retry;			/* number of times to retransmit */
+	u_long	options;		/* option flags - see below. */
+	int	nscount;		/* number of name servers */
+	struct sockaddr_in
+		nsaddr_list[MAXNS];	/* address of name server */
+#define	nsaddr	nsaddr_list[0]		/* for backward compatibility */
+	u_short	id;			/* current message id */
+	char	*dnsrch[MAXDNSRCH+1];	/* components of domain to search */
+	char	defdname[256];		/* default domain (deprecated) */
+	u_long	pfcode;			/* RES_PRF_ flags - see below. */
+	unsigned ndots:4;		/* threshold for initial abs. query */
+	unsigned nsort:4;		/* number of elements in sort_list[] */
+	char	unused[3];
+	struct {
+		struct in_addr	addr;
+		u_int32_t	mask;
+	} sort_list[MAXRESOLVSORT];
+	res_send_qhook qhook;		/* query hook */
+	res_send_rhook rhook;		/* response hook */
+	int	res_h_errno;		/* last one set for this context */
+	int	_vcsock;		/* PRIVATE: for res_send VC i/o */
+	u_int	_flags;			/* PRIVATE: see below */
+	union {
+		char	pad[52];	/* On an i386 this means 512b total. */
+		struct {
+			u_int16_t		nscount;
+			u_int16_t		nstimes[MAXNS];	/* ms. */
+			int			nssocks[MAXNS];
+			u_int16_t		nscount6;
+			u_int16_t		nsinit;
+			struct sockaddr_in6	*nsaddrs[MAXNS];
+		} _ext;
+	} _u;
 };
 
-int encode_header(struct resolv_header * h, unsigned char * dest, int maxlen);
-int decode_header(unsigned char * data, struct resolv_header * h);
-int encode_dotted(const char * dotted, unsigned char * dest, int maxlen);
-int decode_dotted(const unsigned char * message, int offset, 
-	char * dest, int maxlen);
-int length_dotted(const unsigned char * message, int offset);
-int encode_question(struct resolv_question * q,
-	unsigned char * dest, int maxlen);
-int decode_question(unsigned char * message, int offset,
-	struct resolv_question * q);
-int length_question(unsigned char * message, int offset);
-int encode_answer(struct resolv_answer * a,
-	unsigned char * dest, int maxlen);
-int decode_answer(unsigned char * message, int offset,
-	struct resolv_answer * a);
-const char * resolve_name(const char * name, int mailbox);
-
-int encode_packet(struct resolv_header * h,
-	struct resolv_question ** q,
-	struct resolv_answer ** an,
-	struct resolv_answer ** ns,
-	struct resolv_answer ** ar,
-	unsigned char * dest, int maxlen);
-int decode_packet(unsigned char * data, struct resolv_header * h);
-
-extern int open_nameservers(void);
-extern void close_nameservers(void);
-
-extern struct hostent * gethostbyname(const char * name);
-extern struct hostent * gethostbyaddr(const char * addr, int len, int type);
-
-extern int res_init(void);
-extern int res_query(const char *dname, int class, int type,
-	unsigned char *answer, int anslen);
+typedef struct __res_state *res_state;
+
+/*
+ * Resolver flags (used to be discrete per-module statics ints).
+ */
+#define	RES_F_VC	0x00000001	/* socket is TCP */
+#define	RES_F_CONN	0x00000002	/* socket is connected */
+
+/* res_findzonecut() options */
+#define	RES_EXHAUSTIVE	0x00000001	/* always do all queries */
+
+/*
+ * Resolver options (keep these in synch with res_debug.c, please)
+ */
+#define RES_INIT	0x00000001	/* address initialized */
+#define RES_DEBUG	0x00000002	/* print debug messages */
+#define RES_AAONLY	0x00000004	/* authoritative answers only (!IMPL)*/
+#define RES_USEVC	0x00000008	/* use virtual circuit */
+#define RES_PRIMARY	0x00000010	/* query primary server only (!IMPL) */
+#define RES_IGNTC	0x00000020	/* ignore trucation errors */
+#define RES_RECURSE	0x00000040	/* recursion desired */
+#define RES_DEFNAMES	0x00000080	/* use default domain name */
+#define RES_STAYOPEN	0x00000100	/* Keep TCP socket open */
+#define RES_DNSRCH	0x00000200	/* search up local domain tree */
+#define	RES_INSECURE1	0x00000400	/* type 1 security disabled */
+#define	RES_INSECURE2	0x00000800	/* type 2 security disabled */
+#define	RES_NOALIASES	0x00001000	/* shuts off HOSTALIASES feature */
+#define	RES_USE_INET6	0x00002000	/* use/map IPv6 in gethostbyname() */
+#define RES_ROTATE	0x00004000	/* rotate ns list after each query */
+#define	RES_NOCHECKNAME	0x00008000	/* do not check names for sanity. */
+#define	RES_KEEPTSIG	0x00010000	/* do not strip TSIG records */
+#define	RES_BLAST	0x00020000	/* blast all recursive servers */
+
+#define RES_DEFAULT	(RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
+
+/*
+ * Resolver "pfcode" values.  Used by dig.
+ */
+#define RES_PRF_STATS	0x00000001
+#define RES_PRF_UPDATE	0x00000002
+#define RES_PRF_CLASS   0x00000004
+#define RES_PRF_CMD	0x00000008
+#define RES_PRF_QUES	0x00000010
+#define RES_PRF_ANS	0x00000020
+#define RES_PRF_AUTH	0x00000040
+#define RES_PRF_ADD	0x00000080
+#define RES_PRF_HEAD1	0x00000100
+#define RES_PRF_HEAD2	0x00000200
+#define RES_PRF_TTLID	0x00000400
+#define RES_PRF_HEADX	0x00000800
+#define RES_PRF_QUERY	0x00001000
+#define RES_PRF_REPLY	0x00002000
+#define RES_PRF_INIT	0x00004000
+/*			0x00008000	*/
+
+/* Things involving an internal (static) resolver context. */
+#if !defined _LIBC || defined _LIBC_REENTRANT
+__BEGIN_DECLS
+extern struct __res_state *__res_state(void) __attribute__ ((__const__));
+__END_DECLS
+#define _res (*__res_state())
+#else
+#ifndef __BIND_NOSTATIC
+extern struct __res_state _res;
+#endif
+#endif
+
+#ifndef __BIND_NOSTATIC
+#define fp_nquery		__fp_nquery
+#define fp_query		__fp_query
+#define hostalias		__hostalias
+#define p_query			__p_query
+#define res_close		__res_close
+#define res_init		__res_init
+#define res_isourserver		__res_isourserver
+#define res_mkquery		__res_mkquery
+#define res_query		__res_query
+#define res_querydomain		__res_querydomain
+#define res_search		__res_search
+#define res_send		__res_send
 
+__BEGIN_DECLS
+void		fp_nquery __P((const u_char *, int, FILE *));
+void		fp_query __P((const u_char *, FILE *));
+const char *	hostalias __P((const char *));
+void		p_query __P((const u_char *));
+void		res_close __P((void));
+int		res_init __P((void));
+int		res_isourserver __P((const struct sockaddr_in *));
+int		res_mkquery __P((int, const char *, int, int, const u_char *,
+				 int, const u_char *, u_char *, int));
+int		res_query __P((const char *, int, int, u_char *, int));
+int		res_querydomain __P((const char *, const char *, int, int,
+				     u_char *, int));
+int		res_search __P((const char *, int, int, u_char *, int));
+int		res_send __P((const u_char *, int, u_char *, int));
+__END_DECLS
+#endif
+
+#if !defined(SHARED_LIBBIND) || defined(LIB)
+/*
+ * If libbind is a shared object (well, DLL anyway)
+ * these externs break the linker when resolv.h is
+ * included by a lib client (like named)
+ * Make them go away if a client is including this
+ *
+ */
+extern const struct res_sym __p_key_syms[];
+extern const struct res_sym __p_cert_syms[];
+extern const struct res_sym __p_class_syms[];
+extern const struct res_sym __p_type_syms[];
+extern const struct res_sym __p_rcode_syms[];
+#endif /* SHARED_LIBBIND */
+
+#define b64_ntop		__b64_ntop
+#define b64_pton		__b64_pton
+#define dn_comp			__dn_comp
+#define dn_count_labels		__dn_count_labels
+#define dn_expand		__dn_expand
+#define dn_skipname		__dn_skipname
+#define fp_resstat		__fp_resstat
+#define loc_aton		__loc_aton
+#define loc_ntoa		__loc_ntoa
+#define p_cdname		__p_cdname
+#define p_cdnname		__p_cdnname
+#define p_class			__p_class
+#define p_fqname		__p_fqname
+#define p_fqnname		__p_fqnname
+#define p_option		__p_option
+#define p_secstodate		__p_secstodate
+#define p_section		__p_section
+#define p_time			__p_time
+#define p_type			__p_type
+#define p_rcode			__p_rcode
+#define putlong			__putlong
+#define putshort		__putshort
+#define res_dnok		__res_dnok
+#define res_hnok		__res_hnok
+#define res_hostalias		__res_hostalias
+#define res_mailok		__res_mailok
+#define res_nameinquery		__res_nameinquery
+#define res_nclose		__res_nclose
+#define res_ninit		__res_ninit
+#define res_nmkquery		__res_nmkquery
+#define res_npquery		__res_npquery
+#define res_nquery		__res_nquery
+#define res_nquerydomain	__res_nquerydomain
+#define res_nsearch		__res_nsearch
+#define res_nsend		__res_nsend
+#define res_nisourserver	__res_nisourserver
+#define res_ownok		__res_ownok
+#define res_queriesmatch	__res_queriesmatch
+#define res_randomid		__res_randomid
+#define sym_ntop		__sym_ntop
+#define sym_ntos		__sym_ntos
+#define sym_ston		__sym_ston
+__BEGIN_DECLS
+int		res_hnok __P((const char *));
+int		res_ownok __P((const char *));
+int		res_mailok __P((const char *));
+int		res_dnok __P((const char *));
+int		sym_ston __P((const struct res_sym *, const char *, int *));
+const char *	sym_ntos __P((const struct res_sym *, int, int *));
+const char *	sym_ntop __P((const struct res_sym *, int, int *));
+int		b64_ntop __P((u_char const *, size_t, char *, size_t));
+int		b64_pton __P((char const *, u_char *, size_t));
+int		loc_aton __P((const char *ascii, u_char *binary));
+const char *	loc_ntoa __P((const u_char *binary, char *ascii));
+int		dn_skipname __P((const u_char *, const u_char *));
+void		putlong __P((u_int32_t, u_char *));
+void		putshort __P((u_int16_t, u_char *));
+const char *	p_class __P((int));
+const char *	p_time __P((u_int32_t));
+const char *	p_type __P((int));
+const char *	p_rcode __P((int));
+const u_char *	p_cdnname __P((const u_char *, const u_char *, int, FILE *));
+const u_char *	p_cdname __P((const u_char *, const u_char *, FILE *));
+const u_char *	p_fqnname __P((const u_char *cp, const u_char *msg,
+			       int, char *, int));
+const u_char *	p_fqname __P((const u_char *, const u_char *, FILE *));
+const char *	p_option __P((u_long option));
+char *		p_secstodate __P((u_long));
+int		dn_count_labels __P((const char *));
+int		dn_comp __P((const char *, u_char *, int,
+			     u_char **, u_char **));
+int		dn_expand __P((const u_char *, const u_char *, const u_char *,
+			       char *, int));
+u_int		res_randomid __P((void));
+int		res_nameinquery __P((const char *, int, int,
+				     const u_char *, const u_char *));
+int		res_queriesmatch __P((const u_char *, const u_char *,
+				      const u_char *, const u_char *));
+const char *	p_section __P((int section, int opcode));
+/* Things involving a resolver context. */
+int		res_ninit __P((res_state));
+int		res_nisourserver __P((const res_state,
+				      const struct sockaddr_in *));
+void		fp_resstat __P((const res_state, FILE *));
+void		res_npquery __P((const res_state, const u_char *, int, FILE *));
+const char *	res_hostalias __P((const res_state, const char *,
+				   char *, size_t));
+int		res_nquery __P((res_state,
+				const char *, int, int, u_char *, int));
+int		res_nsearch __P((res_state, const char *, int,
+				 int, u_char *, int));
+int		res_nquerydomain __P((res_state,
+				      const char *, const char *, int, int,
+				      u_char *, int));
+int		res_nmkquery __P((res_state,
+				  int, const char *, int, int, const u_char *,
+				  int, const u_char *, u_char *, int));
+int		res_nsend __P((res_state, const u_char *, int, u_char *, int));
+void		res_nclose __P((res_state));
 __END_DECLS
 
-#endif /*_RESOLV_H_*/
+#endif /* !_RESOLV_H_ */

+ 30 - 31
include/rpc/auth.h

@@ -77,7 +77,7 @@ union des_block {
 	char c[8];
 };
 typedef union des_block des_block;
-extern bool_t xdr_des_block __P ((XDR *__xdrs, des_block *__blkp));
+extern bool_t xdr_des_block (XDR *__xdrs, des_block *__blkp) __THROW;
 
 /*
  * Authentication info.  Opaque to client.
@@ -97,12 +97,12 @@ struct AUTH {
   struct opaque_auth ah_verf;
   union des_block ah_key;
   struct auth_ops {
-    void (*ah_nextverf) __PMT ((AUTH *));
-    int  (*ah_marshal) __PMT ((AUTH *, XDR *));	/* nextverf & serialize */
-    int  (*ah_validate) __PMT ((AUTH *, struct opaque_auth *));
+    void (*ah_nextverf) (AUTH *);
+    int  (*ah_marshal) (AUTH *, XDR *);		/* nextverf & serialize */
+    int  (*ah_validate) (AUTH *, struct opaque_auth *);
 						/* validate verifier */
-    int  (*ah_refresh) __PMT ((AUTH *));	/* refresh credentials */
-    void (*ah_destroy) __PMT ((AUTH *));     	/* destroy this structure */
+    int  (*ah_refresh) (AUTH *);		/* refresh credentials */
+    void (*ah_destroy) (AUTH *); 	    	/* destroy this structure */
   } *ah_ops;
   caddr_t ah_private;
 };
@@ -158,16 +158,15 @@ extern struct opaque_auth _null_auth;
  *	int len;
  *	int *aup_gids;
  */
-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 *));
+extern AUTH *authunix_create (char *__machname, __uid_t __uid, __gid_t __gid,
+			      int __len, __gid_t *__aup_gids) __THROW;
+extern AUTH *authunix_create_default (void) __THROW;
+extern AUTH *authnone_create (void) __THROW;
+extern AUTH *authdes_create (const char *__servername, u_int __window,
+			     struct sockaddr *__syncaddr, des_block *__ckey)
+     __THROW;
+extern AUTH *authdes_pk_create (const char *, netobj *, u_int,
+				struct sockaddr *, des_block *) __THROW;
 
 
 #define AUTH_NONE	0		/* no authentication */
@@ -183,31 +182,31 @@ extern AUTH *authdes_pk_create __P ((const char *, netobj *, u_int,
  *  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));
+extern int getnetname (char *) __THROW;
+extern int host2netname (char *, __const char *, __const char *) __THROW;
+extern int user2netname (char *, __const uid_t, __const char *) __THROW;
+extern int netname2user (__const char *, uid_t *, gid_t *, int *, gid_t *)
+     __THROW;
+extern int netname2host (__const char *, char *, __const int) __THROW;
 
 /*
  *
  * 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 *));
+extern int key_decryptsession (char *, des_block *) __THROW;
+extern int key_decryptsession_pk (char *, netobj *, des_block *) __THROW;
+extern int key_encryptsession (char *, des_block *) __THROW;
+extern int key_encryptsession_pk (char *, netobj *, des_block *) __THROW;
+extern int key_gendes (des_block *) __THROW;
+extern int key_setsecret (char *) __THROW;
+extern int key_secretkey_is_set (void) __THROW;
+extern int key_get_conv (char *, des_block *) __THROW;
 
 /*
  * XDR an opaque authentication struct.
  */
-extern bool_t xdr_opaque_auth __P ((XDR *, struct opaque_auth *));
+extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *) __THROW;
 
 __END_DECLS
 

+ 16 - 17
include/rpc/auth_des.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _RPC_AUTH_DES_H
 #define _RPC_AUTH_DES_H	1
@@ -86,26 +86,25 @@ struct authdes_verf
 #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));
+extern int authdes_getucred (__const struct authdes_cred * __adc,
+			     uid_t * __uid, gid_t * __gid,
+			     short *__grouplen, gid_t * __groups) __THROW;
 
 /* 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 HEXKEYBYTES + 1 bytes long to fit all characters from the key.  */
-extern int getpublickey __P ((__const char *__name, char *__key));
+extern int getpublickey (__const char *__name, char *__key) __THROW;
 
 /* 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 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 getsecretkey (__const char *__name, char *__key,
+			 __const char *__passwd) __THROW;
 
-extern int rtime __P ((struct sockaddr_in *__addrp,
-		       struct rpc_timeval *__timep,
-		       struct rpc_timeval *__timeout));
+extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
+		  struct rpc_timeval *__timeout) __THROW;
 
 __END_DECLS
 

+ 2 - 2
include/rpc/auth_unix.h

@@ -72,8 +72,8 @@ struct authunix_parms
     __gid_t *aup_gids;
   };
 
-extern bool_t xdr_authunix_parms __P ((XDR *__xdrs,
-				       struct authunix_parms *__p));
+extern bool_t xdr_authunix_parms (XDR *__xdrs, struct authunix_parms *__p)
+     __THROW;
 
 /*
  * If a response verifier has flavor AUTH_SHORT,

+ 41 - 43
include/rpc/clnt.h

@@ -133,17 +133,16 @@ 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));
+    enum clnt_stat (*cl_call) (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 *));
+    void (*cl_abort) (void);	/* abort a call */
+    void (*cl_geterr) (CLIENT *, struct rpc_err *);
 				/* get specific error code */
-    bool_t (*cl_freeres) __PMT ((CLIENT *, xdrproc_t, caddr_t));
+    bool_t (*cl_freeres) (CLIENT *, xdrproc_t, caddr_t);
 				/* frees results */
-    void (*cl_destroy) __PMT ((CLIENT *)); /* destroy this structure */
-    bool_t (*cl_control) __PMT ((CLIENT *, int, char *));
+    void (*cl_destroy) (CLIENT *); /* destroy this structure */
+    bool_t (*cl_control) (CLIENT *, int, char *);
 				/* the ioctl() of rpc */
   } *cl_ops;
   caddr_t cl_private;		/* private stuff */
@@ -278,8 +277,8 @@ struct CLIENT {
  *	u_long prog;
  *	u_long vers;
  */
-extern CLIENT *clntraw_create __P ((__const u_long __prog,
-				    __const u_long __vers));
+extern CLIENT *clntraw_create (__const u_long __prog, __const u_long __vers)
+     __THROW;
 
 
 /*
@@ -292,8 +291,9 @@ extern CLIENT *clntraw_create __P ((__const u_long __prog,
  *	u_ong 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));
+extern CLIENT *clnt_create (__const char *__host, __const u_long __prog,
+			    __const u_long __vers, __const char *__prot)
+     __THROW;
 
 
 /*
@@ -307,10 +307,9 @@ extern CLIENT *clnt_create __P ((__const char *__host, __const u_long __prog,
  *	u_int sendsz;
  *	u_int recvsz;
  */
-extern CLIENT *clnttcp_create __P ((struct sockaddr_in *__raddr,
-				    u_long __prog, u_long __version,
-				    int *__sockp, u_int __sendsz,
-				    u_int __recvsz));
+extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, u_long __prog,
+			       u_long __version, int *__sockp, u_int __sendsz,
+			       u_int __recvsz) __THROW;
 
 /*
  * UDP based rpc.
@@ -333,15 +332,15 @@ extern CLIENT *clnttcp_create __P ((struct sockaddr_in *__raddr,
  *	u_int sendsz;
  *	u_int recvsz;
  */
-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));
+extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, u_long __program,
+			       u_long __version, struct timeval __wait_resend,
+			       int *__sockp) __THROW;
+extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr,
+				  u_long __program, u_long __version,
+				  struct timeval __wait_resend, int *__sockp,
+				  u_int __sendsz, u_int __recvsz) __THROW;
+
+
 
 
 /*
@@ -355,35 +354,34 @@ extern CLIENT *clntudp_bufcreate __P ((struct sockaddr_in *__raddr,
  *      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 CLIENT *clntunix_create  (struct sockaddr_un *__raddr, u_long __program,
+				 u_long __version, int *__sockp,
+				 u_int __sendsz, u_int __recvsz) __THROW;
 
 
-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));
+extern int callrpc (__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) __THROW;
+extern int _rpc_dtablesize (void) __THROW;
 
 /*
  * Print why creation failed
  */
-extern void clnt_pcreateerror __P ((__const char *__msg));	/* stderr */
-extern char *clnt_spcreateerror __P ((__const char *__msg));	/* string */
+extern void clnt_pcreateerror (__const char *__msg) __THROW;	/* stderr */
+extern char *clnt_spcreateerror(__const char *__msg) __THROW;	/* string */
 
 /*
  * Like clnt_perror(), but is more verbose in its output
  */
-extern void clnt_perrno __P ((enum clnt_stat __num));	/* stderr */
+extern void clnt_perrno (enum clnt_stat __num) __THROW;		/* stderr */
 
 /*
  * Print an English error message, given the client error code
  */
-extern void clnt_perror __P ((CLIENT *__clnt, __const char *__msg));
+extern void clnt_perror (CLIENT *__clnt, __const char *__msg) __THROW;
 							/* stderr */
-extern char *clnt_sperror __P ((CLIENT *__clnt, __const char *__msg));
+extern char *clnt_sperror (CLIENT *__clnt, __const char *__msg) __THROW;
 							/* string */
 
 /*
@@ -401,19 +399,19 @@ extern struct rpc_createerr rpc_createerr;
 /*
  * Copy error message to buffer.
  */
-extern char *clnt_sperrno __P ((enum clnt_stat __num));	/* string */
+extern char *clnt_sperrno (enum clnt_stat __num) __THROW;	/* 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));
+extern int getrpcport (__const char * __host, u_long __prognum,
+		       u_long __versnum, u_int proto) __THROW;
 
 /*
  * get the local host's IP address without consulting
  * name service library functions
  */
-extern void get_myaddress __P ((struct sockaddr_in *));
+extern void get_myaddress (struct sockaddr_in *) __THROW;
 
 #define UDPMSGSIZE	8800	/* rpc imposed limit on udp msg size */
 #define RPCSMALLMSGSIZE	400	/* a more reasonable packet size */

+ 12 - 12
include/rpc/des_crypt.h

@@ -11,23 +11,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
@@ -47,7 +47,7 @@ __BEGIN_DECLS
 
 
 #define DES_DEVMASK (1 << 1)
-#define	DES_HW (0*DES_DEVMASK)	/* Use hardware device */ 
+#define	DES_HW (0*DES_DEVMASK)	/* Use hardware device */
 #define DES_SW (1*DES_DEVMASK)	/* Use software device */
 
 
@@ -77,20 +77,20 @@ __BEGIN_DECLS
 /*
  * Cipher Block Chaining mode
  */
-extern int cbc_crypt __P ((char *__key, char *__buf, unsigned __len,
-			   unsigned __mode, char *__ivec));
+extern int cbc_crypt (char *__key, char *__buf, unsigned __len,
+		      unsigned __mode, char *__ivec) __THROW;
 
 /*
  * Electronic Code Book mode
  */
-extern int ecb_crypt __P ((char *__key, char *__buf, unsigned __len,
-			   unsigned __mode));
+extern int ecb_crypt (char *__key, char *__buf, unsigned __len,
+		      unsigned __mode) __THROW;
 
-/* 
+/*
  * 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));
+extern void des_setparity (char *__key) __THROW;
 
 __END_DECLS
 

+ 13 - 13
include/rpc/netdb.h

@@ -50,23 +50,23 @@ struct rpcent
   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));
+extern void setrpcent (int __stayopen) __THROW;
+extern void endrpcent (void) __THROW;
+extern struct rpcent *getrpcbyname (__const char *__name) __THROW;
+extern struct rpcent *getrpcbynumber (int __number) __THROW;
+extern struct rpcent *getrpcent (void) __THROW;
 
 #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 getrpcbyname_r (__const char *__name, struct rpcent *__result_buf,
+			   char *__buffer, size_t __buflen,
+			   struct rpcent **__result) __THROW;
 
-extern int getrpcbynumber_r __P ((int __number, struct rpcent *__result_buf,
-				  char *__buffer, size_t __buflen,
-				  struct rpcent **__result));
+extern int getrpcbynumber_r (int __number, struct rpcent *__result_buf,
+			     char *__buffer, size_t __buflen,
+			     struct rpcent **__result) __THROW;
 
-extern int getrpcent_r __P ((struct rpcent *__result_buf, char *__buffer,
-			     size_t __buflen, struct rpcent **__result));
+extern int getrpcent_r (struct rpcent *__result_buf, char *__buffer,
+			size_t __buflen, struct rpcent **__result) __THROW;
 #endif
 
 __END_DECLS

+ 24 - 26
include/rpc/pmap_clnt.h

@@ -45,8 +45,7 @@
 
 __BEGIN_DECLS
 
-typedef bool_t (*resultproc_t) __PMT ((caddr_t resp,
-				       struct sockaddr_in *raddr));
+typedef bool_t (*resultproc_t) (caddr_t resp, struct sockaddr_in *raddr);
 
 /*
  * Usage:
@@ -70,30 +69,29 @@ typedef bool_t (*resultproc_t) __PMT ((caddr_t resp,
  *		address if the responder to the broadcast.
  */
 
-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));
+extern bool_t pmap_set (__const u_long __program, __const u_long __vers,
+			int __protocol, u_short __port) __THROW;
+extern bool_t pmap_unset (__const u_long __program, __const u_long __vers)
+     __THROW;
+extern struct pmaplist *pmap_getmaps (struct sockaddr_in *__address) __THROW;
+extern enum clnt_stat pmap_rmtcall (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) __THROW;
+extern enum clnt_stat clnt_broadcast (__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) __THROW;
+extern u_short pmap_getport (struct sockaddr_in *__address,
+			     __const u_long __program,
+			     __const u_long __version, u_int __protocol)
+     __THROW;
 
 __END_DECLS
 

+ 2 - 2
include/rpc/pmap_prot.h

@@ -94,14 +94,14 @@ struct pmap {
 	long unsigned pm_port;
 };
 
-extern bool_t xdr_pmap __P ((XDR *__xdrs, struct pmap *__regs));
+extern bool_t xdr_pmap (XDR *__xdrs, struct pmap *__regs) __THROW;
 
 struct pmaplist {
 	struct pmap	pml_map;
 	struct pmaplist *pml_next;
 };
 
-extern bool_t xdr_pmaplist __P ((XDR *__xdrs, struct pmaplist **__rp));
+extern bool_t xdr_pmaplist (XDR *__xdrs, struct pmaplist **__rp) __THROW;
 
 __END_DECLS
 

+ 3 - 2
include/rpc/pmap_rmt.h

@@ -51,7 +51,8 @@ struct rmtcallargs {
 	xdrproc_t xdr_args;
 };
 
-extern bool_t xdr_rmtcall_args __P ((XDR *__xdrs, struct rmtcallargs *__crp));
+extern bool_t xdr_rmtcall_args (XDR *__xdrs, struct rmtcallargs *__crp)
+     __THROW;
 
 struct rmtcallres {
 	u_long *port_ptr;
@@ -60,7 +61,7 @@ struct rmtcallres {
 	xdrproc_t xdr_results;
 };
 
-extern bool_t xdr_rmtcallres __P ((XDR *__xdrs, struct rmtcallres *__crp));
+extern bool_t xdr_rmtcallres (XDR *__xdrs, struct rmtcallres *__crp) __THROW;
 
 __END_DECLS
 

+ 30 - 1
include/rpc/rpc.h

@@ -65,6 +65,35 @@
  * defined by <rpc/netdb.h> included in <netdb.h>.
  */
 /* routines for parsing /etc/rpc */
-//#include <rpc/netdb.h>		/* structures and routines to parse /etc/rpc */
+#include <rpc/netdb.h>		/* structures and routines to parse /etc/rpc */
+
+__BEGIN_DECLS
+
+#if 0
+/* Global variables, protected for multi-threaded applications.  */
+extern fd_set *__rpc_thread_svc_fdset (void) __attribute__ ((__const__));
+#define svc_fdset (*__rpc_thread_svc_fdset ())
+
+extern struct rpc_createerr *__rpc_thread_createerr (void)
+     __attribute__ ((__const__));
+#define get_rpc_createerr() (*__rpc_thread_createerr ())
+/* The people who "engineered" RPC should bee punished for naming the
+   data structure and the variable the same.  We cannot always define the
+   macro 'rpc_createerr' because this would prevent people from defining
+   object of type 'struct rpc_createerr'.  So we leave it up to the user
+   to select transparent replacement also of this variable.  */
+#ifdef _RPC_MT_VARS
+# define rpc_createerr (*__rpc_thread_createerr ())
+#endif
+
+extern struct pollfd **__rpc_thread_svc_pollfd (void)
+     __attribute__ ((__const__));
+#define svc_pollfd (*__rpc_thread_svc_pollfd ())
+
+extern int *__rpc_thread_svc_max_pollfd (void) __attribute__ ((__const__));
+#define svc_max_pollfd (*__rpc_thread_svc_max_pollfd ())
+#endif
+
+__END_DECLS
 
 #endif /* rpc/rpc.h */

+ 5 - 5
include/rpc/rpc_msg.h

@@ -170,7 +170,7 @@ struct rpc_msg {
  * 	XDR *xdrs;
  * 	struct rpc_msg *cmsg;
  */
-extern bool_t	xdr_callmsg __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
+extern bool_t	xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
 
 /*
  * XDR routine to pre-serialize the static part of a rpc message.
@@ -178,7 +178,7 @@ extern bool_t	xdr_callmsg __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
  * 	XDR *xdrs;
  * 	struct rpc_msg *cmsg;
  */
-extern bool_t	xdr_callhdr __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
+extern bool_t	xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
 
 /*
  * XDR routine to handle a rpc reply.
@@ -186,7 +186,7 @@ extern bool_t	xdr_callhdr __P ((XDR *__xdrs, struct rpc_msg *__cmsg));
  * 	XDR *xdrs;
  * 	struct rpc_msg *rmsg;
  */
-extern bool_t	xdr_replymsg __P ((XDR *__xdrs, struct rpc_msg *__rmsg));
+extern bool_t	xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg) __THROW;
 
 /*
  * Fills in the error part of a reply message.
@@ -194,8 +194,8 @@ extern bool_t	xdr_replymsg __P ((XDR *__xdrs, struct rpc_msg *__rmsg));
  * 	struct rpc_msg *msg;
  * 	struct rpc_err *error;
  */
-extern void	_seterr_reply __P ((struct rpc_msg *__msg,
-				    struct rpc_err *__error));
+extern void	_seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error)
+     __THROW;
 
 __END_DECLS
 

+ 55 - 56
include/rpc/svc.h

@@ -1,4 +1,3 @@
-/* @(#)svc.h	2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -78,18 +77,18 @@ 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));
+    bool_t	(*xp_recv) (SVCXPRT *__xprt, struct rpc_msg *__msg);
 				/* receive incoming requests */
-    enum xprt_stat (*xp_stat) __PMT ((SVCXPRT *__xprt));
+    enum xprt_stat (*xp_stat) (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));
+    bool_t	(*xp_getargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args,
+			       caddr_t args_ptr); /* get arguments */
+    bool_t	(*xp_reply) (SVCXPRT *__xprt, struct rpc_msg *__msg);
 				/* send reply */
-    bool_t	(*xp_freeargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
-				       caddr_t args_ptr));
+    bool_t	(*xp_freeargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args,
+				caddr_t args_ptr);
 				/* free mem allocated for args */
-    void	(*xp_destroy) __PMT ((SVCXPRT *__xprt));
+    void	(*xp_destroy) (SVCXPRT *__xprt);
 				/* destroy this struct */
   } *xp_ops;
   int		xp_addrlen;	 /* length of remote address */
@@ -97,6 +96,7 @@ struct SVCXPRT {
   struct opaque_auth xp_verf;	 /* raw response verifier */
   caddr_t		xp_p1;		 /* private */
   caddr_t		xp_p2;		 /* private */
+  char		xp_pad [256];	/* padding, internal use */
 };
 
 /*
@@ -147,17 +147,17 @@ struct SVCXPRT {
  * Service request
  */
 struct svc_req {
-	u_long		rq_prog;	/* service program number */
-	u_long		rq_vers;	/* service protocol version */
-	u_long		rq_proc;	/* the desired procedure */
-	struct opaque_auth rq_cred;	/* raw creds from the wire */
-	caddr_t		rq_clntcred;	/* read only cooked cred */
-	SVCXPRT	*rq_xprt;		/* associated transport */
+  rpcprog_t rq_prog;            /* service program number */
+  rpcvers_t rq_vers;            /* service protocol version */
+  rpcproc_t rq_proc;            /* the desired procedure */
+  struct opaque_auth rq_cred;   /* raw creds from the wire */
+  caddr_t rq_clntcred;          /* read only cooked cred */
+  SVCXPRT *rq_xprt;             /* associated transport */
 };
 
 #ifndef __DISPATCH_FN_T
 #define __DISPATCH_FN_T
-typedef void (*__dispatch_fn_t) __PMT ((struct svc_req*, SVCXPRT*));
+typedef void (*__dispatch_fn_t) (struct svc_req*, SVCXPRT*);
 #endif
 
 /*
@@ -165,23 +165,23 @@ typedef void (*__dispatch_fn_t) __PMT ((struct svc_req*, SVCXPRT*));
  *
  * svc_register(xprt, prog, vers, dispatch, protocol)
  *	SVCXPRT *xprt;
- *	u_long prog;
- *	u_long vers;
- *	void (*dispatch)();
- *	u_long protocol;  like TCP or UDP, zero means do not register
+ *	rpcprog_t prog;
+ *	rpcvers_t vers;
+ *	void (*dispatch)(struct svc_req*, SVCXPRT*);
+ *	rpcprot_t 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));
+extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog,
+			    rpcvers_t __vers, __dispatch_fn_t __dispatch,
+			    rpcprot_t __protocol) __THROW;
 
 /*
  * Service un-registration
  *
  * svc_unregister(prog, vers)
- *	u_long prog;
- *	u_long vers;
+ *	rpcprog_t prog;
+ *	rpcvers_t vers;
  */
-extern void	svc_unregister __P ((u_long __prog, u_long __vers));
+extern void svc_unregister (rpcprog_t __prog, rpcvers_t __vers) __THROW;
 
 /*
  * Transport registration.
@@ -189,7 +189,7 @@ extern void	svc_unregister __P ((u_long __prog, u_long __vers));
  * xprt_register(xprt)
  *	SVCXPRT *xprt;
  */
-extern void	xprt_register __P ((SVCXPRT *__xprt));
+extern void xprt_register (SVCXPRT *__xprt) __THROW;
 
 /*
  * Transport un-register
@@ -197,9 +197,7 @@ extern void	xprt_register __P ((SVCXPRT *__xprt));
  * xprt_unregister(xprt)
  *	SVCXPRT *xprt;
  */
-extern void	xprt_unregister __P ((SVCXPRT *__xprt));
-
-
+extern void xprt_unregister (SVCXPRT *__xprt) __THROW;
 
 
 /*
@@ -228,23 +226,23 @@ extern void	xprt_unregister __P ((SVCXPRT *__xprt));
  * deadlock the caller and server processes!
  */
 
-extern bool_t	svc_sendreply __P ((SVCXPRT *xprt, xdrproc_t __xdr_results,
-				    caddr_t __xdr_location));
+extern bool_t	svc_sendreply (SVCXPRT *xprt, xdrproc_t __xdr_results,
+			       caddr_t __xdr_location) __THROW;
 
-extern void	svcerr_decode __P ((SVCXPRT *__xprt));
+extern void	svcerr_decode (SVCXPRT *__xprt) __THROW;
 
-extern void	svcerr_weakauth __P ((SVCXPRT *__xprt));
+extern void	svcerr_weakauth (SVCXPRT *__xprt) __THROW;
 
-extern void	svcerr_noproc __P ((SVCXPRT *__xprt));
+extern void	svcerr_noproc (SVCXPRT *__xprt) __THROW;
 
-extern void	svcerr_progvers __P ((SVCXPRT *__xprt, u_long __low_vers,
-				      u_long __high_vers));
+extern void	svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers,
+				 rpcvers_t __high_vers) __THROW;
 
-extern void	svcerr_auth __P ((SVCXPRT *__xprt, enum auth_stat __why));
+extern void	svcerr_auth (SVCXPRT *__xprt, enum auth_stat __why) __THROW;
 
-extern void	svcerr_noprog __P ((SVCXPRT *__xprt));
+extern void	svcerr_noprog (SVCXPRT *__xprt) __THROW;
 
-extern void	svcerr_systemerr __P ((SVCXPRT *__xprt));
+extern void	svcerr_systemerr (SVCXPRT *__xprt) __THROW;
 
 /*
  * Lowest level dispatching -OR- who owns this process anyway.
@@ -261,21 +259,22 @@ extern void	svcerr_systemerr __P ((SVCXPRT *__xprt));
  * Global keeper of rpc service descriptors in use
  * dynamic; must be inspected before each call to select
  */
-#ifdef FD_SETSIZE
+
+extern struct pollfd *svc_pollfd;
+extern int svc_max_pollfd;
 extern fd_set svc_fdset;
 #define svc_fds svc_fdset.fds_bits[0]	/* compatibility */
-#else
-extern int svc_fds;
-#endif /* def FD_SETSIZE */
 
 /*
  * a small program implemented by the svc_rpc implementation itself;
  * also see clnt.h for protocol numbers.
  */
-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));
+extern void svc_getreq (int __rdfds) __THROW;
+extern void svc_getreq_common (const int __fd) __THROW;
+extern void svc_getreqset (fd_set *__readfds) __THROW;
+extern void svc_getreq_poll (struct pollfd *, const int) __THROW;
+extern void svc_exit (void) __THROW;
+extern void svc_run (void) __THROW;
 
 /*
  * Socket to use on svcxxx_create call to get default socket
@@ -289,27 +288,27 @@ extern void svc_run __P ((void));
 /*
  * Memory based rpc for testing and timing.
  */
-extern SVCXPRT *svcraw_create __P ((void));
+extern SVCXPRT *svcraw_create (void) __THROW;
 
 /*
  * Udp based rpc.
  */
-extern SVCXPRT *svcudp_create __P ((int __sock));
-extern SVCXPRT *svcudp_bufcreate __P ((int __sock, u_int __sendsz,
-				       u_int __recvsz));
+extern SVCXPRT *svcudp_create (int __sock) __THROW;
+extern SVCXPRT *svcudp_bufcreate (int __sock, u_int __sendsz, u_int __recvsz)
+     __THROW;
 
 /*
  * Tcp based rpc.
  */
-extern SVCXPRT *svctcp_create __P ((int __sock, u_int __sendsize,
-				    u_int __recvsize));
+extern SVCXPRT *svctcp_create (int __sock, u_int __sendsize, u_int __recvsize)
+     __THROW;
 
 
 /*
  * Unix based rpc.
  */
-extern SVCXPRT *svcunix_create __P ((int __sock, u_int __sendsize,
-				     u_int __recvsize, char *__path));
+extern SVCXPRT *svcunix_create (int __sock, u_int __sendsize, u_int __recvsize,
+				char *__path) __THROW;
 
 
 __END_DECLS

+ 2 - 2
include/rpc/svc_auth.h

@@ -46,8 +46,8 @@ __BEGIN_DECLS
 /*
  * Server side authenticator
  */
-extern enum auth_stat _authenticate __P ((struct svc_req *__rqst,
-					  struct rpc_msg *__msg));
+extern enum auth_stat _authenticate (struct svc_req *__rqst,
+				     struct rpc_msg *__msg) __THROW;
 
 __END_DECLS
 

+ 23 - 3
include/rpc/types.h

@@ -1,4 +1,3 @@
-/* @(#)types.h	2.3 88/08/15 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
@@ -27,8 +26,6 @@
  * 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>
@@ -38,6 +35,12 @@
 
 typedef int bool_t;
 typedef int enum_t;
+/* This needs to be changed to uint32_t in the future */
+typedef unsigned long rpcprog_t;
+typedef unsigned long rpcvers_t;
+typedef unsigned long rpcproc_t;
+typedef unsigned long rpcprot_t;
+typedef unsigned long rpcport_t;
 
 #define        __dontcare__    -1
 
@@ -60,6 +63,23 @@ typedef int enum_t;
 #ifndef makedev /* ie, we haven't already included it */
 #include <sys/types.h>
 #endif
+
+#ifndef __u_char_defined
+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;
+# define __u_char_defined
+#endif
+#ifndef __daddr_t_defined
+typedef __daddr_t daddr_t;
+typedef __caddr_t caddr_t;
+# define __daddr_t_defined
+#endif
+
 #include <sys/time.h>
 #include <sys/param.h>
 

+ 67 - 69
include/rpc/xdr.h

@@ -114,27 +114,25 @@ struct XDR
     enum xdr_op x_op;		/* operation; fast additional param */
     struct xdr_ops
       {
-	bool_t (*x_getlong) __PMT ((XDR *__xdrs, long *__lp));
+	bool_t (*x_getlong) (XDR *__xdrs, long *__lp);
 	/* get a long from underlying stream */
-	bool_t (*x_putlong) __PMT ((XDR *__xdrs, __const long *__lp));
+	bool_t (*x_putlong) (XDR *__xdrs, __const long *__lp);
 	/* put a long to " */
-	bool_t (*x_getbytes) __PMT ((XDR *__xdrs, caddr_t __addr,
-				     u_int __len));
+	bool_t (*x_getbytes) (XDR *__xdrs, caddr_t __addr, u_int __len);
 	/* get some bytes from " */
-	bool_t (*x_putbytes) __PMT ((XDR *__xdrs, __const char *__addr,
-				     u_int __len));
+	bool_t (*x_putbytes) (XDR *__xdrs, __const char *__addr, u_int __len);
 	/* put some bytes to " */
-	u_int (*x_getpostn) __PMT ((__const XDR *__xdrs));
+	u_int (*x_getpostn) (__const XDR *__xdrs);
 	/* returns bytes off from beginning */
-	bool_t (*x_setpostn) __PMT ((XDR *__xdrs, u_int pos));
+	bool_t (*x_setpostn) (XDR *__xdrs, u_int __pos);
 	/* lets you reposition the stream */
-	int32_t *(*x_inline) __PMT ((XDR *__xdrs, int len));
+	int32_t *(*x_inline) (XDR *__xdrs, int __len);
 	/* buf quick ptr to buffered data */
-	void (*x_destroy) __PMT ((XDR *__xdrs));
+	void (*x_destroy) (XDR *__xdrs);
 	/* free privates of this xdr_stream */
-	bool_t (*x_getint32) __PMT ((XDR *__xdrs, int32_t *__ip));
+	bool_t (*x_getint32) (XDR *__xdrs, int32_t *__ip);
 	/* get a int from underlying stream */
-	bool_t (*x_putint32) __PMT ((XDR *__xdrs, __const int32_t *__ip));
+	bool_t (*x_putint32) (XDR *__xdrs, __const int32_t *__ip);
 	/* put a int to " */
       }
      *x_ops;
@@ -153,7 +151,7 @@ struct XDR
  * allocate dynamic storage of the appropriate size and return it.
  * bool_t       (*xdrproc_t)(XDR *, caddr_t *);
  */
-typedef bool_t (*xdrproc_t) __PMT ((XDR *, void *,...));
+typedef bool_t (*xdrproc_t) (XDR *, void *,...);
 
 
 /*
@@ -288,49 +286,49 @@ struct xdr_discrim
  * 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 __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 *));
+extern bool_t xdr_void (void) __THROW;
+extern bool_t xdr_short (XDR *__xdrs, short *__sp) __THROW;
+extern bool_t xdr_u_short (XDR *__xdrs, u_short *__usp) __THROW;
+extern bool_t xdr_int (XDR *__xdrs, int *__ip) __THROW;
+extern bool_t xdr_u_int (XDR *__xdrs, u_int *__up) __THROW;
+extern bool_t xdr_long (XDR *__xdrs, long *__lp) __THROW;
+extern bool_t xdr_u_long (XDR *__xdrs, u_long *__ulp) __THROW;
+extern bool_t xdr_hyper (XDR *__xdrs, quad_t *__llp) __THROW;
+extern bool_t xdr_u_hyper (XDR *__xdrs, u_quad_t *__ullp) __THROW;
+extern bool_t xdr_longlong_t (XDR *__xdrs, quad_t *__llp) __THROW;
+extern bool_t xdr_u_longlong_t (XDR *__xdrs, u_quad_t *__ullp) __THROW;
+extern bool_t xdr_int8_t (XDR *__xdrs, int8_t *__ip) __THROW;
+extern bool_t xdr_uint8_t (XDR *__xdrs, uint8_t *__up) __THROW;
+extern bool_t xdr_int16_t (XDR *__xdrs, int16_t *__ip) __THROW;
+extern bool_t xdr_uint16_t (XDR *__xdrs, uint16_t *__up) __THROW;
+extern bool_t xdr_int32_t (XDR *__xdrs, int32_t *__ip) __THROW;
+extern bool_t xdr_uint32_t (XDR *__xdrs, uint32_t *__up) __THROW;
+extern bool_t xdr_int64_t (XDR *__xdrs, int64_t *__ip) __THROW;
+extern bool_t xdr_uint64_t (XDR *__xdrs, uint64_t *__up) __THROW;
+extern bool_t xdr_bool (XDR *__xdrs, bool_t *__bp) __THROW;
+extern bool_t xdr_enum (XDR *__xdrs, enum_t *__ep) __THROW;
+extern bool_t xdr_array (XDR * _xdrs, caddr_t *__addrp, u_int *__sizep,
+			 u_int __maxsize, u_int __elsize, xdrproc_t __elproc)
+     __THROW;
+extern bool_t xdr_bytes (XDR *__xdrs, char **__cpp, u_int *__sizep,
+			 u_int __maxsize) __THROW;
+extern bool_t xdr_opaque (XDR *__xdrs, caddr_t __cp, u_int __cnt) __THROW;
+extern bool_t xdr_string (XDR *__xdrs, char **__cpp, u_int __maxsize) __THROW;
+extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp,
+			 __const struct xdr_discrim *__choices,
+			 xdrproc_t dfault) __THROW;
+extern bool_t xdr_char (XDR *__xdrs, char *__cp) __THROW;
+extern bool_t xdr_u_char (XDR *__xdrs, u_char *__cp) __THROW;
+extern bool_t xdr_vector (XDR *__xdrs, char *__basep, u_int __nelem,
+			  u_int __elemsize, xdrproc_t __xdr_elem) __THROW;
+extern bool_t xdr_float (XDR *__xdrs, float *__fp) __THROW;
+extern bool_t xdr_double (XDR *__xdrs, double *__dp) __THROW;
+extern bool_t xdr_reference (XDR *__xdrs, caddr_t *__xpp, u_int __size,
+			     xdrproc_t __proc) __THROW;
+extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp,
+			   u_int __obj_size, xdrproc_t __xdr_obj) __THROW;
+extern bool_t xdr_wrapstring (XDR *__xdrs, char **__cpp) __THROW;
+extern u_long xdr_sizeof (xdrproc_t, void *) __THROW;
 
 /*
  * Common opaque bytes objects used by many rpc protocols;
@@ -343,7 +341,7 @@ struct netobj
   char *n_bytes;
 };
 typedef struct netobj netobj;
-extern bool_t xdr_netobj __P ((XDR *__xdrs, struct netobj *__np));
+extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np) __THROW;
 
 /*
  * These are the public routines for the various implementations of
@@ -351,30 +349,30 @@ extern bool_t xdr_netobj __P ((XDR *__xdrs, struct netobj *__np));
  */
 
 /* XDR using memory buffers */
-extern void xdrmem_create __P ((XDR *__xdrs, __const caddr_t __addr,
-				u_int __size, enum xdr_op __xop));
+extern void xdrmem_create (XDR *__xdrs, __const caddr_t __addr,
+			   u_int __size, enum xdr_op __xop) __THROW;
 
 /* XDR using stdio library */
-extern void xdrstdio_create __P ((XDR *__xdrs, FILE *__file,
-				  enum xdr_op __xop));
+extern void xdrstdio_create (XDR *__xdrs, FILE *__file, enum xdr_op __xop)
+     __THROW;
 
 /* 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)));
+extern void xdrrec_create (XDR *__xdrs, u_int __sendsize,
+			   u_int __recvsize, caddr_t __tcp_handle,
+			   int (*__readit) (char *, char *, int),
+			   int (*__writeit) (char *, char *, int)) __THROW;
 
 /* make end of xdr record */
-extern bool_t xdrrec_endofrecord __P ((XDR *__xdrs, bool_t __sendnow));
+extern bool_t xdrrec_endofrecord (XDR *__xdrs, bool_t __sendnow) __THROW;
 
 /* move to beginning of next record */
-extern bool_t xdrrec_skiprecord __P ((XDR *__xdrs));
+extern bool_t xdrrec_skiprecord (XDR *__xdrs) __THROW;
 
 /* true if no more input */
-extern bool_t xdrrec_eof __P ((XDR *__xdrs));
+extern bool_t xdrrec_eof (XDR *__xdrs) __THROW;
 
 /* free memory buffers for xdr */
-extern void xdr_free __P ((xdrproc_t __proc, char *__objp));
+extern void xdr_free (xdrproc_t __proc, char *__objp) __THROW;
 
 __END_DECLS
 

+ 142 - 66
include/search.h

@@ -1,98 +1,174 @@
-/* Copyright (C) 1993 Ulrich Drepper
+/* Declarations for System V style searching functions.
+   Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-This file is intended to be included in the GNU C Library and the
-Linux C Library. So the copyright notice will be:
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
 
-Copyright (C) 1993 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., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
-
-For now the file can be distributed under the LGPL.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SEARCH_H
-#define _SEARCH_H
+#define	_SEARCH_H 1
 
 #include <features.h>
 
 #define __need_size_t
-#define __need_NULL
 #include <stddef.h>
 
-/* Get __compar_fn_t from stdlib.h */
-#include <stdlib.h>
-
 __BEGIN_DECLS
 
-#if 0
-#ifndef __COMPAR_FN_T
-#define __COMPAR_FN_T
-typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t));
-#endif
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
+/* Prototype structure for a linked-list data structure.
+   This is the type used by the `insque' and `remque' functions.  */
+
+# ifdef __USE_GNU
+struct qelem
+  {
+    struct qelem *q_forw;
+    struct qelem *q_back;
+    char q_data[1];
+  };
+# endif
+
+
+/* Insert ELEM into a doubly-linked list, after PREV.  */
+extern void insque (void *__elem, void *__prev) __THROW;
+
+/* Unlink ELEM from the doubly-linked list that it is in.  */
+extern void remque (void *__elem) __THROW;
 #endif
 
-/* for use with hsearch(3) */
 
-typedef struct entry { char *key; char *data; } ENTRY;
-typedef enum { FIND, ENTER } ACTION;
+/* For use with hsearch(3).  */
+#ifndef __COMPAR_FN_T
+# define __COMPAR_FN_T
+typedef int (*__compar_fn_t) (__const void *, __const void *);
+
+# ifdef	__USE_GNU
+typedef __compar_fn_t comparison_fn_t;
+# endif
+#endif
 
-extern ENTRY * hsearch __P((ENTRY __item, ACTION __action));
-extern int     hcreate __P((unsigned __nel));
-extern void    hdestroy __P((void));
+/* Action which shall be performed in the call the hsearch.  */
+typedef enum
+  {
+    FIND,
+    ENTER
+  }
+ACTION;
+
+typedef struct entry
+  {
+    char *key;
+    void *data;
+  }
+ENTRY;
+
+/* Opaque type for internal use.  */
+struct _ENTRY;
+
+/* Family of hash table handling functions.  The functions also
+   have reentrant counterparts ending with _r.  The non-reentrant
+   functions all work on a signle internal hashing table.  */
+
+/* Search for entry matching ITEM.key in internal hash table.  If
+   ACTION is `FIND' return found entry or signal error by returning
+   NULL.  If ACTION is `ENTER' replace existing data (if any) with
+   ITEM.data.  */
+extern ENTRY *hsearch (ENTRY __item, ACTION __action) __THROW;
+
+/* Create a new hashing table which will at most contain NEL elements.  */
+extern int hcreate (size_t __nel) __THROW;
+
+/* Destroy current internal hashing table.  */
+extern void hdestroy (void) __THROW;
+
+#ifdef __USE_GNU
+/* Data type for reentrant functions.  */
+struct hsearch_data
+  {
+    struct _ENTRY *table;
+    unsigned int size;
+    unsigned int filled;
+  };
+
+/* Reentrant versions which can handle multiple hashing tables at the
+   same time.  */
+extern int hsearch_r (ENTRY __item, ACTION __action, ENTRY **__retval,
+		      struct hsearch_data *__htab) __THROW;
+extern int hcreate_r (size_t __nel, struct hsearch_data *__htab) __THROW;
+extern void hdestroy_r (struct hsearch_data *__htab) __THROW;
+#endif
 
 
 /* The tsearch routines are very interesting. They make many
- * assumptions about the compiler. It assumpts that the first field
- * in node must be the "key" field, which points to the datum.
- * Everything depends on that. It is a very tricky stuff. H.J.
- */
+   assumptions about the compiler.  It assumes that the first field
+   in node must be the "key" field, which points to the datum.
+   Everything depends on that.  */
 /* For tsearch */
-typedef enum { preorder, postorder, endorder, leaf } VISIT;
+typedef enum
+{
+  preorder,
+  postorder,
+  endorder,
+  leaf
+}
+VISIT;
+
+/* Search for an entry matching the given KEY in the tree pointed to
+   by *ROOTP and insert a new element if not found.  */
+extern void *tsearch (__const void *__key, void **__rootp,
+		      __compar_fn_t __compar);
+
+/* Search for an entry matching the given KEY in the tree pointed to
+   by *ROOTP.  If no matching entry is available return NULL.  */
+extern void *tfind (__const void *__key, void *__const *__rootp,
+		    __compar_fn_t __compar);
+
+/* Remove the element matching KEY from the tree pointed to by *ROOTP.  */
+extern void *tdelete (__const void *__restrict __key,
+		      void **__restrict __rootp,
+		      __compar_fn_t __compar);
 
-extern void *tsearch __P((__const void * __key, void **__rootp,
-		__compar_fn_t compar));
+#ifndef __ACTION_FN_T
+# define __ACTION_FN_T
+typedef void (*__action_fn_t) (__const void *__nodep, VISIT __value,
+			       int __level);
+#endif
 
-extern void *tfind __P((__const void * __key, void * __const * __rootp,
-		__compar_fn_t compar));
+/* Walk through the whole tree and call the ACTION callback for every node
+   or leaf.  */
+extern void twalk (__const void *__root, __action_fn_t __action);
 
-extern void *tdelete __P((__const void * __key, void ** __rootp,
-		__compar_fn_t compar));
+#ifdef __USE_GNU
+/* Callback type for function to free a tree node.  If the keys are atomic
+   data this function should do nothing.  */
+typedef void (*__free_fn_t) (void *__nodep);
 
-#ifndef __ACTION_FN_T
-#define __ACTION_FN_T
-/* FYI, the first argument should be a pointer to "key".
- * Please read the man page for details.
- */
-typedef void (*__action_fn_t) __P((__const void *__nodep,
-				   __const VISIT __value,
-				   __const int __level));
+/* Destroy the whole tree, call FREEFCT for each node or leaf.  */
+extern void tdestroy (void *__root, __free_fn_t __freefct);
 #endif
 
-extern void twalk __P((__const void * __root, __action_fn_t action));
-
 
-extern void * lfind __P((__const void * __key, __const void * __base,
-                         size_t * __nmemb, size_t __size,
-                         __compar_fn_t __compar));
+/* Perform linear search for KEY by comparing by COMPAR in an array
+   [BASE,BASE+NMEMB*SIZE).  */
+extern void *lfind (__const void *__key, __const void *__base,
+		    size_t *__nmemb, size_t __size, __compar_fn_t __compar);
 
-extern void * lsearch __P((__const void * __key, __const void * __base,
-                         size_t * __nmemb, size_t __size,
-                         __compar_fn_t __compar));
+/* Perform linear search for KEY by comparing by COMPAR function in
+   array [BASE,BASE+NMEMB*SIZE) and insert entry if not found.  */
+extern void *lsearch (__const void *__key, void *__base,
+		      size_t *__nmemb, size_t __size, __compar_fn_t __compar);
 
 __END_DECLS
 

+ 37 - 32
include/setjmp.h

@@ -1,23 +1,23 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
- *	ISO C Standard: 4.6 NON-LOCAL JUMPS	<setjmp.h>
+ *	ISO C99 Standard: 7.13 Nonlocal jumps	<setjmp.h>
  */
 
 #ifndef	_SETJMP_H
@@ -34,50 +34,54 @@ __BEGIN_DECLS
 typedef struct __jmp_buf_tag	/* C++ doesn't like tagless structs.  */
   {
     /* NOTE: The machine-dependent definitions of `__sigsetjmp'
-       assume that a `jmp_buf' begins with a `__jmp_buf'.
-       Do not move this member or add others before it.  */
+       assume that a `jmp_buf' begins with a `__jmp_buf' and that
+       `__mask_was_saved' follows it.  Do not move these members
+       or add others before it.  */
     __jmp_buf __jmpbuf;		/* Calling environment.  */
     int __mask_was_saved;	/* Saved the signal mask?  */
     __sigset_t __saved_mask;	/* Saved signal mask.  */
   } jmp_buf[1];
 
 
+/* Store the calling environment in ENV, also saving the signal mask.
+   Return 0.  */
+extern int setjmp (jmp_buf __env) __THROW;
+
+/* Store the calling environment in ENV, not saving the signal mask.
+   Return 0.  */
+extern int _setjmp (jmp_buf __env) __THROW;
+
 /* Store the calling environment in ENV, also saving the
    signal mask if SAVEMASK is nonzero.  Return 0.
    This is the internal name for `sigsetjmp'.  */
-extern int __sigsetjmp __P ((jmp_buf __env, int __savemask));
+extern int __sigsetjmp (jmp_buf __env, int __savemask) __THROW;
 
 #ifndef	__FAVOR_BSD
-/* Set ENV to the current position and return 0, not saving the signal mask.
-   This is just like `sigsetjmp (ENV, 0)'.
-   The ISO C standard says `setjmp' is a macro.  */
-# define setjmp(env)	__sigsetjmp ((env), 0)
+/* Do not save the signal mask.  This is equivalent to the `_setjmp'
+   BSD function.  */
+# define setjmp(env)	_setjmp (env)
 #else
 /* We are in 4.3 BSD-compatibility mode in which `setjmp'
-   saves the signal mask like `sigsetjmp (ENV, 1)'.  */
-# define setjmp(env)	__sigsetjmp ((env), 1)
+   saves the signal mask like `sigsetjmp (ENV, 1)'.  We have to
+   define a macro since ISO C says `setjmp' is one.  */
+# define setjmp(env)	setjmp (env)
 #endif /* Favor BSD.  */
 
-#if defined __USE_BSD || defined __USE_XOPEN
-/* Set ENV to the current position and return 0, not saving the signal mask.
-   This is the 4.3 BSD name for ISO `setjmp'.  */
-# define _setjmp(env)	__sigsetjmp ((env), 0)
-#endif
-
 
 /* Jump to the environment saved in ENV, making the
    `setjmp' call there return VAL, or 1 if VAL is 0.  */
-extern void longjmp __P ((jmp_buf __env, int __val))
-     __attribute__ ((__noreturn__));
+extern void longjmp (jmp_buf __env, int __val)
+     __THROW __attribute__ ((__noreturn__));
 #if defined __USE_BSD || defined __USE_XOPEN
 /* Same.  Usually `_longjmp' is used with `_setjmp', which does not save
    the signal mask.  But it is how ENV was saved that determines whether
    `longjmp' restores the mask; `_longjmp' is just an alias.  */
-extern void _longjmp __P ((jmp_buf __env, int __val))
-     __attribute__ ((__noreturn__));
+extern void _longjmp (jmp_buf __env, int __val)
+     __THROW __attribute__ ((__noreturn__));
 #endif
 
 
+#ifdef	__USE_POSIX
 /* Use the same type for `jmp_buf' and `sigjmp_buf'.
    The `__mask_was_saved' flag determines whether
    or not `longjmp' will restore the signal mask.  */
@@ -85,14 +89,15 @@ typedef jmp_buf sigjmp_buf;
 
 /* Store the calling environment in ENV, also saving the
    signal mask if SAVEMASK is nonzero.  Return 0.  */
-# define sigsetjmp(env, savemask)	__sigsetjmp ((env), (savemask))
+# define sigsetjmp(env, savemask)	__sigsetjmp (env, savemask)
 
 /* Jump to the environment saved in ENV, making the
    sigsetjmp call there return VAL, or 1 if VAL is 0.
    Restore the signal mask if that sigsetjmp call saved it.
    This is just an alias `longjmp'.  */
-extern void siglongjmp __P ((sigjmp_buf __env, int __val))
-     __attribute__ ((__noreturn__));
+extern void siglongjmp (sigjmp_buf __env, int __val)
+     __THROW __attribute__ ((__noreturn__));
+#endif /* Use POSIX.  */
 
 __END_DECLS
 

+ 92 - 74
include/signal.h

@@ -1,23 +1,23 @@
-/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000, 2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
- *	ISO C Standard: 4.7 SIGNAL HANDLING <signal.h>
+ *	ISO C99 Standard: 7.14 Signal handling <signal.h>
  */
 
 #ifndef	_SIGNAL_H
@@ -27,7 +27,6 @@
 #endif
 
 #include <features.h>
-#include <sys/types.h>
 
 __BEGIN_DECLS
 
@@ -35,49 +34,63 @@ __BEGIN_DECLS
 
 /* An integral type that can be modified atomically, without the
    possibility of a signal arriving in the middle of the operation.  */
+#if defined __need_sig_atomic_t || defined _SIGNAL_H
+# ifndef __sig_atomic_t_defined
+#  define __sig_atomic_t_defined
 typedef __sig_atomic_t sig_atomic_t;
+# endif
+# undef __need_sig_atomic_t
+#endif
 
+#if defined __need_sigset_t || (defined _SIGNAL_H && defined __USE_POSIX)
+# ifndef __sigset_t_defined
+#  define __sigset_t_defined
 typedef __sigset_t sigset_t;
+# endif
+# undef __need_sigset_t
+#endif
 
 #ifdef _SIGNAL_H
 
-//#include <bits/types.h>
+#include <bits/types.h>
 #include <bits/signum.h>
 
 #ifdef __USE_XOPEN
-# ifndef pid_t
+# ifndef __pid_t_defined
 typedef __pid_t pid_t;
-#  define pid_t pid_t
+#  define __pid_t_defined
 # endif
-# ifndef uid_t
+# ifndef __uid_t_defined
 typedef __uid_t uid_t;
-#  define uid_t uid_t
+#  define __uid_t_defined
 # endif
 #endif	/* Unix98 */
 
 
 /* Type of a signal handler.  */
-typedef void (*__sighandler_t) __P ((int));
+typedef void (*__sighandler_t) (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));
+extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
+     __THROW;
 #ifdef __USE_GNU
-extern __sighandler_t sysv_signal __P ((int __sig, __sighandler_t __handler));
+extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
+     __THROW;
 #endif
 
 /* 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));
+extern __sighandler_t signal (int __sig, __sighandler_t __handler) __THROW;
 #else
 /* Make sure the used `signal' implementation is the SVID version. */
 # ifdef __REDIRECT
 extern __sighandler_t __REDIRECT (signal,
-				  __P ((int __sig, __sighandler_t __handler)),
+				  (int __sig,
+				   __sighandler_t __handler) __THROW,
 				  __sysv_signal);
 # else
 #  define signal __sysv_signal
@@ -87,35 +100,35 @@ extern __sighandler_t __REDIRECT (signal,
 #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));
+extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler) __THROW;
 #endif
 
 /* 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));
+extern int kill (__pid_t __pid, int __sig) __THROW;
 #endif /* Use POSIX.  */
 
 #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));
+extern int killpg (__pid_t __pgrp, int __sig) __THROW;
 #endif /* Use BSD || X/Open Unix.  */
 
 /* Raise signal SIG, i.e., send SIG to yourself.  */
-extern int raise __P ((int __sig));
+extern int raise (int __sig) __THROW;
 
 #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));
+extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) __THROW;
+extern int gsignal (int __sig) __THROW;
 #endif /* Use SVID.  */
 
 #ifdef __USE_MISC
 /* Print a message describing the meaning of the given signal number.  */
-extern void psignal __P ((int __sig, __const char *__s));
+extern void psignal (int __sig, __const char *__s) __THROW;
 #endif /* Use misc.  */
 
 
@@ -124,15 +137,18 @@ extern void psignal __P ((int __sig, __const char *__s));
    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 __sigpause (int __sig_or_mask, int __is_sig) __THROW;
 
 #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));
+extern int sigpause (int __mask) __THROW;
 # define sigpause(mask) __sigpause ((mask), 0)
 #else
 # ifdef __USE_XOPEN
+#  ifdef __GNUC__
+extern int sigpause (int __sig) __THROW __asm__ ("__xpg_sigpause");
+#  endif
 /* Remove a signal from the signal mask and suspend the process.  */
 #  define sigpause(sig) __sigpause ((sig), 1)
 # endif
@@ -149,13 +165,13 @@ extern int sigpause __P ((int __mask));
 # define sigmask(sig)	__sigmask(sig)
 
 /* Block signals in MASK, returning the old mask.  */
-extern int sigblock __P ((int __mask));
+extern int sigblock (int __mask) __THROW;
 
 /* Set the mask of blocked signals to MASK, returning the old mask.  */
-extern int sigsetmask __P ((int __mask));
+extern int sigsetmask (int __mask) __THROW;
 
 /* Return currently selected signal mask.  */
-extern int siggetmask __P ((void));
+extern int siggetmask (void) __THROW;
 #endif /* Use BSD.  */
 
 
@@ -184,31 +200,31 @@ typedef __sighandler_t sig_t;
 # endif
 
 /* Clear all signals from SET.  */
-extern int sigemptyset __P ((sigset_t *__set));
+extern int sigemptyset (sigset_t *__set) __THROW;
 
 /* Set all signals in SET.  */
-extern int sigfillset __P ((sigset_t *__set));
+extern int sigfillset (sigset_t *__set) __THROW;
 
 /* Add SIGNO to SET.  */
-extern int sigaddset __P ((sigset_t *__set, int __signo));
+extern int sigaddset (sigset_t *__set, int __signo) __THROW;
 
 /* Remove SIGNO from SET.  */
-extern int sigdelset __P ((sigset_t *__set, int __signo));
+extern int sigdelset (sigset_t *__set, int __signo) __THROW;
 
 /* Return 1 if SIGNO is in SET, 0 if not.  */
-extern int sigismember __P ((__const sigset_t *__set, int __signo));
+extern int sigismember (__const sigset_t *__set, int __signo) __THROW;
 
 # ifdef __USE_GNU
 /* Return non-empty value is SET is not empty.  */
-extern int sigisemptyset __P ((__const sigset_t *__set));
+extern int sigisemptyset (__const sigset_t *__set) __THROW;
 
 /* 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));
+extern int sigandset (sigset_t *__set, __const sigset_t *__left,
+		      __const sigset_t *__right) __THROW;
 
 /* 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));
+extern int sigorset (sigset_t *__set, __const sigset_t *__left,
+		     __const sigset_t *__right) __THROW;
 # endif /* GNU */
 
 /* Get the system-specific definitions of `struct sigaction'
@@ -216,37 +232,41 @@ extern int sigorset __P ((sigset_t *__set, __const sigset_t *__left,
 # 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));
+extern int sigprocmask (int __how, __const sigset_t *__restrict __set,
+			sigset_t *__restrict __oset) __THROW;
 
 /* 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));
+extern int sigsuspend (__const sigset_t *__set) __THROW;
 
 /* 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 (int __sig, __const struct sigaction *__restrict __act,
+		      struct sigaction *__restrict __oact) __THROW;
 
 /* Put in SET all signals that are blocked and waiting to be delivered.  */
-extern int sigpending __P ((sigset_t *__set));
+extern int sigpending (sigset_t *__set) __THROW;
 
 
 /* Select any of pending signals from SET or wait for any to arrive.  */
-extern int sigwait __P ((__const sigset_t *__set, int *__sig));
+extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig)
+     __THROW;
 
 # 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));
+extern int sigwaitinfo (__const sigset_t *__restrict __set,
+			siginfo_t *__restrict __info) __THROW;
 
 /* 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));
+extern int sigtimedwait (__const sigset_t *__restrict __set,
+			 siginfo_t *__restrict __info,
+			 __const struct timespec *__restrict __timeout)
+     __THROW;
 
 /* 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));
+extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val)
+     __THROW;
 # endif	/* Use POSIX 199306.  */
 
 #endif /* Use POSIX.  */
@@ -279,15 +299,15 @@ struct sigvec
    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));
+extern int sigvec (int __sig, __const struct sigvec *__vec,
+		   struct sigvec *__ovec) __THROW;
 
 
 /* Get machine-dependent `struct sigcontext' and signal subcodes.  */
 # include <bits/sigcontext.h>
 
 /* Restore the state saved in SCP.  */
-extern int sigreturn __P ((struct sigcontext *__scp));
+extern int sigreturn (struct sigcontext *__scp) __THROW;
 
 #endif /*  use BSD.  */
 
@@ -297,22 +317,22 @@ extern int sigreturn __P ((struct sigcontext *__scp));
 /* 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));
+extern int siginterrupt (int __sig, int __interrupt) __THROW;
 
 # include <bits/sigstack.h>
-# ifdef __USE_GNU
+# ifdef __USE_XOPEN
 #  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));
+extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) __THROW;
 
 /* Alternate signal handler stack interface.
    This interface should always be preferred over `sigstack'.  */
-extern int sigaltstack __P ((__const struct sigaltstack *__ss,
-			     struct sigaltstack *__oss));
+extern int sigaltstack (__const struct sigaltstack *__restrict __ss,
+			struct sigaltstack *__restrict __oss) __THROW;
 
 #endif /* use BSD or X/Open Unix.  */
 
@@ -320,17 +340,19 @@ extern int sigaltstack __P ((__const struct sigaltstack *__ss,
 /* Simplified interface for signal management.  */
 
 /* Add SIG to the calling process' signal mask.  */
-extern int sighold __P ((int __sig));
+extern int sighold (int __sig) __THROW;
 
 /* Remove SIG from the calling process' signal mask.  */
-extern int sigrelse __P ((int __sig));
+extern int sigrelse (int __sig) __THROW;
 
 /* Set the disposition of SIG to SIG_IGN.  */
-extern int sigignore __P ((int __sig));
+extern int sigignore (int __sig) __THROW;
 
 /* Set the disposition of SIG.  */
-extern __sighandler_t sigset __P ((int __sig, __sighandler_t __disp));
+extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;
+#endif
 
+#if defined _POSIX_THREADS && (defined __USE_POSIX199506 || defined __USE_UNIX98)
 /* Some of the functions for handling signals in threaded programs must
    be defined here.  */
 # include <bits/sigthread.h>
@@ -340,14 +362,10 @@ extern __sighandler_t sigset __P ((int __sig, __sighandler_t __disp));
    other code which need deep insights.  */
 
 /* Return number of available real-time signal with highest priority.  */
-extern int __libc_current_sigrtmin __P ((void));
+extern int __libc_current_sigrtmin (void) __THROW;
 /* Return number of available real-time signal with lowest priority.  */
-extern int __libc_current_sigrtmax __P ((void));
+extern int __libc_current_sigrtmax (void) __THROW;
 
-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

+ 0 - 205
include/stdarg.h

@@ -1,205 +0,0 @@
-/* stdarg.h for GNU.
-   Note that the type used in va_arg is supposed to match the
-   actual type **after default promotions**.
-   Thus, va_arg (..., short) is not valid.  */
-
-#ifndef _STDARG_H
-#ifndef _ANSI_STDARG_H_
-#ifndef __need___va_list
-#define _STDARG_H
-#define _ANSI_STDARG_H_
-#endif /* not __need___va_list */
-#undef __need___va_list
-
-#ifdef __clipper__
-#include "va-clipper.h"
-#else
-#ifdef __m88k__
-#include "va-m88k.h"
-#else
-#ifdef __i860__
-#include "va-i860.h"
-#else
-#ifdef __hppa__
-#include "va-pa.h"
-#else
-#ifdef __mips__
-#include "va-mips.h"
-#else
-#ifdef __sparc__
-#include "va-sparc.h"
-#else
-#ifdef __i960__
-#include "va-i960.h"
-#else
-#ifdef __alpha__
-#include "va-alpha.h"
-#else
-#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
-#include "va-h8300.h"
-#else
-#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
-#include "va-ppc.h"
-#else
-#ifdef __arc__
-#include "va-arc.h"
-#else
-#ifdef __M32R__
-#include "va-m32r.h"
-#else
-#ifdef __sh__
-#include "va-sh.h"
-#else
-#ifdef __mn10300__
-#include "va-mn10300.h"
-#else
-#ifdef __mn10200__
-#include "va-mn10200.h"
-#else
-#ifdef __v850__
-#include "va-v850.h"
-#else
-
-/* Define __gnuc_va_list.  */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
-typedef char *__gnuc_va_list;
-#else
-typedef void *__gnuc_va_list;
-#endif
-#endif
-
-/* Define the standard macros for the user,
-   if this invocation was from the user program.  */
-#ifdef _STDARG_H
-
-/* Amount of space required in an argument list for an arg of type TYPE.
-   TYPE may alternatively be an expression whose type is used.  */
-
-#if defined(sysV68)
-#define __va_rounded_size(TYPE)  \
-  (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
-#else
-#define __va_rounded_size(TYPE)  \
-  (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-#endif
-
-#define va_start(AP, LASTARG) 						\
- (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
-
-#undef va_end
-void va_end (__gnuc_va_list);		/* Defined in libgcc.a */
-#define va_end(AP)	((void)0)
-
-/* We cast to void * and then to TYPE * because this avoids
-   a warning about increasing the alignment requirement.  */
-
-#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
-/* This is for little-endian machines; small args are padded upward.  */
-#define va_arg(AP, TYPE)						\
- (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),	\
-  *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
-#else /* big-endian */
-/* This is for big-endian machines; small args are padded downward.  */
-#define va_arg(AP, TYPE)						\
- (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),	\
-  *((TYPE *) (void *) ((char *) (AP)					\
-		       - ((sizeof (TYPE) < __va_rounded_size (char)	\
-			   ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
-#endif /* big-endian */
-
-/* Copy __gnuc_va_list into another variable of this type.  */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* _STDARG_H */
-
-#endif /* not v850 */
-#endif /* not mn10200 */
-#endif /* not mn10300 */
-#endif /* not sh */
-#endif /* not m32r */
-#endif /* not arc */
-#endif /* not powerpc with V.4 calling sequence */
-#endif /* not h8300 */
-#endif /* not alpha */
-#endif /* not i960 */
-#endif /* not sparc */
-#endif /* not mips */
-#endif /* not hppa */
-#endif /* not i860 */
-#endif /* not m88k */
-#endif /* not clipper */
-
-#ifdef _STDARG_H
-/* Define va_list, if desired, from __gnuc_va_list. */
-/* We deliberately do not define va_list when called from
-   stdio.h, because ANSI C says that stdio.h is not supposed to define
-   va_list.  stdio.h needs to have access to that data type, 
-   but must not use that name.  It should use the name __gnuc_va_list,
-   which is safe because it is reserved for the implementation.  */
-
-#ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
-#undef _VA_LIST
-#endif
-
-#ifdef _BSD_VA_LIST
-#undef _BSD_VA_LIST
-#endif
-
-#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
-/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
-   so we must avoid testing it and setting it here.
-   SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
-   have no conflict with that.  */
-#ifndef _VA_LIST_
-#define _VA_LIST_
-#ifdef __i860__
-#ifndef _VA_LIST
-#define _VA_LIST va_list
-#endif
-#endif /* __i860__ */
-typedef __gnuc_va_list va_list;
-#ifdef _SCO_DS
-#define __VA_LIST
-#endif
-#endif /* _VA_LIST_ */
-#else /* not __svr4__ || _SCO_DS */
-
-/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
-   But on BSD NET2 we must not test or define or undef it.
-   (Note that the comments in NET 2's ansi.h
-   are incorrect for _VA_LIST_--see stdio.h!)  */
-#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
-/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
-#ifndef _VA_LIST_DEFINED
-/* The macro _VA_LIST is used in SCO Unix 3.2.  */
-#ifndef _VA_LIST
-/* The macro _VA_LIST_T_H is used in the Bull dpx2  */
-#ifndef _VA_LIST_T_H
-typedef __gnuc_va_list va_list;
-#endif /* not _VA_LIST_T_H */
-#endif /* not _VA_LIST */
-#endif /* not _VA_LIST_DEFINED */
-#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
-#define _VA_LIST_
-#endif
-#ifndef _VA_LIST
-#define _VA_LIST
-#endif
-#ifndef _VA_LIST_DEFINED
-#define _VA_LIST_DEFINED
-#endif
-#ifndef _VA_LIST_T_H
-#define _VA_LIST_T_H
-#endif
-
-#endif /* not _VA_LIST_, except on certain systems */
-
-#endif /* not __svr4__ */
-
-#endif /* _STDARG_H */
-
-#endif /* not _ANSI_STDARG_H_ */
-#endif /* not _STDARG_H */

+ 30 - 26
include/stdint.h

@@ -1,31 +1,32 @@
-/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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>
+ *	ISO C99: 7.18 Integer types <stdint.h>
  */
 
 #ifndef _STDINT_H
 #define _STDINT_H	1
 
 #include <features.h>
-#define __need_wchar_t
+//#define __need_wchar_t
 #include <stddef.h>
+//#include <bits/wchar.h>
 #include <bits/wordsize.h>
 
 /* Exact integral types.  */
@@ -49,7 +50,10 @@ typedef long long int		int64_t;
 /* Unsigned.  */
 typedef unsigned char		uint8_t;
 typedef unsigned short int	uint16_t;
+#ifndef __uint32_t_defined
 typedef unsigned int		uint32_t;
+# define __uint32_t_defined
+#endif
 #if __WORDSIZE == 64
 typedef unsigned long int	uint64_t;
 #else
@@ -114,15 +118,15 @@ typedef unsigned long long int	uint_fast64_t;
 
 /* Types for `void *' pointers.  */
 #if __WORDSIZE == 64
-# ifndef intptr_t
+# ifndef __intptr_t_defined
 typedef long int		intptr_t;
-#  define intptr_t intptr_t
+#  define __intptr_t_defined
 # endif
 typedef unsigned long int	uintptr_t;
 #else
-# ifndef intptr_t
+# ifndef __intptr_t_defined
 typedef int			intptr_t;
-#  define intptr_t intptr_t
+#  define __intptr_t_defined
 # endif
 typedef unsigned int		uintptr_t;
 #endif
@@ -140,7 +144,7 @@ typedef unsigned long long int	uintmax_t;
 #endif
 
 
-/* The ISO C 9X standard specifies that in C++ implementations these
+/* The ISO C99 standard specifies that in C++ implementations these
    macros should only be defined if explicitly requested.  */
 #if !defined __cplusplus || defined __STDC_LIMIT_MACROS
 
@@ -166,8 +170,8 @@ typedef unsigned long long int	uintmax_t;
 # define INT64_MAX		(__INT64_C(9223372036854775807))
 
 /* Maximum of unsigned integral types.  */
-# define UINT8_MAX		(255U)
-# define UINT16_MAX		(65535U)
+# define UINT8_MAX		(255)
+# define UINT16_MAX		(65535)
 # define UINT32_MAX		(4294967295U)
 # define UINT64_MAX		(__UINT64_C(18446744073709551615))
 
@@ -184,8 +188,8 @@ typedef unsigned long long int	uintmax_t;
 # 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_LEAST8_MAX	(255)
+# define UINT_LEAST16_MAX	(65535)
 # define UINT_LEAST32_MAX	(4294967295U)
 # define UINT_LEAST64_MAX	(__UINT64_C(18446744073709551615))
 
@@ -212,7 +216,7 @@ typedef unsigned long long int	uintmax_t;
 # define INT_FAST64_MAX		(__INT64_C(9223372036854775807))
 
 /* Maximum of fast unsigned integral types having a minimum size.  */
-# define UINT_FAST8_MAX		(255U)
+# define UINT_FAST8_MAX		(255)
 # if __WORDSIZE == 64
 #  define UINT_FAST16_MAX	(18446744073709551615UL)
 #  define UINT_FAST32_MAX	(18446744073709551615UL)
@@ -269,18 +273,18 @@ typedef unsigned long long int	uintmax_t;
 /* Limits of `wchar_t'.  */
 # ifndef WCHAR_MIN
 /* These constants might also be defined in <wchar.h>.  */
-#  define WCHAR_MIN		(0)
-#  define WCHAR_MAX		(2147483647)
+#  define WCHAR_MIN		__WCHAR_MIN
+#  define WCHAR_MAX		__WCHAR_MAX
 # endif
 
 /* Limits of `wint_t'.  */
-# define WINT_MIN		(0)
-# define WINT_MAX		(2147483647)
+# define WINT_MIN		(0u)
+# define WINT_MAX		(4294967295u)
 
 #endif	/* C++ && limit macros */
 
 
-/* The ISO C 9X standard specifies that in C++ implementations these
+/* The ISO C99 standard specifies that in C++ implementations these
    should only be defined if explicitly requested.  */
 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
 

+ 393 - 190
include/stdio.h

@@ -1,45 +1,59 @@
 /* Define ISO C stdio on top of C++ iostreams.
-   Copyright (C) 1991, 1994-1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1994-1999, 2000, 2001 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
- *	ISO C Standard: 4.9 INPUT/OUTPUT	<stdio.h>
+ *	ISO C99 Standard: 7.19 Input/output	<stdio.h>
  */
 
 #ifndef _STDIO_H
-#define _STDIO_H
 
-#include <features.h>
-#include <stdarg.h>
-#include <sys/types.h>
+#if !defined __need_FILE && !defined __need___FILE
+# define _STDIO_H	1
+# include <features.h>
 
 __BEGIN_DECLS
 
+# define __need_size_t
+# define __need_NULL
+# include <stddef.h>
+
+# include <bits/types.h>
+# define __need_FILE
+# define __need___FILE
+#endif /* Don't need FILE.  */
+#include <sys/types.h>
+
+
+#if !defined __FILE_defined && defined __need_FILE
+
+/* The opaque type of streams.  This is the definition used elsewhere.  */
 
 /* when you add or change fields here, be sure to change the initialization
  * in stdio_init and fopen */
-struct __stdio_file {
+struct _IO_FILE {
   unsigned char *bufpos;   /* the next byte to write to or read from */
   unsigned char *bufread;  /* the end of data returned by last read() */
   unsigned char *bufwrite; /* 1 + highest address writable by macro */
   unsigned char *bufstart; /* the start of the buffer */
   unsigned char *bufend;   /* the end of the buffer; ie the byte after the last
                               malloc()ed byte */
-  struct __stdio_file * next;
+  struct _IO_FILE * next;
 
   int fd; /* the file descriptor associated with the stream */
 
@@ -47,16 +61,37 @@ struct __stdio_file {
   unsigned char ungot;
   char unbuf[2];	   /* The buffer for 'unbuffered' streams */
 };
+typedef struct _IO_FILE FILE;
 
-typedef struct __stdio_file FILE;
+# define __FILE_defined	1
+#endif /* FILE not defined.  */
+#undef	__need_FILE
 
-/* Default buffer size.  */
-#define BUFSIZ	    (512)
 
-/* Define EOF and NULL */
-#define EOF	(-1)
-#ifndef NULL
-#define NULL	(0)
+#if !defined ____FILE_defined && defined __need___FILE
+
+/* The opaque type of streams.  This is the definition used elsewhere.  */
+typedef struct _IO_FILE __FILE;
+
+# define ____FILE_defined	1
+#endif /* __FILE not defined.  */
+#undef	__need___FILE
+
+
+#ifdef	_STDIO_H
+#undef _STDIO_USES_IOSTREAM
+
+#include <stdarg.h>
+typedef va_list _G_va_list;
+
+/* The type of the second argument to `fgetpos' and `fsetpos'.  */
+#ifndef __USE_FILE_OFFSET64
+typedef __off_t fpos_t;
+#else
+typedef __off64_t fpos_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __off64_t fpos64_t;
 #endif
 
 /* The possibilities for the third argument to `setvbuf'.  */
@@ -73,14 +108,33 @@ typedef struct __stdio_file FILE;
 #define __MODE_EOF		0x40	/* EOF status */
 #define __MODE_ERR		0x80	/* Error status */
 
+
+/* Default buffer size.  */
+#ifndef BUFSIZ
+# define BUFSIZ	    (512)
+#endif
+
+
+/* End of file character.
+   Some things throughout the library rely on this being -1.  */
+#ifndef EOF
+# define EOF (-1)
+#endif
+
+
 /* The possibilities for the third argument to `fseek'.
    These values should not be changed.  */
 #define SEEK_SET	0	/* Seek from beginning of file.  */
 #define SEEK_CUR	1	/* Seek from current position.  */
 #define SEEK_END	2	/* Seek from end of file.  */
 
+
+#if defined __USE_SVID || defined __USE_XOPEN
 /* Default path prefix for `tempnam' and `tmpnam'.  */
-#define P_tmpdir	"/tmp"
+# define P_tmpdir	"/tmp"
+#endif
+
+
 /* Get the values:
    L_tmpnam	How long an array of chars must be to be passed to `tmpnam'.
    TMP_MAX	The minimum number of unique filenames generated by tmpnam
@@ -90,9 +144,7 @@ typedef struct __stdio_file FILE;
    L_cuserid	How long an array to pass to `cuserid'.
    FOPEN_MAX	Minimum number of files that can be open at once.
    FILENAME_MAX	Maximum length of a filename.  */
-#define __need_FOPEN_MAX
 #include <bits/stdio_lim.h>
-#undef __need_FOPEN_MAX
 
 
 /* Standard streams.  */
@@ -105,23 +157,31 @@ extern FILE *stderr;		/* Standard error output stream.  */
 #define stderr stderr
 
 /* Remove file FILENAME.  */
-extern int remove __P ((__const char *__filename));
+extern int remove (__const char *__filename) __THROW;
 /* Rename file OLD to NEW.  */
-extern int rename __P ((__const char *__old, __const char *__new));
+extern int rename (__const char *__old, __const char *__new) __THROW;
 
 
 /* Create a temporary file and open it read/write.  */
-extern FILE *tmpfile __P ((void));
+#ifndef __USE_FILE_OFFSET64
+extern FILE *tmpfile (void) __THROW;
+#else
+# ifdef __REDIRECT
+extern FILE *__REDIRECT (tmpfile, (void) __THROW, tmpfile64);
+# else
+#  define tmpfile tmpfile64
+# endif
+#endif
 #ifdef __USE_LARGEFILE64
-extern FILE *tmpfile64 __P ((void));
+extern FILE *tmpfile64 (void) __THROW;
 #endif
 /* Generate a temporary filename.  */
-extern char *tmpnam __P ((char *__s));
+extern char *tmpnam (char *__s) __THROW;
 
 #ifdef __USE_MISC
 /* This is the reentrant variant of `tmpnam'.  The only difference is
    that it does not allow S to be NULL.  */
-extern char *tmpnam_r __P ((char *__s));
+extern char *tmpnam_r (char *__s) __THROW;
 #endif
 
 
@@ -133,170 +193,218 @@ extern char *tmpnam_r __P ((char *__s));
    If not and if DIR is not NULL, that value is checked.  If that fails,
    P_tmpdir is tried and finally "/tmp".  The storage for the filename
    is allocated by `malloc'.  */
-extern char *tempnam __P ((__const char *__dir, __const char *__pfx));
+extern char *tempnam (__const char *__dir, __const char *__pfx)
+     __THROW __attribute_malloc__;
 #endif
 
 
 /* Close STREAM.  */
-extern int fclose __P ((FILE *__stream));
+extern int fclose (FILE *__stream) __THROW;
 /* Flush STREAM, or all streams if STREAM is NULL.  */
-extern int fflush __P ((FILE *__stream));
-
-/* Open a file and create a new stream for it.  */
-extern FILE *fopen __P ((__const char *__restrict __filename,
-			 __const char *__restrict __mode));
-/* Open a file, replacing an existing stream with it. */
-extern FILE *freopen __P ((__const char *__restrict __filename,
-			   __const char *__restrict __mode,
-			   FILE *__restrict __stream));
+extern int fflush (FILE *__stream) __THROW;
 
 #ifdef __USE_MISC
-/*
- * Open a file using an automatically (stack) or statically allocated FILE.
- * The FILE * returned behaves just as any other FILE * with respect to the
- * stdio functions, but be aware of the following:
- * NOTE: The buffer used for the file is FILE's builtin 2-byte buffer, so
- *       setting a new buffer is probably advisable.
- * NOTE: This function is primarily intended to be used for stack-allocated
- *       FILEs when uClibc stdio has been built with no dynamic memory support.
- *       For the statically allocated case, it is probably better to increase
- *        the value of FIXED_STREAMS in stdio.c.
- * WARNING: If allocated on the stack, make sure you call fclose before the
- *          stack memory is reclaimed!
- */
-extern FILE *fsfopen __P ((__const char *__restrict __filename,
-			   __const char *__restrict __mode,
-			   FILE *__restrict __stream));
+/* Faster versions when locking is not required.  */
+extern int fflush_unlocked (FILE *__stream) __THROW;
+#endif
+
+#if 0
+//#ifdef __USE_GNU
+/* Close all streams.  */
+extern int fcloseall (void) __THROW;
 #endif
 
 
+#ifndef __USE_FILE_OFFSET64
+/* Open a file and create a new stream for it.  */
+extern FILE *fopen (__const char *__restrict __filename,
+		    __const char *__restrict __modes) __THROW;
+/* Open a file, replacing an existing stream with it. */
+extern FILE *freopen (__const char *__restrict __filename,
+		      __const char *__restrict __modes,
+		      FILE *__restrict __stream) __THROW;
+#else
+# ifdef __REDIRECT
+extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
+				 __const char *__restrict __modes) __THROW,
+			 fopen64);
+extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
+				   __const char *__restrict __modes,
+				   FILE *__restrict __stream) __THROW,
+			 freopen64);
+# else
+#  define fopen fopen64
+#  define freopen freopen64
+# endif
+#endif
 #ifdef __USE_LARGEFILE64
-extern FILE *fopen64 __P ((__const char *__restrict __filename,
-			   __const char *__restrict __mode));
-extern FILE *freopen64 __P ((__const char *__restrict __filename,
-			     __const char *__restrict __mode,
-			     FILE *__restrict __stream));
+extern FILE *fopen64 (__const char *__restrict __filename,
+		      __const char *__restrict __modes) __THROW;
+extern FILE *freopen64 (__const char *__restrict __filename,
+			__const char *__restrict __modes,
+			FILE *__restrict __stream) __THROW;
 #endif
 
 #ifdef	__USE_POSIX
 /* Create a new stream that refers to an existing system file descriptor.  */
-extern FILE *fdopen __P ((int __fd, __const char *__mode));
+extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
 #endif
 
+#if 0
+//#ifdef	__USE_GNU
+/* Create a new stream that refers to the given magic cookie,
+   and uses the given functions for input and output.  */
+extern FILE *fopencookie (void *__restrict __magic_cookie,
+			  __const char *__restrict __modes,
+			  _IO_cookie_io_functions_t __io_funcs) __THROW;
+
+/* Create a new stream that refers to a memory buffer.  */
+extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
+
+/* Open a stream that writes into a malloc'd buffer that is expanded as
+   necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
+   and the number of characters written on fflush or fclose.  */
+extern FILE *open_memstream (char **__restrict __bufloc,
+			     size_t *__restrict __sizeloc) __THROW;
+#endif
 
-/* Make STREAM use buffering mode MODE.
-   If BUF is not NULL, use N bytes of it for buffering;
-   else allocate an internal buffer N bytes long.  */
-extern int setvbuf __P ((FILE *__restrict __stream, char *__restrict __buf,
-			 int __mode, size_t __n));
 
 /* If BUF is NULL, make STREAM unbuffered.
    Else make it use buffer BUF, of size BUFSIZ.  */
-extern void setbuf __P ((FILE *__restrict __stream, char *__restrict __buf));
+extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
+/* Make STREAM use buffering mode MODE.
+   If BUF is not NULL, use N bytes of it for buffering;
+   else allocate an internal buffer N bytes long.  */
+extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
+		    int __modes, size_t __n) __THROW;
 
 #ifdef	__USE_BSD
 /* If BUF is NULL, make STREAM unbuffered.
    Else make it use SIZE bytes of BUF for buffering.  */
-extern void setbuffer __P ((FILE *__restrict __stream, char *__restrict __buf,
-			    size_t __size));
+extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
+		       size_t __size) __THROW;
 
 /* Make STREAM line-buffered.  */
-extern void setlinebuf __P ((FILE *__stream));
+extern void setlinebuf (FILE *__stream) __THROW;
 #endif
 
 
 /* Write formatted output to STREAM.  */
-extern int fprintf __P ((FILE *__restrict __stream,
-			 __const char *__restrict __format, ...));
+extern int fprintf (FILE *__restrict __stream,
+		    __const char *__restrict __format, ...) __THROW;
 /* Write formatted output to stdout.  */
-extern int printf __P ((__const char *__restrict __format, ...));
+extern int printf (__const char *__restrict __format, ...) __THROW;
 /* Write formatted output to S.  */
-extern int sprintf __P ((char *__restrict __s,
-			 __const char *__restrict __format, ...));
-
-/* Write formatted output to a file descriptor */
-extern int vdprintf __P((int fd, __const char *__restrict __format,
-						 va_list __arg));
-
-/* Write formatted output to a buffer S dynamically allocated by asprintf.  */
-extern int asprintf __P ((char **__restrict __s,
-			 __const char *__restrict __format, ...));
+extern int sprintf (char *__restrict __s,
+		    __const char *__restrict __format, ...) __THROW;
 
 /* Write formatted output to S from argument list ARG.  */
-extern int vfprintf __P ((FILE *__restrict __s,
-			  __const char *__restrict __format,
-			  va_list __arg));
+extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
+		     _G_va_list __arg) __THROW;
 /* Write formatted output to stdout from argument list ARG.  */
-extern int vprintf __P ((__const char *__restrict __format,
-			 va_list __arg));
+extern int vprintf (__const char *__restrict __format, _G_va_list __arg)
+     __THROW;
 /* Write formatted output to S from argument list ARG.  */
-extern int vsprintf __P ((char *__restrict __s,
-			  __const char *__restrict __format,
-			  va_list __arg));
+extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
+		     _G_va_list __arg) __THROW;
 
+#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
 /* Maximum chars of output to write in MAXLEN.  */
-extern int snprintf __P ((char *__restrict __s, size_t __maxlen,
-			  __const char *__restrict __format, ...))
-     __attribute__ ((__format__ (__printf__, 3, 4)));
-
-extern int __vsnprintf __P ((char *__restrict __s, size_t __maxlen,
-			     __const char *__restrict __format,
-			     va_list __arg))
-     __attribute__ ((__format__ (__printf__, 3, 0)));
-extern int vsnprintf __P ((char *__restrict __s, size_t __maxlen,
-			   __const char *__restrict __format,
-			   va_list __arg))
-     __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int snprintf (char *__restrict __s, size_t __maxlen,
+		     __const char *__restrict __format, ...)
+     __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
+
+extern int vsnprintf (char *__restrict __s, size_t __maxlen,
+		      __const char *__restrict __format, _G_va_list __arg)
+     __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+#endif
+
+#ifdef __USE_GNU
+/* Write formatted output to a string dynamically allocated with `malloc'.
+   Store the address of the string in *PTR.  */
+extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
+		      _G_va_list __arg)
+     __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int __asprintf (char **__restrict __ptr,
+		       __const char *__restrict __fmt, ...)
+     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int asprintf (char **__restrict __ptr,
+		     __const char *__restrict __fmt, ...)
+     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+
+/* Write formatted output to a file descriptor.  */
+extern int vdprintf (int __fd, __const char *__restrict __fmt,
+		     _G_va_list __arg)
+     __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
+     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+#endif
+
 
 /* Read formatted input from STREAM.  */
-extern int fscanf __P ((FILE *__restrict __stream,
-			__const char *__restrict __format, ...));
+extern int fscanf (FILE *__restrict __stream,
+		   __const char *__restrict __format, ...) __THROW;
 /* Read formatted input from stdin.  */
-extern int scanf __P ((__const char *__restrict __format, ...));
+extern int scanf (__const char *__restrict __format, ...) __THROW;
 /* Read formatted input from S.  */
-extern int sscanf __P ((__const char *__restrict __s,
-			__const char *__restrict __format, ...));
+extern int sscanf (__const char *__restrict __s,
+		   __const char *__restrict __format, ...) __THROW;
 
+#ifdef	__USE_ISOC99
 /* Read formatted input from S into argument list ARG.  */
-extern int vfscanf __P ((FILE *__restrict __s,
-			 __const char *__restrict __format,
-			 va_list __arg))
-     __attribute__ ((__format__ (__scanf__, 2, 0)));
+extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
+		    _G_va_list __arg)
+     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
 
 /* Read formatted input from stdin into argument list ARG.  */
-extern int vscanf __P ((__const char *__restrict __format, va_list __arg))
-     __attribute__ ((__format__ (__scanf__, 1, 0)));
+extern int vscanf (__const char *__restrict __format, _G_va_list __arg)
+     __THROW __attribute__ ((__format__ (__scanf__, 1, 0)));
 
 /* Read formatted input from S into argument list ARG.  */
-extern int vsscanf __P ((__const char *__restrict __s,
-			 __const char *__restrict __format,
-			 va_list __arg))
-     __attribute__ ((__format__ (__scanf__, 2, 0)));
+extern int vsscanf (__const char *__restrict __s,
+		    __const char *__restrict __format, _G_va_list __arg)
+     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
+#endif /* Use ISO C9x.  */
 
 
 /* Read a character from STREAM.  */
-extern int fgetc __P ((FILE *__stream));
-extern int getc __P ((FILE *__stream));
+extern int fgetc (FILE *__stream) __THROW;
+extern int getc (FILE *__stream) __THROW;
 
 /* Read a character from stdin.  */
-extern int getchar __P ((void));
+extern int getchar (void) __THROW;
 
-/* The C standard explicitly says this is a macro, so be that way */
+/* The C standard explicitly says this is a macro, so we always do the
+   optimization for it.  */
 #define getc(stream)	\
   (((stream)->bufpos >= (stream)->bufread) ? fgetc(stream):		\
     (*(stream)->bufpos++))
+
 /* getchar() is equivalent to getc(stdin).  Since getc is a macro, 
  * that means that getchar() should be a macro too...  */
 #define getchar() getc(stdin)
 
+#if defined __USE_POSIX || defined __USE_MISC
+/* These are defined in POSIX.1:1996.  */
+extern int getc_unlocked (FILE *__stream) __THROW;
+extern int getchar_unlocked (void) __THROW;
+#endif /* Use POSIX or MISC.  */
+
+#ifdef __USE_MISC
+/* Faster version when locking is not necessary.  */
+extern int fgetc_unlocked (FILE *__stream) __THROW;
+#endif /* Use MISC.  */
+
+
 /* Write a character to STREAM.  */
-extern int fputc __P ((int __c, FILE *__stream));
-extern int putc __P ((int __c, FILE *__stream));
+extern int fputc (int __c, FILE *__stream) __THROW;
+extern int putc (int __c, FILE *__stream) __THROW;
 
 /* Write a character to stdout.  */
-extern int putchar __P ((int __c));
+extern int putchar (int __c) __THROW;
 
-/* The C standard explicitly says this can be a macro, so be that way */
+/* The C standard explicitly says this can be a macro,
+   so we always do the optimization for it.  */
 #define putc(c, stream)	\
     (((stream)->bufpos >= (stream)->bufwrite) ? fputc((c), (stream))	\
                           : (unsigned char) (*(stream)->bufpos++ = (c))	)
@@ -304,169 +412,264 @@ extern int putchar __P ((int __c));
  * that means that putchar() should be a macro too...  */
 #define putchar(c) putc((c), stdout)
 
+
+#ifdef __USE_MISC
+/* Faster version when locking is not necessary.  */
+extern int fputc_unlocked (int __c, FILE *__stream) __THROW;
+#endif /* Use MISC.  */
+
+#if defined __USE_POSIX || defined __USE_MISC
+/* These are defined in POSIX.1:1996.  */
+extern int putc_unlocked (int __c, FILE *__stream) __THROW;
+extern int putchar_unlocked (int __c) __THROW;
+#endif /* Use POSIX or MISC.  */
+
+
 #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
 /* Get a word (int) from STREAM.  */
-extern int getw __P ((FILE *__stream));
+extern int getw (FILE *__stream) __THROW;
 
 /* Write a word (int) to STREAM.  */
-extern int putw __P ((int __w, FILE *__stream));
+extern int putw (int __w, FILE *__stream) __THROW;
 #endif
 
 
 /* Get a newline-terminated string of finite length from STREAM.  */
-extern char *fgets __P ((char *__restrict __s, int __n,
-			 FILE *__restrict __stream));
+extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
+     __THROW;
+
+#if 0
+//#ifdef __USE_GNU
+/* This function does the same as `fgets' but does not lock the stream.  */
+extern char *fgets_unlocked (char *__restrict __s, int __n,
+			     FILE *__restrict __stream) __THROW;
+#endif
 
 /* Get a newline-terminated string from stdin, removing the newline.
    DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.  */
-extern char *gets __P ((char *__s));
+extern char *gets (char *__s) __THROW;
 
 
-#ifdef __USE_GNU
+#ifdef	__USE_GNU
 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
    (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
    NULL), pointing to *N characters of space.  It is realloc'd as
    necessary.  Returns the number of characters read (not including the
    null terminator), or -1 on error or EOF.  */
-extern ssize_t __getdelim __P ((char **__restrict __lineptr,
-				    size_t *__restrict __n, int __delimiter,
-				    FILE *__restrict __stream));
-extern ssize_t getdelim __P ((char **__restrict __lineptr,
-				  size_t *__restrict __n, int __delimiter,
-				  FILE *__restrict __stream));
+extern ssize_t __getdelim (char **__restrict __lineptr,
+			       size_t *__restrict __n, int __delimiter,
+			       FILE *__restrict __stream) __THROW;
+extern ssize_t getdelim (char **__restrict __lineptr,
+			     size_t *__restrict __n, int __delimiter,
+			     FILE *__restrict __stream) __THROW;
 
 /* Like `getdelim', but reads up to a newline.  */
-extern ssize_t getline __P ((char **__restrict __lineptr,
-				 size_t *__restrict __n,
-				 FILE *__restrict __stream));
+extern ssize_t getline (char **__restrict __lineptr,
+			    size_t *__restrict __n,
+			    FILE *__restrict __stream) __THROW;
 #endif
 
 
 /* Write a string to STREAM.  */
-extern int fputs __P ((__const char *__restrict __s,
-		       FILE *__restrict __stream));
+extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
+     __THROW;
+
+#if 0
+//#ifdef __USE_GNU
+/* This function does the same as `fputs' but does not lock the stream.  */
+extern int fputs_unlocked (__const char *__restrict __s,
+			   FILE *__restrict __stream) __THROW;
+#endif
 
 /* Write a string, followed by a newline, to stdout.  */
-extern int puts __P ((__const char *__s));
+extern int puts (__const char *__s) __THROW;
 
 
 /* Push a character back onto the input buffer of STREAM.  */
-extern int ungetc __P ((int __c, FILE *__stream));
+extern int ungetc (int __c, FILE *__stream) __THROW;
 
 
 /* Read chunks of generic data from STREAM.  */
-extern size_t fread __P ((void *__restrict __ptr, size_t __size,
-			  size_t __n, FILE *__restrict __stream));
+extern size_t fread (void *__restrict __ptr, size_t __size,
+		     size_t __n, FILE *__restrict __stream) __THROW;
 /* Write chunks of generic data to STREAM.  */
-extern size_t fwrite __P ((__const void *__restrict __ptr, size_t __size,
-			   size_t __n, FILE *__restrict __s));
+extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
+		      size_t __n, FILE *__restrict __s) __THROW;
+
+#ifdef __USE_MISC
+/* Faster versions when locking is not necessary.  */
+extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
+			      size_t __n, FILE *__restrict __stream) __THROW;
+extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
+			       size_t __n, FILE *__restrict __stream) __THROW;
+#endif
 
-/* Rewind to the beginning of STREAM.  */
-extern void rewind __P ((FILE *__stream));
 
 /* Seek to a certain position on STREAM.  */
-extern int fseek __P ((FILE *__stream, long int __off, int __whence));
+extern int fseek (FILE *__stream, long int __off, int __whence) __THROW;
 /* Return the current position of STREAM.  */
-extern long int ftell __P ((FILE *__stream));
+extern long int ftell (FILE *__stream) __THROW;
+/* Rewind to the beginning of STREAM.  */
+extern void rewind (FILE *__stream) __THROW;
 
 /* The Single Unix Specification, Version 2, specifies an alternative,
    more adequate interface for the two functions above which deal with
    file offset.  `long int' is not the right type.  These definitions
    are originally defined in the Large File Support API.  */
 
-/* Types needed in these functions.  */
-#ifndef off_t
-typedef __off_t off_t;
-# define off_t off_t
-#endif
-
-#if defined __USE_LARGEFILE64 && !defined off64_t
-typedef __off64_t off64_t;
-# define off64_t off64_t
+#ifndef __USE_FILE_OFFSET64
+# ifdef __USE_LARGEFILE
+/* Seek to a certain position on STREAM.  */
+extern int fseeko (FILE *__stream, __off_t __off, int __whence) __THROW;
+/* Return the current position of STREAM.  */
+extern __off_t ftello (FILE *__stream) __THROW;
+# endif
+
+/* Get STREAM's position.  */
+extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
+     __THROW;
+/* Set STREAM's position.  */
+extern int fsetpos (FILE *__stream, __const fpos_t *__pos) __THROW;
+#else
+# ifdef __REDIRECT
+#  ifdef __USE_LARGEFILE
+extern int __REDIRECT (fseeko,
+		       (FILE *__stream, __off64_t __off, int __whence) __THROW,
+		       fseeko64);
+extern __off64_t __REDIRECT (ftello, (FILE *__stream) __THROW, ftello64);
+#  endif
+extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
+				 fpos_t *__restrict __pos) __THROW, fgetpos64);
+extern int __REDIRECT (fsetpos,
+		       (FILE *__stream, __const fpos_t *__pos) __THROW,
+		       fsetpos64);
+# else
+#  ifdef __USE_LARGEFILE
+#   define fseeko fseeko64
+#   define ftello ftello64
+#  endif
+#  define fgetpos fgetpos64
+#  define fsetpos fsetpos64
+# endif
 #endif
 
-#ifndef fpos_t
-typedef off_t fpos_t;
-#define fpos_t fpos_t
+#ifdef __USE_LARGEFILE64
+extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) __THROW;
+extern __off64_t ftello64 (FILE *__stream) __THROW;
+extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos)
+     __THROW;
+extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos) __THROW;
 #endif
 
-/* Seek to a certain position on STREAM.  */
-extern int fsetpos __P((FILE *__stream, __const fpos_t *__pos));
-/* Return the current position of STREAM.  */
-extern int fgetpos __P((FILE *__stream, fpos_t *__pos));
-
 /* Clear the error and EOF indicators for STREAM.  */
-extern void clearerr __P ((FILE *__stream));
+extern void clearerr (FILE *__stream) __THROW;
 /* Return the EOF indicator for STREAM.  */
-extern int feof __P ((FILE *__stream));
+extern int feof (FILE *__stream) __THROW;
 /* Return the error indicator for STREAM.  */
-extern int ferror __P ((FILE *__stream));
+extern int ferror (FILE *__stream) __THROW;
+
+#ifdef __USE_MISC
+/* Faster versions when locking is not required.  */
+extern void clearerr_unlocked (FILE *__stream) __THROW;
+extern int feof_unlocked (FILE *__stream) __THROW;
+extern int ferror_unlocked (FILE *__stream) __THROW;
+#endif
+
 
 /* Print a message describing the meaning of the value of errno.  */
-extern void perror __P ((__const char *__s));
+extern void perror (__const char *__s) __THROW;
 
 /* These variables normally should not be used directly.  The `strerror'
    function provides all the needed functionality.  */
+#ifdef	__USE_BSD
 extern int sys_nerr;
 extern __const char *__const sys_errlist[];
+#endif
+#if 0
+//#ifdef	__USE_GNU
+extern int _sys_nerr;
+extern __const char *__const _sys_errlist[];
+#endif
+
 
 #ifdef	__USE_POSIX
 /* Return the system file descriptor for STREAM.  */
-extern int fileno __P ((FILE *__stream));
+extern int fileno (FILE *__stream) __THROW;
 /* Only use the macro below if you know fp is a valid FILE for a valid fd. */
 #define __fileno(fp)	((fp)->fd)
 #endif /* Use POSIX.  */
 
+#ifdef __USE_MISC
+/* Faster version when locking is not required.  */
+extern int fileno_unlocked (FILE *__stream) __THROW;
+#endif
+
+
 #if (defined __USE_POSIX2 || defined __USE_SVID  || defined __USE_BSD || \
      defined __USE_MISC)
 /* Create a new stream connected to a pipe running the given command.  */
-extern FILE *popen __P ((__const char *__command, __const char *__mode));
+extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
 
 /* Close a stream opened by popen and return the status of its child.  */
-extern int pclose __P ((FILE *__stream));
+extern int pclose (FILE *__stream) __THROW;
 #endif
 
 
 #ifdef	__USE_POSIX
 /* Return the name of the controlling terminal.  */
-extern char *ctermid __P ((char *__s));
+extern char *ctermid (char *__s) __THROW;
 #endif /* Use POSIX.  */
 
 
 #ifdef __USE_XOPEN
 /* Return the name of the current user.  */
-extern char *cuserid __P ((char *__s));
-#endif /* Use X/Open.  */
+extern char *cuserid (char *__s) __THROW;
+#endif /* Use X/Open, but not issue 6.  */
+
+
+#if 0
+//#ifdef	__USE_GNU
+struct obstack;			/* See <obstack.h>.  */
+
+/* Write formatted output to an obstack.  */
+extern int obstack_printf (struct obstack *__restrict __obstack,
+			   __const char *__restrict __format, ...) __THROW;
+extern int obstack_vprintf (struct obstack *__restrict __obstack,
+			    __const char *__restrict __format,
+			    _G_va_list __args) __THROW;
+#endif /* Use GNU.  */
 
 
 #if defined __USE_POSIX || defined __USE_MISC
 /* These are defined in POSIX.1:1996.  */
 
 /* Acquire ownership of STREAM.  */
-extern void flockfile __P ((FILE *__stream));
+extern void flockfile (FILE *__stream) __THROW;
 
 /* Try to acquire ownership of STREAM but do not block if it is not
    possible.  */
-extern int ftrylockfile __P ((FILE *__stream));
+extern int ftrylockfile (FILE *__stream) __THROW;
 
 /* Relinquish the ownership granted for STREAM.  */
-extern void funlockfile __P ((FILE *__stream));
+extern void funlockfile (FILE *__stream) __THROW;
 #endif /* POSIX || misc */
 
-#if defined __USE_XOPEN && !defined __USE_GNU
+#if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
 /* The X/Open standard requires some functions and variables to be
    declared here which do not belong into this header.  But we have to
    follow.  In GNU mode we don't do this nonsense.  */
 # define __need_getopt
 # include <getopt.h>
-#endif
+#endif	/* X/Open, but not issue 6 and not for GNU.  */
 
 /* If we are compiling with optimizing read this file.  It contains
-   several optizing inline functions and macros.  */
+   several optimizing inline functions and macros.  */
 #ifdef __USE_EXTERN_INLINES
 # include <bits/stdio.h>
 #endif
 
 __END_DECLS
 
+#endif /* <stdio.h> included.  */
+
 #endif /* !_STDIO_H */

+ 844 - 101
include/stdlib.h

@@ -1,130 +1,873 @@
-/* stdlib.h  */
-#ifndef __STDLIB_H
-#define __STDLIB_H
+/* Copyright (C) 1991-1999, 2000, 2001 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ *	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
+ */
+
+#ifndef	_STDLIB_H
 
 #include <features.h>
-#include <sys/types.h>
-#include <limits.h>
+
+/* Get size_t, wchar_t and NULL from <stddef.h>.  */
+#define		__need_size_t
+#ifndef __need_malloc_and_calloc
+# define	__need_wchar_t
+# define	__need_NULL
+#endif
+#include <stddef.h>
 
 __BEGIN_DECLS
 
-/* Don't overwrite user definitions of NULL */
-#ifndef NULL
-#define NULL ((void *) 0)
+#ifndef __need_malloc_and_calloc
+#define	_STDLIB_H	1
+
+#if defined __USE_XOPEN && !defined _SYS_WAIT_H
+/* XPG requires a few symbols from <sys/wait.h> being defined.  */
+# include <bits/waitflags.h>
+# include <bits/waitstatus.h>
+
+# ifdef __USE_BSD
+
+/* Lots of hair to allow traditional BSD use of `union wait'
+   as well as POSIX.1 use of `int' for the status word.  */
+
+#  if defined __GNUC__ && !defined __cplusplus
+#   define __WAIT_INT(status)						      \
+  (__extension__ ({ union { __typeof(status) __in; int __i; } __u;	      \
+		    __u.__in = (status); __u.__i; }))
+#  else
+#   define __WAIT_INT(status)	(*(int *) &(status))
+#  endif
+
+/* This is the type of the argument to `wait'.  The funky union
+   causes redeclarations with ether `int *' or `union wait *' to be
+   allowed without complaint.  __WAIT_STATUS_DEFN is the type used in
+   the actual function definitions.  */
+
+#  if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
+#   define __WAIT_STATUS	void *
+#   define __WAIT_STATUS_DEFN	void *
+#  else
+/* This works in GCC 2.6.1 and later.  */
+typedef union
+  {
+    union wait *__uptr;
+    int *__iptr;
+  } __WAIT_STATUS __attribute__ ((__transparent_union__));
+#   define __WAIT_STATUS_DEFN	int *
+#  endif
+
+# else /* Don't use BSD.  */
+
+#  define __WAIT_INT(status)	(status)
+#  define __WAIT_STATUS		int *
+#  define __WAIT_STATUS_DEFN	int *
+
+# endif /* Use BSD.  */
+
+/* Define the macros <sys/wait.h> also would define this way.  */
+# define WEXITSTATUS(status)	__WEXITSTATUS(__WAIT_INT(status))
+# define WTERMSIG(status)	__WTERMSIG(__WAIT_INT(status))
+# define WSTOPSIG(status)	__WSTOPSIG(__WAIT_INT(status))
+# define WIFEXITED(status)	__WIFEXITED(__WAIT_INT(status))
+# define WIFSIGNALED(status)	__WIFSIGNALED(__WAIT_INT(status))
+# define WIFSTOPPED(status)	__WIFSTOPPED(__WAIT_INT(status))
+#endif	/* X/Open and <sys/wait.h> not included.  */
+
+/* Returned by `div'.  */
+typedef struct
+  {
+    int quot;			/* Quotient.  */
+    int rem;			/* Remainder.  */
+  } div_t;
+
+/* Returned by `ldiv'.  */
+#ifndef __ldiv_t_defined
+typedef struct
+  {
+    long int quot;		/* Quotient.  */
+    long int rem;		/* Remainder.  */
+  } ldiv_t;
+# define __ldiv_t_defined	1
 #endif
 
+#if defined __USE_ISOC99 && !defined __lldiv_t_defined
+/* Returned by `lldiv'.  */
+__extension__ typedef struct
+  {
+    long long int quot;		/* Quotient.  */
+    long long int rem;		/* Remainder.  */
+  } lldiv_t;
+# define __lldiv_t_defined	1
+#endif
+
+
+/* The largest number rand will return (same as INT_MAX).  */
+#define	RAND_MAX	2147483647
+
+
 /* We define these the same for all machines.
- * Changes from this to the outside world should be done in `_exit'.  */
-#define EXIT_FAILURE    1       /* Failing exit status.  */
-#define EXIT_SUCCESS    0       /* Successful exit status.  */
+   Changes from this to the outside world should be done in `_exit'.  */
+#define	EXIT_FAILURE	1	/* Failing exit status.  */
+#define	EXIT_SUCCESS	0	/* Successful exit status.  */
 
-/* The largest number rand will return */
-#define RAND_MAX        INT_MAX
 
 /* Maximum length of a multibyte character in the current locale.  */
-#define MB_CUR_MAX  1
+#define	MB_CUR_MAX	(__ctype_get_mb_cur_max ())
+extern size_t __ctype_get_mb_cur_max (void) __THROW;
 
-typedef struct
+
+/* Convert a string to a floating-point number.  */
+extern double atof (__const char *__nptr) __THROW __attribute_pure__;
+/* Convert a string to an integer.  */
+extern int atoi (__const char *__nptr) __THROW __attribute_pure__;
+/* Convert a string to a long integer.  */
+extern long int atol (__const char *__nptr) __THROW __attribute_pure__;
+
+#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_MISC)
+/* Convert a string to a long long integer.  */
+__extension__ extern long long int atoll (__const char *__nptr)
+     __THROW __attribute_pure__;
+#endif
+
+/* Convert a string to a floating-point number.  */
+extern double strtod (__const char *__restrict __nptr,
+		      char **__restrict __endptr) __THROW;
+
+#ifdef	__USE_ISOC99
+/* Likewise for `float' and `long double' sizes of floating-point numbers.  */
+extern float strtof (__const char *__restrict __nptr,
+		     char **__restrict __endptr) __THROW;
+
+extern long double strtold (__const char *__restrict __nptr,
+			    char **__restrict __endptr) __THROW;
+#endif
+
+/* Convert a string to a long integer.  */
+extern long int strtol (__const char *__restrict __nptr,
+			char **__restrict __endptr, int __base) __THROW;
+/* Convert a string to an unsigned long integer.  */
+extern unsigned long int strtoul (__const char *__restrict __nptr,
+				  char **__restrict __endptr, int __base)
+     __THROW;
+
+#if defined __GNUC__ && defined __USE_BSD
+/* Convert a string to a quadword integer.  */
+__extension__
+extern long long int strtoq (__const char *__restrict __nptr,
+			     char **__restrict __endptr, int __base) __THROW;
+/* Convert a string to an unsigned quadword integer.  */
+__extension__
+extern unsigned long long int strtouq (__const char *__restrict __nptr,
+				       char **__restrict __endptr, int __base)
+     __THROW;
+#endif /* GCC and use BSD.  */
+
+#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_MISC)
+/* These functions will part of the standard C library in ISO C99.  */
+
+/* Convert a string to a quadword integer.  */
+__extension__
+extern long long int strtoll (__const char *__restrict __nptr,
+			      char **__restrict __endptr, int __base) __THROW;
+/* Convert a string to an unsigned quadword integer.  */
+__extension__
+extern unsigned long long int strtoull (__const char *__restrict __nptr,
+					char **__restrict __endptr, int __base)
+     __THROW;
+#endif /* ISO C99 or GCC and use MISC.  */
+
+
+#if 0
+//#ifdef __USE_GNU
+/* The concept of one static locale per category is not very well
+   thought out.  Many applications will need to process its data using
+   information from several different locales.  Another application is
+   the implementation of the internationalization handling in the
+   upcoming ISO C++ standard library.  To support this another set of
+   the functions using locale data exist which have an additional
+   argument.
+
+   Attention: all these functions are *not* standardized in any form.
+   This is a proof-of-concept implementation.  */
+
+/* Structure for reentrant locale using functions.  This is an
+   (almost) opaque type for the user level programs.  */
+# include <xlocale.h>
+
+/* Special versions of the functions above which take the locale to
+   use as an additional parameter.  */
+extern long int __strtol_l (__const char *__restrict __nptr,
+			    char **__restrict __endptr, int __base,
+			    __locale_t __loc) __THROW;
+
+extern unsigned long int __strtoul_l (__const char *__restrict __nptr,
+				      char **__restrict __endptr,
+				      int __base, __locale_t __loc) __THROW;
+
+__extension__
+extern long long int __strtoll_l (__const char *__restrict __nptr,
+				  char **__restrict __endptr, int __base,
+				  __locale_t __loc) __THROW;
+
+__extension__
+extern unsigned long long int __strtoull_l (__const char *__restrict __nptr,
+					    char **__restrict __endptr,
+					    int __base, __locale_t __loc)
+     __THROW;
+
+extern double __strtod_l (__const char *__restrict __nptr,
+			  char **__restrict __endptr, __locale_t __loc)
+     __THROW;
+
+extern float __strtof_l (__const char *__restrict __nptr,
+			 char **__restrict __endptr, __locale_t __loc) __THROW;
+
+extern long double __strtold_l (__const char *__restrict __nptr,
+				char **__restrict __endptr,
+				__locale_t __loc) __THROW;
+#endif /* GNU */
+
+
+/* The internal entry points for `strtoX' take an extra flag argument
+   saying whether or not to parse locale-dependent number grouping.  */
+
+extern double __strtod_internal (__const char *__restrict __nptr,
+				 char **__restrict __endptr, int __group)
+     __THROW;
+extern float __strtof_internal (__const char *__restrict __nptr,
+				char **__restrict __endptr, int __group)
+     __THROW;
+extern long double __strtold_internal (__const char *__restrict __nptr,
+				       char **__restrict __endptr,
+				       int __group) __THROW;
+#ifndef __strtol_internal_defined
+extern long int __strtol_internal (__const char *__restrict __nptr,
+				   char **__restrict __endptr,
+				   int __base, int __group) __THROW;
+# define __strtol_internal_defined	1
+#endif
+#ifndef __strtoul_internal_defined
+extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
+					     char **__restrict __endptr,
+					     int __base, int __group) __THROW;
+# define __strtoul_internal_defined	1
+#endif
+#if defined __GNUC__ || defined __USE_ISOC99
+# ifndef __strtoll_internal_defined
+__extension__
+extern long long int __strtoll_internal (__const char *__restrict __nptr,
+					 char **__restrict __endptr,
+					 int __base, int __group) __THROW;
+#  define __strtoll_internal_defined	1
+# endif
+# ifndef __strtoull_internal_defined
+__extension__
+extern unsigned long long int __strtoull_internal (__const char *
+						   __restrict __nptr,
+						   char **__restrict __endptr,
+						   int __base, int __group)
+     __THROW;
+#  define __strtoull_internal_defined	1
+# endif
+#endif /* GCC */
+
+#ifdef __USE_EXTERN_INLINES
+/* Define inline functions which call the internal entry points.  */
+
+extern __inline double
+strtod (__const char *__restrict __nptr, char **__restrict __endptr) __THROW
+{
+  return __strtod_internal (__nptr, __endptr, 0);
+}
+extern __inline long int
+strtol (__const char *__restrict __nptr, char **__restrict __endptr,
+	int __base) __THROW
 {
-    int quot;                   /* Quotient.  */
-    int rem;                    /* Remainder.  */
-} div_t;
+  return __strtol_internal (__nptr, __endptr, __base, 0);
+}
+extern __inline unsigned long int
+strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
+	 int __base) __THROW
+{
+  return __strtoul_internal (__nptr, __endptr, __base, 0);
+}
 
-typedef struct
+# ifdef __USE_ISOC99
+extern __inline float
+strtof (__const char *__restrict __nptr, char **__restrict __endptr) __THROW
+{
+  return __strtof_internal (__nptr, __endptr, 0);
+}
+extern __inline long double
+strtold (__const char *__restrict __nptr, char **__restrict __endptr) __THROW
 {
-    long int quot;              /* Quotient.  */
-    long int rem;               /* Remainder.  */
-} ldiv_t;
+  return __strtold_internal (__nptr, __endptr, 0);
+}
+# endif
 
-/*  comparison function used by bsearch() and qsort() */
-typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t));
-typedef __compar_fn_t comparison_fn_t;
+# ifdef __USE_BSD
+__extension__ extern __inline long long int
+strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
+	int __base) __THROW
+{
+  return __strtoll_internal (__nptr, __endptr, __base, 0);
+}
+__extension__ extern __inline unsigned long long int
+strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
+	 int __base) __THROW
+{
+  return __strtoull_internal (__nptr, __endptr, __base, 0);
+}
+# endif
+
+# if defined __USE_MISC || defined __USE_ISOC99
+__extension__ extern __inline long long int
+strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
+	 int __base) __THROW
+{
+  return __strtoll_internal (__nptr, __endptr, __base, 0);
+}
+__extension__ extern __inline unsigned long long int
+strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
+	  int __base) __THROW
+{
+  return __strtoull_internal (__nptr, __endptr, __base, 0);
+}
+# endif
+
+extern __inline double
+atof (__const char *__nptr) __THROW
+{
+  return strtod (__nptr, (char **) NULL);
+}
+extern __inline int
+atoi (__const char *__nptr) __THROW
+{
+  return (int) strtol (__nptr, (char **) NULL, 10);
+}
+extern __inline long int
+atol (__const char *__nptr) __THROW
+{
+  return strtol (__nptr, (char **) NULL, 10);
+}
+
+# if defined __USE_MISC || defined __USE_ISOC99
+__extension__ extern __inline long long int
+atoll (__const char *__nptr) __THROW
+{
+  return strtoll (__nptr, (char **) NULL, 10);
+}
+# endif
+#endif /* Optimizing and Inlining.  */
+
+
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
+/* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant
+   digit first.  Returns a pointer to static storage overwritten by the
+   next call.  */
+extern char *l64a (long int __n) __THROW;
+
+/* Read a number from a string S in base 64 as above.  */
+extern long int a64l (__const char *__s) __THROW __attribute_pure__;
+
+
+# include <sys/types.h>	/* we need int32_t... */
+
+/* These are the functions that actually do things.  The `random', `srandom',
+   `initstate' and `setstate' functions are those from BSD Unices.
+   The `rand' and `srand' functions are required by the ANSI standard.
+   We provide both interfaces to the same random number generator.  */
+/* Return a random long integer between 0 and RAND_MAX inclusive.  */
+extern long int random (void) __THROW;
+
+/* Seed the random number generator with the given number.  */
+extern void srandom (unsigned int __seed) __THROW;
+
+/* Initialize the random number generator to use state buffer STATEBUF,
+   of length STATELEN, and seed it with SEED.  Optimal lengths are 8, 16,
+   32, 64, 128 and 256, the bigger the better; values less than 8 will
+   cause an error and values greater than 256 will be rounded down.  */
+extern char *initstate (unsigned int __seed, char *__statebuf,
+			size_t __statelen) __THROW;
+
+/* Switch the random number generator to state buffer STATEBUF,
+   which should have been previously initialized by `initstate'.  */
+extern char *setstate (char *__statebuf) __THROW;
+
+
+# ifdef __USE_MISC
+/* Reentrant versions of the `random' family of functions.
+   These functions all use the following data structure to contain
+   state, rather than global state variables.  */
+
+struct random_data
+  {
+    int32_t *fptr;		/* Front pointer.  */
+    int32_t *rptr;		/* Rear pointer.  */
+    int32_t *state;		/* Array of state values.  */
+    int rand_type;		/* Type of random number generator.  */
+    int rand_deg;		/* Degree of random number generator.  */
+    int rand_sep;		/* Distance between front and rear.  */
+    int32_t *end_ptr;		/* Pointer behind state table.  */
+  };
+
+extern int random_r (struct random_data *__restrict __buf,
+		     int32_t *__restrict __result) __THROW;
+
+extern int srandom_r (unsigned int __seed, struct random_data *__buf) __THROW;
+
+extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
+			size_t __statelen,
+			struct random_data *__restrict __buf) __THROW;
+
+extern int setstate_r (char *__restrict __statebuf,
+		       struct random_data *__restrict __buf) __THROW;
+# endif	/* Use misc.  */
+#endif	/* Use SVID || extended X/Open.  */
+
+
+/* Return a random integer between 0 and RAND_MAX inclusive.  */
+extern int rand (void) __THROW;
+/* Seed the random number generator with the given number.  */
+extern void srand (unsigned int __seed) __THROW;
+
+#ifdef __USE_POSIX
+/* Reentrant interface according to POSIX.1.  */
+extern int rand_r (unsigned int *__seed) __THROW;
+#endif
+
+
+#if defined __USE_SVID || defined __USE_XOPEN
+/* System V style 48-bit random number generator functions.  */
+
+/* Return non-negative, double-precision floating-point value in [0.0,1.0).  */
+extern double drand48 (void) __THROW;
+extern double erand48 (unsigned short int __xsubi[3]) __THROW;
+
+/* Return non-negative, long integer in [0,2^31).  */
+extern long int lrand48 (void) __THROW;
+extern long int nrand48 (unsigned short int __xsubi[3]) __THROW;
 
+/* Return signed, long integers in [-2^31,2^31).  */
+extern long int mrand48 (void) __THROW;
+extern long int jrand48 (unsigned short int __xsubi[3]) __THROW;
 
-/* String to number conversion functions */
-extern double atof(const char *nptr);
-extern int atoi(const char *nptr);
-extern long atol(const char *nptr);
-extern long strtol __P ((const char * nptr, char ** endptr, int base));
-extern unsigned long strtoul __P ((const char * nptr, char ** endptr, int base));
-#if defined __UCLIBC_HAS_LONG_LONG__
-extern long long atoll(const char *nptr);
-extern long long strtoll __P ((const char * nptr, char ** endptr, int base));
-extern unsigned long long strtoull __P ((const char * nptr, char ** endptr, int base));
-#endif
-#ifdef __UCLIBC_HAS_FLOATS__
-/*TODO: extern char * gcvt __P ((double number, size_t ndigit, char * buf)); */
-extern double strtod __P ((const char * nptr, char ** endptr));
-#endif
-
-
-
-/* Random number functions */
-extern int rand __P ((void));
-extern void srand __P ((unsigned int seed));
-extern long int random(void);
-extern void srandom(unsigned int seed);
-
-/* Memory management functions */
-extern __ptr_t calloc __P ((size_t, size_t));
-extern __ptr_t malloc __P ((size_t));
-extern __ptr_t realloc __P ((__ptr_t, size_t));
-extern void free __P ((__ptr_t));
-/* Allocate a block on the stack that will be freed 
- * when the calling function exits.  We use gcc's
- * version to make life better... */
-#undef	alloca
-extern __ptr_t alloca __P ((size_t __size));
-#define alloca(size)	__builtin_alloca (size)
-
-#ifdef DEBUG_MALLOC
-extern __ptr_t calloc_dbg __P ((size_t, size_t, char* func, char* file, int line));
-extern __ptr_t malloc_dbg __P ((size_t, char* func, char* file, int line));
-extern __ptr_t realloc_dbg __P ((__ptr_t, size_t, char* func, char* file, int line));
-extern void free_dbg __P ((__ptr_t, char* func, char* file, int line));
-#define calloc(x,y) calloc_dbg((x),(y),__FUNCTION__,__FILE__,__LINE__)
-#define malloc(x) malloc_dbg((x),__FUNCTION__,__FILE__,__LINE__)
-#define realloc(x,y) realloc_dbg((x),(y),__FUNCTION__,__FILE__,__LINE__)
-#define free(x) free_dbg((x),__FUNCTION__,__FILE__,__LINE__)
-#endif
-
-
-
-/* System and environment functions */
-extern void abort __P ((void)) __attribute__ ((__noreturn__));
-extern int atexit __P ((void (*__func) (void)));
-extern void exit __P ((int __status)) __attribute__ ((__noreturn__));
-extern void _exit __P ((int __status)) __attribute__ ((__noreturn__));
-extern char *getenv __P ((__const char *__name));
-extern int putenv __P ((__const char *__string));
-extern char *realpath __P ((__const char *__restrict __name,
-	    char *__restrict __resolved));
-extern int setenv __P ((__const char *__name, __const char *__value,
-                        int __replace));
-extern int system __P ((__const char *__command));
-extern void unsetenv __P ((__const char *__name));
+/* Seed random number generator.  */
+extern void srand48 (long int __seedval) __THROW;
+extern unsigned short int *seed48 (unsigned short int __seed16v[3]) __THROW;
+extern void lcong48 (unsigned short int __param[7]) __THROW;
+
+# ifdef __USE_MISC
+/* Data structure for communication with thread safe versions.  This
+   type is to be regarded as opaque.  It's only exported because users
+   have to allocate objects of this type.  */
+struct drand48_data
+  {
+    unsigned short int __x[3];	/* Current state.  */
+    unsigned short int __old_x[3]; /* Old state.  */
+    unsigned short int __c;	/* Additive const. in congruential formula.  */
+    unsigned short int __init;	/* Flag for initializing.  */
+    unsigned long long int __a;	/* Factor in congruential formula.  */
+  };
+
+/* Return non-negative, double-precision floating-point value in [0.0,1.0).  */
+extern int drand48_r (struct drand48_data *__restrict __buffer,
+		      double *__restrict __result) __THROW;
+extern int erand48_r (unsigned short int __xsubi[3],
+		      struct drand48_data *__restrict __buffer,
+		      double *__restrict __result) __THROW;
+
+/* Return non-negative, long integer in [0,2^31).  */
+extern int lrand48_r (struct drand48_data *__restrict __buffer,
+		      long int *__restrict __result) __THROW;
+extern int nrand48_r (unsigned short int __xsubi[3],
+		      struct drand48_data *__restrict __buffer,
+		      long int *__restrict __result) __THROW;
+
+/* Return signed, long integers in [-2^31,2^31).  */
+extern int mrand48_r (struct drand48_data *__restrict __buffer,
+		      long int *__restrict __result) __THROW;
+extern int jrand48_r (unsigned short int __xsubi[3],
+		      struct drand48_data *__restrict __buffer,
+		      long int *__restrict __result) __THROW;
+
+/* Seed random number generator.  */
+extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
+     __THROW;
+
+extern int seed48_r (unsigned short int __seed16v[3],
+		     struct drand48_data *__buffer) __THROW;
+
+extern int lcong48_r (unsigned short int __param[7],
+		      struct drand48_data *__buffer) __THROW;
+# endif	/* Use misc.  */
+#endif	/* Use SVID or X/Open.  */
+
+#endif /* don't just need malloc and calloc */
+
+#ifndef __malloc_and_calloc_defined
+#define __malloc_and_calloc_defined
+/* Allocate SIZE bytes of memory.  */
+extern void *malloc (size_t __size) __THROW __attribute_malloc__;
+/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
+extern void *calloc (size_t __nmemb, size_t __size)
+     __THROW __attribute_malloc__;
+#endif
+
+#ifndef __need_malloc_and_calloc
+/* Re-allocate the previously allocated block
+   in PTR, making the new block SIZE bytes long.  */
+extern void *realloc (void *__ptr, size_t __size) __THROW __attribute_malloc__;
+/* Free a block allocated by `malloc', `realloc' or `calloc'.  */
+extern void free (void *__ptr) __THROW;
+
+#ifdef	__USE_MISC
+/* Free a block.  An alias for `free'.	(Sun Unices).  */
+extern void cfree (void *__ptr) __THROW;
+#endif /* Use misc.  */
+
+#if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
+# include <alloca.h>
+#endif /* Use GNU, BSD, or misc.  */
+
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* Allocate SIZE bytes on a page boundary.  The storage cannot be freed.  */
+extern void *valloc (size_t __size) __THROW __attribute_malloc__;
+#endif
+
+#ifdef __USE_XOPEN2K
+/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT.  */
+extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
+     __THROW __attribute_malloc__;
+#endif
+
+/* Abort execution and generate a core-dump.  */
+extern void abort (void) __THROW __attribute__ ((__noreturn__));
+
+
+/* Register a function to be called when `exit' is called.  */
+extern int atexit (void (*__func) (void)) __THROW;
 
 /* The following is used by uClibc in atexit.c and sysconf.c */
 #define __UCLIBC_MAX_ATEXIT     20
 
-/* Search and sort functions */
-extern __ptr_t bsearch __P ((__const __ptr_t __key, __const __ptr_t __base,
-			   size_t __nmemb, size_t __size, __compar_fn_t __compar));
-extern void qsort __P ((__ptr_t __base, size_t __nmemb, size_t __size,
-			  __compar_fn_t __compar));
+
+#ifdef	__USE_MISC
+/* Register a function to be called with the status
+   given to `exit' and the given argument.  */
+extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
+     __THROW;
+#endif
+
+/* Call all functions registered with `atexit' and `on_exit',
+   in the reverse of the order in which they were registered
+   perform stdio cleanup, and terminate program execution with STATUS.  */
+extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
+
+#ifdef __USE_ISOC99
+/* Terminate the program with STATUS without calling any of the
+   functions registered with `atexit' or `on_exit'.  */
+extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__));
+#endif
+
+
+/* Return the value of envariable NAME, or NULL if it doesn't exist.  */
+extern char *getenv (__const char *__name) __THROW;
+
+/* This function is similar to the above but returns NULL if the
+   programs is running with SUID or SGID enabled.  */
+extern char *__secure_getenv (__const char *__name) __THROW;
+
+#if defined __USE_SVID || defined __USE_XOPEN
+/* The SVID says this is in <stdio.h>, but this seems a better place.	*/
+/* Put STRING, which is of the form "NAME=VALUE", in the environment.
+   If there is no `=', remove NAME from the environment.  */
+extern int putenv (char *__string) __THROW;
+#endif
+
+#if defined __USE_BSD || defined __USE_XOPEN2K
+/* Set NAME to VALUE in the environment.
+   If REPLACE is nonzero, overwrite an existing value.  */
+extern int setenv (__const char *__name, __const char *__value, int __replace)
+     __THROW;
+
+/* Remove the variable NAME from the environment.  */
+extern int unsetenv (__const char *__name) __THROW;
+#endif
+
+#ifdef	__USE_MISC
+/* The `clearenv' was planned to be added to POSIX.1 but probably
+   never made it.  Nevertheless the POSIX.9 standard (POSIX bindings
+   for Fortran 77) requires this function.  */
+extern int clearenv (void) __THROW;
+#endif
+
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+/* Generate a unique temporary file name from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   Returns TEMPLATE, or a null pointer if it cannot get a unique file name.  */
+extern char *mktemp (char *__template) __THROW;
+
+/* Generate a unique temporary file name from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the filename unique.
+   Returns a file descriptor open on the file for reading and writing,
+   or -1 if it cannot create a uniquely-named file.  */
+# ifndef __USE_FILE_OFFSET64
+extern int mkstemp (char *__template) __THROW;
+# else
+#  ifdef __REDIRECT
+extern int __REDIRECT (mkstemp, (char *__template) __THROW, mkstemp64);
+#  else
+#   define mkstemp mkstemp64
+#  endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int mkstemp64 (char *__template) __THROW;
+# endif
+#endif
+
+#ifdef __USE_BSD
+/* Create a unique temporary directory from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the directory name unique.
+   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
+   The directory is created mode 700.  */
+extern char *mkdtemp (char *__template) __THROW;
+#endif
+
+
+/* Execute the given line as a shell command.  */
+extern int system (__const char *__command) __THROW;
+
+
+#if 0
+//#ifdef	__USE_GNU
+/* Return a malloc'd string containing the canonical absolute name of the
+   named file.  The last file name component need not exist, and may be a
+   symlink to a nonexistent file.  */
+extern char *canonicalize_file_name (__const char *__name) __THROW;
+#endif
+
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* Return the canonical absolute name of file NAME.  The last file name
+   component need not exist, and may be a symlink to a nonexistent file.
+   If RESOLVED is null, the result is malloc'd; otherwise, if the canonical
+   name is PATH_MAX chars or more, returns null with `errno' set to
+   ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, returns the
+   name in RESOLVED.  */
+extern char *realpath (__const char *__restrict __name,
+		       char *__restrict __resolved) __THROW;
+#endif
 
 
+/* Shorthand for type of comparison functions.  */
+#ifndef __COMPAR_FN_T
+# define __COMPAR_FN_T
+typedef int (*__compar_fn_t) (__const void *, __const void *);
 
-/* Integer math functions */
-extern int abs __P ((int __x)) __attribute__ ((__const__));
-extern div_t div __P ((int __numer, int __denom)) __attribute__ ((__const__));
-extern long int labs __P ((long int __x)) __attribute__ ((__const__));
-extern ldiv_t ldiv __P ((long int __numer, long int __denom)) __attribute__ ((__const__));
+# ifdef	__USE_GNU
+typedef __compar_fn_t comparison_fn_t;
+# endif
+#endif
+
+/* Do a binary search for KEY in BASE, which consists of NMEMB elements
+   of SIZE bytes each, using COMPAR to perform the comparisons.  */
+extern void *bsearch (__const void *__key, __const void *__base,
+		      size_t __nmemb, size_t __size, __compar_fn_t __compar);
+
+/* Sort NMEMB elements of BASE, of SIZE bytes each,
+   using COMPAR to perform the comparisons.  */
+extern void qsort (void *__base, size_t __nmemb, size_t __size,
+		   __compar_fn_t __compar);
+
+
+/* Return the absolute value of X.  */
+extern int abs (int __x) __THROW __attribute__ ((__const__));
+extern long int labs (long int __x) __THROW __attribute__ ((__const__));
+#ifdef __USE_ISOC99
+__extension__ extern long long int llabs (long long int __x)
+     __THROW __attribute__ ((__const__));
+#endif
+
+
+/* Return the `div_t', `ldiv_t' or `lldiv_t' representation
+   of the value of NUMER over DENOM. */
+/* GCC may have built-ins for these someday.  */
+extern div_t div (int __numer, int __denom)
+     __THROW __attribute__ ((__const__));
+extern ldiv_t ldiv (long int __numer, long int __denom)
+     __THROW __attribute__ ((__const__));
+#ifdef __USE_ISOC99
+__extension__ extern lldiv_t lldiv (long long int __numer,
+				    long long int __denom)
+     __THROW __attribute__ ((__const__));
+#endif
+
+
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
+/* Convert floating point numbers to strings.  The returned values are
+   valid only until another call to the same function.  */
+
+/* Convert VALUE to a string with NDIGIT digits and return a pointer to
+   this.  Set *DECPT with the position of the decimal character and *SIGN
+   with the sign of the number.  */
+extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
+		   int *__restrict __sign) __THROW;
+
+/* Convert VALUE to a string rounded to NDIGIT decimal digits.  Set *DECPT
+   with the position of the decimal character and *SIGN with the sign of
+   the number.  */
+extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
+		   int *__restrict __sign) __THROW;
+
+/* If possible convert VALUE to a string with NDIGIT significant digits.
+   Otherwise use exponential representation.  The resulting string will
+   be written to BUF.  */
+extern char *gcvt (double __value, int __ndigit, char *__buf) __THROW;
+
+
+# ifdef __USE_MISC
+/* Long double versions of above functions.  */
+extern char *qecvt (long double __value, int __ndigit,
+		    int *__restrict __decpt, int *__restrict __sign) __THROW;
+extern char *qfcvt (long double __value, int __ndigit,
+		    int *__restrict __decpt, int *__restrict __sign) __THROW;
+extern char *qgcvt (long double __value, int __ndigit, char *__buf) __THROW;
+
+
+/* Reentrant version of the functions above which provide their own
+   buffers.  */
+extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
+		   int *__restrict __sign, char *__restrict __buf,
+		   size_t __len) __THROW;
+extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
+		   int *__restrict __sign, char *__restrict __buf,
+		   size_t __len) __THROW;
+
+extern int qecvt_r (long double __value, int __ndigit,
+		    int *__restrict __decpt, int *__restrict __sign,
+		    char *__restrict __buf, size_t __len) __THROW;
+extern int qfcvt_r (long double __value, int __ndigit,
+		    int *__restrict __decpt, int *__restrict __sign,
+		    char *__restrict __buf, size_t __len) __THROW;
+# endif	/* misc */
+#endif	/* use MISC || use X/Open Unix */
+
+
+/* Return the length of the multibyte character
+   in S, which is no longer than N.  */
+extern int mblen (__const char *__s, size_t __n) __THROW;
+/* Return the length of the given multibyte character,
+   putting its `wchar_t' representation in *PWC.  */
+extern int mbtowc (wchar_t *__restrict __pwc,
+		   __const char *__restrict __s, size_t __n) __THROW;
+/* Put the multibyte character represented
+   by WCHAR in S, returning its length.  */
+extern int wctomb (char *__s, wchar_t __wchar) __THROW;
+
+
+/* Convert a multibyte string to a wide char string.  */
+extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
+			__const char *__restrict __s, size_t __n) __THROW;
+/* Convert a wide char string to multibyte string.  */
+extern size_t wcstombs (char *__restrict __s,
+			__const wchar_t *__restrict __pwcs, size_t __n)
+     __THROW;
+
+
+#ifdef __USE_SVID
+/* Determine whether the string value of RESPONSE matches the affirmation
+   or negative response expression as specified by the LC_MESSAGES category
+   in the program's current locale.  Returns 1 if affirmative, 0 if
+   negative, and -1 if not matching.  */
+extern int rpmatch (__const char *__response) __THROW;
+#endif
+
+
+#ifdef __USE_XOPEN_EXTENDED
+/* Parse comma separated suboption from *OPTIONP and match against
+   strings in TOKENS.  If found return index and set *VALUEP to
+   optional value introduced by an equal sign.  If the suboption is
+   not part of TOKENS return in *VALUEP beginning of unknown
+   suboption.  On exit *OPTIONP is set to the beginning of the next
+   token or at the terminating NUL character.  */
+extern int getsubopt (char **__restrict __optionp,
+		      char *__const *__restrict __tokens,
+		      char **__restrict __valuep) __THROW;
+#endif
+
+
+#ifdef __USE_XOPEN
+/* Setup DES tables according KEY.  */
+extern void setkey (__const char *__key) __THROW;
+#endif
+
+
+/* X/Open pseudo terminal handling.  */
+
+#ifdef __USE_XOPEN2K
+/* Return a master pseudo-terminal handle.  */
+extern int posix_openpt (int __oflag) __THROW;
+#endif
+
+#ifdef __USE_XOPEN
+/* The next four functions all take a master pseudo-tty fd and
+   perform an operation on the associated slave:  */
+
+/* Chown the slave to the calling user.  */
+extern int grantpt (int __fd) __THROW;
+
+/* Release an internal lock so the slave can be opened.
+   Call after grantpt().  */
+extern int unlockpt (int __fd) __THROW;
+
+/* Return the pathname of the pseudo terminal slave assoicated with
+   the master FD is open on, or NULL on errors.
+   The returned storage is good until the next call to this function.  */
+extern char *ptsname (int __fd) __THROW;
+#endif
+
+#if 0
+//#ifdef __USE_GNU
+/* Store at most BUFLEN characters of the pathname of the slave pseudo
+   terminal associated with the master FD is open on in BUF.
+   Return 0 on success, otherwise an error number.  */
+extern int ptsname_r (int __fd, char *__buf, size_t __buflen) __THROW;
+
+/* Open a master pseudo terminal and return its file descriptor.  */
+extern int getpt (void) __THROW;
+#endif
+
+#ifdef __USE_BSD
+/* Put the 1 minute, 5 minute and 15 minute load averages into the first
+   NELEM elements of LOADAVG.  Return the number written (never more than
+   three, but may be less than NELEM), or -1 if an error occurred.  */
+extern int getloadavg (double __loadavg[], int __nelem) __THROW;
+#endif
 
-/* Generate a unique temporary file name from TEMPLATE. */
-extern char *mktemp __P ((char *__template));
-extern int mkstemp __P ((char *__template));
+#endif /* don't just need malloc and calloc */
+#undef __need_malloc_and_calloc
 
 __END_DECLS
 
-#endif /* __STDLIB_H */
+#endif /* stdlib.h  */

+ 334 - 109
include/string.h

@@ -1,141 +1,144 @@
+/* Copyright (C) 1991,92,93,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-#ifndef __STRING_H
-#define __STRING_H
-#include <features.h>
-#include <sys/types.h>
-#include <stddef.h>
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
-__BEGIN_DECLS
-/* Basic string functions */
+   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
+   Lesser General Public License for more details.
 
-/* Return the length of S.  */
-extern size_t strlen __P ((__const char *__s));
-/* Append SRC onto DEST.  */
-extern char *strcat __P ((char *__restrict __dest,
-			  __const char *__restrict __src));
-/* Append no more than N characters from SRC onto DEST.  */
-extern char *strncat __P ((char *__restrict __dest,
-			   __const char *__restrict __src, size_t __n));
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-/* Copy SRC to DEST.  */
-extern char *strcpy __P ((char *__restrict __dest,
-			  __const char *__restrict __src));
-extern char *stpcpy __P ((char *__restrict __dest,
-			  __const char *__restrict __src));
-extern char *stpncpy __P ((char *__restrict __dest,
-			   __const char *__restrict __src, size_t __n));
-/* Copy no more than N characters of SRC to DEST.  */
-extern char *strncpy __P ((char *__restrict __dest,
-			   __const char *__restrict __src, size_t __n));
+/*
+ *	ISO C99 Standard: 7.21 String handling	<string.h>
+ */
 
-/* Compare S1 and S2.  */
-extern int strcmp __P ((__const char *__s1, __const char *__s2));
-/* Compare N characters of S1 and S2.  */
-extern int strncmp __P ((__const char *__s1, __const char *__s2, size_t __n));
+#ifndef	_STRING_H
+#define	_STRING_H	1
 
-/* Find the first occurrence of C in S.  */
-extern char *strchr __P ((__const char *__s, int __c));
-/* Find the last occurrence of C in S.  */
-extern char *strrchr __P ((__const char *__s, int __c));
-/* Duplicate S, returning an identical malloc'd string.  */
-extern char *strdup __P ((__const char *__s));
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Get size_t and NULL from <stddef.h>.  */
+#define	__need_size_t
+#define	__need_NULL
+#include <stddef.h>
 
-/* Basic mem functions */
 
 /* Copy N bytes of SRC to DEST.  */
-extern __ptr_t memcpy __P ((__ptr_t __restrict __dest,
-			    __const __ptr_t __restrict __src, size_t __n));
+extern void *memcpy (void *__restrict __dest,
+		     __const void *__restrict __src, size_t __n) __THROW;
+/* Copy N bytes of SRC to DEST, guaranteeing
+   correct behavior for overlapping strings.  */
+extern void *memmove (void *__dest, __const void *__src, size_t __n)
+     __THROW;
+
 /* Copy no more than N bytes of SRC to DEST, stopping when C is found.
    Return the position in DEST one byte past where C was copied,
    or NULL if C was not found in the first N bytes of SRC.  */
-extern __ptr_t memccpy __P ((__ptr_t __dest, __const __ptr_t __src,
-			     int __c, size_t __n));
-/* Search N bytes of S for C.  */
-extern __ptr_t memchr __P ((__const __ptr_t __s, int __c, size_t __n));
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN
+extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
+		      int __c, size_t __n)
+     __THROW;
+#endif /* SVID.  */
+
+
 /* Set N bytes of S to C.  */
-extern __ptr_t memset __P ((__ptr_t __s, int __c, size_t __n));
+extern void *memset (void *__s, int __c, size_t __n) __THROW;
+
 /* Compare N bytes of S1 and S2.  */
-extern int memcmp __P ((__const __ptr_t __s1, __const __ptr_t __s2,
-			size_t __n));
-/* Copy N bytes of SRC to DEST, guaranteeing
-   correct behavior for overlapping strings.  */
-extern __ptr_t memmove __P ((__ptr_t __dest, __const __ptr_t __src,
-			     size_t __n));
+extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
+     __THROW __attribute_pure__;
 
+/* Search N bytes of S for C.  */
+extern void *memchr (__const void *__s, int __c, size_t __n)
+      __THROW __attribute_pure__;
 
-/* Minimal (very!) locale support */
-extern int strcoll __P ((__const char *__s1, __const char *__s2));
-extern size_t strxfrm __P ((char *__restrict __dest,
-			    __const char *__restrict __src, size_t __n));
+#if 0
+//#ifdef __USE_GNU
+/* Search in S for C.  This is similar to `memchr' but there is no
+   length limit.  */
+extern void *rawmemchr (__const void *__s, int __c) __THROW __attribute_pure__;
 
-/* BSDisms */
-extern char *index __P ((__const char *__s, int __c));
-extern char *rindex __P ((__const char *__s, int __c));
+/* Search N bytes of S for the final occurrence of C.  */
+extern void *memrchr (__const void *__s, int __c, size_t __n)
+      __THROW __attribute_pure__;
+#endif
 
-/* Return the position of the first bit set in I, or 0 if none are set.
-   The least-significant bit is position 1, the most-significant 32.  */
-extern int ffs __P ((int __i)) __attribute__ ((const));
 
-/* Other common BSD functions */
-/* Set N bytes of S to 0.  */
-extern void bzero __P ((__ptr_t __s, size_t __n));
-/* Copy N bytes of SRC to DEST (like memmove, but args reversed).  */
-extern void bcopy __P ((__const __ptr_t __src, __ptr_t __dest, size_t __n));
+/* Copy SRC to DEST.  */
+extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
+     __THROW;
+/* Copy no more than N characters of SRC to DEST.  */
+extern char *strncpy (char *__restrict __dest,
+		      __const char *__restrict __src, size_t __n) __THROW;
 
-/* Compare S1 and S2, ignoring case.  */
-extern int strcasecmp __P ((__const char *__s1, __const char *__s2));
-/* Compare no more than N chars of S1 and S2, ignoring case.  */
-extern int strncasecmp __P ((__const char *__s1, __const char *__s2,
-			     size_t __n));
-/* Find the first occurrence in S of any character in ACCEPT.  */
-extern char *strpbrk __P ((__const char *__s, __const char *__accept));
-/* Return the next DELIM-delimited token from *STRINGP,
-   terminating it with a '\0', and update *STRINGP to point past it.  */
-extern char *strsep __P ((char **__restrict __stringp,
-			  __const char *__restrict __delim));
-/* Find the first occurrence of NEEDLE in HAYSTACK.  */
-extern char *strstr __P ((__const char *__haystack, __const char *__needle));
-extern char *strcasestr __P((__const char *__haystack, __const char *__needle));
-/* Divide S into tokens separated by characters in DELIM.  */
-extern char *strtok __P ((char *__restrict __s,
-			  __const char *__restrict __delim));
-/* Divide S into tokens separated by characters in DELIM.  Information
-   passed between calls are stored in SAVE_PTR.  */
-extern char *__strtok_r __P ((char *__restrict __s,
-                              __const char *__restrict __delim,
-                              char **__restrict __save_ptr));
-#if defined __USE_POSIX || defined __USE_MISC
-extern char *strtok_r __P ((char *__restrict __s,
-                            __const char *__restrict __delim,
-                            char **__restrict __save_ptr));
-#endif
-/* Return the length of the initial segment of S which
-   consists entirely of characters not in REJECT.  */
-extern size_t strcspn __P ((__const char *__s, __const char *__reject));
-/* Return the length of the initial segment of S which
-   consists entirely of characters in ACCEPT.  */
-extern size_t strspn __P ((__const char *__s, __const char *__accept));
+/* Append SRC onto DEST.  */
+extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
+     __THROW;
+/* Append no more than N characters from SRC onto DEST.  */
+extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
+		      size_t __n) __THROW;
 
-/* Return a string describing the meaning of the signal number in SIG.  */
-extern char *strsignal __P ((int __sig));
+/* Compare S1 and S2.  */
+extern int strcmp (__const char *__s1, __const char *__s2)
+     __THROW __attribute_pure__;
+/* Compare N characters of S1 and S2.  */
+extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
+     __THROW __attribute_pure__;
 
-/* More BSD compatabilty */
-extern int bcmp(const void *s1, const void *s2, size_t n);
+/* Compare the collated forms of S1 and S2.  */
+extern int strcoll (__const char *__s1, __const char *__s2)
+     __THROW __attribute_pure__;
+/* Put a transformation of SRC into no more than N bytes of DEST.  */
+extern size_t strxfrm (char *__restrict __dest,
+		       __const char *__restrict __src, size_t __n) __THROW;
 
-/* Linux silly hour */
-char *strfry __P ((char *));
+#if 0
+//#ifdef __USE_GNU
+/* The following functions are equivalent to the both above but they
+   take the locale they use for the collation as an extra argument.
+   This is not standardsized but something like will come.  */
+# include <xlocale.h>
 
-/* Find the length of STRING, but scan at most MAXLEN characters.
-   If no '\0' terminator is found in that many characters, return MAXLEN.  */
-extern size_t strnlen __P ((__const char *__string, size_t __maxlen));
+/* Compare the collated forms of S1 and S2 using rules from L.  */
+extern int __strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l)
+     __THROW __attribute_pure__;
+/* Put a transformation of SRC into no more than N bytes of DEST.  */
+extern size_t __strxfrm_l (char *__dest, __const char *__src, size_t __n,
+			   __locale_t __l) __THROW;
+#endif
+
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* Duplicate S, returning an identical malloc'd string.  */
+extern char *strdup (__const char *__s) __THROW __attribute_malloc__;
+#endif
+
+/* Return a malloc'd copy of at most N bytes of STRING.  The
+   resultant string is terminated even if no null terminator
+   appears before STRING[N].  */
+#if 0
+//#if defined __USE_GNU
+extern char *strndup (__const char *__string, size_t __n)
+     __THROW __attribute_malloc__;
+#endif
 
+#if defined __USE_GNU && defined __GNUC__
 /* Duplicate S, returning an identical alloca'd string.  */
 # define strdupa(s)							      \
   (__extension__							      \
     ({									      \
       __const char *__old = (s);					      \
       size_t __len = strlen (__old) + 1;				      \
-      char *__new = __builtin_alloca (__len);				      \
+      char *__new = (char *) __builtin_alloca (__len);			      \
       (char *) memcpy (__new, __old, __len);				      \
     }))
 
@@ -145,11 +148,233 @@ extern size_t strnlen __P ((__const char *__string, size_t __maxlen));
     ({									      \
       __const char *__old = (s);					      \
       size_t __len = strnlen (__old, (n));				      \
-      char *__new = __builtin_alloca (__len + 1);			      \
+      char *__new = (char *) __builtin_alloca (__len + 1);		      \
       __new[__len] = '\0';						      \
       (char *) memcpy (__new, __old, __len);				      \
     }))
+#endif
+
+/* Find the first occurrence of C in S.  */
+extern char *strchr (__const char *__s, int __c) __THROW __attribute_pure__;
+/* Find the last occurrence of C in S.  */
+extern char *strrchr (__const char *__s, int __c) __THROW __attribute_pure__;
+
+#if 0
+//#ifdef __USE_GNU
+/* This funciton is similar to `strchr'.  But it returns a pointer to
+   the closing NUL byte in case C is not found in S.  */
+extern char *strchrnul (__const char *__s, int __c) __THROW __attribute_pure__;
+#endif
+
+/* Return the length of the initial segment of S which
+   consists entirely of characters not in REJECT.  */
+extern size_t strcspn (__const char *__s, __const char *__reject)
+     __THROW __attribute_pure__;
+/* Return the length of the initial segment of S which
+   consists entirely of characters in ACCEPT.  */
+extern size_t strspn (__const char *__s, __const char *__accept)
+     __THROW __attribute_pure__;
+/* Find the first occurrence in S of any character in ACCEPT.  */
+extern char *strpbrk (__const char *__s, __const char *__accept)
+     __THROW __attribute_pure__;
+/* Find the first occurrence of NEEDLE in HAYSTACK.  */
+extern char *strstr (__const char *__haystack, __const char *__needle)
+     __THROW __attribute_pure__;
+
+#ifdef __USE_GNU
+/* Similar to `strstr' but this function ignores the case of both strings.  */
+extern char *strcasestr (__const char *__haystack, __const char *__needle)
+     __THROW __attribute_pure__;
+#endif
+
+/* Divide S into tokens separated by characters in DELIM.  */
+extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
+     __THROW;
+
+/* Divide S into tokens separated by characters in DELIM.  Information
+   passed between calls are stored in SAVE_PTR.  */
+extern char *__strtok_r (char *__restrict __s,
+			 __const char *__restrict __delim,
+			 char **__restrict __save_ptr) __THROW;
+#if defined __USE_POSIX || defined __USE_MISC
+extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
+		       char **__restrict __save_ptr) __THROW;
+#endif
+
+#if 0
+//#ifdef __USE_GNU
+/* Find the first occurrence of NEEDLE in HAYSTACK.
+   NEEDLE is NEEDLELEN bytes long;
+   HAYSTACK is HAYSTACKLEN bytes long.  */
+extern void *memmem (__const void *__haystack, size_t __haystacklen,
+		     __const void *__needle, size_t __needlelen)
+     __THROW __attribute_pure__;
+
+/* Copy N bytes of SRC to DEST, return pointer to bytes after the
+   last written byte.  */
+extern void *__mempcpy (void *__restrict __dest,
+			__const void *__restrict __src, size_t __n) __THROW;
+extern void *mempcpy (void *__restrict __dest,
+		      __const void *__restrict __src, size_t __n) __THROW;
+#endif
 
-__END_DECLS
 
+/* Return the length of S.  */
+extern size_t strlen (__const char *__s) __THROW __attribute_pure__;
+
+#ifdef	__USE_GNU
+/* Find the length of STRING, but scan at most MAXLEN characters.
+   If no '\0' terminator is found in that many characters, return MAXLEN.  */
+extern size_t strnlen (__const char *__string, size_t __maxlen)
+     __THROW __attribute_pure__;
 #endif
+
+
+/* Return a string describing the meaning of the `errno' code in ERRNUM.  */
+extern char *strerror (int __errnum) __THROW;
+#ifdef	__USE_MISC
+/* Reentrant version of `strerror'.  If a temporary buffer is required, at
+   most BUFLEN bytes of BUF will be used.  */
+extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) __THROW;
+#endif
+
+/* We define this function always since `bzero' is sometimes needed when
+   the namespace rules does not allow this.  */
+extern void __bzero (void *__s, size_t __n) __THROW;
+
+#if defined __USE_BSD
+/* Copy N bytes of SRC to DEST (like memmove, but args reversed).  */
+extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW;
+
+/* Set N bytes of S to 0.  */
+extern void bzero (void *__s, size_t __n) __THROW;
+
+/* Compare N bytes of S1 and S2 (same as memcmp).  */
+extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
+     __THROW __attribute_pure__;
+
+/* Find the first occurrence of C in S (same as strchr).  */
+extern char *index (__const char *__s, int __c) __THROW __attribute_pure__;
+
+/* Find the last occurrence of C in S (same as strrchr).  */
+extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__;
+
+/* Return the position of the first bit set in I, or 0 if none are set.
+   The least-significant bit is position 1, the most-significant 32.  */
+extern int ffs (int __i) __THROW __attribute__ ((__const__));
+
+/* The following two functions are non-standard but necessary for non-32 bit
+   platforms.  */
+# if 0
+//# ifdef	__USE_GNU
+extern int ffsl (long int __l) __THROW __attribute__ ((__const__));
+#  ifdef __GNUC__
+__extension__ extern int ffsll (long long int __ll)
+     __THROW __attribute__ ((__const__));
+#  endif
+# endif
+
+/* Compare S1 and S2, ignoring case.  */
+extern int strcasecmp (__const char *__s1, __const char *__s2)
+     __THROW __attribute_pure__;
+
+/* Compare no more than N chars of S1 and S2, ignoring case.  */
+extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
+     __THROW __attribute_pure__;
+#endif /* Use BSD.  */
+
+#if 0
+//#ifdef	__USE_GNU
+/* Again versions of a few functions which use the given locale instead
+   of the global one.  */
+extern int __strcasecmp_l (__const char *__s1, __const char *__s2,
+			   __locale_t __loc) __THROW __attribute_pure__;
+
+extern int __strncasecmp_l (__const char *__s1, __const char *__s2,
+			    size_t __n, __locale_t __loc)
+     __THROW __attribute_pure__;
+#endif
+
+#ifdef	__USE_BSD
+/* Return the next DELIM-delimited token from *STRINGP,
+   terminating it with a '\0', and update *STRINGP to point past it.  */
+extern char *strsep (char **__restrict __stringp,
+		     __const char *__restrict __delim) __THROW;
+#endif
+
+#ifdef	__USE_GNU
+#if 0
+/* Compare S1 and S2 as strings holding name & indices/version numbers.  */
+extern int strverscmp (__const char *__s1, __const char *__s2)
+     __THROW __attribute_pure__;
+#endif
+
+/* Return a string describing the meaning of the signal number in SIG.  */
+extern char *strsignal (int __sig) __THROW;
+
+#if 0
+/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
+extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src)
+     __THROW;
+extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src)
+     __THROW;
+#endif
+
+/* Copy no more than N characters of SRC to DEST, returning the address of
+   the last character written into DEST.  */
+extern char *__stpncpy (char *__restrict __dest,
+			__const char *__restrict __src, size_t __n) __THROW;
+extern char *stpncpy (char *__restrict __dest,
+		      __const char *__restrict __src, size_t __n) __THROW;
+
+#if 0
+/* Sautee STRING briskly.  */
+extern char *strfry (char *__string) __THROW;
+
+/* Frobnicate N bytes of S.  */
+extern void *memfrob (void *__s, size_t __n) __THROW;
+#endif
+
+# ifndef basename
+/* Return the file name within directory of FILENAME.  We don't
+   declare the function if the `basename' macro is available (defined
+   in <libgen.h>) which makes the XPG version of this function
+   available.  */
+extern char *basename (__const char *__filename) __THROW;
+# endif
+#endif
+
+#if 0
+#if defined __GNUC__ && __GNUC__ >= 2
+# if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
+     && !defined __NO_INLINE__ && !defined __cplusplus
+/* When using GNU CC we provide some optimized versions of selected
+   functions from this header.  There are two kinds of optimizations:
+
+   - machine-dependent optimizations, most probably using inline
+     assembler code; these might be quite expensive since the code
+     size can increase significantly.
+     These optimizations are not used unless the symbol
+	__USE_STRING_INLINES
+     is defined before including this header.
+
+   - machine-independent optimizations which do not increase the
+     code size significantly and which optimize mainly situations
+     where one or more arguments are compile-time constants.
+     These optimizations are used always when the compiler is
+     taught to optimize.
+
+   One can inhibit all optimizations by defining __NO_STRING_INLINES.  */
+
+/* Get the machine-dependent optimizations (if any).  */
+#  include <bits/string.h>
+
+/* These are generic optimizations which do not add too much inline code.  */
+#  include <bits/string2.h>
+# endif
+#endif
+#endif
+
+__END_DECLS
+
+#endif /* string.h  */

+ 65 - 1
include/strings.h

@@ -1 +1,65 @@
-#include <string.h>
+/* Copyright (C) 1991,92,96,97,99,2000,2001 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_STRINGS_H
+#define	_STRINGS_H	1
+
+/* We don't need and should not read this file if <string.h> was already
+   read. The one exception being that if __USE_BSD isn't defined, then
+   these aren't defined in string.h, so we need to define them here.  */
+#if !defined _STRING_H || !defined __USE_BSD
+
+# include <features.h>
+# define __need_size_t
+# include <stddef.h>
+
+__BEGIN_DECLS
+
+/* Compare N bytes of S1 and S2 (same as memcmp).  */
+extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
+     __THROW __attribute_pure__;
+
+/* Copy N bytes of SRC to DEST (like memmove, but args reversed).  */
+extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW;
+
+/* Set N bytes of S to 0.  */
+extern void bzero (void *__s, size_t __n) __THROW;
+
+/* Return the position of the first bit set in I, or 0 if none are set.
+   The least-significant bit is position 1, the most-significant 32.  */
+extern int ffs (int __i) __THROW __attribute__ ((const));
+
+/* Find the first occurrence of C in S (same as strchr).  */
+extern char *index (__const char *__s, int __c) __THROW __attribute_pure__;
+
+/* Find the last occurrence of C in S (same as strrchr).  */
+extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__;
+
+/* Compare S1 and S2, ignoring case.  */
+extern int strcasecmp (__const char *__s1, __const char *__s2)
+     __THROW __attribute_pure__;
+
+/* Compare no more than N chars of S1 and S2, ignoring case.  */
+extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
+     __THROW __attribute_pure__;
+
+__END_DECLS
+
+#endif	/* string.h  */
+
+#endif	/* strings.h  */

+ 3 - 1
include/sys/bitypes.h

@@ -1 +1,3 @@
-#include <stddef.h>
+/* The GNU <sys/types.h> defines all the necessary types.  */
+
+#include <sys/types.h>

+ 195 - 27
include/sys/cdefs.h

@@ -1,49 +1,217 @@
+/* Copyright (C) 1992,93,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-#ifndef __SYS_CDEFS_H
-#define __SYS_CDEFS_H
-#include <features.h>
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
-#if defined (__STDC__) && __STDC__
+   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
+   Lesser General Public License for more details.
 
-#define	__CONCAT(x,y)	x ## y
-#define	__STRING(x)	#x
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_SYS_CDEFS_H
+#define	_SYS_CDEFS_H	1
+
+/* We are almost always included from features.h. */
+#ifndef _FEATURES_H
+# include <features.h>
+#endif
+
+/* The GNU libc does not support any K&R compilers or the traditional mode
+   of ISO C compilers anymore.  Check for some of the combinations not
+   anymore supported.  */
+#if defined __GNUC__ && !defined __STDC__
+# error "You need a ISO C conforming compiler to use the glibc headers"
+#endif
+
+/* Some user header file might have defined this before.  */
+#undef	__P
+#undef	__PMT
+
+#ifdef __GNUC__
+
+/* GCC can always grok prototypes.  For C++ programs we add throw()
+   to help it optimize the function calls.  But this works only with
+   gcc 2.8.x and egcs.  */
+# if defined __cplusplus && __GNUC_PREREQ (2,8)
+#  define __THROW	throw ()
+# else
+#  define __THROW
+# endif
+# define __P(args)	args __THROW
+/* This macro will be used for functions which might take C++ callback
+   functions.  */
+# define __PMT(args)	args
+
+#else	/* Not GCC.  */
+
+# define __inline		/* No inline functions.  */
+
+# define __THROW
+# define __P(args)	args
+# define __PMT(args)	args
+
+# define __const	const
+# define __signed	signed
+# define __volatile	volatile
+
+#endif	/* GCC.  */
+
+/* For these things, GCC behaves the ANSI way normally,
+   and the non-ANSI way under -traditional.  */
+
+#define __CONCAT(x,y)	x ## y
+#define __STRING(x)	#x
 
 /* This is not a typedef so `const __ptr_t' does the right thing.  */
 #define __ptr_t void *
+#define __long_double_t  long double
+
+
+/* C++ needs to know that types and declarations are C, not C++.  */
+#ifdef	__cplusplus
+# define __BEGIN_DECLS	extern "C" {
+# define __END_DECLS	}
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+
 
+/* Support for bounded pointers.  */
+#ifndef __BOUNDED_POINTERS__
+# define __bounded	/* nothing */
+# define __unbounded	/* nothing */
+# define __ptrvalue	/* nothing */
+#endif
+
+
+/* Support for flexible arrays.  */
+#if __GNUC_PREREQ (2,97)
+/* GCC 2.97 supports C99 flexible array members.  */
+# define __flexarr	[]
 #else
+# ifdef __GNUC__
+#  define __flexarr	[0]
+# else
+#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#   define __flexarr	[]
+#  else
+/* Some other non-C99 compiler.  Approximate with [1].  */
+#   define __flexarr	[1]
+#  endif
+# endif
+#endif
+
+
+/* __asm__ ("xyz") is used throughout the headers to rename functions
+   at the assembly language level.  This is wrapped by the __REDIRECT
+   macro, in order to support compilers that can do this some other
+   way.  When compilers don't support asm-names at all, we have to do
+   preprocessor tricks instead (which don't have exactly the right
+   semantics, but it's the best we can do).
+
+   Example:
+   int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
 
-#define	__CONCAT(x,y)	x/**/y
-#define	__STRING(x)	"x"
+#if defined __GNUC__ && __GNUC__ >= 2
 
-#define __ptr_t char *
+# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
+# define __ASMNAME(cname)  __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
 
+/*
+#elif __SOME_OTHER_COMPILER__
+
+# define __REDIRECT(name, proto, alias) name proto; \
+	_Pragma("let " #name " = " #alias)
+*/
 #endif
 
-/* C++ needs to know that types and declarations are C, not C++.  */
-#ifdef  __cplusplus
-# define __BEGIN_DECLS  extern "C" {
-# define __END_DECLS    }
+/* GCC has various useful declarations that can be made with the
+   `__attribute__' syntax.  All of the ways we use this do fine if
+   they are omitted for compilers that don't understand it. */
+#if !defined __GNUC__ || __GNUC__ < 2
+# define __attribute__(xyz)	/* Ignore */
+#endif
+
+/* At some point during the gcc 2.96 development the `malloc' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.  */
+#if __GNUC_PREREQ (2,96)
+# define __attribute_malloc__ __attribute__ ((__malloc__))
 #else
-# define __BEGIN_DECLS
-# define __END_DECLS
+# define __attribute_malloc__ /* Ignore */
 #endif
 
-/* GNUish things */
-#define __CONSTVALUE
-#define __CONSTVALUE2
+/* At some point during the gcc 2.96 development the `pure' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.  */
+#if __GNUC_PREREQ (2,96)
+# define __attribute_pure__ __attribute__ ((__pure__))
+#else
+# define __attribute_pure__ /* Ignore */
+#endif
 
-#ifdef __GNUC__
-/* GCC can always grok prototypes.  For C++ programs we add throw()
-   to help it optimize the function calls.  But this works only with
-   gcc 2.8.x and egcs.  */
-#if defined __cplusplus && __GNUC_PREREQ (2,8)
-#define __THROW		throw()
+/* At some point during the gcc 2.8 development the `format_arg' attribute
+   for functions was introduced.  We don't want to use it unconditionally
+   (although this would be possible) since it generates warnings.
+   If several `format_arg' attributes are given for the same function, in
+   gcc-3.0 and older, all but the last one are ignored.  In newer gccs,
+   all designated arguments are considered.  */
+#if __GNUC_PREREQ (2,8)
+# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
 #else
-#define __THROW
+# define __attribute_format_arg__(x) /* Ignore */
 #endif
-#else /* GCC */
-#define __THROW
+
+/* At some point during the gcc 2.97 development the `strfmon' format
+   attribute for functions was introduced.  We don't want to use it
+   unconditionally (although this would be possible) since it
+   generates warnings.  */
+#if __GNUC_PREREQ (2,97)
+# define __attribute_format_strfmon__(a,b) \
+  __attribute__ ((__format__ (__strfmon__, a, b)))
+#else
+# define __attribute_format_strfmon__(a,b) /* Ignore */
 #endif
 
+/* It is possible to compile containing GCC extensions even if GCC is
+   run in pedantic mode if the uses are carefully marked using the
+   `__extension__' keyword.  But this is not generally available before
+   version 2.8.  */
+#if !__GNUC_PREREQ (2,8)
+# define __extension__		/* Ignore */
 #endif
+
+/* __restrict is known in EGCS 1.2 and above. */
+#if !__GNUC_PREREQ (2,92)
+# define __restrict	/* Ignore */
+#endif
+
+/* ISO C99 also allows to declare arrays as non-overlapping.  The syntax is
+     array_name[restrict]
+   GCC 3.1 supports this.  */
+#if __GNUC_PREREQ (3,1) && !defined __GNUG__
+# define __restrict_arr	__restrict
+#else
+# ifdef __GNUC__
+#  define __restrict_arr	/* Not supported in old GCC.  */
+# else
+#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#   define __restrict_arr	restrict
+#  else
+/* Some other non-C99 compiler.  */
+#   define __restrict_arr	/* Not supported.  */
+#  endif
+# endif
+#endif
+
+#endif	 /* sys/cdefs.h */

+ 8 - 8
include/sys/dir.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_SYS_DIR_H
 #define	_SYS_DIR_H	1

+ 38 - 17
include/sys/file.h

@@ -1,35 +1,56 @@
-#ifndef _SYS_FILE_H
-#define _SYS_FILE_H
+/* Copyright (C) 1991, 92, 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_SYS_FILE_H
+#define	_SYS_FILE_H	1
 
 #include <features.h>
-#include <fcntl.h>
 
-#ifndef L_SET
+#ifndef	_FCNTL_H
+# include <fcntl.h>
+#endif
+
+__BEGIN_DECLS
 
-#define L_SET           0       /* absolute offset */
-#define L_INCR          1       /* relative to current offset */
-#define L_XTND          2       /* relative to end of file */
 
+/* Alternate names for values for the WHENCE argument to `lseek'.
+   These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively.  */
+#ifndef L_SET
+# define L_SET	0	/* Seek from beginning of file.  */
+# define L_INCR	1	/* Seek from current position.  */
+# define L_XTND	2	/* Seek from end of file.  */
 #endif
 
-#ifndef LOCK_SH
 
 /* Operations for the `flock' call.  */
-#define LOCK_SH       1    /* Shared lock.  */
-#define LOCK_EX       2    /* Exclusive lock.  */
-#define LOCK_UN       8    /* Unlock.  */
+#define	LOCK_SH	1	/* Shared lock.  */
+#define	LOCK_EX	2 	/* Exclusive lock.  */
+#define	LOCK_UN	8	/* Unlock.  */
 
 /* Can be OR'd in to one of the above.  */
-#define LOCK_NB       4    /* Don't block when locking.  */
+#define	LOCK_NB	4	/* Don't block when locking.  */
 
-#endif
-
-__BEGIN_DECLS
 
 /* Apply or remove an advisory lock, according to OPERATION,
    on the file FD refers to.  */
-extern int flock __P ((int __fd, int __operation));
+extern int flock (int __fd, int __operation) __THROW;
+
 
 __END_DECLS
 
-#endif
+#endif /* sys/file.h  */

+ 20 - 19
include/sys/io.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1996, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_SYS_IO_H
 
@@ -26,15 +26,15 @@ __BEGIN_DECLS
 /* If TURN_ON is TRUE, request for permission to do direct i/o on the
    port numbers in the range [FROM,FROM+NUM-1].  Otherwise, turn I/O
    permission off for that range.  This call requires root privileges.  */
-extern int ioperm __P ((unsigned long int __from, unsigned long int __num,
-			int __turn_on));
+extern int ioperm (unsigned long int __from, unsigned long int __num,
+		   int __turn_on) __THROW;
 
 /* Set the I/O privilege level to LEVEL.  If LEVEL is nonzero,
    permission to access any I/O port is granted.  This call requires
    root privileges. */
-extern int iopl __P ((int __level));
+extern int iopl (int __level) __THROW;
+
 
-/* The functions that actually perform reads and writes.  */
 #ifdef __i386__
 /*
  * For i386, glibc defines the in* and out* functions as static inlines
@@ -45,13 +45,14 @@ extern int iopl __P ((int __level));
  */
 #include <bits/io_i386.h>
 #else
-extern unsigned char inb (unsigned long port);
-extern unsigned short inw (unsigned long port);
-extern unsigned long inl (unsigned long port);
+/* The functions that actually perform reads and writes.  */
+extern unsigned char inb (unsigned long int port) __THROW;
+extern unsigned short int inw (unsigned long int port) __THROW;
+extern unsigned long int inl (unsigned long int port) __THROW;
 
-extern void outb (unsigned char value, unsigned long port);
-extern void outw (unsigned short value, unsigned long port);
-extern void outl (unsigned long value, unsigned long port);
+extern void outb (unsigned char value, unsigned long int port) __THROW;
+extern void outw (unsigned short value, unsigned long int port) __THROW;
+extern void outl (unsigned long value, unsigned long int port) __THROW;
 #endif /* __i386__ */
 
 __END_DECLS

+ 10 - 10
include/sys/ioctl.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 92, 93, 94, 96, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 96, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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
@@ -39,7 +39,7 @@ __BEGIN_DECLS
 /* 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, ...));
+extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
 
 __END_DECLS
 

+ 32 - 12
include/sys/ipc.h

@@ -1,37 +1,57 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_IPC_H
 #define _SYS_IPC_H	1
 
 #include <features.h>
 
+#if !defined __USE_SVID && !defined __USE_XOPEN && __GNUC__ >= 2
+# warning "Files using this header must be compiled with _SVID_SOURCE or _XOPEN_SOURCE"
+#endif
+
 /* Get system dependent definition of `struct ipc_perm' and more.  */
 #include <bits/ipc.h>
 
-#if !defined __USE_SVID && !defined __USE_XOPEN && __GNUC__ >= 2
-# warning "Files using this header must be compiled with _SVID_SOURCE or _XOPEN_SOURCE"
+#ifndef __uid_t_defined
+typedef __uid_t uid_t;
+# define __uid_t_defined
+#endif
+
+#ifndef __gid_t_defined
+typedef __gid_t gid_t;
+# define __gid_t_defined
+#endif
+
+#ifndef __mode_t_defined
+typedef __mode_t mode_t;
+# define __mode_t_defined
+#endif
+
+#ifndef __key_t_defined
+typedef __key_t key_t;
+# define __key_t_defined
 #endif
 
 __BEGIN_DECLS
 
 /* Generates key for System V style IPC.  */
-extern key_t ftok __P ((__const char *__pathname, int __proj_id));
+extern key_t ftok (__const char *__pathname, int __proj_id) __THROW;
 
 __END_DECLS
 

+ 8 - 8
include/sys/kd.h

@@ -2,19 +2,19 @@
    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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_KD_H
 #define _SYS_KD_H	1

+ 10 - 10
include/sys/kdaemon.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /* Interfaces to control the various kernel daemons.  */
 
@@ -26,7 +26,7 @@
 __BEGIN_DECLS
 
 /* Start, flush, or tune the kernel's buffer flushing daemon.  */
-extern int bdflush __P ((int __func, long int __data));
+extern int bdflush (int __func, long int __data) __THROW;
 
 __END_DECLS
 

+ 10 - 10
include/sys/klog.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_SYS_KLOG_H
 
@@ -27,7 +27,7 @@ __BEGIN_DECLS
    the kernel's syslog system call, but that name is easily confused
    with the user-level syslog facility, which is something completely
    different.  */
-extern int klogctl __P ((int __type, char *__bufp, int __len));
+extern int klogctl (int __type, char *__bufp, int __len) __THROW;
 
 __END_DECLS
 

+ 120 - 20
include/sys/mman.h

@@ -1,39 +1,139 @@
-#ifndef _SYS_MMAN_H
-#define _SYS_MMAN_H
+/* Definitions for BSD-style memory management.
+   Copyright (C) 1994-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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_SYS_MMAN_H
+#define	_SYS_MMAN_H	1
 
 #include <features.h>
 #include <bits/types.h>
 #define __need_size_t
 #include <stddef.h>
-#include <bits/mman.h>
 
-#ifndef MAP_ANON
-#define MAP_ANON	MAP_ANONYMOUS	   /* idem */
+#ifndef __off_t_defined
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+# define __off_t_defined
 #endif
-#ifndef MAP_FILE
-#define MAP_FILE	0x00	   /* The 'normal' way: mapped from file */
+
+#ifndef __mode_t_defined
+typedef __mode_t mode_t;
+# define __mode_t_defined
 #endif
 
-#define MAP_FAILED     ((__ptr_t) -1) /* Return value of `mmap' in case of an error.  */
+#include <bits/mman.h>
+
+/* Return value of `mmap' in case of an error.  */
+#define MAP_FAILED	((void *) -1)
 
 __BEGIN_DECLS
+/* Map addresses starting near ADDR and extending for LEN bytes.  from
+   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
+   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
+   set in FLAGS, the mapping will be at ADDR exactly (which must be
+   page-aligned); otherwise the system chooses a convenient nearby address.
+   The return value is the actual mapping address chosen or MAP_FAILED
+   for errors (in which case `errno' is set).  A successful `mmap' call
+   deallocates any previous mapping for the affected region.  */
+
+#ifndef __USE_FILE_OFFSET64
+extern void *mmap (void *__addr, size_t __len, int __prot,
+		   int __flags, int __fd, __off_t __offset) __THROW;
+#else
+# ifdef __REDIRECT
+extern void * __REDIRECT (mmap,
+			  (void *__addr, size_t __len, int __prot,
+			   int __flags, int __fd, __off64_t __offset) __THROW,
+			  mmap64);
+# else
+#  define mmap mmap64
+# endif
+#endif
+#ifdef __USE_LARGEFILE64
+extern void *mmap64 (void *__addr, size_t __len, int __prot,
+		     int __flags, int __fd, __off64_t __offset) __THROW;
+#endif
 
-extern __ptr_t mmap __P((__ptr_t __addr, size_t __len,
-		int __prot, int __flags, int __fd, off_t __off));
-extern int munmap __P((__ptr_t __addr, size_t __len));
-extern int mprotect __P ((__const __ptr_t __addr, size_t __len, int __prot));
+/* Deallocate any mapping for the region starting at ADDR and extending LEN
+   bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
+extern int munmap (void *__addr, size_t __len) __THROW;
 
-extern int msync __P((__ptr_t __addr, size_t __len, int __flags));
+/* Change the memory protection of the region starting at ADDR and
+   extending LEN bytes to PROT.  Returns 0 if successful, -1 for errors
+   (and sets errno).  */
+extern int mprotect (void *__addr, size_t __len, int __prot) __THROW;
+
+/* Synchronize the region starting at ADDR and extending LEN bytes with the
+   file it maps.  Filesystem operations on a file being mapped are
+   unpredictable before this is done.  Flags are from the MS_* set.  */
+extern int msync (void *__addr, size_t __len, int __flags) __THROW;
+
+#ifdef __USE_BSD
+/* Advise the system about particular usage patterns the program follows
+   for the region starting at ADDR and extending LEN bytes.  */
+extern int madvise (void *__addr, size_t __len, int __advice) __THROW;
+#endif
+#ifdef __USE_XOPEN2K
+/* This is the POSIX name for this function.  */
+extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW;
+#endif
+
+/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
+   be memory resident.  */
+extern int mlock (__const void *__addr, size_t __len) __THROW;
+
+/* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN).  */
+extern int munlock (__const void *__addr, size_t __len) __THROW;
+
+/* Cause all currently mapped pages of the process to be memory resident
+   until unlocked by a call to the `munlockall', until the process exits,
+   or until the process calls `execve'.  */
+extern int mlockall (int __flags) __THROW;
+
+/* All currently mapped pages of the process' address space become
+   unlocked.  */
+extern int munlockall (void) __THROW;
+
+#ifdef __USE_MISC
+/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length
+   NEW_LEN.  If MAY_MOVE is MREMAP_MAYMOVE the returned address may
+   differ from ADDR.  */
+extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
+		     int __may_move) __THROW;
+
+/* mincore returns the memory residency status of the pages in the
+   current process's address space specified by [start, start + len).
+   The status is returned in a vector of bytes.  The least significant
+   bit of each byte is 1 if the referenced page is in memory, otherwise
+   it is zero.  */
+extern int mincore (void *__start, size_t __len, unsigned char *__vec);
+#endif
 
-extern int mlock __P((__const __ptr_t __addr, size_t __len));
-extern int munlock __P((__const __ptr_t __addr, size_t __len));
 
-extern int mlockall __P((int __flags));
-extern int munlockall __P((void));
+/* Open shared memory segment.  */
+extern int shm_open (__const char *__name, int __oflag, mode_t __mode);
 
-extern __ptr_t mremap __P((__ptr_t __addr, size_t __old_len,
-		size_t __new_len, int __may_move));
+/* Remove shared memory segment.  */
+extern int shm_unlink (__const char *__name);
 
 __END_DECLS
 
-#endif /* _SYS_MMAN_H */
+#endif	/* sys/mman.h */

+ 17 - 15
include/sys/mount.h

@@ -1,21 +1,21 @@
 /* Header file for mounting/unmount Linux filesystems.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 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.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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.
+   Lesser 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.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /* This is taken from /usr/include/linux/fs.h.  */
 
@@ -55,8 +55,10 @@ enum
 #define S_IMMUTABLE	S_IMMUTABLE
   MS_NOATIME = 1024,		/* Do not update access times.  */
 #define MS_NOATIME	MS_NOATIME
-  MS_NODIRATIME = 2048		/* Do not update directory access times.  */
+  MS_NODIRATIME = 2048,		/* Do not update directory access times.  */
 #define MS_NODIRATIME	MS_NODIRATIME
+  MS_BIND = 4096,		/* Bind directory at different place.  */
+#define MS_BIND		MS_BIND
 };
 
 /* Flags that can be altered by MS_REMOUNT  */
@@ -93,15 +95,15 @@ enum
 __BEGIN_DECLS
 
 /* Mount a filesystem.  */
-extern int mount __P ((__const char *__special_file, __const char *__dir,
-		       __const char *__fstype, unsigned long int __rwflag,
-		       __const void *__data));
+extern int mount (__const char *__special_file, __const char *__dir,
+		  __const char *__fstype, unsigned long int __rwflag,
+		  __const void *__data) __THROW;
 
 /* Unmount a filesystem.  */
-extern int umount __P ((__const char *__special_file));
+extern int umount (__const char *__special_file) __THROW;
 
 /* Unmount a filesystem.  Force unmounting if FLAGS is set to MNT_FORCE.  */
-extern int umount2 __P ((__const char *__special_file, int __flags));
+extern int umount2 (__const char *__special_file, int __flags) __THROW;
 
 __END_DECLS
 

Vissa filer visades inte eftersom för många filer har ändrats