diff options
Diffstat (limited to 'include')
142 files changed, 8278 insertions, 4321 deletions
diff --git a/include/alloca.h b/include/alloca.h index 741eca743..0dd291f1b 100644 --- a/include/alloca.h +++ b/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) diff --git a/include/ar.h b/include/ar.h index 2b54ecb87..5d157eca9 100644 --- a/include/ar.h +++ b/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 diff --git a/include/arpa/ftp.h b/include/arpa/ftp.h index ac864aa70..e5b340db1 100644 --- a/include/arpa/ftp.h +++ b/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. diff --git a/include/arpa/inet.h b/include/arpa/inet.h index e34c4726a..30af9757d 100644 --- a/include/arpa/inet.h +++ b/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 diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h index 4a8ef67c7..6ae1bc61e 100644 --- a/include/arpa/nameser.h +++ b/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_ */ diff --git a/include/arpa/telnet.h b/include/arpa/telnet.h index 3309e5d72..3774c8928 100644 --- a/include/arpa/telnet.h +++ b/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. diff --git a/include/arpa/tftp.h b/include/arpa/tftp.h index 69187da08..21b0559e5 100644 --- a/include/arpa/tftp.h +++ b/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. diff --git a/include/assert.h b/include/assert.h index 2612534cd..15a5bfe12 100644 --- a/include/assert.h +++ b/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> diff --git a/include/cfgfile.h b/include/cfgfile.h deleted file mode 100644 index 3e26f9c4c..000000000 --- a/include/cfgfile.h +++ /dev/null @@ -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__ */ diff --git a/include/cpio.h b/include/cpio.h index 0364e8af8..a2fefab51 100644 --- a/include/cpio.h +++ b/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 diff --git a/include/crypt.h b/include/crypt.h index 6c7f6c85d..a35d8c0bd 100644 --- a/include/crypt.h +++ b/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. * */ diff --git a/include/ctype.h b/include/ctype.h index 546d032f9..81f09bebe 100644 --- a/include/ctype.h +++ b/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 diff --git a/include/dirent.h b/include/dirent.h index 519373a55..8079d7097 100644 --- a/include/dirent.h +++ b/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. */ diff --git a/include/dlfcn.h b/include/dlfcn.h index 998350baa..3fe4d0266 100644 --- a/include/dlfcn.h +++ b/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 diff --git a/include/elf.h b/include/elf.h index 0644fd753..da82d591f 100644 --- a/include/elf.h +++ b/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 diff --git a/include/endian.h b/include/endian.h index 109678aea..2f7bce100 100644 --- a/include/endian.h +++ b/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 */ diff --git a/include/err.h b/include/err.h index 5bd51ea0d..9791a659c 100644 --- a/include/err.h +++ b/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 */ diff --git a/include/errno.h b/include/errno.h index aa7e6bcae..645a439db 100644 --- a/include/errno.h +++ b/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 diff --git a/include/fcntl.h b/include/fcntl.h index 744f5ae4f..951fd8016 100644 --- a/include/fcntl.h +++ b/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 diff --git a/include/features.h b/include/features.h index f86788fa4..05afff6d8 100644 --- a/include/features.h +++ b/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 */ diff --git a/include/fnmatch.h b/include/fnmatch.h index c89d0ee4b..c0fd6a920 100644 --- a/include/fnmatch.h +++ b/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 */ diff --git a/include/fstab.h b/include/fstab.h index 274f23aae..24ecad7db 100644 --- a/include/fstab.h +++ b/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 diff --git a/include/getopt.h b/include/getopt.h index 725d9cbd4..a1b8dd665 100644 --- a/include/getopt.h +++ b/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 */ diff --git a/include/glob.h b/include/glob.h index c4ad24f17..6bb7c7e8c 100644 --- a/include/glob.h +++ b/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 diff --git a/include/gnu-versions.h b/include/gnu-versions.h index f642f6aee..59e617c4b 100644 --- a/include/gnu-versions.h +++ b/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 */ diff --git a/include/grp.h b/include/grp.h index c0db17e44..33247718a 100644 --- a/include/grp.h +++ b/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 */ diff --git a/include/langinfo.h b/include/langinfo.h index 3844db2e4..21d16cd90 100644 --- a/include/langinfo.h +++ b/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. */ diff --git a/include/limits.h b/include/limits.h index 39ff69778..45cd6f253 100644 --- a/include/limits.h +++ b/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 diff --git a/include/link.h b/include/link.h index 4680dd914..f8e7f629d 100644 --- a/include/link.h +++ b/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 */ diff --git a/include/locale.h b/include/locale.h index 00e75d5b5..b3736dd11 100644 --- a/include/locale.h +++ b/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 diff --git a/include/malloc.h b/include/malloc.h index 7ef63d8c7..8accd6469 100644 --- a/include/malloc.h +++ b/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 */ diff --git a/include/memory.h b/include/memory.h index 3b2f59002..743fa6a95 100644 --- a/include/memory.h +++ b/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 */ diff --git a/include/mntent.h b/include/mntent.h index b4c6a8f2d..a82e9539a 100644 --- a/include/mntent.h +++ b/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 */ diff --git a/include/net/ethernet.h b/include/net/ethernet.h index c8093bc5a..ae7b78460 100644 --- a/include/net/ethernet.h +++ b/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. */ diff --git a/include/net/if.h b/include/net/if.h index 3591dded7..b10245f45 100644 --- a/include/net/if.h +++ b/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 diff --git a/include/net/if_arp.h b/include/net/if_arp.h index 2fa9baedd..d6a366459 100644 --- a/include/net/if_arp.h +++ b/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 diff --git a/include/net/if_packet.h b/include/net/if_packet.h index 441cad175..e5184e7f1 100644 --- a/include/net/if_packet.h +++ b/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 diff --git a/include/net/if_shaper.h b/include/net/if_shaper.h index 94d7cd405..7060af31e 100644 --- a/include/net/if_shaper.h +++ b/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 diff --git a/include/net/if_slip.h b/include/net/if_slip.h index 4686bc5da..66bd7f30a 100644 --- a/include/net/if_slip.h +++ b/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 diff --git a/include/net/pppio.h b/include/net/pppio.h index 3f552d8f0..1b163f811 100644 --- a/include/net/pppio.h +++ b/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)) diff --git a/include/net/route.h b/include/net/route.h index 6cccbeee2..fc72c7efb 100644 --- a/include/net/route.h +++ b/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. */ diff --git a/include/net/slcompress.h b/include/net/slcompress.h index fc3b000a9..bb494c4ff 100644 --- a/include/net/slcompress.h +++ b/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_ */ diff --git a/include/net/vjcompress.h b/include/net/vjcompress.h index c792fe5e7..c70dda3d0 100644 --- a/include/net/vjcompress.h +++ b/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_ */ diff --git a/include/netdb.h b/include/netdb.h index 84191b68d..aea6e0050 100644 --- a/include/netdb.h +++ b/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 */ diff --git a/include/netinet/ether.h b/include/netinet/ether.h index c7985d7ac..ca780e2d0 100644 --- a/include/netinet/ether.h +++ b/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 diff --git a/include/netinet/icmp6.h b/include/netinet/icmp6.h index 5a3863953..4b17d9cd9 100644 --- a/include/netinet/icmp6.h +++ b/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 */ diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h index 7194490f5..aadb59bea 100644 --- a/include/netinet/if_ether.h +++ b/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. diff --git a/include/netinet/if_fddi.h b/include/netinet/if_fddi.h index d5d6dbdbe..1a0ec927d 100644 --- a/include/netinet/if_fddi.h +++ b/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 diff --git a/include/netinet/if_tr.h b/include/netinet/if_tr.h index 3c1be2102..1a7bc68c9 100644 --- a/include/netinet/if_tr.h +++ b/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 diff --git a/include/netinet/igmp.h b/include/netinet/igmp.h index 7a6ed6e8c..a4683bd7f 100644 --- a/include/netinet/igmp.h +++ b/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. diff --git a/include/netinet/in.h b/include/netinet/in.h index b5a5c7275..26be9ea75 100644 --- a/include/netinet/in.h +++ b/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 diff --git a/include/netinet/in_systm.h b/include/netinet/in_systm.h index 902fe6ea0..51a08e176 100644 --- a/include/netinet/in_systm.h +++ b/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 diff --git a/include/netinet/ip.h b/include/netinet/ip.h index 246a56a5d..fc9144052 100644 --- a/include/netinet/ip.h +++ b/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. diff --git a/include/netinet/ip6.h b/include/netinet/ip6.h index cd42ef64b..c6fc2b31c 100644 --- a/include/netinet/ip6.h +++ b/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 */ diff --git a/include/netinet/ip_icmp.h b/include/netinet/ip_icmp.h index be7959ee7..2fc8e9c1c 100644 --- a/include/netinet/ip_icmp.h +++ b/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. diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h index 36976369e..87099ec14 100644 --- a/include/netinet/tcp.h +++ b/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 */ diff --git a/include/netinet/udp.h b/include/netinet/udp.h index 9ee66f0fc..5be4bbd3e 100644 --- a/include/netinet/udp.h +++ b/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. diff --git a/include/nl_types.h b/include/nl_types.h index 2fa7d7f64..9322aa246 100644 --- a/include/nl_types.h +++ b/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 diff --git a/include/paths.h b/include/paths.h index 95b63c58b..2f7cc6dad 100644 --- a/include/paths.h +++ b/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_ */ diff --git a/include/pty.h b/include/pty.h index 7c64359d2..2d4b5e270 100644 --- a/include/pty.h +++ b/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 diff --git a/include/pwd.h b/include/pwd.h index 3377afd88..8a54578b8 100644 --- a/include/pwd.h +++ b/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 */ - - - diff --git a/include/regex.h b/include/regex.h index 113a32e72..b9c2d97cc 100644 --- a/include/regex.h +++ b/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)); diff --git a/include/regexp.h b/include/regexp.h index fc60d3ca5..bb1c4017f 100644 --- a/include/regexp.h +++ b/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 diff --git a/include/resolv.h b/include/resolv.h index 9ac45959a..bb8c78293 100644 --- a/include/resolv.h +++ b/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_ */ diff --git a/include/rpc/auth.h b/include/rpc/auth.h index e0e1e5f67..661295766 100644 --- a/include/rpc/auth.h +++ b/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 diff --git a/include/rpc/auth_des.h b/include/rpc/auth_des.h index b94bafb67..12ada8404 100644 --- a/include/rpc/auth_des.h +++ b/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 diff --git a/include/rpc/auth_unix.h b/include/rpc/auth_unix.h index ed3b9322c..424661d9c 100644 --- a/include/rpc/auth_unix.h +++ b/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, diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h index b3852927a..a19fc773b 100644 --- a/include/rpc/clnt.h +++ b/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 */ diff --git a/include/rpc/des_crypt.h b/include/rpc/des_crypt.h index e20cc3824..6a65887d3 100644 --- a/include/rpc/des_crypt.h +++ b/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 diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h index 6b820c84d..539d8c326 100644 --- a/include/rpc/netdb.h +++ b/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 diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h index d9800d400..1b1c45291 100644 --- a/include/rpc/pmap_clnt.h +++ b/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 diff --git a/include/rpc/pmap_prot.h b/include/rpc/pmap_prot.h index 52185d319..cd64e36de 100644 --- a/include/rpc/pmap_prot.h +++ b/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 diff --git a/include/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h index bb35ad63e..7a38b5f5f 100644 --- a/include/rpc/pmap_rmt.h +++ b/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 diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h index 74e529d82..e7799ccb1 100644 --- a/include/rpc/rpc.h +++ b/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 */ diff --git a/include/rpc/rpc_msg.h b/include/rpc/rpc_msg.h index e2908ac9c..636d60ea9 100644 --- a/include/rpc/rpc_msg.h +++ b/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 diff --git a/include/rpc/svc.h b/include/rpc/svc.h index 4ac2a5cdf..3ffca50bd 100644 --- a/include/rpc/svc.h +++ b/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 diff --git a/include/rpc/svc_auth.h b/include/rpc/svc_auth.h index ad08b71c7..1c1a7156a 100644 --- a/include/rpc/svc_auth.h +++ b/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 diff --git a/include/rpc/types.h b/include/rpc/types.h index 61ea3c19f..8eff8e718 100644 --- a/include/rpc/types.h +++ b/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> diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index 91dbcc3da..0b703445a 100644 --- a/include/rpc/xdr.h +++ b/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 diff --git a/include/search.h b/include/search.h index fa3e5c083..2ffba697b 100644 --- a/include/search.h +++ b/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 diff --git a/include/setjmp.h b/include/setjmp.h index 33bcfc539..99e3dc8cd 100644 --- a/include/setjmp.h +++ b/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 diff --git a/include/signal.h b/include/signal.h index c94d8bfda..f217349d0 100644 --- a/include/signal.h +++ b/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 diff --git a/include/stdarg.h b/include/stdarg.h deleted file mode 100644 index 24f338319..000000000 --- a/include/stdarg.h +++ /dev/null @@ -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 */ diff --git a/include/stdint.h b/include/stdint.h index af73866e3..d254dcabb 100644 --- a/include/stdint.h +++ b/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 diff --git a/include/stdio.h b/include/stdio.h index 25912ebaf..def468794 100644 --- a/include/stdio.h +++ b/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 */ diff --git a/include/stdlib.h b/include/stdlib.h index 28119c6aa..ac5bf3973 100644 --- a/include/stdlib.h +++ b/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 */ diff --git a/include/string.h b/include/string.h index 4191f7ba1..3c03c7cee 100644 --- a/include/string.h +++ b/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 */ diff --git a/include/strings.h b/include/strings.h index 3b2f59002..3ba2b04c8 100644 --- a/include/strings.h +++ b/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 */ diff --git a/include/sys/bitypes.h b/include/sys/bitypes.h index 21aaf7436..3a9860f71 100644 --- a/include/sys/bitypes.h +++ b/include/sys/bitypes.h @@ -1 +1,3 @@ -#include <stddef.h> +/* The GNU <sys/types.h> defines all the necessary types. */ + +#include <sys/types.h> diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index 7df9f1e52..02454ee4d 100644 --- a/include/sys/cdefs.h +++ b/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 */ diff --git a/include/sys/dir.h b/include/sys/dir.h index 96b36c78d..2611d6cd9 100644 --- a/include/sys/dir.h +++ b/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 diff --git a/include/sys/file.h b/include/sys/file.h index 2401b155a..93b36350a 100644 --- a/include/sys/file.h +++ b/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 */ diff --git a/include/sys/io.h b/include/sys/io.h index 9ce921365..9ea033a01 100644 --- a/include/sys/io.h +++ b/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 diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h index acb42f2b3..6d8a0f40b 100644 --- a/include/sys/ioctl.h +++ b/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 diff --git a/include/sys/ipc.h b/include/sys/ipc.h index f1ba7ff18..42806db2b 100644 --- a/include/sys/ipc.h +++ b/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 diff --git a/include/sys/kd.h b/include/sys/kd.h index b37586abf..e0d2e869c 100644 --- a/include/sys/kd.h +++ b/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 diff --git a/include/sys/kdaemon.h b/include/sys/kdaemon.h index d59fe2bc3..61491f93d 100644 --- a/include/sys/kdaemon.h +++ b/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 diff --git a/include/sys/klog.h b/include/sys/klog.h index 62243e9ec..35f5fe40e 100644 --- a/include/sys/klog.h +++ b/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 diff --git a/include/sys/mman.h b/include/sys/mman.h index 68445bbb1..c0dd39e32 100644 --- a/include/sys/mman.h +++ b/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 */ diff --git a/include/sys/mount.h b/include/sys/mount.h index 862c1f040..f768d4dc7 100644 --- a/include/sys/mount.h +++ b/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 diff --git a/include/sys/msg.h b/include/sys/msg.h index cba58b364..9568baf89 100644 --- a/include/sys/msg.h +++ b/include/sys/msg.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_MSG_H #define _SYS_MSG_H @@ -57,18 +57,18 @@ struct msgbuf __BEGIN_DECLS /* Message queue control operation. */ -extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf); +extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; /* Get messages queue. */ -extern int msgget (key_t __key, int __msgflg); +extern int msgget (key_t __key, int __msgflg) __THROW; /* Receive message from message queue. */ extern int msgrcv (int __msqid, void *__msgp, size_t __msgsz, - long int __msgtyp, int __msgflg); + long int __msgtyp, int __msgflg) __THROW; /* Send message to message queue. */ extern int msgsnd (int __msqid, __const void *__msgp, size_t __msgsz, - int __msgflg); + int __msgflg) __THROW; __END_DECLS diff --git a/include/sys/mtio.h b/include/sys/mtio.h index 7498dfa78..51fa550cd 100644 --- a/include/sys/mtio.h +++ b/include/sys/mtio.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. */ /* Written by H. Bergman <hennus@cybercomm.nl>. */ diff --git a/include/sys/param.h b/include/sys/param.h index c59222cd4..d64f4b9a9 100644 --- a/include/sys/param.h +++ b/include/sys/param.h @@ -1,49 +1,66 @@ -/* Copyright (C) 1996 Robert de Bath <rdebath@cix.compulink.co.uk> - * This file is part of the Linux-8086 C library and is distributed - * under the GNU Library General Public License. - */ +/* Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. -#ifndef _PARAM_H -#define _PARAM_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. + + 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_PARAM_H +#define _SYS_PARAM_H 1 -#include <features.h> #include <limits.h> #include <linux/limits.h> -#include <asm/param.h> - -#include <sys/types.h> +#include <linux/param.h> -#define MAXPATHLEN PATH_MAX +/* BSD names for some <limits.h> values. */ -#ifndef NR_OPEN -#define NR_OPEN 32 -#endif -#ifndef NR_FILE -#define NR_FILE 32 +#define NBBY CHAR_BIT +#ifndef NGROUPS +# define NGROUPS NGROUPS_MAX #endif +#define MAXSYMLINKS 20 +#define CANBSIZ MAX_CANON +#define NCARGS ARG_MAX +#define MAXPATHLEN PATH_MAX +/* The following is not really correct but it is a value we used for a + long time and which seems to be usable. People should not use NOFILE + anyway. */ +#define NOFILE 256 + -/* Number of Bits per BYte */ -#define NBBY CHAR_BIT +#include <sys/types.h> /* Bit map related macros. */ -#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) +#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) +#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) +#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) /* Macros for counting and rounding. */ #ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) +# define howmany(x, y) (((x)+((y)-1))/(y)) #endif -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -#define powerof2(x) ((((x)-1)&(x))==0) +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#define powerof2(x) ((((x)-1)&(x))==0) /* Macros for min/max. */ -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MAX(a,b) (((a)>(b))?(a):(b)) /* Unit of `st_blocks'. */ -#define DEV_BSIZE 512 +#define DEV_BSIZE 512 + -#endif /* _PARAM_H */ +#endif /* sys/param.h */ diff --git a/include/sys/poll.h b/include/sys/poll.h index 9cb60e72e..bf1c9e203 100644 --- a/include/sys/poll.h +++ b/include/sys/poll.h @@ -1,21 +1,21 @@ /* Compatibility definitions for System V `poll' interface. - Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1994,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. */ #ifndef _SYS_POLL_H #define _SYS_POLL_H 1 @@ -25,7 +25,9 @@ /* Get the platform dependent bits of `poll'. */ #include <bits/poll.h> -__BEGIN_DECLS + +/* Type used for the number of file descriptors. */ +typedef unsigned long int nfds_t; /* Data structure describing a polling request. */ struct pollfd @@ -36,15 +38,14 @@ struct pollfd }; +__BEGIN_DECLS + /* Poll the file descriptors described by the NFDS structures starting at FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for an event to occur; if TIMEOUT is -1, block until an event occurs. Returns the number of file descriptors with events, zero if timed out, or -1 for errors. */ -extern int __poll __P ((struct pollfd *__fds, unsigned long int __nfds, - int __timeout)); -extern int poll __P ((struct pollfd *__fds, unsigned long int __nfds, - int __timeout)); +extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) __THROW; __END_DECLS diff --git a/include/sys/procfs.h b/include/sys/procfs.h new file mode 100644 index 000000000..3b3736324 --- /dev/null +++ b/include/sys/procfs.h @@ -0,0 +1,123 @@ +/* Copyright (C) 1996, 1997, 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 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_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somewhat modelled after the file of the same name on SVR4 + systems. It provides a definition of the core file format for ELF + used on Linux. It doesn't have anything to do with the /proc file + system, even though Linux has one. + + Anyway, the whole purpose of this file is for GDB and GDB only. + Don't read too much into it. Don't use it for anything other than + GDB unless you know what you are doing. */ + +#include <features.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/user.h> + +__BEGIN_DECLS + +/* Type for a general-purpose register. */ +typedef unsigned long elf_greg_t; + +/* And the whole bunch of them. We could have used `struct + user_regs' directly in the typedef, but tradition says that + the register set is an array, which does have some peculiar + semantics, so leave it that way. */ +#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t)) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +/* Register set for the floating-point registers. */ +typedef struct user_fpregs elf_fpregset_t; + +/* Signal info. */ +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with Linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + GDB doesn't really use excluded. */ + +struct elf_prstatus + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args. */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + unsigned short int pr_uid; + unsigned short int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + +/* The rest of this file provides the types for emulation of the + Solaris <proc_service.h> interfaces that should be implemented by + users of libthread_db. */ + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_fpregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore have only one PID type. */ +typedef __pid_t lwpid_t; + +/* Process status and info. In the end we do provide typedefs for them. */ +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff --git a/include/sys/ptrace.h b/include/sys/ptrace.h index 5b670668b..b4aec4f20 100644 --- a/include/sys/ptrace.h +++ b/include/sys/ptrace.h @@ -1,21 +1,21 @@ /* `ptrace' debugger support interface. Linux version. - 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. */ #ifndef _SYS_PTRACE_H #define _SYS_PTRACE_H 1 @@ -98,9 +98,19 @@ enum __ptrace_request PTRACE_DETACH = 17, #define PT_DETACH PTRACE_DETACH + /* Get all extended floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETFPXREGS = 18, +#define PT_GETFPXREGS PTRACE_GETFPXREGS + + /* Set all extended floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETFPXREGS = 19, +#define PT_SETFPXREGS PTRACE_SETFPXREGS + /* Continue and stop at the next (return from) syscall. */ PTRACE_SYSCALL = 24 -#define PTRACE_SYSCALL PTRACE_SYSCALL +#define PT_SYSCALL PTRACE_SYSCALL }; /* Perform process tracing functions. REQUEST is one of the values @@ -112,7 +122,7 @@ enum __ptrace_request appear (those that are used for the particular request) as: pid_t PID, void *ADDR, int DATA, void *ADDR2 after REQUEST. */ -extern long int ptrace __P ((enum __ptrace_request __request, ...)); +extern long int ptrace (enum __ptrace_request __request, ...) __THROW; __END_DECLS diff --git a/include/sys/reboot.h b/include/sys/reboot.h index dd7a71b4c..2a719c7a3 100644 --- a/include/sys/reboot.h +++ b/include/sys/reboot.h @@ -1,20 +1,20 @@ -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - 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 file should define RB_* macros to be used as flag bits in the argument to the `reboot' system call. */ @@ -42,7 +42,7 @@ __BEGIN_DECLS /* Reboot or halt the system. */ -extern int reboot __P ((int __howto)); +extern int reboot (int __howto) __THROW; __END_DECLS diff --git a/include/sys/resource.h b/include/sys/resource.h index 77a5f697a..e64a08672 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -2,25 +2,24 @@ 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_RESOURCE_H #define _SYS_RESOURCE_H 1 #include <features.h> -#include <sys/types.h> /* Get the system-dependent definitions of structures and bit values. */ #include <bits/resource.h> @@ -50,11 +49,11 @@ typedef int __priority_which_t; Returns 0 if successful, -1 if not (and sets errno). */ #ifndef __USE_FILE_OFFSET64 extern int getrlimit (__rlimit_resource_t __resource, - struct rlimit *__rlimits); + struct rlimit *__rlimits) __THROW; #else # ifdef __REDIRECT extern int __REDIRECT (getrlimit, (__rlimit_resource_t __resource, - struct rlimit *__rlimits) , + struct rlimit *__rlimits) __THROW, getrlimit64); # else # define getrlimit getrlimit64 @@ -62,7 +61,7 @@ extern int __REDIRECT (getrlimit, (__rlimit_resource_t __resource, #endif #ifdef __USE_LARGEFILE64 extern int getrlimit64 (__rlimit_resource_t __resource, - struct rlimit64 *__rlimits); + struct rlimit64 *__rlimits) __THROW; #endif /* Set the soft and hard limits for RESOURCE to *RLIMITS. @@ -70,11 +69,11 @@ extern int getrlimit64 (__rlimit_resource_t __resource, Return 0 if successful, -1 if not (and sets errno). */ #ifndef __USE_FILE_OFFSET64 extern int setrlimit (__rlimit_resource_t __resource, - __const struct rlimit *__rlimits); + __const struct rlimit *__rlimits) __THROW; #else # ifdef __REDIRECT extern int __REDIRECT (setrlimit, (__rlimit_resource_t __resource, - __const struct rlimit *__rlimits) , + __const struct rlimit *__rlimits) __THROW, setrlimit64); # else # define setrlimit setrlimit64 @@ -82,22 +81,23 @@ extern int __REDIRECT (setrlimit, (__rlimit_resource_t __resource, #endif #ifdef __USE_LARGEFILE64 extern int setrlimit64 (__rlimit_resource_t __resource, - __const struct rlimit64 *__rlimits); + __const struct rlimit64 *__rlimits) __THROW; #endif /* Return resource usage information on process indicated by WHO and put it in *USAGE. Returns 0 for success, -1 for failure. */ -extern int getrusage (__rusage_who_t __who, struct rusage *__usage); +extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; /* Return the highest priority of any process specified by WHICH and WHO (see above); if WHO is zero, the current process, process group, or user (as specified by WHO) is used. A lower priority number means higher priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */ -extern int getpriority (__priority_which_t __which, id_t __who); +extern int getpriority (__priority_which_t __which, id_t __who) __THROW; /* Set the priority of all processes specified by WHICH and WHO (see above) to PRIO. Returns 0 on success, -1 on errors. */ -extern int setpriority (__priority_which_t __which, id_t __who, int __prio); +extern int setpriority (__priority_which_t __which, id_t __who, int __prio) + __THROW; __END_DECLS diff --git a/include/sys/select.h b/include/sys/select.h index 0972560b9..8f03c73e9 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -1,21 +1,21 @@ /* `fd_set' type and related macros, and `select'/`pselect' declarations. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + 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 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 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h> */ @@ -33,61 +33,80 @@ /* Get __sigset_t. */ #include <bits/sigset.h> +#ifndef __sigset_t_defined +# define __sigset_t_defined +typedef __sigset_t sigset_t; +#endif + /* Get definition of timer specification structures. */ #define __need_timespec #include <time.h> - -__BEGIN_DECLS - -/* This declaration puts `struct timeval' in global scope even if - <sys/time.h> has not been included to define it. That way the - `select' prototype below will not conflict with a later definition - of `struct timeval'. */ -struct timeval; - -typedef __fd_mask fd_mask; - -/* Representation of a set of file descriptors. */ -typedef __fd_set fd_set; +#define __need_timeval +#include <bits/time.h> + + +/* The fd_set member is required to be an array of longs. */ +typedef long int __fd_mask; + +/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ +#define __NFDBITS (8 * sizeof (__fd_mask)) +#define __FDELT(d) ((d) / __NFDBITS) +#define __FDMASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS)) + +/* fd_set for select and pselect. */ +typedef struct + { + /* XPG4.2 requires this member name. Otherwise avoid the name + from the global namespace. */ +#ifdef __USE_XOPEN + __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; +# define __FDS_BITS(set) ((set)->fds_bits) +#else + __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; +# define __FDS_BITS(set) ((set)->__fds_bits) +#endif + } fd_set; /* Maximum number of file descriptors in `fd_set'. */ #define FD_SETSIZE __FD_SETSIZE #ifdef __USE_MISC +/* Sometimes the fd_set member is assumed to have this type. */ +typedef __fd_mask fd_mask; + /* Number of bits per word of `fd_set' (some code assumes this is 32). */ # define NFDBITS __NFDBITS #endif /* Access macros for `fd_set'. */ -#define FD_SET(fd, fdsetp) __FD_SET ((fd), (fdsetp)) -#define FD_CLR(fd, fdsetp) __FD_CLR ((fd), (fdsetp)) -#define FD_ISSET(fd, fdsetp) __FD_ISSET ((fd), (fdsetp)) +#define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp) +#define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp) +#define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp) #define FD_ZERO(fdsetp) __FD_ZERO (fdsetp) +__BEGIN_DECLS + /* Check the first NFDS descriptors each in READFDS (if not NULL) for read readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out after waiting the interval specified therein. Returns the number of ready descriptors, or -1 for errors. */ -extern int __select __P ((int __nfds, __fd_set *__readfds, - __fd_set *__writefds, __fd_set *__exceptfds, - struct timeval *__timeout)); -extern int select __P ((int __nfds, __fd_set *__readfds, - __fd_set *__writefds, __fd_set *__exceptfds, - struct timeval *__timeout)); - -#ifdef __USE_GNU -/* XXX Once/if POSIX.1g gets official this prototype will be available - when defining __USE_POSIX. */ +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout) __THROW; + +#ifdef __USE_XOPEN2K /* Same as above only that the TIMEOUT value is given with higher resolution and a sigmask which is been set temporarily. This version should be used. */ -extern int pselect __P ((int __nfds, __fd_set *__readfds, - __fd_set *__writefds, __fd_set *__exceptfds, - const struct timespec *__timeout, - const __sigset_t *__sigmask)); +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask) __THROW; #endif __END_DECLS diff --git a/include/sys/sem.h b/include/sys/sem.h index 6ae76e234..5b1d38f52 100644 --- a/include/sys/sem.h +++ b/include/sys/sem.h @@ -1,27 +1,28 @@ -/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1995-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. */ #ifndef _SYS_SEM_H #define _SYS_SEM_H 1 #include <features.h> -#include <sys/types.h> +#define __need_size_t +#include <stddef.h> /* Get common definition of System V style IPC. */ #include <sys/ipc.h> @@ -35,7 +36,7 @@ /* Structure used for argument to `semop' to describe operations. */ struct sembuf { - short int sem_num; /* semaphore number */ + unsigned short int sem_num; /* semaphore number */ short int sem_op; /* semaphore operation */ short int sem_flg; /* operation flag */ }; @@ -44,14 +45,13 @@ struct sembuf __BEGIN_DECLS /* Semaphore control operation. */ -extern int semctl __P ((int __semid, int __semnum, int __cmd, ...)); +extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; /* Get semaphore. */ -extern int semget __P ((key_t __key, int __nsems, int __semflg)); +extern int semget (key_t __key, int __nsems, int __semflg) __THROW; /* Operate on semaphore. */ -extern int semop __P ((int __semid, struct sembuf *__sops, - unsigned int __nsops)); +extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW; __END_DECLS diff --git a/include/sys/shm.h b/include/sys/shm.h index 09e21d60e..1ef669ba4 100644 --- a/include/sys/shm.h +++ b/include/sys/shm.h @@ -1,28 +1,28 @@ -/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1995-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. */ #ifndef _SYS_SHM_H #define _SYS_SHM_H 1 #include <features.h> -#include <unistd.h> /* for `getpagesize' declaration */ -#include <sys/types.h> +#define __need_size_t +#include <stddef.h> /* Get common definition of System V style IPC. */ #include <sys/ipc.h> @@ -30,26 +30,39 @@ /* Get system dependent definition of `struct shmid_ds' and more. */ #include <bits/shm.h> +/* Define types required by the standard. */ +#define __need_time_t +#include <time.h> + +#ifdef __USE_XOPEN +# ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +# endif +#endif /* X/Open */ + +__BEGIN_DECLS /* Segment low boundary address multiple. */ -#define SHMLBA (getpagesize ()) +#define SHMLBA (__getpagesize ()) +extern int __getpagesize (void) __THROW __attribute__ ((__const__)); + /* The following System V style IPC functions implement a shared memory facility. The definition is found in XPG4.2. */ -__BEGIN_DECLS - /* Shared memory control operation. */ -extern int shmctl __P ((int __shmid, int __cmd, struct shmid_ds *__buf)); +extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; /* Get shared memory segment. */ -extern int shmget __P ((key_t __key, size_t __size, int __shmflg)); +extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW; /* Attach shared memory segment. */ -extern void *shmat __P ((int __shmid, __const void *__shmaddr, int __shmflg)); +extern void *shmat (int __shmid, __const void *__shmaddr, int __shmflg) + __THROW; /* Detach shared memory segment. */ -extern int shmdt __P ((__const void *__shmaddr)); +extern int shmdt (__const void *__shmaddr) __THROW; __END_DECLS diff --git a/include/sys/socket.h b/include/sys/socket.h index dccf0e3f0..b57b63349 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.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 _SYS_SOCKET_H #define _SYS_SOCKET_H 1 @@ -97,50 +97,50 @@ typedef union { __SOCKADDR_ALLTYPES /* Create a new socket of type TYPE in domain DOMAIN, using protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. Returns a file descriptor for the new socket, or -1 for errors. */ -extern int socket (int __domain, int __type, int __protocol) ; +extern int socket (int __domain, int __type, int __protocol) __THROW; /* Create two new sockets, of type TYPE in domain DOMAIN and using protocol PROTOCOL, which are connected to each other, and put file descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero, one will be chosen automatically. Returns 0 on success, -1 for errors. */ extern int socketpair (int __domain, int __type, int __protocol, - int __fds[2]) ; + int __fds[2]) __THROW; /* Give the socket FD the local address ADDR (which is LEN bytes long). */ extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) - ; + __THROW; /* Put the local address of FD into *ADDR and its length in *LEN. */ extern int getsockname (int __fd, __SOCKADDR_ARG __addr, - socklen_t *__restrict __len) ; + socklen_t *__restrict __len) __THROW; /* Open a connection on socket FD to peer at ADDR (which LEN bytes long). For connectionless socket types, just set the default address to send to and the only address from which to accept transmissions. Return 0 on success, -1 for errors. */ extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) - ; + __THROW; /* Put the address of the peer connected to socket FD into *ADDR (which is *LEN bytes long), and its actual length into *LEN. */ extern int getpeername (int __fd, __SOCKADDR_ARG __addr, - socklen_t *__restrict __len) ; + socklen_t *__restrict __len) __THROW; /* Send N bytes of BUF to socket FD. Returns the number sent or -1. */ extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags) - ; + __THROW; /* Read N bytes into BUF from socket FD. Returns the number read or -1 for errors. */ extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags) - ; + __THROW; /* Send N bytes of BUF on socket FD to peer at address ADDR (which is ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */ extern ssize_t sendto (int __fd, __const void *__buf, size_t __n, int __flags, __CONST_SOCKADDR_ARG __addr, - socklen_t __addr_len) ; + socklen_t __addr_len) __THROW; /* Read N bytes into BUF through socket FD. If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of @@ -148,18 +148,18 @@ extern ssize_t sendto (int __fd, __const void *__buf, size_t __n, Returns the number of bytes read or -1 for errors. */ extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) - ; + __THROW; /* Send a message described MESSAGE on socket FD. Returns the number of bytes sent, or -1 for errors. */ extern ssize_t sendmsg (int __fd, __const struct msghdr *__message, int __flags) - ; + __THROW; /* Receive a message as described by MESSAGE from socket FD. Returns the number of bytes read or -1 for errors. */ extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags) - ; + __THROW; /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL @@ -167,19 +167,19 @@ extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags) actual length. Returns 0 on success, -1 for errors. */ extern int getsockopt (int __fd, int __level, int __optname, void *__restrict __optval, - socklen_t *__restrict __optlen) ; + socklen_t *__restrict __optlen) __THROW; /* Set socket FD's option OPTNAME at protocol level LEVEL to *OPTVAL (which is OPTLEN bytes long). Returns 0 on success, -1 for errors. */ extern int setsockopt (int __fd, int __level, int __optname, - __const void *__optval, socklen_t __optlen) ; + __const void *__optval, socklen_t __optlen) __THROW; /* Prepare to accept connections on socket FD. N connection requests will be queued before further requests are refused. Returns 0 on success, -1 for errors. */ -extern int listen (int __fd, int __n) ; +extern int listen (int __fd, int __n) __THROW; /* Await a connection on socket FD. When a connection arrives, open a new socket to communicate with it, @@ -188,7 +188,7 @@ extern int listen (int __fd, int __n) ; new socket's descriptor, or -1 for errors. */ extern int accept (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) - ; + __THROW; /* Shut down all or part of the connection open on socket FD. HOW determines what to shut down: @@ -196,14 +196,20 @@ extern int accept (int __fd, __SOCKADDR_ARG __addr, SHUT_WR = No more transmissions; SHUT_RDWR = No more receptions or transmissions. Returns 0 on success, -1 for errors. */ -extern int shutdown (int __fd, int __how) ; +extern int shutdown (int __fd, int __how) __THROW; + + +#ifdef __USE_XOPEN2K +/* Determine wheter socket is at a out-of-band mark. */ +extern int sockatmark (int __fd) __THROW; +#endif #ifdef __USE_MISC /* FDTYPE is S_IFSOCK or another S_IF* macro defined in <sys/stat.h>; returns 1 if FD is open on an object of the indicated type, 0 if not, or -1 for errors (setting errno). */ -extern int isfdtype (int __fd, int __fdtype) ; +extern int isfdtype (int __fd, int __fdtype) __THROW; #endif __END_DECLS diff --git a/include/sys/socketcall.h b/include/sys/socketcall.h deleted file mode 100644 index 2538c672c..000000000 --- a/include/sys/socketcall.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _SYS_SOCKETCALL_H -#define _SYS_SOCKETCALL_H - -#define SYS_SOCKET 1 -#define SYS_BIND 2 -#define SYS_CONNECT 3 -#define SYS_LISTEN 4 -#define SYS_ACCEPT 5 -#define SYS_GETSOCKNAME 6 -#define SYS_GETPEERNAME 7 -#define SYS_SOCKETPAIR 8 -#define SYS_SEND 9 -#define SYS_RECV 10 -#define SYS_SENDTO 11 -#define SYS_RECVFROM 12 -#define SYS_SHUTDOWN 13 -#define SYS_SETSOCKOPT 14 -#define SYS_GETSOCKOPT 15 -#define SYS_SENDMSG 16 -#define SYS_RECVMSG 17 - -#endif /* _SYS_SOCKETCALL_H */ diff --git a/include/sys/stat.h b/include/sys/stat.h index b4e1620df..a2a669277 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 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. */ /* * POSIX Standard: 5.6 File Characteristics <sys/stat.h> @@ -33,54 +33,63 @@ /* The Single Unix specification says that some more types are available here. */ -# ifndef dev_t +# ifndef __dev_t_defined typedef __dev_t dev_t; -# define dev_t dev_t +# define __dev_t_defined # endif -# ifndef gid_t +# ifndef __gid_t_defined typedef __gid_t gid_t; -# define gid_t gid_t +# define __gid_t_defined # endif -# 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 -# ifndef mode_t +# ifndef __mode_t_defined typedef __mode_t mode_t; -# define mode_t mode_t +# define __mode_t_defined # endif -# ifndef nlink_t +# ifndef __nlink_t_defined typedef __nlink_t nlink_t; -# define nlink_t nlink_t +# define __nlink_t_defined # endif -# ifndef off_t +# ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif -# define off_t off_t +# define __off_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 /* X/Open */ #ifdef __USE_UNIX98 -# ifndef pid_t -typedef __pid_t pid_t; -# define pid_t pid_t +# ifndef __blkcnt_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __blkcnt_t blkcnt_t; +# else +typedef __blkcnt64_t blkcnt_t; +# endif +# define __blkcnt_t_defined +# endif + +# ifndef __blksize_t_defined +typedef __blksize_t blksize_t; +# define __blksize_t_defined # endif #endif /* Unix98 */ @@ -97,13 +106,12 @@ __BEGIN_DECLS # ifdef __S_IFIFO # define S_IFIFO __S_IFIFO # endif -# if defined __USE_BSD || defined __USE_MISC -# ifdef __S_IFLNK -# define S_IFLNK __S_IFLNK -# endif -# ifdef __S_IFSOCK -# define S_IFSOCK __S_IFSOCK -# endif +# ifdef __S_IFLNK +# define S_IFLNK __S_IFLNK +# endif +# if (defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN2K) \ + && defined __S_IFSOCK +# define S_IFSOCK __S_IFSOCK # endif #endif @@ -118,11 +126,12 @@ __BEGIN_DECLS #ifdef __S_IFIFO # define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO) #endif +#ifdef __S_IFLNK +# define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK) +#endif #ifdef __USE_BSD -# ifdef __S_IFLNK -# define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK) -# else +# ifndef __S_IFLNK # define S_ISLNK(mode) 0 # endif # ifdef __S_IFSOCK @@ -130,13 +139,23 @@ __BEGIN_DECLS # endif #endif +/* These are from POSIX.1b. If the objects are not implemented using separate + distinct file types, the macros always will evaluate to zero. Unlike the + other S_* macros the following three take a pointer to a `struct stat' + object as the argument. */ +#ifdef __USE_POSIX199309 +# define S_TYPEISMQ(buf) __S_TYPEISMQ(buf) +# define S_TYPEISSEM(buf) __S_TYPEISSEM(buf) +# define S_TYPEISSHM(buf) __S_TYPEISSHM(buf) +#endif + /* Protection bits. */ #define S_ISUID __S_ISUID /* Set user ID on execution. */ #define S_ISGID __S_ISGID /* Set group ID on execution. */ -#if defined __USE_BSD || defined __USE_MISC +#if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN /* Save swapped text after use (sticky bit). This is pretty well obsolete. */ # define S_ISVTX __S_ISVTX #endif @@ -178,79 +197,87 @@ __BEGIN_DECLS #ifndef __USE_FILE_OFFSET64 /* Get file attributes for FILE and put them in BUF. */ -extern int stat __P ((__const char *__file, struct stat *__buf)); +extern int stat (__const char *__restrict __file, + struct stat *__restrict __buf) __THROW; /* Get file attributes for the file, device, pipe, or socket that file descriptor FD is open on and put them in BUF. */ -extern int fstat __P ((int __fd, struct stat *__buf)); +extern int fstat (int __fd, struct stat *__buf) __THROW; #else # ifdef __REDIRECT -extern int __REDIRECT (stat, __P ((__const char *__file, struct stat *__buf)), +extern int __REDIRECT (stat, + (__const char *__restrict __file, + struct stat *__restrict __buf) __THROW, stat64); -extern int __REDIRECT (fstat, __P ((int __fd, struct stat *__buf)), fstat64); +extern int __REDIRECT (fstat, (int __fd, struct stat *__buf) __THROW, fstat64); # else # define stat stat64 # define fstat fstat64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int stat64 __P ((__const char *__file, struct stat64 *__buf)); -extern int fstat64 __P ((int __fd, struct stat64 *__buf)); +extern int stat64 (__const char *__restrict __file, + struct stat64 *__restrict __buf) __THROW; +extern int fstat64 (int __fd, struct stat64 *__buf) __THROW; #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED # ifndef __USE_FILE_OFFSET64 /* Get file attributes about FILE and put them in BUF. If FILE is a symbolic link, do not follow it. */ -extern int lstat __P ((__const char *__file, struct stat *__buf)); +extern int lstat (__const char *__restrict __file, + struct stat *__restrict __buf) __THROW; # else # ifdef __REDIRECT -extern int __REDIRECT (lstat, __P ((__const char *__file, struct stat *__buf)), +extern int __REDIRECT (lstat, + (__const char *__restrict __file, + struct stat *__restrict __buf) __THROW, lstat64); # else # define lstat lstat64 # endif # endif # ifdef __USE_LARGEFILE64 -extern int lstat64 __P ((__const char *__file, struct stat64 *__buf)); +extern int lstat64 (__const char *__restrict __file, + struct stat64 *__restrict __buf) __THROW; # endif #endif /* Set file access permissions for FILE to MODE. This takes an `int' MODE argument because that is what `mode_t's get widened to. */ -extern int chmod __P ((__const char *__file, __mode_t __mode)); +extern int chmod (__const char *__file, __mode_t __mode) __THROW; /* Set file access permissions of the file FD is open on to MODE. */ #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED -extern int fchmod __P ((int __fd, __mode_t __mode)); +extern int fchmod (int __fd, __mode_t __mode) __THROW; #endif /* Set the file creation mask of the current process to MASK, and return the old creation mask. */ -extern __mode_t umask __P ((__mode_t __mask)); +extern __mode_t umask (__mode_t __mask) __THROW; #ifdef __USE_GNU /* Get the current `umask' value without changing it. This function is only available under the GNU Hurd. */ -extern __mode_t getumask __P ((void)); +extern __mode_t getumask (void) __THROW; #endif /* Create a new directory named PATH, with permission bits MODE. */ -extern int mkdir __P ((__const char *__path, __mode_t __mode)); +extern int mkdir (__const char *__path, __mode_t __mode) __THROW; /* Create a device file named PATH, with permission and special bits MODE and device number DEV (which can be constructed from major and minor device numbers with the `makedev' macro above). */ #if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED -extern int mknod __P ((__const char *__path, - __mode_t __mode, __dev_t __dev)); +extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev) + __THROW; #endif /* Create a new FIFO named PATH, with permission bits MODE. */ -extern int mkfifo __P ((__const char *__path, __mode_t __mode)); +extern int mkfifo (__const char *__path, __mode_t __mode) __THROW; /* To allow the `struct stat' structure and the file type `mode_t' bits to vary without changing shared library major version number, @@ -276,87 +303,90 @@ extern int mkfifo __P ((__const char *__path, __mode_t __mode)); /* Wrappers for stat and mknod system calls. */ #ifndef __USE_FILE_OFFSET64 -extern int _fxstat __P ((int __ver, int __fildes, - struct stat *__stat_buf)); -extern int _xstat __P ((int __ver, __const char *__filename, - struct stat *__stat_buf)); -extern int _lxstat __P ((int __ver, __const char *__filename, - struct stat *__stat_buf)); +extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) __THROW; +extern int __xstat (int __ver, __const char *__filename, + struct stat *__stat_buf) __THROW; +extern int __lxstat (int __ver, __const char *__filename, + struct stat *__stat_buf) __THROW; #else # ifdef __REDIRECT -extern int __REDIRECT (_fxstat, __P ((int __ver, int __fildes, - struct stat *__stat_buf)), _fxstat64); -extern int __REDIRECT (_xstat, __P ((int __ver, __const char *__filename, - struct stat *__stat_buf)), _xstat64); -extern int __REDIRECT (_lxstat, __P ((int __ver, __const char *__filename, - struct stat *__stat_buf)), _lxstat64); +extern int __REDIRECT (__fxstat, (int __ver, int __fildes, + struct stat *__stat_buf) __THROW, + __fxstat64); +extern int __REDIRECT (__xstat, (int __ver, __const char *__filename, + struct stat *__stat_buf) __THROW, __xstat64); +extern int __REDIRECT (__lxstat, (int __ver, __const char *__filename, + struct stat *__stat_buf) __THROW, + __lxstat64); # else -# define _fxstat _fxstat64 -# define _xstat _xstat64 -# define _lxstat _lxstat64 +# define __fxstat __fxstat64 +# define __xstat __xstat64 +# define __lxstat __lxstat64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int _fxstat64 __P ((int __ver, int __fildes, - struct stat64 *__stat_buf)); -extern int _xstat64 __P ((int __ver, __const char *__filename, - struct stat64 *__stat_buf)); -extern int _lxstat64 __P ((int __ver, __const char *__filename, - struct stat64 *__stat_buf)); +extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) + __THROW; +extern int __xstat64 (int __ver, __const char *__filename, + struct stat64 *__stat_buf) __THROW; +extern int __lxstat64 (int __ver, __const char *__filename, + struct stat64 *__stat_buf) __THROW; #endif -extern int _xmknod __P ((int __ver, __const char *__path, - __mode_t __mode, __dev_t *__dev)); +extern int __xmknod (int __ver, __const char *__path, __mode_t __mode, + __dev_t *__dev) __THROW; #if defined __GNUC__ && __GNUC__ >= 2 /* Inlined versions of the real stat and mknod functions. */ extern __inline__ int stat (__const char *__path, - struct stat *__statbuf) + struct stat *__statbuf) __THROW { - return _xstat (_STAT_VER, __path, __statbuf); + return __xstat (_STAT_VER, __path, __statbuf); } # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED extern __inline__ int lstat (__const char *__path, - struct stat *__statbuf) + struct stat *__statbuf) __THROW { - return _lxstat (_STAT_VER, __path, __statbuf); + return __lxstat (_STAT_VER, __path, __statbuf); } # endif -extern __inline__ int fstat (int __fd, struct stat *__statbuf) +extern __inline__ int fstat (int __fd, struct stat *__statbuf) __THROW { - return _fxstat (_STAT_VER, __fd, __statbuf); + return __fxstat (_STAT_VER, __fd, __statbuf); } # if defined __USE_MISC || defined __USE_BSD extern __inline__ int mknod (__const char *__path, __mode_t __mode, - __dev_t __dev) + __dev_t __dev) __THROW { - return _xmknod (_MKNOD_VER, __path, __mode, &__dev); + return __xmknod (_MKNOD_VER, __path, __mode, &__dev); } # endif -# ifdef __USE_LARGEFILE64 +# if defined __USE_LARGEFILE64 \ + && (! defined __USE_FILE_OFFSET64 \ + || (defined __REDIRECT && defined __OPTIMIZE__)) extern __inline__ int stat64 (__const char *__path, - struct stat64 *__statbuf) + struct stat64 *__statbuf) __THROW { - return _xstat64 (_STAT_VER, __path, __statbuf); + return __xstat64 (_STAT_VER, __path, __statbuf); } # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED extern __inline__ int lstat64 (__const char *__path, - struct stat64 *__statbuf) + struct stat64 *__statbuf) __THROW { - return _lxstat64 (_STAT_VER, __path, __statbuf); + return __lxstat64 (_STAT_VER, __path, __statbuf); } # endif -extern __inline__ int fstat64 (int __fd, struct stat64 *__statbuf) +extern __inline__ int fstat64 (int __fd, struct stat64 *__statbuf) __THROW { - return _fxstat64 (_STAT_VER, __fd, __statbuf); + return __fxstat64 (_STAT_VER, __fd, __statbuf); } # endif diff --git a/include/sys/statfs.h b/include/sys/statfs.h index be93bc923..969d9d0e5 100644 --- a/include/sys/statfs.h +++ b/include/sys/statfs.h @@ -1,21 +1,21 @@ /* Definitions for getting information about a filesystem. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - 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_STATFS_H #define _SYS_STATFS_H 1 @@ -29,33 +29,34 @@ __BEGIN_DECLS /* Return information about the filesystem on which FILE resides. */ #ifndef __USE_FILE_OFFSET64 -extern int statfs __P ((__const char *__file, struct statfs *__buf)); +extern int statfs (__const char *__file, struct statfs *__buf) __THROW; #else # ifdef __REDIRECT -extern int __REDIRECT (statfs, __P ((__const char *__file, - struct statfs *__buf)), statfs64); +extern int __REDIRECT (statfs, + (__const char *__file, struct statfs *__buf) __THROW, + statfs64); # else # define statfs statfs64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int statfs64 __P ((__const char *__file, struct statfs64 *__buf)); +extern int statfs64 (__const char *__file, struct statfs64 *__buf) __THROW; #endif /* Return information about the filesystem containing the file FILDES refers to. */ #ifndef __USE_FILE_OFFSET64 -extern int fstatfs __P ((int __fildes, struct statfs *__buf)); +extern int fstatfs (int __fildes, struct statfs *__buf) __THROW; #else # ifdef __REDIRECT -extern int __REDIRECT (fstatfs, __P ((int __fildes, struct statfs *__buf)), +extern int __REDIRECT (fstatfs, (int __fildes, struct statfs *__buf) __THROW, fstatfs64); # else # define fstatfs fstatfs64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int fstatfs64 __P ((int __fildes, struct statfs64 *__buf)); +extern int fstatfs64 (int __fildes, struct statfs64 *__buf) __THROW; #endif __END_DECLS diff --git a/include/sys/swap.h b/include/sys/swap.h index e84c36520..b6e7bef5d 100644 --- a/include/sys/swap.h +++ b/include/sys/swap.h @@ -1,21 +1,21 @@ /* Calls to enable and disable swapping on specified locations. Linux version. - 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_SWAP_H @@ -33,10 +33,10 @@ __BEGIN_DECLS /* Make the block special device PATH available to the system for swapping. This call is restricted to the super-user. */ -extern int swapon __P ((__const char *__path, int __flags)); +extern int swapon (__const char *__path, int __flags) __THROW; /* Stop using block special device PATH for swapping. */ -extern int swapoff __P ((__const char *__path)); +extern int swapoff (__const char *__path) __THROW; __END_DECLS diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h index ebdb7715f..a6727b21e 100644 --- a/include/sys/sysinfo.h +++ b/include/sys/sysinfo.h @@ -1,15 +1,48 @@ +/* Copyright (C) 1996, 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 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_SYSINFO_H -#define _SYS_SYSINFO_H +#define _SYS_SYSINFO_H 1 #include <features.h> +/* Get sysinfo structure from kernel header. */ #include <linux/kernel.h> __BEGIN_DECLS -extern int sysinfo __P((struct sysinfo *__info)); -extern int __sysinfo __P((struct sysinfo *__info)); +/* Returns information on overall system statistics. */ +extern int sysinfo (struct sysinfo *__info) __THROW; + + +/* Return number of configured processors. */ +extern int get_nprocs_conf (void) __THROW; + +/* Return number of available processors. */ +extern int get_nprocs (void) __THROW; + + +/* Return number of physical pages of memory in the system. */ +extern long int get_phys_pages (void) __THROW; + +/* Return number of available physical pages of memory in the system. */ +extern long int get_avphys_pages (void) __THROW; __END_DECLS -#endif +#endif /* sys/sysinfo.h */ diff --git a/include/sys/syslog.h b/include/sys/syslog.h index ffdb39bc1..940ee2dec 100644 --- a/include/sys/syslog.h +++ b/include/sys/syslog.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,7 +33,7 @@ #define _SYS_SYSLOG_H 1 #include <features.h> -// #define __need___va_list +#define __need___va_list #include <stdarg.h> @@ -173,22 +169,23 @@ CODE facilitynames[] = __BEGIN_DECLS /* Close desriptor used to write to system logger. */ -extern void closelog __P ((void)); +extern void closelog (void) __THROW; /* Open connection to system logger. */ -extern void openlog __P ((__const char *__ident, int __option, - int __facility)); +extern void openlog (__const char *__ident, int __option, int __facility) + __THROW; /* Set the log mask level. */ -extern int setlogmask __P ((int __mask)); +extern int setlogmask (int __mask) __THROW; /* Generate a log message using FMT string and option arguments. */ -extern void syslog __P ((int __pri, __const char *__fmt, ...)); +extern void syslog (int __pri, __const char *__fmt, ...) __THROW + __attribute__ ((__format__(__printf__, 2, 3))); #ifdef __USE_BSD /* Generate a log message using FMT and using arguments pointed to by AP. */ -extern void vsyslog __P ((int __pri, __const char *__fmt, - va_list __ap)); +extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap) + __THROW __attribute__ ((__format__(__printf__, 2, 0))); #endif __END_DECLS diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 35760e5e0..e482aab17 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.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 _SYS_SYSMACROS_H #define _SYS_SYSMACROS_H 1 diff --git a/include/sys/time.h b/include/sys/time.h index c05c5c210..f051d58c4 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -1,54 +1,56 @@ -/* Copyright (C) 1991, 92, 93, 94, 96, 97, 98 Free Software Foundation, Inc. +/* Copyright (C) 1991-1994,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. */ #ifndef _SYS_TIME_H #define _SYS_TIME_H 1 #include <features.h> -/* POSIX.4 structure for a time value. This is like a `struct timeval' but - has nanoseconds instead of microseconds. */ -struct timespec - { - long int tv_sec; /* Seconds. */ - long int tv_nsec; /* Nanoseconds. */ - }; - +#include <bits/types.h> +#define __need_time_t #include <time.h> -#include <sys/select.h> - #define __need_timeval #include <bits/time.h> +#include <sys/select.h> + +#ifndef __suseconds_t_defined +typedef __suseconds_t suseconds_t; +# define __suseconds_t_defined +#endif + __BEGIN_DECLS +#ifdef __USE_GNU /* Macros for converting between `struct timeval' and `struct timespec'. */ -#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ +# define TIMEVAL_TO_TIMESPEC(tv, ts) { \ (ts)->tv_sec = (tv)->tv_sec; \ (ts)->tv_nsec = (tv)->tv_usec * 1000; \ } -#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ +# define TIMESPEC_TO_TIMEVAL(tv, ts) { \ (tv)->tv_sec = (ts)->tv_sec; \ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } +#endif +#ifdef __USE_BSD /* Structure crudely representing a timezone. This is obsolete and should never be used. */ struct timezone @@ -57,25 +59,32 @@ struct timezone int tz_dsttime; /* Nonzero if DST is ever in effect. */ }; +typedef struct timezone *__restrict __timezone_ptr_t; +#else +typedef void *__restrict __timezone_ptr_t; +#endif + /* Get the current time of day and timezone information, putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. Returns 0 on success, -1 on errors. NOTE: This form of timezone information is obsolete. Use the functions and variables declared in <time.h> instead. */ -extern int gettimeofday __P ((struct timeval *__tv, - struct timezone *__tz)); +extern int gettimeofday (struct timeval *__restrict __tv, + __timezone_ptr_t __tz) __THROW; +#ifdef __USE_BSD /* Set the current time of day and timezone information. This call is restricted to the super-user. */ -extern int settimeofday __P ((__const struct timeval *__tv, - __const struct timezone *__tz)); +extern int settimeofday (__const struct timeval *__tv, + __const struct timezone *__tz) __THROW; /* Adjust the current time of day by the amount in DELTA. If OLDDELTA is not NULL, it is filled in with the amount of time adjustment remaining to be done from the last `adjtime' call. This call is restricted to the super-user. */ -extern int adjtime __P ((__const struct timeval *__delta, - struct timeval *__olddelta)); +extern int adjtime (__const struct timeval *__delta, + struct timeval *__olddelta) __THROW; +#endif /* Values for the first argument to `getitimer' and `setitimer'. */ @@ -103,32 +112,42 @@ struct itimerval struct timeval it_value; }; +#if defined __USE_GNU && !defined __cplusplus +/* Use the nicer parameter type only in GNU mode and not for C++ since the + strict C++ rules prevent the automatic promotion. */ +typedef enum __itimer_which __itimer_which_t; +#else +typedef int __itimer_which_t; +#endif + /* Set *VALUE to the current setting of timer WHICH. Return 0 on success, -1 on errors. */ -extern int getitimer __P ((enum __itimer_which __which, - struct itimerval *__value)); +extern int getitimer (__itimer_which_t __which, + struct itimerval *__value) __THROW; /* Set the timer WHICH to *NEW. If OLD is not NULL, set *OLD to the old value of timer WHICH. Returns 0 on success, -1 on errors. */ -extern int setitimer __P ((enum __itimer_which __which, - __const struct itimerval *__new, - struct itimerval *__old)); +extern int setitimer (__itimer_which_t __which, + __const struct itimerval *__restrict __new, + struct itimerval *__restrict __old) __THROW; /* Change the access time of FILE to TVP[0] and the modification time of FILE to TVP[1]. */ -extern int utimes __P ((__const char *__file, struct timeval __tvp[2])); +extern int utimes (__const char *__file, __const struct timeval __tvp[2]) + __THROW; +#ifdef __USE_BSD /* Convenience macros for operations on timevals. NOTE: `timercmp' does not work for >= or <=. */ -#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) -#define timercmp(a, b, CMP) \ +# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +# define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) +# define timercmp(a, b, CMP) \ (((a)->tv_sec == (b)->tv_sec) ? \ ((a)->tv_usec CMP (b)->tv_usec) : \ ((a)->tv_sec CMP (b)->tv_sec)) -#define timeradd(a, b, result) \ +# define timeradd(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ @@ -138,7 +157,7 @@ extern int utimes __P ((__const char *__file, struct timeval __tvp[2])); (result)->tv_usec -= 1000000; \ } \ } while (0) -#define timersub(a, b, result) \ +# define timersub(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ @@ -147,6 +166,7 @@ extern int utimes __P ((__const char *__file, struct timeval __tvp[2])); (result)->tv_usec += 1000000; \ } \ } while (0) +#endif /* BSD */ __END_DECLS diff --git a/include/sys/timeb.h b/include/sys/timeb.h index 52e5486b3..dbdbf45a8 100644 --- a/include/sys/timeb.h +++ b/include/sys/timeb.h @@ -29,16 +29,17 @@ __BEGIN_DECLS /* Structure returned by the `ftime' function. */ -struct timeb { - time_t time; /* Seconds since epoch, as from `time'. */ - unsigned short int millitm; /* Additional milliseconds. */ - short int timezone; /* Minutes west of GMT. */ - short int dstflag; /* Nonzero if Daylight Savings Time used. */ -}; +struct timeb + { + time_t time; /* Seconds since epoch, as from `time'. */ + unsigned short int millitm; /* Additional milliseconds. */ + short int timezone; /* Minutes west of GMT. */ + short int dstflag; /* Nonzero if Daylight Savings Time used. */ + }; /* Fill in TIMEBUF with information about the current time. */ -extern int ftime(struct timeb *__timebuf); +extern int ftime (struct timeb *__timebuf); __END_DECLS diff --git a/include/sys/times.h b/include/sys/times.h index b6defa877..6022f2f84 100644 --- a/include/sys/times.h +++ b/include/sys/times.h @@ -1,21 +1,53 @@ -#ifndef _SYS_TIMES_H -#define _SYS_TIMES_H +/* Copyright (C) 1991, 1992, 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 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: 4.5.2 Process Times <sys/times.h> + */ + +#ifndef _SYS_TIMES_H +#define _SYS_TIMES_H 1 #include <features.h> -#include <sys/types.h> + +#define __need_clock_t #include <time.h> -struct tms { - clock_t tms_utime; - clock_t tms_stime; - clock_t tms_cutime; - clock_t tms_cstime; -}; __BEGIN_DECLS -extern clock_t times __P ((struct tms * __tp)); +/* Structure describing CPU time used by a process and its children. */ +struct tms + { + clock_t tms_utime; /* User CPU time. */ + clock_t tms_stime; /* System CPU time. */ + + clock_t tms_cutime; /* User CPU time of dead children. */ + clock_t tms_cstime; /* System CPU time of dead children. */ + }; + + +/* Store the CPU time used by this process and all its + dead children (and their dead children) in BUFFER. + Return the elapsed real time, or (clock_t) -1 for errors. + All times are in CLK_TCKths of a second. */ +extern clock_t times (struct tms *__buffer) __THROW; __END_DECLS -#endif +#endif /* sys/times.h */ diff --git a/include/sys/timex.h b/include/sys/timex.h index 900341e54..773a5ab8d 100644 --- a/include/sys/timex.h +++ b/include/sys/timex.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_TIMEX_H #define _SYS_TIMEX_H 1 @@ -116,11 +116,11 @@ struct timex __BEGIN_DECLS -extern int __adjtimex __P ((struct timex *__ntx)); -extern int adjtimex __P ((struct timex *__ntx)); +extern int __adjtimex (struct timex *__ntx) __THROW; +extern int adjtimex (struct timex *__ntx) __THROW; -extern int ntp_gettime __P ((struct ntptimeval *__ntv)); -extern int ntp_adjtime __P ((struct timex *__tntx)); +extern int ntp_gettime (struct ntptimeval *__ntv) __THROW; +extern int ntp_adjtime (struct timex *__tntx) __THROW; __END_DECLS diff --git a/include/sys/ttydefaults.h b/include/sys/ttydefaults.h index b21c6d568..9be168b83 100644 --- a/include/sys/ttydefaults.h +++ b/include/sys/ttydefaults.h @@ -15,10 +15,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. diff --git a/include/sys/types.h b/include/sys/types.h index c746ad6c6..cd114876f 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -1,20 +1,20 @@ -/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,94,95,96,97,98,99,2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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: 2.6 Primitive System Data Types <sys/types.h> @@ -30,6 +30,7 @@ __BEGIN_DECLS #include <bits/types.h> #ifdef __USE_BSD +# ifndef __u_char_defined typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; @@ -37,93 +38,110 @@ 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 #endif typedef __loff_t loff_t; -#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 -#ifndef dev_t +#ifndef __dev_t_defined typedef __dev_t dev_t; -# define dev_t dev_t +# define __dev_t_defined #endif -#ifndef gid_t +#ifndef __gid_t_defined typedef __gid_t gid_t; -# define gid_t gid_t +# define __gid_t_defined #endif -#ifndef mode_t +#ifndef __mode_t_defined typedef __mode_t mode_t; -# define mode_t mode_t +# define __mode_t_defined #endif -#ifndef nlink_t +#ifndef __nlink_t_defined typedef __nlink_t nlink_t; -# define nlink_t nlink_t +# define __nlink_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 -#ifndef off_t +#ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif -# define off_t off_t +# define __off_t_defined #endif -#if defined __USE_LARGEFILE64 && !defined off64_t +#if defined __USE_LARGEFILE64 && !defined __off64_t_defined typedef __off64_t off64_t; -# define off64_t off64_t +# define __off64_t_defined #endif -#ifndef pid_t +#ifndef __pid_t_defined typedef __pid_t pid_t; -# define pid_t pid_t # define __pid_t_defined #endif -#if defined __USE_SVID || defined __USE_XOPEN +#if (defined __USE_SVID || defined __USE_XOPEN) && !defined __id_t_defined typedef __id_t id_t; # define __id_t_defined #endif -#ifndef ssize_t +#ifndef __ssize_t_defined typedef __ssize_t ssize_t; -# define ssize_t ssize_t # define __ssize_t_defined #endif #ifdef __USE_BSD +# ifndef __daddr_t_defined typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; +# define __daddr_t_defined +# endif #endif -#if defined __USE_SVID || defined __USE_XOPEN +#if (defined __USE_SVID || defined __USE_XOPEN) && !defined __key_t_defined typedef __key_t key_t; +# define __key_t_defined #endif #ifdef __USE_XOPEN # define __need_clock_t #endif #define __need_time_t +#define __need_timer_t +#define __need_clockid_t #include <time.h> +#ifdef __USE_XOPEN +# ifndef __useconds_t_defined +typedef __useconds_t useconds_t; +# define __useconds_t_defined +# endif +# ifndef __suseconds_t_defined +typedef __suseconds_t suseconds_t; +# define __suseconds_t_defined +# endif +#endif + #define __need_size_t #include <stddef.h> @@ -136,9 +154,9 @@ typedef unsigned int uint; /* These size-specific names are used by some of the inet code. */ -#if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +#if !__GNUC_PREREQ (2, 7) -/* These types are defined by the ISO C 9x header <inttypes.h>. */ +/* These types are defined by the ISO C99 header <inttypes.h>. */ # ifndef __int8_t_defined # define __int8_t_defined typedef char int8_t; @@ -201,15 +219,38 @@ typedef int register_t __attribute__ ((__mode__ (__word__))); #endif /* Use BSD. */ +#if defined __USE_UNIX98 && !defined __blksize_t_defined +typedef __blksize_t blksize_t; +# define __blksize_t_defined +#endif + /* Types from the Large File Support interface. */ #ifndef __USE_FILE_OFFSET64 +# ifndef __blkcnt_t_defined typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */ +# define __blkcnt_t_defined +# endif +# ifndef __fsblkcnt_t_defined typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ +# define __fsblkcnt_t_defined +# endif +# ifndef __fsfilcnt_t_defined typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ +# define __fsfilcnt_t_defined +# endif #else +# ifndef __blkcnt_t_defined typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */ +# define __blkcnt_t_defined +# endif +# ifndef __fsblkcnt_t_defined typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ +# define __fsblkcnt_t_defined +# endif +# ifndef __fsfilcnt_t_defined typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ +# define __fsfilcnt_t_defined +# endif #endif #ifdef __USE_LARGEFILE64 diff --git a/include/sys/ucontext.h b/include/sys/ucontext.h new file mode 100644 index 000000000..6d6c8e399 --- /dev/null +++ b/include/sys/ucontext.h @@ -0,0 +1,94 @@ +/* Copyright (C) 1998, 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 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. */ + +/* System V/ARM ABI compliant context switching support. */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include <features.h> +#include <signal.h> +#include <sys/procfs.h> + +typedef int greg_t; + +/* Number of general registers. */ +#define NGREG 16 + +/* Container for all general registers. */ +typedef elf_gregset_t gregset_t; + +/* Number of each register is the `gregset_t' array. */ +enum +{ + R0 = 0, +#define R0 R0 + R1 = 1, +#define R1 R1 + R2 = 2, +#define R2 R2 + R3 = 3, +#define R3 R3 + R4 = 4, +#define R4 R4 + R5 = 5, +#define R5 R5 + R6 = 6, +#define R6 R6 + R7 = 7, +#define R7 R7 + R8 = 8, +#define R8 R8 + R9 = 9, +#define R9 R9 + R10 = 10, +#define R10 R10 + R11 = 11, +#define R11 R11 + R12 = 12, +#define R12 R12 + R13 = 13, +#define R13 R13 + R14 = 14, +#define R14 R14 + R15 = 15 +#define R15 R15 +}; + +/* Structure to describe FPU registers. */ +typedef elf_fpregset_t fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t gregs; + fpregset_t fpregs; + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + __sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + long int uc_filler[5]; + } ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/include/sys/uio.h b/include/sys/uio.h index 0be33e9b4..4b3138088 100644 --- a/include/sys/uio.h +++ b/include/sys/uio.h @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc. +/* 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 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_UIO_H #define _SYS_UIO_H 1 @@ -34,16 +34,16 @@ __BEGIN_DECLS The buffers are filled in the order specified. Operates just like `read' (see <unistd.h>) except that data are put in VECTOR instead of a contiguous buffer. */ -extern ssize_t readv __P ((int __fd, __const struct iovec *__vector, - int __count)); +extern ssize_t readv (int __fd, __const struct iovec *__vector, int __count) + __THROW; /* Write data pointed by the buffers described by VECTOR, which is a vector of COUNT `struct iovec's, to file descriptor FD. The data is written in the order specified. Operates just like `write' (see <unistd.h>) except that the data are taken from VECTOR instead of a contiguous buffer. */ -extern ssize_t writev __P ((int __fd, __const struct iovec *__vector, - int __count)); +extern ssize_t writev (int __fd, __const struct iovec *__vector, int __count) + __THROW; __END_DECLS diff --git a/include/sys/un.h b/include/sys/un.h index 03f36058b..1fa10e4fe 100644 --- a/include/sys/un.h +++ b/include/sys/un.h @@ -1,28 +1,26 @@ -/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996, 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 _SYS_UN_H #define _SYS_UN_H 1 #include <sys/cdefs.h> -#include <string.h> /* For prototype of `strlen'. */ - /* Get the definition of the macro to define the common sockaddr members. */ #include <bits/sockaddr.h> @@ -36,9 +34,13 @@ struct sockaddr_un }; +#ifdef __USE_MISC +# include <string.h> /* For prototype of `strlen'. */ + /* Evaluate to actual length of the `sockaddr_un' structure. */ -#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ +# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ + strlen ((ptr)->sun_path)) +#endif __END_DECLS diff --git a/include/sys/user.h b/include/sys/user.h index aca46e7d3..3fae43f83 100644 --- a/include/sys/user.h +++ b/include/sys/user.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -23,81 +23,50 @@ too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ -struct user_fpregs_struct +struct user_fpregs { - long int cwd; - long int swd; - long int twd; - long int fip; - long int fcs; - long int foo; - long int fos; - long int st_space [20]; + struct fp_reg + { + unsigned int sign1:1; + unsigned int unused:15; + unsigned int sign2:1; + unsigned int exponent:14; + unsigned int j:1; + unsigned int mantissa1:31; + unsigned int mantissa0:32; + } fpregs[8]; + unsigned int fpsr:32; + unsigned int fpcr:32; + unsigned char ftype[8]; + unsigned int init_flag; }; -struct user_fpxregs_struct +struct user_regs { - unsigned short int cwd; - unsigned short int swd; - unsigned short int twd; - unsigned short int fop; - long int fip; - long int fcs; - long int foo; - long int fos; - long int mxcsr; - long int reserved; - long int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ - long int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ - long int padding[56]; -}; - -struct user_regs_struct -{ - long int ebx; - long int ecx; - long int edx; - long int esi; - long int edi; - long int ebp; - long int eax; - long int xds; - long int xes; - long int xfs; - long int xgs; - long int orig_eax; - long int eip; - long int xcs; - long int eflags; - long int esp; - long int xss; + unsigned long int uregs[18]; }; struct user { - struct user_regs_struct regs; - int u_fpvalid; - struct user_fpregs_struct i387; - unsigned long int u_tsize; - unsigned long int u_dsize; - unsigned long int u_ssize; - unsigned long start_code; - unsigned long start_stack; - long int signal; - int reserved; - struct user_regs_struct* u_ar0; - struct user_fpregs_struct* u_fpstate; - unsigned long int magic; - char u_comm [32]; - int u_debugreg [8]; -}; + struct user_regs regs; /* General registers */ + int u_fpvalid; /* True if math co-processor being used. */ -#define PAGE_SHIFT 12 -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) -#define NBPG PAGE_SIZE -#define UPAGES 1 -#define HOST_TEXT_START_ADDR (u.start_code) -#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + unsigned long int u_tsize; /* Text segment size (pages). */ + unsigned long int u_dsize; /* Data segment size (pages). */ + unsigned long int u_ssize; /* Stack segment size (pages). */ + + unsigned long start_code; /* Starting virtual address of text. */ + unsigned long start_stack; /* Starting virtual address of stack. */ + + long int signal; /* Signal that caused the core dump. */ + int reserved; /* No longer used */ + struct user_regs *u_ar0; /* help gdb to find the general registers. */ + + unsigned long magic; /* uniquely identify a core file */ + char u_comm[32]; /* User command that was responsible */ + int u_debugreg[8]; + struct user_fpregs u_fp; /* Floating point registers */ + struct user_fpregs *u_fp0; /* help gdb to find the FP registers. */ +}; -#endif /* _SYS_USER_H */ +#endif /* sys/user.h */ diff --git a/include/sys/utsname.h b/include/sys/utsname.h index 7625a5b6b..ca195cb4d 100644 --- a/include/sys/utsname.h +++ b/include/sys/utsname.h @@ -1,20 +1,74 @@ -#ifndef __SYS_UTSNAME_H -#define __SYS_UTSNAME_H +/* Copyright (C) 1991, 92, 94, 96, 97, 99 Free Software Foundation, Inc. + This file is part of the GNU C Library. -#include <features.h> -#include <sys/param.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. + + 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. */ -struct utsname { - char sysname[65]; - char nodename[65]; - char release[65]; - char version[65]; - char machine[65]; - char domainname[65]; -}; +/* + * POSIX Standard: 4.4 System Identification <sys/utsname.h> + */ + +#ifndef _SYS_UTSNAME_H +#define _SYS_UTSNAME_H 1 + +#include <features.h> __BEGIN_DECLS -extern int uname __P ((struct utsname * __utsbuf)); -__END_DECLS +#include <bits/utsname.h> + +#ifndef _UTSNAME_NODENAME_LENGTH +# define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH +#endif + +/* Structure describing the system and machine. */ +struct utsname + { + /* Name of the implementation of the operating system. */ + char sysname[_UTSNAME_LENGTH]; + + /* Name of this node on the network. */ + char nodename[_UTSNAME_NODENAME_LENGTH]; + + /* Current release level of this implementation. */ + char release[_UTSNAME_LENGTH]; + /* Current version level of this release. */ + char version[_UTSNAME_LENGTH]; + + /* Name of the hardware type the system is running on. */ + char machine[_UTSNAME_LENGTH]; + +#if _UTSNAME_DOMAIN_LENGTH - 0 + /* Name of the domain of this node on the network. */ +# ifdef __USE_GNU + char domainname[_UTSNAME_DOMAIN_LENGTH]; +# else + char __domainname[_UTSNAME_DOMAIN_LENGTH]; +# endif #endif + }; + +#ifdef __USE_SVID +# define SYS_NMLN _UTSNAME_LENGTH +#endif + + +/* Put information about the system in NAME. */ +extern int uname (struct utsname *__name) __THROW; + + +__END_DECLS + +#endif /* sys/utsname.h */ diff --git a/include/sys/vm86.h b/include/sys/vm86.h deleted file mode 100644 index 851814e13..000000000 --- a/include/sys/vm86.h +++ /dev/null @@ -1,125 +0,0 @@ -#if !__AS386_16__ - -#ifndef _SYS_VM86_H -#define _SYS_VM86_H - -#include <features.h> -#ifndef _LINUX_VM86_H -#define _LINUX_VM86_H - -/* - * I'm guessing at the VIF/VIP flag usage, but hope that this is how - * the Pentium uses them. Linux will return from vm86 mode when both - * VIF and VIP is set. - * - * On a Pentium, we could probably optimize the virtual flags directly - * in the eflags register instead of doing it "by hand" in vflags... - * - * Linus - */ - -#define TF_MASK 0x00000100 -#define IF_MASK 0x00000200 -#define IOPL_MASK 0x00003000 -#define NT_MASK 0x00004000 -#define VM_MASK 0x00020000 -#define AC_MASK 0x00040000 -#define VIF_MASK 0x00080000 /* virtual interrupt flag */ -#define VIP_MASK 0x00100000 /* virtual interrupt pending */ -#define ID_MASK 0x00200000 - -#define BIOSSEG 0x0f000 - -#define CPU_086 0 -#define CPU_186 1 -#define CPU_286 2 -#define CPU_386 3 -#define CPU_486 4 -#define CPU_586 5 - -/* - * Return values for the 'vm86()' system call - */ -#define VM86_TYPE(retval) ((retval) & 0xff) -#define VM86_ARG(retval) ((retval) >> 8) - -#define VM86_SIGNAL 0 /* return due to signal */ -#define VM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */ -#define VM86_INTx 2 /* int3/int x instruction (ARG = x) */ -#define VM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */ - -/* - * This is the stack-layout when we have done a "SAVE_ALL" from vm86 - * mode - the main change is that the old segment descriptors aren't - * useful any more and are forced to be zero by the kernel (and the - * hardware when a trap occurs), and the real segment descriptors are - * at the end of the structure. Look at ptrace.h to see the "normal" - * setup. - */ - -struct vm86_regs { -/* - * normal regs, with special meaning for the segment descriptors.. - */ - long ebx; - long ecx; - long edx; - long esi; - long edi; - long ebp; - long eax; - long __null_ds; - long __null_es; - long __null_fs; - long __null_gs; - long orig_eax; - long eip; - unsigned short cs, __csh; - long eflags; - long esp; - unsigned short ss, __ssh; -/* - * these are specific to v86 mode: - */ - unsigned short es, __esh; - unsigned short ds, __dsh; - unsigned short fs, __fsh; - unsigned short gs, __gsh; -}; - -struct revectored_struct { - unsigned long __map[8]; /* 256 bits */ -}; - -struct vm86_struct { - struct vm86_regs regs; - unsigned long flags; - unsigned long screen_bitmap; - unsigned long cpu_type; - struct revectored_struct int_revectored; - struct revectored_struct int21_revectored; -}; - -/* - * flags masks - */ -#define VM86_SCREEN_BITMAP 0x0001 - -#ifdef __KERNEL__ - -void handle_vm86_fault(struct vm86_regs *, long); -void handle_vm86_debug(struct vm86_regs *, long); - -#endif - -#endif - -__BEGIN_DECLS - -extern vm86(struct vm86_struct * __info); - -__END_DECLS - -#endif /*_SYS_VM86_H */ - -#endif diff --git a/include/sys/wait.h b/include/sys/wait.h index 2ba604de6..03ac5fe35 100644 --- a/include/sys/wait.h +++ b/include/sys/wait.h @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 92, 93, 94, 96, 97, 98 Free Software Foundation, Inc. +/* Copyright (C) 1991-1994,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: 3.2.1 Wait for Process Termination <sys/wait.h> @@ -27,65 +27,64 @@ __BEGIN_DECLS -#include <bits/types.h> - -#if defined __USE_XOPEN && !defined pid_t -typedef __pid_t pid_t; -# define pid_t pid_t -#endif +#include <signal.h> +#include <sys/resource.h> +/* These macros could also be defined int <stdlib.h>. */ +#if !defined _STDLIB_H || !defined __USE_XOPEN /* This will define the `W*' macros for the flag bits to `waitpid', `wait3', and `wait4'. */ -#include <bits/waitflags.h> +# include <bits/waitflags.h> -#ifdef __USE_BSD +# 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) \ +# 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 +# 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 __ptr_t -# define __WAIT_STATUS_DEFN __ptr_t -# else +# 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 +# define __WAIT_STATUS_DEFN int * +# endif -#else /* Don't use BSD. */ +# else /* Don't use BSD. */ -# define __WAIT_INT(status) (status) -# define __WAIT_STATUS int * -# define __WAIT_STATUS_DEFN int * +# define __WAIT_INT(status) (status) +# define __WAIT_STATUS int * +# define __WAIT_STATUS_DEFN int * -#endif /* Use BSD. */ +# endif /* Use BSD. */ /* This will define all the `__W*' macros. */ -#include <bits/waitstatus.h> +# include <bits/waitstatus.h> -#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)) +# 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 /* <stdlib.h> not included. */ #ifdef __USE_BSD # define WCOREFLAG __WCOREFLAG @@ -107,8 +106,7 @@ typedef enum /* Wait for a child to die. When one does, put its status in *STAT_LOC and return its process ID. For errors, return (pid_t) -1. */ -extern __pid_t __wait __P ((__WAIT_STATUS __stat_loc)); -extern __pid_t wait __P ((__WAIT_STATUS __stat_loc)); +extern __pid_t wait (__WAIT_STATUS __stat_loc) __THROW; #ifdef __USE_BSD /* Special values for the PID argument to `waitpid' and `wait4'. */ @@ -128,8 +126,7 @@ extern __pid_t wait __P ((__WAIT_STATUS __stat_loc)); return PID and store the dead child's status in STAT_LOC. Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS, return status for stopped children; otherwise don't. */ -extern __pid_t waitpid __P ((__pid_t __pid, int *__stat_loc, - int __options)); +extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options) __THROW; #if defined __USE_SVID || defined __USE_XOPEN # define __need_siginfo_t @@ -142,8 +139,8 @@ extern __pid_t waitpid __P ((__pid_t __pid, int *__stat_loc, If the WNOHANG bit is set in OPTIONS, and that child is not already dead, clear *INFOP and return 0. If successful, store exit code and status in *INFOP. */ -extern int waitid __P ((idtype_t __idtype, __id_t __id, siginfo_t *__infop, - int __options)); +extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop, + int __options) __THROW; #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED @@ -156,8 +153,8 @@ struct rusage; nil, store information about the child's resource usage there. If the WUNTRACED bit is set in OPTIONS, return status for stopped children; otherwise don't. */ -extern __pid_t wait3 __P ((__WAIT_STATUS __stat_loc, - int __options, struct rusage * __usage)); +extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options, + struct rusage * __usage) __THROW; #endif #ifdef __USE_BSD @@ -166,8 +163,8 @@ extern __pid_t wait3 __P ((__WAIT_STATUS __stat_loc, struct rusage; /* PID is like waitpid. Other args are like wait3. */ -extern __pid_t wait4 __P ((__pid_t __pid, __WAIT_STATUS __stat_loc, - int __options, struct rusage *__usage)); +extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options, + struct rusage *__usage) __THROW; #endif /* Use BSD. */ diff --git a/include/tar.h b/include/tar.h index f8264a0f7..ddfef755d 100644 --- a/include/tar.h +++ b/include/tar.h @@ -4,19 +4,19 @@ Written by David J. MacKenzie. 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 _TAR_H #define _TAR_H 1 diff --git a/include/termcap.h b/include/termcap.h index 97624192c..25d69557d 100644 --- a/include/termcap.h +++ b/include/termcap.h @@ -1,25 +1,75 @@ +/**************************************************************************** + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ -#ifndef _TERMCAP_H -#define _TERMCAP_H +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* $Id: termcap.h,v 1.3 2001/09/27 05:21:09 andersen Exp $ */ + +#ifndef _NCU_TERMCAP_H +#define _NCU_TERMCAP_H 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "5.2" + +#include <ncurses_dll.h> + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ -#include <features.h> #include <sys/types.h> -__BEGIN_DECLS +#undef NCURSES_CONST +#define NCURSES_CONST const -extern char PC; -extern char *UP; -extern char *BC; -extern int ospeed; +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short -extern int tgetent __P((char *, const char *)); -extern int tgetflag __P((const char *)); -extern int tgetnum __P((const char *)); -extern char *tgetstr __P((const char *, char **)); +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char *) UP; +extern NCURSES_EXPORT_VAR(char *) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; -extern int tputs __P((const char *, int, int (*)(int))); -extern char *tgoto __P((const char *, int, int)); +#if !defined(_NCU_TERM_H) +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif -__END_DECLS +#ifdef __cplusplus +} +#endif -#endif /* _TERMCAP_H */ +#endif /* _NCU_TERMCAP_H */ diff --git a/include/termios.h b/include/termios.h index 0306d8fb8..2c66457e2 100644 --- a/include/termios.h +++ b/include/termios.h @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 92, 93, 94, 96, 97, 98 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,94,96,97,98,99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + 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: 7.1-2 General Terminal Interface <termios.h> @@ -27,9 +27,9 @@ #ifdef __USE_UNIX98 /* We need `pid_t'. */ # include <bits/types.h> -# ifndef pid_t +# ifndef __pid_t_defined typedef __pid_t pid_t; -# define pid_t pid_t +# define __pid_t_defined # endif #endif @@ -46,55 +46,55 @@ __BEGIN_DECLS #endif /* Return the output baud rate stored in *TERMIOS_P. */ -extern speed_t cfgetospeed __P ((__const struct termios *__termios_p)); +extern speed_t cfgetospeed (__const struct termios *__termios_p) __THROW; /* Return the input baud rate stored in *TERMIOS_P. */ -extern speed_t cfgetispeed __P ((__const struct termios *__termios_p)); +extern speed_t cfgetispeed (__const struct termios *__termios_p) __THROW; /* Set the output baud rate stored in *TERMIOS_P to SPEED. */ -extern int cfsetospeed __P ((struct termios *__termios_p, speed_t __speed)); +extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW; /* Set the input baud rate stored in *TERMIOS_P to SPEED. */ -extern int cfsetispeed __P ((struct termios *__termios_p, speed_t __speed)); +extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW; #ifdef __USE_BSD /* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */ -extern int cfsetspeed __P ((struct termios *__termios_p, speed_t __speed)); +extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; #endif /* Put the state of FD into *TERMIOS_P. */ -extern int tcgetattr __P ((int __fd, struct termios *__termios_p)); +extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW; /* Set the state of FD to *TERMIOS_P. Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */ -extern int tcsetattr __P ((int __fd, int __optional_actions, - __const struct termios *__termios_p)); +extern int tcsetattr (int __fd, int __optional_actions, + __const struct termios *__termios_p) __THROW; #ifdef __USE_BSD /* Set *TERMIOS_P to indicate raw mode. */ -extern void cfmakeraw __P ((struct termios *__termios_p)); +extern void cfmakeraw (struct termios *__termios_p) __THROW; #endif /* Send zero bits on FD. */ -extern int tcsendbreak __P ((int __fd, int __duration)); +extern int tcsendbreak (int __fd, int __duration) __THROW; /* Wait for pending output to be written on FD. */ -extern int tcdrain __P ((int __fd)); +extern int tcdrain (int __fd) __THROW; /* Flush pending data on FD. Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */ -extern int tcflush __P ((int __fd, int __queue_selector)); +extern int tcflush (int __fd, int __queue_selector) __THROW; /* Suspend or restart transmission on FD. Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>. */ -extern int tcflow __P ((int __fd, int __action)); +extern int tcflow (int __fd, int __action) __THROW; #ifdef __USE_UNIX98 /* Get process group ID for session leader for controlling terminal FD. */ -extern __pid_t tcgetsid __P ((int __fd)); +extern __pid_t tcgetsid (int __fd) __THROW; #endif diff --git a/include/time.h b/include/time.h index 4d9781d5d..08ee502e5 100644 --- a/include/time.h +++ b/include/time.h @@ -1,122 +1,366 @@ -/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* 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. + 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 -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 the GNU C Library; see the file COPYING.LIB. If -not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU 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. */ /* - * ANSI Standard: 4.12 DATE and TIME <time.h> + * ISO C99 Standard: 7.23 Date and time <time.h> */ -#ifndef _TIME_H -#define _TIME_H +#ifndef _TIME_H -#include <features.h> -#include <sys/time.h> +#if (! defined __need_time_t && !defined __need_clock_t && \ + ! defined __need_timespec) +# define _TIME_H 1 +# include <features.h> -#ifndef _TIME_T -#define _TIME_T -typedef long time_t; -#endif +__BEGIN_DECLS -#ifndef _CLOCK_T -#define _CLOCK_T -typedef long clock_t; #endif -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; -#endif +#ifdef _TIME_H +/* Get size_t and NULL from <stddef.h>. */ +# define __need_size_t +# define __need_NULL +# include <stddef.h> -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *) 0) -#endif -#endif +/* This defines CLOCKS_PER_SEC, which is the number of processor clock + ticks per second. */ +# include <bits/time.h> + +/* This is the obsolete POSIX.1-1988 name for the same constant. */ +# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K +# ifndef CLK_TCK +# define CLK_TCK CLOCKS_PER_SEC +# endif +# endif + +#endif /* <time.h> included. */ + +#if !defined __clock_t_defined && (defined _TIME_H || defined __need_clock_t) +# define __clock_t_defined 1 + +# include <bits/types.h> + +/* Returned by `clock'. */ +typedef __clock_t clock_t; + +#endif /* clock_t not defined and <time.h> or need clock_t. */ +#undef __need_clock_t + +#if !defined __time_t_defined && (defined _TIME_H || defined __need_time_t) +# define __time_t_defined 1 + +# include <bits/types.h> + +/* Returned by `time'. */ +typedef __time_t time_t; + +#endif /* time_t not defined and <time.h> or need time_t. */ +#undef __need_time_t + +#if !defined __clockid_t_defined && \ + ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_clockid_t) +# define __clockid_t_defined 1 + +# include <bits/types.h> + +/* Clock ID used in clock and timer functions. */ +typedef __clockid_t clockid_t; + +#endif /* clockid_t not defined and <time.h> or need clockid_t. */ +#undef __clockid_time_t + +#if !defined __timer_t_defined && \ + ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timer_t) +# define __timer_t_defined 1 + +# include <bits/types.h> -#define CLOCKS_PER_SEC 100 -#define CLK_TCK 100 /* That must be the same as HZ ???? */ - -struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; - /* Those are for future use. */ - long int __tm_gmtoff__; - __const char *__tm_zone__; +/* Timer ID returned by `timer_create'. */ +typedef __timer_t timer_t; + +#endif /* timer_t not defined and <time.h> or need timer_t. */ +#undef __need_timer_t + + +#if !defined __timespec_defined && \ + ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timespec) +# define __timespec_defined 1 + +/* POSIX.1b structure for a time value. This is like a `struct timeval' but + has nanoseconds instead of microseconds. */ +struct timespec + { + long int tv_sec; /* Seconds. */ + long int tv_nsec; /* Nanoseconds. */ + }; + +#endif /* timespec not defined and <time.h> or need timespec. */ +#undef __need_timespec + + +#ifdef _TIME_H +/* Used by other time functions. */ +struct tm +{ + int tm_sec; /* Seconds. [0-60] (1 leap second) */ + int tm_min; /* Minutes. [0-59] */ + int tm_hour; /* Hours. [0-23] */ + int tm_mday; /* Day. [1-31] */ + int tm_mon; /* Month. [0-11] */ + int tm_year; /* Year - 1900. */ + int tm_wday; /* Day of week. [0-6] */ + int tm_yday; /* Days in year.[0-365] */ + int tm_isdst; /* DST. [-1/0/1]*/ + +# ifdef __USE_BSD + long int tm_gmtoff; /* Seconds east of UTC. */ + __const char *tm_zone; /* Timezone abbreviation. */ +# else + long int __tm_gmtoff; /* Seconds east of UTC. */ + __const char *__tm_zone; /* Timezone abbreviation. */ +# endif }; -#define __isleap(year) \ - ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) +#ifdef __USE_POSIX199309 +/* POSIX.1b structure for timer start values and intervals. */ +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + +/* We can use a simple forward declaration. */ +struct sigevent; + +#endif /* POSIX.1b */ + +#ifdef __USE_XOPEN2K +# ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +# endif +#endif + + +/* Time used by the program so far (user time + system time). + The result / CLOCKS_PER_SECOND is program time in seconds. */ +extern clock_t clock (void) __THROW; + +/* Return the current time and put it in *TIMER if TIMER is not NULL. */ +extern time_t time (time_t *__timer) __THROW; + +/* Return the difference between TIME1 and TIME0. */ +extern double difftime (time_t __time1, time_t __time0) + __THROW __attribute__ ((__const__)); + +/* Return the `time_t' representation of TP and normalize TP. */ +extern time_t mktime (struct tm *__tp) __THROW; + + +/* Format TP into S according to FORMAT. + Write no more than MAXSIZE characters and return the number + of characters written, or 0 if it would exceed MAXSIZE. */ +extern size_t strftime (char *__restrict __s, size_t __maxsize, + __const char *__restrict __format, + __const struct tm *__restrict __tp) __THROW; + +# ifdef __USE_XOPEN +/* Parse S according to FORMAT and store binary time information in TP. + The return value is a pointer to the first unparsed character in S. */ +extern char *strptime (__const char *__restrict __s, + __const char *__restrict __fmt, struct tm *__tp) + __THROW; +# endif + + +/* Return the `struct tm' representation of *TIMER + in Universal Coordinated Time (aka Greenwich Mean Time). */ +extern struct tm *gmtime (__const time_t *__timer) __THROW; + +/* Return the `struct tm' representation + of *TIMER in the local timezone. */ +extern struct tm *localtime (__const time_t *__timer) __THROW; + +# if defined __USE_POSIX || defined __USE_MISC +/* Return the `struct tm' representation of *TIMER in UTC, + using *TP to store the result. */ +extern struct tm *gmtime_r (__const time_t *__restrict __timer, + struct tm *__restrict __tp) __THROW; + +/* Return the `struct tm' representation of *TIMER in local time, + using *TP to store the result. */ +extern struct tm *localtime_r (__const time_t *__restrict __timer, + struct tm *__restrict __tp) __THROW; +# endif /* POSIX or misc */ + +/* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n" + that is the representation of TP in this format. */ +extern char *asctime (__const struct tm *__tp) __THROW; + +/* Equivalent to `asctime (localtime (timer))'. */ +extern char *ctime (__const time_t *__timer) __THROW; + +# if defined __USE_POSIX || defined __USE_MISC +/* Reentrant versions of the above functions. */ + +/* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n" + that is the representation of TP in this format. */ +extern char *asctime_r (__const struct tm *__restrict __tp, + char *__restrict __buf) __THROW; + +/* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */ +extern char *ctime_r (__const time_t *__restrict __timer, + char *__restrict __buf) __THROW; +# endif /* POSIX or misc */ + + +/* Defined in localtime.c. */ +extern char *__tzname[2]; /* Current timezone names. */ +extern int __daylight; /* If daylight-saving time is ever in use. */ +extern long int __timezone; /* Seconds west of UTC. */ + + +# ifdef __USE_POSIX +/* Same as above. */ extern char *tzname[2]; -extern int daylight; -extern long int timezone; -__BEGIN_DECLS +/* Set time conversion information from the TZ environment variable. + If TZ is not defined, a locale-dependent default is used. */ +extern void tzset (void) __THROW; +# endif -extern int stime __P ((time_t* __tptr)); +# if defined __USE_SVID || defined __USE_XOPEN +extern int daylight; +extern long int timezone; +# endif -extern clock_t clock __P ((void)); -extern time_t time __P ((time_t * __tp)); -extern __CONSTVALUE double difftime __P ((time_t __time2, - time_t __time1)) __CONSTVALUE2; -extern time_t mktime __P ((struct tm * __tp)); +# ifdef __USE_SVID +/* Set the system time to *WHEN. + This call is restricted to the superuser. */ +extern int stime (__const time_t *__when) __THROW; +# endif -extern char * asctime __P ((__const struct tm * __tp)); -extern char * ctime __P ((__const time_t * __tp)); -extern size_t strftime __P ((char * __s, size_t __smax, - __const char * __fmt, __const struct tm * __tp)); -extern char * strptime __P ((__const char * __s, __const char * __fmt, - struct tm * __tm)); -extern void tzset __P ((void)); +/* Nonzero if YEAR is a leap year (every 4 years, + except every 100th isn't, and every 400th is). */ +# define __isleap(year) \ + ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) -extern struct tm* gmtime __P ((__const time_t *__tp)); -extern struct tm* localtime __P ((__const time_t * __tp)); -#ifdef __USE_MISC +# ifdef __USE_MISC /* Miscellaneous functions many Unices inherited from the public domain - localtime package. These are included only for compatibility. */ + localtime package. These are included only for compatibility. */ /* Like `mktime', but for TP represents Universal Time, not local time. */ -extern time_t timegm __P ((struct tm *__tp)); - +extern time_t timegm (struct tm *__tp) __THROW; + /* Another name for `mktime'. */ -extern time_t timelocal __P ((struct tm *__tp)); +extern time_t timelocal (struct tm *__tp) __THROW; + +/* Return the number of days in YEAR. */ +extern int dysize (int __year) __THROW __attribute__ ((__const__)); +# endif + + +# ifdef __USE_POSIX199309 +/* Pause execution for a number of nanoseconds. */ +extern int nanosleep (__const struct timespec *__requested_time, + struct timespec *__remaining) __THROW; + + +/* Get resolution of clock CLOCK_ID. */ +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW; + +/* Get current value of clock CLOCK_ID and store it in TP. */ +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW; + +/* Set clock CLOCK_ID to value TP. */ +extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp) + __THROW; + +# ifdef __USE_XOPEN2K +/* High-resolution sleep with the specified clock. */ +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + __const struct timespec *__req, + struct timespec *__rem) __THROW; + +/* Return clock ID for CPU-time clock. */ +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW; +# endif -#endif -extern char * asctime_r __P((__const struct tm *, char *)); -extern char * ctime_r __P((__const time_t *, char *)); -extern struct tm* gmtime_r __P((__const time_t *, struct tm *)); -extern struct tm* localtime_r __P((__const time_t *, struct tm *)); +/* Create new per-process timer using CLOCK_ID. */ +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __THROW; + +/* Delete timer TIMERID. */ +extern int timer_delete (timer_t __timerid) __THROW; + +/* Set timer TIMERID to VALUE, returning old value in OVLAUE. */ +extern int timer_settime (timer_t __timerid, int __flags, + __const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __THROW; + +/* Get current value of timer TIMERID and store it in VLAUE. */ +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __THROW; + +/* Get expiration overrun for timer TIMERID. */ +extern int timer_getoverrun (timer_t __timerid) __THROW; +# endif + + +# ifdef __USE_XOPEN_EXTENDED +/* Set to one of the following values to indicate an error. + 1 the DATEMSK environment variable is null or undefined, + 2 the template file cannot be opened for reading, + 3 failed to get file status information, + 4 the template file is not a regular file, + 5 an error is encountered while reading the template file, + 6 memory allication failed (not enough memory available), + 7 there is no line in the template that matches the input, + 8 invalid input specification Example: February 31 or a time is + specified that can not be represented in a time_t (representing + the time in seconds since 00:00:00 UTC, January 1, 1970) */ +extern int getdate_err; + +/* Parse the given string as a date specification and return a value + representing the value. The templates from the file identified by + the environment variable DATEMSK are used. In case of an error + `getdate_err' is set. */ +extern struct tm *getdate (__const char *__string) __THROW; +# endif + +# ifdef __USE_GNU +/* Since `getdate' is not reentrant because of the use of `getdate_err' + and the static buffer to return the result in, we provide a thread-safe + variant. The functionality is the same. The result is returned in + the buffer pointed to by RESBUFP and in case of an error the return + value is != 0 with the same values as given above for `getdate_err'. */ +extern int getdate_r (__const char *__restrict __string, + struct tm *__restrict __resbufp) __THROW; +# endif -/* IEEE Std 1003.1b-1993. */ -extern int nanosleep __P((__const struct timespec *__rqtp, - struct timespec *__rmtp)); __END_DECLS -#endif +#endif /* <time.h> included. */ + +#endif /* <time.h> not already included. */ diff --git a/include/ucontext.h b/include/ucontext.h index 5ba3c2f0f..ee6f594f0 100644 --- a/include/ucontext.h +++ b/include/ucontext.h @@ -1,20 +1,20 @@ -/* Copyright (C) 1997, 1998 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. */ /* System V ABI compliant user-level context switching support. */ @@ -24,20 +24,20 @@ #include <features.h> /* Get machine dependent definition of data structures. */ -#if 0 #include <sys/ucontext.h> __BEGIN_DECLS /* Get user context and store it in variable pointed to by UCP. */ -extern int getcontext __P ((ucontext_t *__ucp)); +extern int getcontext (ucontext_t *__ucp) __THROW; /* Set user context from information of variable pointed to by UCP. */ -extern int setcontext __P ((__const ucontext_t *__ucp)); +extern int setcontext (__const ucontext_t *__ucp) __THROW; /* Save current context in context variable pointed to by OUCP and set context from variable pointed to by UCP. */ -extern int swapcontext __P ((ucontext_t *__oucp, __const ucontext_t *__ucp)); +extern int swapcontext (ucontext_t *__restrict __oucp, + __const ucontext_t *__restrict __ucp) __THROW; /* Manipulate user context UCP to continue with calling functions FUNC and the ARGC-1 parameters following ARGC when the context is used @@ -45,9 +45,9 @@ extern int swapcontext __P ((ucontext_t *__oucp, __const ucontext_t *__ucp)); We cannot say anything about the parameters FUNC takes; `void' is as good as any other choice. */ -extern void makecontext __P ((ucontext_t *__ucp, void (*__func) (void), - int __argc, ...)); +extern void makecontext (ucontext_t *__ucp, void (*__func) (void), + int __argc, ...) __THROW; + __END_DECLS -#endif #endif /* ucontext.h */ diff --git a/include/unistd.h b/include/unistd.h index 4364c88c4..47a60b135 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,20 +1,20 @@ -/* 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. */ /* * POSIX Standard: 2.10 Symbolic Constants <unistd.h> @@ -23,9 +23,7 @@ #ifndef _UNISTD_H #define _UNISTD_H 1 -#include <errno.h> #include <features.h> -#include <sys/types.h> __BEGIN_DECLS @@ -98,7 +96,7 @@ __BEGIN_DECLS _POSIX_JOB_CONTROL Job control is supported. _POSIX_SAVED_IDS Processes have a saved set-user-ID - and a saved set-group-ID. + and a saved set-group-ID. _POSIX_REALTIME_SIGNALS Real-time, queued signals are supported. _POSIX_PRIORITY_SCHEDULING Priority scheduling is supported. _POSIX_TIMERS POSIX.4 clocks and timers are supported. @@ -155,11 +153,11 @@ __BEGIN_DECLS for a specific file can be obtained from `pathconf' and `fpathconf'. _POSIX_CHOWN_RESTRICTED Only the super user can use `chown' to change - the owner of a file. `chown' can only be used + the owner of a file. `chown' can only be used to change the group ID of a file to a group of which the calling process is a member. _POSIX_NO_TRUNC Pathname components longer than - NAME_MAX generate an error. + NAME_MAX generate an error. _POSIX_VDISABLE If defined, if the value of an element of the `c_cc' member of `struct termios' is _POSIX_VDISABLE, no character will have the @@ -175,8 +173,6 @@ __BEGIN_DECLS */ #include <bits/posix_opt.h> -/* At this time, we don't do pthreads... Sorry... */ -#undef _POSIX_THREADS /* Get the environment definitions from Unix98. */ #ifdef __USE_UNIX98 @@ -193,9 +189,9 @@ __BEGIN_DECLS #include <bits/types.h> -#ifndef ssize_t +#ifndef __ssize_t_defined typedef __ssize_t ssize_t; -# define ssize_t ssize_t +# define __ssize_t_defined #endif #define __need_size_t @@ -205,41 +201,53 @@ typedef __ssize_t ssize_t; #ifdef __USE_XOPEN /* The Single Unix specification says that some more types are available here. */ -# ifndef gid_t +# ifndef __gid_t_defined typedef __gid_t gid_t; -# define gid_t gid_t +# define __gid_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 -# ifndef off_t +# ifndef __off_t_defined # ifndef __USE_FILE_OFFSET64 typedef __off_t off_t; # else typedef __off64_t off_t; # endif -# define off_t off_t +# define __off_t_defined # endif -# if defined __USE_LARGEFILE64 && !defined off64_t +# if defined __USE_LARGEFILE64 && !defined __off64_t_defined typedef __off64_t off64_t; -# define off64_t off64_t +# define __off64_t_defined # endif -# ifndef pid_t +# ifndef __useconds_t_defined +typedef __useconds_t useconds_t; +# define __useconds_t_defined +# endif + +# ifndef __pid_t_defined typedef __pid_t pid_t; -# define pid_t pid_t +# define __pid_t_defined # endif #endif /* X/Open */ -#ifdef __USE_UNIX98 -# ifndef intptr_t +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +# ifndef __intptr_t_defined typedef __intptr_t intptr_t; -# define intptr_t intptr_t +# define __intptr_t_defined +# endif +#endif + +#if defined __USE_BSD || defined __USE_XOPEN +# ifndef __socklen_t_defined +typedef __socklen_t socklen_t; +# define __socklen_t_defined # endif -#endif /* Unix98 */ +#endif /* Values for the second argument to access. These may be OR'd together. */ @@ -249,12 +257,13 @@ typedef __intptr_t intptr_t; #define F_OK 0 /* Test for existence. */ /* Test for access to NAME using the real UID and real GID. */ -extern int access __P ((__const char *__name, int __type)); +extern int access (__const char *__name, int __type) __THROW; -#ifdef __USE_GNU +#if 0 +//#ifdef __USE_GNU /* Test for access to NAME using the effective UID and GID (as normal file operations use). */ -extern int euidaccess __P ((__const char *__name, int __type)); +extern int euidaccess (__const char *__name, int __type) __THROW; #endif @@ -278,59 +287,46 @@ extern int euidaccess __P ((__const char *__name, int __type)); the current position (if WHENCE is SEEK_CUR), or the end of the file (if WHENCE is SEEK_END). Return the new file position. */ -extern __off_t __lseek __P ((int __fd, __off_t __offset, int __whence)); #ifndef __USE_FILE_OFFSET64 -extern __off_t lseek __P ((int __fd, __off_t __offset, int __whence)); +extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW; #else # ifdef __REDIRECT extern __off64_t __REDIRECT (lseek, - __P ((int __fd, __off64_t __offset, - int __whence)), + (int __fd, __off64_t __offset, int __whence) + __THROW, lseek64); # else # define lseek lseek64 # endif #endif #ifdef __USE_LARGEFILE64 -extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence)); +extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) __THROW; #endif /* Close the file descriptor FD. */ -extern int __close __P ((int __fd)); -extern int close __P ((int __fd)); +extern int close (int __fd) __THROW; /* Read NBYTES into BUF from FD. Return the number read, -1 for errors or 0 for EOF. */ -extern ssize_t __read __P ((int __fd, __ptr_t __buf, size_t __nbytes)); -extern ssize_t read __P ((int __fd, __ptr_t __buf, size_t __nbytes)); +extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __THROW; /* Write N bytes of BUF to FD. Return the number written, or -1. */ -extern ssize_t __write __P ((int __fd, __const __ptr_t __buf, size_t __n)); -extern ssize_t write __P ((int __fd, __const __ptr_t __buf, size_t __n)); +extern ssize_t write (int __fd, __const void *__buf, size_t __n) __THROW; #ifdef __USE_UNIX98 -/* Read NBYTES into BUF from FD at the given position OFFSET without - changing the file pointer. Return the number read, -1 for errors - or 0 for EOF. */ -extern ssize_t __pread64 __P ((int __fd, __ptr_t __buf, size_t __nbytes, - __off64_t __offset)); -/* Write N bytes of BUF to FD at the given position OFFSET without - changing the file pointer. Return the number written, or -1. */ -extern ssize_t __pwrite64 __P ((int __fd, __const __ptr_t __buf, size_t __n, - __off64_t __offset)); - # ifndef __USE_FILE_OFFSET64 -extern ssize_t pread __P ((int __fd, __ptr_t __buf, size_t __nbytes, - __off_t __offset)); -extern ssize_t pwrite __P ((int __fd, __const __ptr_t __buf, size_t __n, - __off_t __offset)); +extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) + __THROW; +extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n, + __off_t __offset) __THROW; # else # ifdef __REDIRECT -extern ssize_t __REDIRECT (pread, __P ((int __fd, __ptr_t __buf, - size_t __nbytes,__off64_t __offset)), +extern ssize_t __REDIRECT (pread, (int __fd, void *__buf, size_t __nbytes, + __off64_t __offset) __THROW, pread64); -extern ssize_t __REDIRECT (pwrite, __P ((int __fd, __const __ptr_t __buf, - size_t __nbytes, __off64_t __offset)), +extern ssize_t __REDIRECT (pwrite, (int __fd, __const void *__buf, + size_t __nbytes, __off64_t __offset) + __THROW, pwrite64); # else # define pread pread64 @@ -339,10 +335,15 @@ extern ssize_t __REDIRECT (pwrite, __P ((int __fd, __const __ptr_t __buf, # endif # ifdef __USE_LARGEFILE64 -extern ssize_t pread64 __P ((int __fd, __ptr_t __buf, size_t __nbytes, - __off64_t __offset)); -extern ssize_t pwrite64 __P ((int __fd, __const __ptr_t __buf, size_t __n, - __off64_t __offset)); +/* Read NBYTES into BUF from FD at the given position OFFSET without + changing the file pointer. Return the number read, -1 for errors + or 0 for EOF. */ +extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, + __off64_t __offset) __THROW; +/* Write N bytes of BUF to FD at the given position OFFSET without + changing the file pointer. Return the number written, or -1. */ +extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n, + __off64_t __offset) __THROW; # endif #endif @@ -350,7 +351,7 @@ extern ssize_t pwrite64 __P ((int __fd, __const __ptr_t __buf, size_t __n, If successful, two file descriptors are stored in PIPEDES; bytes written on PIPEDES[1] can be read from PIPEDES[0]. Returns 0 if successful, -1 if not. */ -extern int pipe __P ((int __pipedes[2])); +extern int pipe (int __pipedes[2]) __THROW; /* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. If SECONDS is zero, any currently scheduled alarm will be cancelled. @@ -359,7 +360,7 @@ extern int pipe __P ((int __pipedes[2])); There is no return value to indicate an error, but you can set `errno' to 0 and check its value after calling `alarm', and this might tell you. The signal may come late due to processor scheduling. */ -extern unsigned int alarm __P ((unsigned int __seconds)); +extern unsigned int alarm (unsigned int __seconds) __THROW; /* Make the process sleep for SECONDS seconds, or until a signal arrives and is not ignored. The function returns the number of seconds less @@ -368,49 +369,49 @@ extern unsigned int alarm __P ((unsigned int __seconds)); SIGALRM signal while inside `sleep' call, the handling of the SIGALRM signal afterwards is undefined. There is no return value to indicate error, but if `sleep' returns SECONDS, it probably didn't work. */ -extern unsigned int sleep __P ((unsigned int __seconds)); +extern unsigned int sleep (unsigned int __seconds) __THROW; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Set an alarm to go off (generating a SIGALRM signal) in VALUE microseconds. If INTERVAL is nonzero, when the alarm goes off, the timer is reset to go off every INTERVAL microseconds thereafter. Returns the number of microseconds remaining before the alarm. */ -extern unsigned int ualarm __P ((unsigned int __value, - unsigned int __interval)); +extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval) + __THROW; /* Sleep USECONDS microseconds, or until a signal arrives that is not blocked or ignored. */ -extern void usleep __P ((unsigned int __useconds)); +extern int usleep (__useconds_t __useconds) __THROW; #endif /* Suspend the process until a signal arrives. This always returns -1 and sets `errno' to EINTR. */ -extern int pause __P ((void)); +extern int pause (void) __THROW; /* Change the owner and group of FILE. */ -extern int chown __P ((__const char *__file, __uid_t __owner, - __gid_t __group)); +extern int chown (__const char *__file, __uid_t __owner, __gid_t __group) + __THROW; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Change the owner and group of the file that FD is open on. */ -extern int fchown __P ((int __fd, __uid_t __owner, __gid_t __group)); +extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW; /* Change owner and group of FILE, if it is a symbolic link the ownership of the symbolic link is changed. */ -extern int lchown __P ((__const char *__file, __uid_t __owner, - __gid_t __group)); +extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group) + __THROW; #endif /* Use BSD || X/Open Unix. */ /* Change the process's working directory to PATH. */ -extern int chdir __P ((__const char *__path)); +extern int chdir (__const char *__path) __THROW; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Change the process's working directory to the one FD is open on. */ -extern int fchdir __P ((int __fd)); +extern int fchdir (int __fd) __THROW; #endif /* Get the pathname of the current working directory, @@ -420,77 +421,80 @@ extern int fchdir __P ((int __fd)); an array is allocated with `malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */ -extern char *getcwd __P ((char *__buf, size_t __size)); +extern char *getcwd (char *__buf, size_t __size) __THROW; -#ifdef __USE_GNU +#if 0 +//#ifdef __USE_GNU /* Return a malloc'd string containing the current directory name. If the environment variable `PWD' is set, and its value is correct, that value is used. */ -extern char *get_current_dir_name __P ((void)); +extern char *get_current_dir_name (void) __THROW; #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Put the absolute pathname of the current working directory in BUF. If successful, return BUF. If not, put an error message in BUF and return NULL. BUF should be at least PATH_MAX bytes long. */ -extern char *getwd __P ((char *__buf)); +extern char *getwd (char *__buf) __THROW; #endif /* Duplicate FD, returning a new file descriptor on the same file. */ -extern int dup __P ((int __fd)); +extern int dup (int __fd) __THROW; /* Duplicate FD to FD2, closing FD2 and making it open on the same file. */ -extern int dup2 __P ((int __fd, int __fd2)); +extern int dup2 (int __fd, int __fd2) __THROW; /* NULL-terminated array of "NAME=VALUE" environment variables. */ extern char **__environ; +#ifdef __USE_GNU extern char **environ; +#endif /* Replace the current process, executing PATH with arguments ARGV and environment ENVP. ARGV and ENVP are terminated by NULL pointers. */ -extern int execve __P ((__const char *__path, char *__const __argv[], - char *__const __envp[])); +extern int execve (__const char *__path, char *__const __argv[], + char *__const __envp[]) __THROW; -#ifdef __USE_GNU +#if 0 +//#ifdef __USE_GNU /* Execute the file FD refers to, overlaying the running program image. ARGV and ENVP are passed to the new program, as for `execve'. */ -extern int fexecve __P ((int __fd, - char *__const __argv[], char *__const __envp[])); - +extern int fexecve (int __fd, char *__const __argv[], char *__const __envp[]) + __THROW; #endif /* Execute PATH with arguments ARGV and environment from `environ'. */ -extern int execv __P ((__const char *__path, char *__const __argv[])); +extern int execv (__const char *__path, char *__const __argv[]) __THROW; /* Execute PATH with all arguments after PATH until a NULL pointer, and the argument after that for environment. */ -extern int execle __P ((__const char *__path, __const char *__arg, ...)); +extern int execle (__const char *__path, __const char *__arg, ...) __THROW; /* Execute PATH with all arguments after PATH until a NULL pointer and environment from `environ'. */ -extern int execl __P ((__const char *__path, __const char *__arg, ...)); +extern int execl (__const char *__path, __const char *__arg, ...) __THROW; /* Execute FILE, searching in the `PATH' environment variable if it contains no slashes, with arguments ARGV and environment from `environ'. */ -extern int execvp __P ((__const char *__file, char *__const __argv[])); +extern int execvp (__const char *__file, char *__const __argv[]) __THROW; /* Execute FILE, searching in the `PATH' environment variable if it contains no slashes, with all arguments after FILE until a NULL pointer and environment from `environ'. */ -extern int execlp __P ((__const char *__file, __const char *__arg, ...)); +extern int execlp (__const char *__file, __const char *__arg, ...) __THROW; #if defined __USE_MISC || defined __USE_XOPEN /* Add INC to priority of the current process. */ -extern int nice __P ((int __inc)); +extern int nice (int __inc) __THROW; #endif /* Terminate program execution with the low-order 8 bits of STATUS. */ -extern void _exit __PMT ((int __status)) __attribute__ ((__noreturn__)); +extern void _exit (int __status) __attribute__ ((__noreturn__)); /* Get the `_PC_*' symbols for the NAME argument to `pathconf' and `fpathconf'; @@ -499,48 +503,49 @@ extern void _exit __PMT ((int __status)) __attribute__ ((__noreturn__)); #include <bits/confname.h> /* Get file-specific configuration information about PATH. */ -extern long int pathconf __P ((__const char *__path, int __name)); +extern long int pathconf (__const char *__path, int __name) __THROW; /* Get file-specific configuration about descriptor FD. */ -extern long int fpathconf __P ((int __fd, int __name)); +extern long int fpathconf (int __fd, int __name) __THROW; /* Get the value of the system variable NAME. */ -extern long int sysconf __P ((int __name)); +extern long int sysconf (int __name) __THROW __attribute__ ((__const__)); #ifdef __USE_POSIX2 /* Get the value of the string-valued system variable NAME. */ -extern size_t confstr __P ((int __name, char *__buf, size_t __len)); +extern size_t confstr (int __name, char *__buf, size_t __len) __THROW; #endif /* Get the process ID of the calling process. */ -extern __pid_t __getpid __P ((void)); -extern __pid_t getpid __P ((void)); +extern __pid_t getpid (void) __THROW; /* Get the process ID of the calling process's parent. */ -extern __pid_t getppid __P ((void)); +extern __pid_t getppid (void) __THROW; /* Get the process group ID of the calling process. This function is different on old BSD. */ #ifndef __FAVOR_BSD -extern __pid_t getpgrp __P ((void)); +extern __pid_t getpgrp (void) __THROW; #else -//# ifdef __REDIRECT -//extern __pid_t __REDIRECT (getpgrp, __P ((__pid_t __pid)), __getpgid); -//# else -# define getpgrp getpgid -//# endif +# ifdef __REDIRECT +extern __pid_t __REDIRECT (getpgrp, (__pid_t __pid) __THROW, __getpgid); +# else +# define getpgrp __getpgid +# endif #endif /* Get the process group ID of process PID. */ -extern __pid_t getpgid __P ((__pid_t __pid)); +extern __pid_t __getpgid (__pid_t __pid) __THROW; +#ifdef __USE_XOPEN_EXTENDED +extern __pid_t getpgid (__pid_t __pid) __THROW; +#endif /* Set the process group ID of the process matching PID to PGID. If PID is zero, the current process's process group ID is set. If PGID is zero, the process ID of the process is used. */ -extern int __setpgid __P ((__pid_t __pid, __pid_t __pgid)); -extern int setpgid __P ((__pid_t __pid, __pid_t __pgid)); +extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW; #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Both System V and BSD have `setpgrp' functions, but with different @@ -557,13 +562,13 @@ extern int setpgid __P ((__pid_t __pid, __pid_t __pgid)); /* Set the process group ID of the calling process to its own PID. This is exactly the same as `setpgid (0, 0)'. */ -extern int setpgrp __P ((void)); +extern int setpgrp (void) __THROW; # else /* Another name for `setpgid' (above). */ # ifdef __REDIRECT -extern int __REDIRECT (setpgrp, __P ((__pid_t __pid, __pid_t __pgrp)), +extern int __REDIRECT (setpgrp, (__pid_t __pid, __pid_t __pgrp) __THROW, setpgid); # else # define setpgrp setpgid @@ -575,146 +580,145 @@ extern int __REDIRECT (setpgrp, __P ((__pid_t __pid, __pid_t __pgrp)), /* Create a new session with the calling process as its leader. The process group IDs of the session and the calling process are set to the process ID of the calling process, which is returned. */ -extern __pid_t setsid __P ((void)); +extern __pid_t setsid (void) __THROW; #ifdef __USE_XOPEN_EXTENDED /* Return the session ID of the given process. */ -extern __pid_t getsid __P ((__pid_t __pid)); +extern __pid_t getsid (__pid_t __pid) __THROW; #endif /* Get the real user ID of the calling process. */ -extern __uid_t getuid __P ((void)); +extern __uid_t getuid (void) __THROW; /* Get the effective user ID of the calling process. */ -extern __uid_t geteuid __P ((void)); +extern __uid_t geteuid (void) __THROW; /* Get the real group ID of the calling process. */ -extern __gid_t getgid __P ((void)); +extern __gid_t getgid (void) __THROW; /* Get the effective group ID of the calling process. */ -extern __gid_t getegid __P ((void)); +extern __gid_t getegid (void) __THROW; /* If SIZE is zero, return the number of supplementary groups the calling process is in. Otherwise, fill in the group IDs of its supplementary groups in LIST and return the number written. */ -extern int getgroups __P ((int __size, __gid_t __list[])); +extern int getgroups (int __size, __gid_t __list[]) __THROW; -#ifdef __USE_GNU +#if 0 +//#ifdef __USE_GNU /* Return nonzero iff the calling process is in group GID. */ -extern int group_member __P ((__gid_t __gid)); +extern int group_member (__gid_t __gid) __THROW; #endif /* Set the user ID of the calling process to UID. If the calling process is the super-user, set the real and effective user IDs, and the saved set-user-ID to UID; if not, the effective user ID is set to UID. */ -extern int setuid __P ((__uid_t __uid)); +extern int setuid (__uid_t __uid) __THROW; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Set the real user ID of the calling process to RUID, and the effective user ID of the calling process to EUID. */ -extern int setreuid __P ((__uid_t __ruid, __uid_t __euid)); +extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW; #endif -#ifdef __USE_BSD +#if defined __USE_BSD || defined __USE_XOPEN2K /* Set the effective user ID of the calling process to UID. */ -extern int seteuid __P ((__uid_t __uid)); +extern int seteuid (__uid_t __uid) __THROW; #endif /* Use BSD. */ /* Set the group ID of the calling process to GID. If the calling process is the super-user, set the real and effective group IDs, and the saved set-group-ID to GID; if not, the effective group ID is set to GID. */ -extern int setgid __P ((__gid_t __gid)); +extern int setgid (__gid_t __gid) __THROW; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Set the real group ID of the calling process to RGID, and the effective group ID of the calling process to EGID. */ -extern int setregid __P ((__gid_t __rgid, __gid_t __egid)); +extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW; #endif -#ifdef __USE_BSD +#if defined __USE_BSD || defined __USE_XOPEN2K /* Set the effective group ID of the calling process to GID. */ -extern int setegid __P ((__gid_t __gid)); +extern int setegid (__gid_t __gid) __THROW; #endif /* Use BSD. */ /* Clone the calling process, creating an exact copy. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */ -#ifdef __UCLIBC_HAS_MMU__ -extern __pid_t fork __P ((void)); -#else -#define fork fork_not_available_on_mmuless_systems__use_vfork -#endif +extern __pid_t fork (void) __THROW; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is replaced by a call to `execve'. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */ -extern __pid_t vfork __P ((void)); +extern __pid_t vfork (void) __THROW; #endif /* Use BSD. */ /* Return the pathname of the terminal FD is open on, or NULL on errors. The returned storage is good only until the next call to this function. */ -extern char *ttyname __P ((int __fd)); +extern char *ttyname (int __fd) __THROW; /* Store at most BUFLEN characters of the pathname of the terminal FD is open on in BUF. Return 0 on success, otherwise an error number. */ -extern int ttyname_r __P ((int __fd, char *__buf, size_t __buflen)); +extern int ttyname_r (int __fd, char *__buf, size_t __buflen) __THROW; /* Return 1 if FD is a valid descriptor associated with a terminal, zero if not. */ -extern int isatty __P ((int __fd)); +extern int isatty (int __fd) __THROW; -#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +#if defined __USE_BSD \ + || (defined __USE_XOPEN_EXTENDED && !defined __USE_UNIX98) /* Return the index into the active-logins file (utmp) for the controlling terminal. */ -extern int ttyslot __P ((void)); +extern int ttyslot (void) __THROW; #endif /* Make a link to FROM named TO. */ -extern int link __P ((__const char *__from, __const char *__to)); +extern int link (__const char *__from, __const char *__to) __THROW; #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Make a symbolic link to FROM named TO. */ -extern int symlink __P ((__const char *__from, __const char *__to)); +extern int symlink (__const char *__from, __const char *__to) __THROW; /* Read the contents of the symbolic link PATH into no more than LEN bytes of BUF. The contents are not null-terminated. Returns the number of characters read, or -1 for errors. */ -extern int readlink __P ((__const char *__path, char *__buf, size_t __len)); +extern int readlink (__const char *__restrict __path, char *__restrict __buf, + size_t __len) __THROW; #endif /* Use BSD. */ /* Remove the link NAME. */ -extern int unlink __P ((__const char *__name)); +extern int unlink (__const char *__name) __THROW; /* Remove the directory PATH. */ -extern int rmdir __P ((__const char *__path)); +extern int rmdir (__const char *__path) __THROW; /* Return the foreground process group ID of FD. */ -extern __pid_t tcgetpgrp __P ((int __fd)); +extern __pid_t tcgetpgrp (int __fd) __THROW; /* Set the foreground process group ID of FD set PGRP_ID. */ -extern int tcsetpgrp __P ((int __fd, __pid_t __pgrp_id)); +extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW; /* Return the login name of the user. */ -extern char *getlogin __P ((void)); -#ifdef __USE_REENTRANT +extern char *getlogin (void) __THROW; +#if defined __USE_REENTRANT || defined __USE_UNIX98 /* Return at most NAME_LEN characters of the login name of the user in NAME. If it cannot be determined or some other error occurred, return the error code. Otherwise return 0. */ -extern int getlogin_r __P ((char *__name, size_t __name_len)); +extern int getlogin_r (char *__name, size_t __name_len) __THROW; #endif #ifdef __USE_BSD /* Set the login name returned by `getlogin'. */ -extern int setlogin __P ((__const char *__name)); +extern int setlogin (__const char *__name) __THROW; #endif @@ -727,40 +731,38 @@ extern int setlogin __P ((__const char *__name)); #endif -#if defined __USE_BSD || defined __USE_XOPEN - +#if defined __USE_BSD || defined __USE_XOPEN2K /* Put the name of the current host in no more than LEN bytes of NAME. The result is null-terminated if LEN is large enough for the full name and the terminator. */ -extern int gethostname __P ((char *__name, size_t __len)); +extern int gethostname (char *__name, size_t __len) __THROW; +#endif + +#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98) /* Set the name of the current host to NAME, which is LEN bytes long. This call is restricted to the super-user. */ -extern int sethostname __P ((__const char *__name, size_t __len)); +extern int sethostname (__const char *__name, size_t __len) __THROW; /* Set the current machine's Internet number to ID. This call is restricted to the super-user. */ -extern int sethostid __P ((long int __id)); +extern int sethostid (long int __id) __THROW; /* Get and set the NIS (aka YP) domain name, if any. Called just like `gethostname' and `sethostname'. The NIS domain name is usually the empty string when not using NIS. */ -extern int getdomainname __P ((char *__name, size_t __len)); -extern int setdomainname __P ((__const char *__name, size_t __len)); - - -/* Make all changes done to FD actually appear on disk. */ -extern int fsync __P ((int __fd)); +extern int getdomainname (char *__name, size_t __len) __THROW; +extern int setdomainname (__const char *__name, size_t __len) __THROW; /* Revoke access permissions to all processes currently communicating with the control terminal, and then send a SIGHUP signal to the process group of the control terminal. */ -extern int vhangup __P ((void)); +extern int vhangup (void) __THROW; /* Revoke the access of all descriptors currently open on FILE. */ -extern int revoke __P ((__const char *__file)); +extern int revoke (__const char *__file) __THROW; /* Enable statistical profiling, writing samples of the PC into at most @@ -768,89 +770,95 @@ extern int revoke __P ((__const char *__file)); is enabled, the system examines the user PC and increments SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero, disable profiling. Returns zero on success, -1 on error. */ -extern int profil __P ((unsigned short int *__sample_buffer, size_t __size, - size_t __offset, unsigned int __scale)); +extern int profil (unsigned short int *__sample_buffer, size_t __size, + size_t __offset, unsigned int __scale) __THROW; /* Turn accounting on if NAME is an existing file. The system will then write a record for each process as it terminates, to this file. If NAME is NULL, turn accounting off. This call is restricted to the super-user. */ -extern int acct __P ((__const char *__name)); - -/* Make PATH be the root directory (the starting point for absolute paths). - This call is restricted to the super-user. */ -extern int chroot __P ((__const char *__path)); +extern int acct (__const char *__name) __THROW; /* Successive calls return the shells listed in `/etc/shells'. */ -extern char *getusershell __P ((void)); -extern void endusershell __P ((void)); /* Discard cached info. */ -extern void setusershell __P ((void)); /* Rewind and re-read the file. */ - +extern char *getusershell (void) __THROW; +extern void endusershell (void) __THROW; /* Discard cached info. */ +extern void setusershell (void) __THROW; /* Rewind and re-read the file. */ -/* Prompt with PROMPT and read a string from the terminal without echoing. - Uses /dev/tty if possible; otherwise stderr and stdin. */ -extern char *getpass __P ((__const char *__prompt)); /* Put the program in the background, and dissociate from the controlling terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, redirects stdin, stdout, and stderr to /dev/null. */ -extern int daemon __P ((int __nochdir, int __noclose)); +extern int daemon (int __nochdir, int __noclose) __THROW; +#endif /* Use BSD || X/Open. */ + + +#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +/* Make PATH be the root directory (the starting point for absolute paths). + This call is restricted to the super-user. */ +extern int chroot (__const char *__path) __THROW; + +/* Prompt with PROMPT and read a string from the terminal without echoing. + Uses /dev/tty if possible; otherwise stderr and stdin. */ +extern char *getpass (__const char *__prompt) __THROW; +#endif /* Use BSD || X/Open. */ + +#if defined __USE_BSD || defined __USE_XOPEN +/* Make all changes done to FD actually appear on disk. */ +extern int fsync (int __fd) __THROW; #endif /* Use BSD || X/Open. */ #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Return the current machine's Internet number. */ -extern long int gethostid __P ((void)); +extern long int gethostid (void) __THROW; /* Make all changes done to all files actually appear on disk. */ -extern int sync __P ((void)); +extern void sync (void) __THROW; /* Return the number of bytes in a page. This is the system's page size, which is not necessarily the same as the hardware page size. */ -extern int __getpagesize __P ((void)) __attribute__ ((__const__)); -extern int getpagesize __P ((void)) __attribute__ ((__const__)); +extern int getpagesize (void) __THROW __attribute__ ((__const__)); /* Truncate FILE to LENGTH bytes. */ -#ifndef __USE_FILE_OFFSET64 -extern int truncate __P ((__const char *__file, __off_t __length)); -#else -# ifdef __REDIRECT +# ifndef __USE_FILE_OFFSET64 +extern int truncate (__const char *__file, __off_t __length) __THROW; +# else +# ifdef __REDIRECT extern int __REDIRECT (truncate, - __P ((__const char *__file, __off64_t __length)), + (__const char *__file, __off64_t __length) __THROW, truncate64); -# else -# define truncate truncate64 +# else +# define truncate truncate64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int truncate64 (__const char *__file, __off64_t __length) __THROW; # endif -#endif -#ifdef __USE_LARGEFILE64 -extern int truncate64 __P ((__const char *__file, __off64_t __length)); -#endif /* Truncate the file FD is open on to LENGTH bytes. */ -extern int __ftruncate __P ((int __fd, __off_t __length)); -#ifndef __USE_FILE_OFFSET64 -extern int ftruncate __P ((int __fd, __off_t __length)); -#else -# ifdef __REDIRECT -extern int __REDIRECT (ftruncate, __P ((int __fd, __off64_t __length)), - ftruncate64); +# ifndef __USE_FILE_OFFSET64 +extern int ftruncate (int __fd, __off_t __length) __THROW; # else -# define ftruncate ftruncate64 +# ifdef __REDIRECT +extern int __REDIRECT (ftruncate, (int __fd, __off64_t __length) __THROW, + ftruncate64); +# else +# define ftruncate ftruncate64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int ftruncate64 (int __fd, __off64_t __length) __THROW; # endif -#endif -#ifdef __USE_LARGEFILE64 -extern int ftruncate64 __P ((int __fd, __off64_t __length)); -#endif /* Return the maximum number of file descriptors the current process could possibly have. */ -extern int getdtablesize __P ((void)); +extern int getdtablesize (void) __THROW; #endif /* Use BSD || X/Open Unix. */ @@ -859,18 +867,13 @@ extern int getdtablesize __P ((void)); /* Set the end of accessible data space (aka "the break") to ADDR. Returns zero on success and -1 for errors (with errno set). */ -extern int brk __P ((__ptr_t __addr)); - -# define __need_ptrdiff_t -# include <stddef.h> +extern int brk (void *__addr) __THROW; /* Increase or decrease the end of accessible data space by DELTA bytes. If successful, returns the address the previous end of data space (i.e. the beginning of the new space, if DELTA > 0); returns (void *) -1 for errors (with errno set). */ -#define ptrdiff_t int -extern __ptr_t __sbrk __P ((ptrdiff_t __delta)); -extern __ptr_t sbrk __P ((ptrdiff_t __delta)); +extern void *sbrk (intptr_t __delta) __THROW; #endif @@ -885,7 +888,7 @@ extern __ptr_t sbrk __P ((ptrdiff_t __delta)); In Mach, all system calls take normal arguments and always return an error code (zero for success). */ -extern long int syscall __P ((long int __sysno, ...)); +extern long int syscall (long int __sysno, ...) __THROW; #endif /* Use misc. */ @@ -905,17 +908,17 @@ extern long int syscall __P ((long int __sysno, ...)); # 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 /* Use misc and F_LOCK not already defined. */ @@ -930,22 +933,13 @@ extern int lockf64 __P ((int __fd, int __cmd, __off64_t __len)); ({ long int __result; \ do __result = (long int) (expression); \ while (__result == -1L && errno == EINTR); \ - __result; })) \ - - -/* This variable is set nonzero at startup if the process's effective - IDs differ from its real IDs, or it is otherwise indicated that - extra security should be used. When this is set the dynamic linker - and some functions contained in the C library ignore various - environment variables that normally affect them. */ -extern int __libc_enable_secure; - + __result; })) #endif #if defined __USE_POSIX199309 || defined __USE_UNIX98 /* Synchronize at least the data part of a file with the underlying media. */ -extern int fdatasync __P ((int __fildes)); +extern int fdatasync (int __fildes) __THROW; #endif /* Use POSIX199309 */ @@ -953,36 +947,27 @@ extern int fdatasync __P ((int __fildes)); be defined here. */ #ifdef __USE_XOPEN /* Encrypt at most 8 characters from KEY using salt to perturb DES. */ -extern char *crypt __P ((__const char *__key, __const char *__salt)); - -/* Setup DES tables according KEY. */ -extern void setkey __P ((__const char *__key)); +extern char *crypt (__const char *__key, __const char *__salt) __THROW; /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt block in place. */ -extern void encrypt __P ((char *__block, int __edflag)); +extern void encrypt (char *__block, int __edflag) __THROW; /* Swab pairs bytes in the first N bytes of the area pointed to by FROM and copy the result to TO. The value of TO must not be in the range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM is without partner. */ -extern void swab __P ((__const __ptr_t __from, __ptr_t __to, ssize_t __n)); +extern void swab (__const void *__restrict __from, void *__restrict __to, + ssize_t __n) __THROW; #endif -/* The Single Unix specification, version 2, demands these prototypes - to be here. They are also found in <stdio.h>. */ +/* The Single Unix specification demands this prototype to be here. + It is also found in <stdio.h>. */ #ifdef __USE_XOPEN /* Return the name of the controlling terminal. */ -extern char *ctermid __P ((char *__s)); - -/* Return the name of the current user. This function should not be - used and might go away some time. */ -extern char *cuserid __P ((char *__s)); - -/* Rename file OLD to NEW. */ -extern int rename __P ((__const char *__old, __const char *__new)); +extern char *ctermid (char *__s) __THROW; #endif @@ -999,9 +984,9 @@ extern int rename __P ((__const char *__old, __const char *__new)); handlers are called in LIFO order (last added with PTHREAD_ATFORK, first called before FORK), and the PARENT and CHILD handlers are called in FIFO (first added, first called). */ -extern int pthread_atfork __P ((void (*__prepare) (void), - void (*__parent) (void), - void (*__child) (void))); +extern int pthread_atfork (void (*__prepare) (void), + void (*__parent) (void), + void (*__child) (void)) __THROW; #endif __END_DECLS diff --git a/include/utime.h b/include/utime.h index d2e42b275..068769649 100644 --- a/include/utime.h +++ b/include/utime.h @@ -1,19 +1,51 @@ -#ifndef __UTIME_H -#define __UTIME_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. */ + +/* + * POSIX Standard: 5.6.6 Set File Access and Modification Times <utime.h> + */ + +#ifndef _UTIME_H +#define _UTIME_H 1 #include <features.h> -#include <sys/types.h> __BEGIN_DECLS -struct utimbuf { - time_t actime; - time_t modtime; -}; +#include <bits/types.h> -extern int utime __P ((const char *__filename, struct utimbuf *__utimebuf)); +#ifdef __USE_XOPEN +# define __need_time_t +# include <time.h> +#endif -__END_DECLS +/* Structure describing file times. */ +struct utimbuf + { + __time_t actime; /* Access time. */ + __time_t modtime; /* Modification time. */ + }; -#endif +/* Set the access and modification times of FILE to those given in + *FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */ +extern int utime (__const char *__file, + __const struct utimbuf *__file_times) __THROW; + +__END_DECLS +#endif /* utime.h */ diff --git a/include/utmp.h b/include/utmp.h index a9d5f53eb..64b10889b 100644 --- a/include/utmp.h +++ b/include/utmp.h @@ -1,60 +1,97 @@ -/* utmp.h */ +/* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. -#ifndef __UTMP_H -#define __UTMP_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. + + 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 _UTMP_H +#define _UTMP_H 1 #include <features.h> + #include <sys/types.h> -#include <paths.h> -#include <time.h> -#define UT_UNKNOWN 0 -#define UT_LINESIZE 12 -#define UT_NAMESIZE 8 -#define UT_HOSTSIZE 16 -#define RUN_LVL 1 -#define BOOT_TIME 2 -#define NEW_TIME 3 -#define OLD_TIME 4 +__BEGIN_DECLS -#define INIT_PROCESS 5 -#define LOGIN_PROCESS 6 -#define USER_PROCESS 7 -#define DEAD_PROCESS 8 +/* Get system dependent values and data structures. */ +#include <bits/utmp.h> -__BEGIN_DECLS +/* Compatibility names for the strings of the canonical file names. */ +#define UTMP_FILE _PATH_UTMP +#define UTMP_FILENAME _PATH_UTMP +#define WTMP_FILE _PATH_WTMP +#define WTMP_FILENAME _PATH_WTMP -struct utmp -{ - short ut_type; /* type of login */ - pid_t ut_pid; /* pid of login-process */ - char ut_line[UT_LINESIZE]; /* devicename of tty -"/dev/", null-term */ - char ut_id[2]; /* abbrev. ttyname, as 01, s1 etc. */ - time_t ut_time; /* login time */ -#define ut_name ut_user /* Backwards compatibility hack */ - char ut_user[UT_NAMESIZE]; /* username, not null-term */ - char ut_host[UT_HOSTSIZE]; /* hostname for remote login... */ - long ut_addr; /* IP addr of remote host */ - -}; - -extern void setutent __P ((void)); -extern void utmpname __P ((__const char *)); -extern struct utmp * getutent __P ((void)); -extern struct utmp * getutid __P ((struct utmp *)); -extern struct utmp * getutline __P ((struct utmp *)); -extern struct utmp * pututline __P ((struct utmp *)); -extern void endutent __P ((void)); -extern int login_tty (int __fd); -extern void login (const struct utmp *entry); -extern void logwtmp (const char *line, const char *name, const char *host); - -#ifdef _LIBC -struct utmp * __getutent __P ((int)); -#endif -__END_DECLS -#endif /* __UTMP_H */ +/* Make FD be the controlling terminal, stdin, stdout, and stderr; + then close FD. Returns 0 on success, nonzero on error. */ +extern int login_tty (int __fd) __THROW; + + +/* Write the given entry into utmp and wtmp. */ +extern void login (__const struct utmp *__entry) __THROW; + +/* Write the utmp entry to say the user on UT_LINE has logged out. */ +extern int logout (__const char *__ut_line) __THROW; + +/* Append to wtmp an entry for the current time and the given info. */ +extern void logwtmp (__const char *__ut_line, __const char *__ut_name, + __const char *__ut_host) __THROW; + +/* Append entry UTMP to the wtmp-like file WTMP_FILE. */ +extern void updwtmp (__const char *__wtmp_file, __const struct utmp *__utmp) + __THROW; + +/* Change name of the utmp file to be examined. */ +extern int utmpname (__const char *__file) __THROW; + +/* Read next entry from a utmp-like file. */ +extern struct utmp *getutent (void) __THROW; + +/* Reset the input stream to the beginning of the file. */ +extern void setutent (void) __THROW; + +/* Close the current open file. */ +extern void endutent (void) __THROW; + +/* Search forward from the current point in the utmp file until the + next entry with a ut_type matching ID->ut_type. */ +extern struct utmp *getutid (__const struct utmp *__id) __THROW; + +/* Search forward from the current point in the utmp file until the + next entry with a ut_line matching LINE->ut_line. */ +extern struct utmp *getutline (__const struct utmp *__line) __THROW; + +/* Write out entry pointed to by UTMP_PTR into the utmp file. */ +extern struct utmp *pututline (__const struct utmp *__utmp_ptr) __THROW; + + +#ifdef __USE_MISC +/* Reentrant versions of the file for handling utmp files. */ +extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW; + +extern int getutid_r (__const struct utmp *__id, struct utmp *__buffer, + struct utmp **__result) __THROW; + +extern int getutline_r (__const struct utmp *__line, + struct utmp *__buffer, struct utmp **__result) __THROW; + +#endif /* Use misc. */ + +__END_DECLS +#endif /* utmp.h */ diff --git a/include/va-sh.h b/include/va-sh.h deleted file mode 100644 index d891c171f..000000000 --- a/include/va-sh.h +++ /dev/null @@ -1,202 +0,0 @@ -/* This is just like the default gvarargs.h - except for differences described below. */ - -/* Define __gnuc_va_list. */ - -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST - -#ifdef __SH3E__ - -typedef long __va_greg; -typedef double __va_freg; - -typedef struct { - __va_greg * __va_next_o; /* next available register */ - __va_greg * __va_next_o_limit; /* past last available register */ - __va_freg * __va_next_fp; /* next available fp register */ - __va_freg * __va_next_fp_limit; /* last available fp register */ - __va_greg * __va_next_stack; /* next extended word on stack */ -} __gnuc_va_list; - -#else /* ! SH3E */ - -typedef void *__gnuc_va_list; - -#endif /* ! SH3E */ - -#endif /* __GNUC_VA_LIST */ - -/* If this is for internal libc use, don't define anything but - __gnuc_va_list. */ -#if defined (_STDARG_H) || defined (_VARARGS_H) - -#ifdef _STDARG_H - -#ifdef __SH3E__ - -#define va_start(AP, LASTARG) \ -__extension__ \ - ({ \ - AP.__va_next_fp = (__va_freg *) __builtin_saveregs (); \ - AP.__va_next_fp_limit = (AP.__va_next_fp + \ - (__builtin_args_info (1) < 8 ? 8 - __builtin_args_info (1) : 0)); \ - AP.__va_next_o = (__va_greg *) AP.__va_next_fp_limit; \ - AP.__va_next_o_limit = (AP.__va_next_o + \ - (__builtin_args_info (0) < 4 ? 4 - __builtin_args_info (0) : 0)); \ - AP.__va_next_stack = (__va_greg *) __builtin_next_arg (LASTARG); \ - }) - -#else /* ! SH3E */ - -#define va_start(AP, LASTARG) \ -do { \ - __builtin_saveregs();\ - (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))); \ -} while (0) - -#endif /* ! SH3E */ - -#else /* _VARARGS_H */ - -#define va_alist __builtin_va_alist -#define va_dcl int __builtin_va_alist;... - -#ifdef __SH3E__ - -#define va_start(AP) \ -__extension__ \ - ({ \ - AP.__va_next_fp = (__va_freg *) __builtin_saveregs (); \ - AP.__va_next_fp_limit = (AP.__va_next_fp + \ - (__builtin_args_info (1) < 8 ? 8 - __builtin_args_info (1) : 0)); \ - AP.__va_next_o = (__va_greg *) AP.__va_next_fp_limit; \ - AP.__va_next_o_limit = (AP.__va_next_o + \ - (__builtin_args_info (0) < 4 ? 4 - __builtin_args_info (0) : 0)); \ - AP.__va_next_stack = (__va_greg *) __builtin_next_arg (__builtin_va_alist) \ - - (__builtin_args_info (0) >= 4 || __builtin_args_info (1) >= 8 ? 1 : 0); \ - }) - -#else /* ! SH3E */ - -#define va_start(AP) AP=(char *) &__builtin_va_alist - -#endif /* ! SH3E */ - -#endif /* _STDARG */ - -#ifndef va_end -void va_end (__gnuc_va_list); /* Defined in libgcc.a */ - -/* Values returned by __builtin_classify_type. */ - -enum __va_type_classes { - __no_type_class = -1, - __void_type_class, - __integer_type_class, - __char_type_class, - __enumeral_type_class, - __boolean_type_class, - __pointer_type_class, - __reference_type_class, - __offset_type_class, - __real_type_class, - __complex_type_class, - __function_type_class, - __method_type_class, - __record_type_class, - __union_type_class, - __array_type_class, - __string_type_class, - __set_type_class, - __file_type_class, - __lang_type_class -}; - -#endif -#define va_end(pvar) ((void)0) - -#ifdef __LITTLE_ENDIAN__ -#define __LITTLE_ENDIAN_P 1 -#else -#define __LITTLE_ENDIAN_P 0 -#endif - -#define __SCALAR_TYPE(TYPE) \ - ((TYPE) == __integer_type_class \ - || (TYPE) == __char_type_class \ - || (TYPE) == __enumeral_type_class) - -/* RECORD_TYPE args passed using the C calling convention are - passed by invisible reference. ??? RECORD_TYPE args passed - in the stack are made to be word-aligned; for an aggregate that is - not word-aligned, we advance the pointer to the first non-reg slot. */ - - /* When this is a smaller-than-int integer, using - auto-increment in the promoted (SImode) is fastest; - however, there is no way to express that is C. Therefore, - we use an asm. - We want the MEM_IN_STRUCT_P bit set in the emitted RTL, therefore we - use unions even when it would otherwise be unnecessary. */ - -#define __va_arg_sh1(AP, TYPE) __extension__ \ -__extension__ \ -({(sizeof (TYPE) == 1 \ - ? ({union {TYPE t; char c;} __t; \ - __asm("" \ - : "=r" (__t.c) \ - : "0" ((((union { int i, j; } *) (AP))++)->i)); \ - __t.t;}) \ - : sizeof (TYPE) == 2 \ - ? ({union {TYPE t; short s;} __t; \ - __asm("" \ - : "=r" (__t.s) \ - : "0" ((((union { int i, j; } *) (AP))++)->i)); \ - __t.t;}) \ - : sizeof (TYPE) >= 4 || __LITTLE_ENDIAN_P \ - ? (((union { TYPE t; int i;} *) (AP))++)->t \ - : ((union {TYPE t;TYPE u;}*) ((char *)++(int *)(AP) - sizeof (TYPE)))->t);}) - -#ifdef __SH3E__ - -#define __PASS_AS_FLOAT(TYPE_CLASS,SIZE) \ - (TYPE_CLASS == __real_type_class && SIZE == 4) - -#define va_arg(pvar,TYPE) \ -__extension__ \ -({int __type = __builtin_classify_type (* (TYPE *) 0); \ - void * __result_p; \ - if (__PASS_AS_FLOAT (__type, sizeof(TYPE))) \ - { \ - if (pvar.__va_next_fp < pvar.__va_next_fp_limit) \ - { \ - __result_p = &pvar.__va_next_fp; \ - } \ - else \ - __result_p = &pvar.__va_next_stack; \ - } \ - else \ - { \ - if (pvar.__va_next_o + ((sizeof (TYPE) + 3) / 4) \ - <= pvar.__va_next_o_limit) \ - __result_p = &pvar.__va_next_o; \ - else \ - { \ - if (sizeof (TYPE) > 4) \ - pvar.__va_next_o = pvar.__va_next_o_limit; \ - \ - __result_p = &pvar.__va_next_stack; \ - } \ - } \ - __va_arg_sh1(*(void **)__result_p, TYPE);}) - -#else /* ! SH3E */ - -#define va_arg(AP, TYPE) __va_arg_sh1((AP), TYPE) - -#endif /* SH3E */ - -/* Copy __gnuc_va_list into another variable of this type. */ -#define __va_copy(dest, src) (dest) = (src) - -#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/include/wait.h b/include/wait.h index cdb77149f..d01b81125 100644 --- a/include/wait.h +++ b/include/wait.h @@ -1,3 +1 @@ -/* SVR4 ABI requires <wait.h> rather than <sys/wait.h> */ - #include <sys/wait.h> |