mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
Imported glibc headers to contrib
This commit is contained in:
parent
8e4bb58c4c
commit
90b3a1435a
@ -236,6 +236,8 @@ if (OS_LINUX AND NOT UNBUNDLED AND (GLIBC_COMPATIBILITY OR USE_LIBCXX))
|
||||
|
||||
# FIXME: glibc-compatibility may be non-static in some builds!
|
||||
set (DEFAULT_LIBS "${DEFAULT_LIBS} ${ClickHouse_BINARY_DIR}/libs/libglibc-compatibility/libglibc-compatibility${${CMAKE_POSTFIX_VARIABLE}}.a")
|
||||
|
||||
include_directories (SYSTEM ${ClickHouse_SOURCE_DIR}/contrib/libc-headers/x86_64-linux-gnu ${ClickHouse_SOURCE_DIR}/contrib/libc-headers)
|
||||
endif ()
|
||||
|
||||
# Add Libc. GLIBC is actually a collection of interdependent libraries.
|
||||
|
40
contrib/libc-headers/alloca.h
Normal file
40
contrib/libc-headers/alloca.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 1992-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _ALLOCA_H
|
||||
#define _ALLOCA_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Remove any previous definitions. */
|
||||
#undef alloca
|
||||
|
||||
/* Allocate a block that will be freed when the calling function exits. */
|
||||
extern void *alloca (size_t __size) __THROW;
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define alloca(size) __builtin_alloca (size)
|
||||
#endif /* GCC. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* alloca.h */
|
156
contrib/libc-headers/argz.h
Normal file
156
contrib/libc-headers/argz.h
Normal file
@ -0,0 +1,156 @@
|
||||
/* Routines for dealing with '\0' separated arg vectors.
|
||||
Copyright (C) 1995-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _ARGZ_H
|
||||
#define _ARGZ_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <errno.h>
|
||||
#include <string.h> /* Need size_t, and strchr is called below. */
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* error_t may or may not be available from errno.h, depending on the
|
||||
operating system. */
|
||||
#ifndef __error_t_defined
|
||||
# define __error_t_defined 1
|
||||
typedef int error_t;
|
||||
#endif
|
||||
|
||||
/* Make a '\0' separated arg vector from a unix argv vector, returning it in
|
||||
ARGZ, and the total length in LEN. If a memory allocation error occurs,
|
||||
ENOMEM is returned, otherwise 0. The result can be destroyed using free. */
|
||||
extern error_t __argz_create (char *const __argv[], char **__restrict __argz,
|
||||
size_t *__restrict __len) __THROW;
|
||||
extern error_t argz_create (char *const __argv[], char **__restrict __argz,
|
||||
size_t *__restrict __len) __THROW;
|
||||
|
||||
/* Make a '\0' separated arg vector from a SEP separated list in
|
||||
STRING, returning it in ARGZ, and the total length in LEN. If a
|
||||
memory allocation error occurs, ENOMEM is returned, otherwise 0.
|
||||
The result can be destroyed using free. */
|
||||
extern error_t argz_create_sep (const char *__restrict __string,
|
||||
int __sep, char **__restrict __argz,
|
||||
size_t *__restrict __len) __THROW;
|
||||
|
||||
/* Returns the number of strings in ARGZ. */
|
||||
extern size_t __argz_count (const char *__argz, size_t __len)
|
||||
__THROW __attribute_pure__;
|
||||
extern size_t argz_count (const char *__argz, size_t __len)
|
||||
__THROW __attribute_pure__;
|
||||
|
||||
/* Puts pointers to each string in ARGZ into ARGV, which must be large enough
|
||||
to hold them all. */
|
||||
extern void __argz_extract (const char *__restrict __argz, size_t __len,
|
||||
char **__restrict __argv) __THROW;
|
||||
extern void argz_extract (const char *__restrict __argz, size_t __len,
|
||||
char **__restrict __argv) __THROW;
|
||||
|
||||
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
|
||||
except the last into the character SEP. */
|
||||
extern void __argz_stringify (char *__argz, size_t __len, int __sep) __THROW;
|
||||
extern void argz_stringify (char *__argz, size_t __len, int __sep) __THROW;
|
||||
|
||||
/* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */
|
||||
extern error_t argz_append (char **__restrict __argz,
|
||||
size_t *__restrict __argz_len,
|
||||
const char *__restrict __buf, size_t __buf_len)
|
||||
__THROW;
|
||||
|
||||
/* Append STR to the argz vector in ARGZ & ARGZ_LEN. */
|
||||
extern error_t argz_add (char **__restrict __argz,
|
||||
size_t *__restrict __argz_len,
|
||||
const char *__restrict __str) __THROW;
|
||||
|
||||
/* Append SEP separated list in STRING to the argz vector in ARGZ &
|
||||
ARGZ_LEN. */
|
||||
extern error_t argz_add_sep (char **__restrict __argz,
|
||||
size_t *__restrict __argz_len,
|
||||
const char *__restrict __string, int __delim)
|
||||
__THROW;
|
||||
|
||||
/* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */
|
||||
extern void argz_delete (char **__restrict __argz,
|
||||
size_t *__restrict __argz_len,
|
||||
char *__restrict __entry) __THROW;
|
||||
|
||||
/* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an
|
||||
existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end.
|
||||
Since ARGZ's first entry is the same as ARGZ, argz_insert (ARGZ, ARGZ_LEN,
|
||||
ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ. If BEFORE is not
|
||||
in ARGZ, EINVAL is returned, else if memory can't be allocated for the new
|
||||
ARGZ, ENOMEM is returned, else 0. */
|
||||
extern error_t argz_insert (char **__restrict __argz,
|
||||
size_t *__restrict __argz_len,
|
||||
char *__restrict __before,
|
||||
const char *__restrict __entry) __THROW;
|
||||
|
||||
/* Replace any occurrences of the string STR in ARGZ with WITH, reallocating
|
||||
ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be
|
||||
incremented by number of replacements performed. */
|
||||
extern error_t argz_replace (char **__restrict __argz,
|
||||
size_t *__restrict __argz_len,
|
||||
const char *__restrict __str,
|
||||
const char *__restrict __with,
|
||||
unsigned int *__restrict __replace_count);
|
||||
|
||||
/* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there
|
||||
are no more. If entry is NULL, then the first entry is returned. This
|
||||
behavior allows two convenient iteration styles:
|
||||
|
||||
char *entry = 0;
|
||||
while ((entry = argz_next (argz, argz_len, entry)))
|
||||
...;
|
||||
|
||||
or
|
||||
|
||||
char *entry;
|
||||
for (entry = argz; entry; entry = argz_next (argz, argz_len, entry))
|
||||
...;
|
||||
*/
|
||||
extern char *__argz_next (const char *__restrict __argz, size_t __argz_len,
|
||||
const char *__restrict __entry) __THROW;
|
||||
extern char *argz_next (const char *__restrict __argz, size_t __argz_len,
|
||||
const char *__restrict __entry) __THROW;
|
||||
|
||||
#ifdef __USE_EXTERN_INLINES
|
||||
__extern_inline char *
|
||||
__NTH (__argz_next (const char *__argz, size_t __argz_len,
|
||||
const char *__entry))
|
||||
{
|
||||
if (__entry)
|
||||
{
|
||||
if (__entry < __argz + __argz_len)
|
||||
__entry = strchr (__entry, '\0') + 1;
|
||||
|
||||
return __entry >= __argz + __argz_len ? (char *) NULL : (char *) __entry;
|
||||
}
|
||||
else
|
||||
return __argz_len > 0 ? (char *) __argz : 0;
|
||||
}
|
||||
__extern_inline char *
|
||||
__NTH (argz_next (const char *__argz, size_t __argz_len,
|
||||
const char *__entry))
|
||||
{
|
||||
return __argz_next (__argz, __argz_len, __entry);
|
||||
}
|
||||
#endif /* Use extern inlines. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* argz.h */
|
105
contrib/libc-headers/arpa/inet.h
Normal file
105
contrib/libc-headers/arpa/inet.h
Normal file
@ -0,0 +1,105 @@
|
||||
/* Copyright (C) 1997-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _ARPA_INET_H
|
||||
#define _ARPA_INET_H 1
|
||||
|
||||
#include <features.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 in_addr_t inet_addr (const char *__cp) __THROW;
|
||||
|
||||
/* Return the local host address part of the Internet address in 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 (in_addr_t __net, in_addr_t __host)
|
||||
__THROW;
|
||||
|
||||
/* Return network number part of the Internet address 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 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 (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 (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 (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 int 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 (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 (int __len, const unsigned char *__cp,
|
||||
char *__buf) __THROW;
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* arpa/inet.h */
|
443
contrib/libc-headers/arpa/nameser.h
Normal file
443
contrib/libc-headers/arpa/nameser.h
Normal file
@ -0,0 +1,443 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_NAMESER_H_
|
||||
#define _ARPA_NAMESER_H_
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Define constants based on RFC 883, RFC 1034, RFC 1035
|
||||
*/
|
||||
#define NS_PACKETSZ 512 /*%< default UDP packet size */
|
||||
#define NS_MAXDNAME 1025 /*%< maximum domain name */
|
||||
#define NS_MAXMSG 65535 /*%< maximum message size */
|
||||
#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 uint32_t */
|
||||
#define NS_INT16SZ 2 /*%< #/bytes of data in a uint16_t */
|
||||
#define NS_INT8SZ 1 /*%< #/bytes of data in a uint8_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. */
|
||||
/*
|
||||
* These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
|
||||
* in synch with it.
|
||||
*/
|
||||
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;
|
||||
|
||||
/*%
|
||||
* 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.
|
||||
*/
|
||||
typedef struct __ns_msg {
|
||||
const unsigned char *_msg, *_eom;
|
||||
uint16_t _id, _flags, _counts[ns_s_max];
|
||||
const unsigned char *_sections[ns_s_max];
|
||||
ns_sect _sect;
|
||||
int _rrnum;
|
||||
const unsigned char *_msg_ptr;
|
||||
} ns_msg;
|
||||
|
||||
/* Private data structure - do not use from outside library. */
|
||||
struct _ns_flagdata { int mask, shift; };
|
||||
extern const struct _ns_flagdata _ns_flagdata[];
|
||||
|
||||
/* Accessor macros - this is part of the public interface. */
|
||||
|
||||
#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)
|
||||
|
||||
/*%
|
||||
* This is a parsed record. It is caller allocated and has no dynamic data.
|
||||
*/
|
||||
typedef struct __ns_rr {
|
||||
char name[NS_MAXDNAME];
|
||||
uint16_t type;
|
||||
uint16_t rr_class;
|
||||
uint32_t ttl;
|
||||
uint16_t rdlength;
|
||||
const unsigned 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)
|
||||
|
||||
/*%
|
||||
* 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[].
|
||||
*/
|
||||
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;
|
||||
|
||||
/*%
|
||||
* Currently defined opcodes.
|
||||
*/
|
||||
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;
|
||||
|
||||
/*%
|
||||
* Currently defined response codes.
|
||||
*/
|
||||
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 EDNS extended rcodes */
|
||||
ns_r_badvers = 16,
|
||||
/* The following are TSIG errors */
|
||||
ns_r_badsig = 16,
|
||||
ns_r_badkey = 17,
|
||||
ns_r_badtime = 18
|
||||
} ns_rcode;
|
||||
|
||||
/* BIND_UPDATE */
|
||||
typedef enum __ns_update_operation {
|
||||
ns_uop_delete = 0,
|
||||
ns_uop_add = 1,
|
||||
ns_uop_max = 2
|
||||
} ns_update_operation;
|
||||
|
||||
/*%
|
||||
* 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;
|
||||
|
||||
/*%
|
||||
* This structure is used for TSIG authenticated TCP messages
|
||||
*/
|
||||
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;
|
||||
|
||||
#define NS_TSIG_FUDGE 300
|
||||
#define NS_TSIG_TCP_COUNT 100
|
||||
#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
|
||||
|
||||
#define NS_TSIG_ERROR_NO_TSIG -10
|
||||
#define NS_TSIG_ERROR_NO_SPACE -11
|
||||
#define NS_TSIG_ERROR_FORMERR -12
|
||||
|
||||
/*%
|
||||
* Currently defined type values for resources and queries.
|
||||
*/
|
||||
typedef enum __ns_type
|
||||
{
|
||||
ns_t_invalid = 0,
|
||||
|
||||
ns_t_a = 1,
|
||||
ns_t_ns = 2,
|
||||
ns_t_md = 3,
|
||||
ns_t_mf = 4,
|
||||
ns_t_cname = 5,
|
||||
ns_t_soa = 6,
|
||||
ns_t_mb = 7,
|
||||
ns_t_mg = 8,
|
||||
ns_t_mr = 9,
|
||||
ns_t_null = 10,
|
||||
ns_t_wks = 11,
|
||||
ns_t_ptr = 12,
|
||||
ns_t_hinfo = 13,
|
||||
ns_t_minfo = 14,
|
||||
ns_t_mx = 15,
|
||||
ns_t_txt = 16,
|
||||
ns_t_rp = 17,
|
||||
ns_t_afsdb = 18,
|
||||
ns_t_x25 = 19,
|
||||
ns_t_isdn = 20,
|
||||
ns_t_rt = 21,
|
||||
ns_t_nsap = 22,
|
||||
ns_t_nsap_ptr = 23,
|
||||
ns_t_sig = 24,
|
||||
ns_t_key = 25,
|
||||
ns_t_px = 26,
|
||||
ns_t_gpos = 27,
|
||||
ns_t_aaaa = 28,
|
||||
ns_t_loc = 29,
|
||||
ns_t_nxt = 30,
|
||||
ns_t_eid = 31,
|
||||
ns_t_nimloc = 32,
|
||||
ns_t_srv = 33,
|
||||
ns_t_atma = 34,
|
||||
ns_t_naptr = 35,
|
||||
ns_t_kx = 36,
|
||||
ns_t_cert = 37,
|
||||
ns_t_a6 = 38,
|
||||
ns_t_dname = 39,
|
||||
ns_t_sink = 40,
|
||||
ns_t_opt = 41,
|
||||
ns_t_apl = 42,
|
||||
ns_t_ds = 43,
|
||||
ns_t_sshfp = 44,
|
||||
ns_t_ipseckey = 45,
|
||||
ns_t_rrsig = 46,
|
||||
ns_t_nsec = 47,
|
||||
ns_t_dnskey = 48,
|
||||
ns_t_dhcid = 49,
|
||||
ns_t_nsec3 = 50,
|
||||
ns_t_nsec3param = 51,
|
||||
ns_t_tlsa = 52,
|
||||
ns_t_smimea = 53,
|
||||
ns_t_hip = 55,
|
||||
ns_t_ninfo = 56,
|
||||
ns_t_rkey = 57,
|
||||
ns_t_talink = 58,
|
||||
ns_t_cds = 59,
|
||||
ns_t_cdnskey = 60,
|
||||
ns_t_openpgpkey = 61,
|
||||
ns_t_csync = 62,
|
||||
ns_t_spf = 99,
|
||||
ns_t_uinfo = 100,
|
||||
ns_t_uid = 101,
|
||||
ns_t_gid = 102,
|
||||
ns_t_unspec = 103,
|
||||
ns_t_nid = 104,
|
||||
ns_t_l32 = 105,
|
||||
ns_t_l64 = 106,
|
||||
ns_t_lp = 107,
|
||||
ns_t_eui48 = 108,
|
||||
ns_t_eui64 = 109,
|
||||
ns_t_tkey = 249,
|
||||
ns_t_tsig = 250,
|
||||
ns_t_ixfr = 251,
|
||||
ns_t_axfr = 252,
|
||||
ns_t_mailb = 253,
|
||||
ns_t_maila = 254,
|
||||
ns_t_any = 255,
|
||||
ns_t_uri = 256,
|
||||
ns_t_caa = 257,
|
||||
ns_t_avc = 258,
|
||||
ns_t_ta = 32768,
|
||||
ns_t_dlv = 32769,
|
||||
|
||||
ns_t_max = 65536
|
||||
} ns_type;
|
||||
|
||||
/*%
|
||||
* Values for class field
|
||||
*/
|
||||
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;
|
||||
|
||||
/* Certificate type values in CERT resource records. */
|
||||
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;
|
||||
|
||||
/*%
|
||||
* EDNS0 extended flags and option codes, host order.
|
||||
*/
|
||||
#define NS_OPT_DNSSEC_OK 0x8000U
|
||||
#define NS_OPT_NSID 3
|
||||
|
||||
/*%
|
||||
* Inline versions of get/put short/long. Pointer is advanced.
|
||||
*/
|
||||
#define NS_GET16(s, cp) do { \
|
||||
const unsigned char *t_cp = (const unsigned char *)(cp); \
|
||||
(s) = ((uint16_t)t_cp[0] << 8) \
|
||||
| ((uint16_t)t_cp[1]) \
|
||||
; \
|
||||
(cp) += NS_INT16SZ; \
|
||||
} while (0)
|
||||
|
||||
#define NS_GET32(l, cp) do { \
|
||||
const unsigned char *t_cp = (const unsigned char *)(cp); \
|
||||
(l) = ((uint32_t)t_cp[0] << 24) \
|
||||
| ((uint32_t)t_cp[1] << 16) \
|
||||
| ((uint32_t)t_cp[2] << 8) \
|
||||
| ((uint32_t)t_cp[3]) \
|
||||
; \
|
||||
(cp) += NS_INT32SZ; \
|
||||
} while (0)
|
||||
|
||||
#define NS_PUT16(s, cp) do { \
|
||||
uint16_t t_s = (uint16_t)(s); \
|
||||
unsigned char *t_cp = (unsigned char *)(cp); \
|
||||
*t_cp++ = t_s >> 8; \
|
||||
*t_cp = t_s; \
|
||||
(cp) += NS_INT16SZ; \
|
||||
} while (0)
|
||||
|
||||
#define NS_PUT32(l, cp) do { \
|
||||
uint32_t t_l = (uint32_t)(l); \
|
||||
unsigned char *t_cp = (unsigned char *)(cp); \
|
||||
*t_cp++ = t_l >> 24; \
|
||||
*t_cp++ = t_l >> 16; \
|
||||
*t_cp++ = t_l >> 8; \
|
||||
*t_cp = t_l; \
|
||||
(cp) += NS_INT32SZ; \
|
||||
} while (0)
|
||||
|
||||
__BEGIN_DECLS
|
||||
int ns_msg_getflag (ns_msg, int) __THROW;
|
||||
unsigned int ns_get16 (const unsigned char *) __THROW;
|
||||
unsigned long ns_get32 (const unsigned char *) __THROW;
|
||||
void ns_put16 (unsigned int, unsigned char *) __THROW;
|
||||
void ns_put32 (unsigned long, unsigned char *) __THROW;
|
||||
int ns_initparse (const unsigned char *, int, ns_msg *) __THROW;
|
||||
int ns_skiprr (const unsigned char *, const unsigned char *,
|
||||
ns_sect, int) __THROW;
|
||||
int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW;
|
||||
int ns_sprintrr (const ns_msg *, const ns_rr *,
|
||||
const char *, const char *, char *, size_t)
|
||||
__THROW;
|
||||
int ns_sprintrrf (const unsigned char *, size_t, const char *,
|
||||
ns_class, ns_type, unsigned long,
|
||||
const unsigned char *, size_t, const char *,
|
||||
const char *, char *, size_t) __THROW;
|
||||
int ns_format_ttl (unsigned long, char *, size_t) __THROW;
|
||||
int ns_parse_ttl (const char *, unsigned long *) __THROW;
|
||||
uint32_t ns_datetosecs (const char *, int *) __THROW;
|
||||
int ns_name_ntol (const unsigned char *, unsigned char *, size_t)
|
||||
__THROW;
|
||||
int ns_name_ntop (const unsigned char *, char *, size_t) __THROW;
|
||||
int ns_name_pton (const char *, unsigned char *, size_t) __THROW;
|
||||
int ns_name_unpack (const unsigned char *, const unsigned char *,
|
||||
const unsigned char *, unsigned char *, size_t)
|
||||
__THROW;
|
||||
int ns_name_pack (const unsigned char *, unsigned char *, int,
|
||||
const unsigned char **, const unsigned char **)
|
||||
__THROW;
|
||||
int ns_name_uncompress (const unsigned char *,
|
||||
const unsigned char *,
|
||||
const unsigned char *,
|
||||
char *, size_t) __THROW;
|
||||
int ns_name_compress (const char *, unsigned char *, size_t,
|
||||
const unsigned char **,
|
||||
const unsigned char **) __THROW;
|
||||
int ns_name_skip (const unsigned char **, const unsigned char *)
|
||||
__THROW;
|
||||
void ns_name_rollback (const unsigned char *,
|
||||
const unsigned char **,
|
||||
const unsigned char **) __THROW;
|
||||
int ns_samedomain (const char *, const char *) __THROW;
|
||||
int ns_subdomain (const char *, const char *) __THROW;
|
||||
int ns_makecanon (const char *, char *, size_t) __THROW;
|
||||
int ns_samename (const char *, const char *) __THROW;
|
||||
__END_DECLS
|
||||
|
||||
#include <arpa/nameser_compat.h>
|
||||
|
||||
#endif /* !_ARPA_NAMESER_H_ */
|
||||
/*! \file */
|
221
contrib/libc-headers/arpa/nameser_compat.h
Normal file
221
contrib/libc-headers/arpa/nameser_compat.h
Normal file
@ -0,0 +1,221 @@
|
||||
/* Copyright (c) 1983, 1989
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_NAMESER_COMPAT_
|
||||
#define _ARPA_NAMESER_COMPAT_
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
/*%
|
||||
* Structure for query header. The order of the fields is machine- and
|
||||
* compiler-dependent, depending on the byte/bit order and the layout
|
||||
* of bit fields. We use bit fields only in int variables, as this
|
||||
* is all ANSI requires. This requires a somewhat confusing rearrangement.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned id :16; /*%< query identification number */
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
/* fields in third byte */
|
||||
unsigned qr: 1; /*%< response flag */
|
||||
unsigned opcode: 4; /*%< purpose of message */
|
||||
unsigned aa: 1; /*%< authoritive answer */
|
||||
unsigned tc: 1; /*%< truncated message */
|
||||
unsigned rd: 1; /*%< recursion desired */
|
||||
/* fields in fourth byte */
|
||||
unsigned ra: 1; /*%< recursion available */
|
||||
unsigned unused :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; /*%< authoritive 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;
|
||||
|
||||
#define PACKETSZ NS_PACKETSZ
|
||||
#define MAXDNAME NS_MAXDNAME
|
||||
#define MAXCDNAME NS_MAXCDNAME
|
||||
#define MAXLABEL NS_MAXLABEL
|
||||
#define HFIXEDSZ NS_HFIXEDSZ
|
||||
#define QFIXEDSZ NS_QFIXEDSZ
|
||||
#define RRFIXEDSZ NS_RRFIXEDSZ
|
||||
#define INT32SZ NS_INT32SZ
|
||||
#define INT16SZ NS_INT16SZ
|
||||
#define INT8SZ NS_INT8SZ
|
||||
#define INADDRSZ NS_INADDRSZ
|
||||
#define IN6ADDRSZ NS_IN6ADDRSZ
|
||||
#define INDIR_MASK NS_CMPRSFLGS
|
||||
#define NAMESERVER_PORT NS_DEFAULTPORT
|
||||
|
||||
#define S_ZONE ns_s_zn
|
||||
#define S_PREREQ ns_s_pr
|
||||
#define S_UPDATE ns_s_ud
|
||||
#define S_ADDT ns_s_ar
|
||||
|
||||
#define QUERY ns_o_query
|
||||
#define IQUERY ns_o_iquery
|
||||
#define STATUS ns_o_status
|
||||
#define NS_NOTIFY_OP ns_o_notify
|
||||
#define NS_UPDATE_OP ns_o_update
|
||||
|
||||
#define NOERROR ns_r_noerror
|
||||
#define FORMERR ns_r_formerr
|
||||
#define SERVFAIL ns_r_servfail
|
||||
#define NXDOMAIN ns_r_nxdomain
|
||||
#define NOTIMP ns_r_notimpl
|
||||
#define REFUSED ns_r_refused
|
||||
#define YXDOMAIN ns_r_yxdomain
|
||||
#define YXRRSET ns_r_yxrrset
|
||||
#define NXRRSET ns_r_nxrrset
|
||||
#define NOTAUTH ns_r_notauth
|
||||
#define NOTZONE ns_r_notzone
|
||||
/*#define BADSIG ns_r_badsig*/
|
||||
/*#define BADKEY ns_r_badkey*/
|
||||
/*#define BADTIME ns_r_badtime*/
|
||||
|
||||
|
||||
#define DELETE ns_uop_delete
|
||||
#define ADD ns_uop_add
|
||||
|
||||
#define T_A ns_t_a
|
||||
#define T_NS ns_t_ns
|
||||
#define T_MD ns_t_md
|
||||
#define T_MF ns_t_mf
|
||||
#define T_CNAME ns_t_cname
|
||||
#define T_SOA ns_t_soa
|
||||
#define T_MB ns_t_mb
|
||||
#define T_MG ns_t_mg
|
||||
#define T_MR ns_t_mr
|
||||
#define T_NULL ns_t_null
|
||||
#define T_WKS ns_t_wks
|
||||
#define T_PTR ns_t_ptr
|
||||
#define T_HINFO ns_t_hinfo
|
||||
#define T_MINFO ns_t_minfo
|
||||
#define T_MX ns_t_mx
|
||||
#define T_TXT ns_t_txt
|
||||
#define T_RP ns_t_rp
|
||||
#define T_AFSDB ns_t_afsdb
|
||||
#define T_X25 ns_t_x25
|
||||
#define T_ISDN ns_t_isdn
|
||||
#define T_RT ns_t_rt
|
||||
#define T_NSAP ns_t_nsap
|
||||
#define T_NSAP_PTR ns_t_nsap_ptr
|
||||
#define T_SIG ns_t_sig
|
||||
#define T_KEY ns_t_key
|
||||
#define T_PX ns_t_px
|
||||
#define T_GPOS ns_t_gpos
|
||||
#define T_AAAA ns_t_aaaa
|
||||
#define T_LOC ns_t_loc
|
||||
#define T_NXT ns_t_nxt
|
||||
#define T_EID ns_t_eid
|
||||
#define T_NIMLOC ns_t_nimloc
|
||||
#define T_SRV ns_t_srv
|
||||
#define T_ATMA ns_t_atma
|
||||
#define T_NAPTR ns_t_naptr
|
||||
#define T_KX ns_t_kx
|
||||
#define T_CERT ns_t_cert
|
||||
#define T_A6 ns_t_a6
|
||||
#define T_DNAME ns_t_dname
|
||||
#define T_SINK ns_t_sink
|
||||
#define T_OPT ns_t_opt
|
||||
#define T_APL ns_t_apl
|
||||
#define T_DS ns_t_ds
|
||||
#define T_SSHFP ns_t_sshfp
|
||||
#define T_IPSECKEY ns_t_ipseckey
|
||||
#define T_RRSIG ns_t_rrsig
|
||||
#define T_NSEC ns_t_nsec
|
||||
#define T_DNSKEY ns_t_dnskey
|
||||
#define T_DHCID ns_t_dhcid
|
||||
#define T_NSEC3 ns_t_nsec3
|
||||
#define T_NSEC3PARAM ns_t_nsec3param
|
||||
#define T_TLSA ns_t_tlsa
|
||||
#define T_SMIMEA ns_t_smimea
|
||||
#define T_HIP ns_t_hip
|
||||
#define T_NINFO ns_t_ninfo
|
||||
#define T_RKEY ns_t_rkey
|
||||
#define T_TALINK ns_t_talink
|
||||
#define T_CDS ns_t_cds
|
||||
#define T_CDNSKEY ns_t_cdnskey
|
||||
#define T_OPENPGPKEY ns_t_openpgpkey
|
||||
#define T_CSYNC ns_t_csync
|
||||
#define T_SPF ns_t_spf
|
||||
#define T_UINFO ns_t_uinfo
|
||||
#define T_UID ns_t_uid
|
||||
#define T_GID ns_t_gid
|
||||
#define T_UNSPEC ns_t_unspec
|
||||
#define T_NID ns_t_nid
|
||||
#define T_L32 ns_t_l32
|
||||
#define T_L64 ns_t_l64
|
||||
#define T_LP ns_t_lp
|
||||
#define T_EUI48 ns_t_eui48
|
||||
#define T_EUI64 ns_t_eui64
|
||||
#define T_TKEY ns_t_tkey
|
||||
#define T_TSIG ns_t_tsig
|
||||
#define T_IXFR ns_t_ixfr
|
||||
#define T_AXFR ns_t_axfr
|
||||
#define T_MAILB ns_t_mailb
|
||||
#define T_MAILA ns_t_maila
|
||||
#define T_ANY ns_t_any
|
||||
#define T_URI ns_t_uri
|
||||
#define T_CAA ns_t_caa
|
||||
#define T_AVC ns_t_avc
|
||||
#define T_TA ns_t_ta
|
||||
#define T_DLV ns_t_dlv
|
||||
|
||||
#define C_IN ns_c_in
|
||||
#define C_CHAOS ns_c_chaos
|
||||
#define C_HS ns_c_hs
|
||||
/* BIND_UPDATE */
|
||||
#define C_NONE ns_c_none
|
||||
#define C_ANY ns_c_any
|
||||
|
||||
#define GETSHORT NS_GET16
|
||||
#define GETLONG NS_GET32
|
||||
#define PUTSHORT NS_PUT16
|
||||
#define PUTLONG NS_PUT32
|
||||
|
||||
#endif /* _ARPA_NAMESER_COMPAT_ */
|
||||
/*! \file */
|
16
contrib/libc-headers/asm-generic/bitsperlong.h
Normal file
16
contrib/libc-headers/asm-generic/bitsperlong.h
Normal file
@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef __ASM_GENERIC_BITS_PER_LONG
|
||||
#define __ASM_GENERIC_BITS_PER_LONG
|
||||
|
||||
/*
|
||||
* There seems to be no way of detecting this automatically from user
|
||||
* space, so 64 bit architectures should override this in their
|
||||
* bitsperlong.h. In particular, an architecture that supports
|
||||
* both 32 and 64 bit user space must not rely on CONFIG_64BIT
|
||||
* to decide it, but rather check a compiler provided macro.
|
||||
*/
|
||||
#ifndef __BITS_PER_LONG
|
||||
#define __BITS_PER_LONG 32
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_GENERIC_BITS_PER_LONG */
|
40
contrib/libc-headers/asm-generic/errno-base.h
Normal file
40
contrib/libc-headers/asm-generic/errno-base.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _ASM_GENERIC_ERRNO_BASE_H
|
||||
#define _ASM_GENERIC_ERRNO_BASE_H
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Argument list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Try again */
|
||||
#define ENOMEM 12 /* Out of memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device or resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Math argument out of domain of func */
|
||||
#define ERANGE 34 /* Math result not representable */
|
||||
|
||||
#endif
|
123
contrib/libc-headers/asm-generic/errno.h
Normal file
123
contrib/libc-headers/asm-generic/errno.h
Normal file
@ -0,0 +1,123 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _ASM_GENERIC_ERRNO_H
|
||||
#define _ASM_GENERIC_ERRNO_H
|
||||
|
||||
#include <asm-generic/errno-base.h>
|
||||
|
||||
#define EDEADLK 35 /* Resource deadlock would occur */
|
||||
#define ENAMETOOLONG 36 /* File name too long */
|
||||
#define ENOLCK 37 /* No record locks available */
|
||||
|
||||
/*
|
||||
* This error code is special: arch syscall entry code will return
|
||||
* -ENOSYS if users try to call a syscall that doesn't exist. To keep
|
||||
* failures of syscalls that really do exist distinguishable from
|
||||
* failures due to attempts to use a nonexistent syscall, syscall
|
||||
* implementations should refrain from returning -ENOSYS.
|
||||
*/
|
||||
#define ENOSYS 38 /* Invalid system call number */
|
||||
|
||||
#define ENOTEMPTY 39 /* Directory not empty */
|
||||
#define ELOOP 40 /* Too many symbolic links encountered */
|
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||
#define ENOMSG 42 /* No message of desired type */
|
||||
#define EIDRM 43 /* Identifier removed */
|
||||
#define ECHRNG 44 /* Channel number out of range */
|
||||
#define EL2NSYNC 45 /* Level 2 not synchronized */
|
||||
#define EL3HLT 46 /* Level 3 halted */
|
||||
#define EL3RST 47 /* Level 3 reset */
|
||||
#define ELNRNG 48 /* Link number out of range */
|
||||
#define EUNATCH 49 /* Protocol driver not attached */
|
||||
#define ENOCSI 50 /* No CSI structure available */
|
||||
#define EL2HLT 51 /* Level 2 halted */
|
||||
#define EBADE 52 /* Invalid exchange */
|
||||
#define EBADR 53 /* Invalid request descriptor */
|
||||
#define EXFULL 54 /* Exchange full */
|
||||
#define ENOANO 55 /* No anode */
|
||||
#define EBADRQC 56 /* Invalid request code */
|
||||
#define EBADSLT 57 /* Invalid slot */
|
||||
|
||||
#define EDEADLOCK EDEADLK
|
||||
|
||||
#define EBFONT 59 /* Bad font file format */
|
||||
#define ENOSTR 60 /* Device not a stream */
|
||||
#define ENODATA 61 /* No data available */
|
||||
#define ETIME 62 /* Timer expired */
|
||||
#define ENOSR 63 /* Out of streams resources */
|
||||
#define ENONET 64 /* Machine is not on the network */
|
||||
#define ENOPKG 65 /* Package not installed */
|
||||
#define EREMOTE 66 /* Object is remote */
|
||||
#define ENOLINK 67 /* Link has been severed */
|
||||
#define EADV 68 /* Advertise error */
|
||||
#define ESRMNT 69 /* Srmount error */
|
||||
#define ECOMM 70 /* Communication error on send */
|
||||
#define EPROTO 71 /* Protocol error */
|
||||
#define EMULTIHOP 72 /* Multihop attempted */
|
||||
#define EDOTDOT 73 /* RFS specific error */
|
||||
#define EBADMSG 74 /* Not a data message */
|
||||
#define EOVERFLOW 75 /* Value too large for defined data type */
|
||||
#define ENOTUNIQ 76 /* Name not unique on network */
|
||||
#define EBADFD 77 /* File descriptor in bad state */
|
||||
#define EREMCHG 78 /* Remote address changed */
|
||||
#define ELIBACC 79 /* Can not access a needed shared library */
|
||||
#define ELIBBAD 80 /* Accessing a corrupted shared library */
|
||||
#define ELIBSCN 81 /* .lib section in a.out corrupted */
|
||||
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
|
||||
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
|
||||
#define EILSEQ 84 /* Illegal byte sequence */
|
||||
#define ERESTART 85 /* Interrupted system call should be restarted */
|
||||
#define ESTRPIPE 86 /* Streams pipe error */
|
||||
#define EUSERS 87 /* Too many users */
|
||||
#define ENOTSOCK 88 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 89 /* Destination address required */
|
||||
#define EMSGSIZE 90 /* Message too long */
|
||||
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 92 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 93 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
|
||||
#define EADDRINUSE 98 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
|
||||
#define ENETDOWN 100 /* Network is down */
|
||||
#define ENETUNREACH 101 /* Network is unreachable */
|
||||
#define ENETRESET 102 /* Network dropped connection because of reset */
|
||||
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||
#define ECONNRESET 104 /* Connection reset by peer */
|
||||
#define ENOBUFS 105 /* No buffer space available */
|
||||
#define EISCONN 106 /* Transport endpoint is already connected */
|
||||
#define ENOTCONN 107 /* Transport endpoint is not connected */
|
||||
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
|
||||
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
|
||||
#define ETIMEDOUT 110 /* Connection timed out */
|
||||
#define ECONNREFUSED 111 /* Connection refused */
|
||||
#define EHOSTDOWN 112 /* Host is down */
|
||||
#define EHOSTUNREACH 113 /* No route to host */
|
||||
#define EALREADY 114 /* Operation already in progress */
|
||||
#define EINPROGRESS 115 /* Operation now in progress */
|
||||
#define ESTALE 116 /* Stale file handle */
|
||||
#define EUCLEAN 117 /* Structure needs cleaning */
|
||||
#define ENOTNAM 118 /* Not a XENIX named type file */
|
||||
#define ENAVAIL 119 /* No XENIX semaphores available */
|
||||
#define EISNAM 120 /* Is a named type file */
|
||||
#define EREMOTEIO 121 /* Remote I/O error */
|
||||
#define EDQUOT 122 /* Quota exceeded */
|
||||
|
||||
#define ENOMEDIUM 123 /* No medium found */
|
||||
#define EMEDIUMTYPE 124 /* Wrong medium type */
|
||||
#define ECANCELED 125 /* Operation Canceled */
|
||||
#define ENOKEY 126 /* Required key not available */
|
||||
#define EKEYEXPIRED 127 /* Key has expired */
|
||||
#define EKEYREVOKED 128 /* Key has been revoked */
|
||||
#define EKEYREJECTED 129 /* Key was rejected by service */
|
||||
|
||||
/* for robust mutexes */
|
||||
#define EOWNERDEAD 130 /* Owner died */
|
||||
#define ENOTRECOVERABLE 131 /* State not recoverable */
|
||||
|
||||
#define ERFKILL 132 /* Operation not possible due to RF-kill */
|
||||
|
||||
#define EHWPOISON 133 /* Memory page has hardware error */
|
||||
|
||||
#endif
|
40
contrib/libc-headers/asm-generic/int-ll64.h
Normal file
40
contrib/libc-headers/asm-generic/int-ll64.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/*
|
||||
* asm-generic/int-ll64.h
|
||||
*
|
||||
* Integer declarations for architectures which use "long long"
|
||||
* for 64-bit types.
|
||||
*/
|
||||
|
||||
#ifndef _ASM_GENERIC_INT_LL64_H
|
||||
#define _ASM_GENERIC_INT_LL64_H
|
||||
|
||||
#include <asm/bitsperlong.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/*
|
||||
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
|
||||
* header files exported to user space
|
||||
*/
|
||||
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned char __u8;
|
||||
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned short __u16;
|
||||
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned int __u32;
|
||||
|
||||
#ifdef __GNUC__
|
||||
__extension__ typedef __signed__ long long __s64;
|
||||
__extension__ typedef unsigned long long __u64;
|
||||
#else
|
||||
typedef __signed__ long long __s64;
|
||||
typedef unsigned long long __u64;
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
|
||||
#endif /* _ASM_GENERIC_INT_LL64_H */
|
105
contrib/libc-headers/asm-generic/ioctl.h
Normal file
105
contrib/libc-headers/asm-generic/ioctl.h
Normal file
@ -0,0 +1,105 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _ASM_GENERIC_IOCTL_H
|
||||
#define _ASM_GENERIC_IOCTL_H
|
||||
|
||||
/* ioctl command encoding: 32 bits total, command in lower 16 bits,
|
||||
* size of the parameter structure in the lower 14 bits of the
|
||||
* upper 16 bits.
|
||||
* Encoding the size of the parameter structure in the ioctl request
|
||||
* is useful for catching programs compiled with old versions
|
||||
* and to avoid overwriting user space outside the user buffer area.
|
||||
* The highest 2 bits are reserved for indicating the ``access mode''.
|
||||
* NOTE: This limits the max parameter size to 16kB -1 !
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following is for compatibility across the various Linux
|
||||
* platforms. The generic ioctl numbering scheme doesn't really enforce
|
||||
* a type field. De facto, however, the top 8 bits of the lower 16
|
||||
* bits are indeed used as a type field, so we might just as well make
|
||||
* this explicit here. Please be sure to use the decoding macros
|
||||
* below from now on.
|
||||
*/
|
||||
#define _IOC_NRBITS 8
|
||||
#define _IOC_TYPEBITS 8
|
||||
|
||||
/*
|
||||
* Let any architecture override either of the following before
|
||||
* including this file.
|
||||
*/
|
||||
|
||||
#ifndef _IOC_SIZEBITS
|
||||
# define _IOC_SIZEBITS 14
|
||||
#endif
|
||||
|
||||
#ifndef _IOC_DIRBITS
|
||||
# define _IOC_DIRBITS 2
|
||||
#endif
|
||||
|
||||
#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
|
||||
#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
|
||||
#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
|
||||
#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
|
||||
|
||||
#define _IOC_NRSHIFT 0
|
||||
#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
|
||||
#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
|
||||
#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
|
||||
|
||||
/*
|
||||
* Direction bits, which any architecture can choose to override
|
||||
* before including this file.
|
||||
*
|
||||
* NOTE: _IOC_WRITE means userland is writing and kernel is
|
||||
* reading. _IOC_READ means userland is reading and kernel is writing.
|
||||
*/
|
||||
|
||||
#ifndef _IOC_NONE
|
||||
# define _IOC_NONE 0U
|
||||
#endif
|
||||
|
||||
#ifndef _IOC_WRITE
|
||||
# define _IOC_WRITE 1U
|
||||
#endif
|
||||
|
||||
#ifndef _IOC_READ
|
||||
# define _IOC_READ 2U
|
||||
#endif
|
||||
|
||||
#define _IOC(dir,type,nr,size) \
|
||||
(((dir) << _IOC_DIRSHIFT) | \
|
||||
((type) << _IOC_TYPESHIFT) | \
|
||||
((nr) << _IOC_NRSHIFT) | \
|
||||
((size) << _IOC_SIZESHIFT))
|
||||
|
||||
#define _IOC_TYPECHECK(t) (sizeof(t))
|
||||
|
||||
/*
|
||||
* Used to create numbers.
|
||||
*
|
||||
* NOTE: _IOW means userland is writing and kernel is reading. _IOR
|
||||
* means userland is reading and kernel is writing.
|
||||
*/
|
||||
#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
|
||||
#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
|
||||
#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
|
||||
#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
|
||||
#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
|
||||
#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
|
||||
#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
|
||||
|
||||
/* used to decode ioctl numbers.. */
|
||||
#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
|
||||
#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
|
||||
#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
|
||||
#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
|
||||
|
||||
/* ...and for the drivers/sound files... */
|
||||
|
||||
#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
|
||||
#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
|
||||
#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
|
||||
#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
|
||||
#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
|
||||
|
||||
#endif /* _ASM_GENERIC_IOCTL_H */
|
119
contrib/libc-headers/asm-generic/ioctls.h
Normal file
119
contrib/libc-headers/asm-generic/ioctls.h
Normal file
@ -0,0 +1,119 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef __ASM_GENERIC_IOCTLS_H
|
||||
#define __ASM_GENERIC_IOCTLS_H
|
||||
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
/*
|
||||
* These are the most common definitions for tty ioctl numbers.
|
||||
* Most of them do not use the recommended _IOC(), but there is
|
||||
* probably some source code out there hardcoding the number,
|
||||
* so we might as well use them for all new platforms.
|
||||
*
|
||||
* The architectures that use different values here typically
|
||||
* try to be compatible with some Unix variants for the same
|
||||
* architecture.
|
||||
*/
|
||||
|
||||
/* 0x54 is just a magic number to make these relatively unique ('T') */
|
||||
|
||||
#define TCGETS 0x5401
|
||||
#define TCSETS 0x5402
|
||||
#define TCSETSW 0x5403
|
||||
#define TCSETSF 0x5404
|
||||
#define TCGETA 0x5405
|
||||
#define TCSETA 0x5406
|
||||
#define TCSETAW 0x5407
|
||||
#define TCSETAF 0x5408
|
||||
#define TCSBRK 0x5409
|
||||
#define TCXONC 0x540A
|
||||
#define TCFLSH 0x540B
|
||||
#define TIOCEXCL 0x540C
|
||||
#define TIOCNXCL 0x540D
|
||||
#define TIOCSCTTY 0x540E
|
||||
#define TIOCGPGRP 0x540F
|
||||
#define TIOCSPGRP 0x5410
|
||||
#define TIOCOUTQ 0x5411
|
||||
#define TIOCSTI 0x5412
|
||||
#define TIOCGWINSZ 0x5413
|
||||
#define TIOCSWINSZ 0x5414
|
||||
#define TIOCMGET 0x5415
|
||||
#define TIOCMBIS 0x5416
|
||||
#define TIOCMBIC 0x5417
|
||||
#define TIOCMSET 0x5418
|
||||
#define TIOCGSOFTCAR 0x5419
|
||||
#define TIOCSSOFTCAR 0x541A
|
||||
#define FIONREAD 0x541B
|
||||
#define TIOCINQ FIONREAD
|
||||
#define TIOCLINUX 0x541C
|
||||
#define TIOCCONS 0x541D
|
||||
#define TIOCGSERIAL 0x541E
|
||||
#define TIOCSSERIAL 0x541F
|
||||
#define TIOCPKT 0x5420
|
||||
#define FIONBIO 0x5421
|
||||
#define TIOCNOTTY 0x5422
|
||||
#define TIOCSETD 0x5423
|
||||
#define TIOCGETD 0x5424
|
||||
#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
|
||||
#define TIOCSBRK 0x5427 /* BSD compatibility */
|
||||
#define TIOCCBRK 0x5428 /* BSD compatibility */
|
||||
#define TIOCGSID 0x5429 /* Return the session ID of FD */
|
||||
#define TCGETS2 _IOR('T', 0x2A, struct termios2)
|
||||
#define TCSETS2 _IOW('T', 0x2B, struct termios2)
|
||||
#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
|
||||
#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
|
||||
#define TIOCGRS485 0x542E
|
||||
#ifndef TIOCSRS485
|
||||
#define TIOCSRS485 0x542F
|
||||
#endif
|
||||
#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||
#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
|
||||
#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
|
||||
#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */
|
||||
#define TCSETX 0x5433
|
||||
#define TCSETXF 0x5434
|
||||
#define TCSETXW 0x5435
|
||||
#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
|
||||
#define TIOCVHANGUP 0x5437
|
||||
#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
|
||||
#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
|
||||
#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
|
||||
#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
|
||||
|
||||
#define FIONCLEX 0x5450
|
||||
#define FIOCLEX 0x5451
|
||||
#define FIOASYNC 0x5452
|
||||
#define TIOCSERCONFIG 0x5453
|
||||
#define TIOCSERGWILD 0x5454
|
||||
#define TIOCSERSWILD 0x5455
|
||||
#define TIOCGLCKTRMIOS 0x5456
|
||||
#define TIOCSLCKTRMIOS 0x5457
|
||||
#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
|
||||
#define TIOCSERGETLSR 0x5459 /* Get line status register */
|
||||
#define TIOCSERGETMULTI 0x545A /* Get multiport config */
|
||||
#define TIOCSERSETMULTI 0x545B /* Set multiport config */
|
||||
|
||||
#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
|
||||
#define TIOCGICOUNT 0x545D /* read serial port __inline__ interrupt counts */
|
||||
|
||||
/*
|
||||
* Some arches already define FIOQSIZE due to a historical
|
||||
* conflict with a Hayes modem-specific ioctl value.
|
||||
*/
|
||||
#ifndef FIOQSIZE
|
||||
# define FIOQSIZE 0x5460
|
||||
#endif
|
||||
|
||||
/* Used for packet mode */
|
||||
#define TIOCPKT_DATA 0
|
||||
#define TIOCPKT_FLUSHREAD 1
|
||||
#define TIOCPKT_FLUSHWRITE 2
|
||||
#define TIOCPKT_STOP 4
|
||||
#define TIOCPKT_START 8
|
||||
#define TIOCPKT_NOSTOP 16
|
||||
#define TIOCPKT_DOSTOP 32
|
||||
#define TIOCPKT_IOCTL 64
|
||||
|
||||
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
|
||||
|
||||
#endif /* __ASM_GENERIC_IOCTLS_H */
|
20
contrib/libc-headers/asm-generic/param.h
Normal file
20
contrib/libc-headers/asm-generic/param.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef __ASM_GENERIC_PARAM_H
|
||||
#define __ASM_GENERIC_PARAM_H
|
||||
|
||||
#ifndef HZ
|
||||
#define HZ 100
|
||||
#endif
|
||||
|
||||
#ifndef EXEC_PAGESIZE
|
||||
#define EXEC_PAGESIZE 4096
|
||||
#endif
|
||||
|
||||
#ifndef NOGROUP
|
||||
#define NOGROUP (-1)
|
||||
#endif
|
||||
|
||||
#define MAXHOSTNAMELEN 64 /* max length of hostname */
|
||||
|
||||
|
||||
#endif /* __ASM_GENERIC_PARAM_H */
|
97
contrib/libc-headers/asm-generic/posix_types.h
Normal file
97
contrib/libc-headers/asm-generic/posix_types.h
Normal file
@ -0,0 +1,97 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef __ASM_GENERIC_POSIX_TYPES_H
|
||||
#define __ASM_GENERIC_POSIX_TYPES_H
|
||||
|
||||
#include <asm/bitsperlong.h>
|
||||
/*
|
||||
* This file is generally used by user-level software, so you need to
|
||||
* be a little careful about namespace pollution etc.
|
||||
*
|
||||
* First the types that are often defined in different ways across
|
||||
* architectures, so that you can override them.
|
||||
*/
|
||||
|
||||
#ifndef __kernel_long_t
|
||||
typedef long __kernel_long_t;
|
||||
typedef unsigned long __kernel_ulong_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_ino_t
|
||||
typedef __kernel_ulong_t __kernel_ino_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_mode_t
|
||||
typedef unsigned int __kernel_mode_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_pid_t
|
||||
typedef int __kernel_pid_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_ipc_pid_t
|
||||
typedef int __kernel_ipc_pid_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_uid_t
|
||||
typedef unsigned int __kernel_uid_t;
|
||||
typedef unsigned int __kernel_gid_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_suseconds_t
|
||||
typedef __kernel_long_t __kernel_suseconds_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_daddr_t
|
||||
typedef int __kernel_daddr_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_uid32_t
|
||||
typedef unsigned int __kernel_uid32_t;
|
||||
typedef unsigned int __kernel_gid32_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_old_uid_t
|
||||
typedef __kernel_uid_t __kernel_old_uid_t;
|
||||
typedef __kernel_gid_t __kernel_old_gid_t;
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_old_dev_t
|
||||
typedef unsigned int __kernel_old_dev_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Most 32 bit architectures use "unsigned int" size_t,
|
||||
* and all 64 bit architectures use "unsigned long" size_t.
|
||||
*/
|
||||
#ifndef __kernel_size_t
|
||||
#if __BITS_PER_LONG != 64
|
||||
typedef unsigned int __kernel_size_t;
|
||||
typedef int __kernel_ssize_t;
|
||||
typedef int __kernel_ptrdiff_t;
|
||||
#else
|
||||
typedef __kernel_ulong_t __kernel_size_t;
|
||||
typedef __kernel_long_t __kernel_ssize_t;
|
||||
typedef __kernel_long_t __kernel_ptrdiff_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __kernel_fsid_t
|
||||
typedef struct {
|
||||
int val[2];
|
||||
} __kernel_fsid_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* anything below here should be completely generic
|
||||
*/
|
||||
typedef __kernel_long_t __kernel_off_t;
|
||||
typedef long long __kernel_loff_t;
|
||||
typedef __kernel_long_t __kernel_time_t;
|
||||
typedef __kernel_long_t __kernel_clock_t;
|
||||
typedef int __kernel_timer_t;
|
||||
typedef int __kernel_clockid_t;
|
||||
typedef char * __kernel_caddr_t;
|
||||
typedef unsigned short __kernel_uid16_t;
|
||||
typedef unsigned short __kernel_gid16_t;
|
||||
|
||||
#endif /* __ASM_GENERIC_POSIX_TYPES_H */
|
110
contrib/libc-headers/asm-generic/socket.h
Normal file
110
contrib/libc-headers/asm-generic/socket.h
Normal file
@ -0,0 +1,110 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef __ASM_GENERIC_SOCKET_H
|
||||
#define __ASM_GENERIC_SOCKET_H
|
||||
|
||||
#include <asm/sockios.h>
|
||||
|
||||
/* For setsockopt(2) */
|
||||
#define SOL_SOCKET 1
|
||||
|
||||
#define SO_DEBUG 1
|
||||
#define SO_REUSEADDR 2
|
||||
#define SO_TYPE 3
|
||||
#define SO_ERROR 4
|
||||
#define SO_DONTROUTE 5
|
||||
#define SO_BROADCAST 6
|
||||
#define SO_SNDBUF 7
|
||||
#define SO_RCVBUF 8
|
||||
#define SO_SNDBUFFORCE 32
|
||||
#define SO_RCVBUFFORCE 33
|
||||
#define SO_KEEPALIVE 9
|
||||
#define SO_OOBINLINE 10
|
||||
#define SO_NO_CHECK 11
|
||||
#define SO_PRIORITY 12
|
||||
#define SO_LINGER 13
|
||||
#define SO_BSDCOMPAT 14
|
||||
#define SO_REUSEPORT 15
|
||||
#ifndef SO_PASSCRED /* powerpc only differs in these */
|
||||
#define SO_PASSCRED 16
|
||||
#define SO_PEERCRED 17
|
||||
#define SO_RCVLOWAT 18
|
||||
#define SO_SNDLOWAT 19
|
||||
#define SO_RCVTIMEO 20
|
||||
#define SO_SNDTIMEO 21
|
||||
#endif
|
||||
|
||||
/* Security levels - as per NRL IPv6 - don't actually do anything */
|
||||
#define SO_SECURITY_AUTHENTICATION 22
|
||||
#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
|
||||
#define SO_SECURITY_ENCRYPTION_NETWORK 24
|
||||
|
||||
#define SO_BINDTODEVICE 25
|
||||
|
||||
/* Socket filtering */
|
||||
#define SO_ATTACH_FILTER 26
|
||||
#define SO_DETACH_FILTER 27
|
||||
#define SO_GET_FILTER SO_ATTACH_FILTER
|
||||
|
||||
#define SO_PEERNAME 28
|
||||
#define SO_TIMESTAMP 29
|
||||
#define SCM_TIMESTAMP SO_TIMESTAMP
|
||||
|
||||
#define SO_ACCEPTCONN 30
|
||||
|
||||
#define SO_PEERSEC 31
|
||||
#define SO_PASSSEC 34
|
||||
#define SO_TIMESTAMPNS 35
|
||||
#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
|
||||
|
||||
#define SO_MARK 36
|
||||
|
||||
#define SO_TIMESTAMPING 37
|
||||
#define SCM_TIMESTAMPING SO_TIMESTAMPING
|
||||
|
||||
#define SO_PROTOCOL 38
|
||||
#define SO_DOMAIN 39
|
||||
|
||||
#define SO_RXQ_OVFL 40
|
||||
|
||||
#define SO_WIFI_STATUS 41
|
||||
#define SCM_WIFI_STATUS SO_WIFI_STATUS
|
||||
#define SO_PEEK_OFF 42
|
||||
|
||||
/* Instruct lower device to use last 4-bytes of skb data as FCS */
|
||||
#define SO_NOFCS 43
|
||||
|
||||
#define SO_LOCK_FILTER 44
|
||||
|
||||
#define SO_SELECT_ERR_QUEUE 45
|
||||
|
||||
#define SO_BUSY_POLL 46
|
||||
|
||||
#define SO_MAX_PACING_RATE 47
|
||||
|
||||
#define SO_BPF_EXTENSIONS 48
|
||||
|
||||
#define SO_INCOMING_CPU 49
|
||||
|
||||
#define SO_ATTACH_BPF 50
|
||||
#define SO_DETACH_BPF SO_DETACH_FILTER
|
||||
|
||||
#define SO_ATTACH_REUSEPORT_CBPF 51
|
||||
#define SO_ATTACH_REUSEPORT_EBPF 52
|
||||
|
||||
#define SO_CNX_ADVICE 53
|
||||
|
||||
#define SCM_TIMESTAMPING_OPT_STATS 54
|
||||
|
||||
#define SO_MEMINFO 55
|
||||
|
||||
#define SO_INCOMING_NAPI_ID 56
|
||||
|
||||
#define SO_COOKIE 57
|
||||
|
||||
#define SCM_TIMESTAMPING_PKTINFO 58
|
||||
|
||||
#define SO_PEERGROUPS 59
|
||||
|
||||
#define SO_ZEROCOPY 60
|
||||
|
||||
#endif /* __ASM_GENERIC_SOCKET_H */
|
14
contrib/libc-headers/asm-generic/sockios.h
Normal file
14
contrib/libc-headers/asm-generic/sockios.h
Normal file
@ -0,0 +1,14 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef __ASM_GENERIC_SOCKIOS_H
|
||||
#define __ASM_GENERIC_SOCKIOS_H
|
||||
|
||||
/* Socket-level I/O control calls. */
|
||||
#define FIOSETOWN 0x8901
|
||||
#define SIOCSPGRP 0x8902
|
||||
#define FIOGETOWN 0x8903
|
||||
#define SIOCGPGRP 0x8904
|
||||
#define SIOCATMARK 0x8905
|
||||
#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
|
||||
#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
|
||||
|
||||
#endif /* __ASM_GENERIC_SOCKIOS_H */
|
9
contrib/libc-headers/asm-generic/types.h
Normal file
9
contrib/libc-headers/asm-generic/types.h
Normal file
@ -0,0 +1,9 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _ASM_GENERIC_TYPES_H
|
||||
#define _ASM_GENERIC_TYPES_H
|
||||
/*
|
||||
* int-ll64 is used everywhere now.
|
||||
*/
|
||||
#include <asm-generic/int-ll64.h>
|
||||
|
||||
#endif /* _ASM_GENERIC_TYPES_H */
|
144
contrib/libc-headers/assert.h
Normal file
144
contrib/libc-headers/assert.h
Normal file
@ -0,0 +1,144 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.2 Diagnostics <assert.h>
|
||||
*/
|
||||
|
||||
#ifdef _ASSERT_H
|
||||
|
||||
# undef _ASSERT_H
|
||||
# undef assert
|
||||
# undef __ASSERT_VOID_CAST
|
||||
|
||||
# ifdef __USE_GNU
|
||||
# undef assert_perror
|
||||
# endif
|
||||
|
||||
#endif /* assert.h */
|
||||
|
||||
#define _ASSERT_H 1
|
||||
#include <features.h>
|
||||
|
||||
#if defined __cplusplus && __GNUC_PREREQ (2,95)
|
||||
# define __ASSERT_VOID_CAST static_cast<void>
|
||||
#else
|
||||
# define __ASSERT_VOID_CAST (void)
|
||||
#endif
|
||||
|
||||
/* void assert (int expression);
|
||||
|
||||
If NDEBUG is defined, do nothing.
|
||||
If not, and EXPRESSION is zero, print an error message and abort. */
|
||||
|
||||
#ifdef NDEBUG
|
||||
|
||||
# define assert(expr) (__ASSERT_VOID_CAST (0))
|
||||
|
||||
/* void assert_perror (int errnum);
|
||||
|
||||
If NDEBUG is defined, do nothing. If not, and ERRNUM is not zero, print an
|
||||
error message with the error text for ERRNUM and abort.
|
||||
(This is a GNU extension.) */
|
||||
|
||||
# ifdef __USE_GNU
|
||||
# define assert_perror(errnum) (__ASSERT_VOID_CAST (0))
|
||||
# endif
|
||||
|
||||
#else /* Not NDEBUG. */
|
||||
|
||||
#ifndef _ASSERT_H_DECLS
|
||||
#define _ASSERT_H_DECLS
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* This prints an "Assertion failed" message and aborts. */
|
||||
extern void __assert_fail (const char *__assertion, const char *__file,
|
||||
unsigned int __line, const char *__function)
|
||||
__THROW __attribute__ ((__noreturn__));
|
||||
|
||||
/* Likewise, but prints the error text for ERRNUM. */
|
||||
extern void __assert_perror_fail (int __errnum, const char *__file,
|
||||
unsigned int __line, const char *__function)
|
||||
__THROW __attribute__ ((__noreturn__));
|
||||
|
||||
|
||||
/* The following is not at all used here but needed for standard
|
||||
compliance. */
|
||||
extern void __assert (const char *__assertion, const char *__file, int __line)
|
||||
__THROW __attribute__ ((__noreturn__));
|
||||
|
||||
|
||||
__END_DECLS
|
||||
#endif /* Not _ASSERT_H_DECLS */
|
||||
|
||||
/* When possible, define assert so that it does not add extra
|
||||
parentheses around EXPR. Otherwise, those added parentheses would
|
||||
suppress warnings we'd expect to be detected by gcc's -Wparentheses. */
|
||||
# if defined __cplusplus
|
||||
# define assert(expr) \
|
||||
(static_cast <bool> (expr) \
|
||||
? void (0) \
|
||||
: __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
|
||||
# elif !defined __GNUC__ || defined __STRICT_ANSI__
|
||||
# define assert(expr) \
|
||||
((expr) \
|
||||
? __ASSERT_VOID_CAST (0) \
|
||||
: __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
|
||||
# else
|
||||
/* The first occurrence of EXPR is not evaluated due to the sizeof,
|
||||
but will trigger any pedantic warnings masked by the __extension__
|
||||
for the second occurrence. The ternary operator is required to
|
||||
support function pointers and bit fields in this context, and to
|
||||
suppress the evaluation of variable length arrays. */
|
||||
# define assert(expr) \
|
||||
((void) sizeof ((expr) ? 1 : 0), __extension__ ({ \
|
||||
if (expr) \
|
||||
; /* empty */ \
|
||||
else \
|
||||
__assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \
|
||||
}))
|
||||
# endif
|
||||
|
||||
# ifdef __USE_GNU
|
||||
# define assert_perror(errnum) \
|
||||
(!(errnum) \
|
||||
? __ASSERT_VOID_CAST (0) \
|
||||
: __assert_perror_fail ((errnum), __FILE__, __LINE__, __ASSERT_FUNCTION))
|
||||
# endif
|
||||
|
||||
/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
|
||||
which contains the name of the function currently being defined.
|
||||
This is broken in G++ before version 2.6.
|
||||
C9x has a similar variable called __func__, but prefer the GCC one since
|
||||
it demangles C++ function names. */
|
||||
# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
|
||||
# define __ASSERT_FUNCTION __extension__ __PRETTY_FUNCTION__
|
||||
# else
|
||||
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
|
||||
# define __ASSERT_FUNCTION __func__
|
||||
# else
|
||||
# define __ASSERT_FUNCTION ((const char *) 0)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* NDEBUG. */
|
||||
|
||||
|
||||
#if defined __USE_ISOC11 && !defined __cplusplus
|
||||
# undef static_assert
|
||||
# define static_assert _Static_assert
|
||||
#endif
|
39
contrib/libc-headers/byteswap.h
Normal file
39
contrib/libc-headers/byteswap.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* Copyright (C) 1997-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _BYTESWAP_H
|
||||
#define _BYTESWAP_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* Get the machine specific, optimized definitions. */
|
||||
#include <bits/byteswap.h>
|
||||
|
||||
|
||||
/* The following definitions must all be macros since otherwise some
|
||||
of the possible optimizations are not possible. */
|
||||
|
||||
/* Return a value with all bytes in the 16 bit argument swapped. */
|
||||
#define bswap_16(x) __bswap_16 (x)
|
||||
|
||||
/* Return a value with all bytes in the 32 bit argument swapped. */
|
||||
#define bswap_32(x) __bswap_32 (x)
|
||||
|
||||
/* Return a value with all bytes in the 64 bit argument swapped. */
|
||||
#define bswap_64(x) __bswap_64 (x)
|
||||
|
||||
#endif /* byteswap.h */
|
329
contrib/libc-headers/ctype.h
Normal file
329
contrib/libc-headers/ctype.h
Normal file
@ -0,0 +1,329 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard 7.4: Character handling <ctype.h>
|
||||
*/
|
||||
|
||||
#ifndef _CTYPE_H
|
||||
#define _CTYPE_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <bits/types.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#ifndef _ISbit
|
||||
/* These are all the characteristics of characters.
|
||||
If there get to be more than 16 distinct characteristics,
|
||||
many things must be changed that use `unsigned short int's.
|
||||
|
||||
The characteristics are stored always in network byte order (big
|
||||
endian). We define the bit value interpretations here dependent on the
|
||||
machine's byte order. */
|
||||
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define _ISbit(bit) (1 << (bit))
|
||||
# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
|
||||
# define _ISbit(bit) ((bit) < 8 ? ((1 << (bit)) << 8) : ((1 << (bit)) >> 8))
|
||||
# endif
|
||||
|
||||
enum
|
||||
{
|
||||
_ISupper = _ISbit (0), /* UPPERCASE. */
|
||||
_ISlower = _ISbit (1), /* lowercase. */
|
||||
_ISalpha = _ISbit (2), /* Alphabetic. */
|
||||
_ISdigit = _ISbit (3), /* Numeric. */
|
||||
_ISxdigit = _ISbit (4), /* Hexadecimal numeric. */
|
||||
_ISspace = _ISbit (5), /* Whitespace. */
|
||||
_ISprint = _ISbit (6), /* Printing. */
|
||||
_ISgraph = _ISbit (7), /* Graphical. */
|
||||
_ISblank = _ISbit (8), /* Blank (usually SPC and TAB). */
|
||||
_IScntrl = _ISbit (9), /* Control character. */
|
||||
_ISpunct = _ISbit (10), /* Punctuation. */
|
||||
_ISalnum = _ISbit (11) /* Alphanumeric. */
|
||||
};
|
||||
#endif /* ! _ISbit */
|
||||
|
||||
/* These are defined in ctype-info.c.
|
||||
The declarations here must match those in localeinfo.h.
|
||||
|
||||
In the thread-specific locale model (see `uselocale' in <locale.h>)
|
||||
we cannot use global variables for these as was done in the past.
|
||||
Instead, the following accessor functions return the address of
|
||||
each variable, which is local to the current thread if multithreaded.
|
||||
|
||||
These point into arrays of 384, so they can be indexed by any `unsigned
|
||||
char' value [0,255]; by EOF (-1); or by any `signed char' value
|
||||
[-128,-1). ISO C requires that the ctype functions work for `unsigned
|
||||
char' values and for EOF; we also support negative `signed char' values
|
||||
for broken old programs. The case conversion arrays are of `int's
|
||||
rather than `unsigned char's because tolower (EOF) must be EOF, which
|
||||
doesn't fit into an `unsigned char'. But today more important is that
|
||||
the arrays are also used for multi-byte character sets. */
|
||||
extern const unsigned short int **__ctype_b_loc (void)
|
||||
__THROW __attribute__ ((__const__));
|
||||
extern const __int32_t **__ctype_tolower_loc (void)
|
||||
__THROW __attribute__ ((__const__));
|
||||
extern const __int32_t **__ctype_toupper_loc (void)
|
||||
__THROW __attribute__ ((__const__));
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
# define __isctype(c, type) \
|
||||
((*__ctype_b_loc ())[(int) (c)] & (unsigned short int) type)
|
||||
#elif defined __USE_EXTERN_INLINES
|
||||
# define __isctype_f(type) \
|
||||
__extern_inline int \
|
||||
is##type (int __c) __THROW \
|
||||
{ \
|
||||
return (*__ctype_b_loc ())[(int) (__c)] & (unsigned short int) _IS##type; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */
|
||||
#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */
|
||||
|
||||
#define __exctype(name) extern int name (int) __THROW
|
||||
|
||||
/* The following names are all functions:
|
||||
int isCHARACTERISTIC(int c);
|
||||
which return nonzero iff C has CHARACTERISTIC.
|
||||
For the meaning of the characteristic names, see the `enum' above. */
|
||||
__exctype (isalnum);
|
||||
__exctype (isalpha);
|
||||
__exctype (iscntrl);
|
||||
__exctype (isdigit);
|
||||
__exctype (islower);
|
||||
__exctype (isgraph);
|
||||
__exctype (isprint);
|
||||
__exctype (ispunct);
|
||||
__exctype (isspace);
|
||||
__exctype (isupper);
|
||||
__exctype (isxdigit);
|
||||
|
||||
|
||||
/* Return the lowercase version of C. */
|
||||
extern int tolower (int __c) __THROW;
|
||||
|
||||
/* Return the uppercase version of C. */
|
||||
extern int toupper (int __c) __THROW;
|
||||
|
||||
|
||||
/* ISO C99 introduced one new function. */
|
||||
#ifdef __USE_ISOC99
|
||||
__exctype (isblank);
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Test C for a set of character classes according to MASK. */
|
||||
extern int isctype (int __c, int __mask) __THROW;
|
||||
#endif
|
||||
|
||||
#if defined __USE_MISC || defined __USE_XOPEN
|
||||
|
||||
/* Return nonzero iff C is in the ASCII set
|
||||
(i.e., is no more than 7 bits wide). */
|
||||
extern int isascii (int __c) __THROW;
|
||||
|
||||
/* Return the part of C that is in the ASCII set
|
||||
(i.e., the low-order 7 bits of C). */
|
||||
extern int toascii (int __c) __THROW;
|
||||
|
||||
/* These are the same as `toupper' and `tolower' except that they do not
|
||||
check the argument for being in the range of a `char'. */
|
||||
__exctype (_toupper);
|
||||
__exctype (_tolower);
|
||||
#endif /* Use X/Open or use misc. */
|
||||
|
||||
/* This code is needed for the optimized mapping functions. */
|
||||
#define __tobody(c, f, a, args) \
|
||||
(__extension__ \
|
||||
({ int __res; \
|
||||
if (sizeof (c) > 1) \
|
||||
{ \
|
||||
if (__builtin_constant_p (c)) \
|
||||
{ \
|
||||
int __c = (c); \
|
||||
__res = __c < -128 || __c > 255 ? __c : (a)[__c]; \
|
||||
} \
|
||||
else \
|
||||
__res = f args; \
|
||||
} \
|
||||
else \
|
||||
__res = (a)[(int) (c)]; \
|
||||
__res; }))
|
||||
|
||||
#if !defined __NO_CTYPE
|
||||
# ifdef __isctype_f
|
||||
__isctype_f (alnum)
|
||||
__isctype_f (alpha)
|
||||
__isctype_f (cntrl)
|
||||
__isctype_f (digit)
|
||||
__isctype_f (lower)
|
||||
__isctype_f (graph)
|
||||
__isctype_f (print)
|
||||
__isctype_f (punct)
|
||||
__isctype_f (space)
|
||||
__isctype_f (upper)
|
||||
__isctype_f (xdigit)
|
||||
# ifdef __USE_ISOC99
|
||||
__isctype_f (blank)
|
||||
# endif
|
||||
# elif defined __isctype
|
||||
# define isalnum(c) __isctype((c), _ISalnum)
|
||||
# define isalpha(c) __isctype((c), _ISalpha)
|
||||
# define iscntrl(c) __isctype((c), _IScntrl)
|
||||
# define isdigit(c) __isctype((c), _ISdigit)
|
||||
# define islower(c) __isctype((c), _ISlower)
|
||||
# define isgraph(c) __isctype((c), _ISgraph)
|
||||
# define isprint(c) __isctype((c), _ISprint)
|
||||
# define ispunct(c) __isctype((c), _ISpunct)
|
||||
# define isspace(c) __isctype((c), _ISspace)
|
||||
# define isupper(c) __isctype((c), _ISupper)
|
||||
# define isxdigit(c) __isctype((c), _ISxdigit)
|
||||
# ifdef __USE_ISOC99
|
||||
# define isblank(c) __isctype((c), _ISblank)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef __USE_EXTERN_INLINES
|
||||
__extern_inline int
|
||||
__NTH (tolower (int __c))
|
||||
{
|
||||
return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c;
|
||||
}
|
||||
|
||||
__extern_inline int
|
||||
__NTH (toupper (int __c))
|
||||
{
|
||||
return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c;
|
||||
}
|
||||
# endif
|
||||
|
||||
# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
|
||||
# define tolower(c) __tobody (c, tolower, *__ctype_tolower_loc (), (c))
|
||||
# define toupper(c) __tobody (c, toupper, *__ctype_toupper_loc (), (c))
|
||||
# endif /* Optimizing gcc */
|
||||
|
||||
# if defined __USE_MISC || defined __USE_XOPEN
|
||||
# define isascii(c) __isascii (c)
|
||||
# define toascii(c) __toascii (c)
|
||||
|
||||
# define _tolower(c) ((int) (*__ctype_tolower_loc ())[(int) (c)])
|
||||
# define _toupper(c) ((int) (*__ctype_toupper_loc ())[(int) (c)])
|
||||
# endif
|
||||
|
||||
#endif /* Not __NO_CTYPE. */
|
||||
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* POSIX.1-2008 extended locale interface (see locale.h). */
|
||||
# include <bits/types/locale_t.h>
|
||||
|
||||
/* These definitions are similar to the ones above but all functions
|
||||
take as an argument a handle for the locale which shall be used. */
|
||||
# define __isctype_l(c, type, locale) \
|
||||
((locale)->__ctype_b[(int) (c)] & (unsigned short int) type)
|
||||
|
||||
# define __exctype_l(name) \
|
||||
extern int name (int, locale_t) __THROW
|
||||
|
||||
/* The following names are all functions:
|
||||
int isCHARACTERISTIC(int c, locale_t *locale);
|
||||
which return nonzero iff C has CHARACTERISTIC.
|
||||
For the meaning of the characteristic names, see the `enum' above. */
|
||||
__exctype_l (isalnum_l);
|
||||
__exctype_l (isalpha_l);
|
||||
__exctype_l (iscntrl_l);
|
||||
__exctype_l (isdigit_l);
|
||||
__exctype_l (islower_l);
|
||||
__exctype_l (isgraph_l);
|
||||
__exctype_l (isprint_l);
|
||||
__exctype_l (ispunct_l);
|
||||
__exctype_l (isspace_l);
|
||||
__exctype_l (isupper_l);
|
||||
__exctype_l (isxdigit_l);
|
||||
|
||||
__exctype_l (isblank_l);
|
||||
|
||||
|
||||
/* Return the lowercase version of C in locale L. */
|
||||
extern int __tolower_l (int __c, locale_t __l) __THROW;
|
||||
extern int tolower_l (int __c, locale_t __l) __THROW;
|
||||
|
||||
/* Return the uppercase version of C. */
|
||||
extern int __toupper_l (int __c, locale_t __l) __THROW;
|
||||
extern int toupper_l (int __c, locale_t __l) __THROW;
|
||||
|
||||
# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
|
||||
# define __tolower_l(c, locale) \
|
||||
__tobody (c, __tolower_l, (locale)->__ctype_tolower, (c, locale))
|
||||
# define __toupper_l(c, locale) \
|
||||
__tobody (c, __toupper_l, (locale)->__ctype_toupper, (c, locale))
|
||||
# define tolower_l(c, locale) __tolower_l ((c), (locale))
|
||||
# define toupper_l(c, locale) __toupper_l ((c), (locale))
|
||||
# endif /* Optimizing gcc */
|
||||
|
||||
|
||||
# ifndef __NO_CTYPE
|
||||
# define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l))
|
||||
# define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l))
|
||||
# define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l))
|
||||
# define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l))
|
||||
# define __islower_l(c,l) __isctype_l((c), _ISlower, (l))
|
||||
# define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l))
|
||||
# define __isprint_l(c,l) __isctype_l((c), _ISprint, (l))
|
||||
# define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l))
|
||||
# define __isspace_l(c,l) __isctype_l((c), _ISspace, (l))
|
||||
# define __isupper_l(c,l) __isctype_l((c), _ISupper, (l))
|
||||
# define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l))
|
||||
|
||||
# define __isblank_l(c,l) __isctype_l((c), _ISblank, (l))
|
||||
|
||||
# ifdef __USE_MISC
|
||||
# define __isascii_l(c,l) ((l), __isascii (c))
|
||||
# define __toascii_l(c,l) ((l), __toascii (c))
|
||||
# endif
|
||||
|
||||
# define isalnum_l(c,l) __isalnum_l ((c), (l))
|
||||
# define isalpha_l(c,l) __isalpha_l ((c), (l))
|
||||
# define iscntrl_l(c,l) __iscntrl_l ((c), (l))
|
||||
# define isdigit_l(c,l) __isdigit_l ((c), (l))
|
||||
# define islower_l(c,l) __islower_l ((c), (l))
|
||||
# define isgraph_l(c,l) __isgraph_l ((c), (l))
|
||||
# define isprint_l(c,l) __isprint_l ((c), (l))
|
||||
# define ispunct_l(c,l) __ispunct_l ((c), (l))
|
||||
# define isspace_l(c,l) __isspace_l ((c), (l))
|
||||
# define isupper_l(c,l) __isupper_l ((c), (l))
|
||||
# define isxdigit_l(c,l) __isxdigit_l ((c), (l))
|
||||
|
||||
# define isblank_l(c,l) __isblank_l ((c), (l))
|
||||
|
||||
# ifdef __USE_MISC
|
||||
# define isascii_l(c,l) __isascii_l ((c), (l))
|
||||
# define toascii_l(c,l) __toascii_l ((c), (l))
|
||||
# endif
|
||||
|
||||
# endif /* Not __NO_CTYPE. */
|
||||
|
||||
#endif /* Use POSIX 2008. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ctype.h */
|
404
contrib/libc-headers/dirent.h
Normal file
404
contrib/libc-headers/dirent.h
Normal file
@ -0,0 +1,404 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* POSIX Standard: 5.1.2 Directory Operations <dirent.h>
|
||||
*/
|
||||
|
||||
#ifndef _DIRENT_H
|
||||
#define _DIRENT_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <bits/types.h>
|
||||
|
||||
#ifdef __USE_XOPEN
|
||||
# ifndef __ino_t_defined
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
typedef __ino_t ino_t;
|
||||
# else
|
||||
typedef __ino64_t ino_t;
|
||||
# endif
|
||||
# define __ino_t_defined
|
||||
# endif
|
||||
# if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
|
||||
typedef __ino64_t ino64_t;
|
||||
# define __ino64_t_defined
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* This file defines `struct dirent'.
|
||||
|
||||
It defines the macro `_DIRENT_HAVE_D_NAMLEN' iff there is a `d_namlen'
|
||||
member that gives the length of `d_name'.
|
||||
|
||||
It defines the macro `_DIRENT_HAVE_D_RECLEN' iff there is a `d_reclen'
|
||||
member that gives the size of the entire directory entry.
|
||||
|
||||
It defines the macro `_DIRENT_HAVE_D_OFF' iff there is a `d_off'
|
||||
member that gives the file offset of the next directory entry.
|
||||
|
||||
It defines the macro `_DIRENT_HAVE_D_TYPE' iff there is a `d_type'
|
||||
member that gives the type of the file.
|
||||
*/
|
||||
|
||||
#include <bits/dirent.h>
|
||||
|
||||
#if defined __USE_MISC && !defined d_fileno
|
||||
# define d_ino d_fileno /* Backward compatibility. */
|
||||
#endif
|
||||
|
||||
/* These macros extract size information from a `struct dirent *'.
|
||||
They may evaluate their argument multiple times, so it must not
|
||||
have side effects. Each of these may involve a relatively costly
|
||||
call to `strlen' on some systems, so these values should be cached.
|
||||
|
||||
_D_EXACT_NAMLEN (DP) returns the length of DP->d_name, not including
|
||||
its terminating null character.
|
||||
|
||||
_D_ALLOC_NAMLEN (DP) returns a size at least (_D_EXACT_NAMLEN (DP) + 1);
|
||||
that is, the allocation size needed to hold the DP->d_name string.
|
||||
Use this macro when you don't need the exact length, just an upper bound.
|
||||
This macro is less likely to require calling `strlen' than _D_EXACT_NAMLEN.
|
||||
*/
|
||||
|
||||
#ifdef _DIRENT_HAVE_D_NAMLEN
|
||||
# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
|
||||
# define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1)
|
||||
#else
|
||||
# define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name))
|
||||
# ifdef _DIRENT_HAVE_D_RECLEN
|
||||
# define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name[0])
|
||||
# else
|
||||
# define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \
|
||||
_D_EXACT_NAMLEN (d) + 1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* File types for `d_type'. */
|
||||
enum
|
||||
{
|
||||
DT_UNKNOWN = 0,
|
||||
# define DT_UNKNOWN DT_UNKNOWN
|
||||
DT_FIFO = 1,
|
||||
# define DT_FIFO DT_FIFO
|
||||
DT_CHR = 2,
|
||||
# define DT_CHR DT_CHR
|
||||
DT_DIR = 4,
|
||||
# define DT_DIR DT_DIR
|
||||
DT_BLK = 6,
|
||||
# define DT_BLK DT_BLK
|
||||
DT_REG = 8,
|
||||
# define DT_REG DT_REG
|
||||
DT_LNK = 10,
|
||||
# define DT_LNK DT_LNK
|
||||
DT_SOCK = 12,
|
||||
# define DT_SOCK DT_SOCK
|
||||
DT_WHT = 14
|
||||
# define DT_WHT DT_WHT
|
||||
};
|
||||
|
||||
/* Convert between stat structure types and directory types. */
|
||||
# define IFTODT(mode) (((mode) & 0170000) >> 12)
|
||||
# define DTTOIF(dirtype) ((dirtype) << 12)
|
||||
#endif
|
||||
|
||||
|
||||
/* This is the data type of directory stream objects.
|
||||
The actual structure is opaque to users. */
|
||||
typedef struct __dirstream DIR;
|
||||
|
||||
/* Open a directory stream on NAME.
|
||||
Return a DIR stream on the directory, or NULL if it could not be opened.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern DIR *opendir (const char *__name) __nonnull ((1));
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Same as opendir, but open the stream on the file descriptor FD.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern DIR *fdopendir (int __fd);
|
||||
#endif
|
||||
|
||||
/* Close the directory stream DIRP.
|
||||
Return 0 if successful, -1 if not.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int closedir (DIR *__dirp) __nonnull ((1));
|
||||
|
||||
/* Read a directory entry from DIRP. Return a pointer to a `struct
|
||||
dirent' describing the entry, or NULL for EOF or error. The
|
||||
storage returned may be overwritten by a later readdir call on the
|
||||
same DIR stream.
|
||||
|
||||
If the Large File Support API is selected we have to use the
|
||||
appropriate interface.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
extern struct dirent *readdir (DIR *__dirp) __nonnull ((1));
|
||||
#else
|
||||
# ifdef __REDIRECT
|
||||
extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64)
|
||||
__nonnull ((1));
|
||||
# else
|
||||
# define readdir readdir64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
extern struct dirent64 *readdir64 (DIR *__dirp) __nonnull ((1));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_POSIX
|
||||
/* Reentrant version of `readdir'. Return in RESULT a pointer to the
|
||||
next entry.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int readdir_r (DIR *__restrict __dirp,
|
||||
struct dirent *__restrict __entry,
|
||||
struct dirent **__restrict __result)
|
||||
__nonnull ((1, 2, 3)) __attribute_deprecated__;
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (readdir_r,
|
||||
(DIR *__restrict __dirp,
|
||||
struct dirent *__restrict __entry,
|
||||
struct dirent **__restrict __result),
|
||||
readdir64_r)
|
||||
__nonnull ((1, 2, 3)) __attribute_deprecated__;
|
||||
# else
|
||||
# define readdir_r readdir64_r
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef __USE_LARGEFILE64
|
||||
extern int readdir64_r (DIR *__restrict __dirp,
|
||||
struct dirent64 *__restrict __entry,
|
||||
struct dirent64 **__restrict __result)
|
||||
__nonnull ((1, 2, 3)) __attribute_deprecated__;
|
||||
# endif
|
||||
#endif /* POSIX or misc */
|
||||
|
||||
/* Rewind DIRP to the beginning of the directory. */
|
||||
extern void rewinddir (DIR *__dirp) __THROW __nonnull ((1));
|
||||
|
||||
#if defined __USE_MISC || defined __USE_XOPEN
|
||||
# include <bits/types.h>
|
||||
|
||||
/* Seek to position POS on DIRP. */
|
||||
extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1));
|
||||
|
||||
/* Return the current position of DIRP. */
|
||||
extern long int telldir (DIR *__dirp) __THROW __nonnull ((1));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
|
||||
/* Return the file descriptor used by DIRP. */
|
||||
extern int dirfd (DIR *__dirp) __THROW __nonnull ((1));
|
||||
|
||||
# if defined __OPTIMIZE__ && defined _DIR_dirfd
|
||||
# define dirfd(dirp) _DIR_dirfd (dirp)
|
||||
# endif
|
||||
|
||||
# ifdef __USE_MISC
|
||||
# ifndef MAXNAMLEN
|
||||
/* Get the definitions of the POSIX.1 limits. */
|
||||
# include <bits/posix1_lim.h>
|
||||
|
||||
/* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */
|
||||
# ifdef NAME_MAX
|
||||
# define MAXNAMLEN NAME_MAX
|
||||
# else
|
||||
# define MAXNAMLEN 255
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# define __need_size_t
|
||||
# include <stddef.h>
|
||||
|
||||
/* Scan the directory DIR, calling SELECTOR on each directory entry.
|
||||
Entries for which SELECT returns nonzero are individually malloc'd,
|
||||
sorted using qsort with CMP, and collected in a malloc'd array in
|
||||
*NAMELIST. Returns the number of entries selected, or -1 on error.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int scandir (const char *__restrict __dir,
|
||||
struct dirent ***__restrict __namelist,
|
||||
int (*__selector) (const struct dirent *),
|
||||
int (*__cmp) (const struct dirent **,
|
||||
const struct dirent **))
|
||||
__nonnull ((1, 2));
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (scandir,
|
||||
(const char *__restrict __dir,
|
||||
struct dirent ***__restrict __namelist,
|
||||
int (*__selector) (const struct dirent *),
|
||||
int (*__cmp) (const struct dirent **,
|
||||
const struct dirent **)),
|
||||
scandir64) __nonnull ((1, 2));
|
||||
# else
|
||||
# define scandir scandir64
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined __USE_GNU && defined __USE_LARGEFILE64
|
||||
/* This function is like `scandir' but it uses the 64bit dirent structure.
|
||||
Please note that the CMP function must now work with struct dirent64 **. */
|
||||
extern int scandir64 (const char *__restrict __dir,
|
||||
struct dirent64 ***__restrict __namelist,
|
||||
int (*__selector) (const struct dirent64 *),
|
||||
int (*__cmp) (const struct dirent64 **,
|
||||
const struct dirent64 **))
|
||||
__nonnull ((1, 2));
|
||||
# endif
|
||||
|
||||
# ifdef __USE_GNU
|
||||
/* Similar to `scandir' but a relative DIR name is interpreted relative
|
||||
to the directory for which DFD is a descriptor.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int scandirat (int __dfd, const char *__restrict __dir,
|
||||
struct dirent ***__restrict __namelist,
|
||||
int (*__selector) (const struct dirent *),
|
||||
int (*__cmp) (const struct dirent **,
|
||||
const struct dirent **))
|
||||
__nonnull ((2, 3));
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (scandirat,
|
||||
(int __dfd, const char *__restrict __dir,
|
||||
struct dirent ***__restrict __namelist,
|
||||
int (*__selector) (const struct dirent *),
|
||||
int (*__cmp) (const struct dirent **,
|
||||
const struct dirent **)),
|
||||
scandirat64) __nonnull ((2, 3));
|
||||
# else
|
||||
# define scandirat scandirat64
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* 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 scandirat64 (int __dfd, const char *__restrict __dir,
|
||||
struct dirent64 ***__restrict __namelist,
|
||||
int (*__selector) (const struct dirent64 *),
|
||||
int (*__cmp) (const struct dirent64 **,
|
||||
const struct dirent64 **))
|
||||
__nonnull ((2, 3));
|
||||
# endif
|
||||
|
||||
/* Function to compare two `struct dirent's alphabetically. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int alphasort (const struct dirent **__e1,
|
||||
const struct dirent **__e2)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT_NTH (alphasort,
|
||||
(const struct dirent **__e1,
|
||||
const struct dirent **__e2),
|
||||
alphasort64) __attribute_pure__ __nonnull ((1, 2));
|
||||
# else
|
||||
# define alphasort alphasort64
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined __USE_GNU && defined __USE_LARGEFILE64
|
||||
extern int alphasort64 (const struct dirent64 **__e1,
|
||||
const struct dirent64 **__e2)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
# endif
|
||||
#endif /* Use XPG7. */
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Read directory entries from FD into BUF, reading at most NBYTES.
|
||||
Reading starts at offset *BASEP, and *BASEP is updated with the new
|
||||
position after reading. Returns the number of bytes read; zero when at
|
||||
end of directory; or -1 for errors. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
|
||||
size_t __nbytes,
|
||||
__off_t *__restrict __basep)
|
||||
__THROW __nonnull ((2, 4));
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern __ssize_t __REDIRECT_NTH (getdirentries,
|
||||
(int __fd, char *__restrict __buf,
|
||||
size_t __nbytes,
|
||||
__off64_t *__restrict __basep),
|
||||
getdirentries64) __nonnull ((2, 4));
|
||||
# else
|
||||
# define getdirentries getdirentries64
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef __USE_LARGEFILE64
|
||||
extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf,
|
||||
size_t __nbytes,
|
||||
__off64_t *__restrict __basep)
|
||||
__THROW __nonnull ((2, 4));
|
||||
# endif
|
||||
#endif /* Use misc. */
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Function to compare two `struct dirent's by name & version. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int versionsort (const struct dirent **__e1,
|
||||
const struct dirent **__e2)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT_NTH (versionsort,
|
||||
(const struct dirent **__e1,
|
||||
const struct dirent **__e2),
|
||||
versionsort64)
|
||||
__attribute_pure__ __nonnull ((1, 2));
|
||||
# else
|
||||
# define versionsort versionsort64
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef __USE_LARGEFILE64
|
||||
extern int versionsort64 (const struct dirent64 **__e1,
|
||||
const struct dirent64 **__e2)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
# endif
|
||||
#endif /* Use GNU. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* dirent.h */
|
190
contrib/libc-headers/dlfcn.h
Normal file
190
contrib/libc-headers/dlfcn.h
Normal file
@ -0,0 +1,190 @@
|
||||
/* User functions for run-time dynamic loading.
|
||||
Copyright (C) 1995-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _DLFCN_H
|
||||
#define _DLFCN_H 1
|
||||
|
||||
#include <features.h>
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
/* 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)
|
||||
|
||||
/* 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)
|
||||
|
||||
|
||||
/* Type for namespace indeces. */
|
||||
typedef long int Lmid_t;
|
||||
|
||||
/* Special namespace ID values. */
|
||||
# define LM_ID_BASE 0 /* Initial namespace. */
|
||||
# define LM_ID_NEWLM -1 /* For dlmopen: request new namespace. */
|
||||
#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 (const char *__file, int __mode) __THROWNL;
|
||||
|
||||
/* Unmap and close a shared object opened by `dlopen'.
|
||||
The handle cannot be used again after calling `dlclose'. */
|
||||
extern int dlclose (void *__handle) __THROWNL __nonnull ((1));
|
||||
|
||||
/* Find the run-time address in the shared object HANDLE refers to
|
||||
of the symbol called NAME. */
|
||||
extern void *dlsym (void *__restrict __handle,
|
||||
const char *__restrict __name) __THROW __nonnull ((2));
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Like `dlopen', but request object to be allocated in a new namespace. */
|
||||
extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROWNL;
|
||||
|
||||
/* Find the run-time address in the shared object HANDLE refers to
|
||||
of the symbol called NAME with VERSION. */
|
||||
extern void *dlvsym (void *__restrict __handle,
|
||||
const char *__restrict __name,
|
||||
const char *__restrict __version)
|
||||
__THROW __nonnull ((2, 3));
|
||||
#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 (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. */
|
||||
extern int dladdr (const void *__address, Dl_info *__info)
|
||||
__THROW __nonnull ((2));
|
||||
|
||||
/* Same as `dladdr', but additionally sets *EXTRA_INFO according to FLAGS. */
|
||||
extern int dladdr1 (const void *__address, Dl_info *__info,
|
||||
void **__extra_info, int __flags) __THROW __nonnull ((2));
|
||||
|
||||
/* These are the possible values for the FLAGS argument to `dladdr1'.
|
||||
This indicates what extra information is stored at *EXTRA_INFO.
|
||||
It may also be zero, in which case the EXTRA_INFO argument is not used. */
|
||||
enum
|
||||
{
|
||||
/* Matching symbol table entry (const ElfNN_Sym *). */
|
||||
RTLD_DL_SYMENT = 1,
|
||||
|
||||
/* The object containing the address (struct link_map *). */
|
||||
RTLD_DL_LINKMAP = 2
|
||||
};
|
||||
|
||||
|
||||
/* Get information about the shared object HANDLE refers to.
|
||||
REQUEST is from among the values below, and determines the use of ARG.
|
||||
|
||||
On success, returns zero. On failure, returns -1 and records an error
|
||||
message to be fetched with `dlerror'. */
|
||||
extern int dlinfo (void *__restrict __handle,
|
||||
int __request, void *__restrict __arg)
|
||||
__THROW __nonnull ((1, 3));
|
||||
|
||||
/* These are the possible values for the REQUEST argument to `dlinfo'. */
|
||||
enum
|
||||
{
|
||||
/* Treat ARG as `lmid_t *'; store namespace ID for HANDLE there. */
|
||||
RTLD_DI_LMID = 1,
|
||||
|
||||
/* Treat ARG as `struct link_map **';
|
||||
store the `struct link_map *' for HANDLE there. */
|
||||
RTLD_DI_LINKMAP = 2,
|
||||
|
||||
RTLD_DI_CONFIGADDR = 3, /* Unsupported, defined by Solaris. */
|
||||
|
||||
/* Treat ARG as `Dl_serinfo *' (see below), and fill in to describe the
|
||||
directories that will be searched for dependencies of this object.
|
||||
RTLD_DI_SERINFOSIZE fills in just the `dls_cnt' and `dls_size'
|
||||
entries to indicate the size of the buffer that must be passed to
|
||||
RTLD_DI_SERINFO to fill in the full information. */
|
||||
RTLD_DI_SERINFO = 4,
|
||||
RTLD_DI_SERINFOSIZE = 5,
|
||||
|
||||
/* Treat ARG as `char *', and store there the directory name used to
|
||||
expand $ORIGIN in this shared object's dependency file names. */
|
||||
RTLD_DI_ORIGIN = 6,
|
||||
|
||||
RTLD_DI_PROFILENAME = 7, /* Unsupported, defined by Solaris. */
|
||||
RTLD_DI_PROFILEOUT = 8, /* Unsupported, defined by Solaris. */
|
||||
|
||||
/* Treat ARG as `size_t *', and store there the TLS module ID
|
||||
of this object's PT_TLS segment, as used in TLS relocations;
|
||||
store zero if this object does not define a PT_TLS segment. */
|
||||
RTLD_DI_TLS_MODID = 9,
|
||||
|
||||
/* Treat ARG as `void **', and store there a pointer to the calling
|
||||
thread's TLS block corresponding to this object's PT_TLS segment.
|
||||
Store a null pointer if this object does not define a PT_TLS
|
||||
segment, or if the calling thread has not allocated a block for it. */
|
||||
RTLD_DI_TLS_DATA = 10,
|
||||
|
||||
RTLD_DI_MAX = 10
|
||||
};
|
||||
|
||||
|
||||
/* This is the type of elements in `Dl_serinfo', below.
|
||||
The `dls_name' member points to space in the buffer passed to `dlinfo'. */
|
||||
typedef struct
|
||||
{
|
||||
char *dls_name; /* Name of library search path directory. */
|
||||
unsigned int dls_flags; /* Indicates where this directory came from. */
|
||||
} Dl_serpath;
|
||||
|
||||
/* This is the structure that must be passed (by reference) to `dlinfo' for
|
||||
the RTLD_DI_SERINFO and RTLD_DI_SERINFOSIZE requests. */
|
||||
typedef struct
|
||||
{
|
||||
size_t dls_size; /* Size in bytes of the whole buffer. */
|
||||
unsigned int dls_cnt; /* Number of elements in `dls_serpath'. */
|
||||
Dl_serpath dls_serpath[1]; /* Actually longer, dls_cnt elements. */
|
||||
} Dl_serinfo;
|
||||
#endif /* __USE_GNU */
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* dlfcn.h */
|
3789
contrib/libc-headers/elf.h
Normal file
3789
contrib/libc-headers/elf.h
Normal file
File diff suppressed because it is too large
Load Diff
97
contrib/libc-headers/endian.h
Normal file
97
contrib/libc-headers/endian.h
Normal file
@ -0,0 +1,97 @@
|
||||
/* Copyright (C) 1992-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#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, 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
|
||||
#define __PDP_ENDIAN 3412
|
||||
|
||||
/* This file defines `__BYTE_ORDER' for the particular machine. */
|
||||
#include <bits/endian.h>
|
||||
|
||||
/* Some machines may need to use a different endianness for floating point
|
||||
values. */
|
||||
#ifndef __FLOAT_WORD_ORDER
|
||||
# define __FLOAT_WORD_ORDER __BYTE_ORDER
|
||||
#endif
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# define LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||
# define BIG_ENDIAN __BIG_ENDIAN
|
||||
# define PDP_ENDIAN __PDP_ENDIAN
|
||||
# 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
|
||||
|
||||
|
||||
#if defined __USE_MISC && !defined __ASSEMBLER__
|
||||
/* Conversion interfaces. */
|
||||
# include <bits/byteswap.h>
|
||||
# include <bits/uintn-identity.h>
|
||||
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define htobe16(x) __bswap_16 (x)
|
||||
# define htole16(x) __uint16_identity (x)
|
||||
# define be16toh(x) __bswap_16 (x)
|
||||
# define le16toh(x) __uint16_identity (x)
|
||||
|
||||
# define htobe32(x) __bswap_32 (x)
|
||||
# define htole32(x) __uint32_identity (x)
|
||||
# define be32toh(x) __bswap_32 (x)
|
||||
# define le32toh(x) __uint32_identity (x)
|
||||
|
||||
# define htobe64(x) __bswap_64 (x)
|
||||
# define htole64(x) __uint64_identity (x)
|
||||
# define be64toh(x) __bswap_64 (x)
|
||||
# define le64toh(x) __uint64_identity (x)
|
||||
|
||||
# else
|
||||
# define htobe16(x) __uint16_identity (x)
|
||||
# define htole16(x) __bswap_16 (x)
|
||||
# define be16toh(x) __uint16_identity (x)
|
||||
# define le16toh(x) __bswap_16 (x)
|
||||
|
||||
# define htobe32(x) __uint32_identity (x)
|
||||
# define htole32(x) __bswap_32 (x)
|
||||
# define be32toh(x) __uint32_identity (x)
|
||||
# define le32toh(x) __bswap_32 (x)
|
||||
|
||||
# define htobe64(x) __uint64_identity (x)
|
||||
# define htole64(x) __bswap_64 (x)
|
||||
# define be64toh(x) __uint64_identity (x)
|
||||
# define le64toh(x) __bswap_64 (x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* endian.h */
|
60
contrib/libc-headers/errno.h
Normal file
60
contrib/libc-headers/errno.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.5 Errors <errno.h>
|
||||
*/
|
||||
|
||||
#ifndef _ERRNO_H
|
||||
#define _ERRNO_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* The system-specific definitions of the E* constants, as macros. */
|
||||
#include <bits/errno.h>
|
||||
|
||||
/* When included from assembly language, this header only provides the
|
||||
E* constants. */
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* The error code set by various library functions. */
|
||||
extern int *__errno_location (void) __THROW __attribute_const__;
|
||||
# define errno (*__errno_location ())
|
||||
|
||||
# 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]. */
|
||||
extern char *program_invocation_name;
|
||||
extern char *program_invocation_short_name;
|
||||
|
||||
/* bits/errno.h may have defined this type. If it didn't, provide a
|
||||
fallback definition. */
|
||||
# ifndef __error_t_defined
|
||||
# define __error_t_defined 1
|
||||
typedef int error_t;
|
||||
# endif
|
||||
|
||||
# endif /* __USE_GNU */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
#endif /* errno.h */
|
43
contrib/libc-headers/execinfo.h
Normal file
43
contrib/libc-headers/execinfo.h
Normal file
@ -0,0 +1,43 @@
|
||||
/* Copyright (C) 1998-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _EXECINFO_H
|
||||
#define _EXECINFO_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Store up to SIZE return address of the current program state in
|
||||
ARRAY and return the exact number of values stored. */
|
||||
extern int backtrace (void **__array, int __size) __nonnull ((1));
|
||||
|
||||
|
||||
/* Return names of functions from the backtrace list in ARRAY in a newly
|
||||
malloc()ed memory block. */
|
||||
extern char **backtrace_symbols (void *const *__array, int __size)
|
||||
__THROW __nonnull ((1));
|
||||
|
||||
|
||||
/* This function is similar to backtrace_symbols() but it writes the result
|
||||
immediately to a file. */
|
||||
extern void backtrace_symbols_fd (void *const *__array, int __size, int __fd)
|
||||
__THROW __nonnull ((1));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* execinfo.h */
|
295
contrib/libc-headers/fcntl.h
Normal file
295
contrib/libc-headers/fcntl.h
Normal file
@ -0,0 +1,295 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* POSIX Standard: 6.5 File Control Operations <fcntl.h>
|
||||
*/
|
||||
|
||||
#ifndef _FCNTL_H
|
||||
#define _FCNTL_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* This must be early so <bits/fcntl.h> can define types winningly. */
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Get __mode_t, __dev_t and __off_t .*/
|
||||
#include <bits/types.h>
|
||||
|
||||
/* Get the definitions of O_*, F_*, FD_*: all the
|
||||
numbers and flag bits for `open', `fcntl', et al. */
|
||||
#include <bits/fcntl.h>
|
||||
|
||||
/* Detect if open needs mode as a third argument (or for openat as a fourth
|
||||
argument). */
|
||||
#ifdef __O_TMPFILE
|
||||
# define __OPEN_NEEDS_MODE(oflag) \
|
||||
(((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE)
|
||||
#else
|
||||
# define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0)
|
||||
#endif
|
||||
|
||||
/* POSIX.1-2001 specifies that these types are defined by <fcntl.h>.
|
||||
Earlier POSIX standards permitted any type ending in `_t' to be defined
|
||||
by any POSIX header, so we don't conditionalize the definitions here. */
|
||||
#ifndef __mode_t_defined
|
||||
typedef __mode_t mode_t;
|
||||
# define __mode_t_defined
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
|
||||
typedef __off64_t off64_t;
|
||||
# define __off64_t_defined
|
||||
#endif
|
||||
|
||||
#ifndef __pid_t_defined
|
||||
typedef __pid_t pid_t;
|
||||
# define __pid_t_defined
|
||||
#endif
|
||||
|
||||
/* For XPG all symbols from <sys/stat.h> should also be available. */
|
||||
#ifdef __USE_XOPEN2K8
|
||||
# include <bits/types/struct_timespec.h>
|
||||
#endif
|
||||
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
|
||||
# include <bits/stat.h>
|
||||
|
||||
# define S_IFMT __S_IFMT
|
||||
# define S_IFDIR __S_IFDIR
|
||||
# define S_IFCHR __S_IFCHR
|
||||
# define S_IFBLK __S_IFBLK
|
||||
# define S_IFREG __S_IFREG
|
||||
# ifdef __S_IFIFO
|
||||
# define S_IFIFO __S_IFIFO
|
||||
# endif
|
||||
# ifdef __S_IFLNK
|
||||
# define S_IFLNK __S_IFLNK
|
||||
# endif
|
||||
# if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && defined __S_IFSOCK
|
||||
# define S_IFSOCK __S_IFSOCK
|
||||
# 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_MISC || defined __USE_XOPEN
|
||||
/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
|
||||
# define S_ISVTX __S_ISVTX
|
||||
# endif
|
||||
|
||||
# define S_IRUSR __S_IREAD /* Read by owner. */
|
||||
# define S_IWUSR __S_IWRITE /* Write by owner. */
|
||||
# define S_IXUSR __S_IEXEC /* Execute by owner. */
|
||||
/* Read, write, and execute by owner. */
|
||||
# define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
|
||||
|
||||
# define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
|
||||
# define S_IWGRP (S_IWUSR >> 3) /* Write by group. */
|
||||
# define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */
|
||||
/* Read, write, and execute by group. */
|
||||
# define S_IRWXG (S_IRWXU >> 3)
|
||||
|
||||
# define S_IROTH (S_IRGRP >> 3) /* Read by others. */
|
||||
# define S_IWOTH (S_IWGRP >> 3) /* Write by others. */
|
||||
# define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */
|
||||
/* Read, write, and execute by others. */
|
||||
# define S_IRWXO (S_IRWXG >> 3)
|
||||
#endif
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# ifndef R_OK /* Verbatim from <unistd.h>. Ugh. */
|
||||
/* Values for the second argument to access.
|
||||
These may be OR'd together. */
|
||||
# define R_OK 4 /* Test for read permission. */
|
||||
# define W_OK 2 /* Test for write permission. */
|
||||
# define X_OK 1 /* Test for execute permission. */
|
||||
# define F_OK 0 /* Test for existence. */
|
||||
# endif
|
||||
#endif /* Use misc. */
|
||||
|
||||
/* XPG wants the following symbols. <stdio.h> has the same definitions. */
|
||||
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
|
||||
# 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. */
|
||||
#endif /* XPG */
|
||||
|
||||
/* Do the file control operation described by CMD on FD.
|
||||
The remaining arguments are interpreted depending on CMD.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
extern int fcntl (int __fd, int __cmd, ...);
|
||||
|
||||
/* Open FILE and return a new file descriptor for it, or -1 on error.
|
||||
OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set
|
||||
in OFLAG, the third argument is taken as a `mode_t', the mode of the
|
||||
created file.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
|
||||
#else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
|
||||
__nonnull ((1));
|
||||
# else
|
||||
# define open open64
|
||||
# endif
|
||||
#endif
|
||||
#ifdef __USE_LARGEFILE64
|
||||
extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_ATFILE
|
||||
/* Similar to `open' but a relative path name is interpreted relative to
|
||||
the directory for which FD is a descriptor.
|
||||
|
||||
NOTE: some other `openat' implementation support additional functionality
|
||||
through this interface, especially using the O_XATTR flag. This is not
|
||||
yet supported here.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int openat (int __fd, const char *__file, int __oflag, ...)
|
||||
__nonnull ((2));
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag,
|
||||
...), openat64) __nonnull ((2));
|
||||
# else
|
||||
# define openat openat64
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __USE_LARGEFILE64
|
||||
extern int openat64 (int __fd, const char *__file, int __oflag, ...)
|
||||
__nonnull ((2));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Create and open FILE, with mode MODE. This takes an `int' MODE
|
||||
argument because that is what `mode_t' will be widened to.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
extern int creat (const char *__file, mode_t __mode) __nonnull ((1));
|
||||
#else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (creat, (const char *__file, mode_t __mode),
|
||||
creat64) __nonnull ((1));
|
||||
# else
|
||||
# define creat creat64
|
||||
# endif
|
||||
#endif
|
||||
#ifdef __USE_LARGEFILE64
|
||||
extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1));
|
||||
#endif
|
||||
|
||||
#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
|
||||
&& !defined __USE_POSIX))
|
||||
/* NOTE: These declarations also appear in <unistd.h>; be sure to keep both
|
||||
files consistent. Some systems have them there and some here, and some
|
||||
software depends on the macros being defined without including both. */
|
||||
|
||||
/* `lockf' is a simpler interface to the locking facilities of `fcntl'.
|
||||
LEN is always relative to the current file position.
|
||||
The CMD argument is one of the following. */
|
||||
|
||||
# define F_ULOCK 0 /* Unlock a previously locked region. */
|
||||
# define F_LOCK 1 /* Lock a region for exclusive use. */
|
||||
# define F_TLOCK 2 /* Test and lock a region for exclusive use. */
|
||||
# define F_TEST 3 /* Test a region for other processes locks. */
|
||||
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int lockf (int __fd, int __cmd, off_t __len);
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
|
||||
# else
|
||||
# define lockf lockf64
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __USE_LARGEFILE64
|
||||
extern int lockf64 (int __fd, int __cmd, off64_t __len);
|
||||
# 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, off_t __len,
|
||||
int __advise) __THROW;
|
||||
# else
|
||||
# ifdef __REDIRECT_NTH
|
||||
extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
|
||||
__off64_t __len, int __advise),
|
||||
posix_fadvise64);
|
||||
# else
|
||||
# define posix_fadvise posix_fadvise64
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __USE_LARGEFILE64
|
||||
extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len,
|
||||
int __advise) __THROW;
|
||||
# endif
|
||||
|
||||
|
||||
/* Reserve storage for the data of the file associated with FD.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int posix_fallocate (int __fd, off_t __offset, off_t __len);
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
|
||||
__off64_t __len),
|
||||
posix_fallocate64);
|
||||
# else
|
||||
# define posix_fallocate posix_fallocate64
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __USE_LARGEFILE64
|
||||
extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Define some inlines helping to catch common problems. */
|
||||
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
|
||||
&& defined __va_arg_pack_len
|
||||
# include <bits/fcntl2.h>
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* fcntl.h */
|
451
contrib/libc-headers/features.h
Normal file
451
contrib/libc-headers/features.h
Normal file
@ -0,0 +1,451 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#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.
|
||||
_ISOC11_SOURCE Extensions to ISO C99 from ISO C11.
|
||||
__STDC_WANT_LIB_EXT2__
|
||||
Extensions to ISO C99 from TR 27431-2:2010.
|
||||
__STDC_WANT_IEC_60559_BFP_EXT__
|
||||
Extensions to ISO C11 from TS 18661-1:2014.
|
||||
__STDC_WANT_IEC_60559_FUNCS_EXT__
|
||||
Extensions to ISO C11 from TS 18661-4:2015.
|
||||
__STDC_WANT_IEC_60559_TYPES_EXT__
|
||||
Extensions to ISO C11 from TS 18661-3:2015.
|
||||
|
||||
_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;
|
||||
if >=200112L, all of IEEE 1003.1-2004
|
||||
if >=200809L, all of IEEE 1003.1-2008
|
||||
_XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
|
||||
Single Unix conformance is wanted, to 600 for the
|
||||
sixth revision, to 700 for the seventh 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.
|
||||
_ATFILE_SOURCE Additional *at interfaces.
|
||||
_GNU_SOURCE All of the above, plus GNU extensions.
|
||||
_DEFAULT_SOURCE The default set of features (taking precedence over
|
||||
__STRICT_ANSI__).
|
||||
|
||||
_FORTIFY_SOURCE Add security hardening to many library functions.
|
||||
Set to 1 or 2; 2 performs stricter checks than 1.
|
||||
|
||||
_REENTRANT, _THREAD_SAFE
|
||||
Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
|
||||
|
||||
The `-ansi' switch to the GNU C compiler, and standards conformance
|
||||
options such as `-std=c99', define __STRICT_ANSI__. If none of
|
||||
these are defined, or if _DEFAULT_SOURCE is defined, the default is
|
||||
to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
|
||||
200809L, as well as enabling miscellaneous functions from BSD and
|
||||
SVID. 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:
|
||||
|
||||
__GLIBC_USE (F) Define things from feature set F. This is defined
|
||||
to 1 or 0; the subsequent macros are either defined
|
||||
or undefined, and those tests should be moved to
|
||||
__GLIBC_USE.
|
||||
__USE_ISOC11 Define ISO C11 things.
|
||||
__USE_ISOC99 Define ISO C99 things.
|
||||
__USE_ISOC95 Define ISO C90 AMD1 (C95) things.
|
||||
__USE_ISOCXX11 Define ISO C++11 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_XOPEN2KXSI Define XPG6 XSI things.
|
||||
__USE_XOPEN2K8 Define XPG7 things.
|
||||
__USE_XOPEN2K8XSI Define XPG7 XSI 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_MISC Define things from 4.3BSD or System V Unix.
|
||||
__USE_ATFILE Define *at interfaces and AT_* constants for them.
|
||||
__USE_GNU Define GNU extensions.
|
||||
__USE_FORTIFY_LEVEL Additional security measures used, according to level.
|
||||
|
||||
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.
|
||||
|
||||
ISO C feature test macros depend on the definition of the macro
|
||||
when an affected header is included, not when the first system
|
||||
header is included, and so they are handled in
|
||||
<bits/libc-header-start.h>, which does not have a multiple include
|
||||
guard. Feature test macros that can be handled from the first
|
||||
system header included are handled here. */
|
||||
|
||||
|
||||
/* Undefine everything, so we get a clean slate. */
|
||||
#undef __USE_ISOC11
|
||||
#undef __USE_ISOC99
|
||||
#undef __USE_ISOC95
|
||||
#undef __USE_ISOCXX11
|
||||
#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_XOPEN2KXSI
|
||||
#undef __USE_XOPEN2K8
|
||||
#undef __USE_XOPEN2K8XSI
|
||||
#undef __USE_LARGEFILE
|
||||
#undef __USE_LARGEFILE64
|
||||
#undef __USE_FILE_OFFSET64
|
||||
#undef __USE_MISC
|
||||
#undef __USE_ATFILE
|
||||
#undef __USE_GNU
|
||||
#undef __USE_FORTIFY_LEVEL
|
||||
#undef __KERNEL_STRICT_NAMES
|
||||
#undef __GLIBC_USE_DEPRECATED_GETS
|
||||
|
||||
/* Suppress kernel-name space pollution unless user expressedly asks
|
||||
for it. */
|
||||
#ifndef _LOOSE_KERNEL_NAMES
|
||||
# define __KERNEL_STRICT_NAMES
|
||||
#endif
|
||||
|
||||
/* Convenience macro to test the version of gcc.
|
||||
Use like this:
|
||||
#if __GNUC_PREREQ (2,8)
|
||||
... code requiring gcc 2.8 or later ...
|
||||
#endif
|
||||
Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
|
||||
added in 2.0. */
|
||||
#if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
#else
|
||||
# define __GNUC_PREREQ(maj, min) 0
|
||||
#endif
|
||||
|
||||
/* Similarly for clang. Features added to GCC after version 4.2 may
|
||||
or may not also be available in clang, and clang's definitions of
|
||||
__GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such
|
||||
features can be queried via __has_extension/__has_feature. */
|
||||
#if defined __clang_major__ && defined __clang_minor__
|
||||
# define __glibc_clang_prereq(maj, min) \
|
||||
((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min))
|
||||
#else
|
||||
# define __glibc_clang_prereq(maj, min) 0
|
||||
#endif
|
||||
|
||||
/* Whether to use feature set F. */
|
||||
#define __GLIBC_USE(F) __GLIBC_USE_ ## F
|
||||
|
||||
/* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
|
||||
_DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not
|
||||
issue a warning; the expectation is that the source is being
|
||||
transitioned to use the new macro. */
|
||||
#if (defined _BSD_SOURCE || defined _SVID_SOURCE) \
|
||||
&& !defined _DEFAULT_SOURCE
|
||||
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
|
||||
# undef _DEFAULT_SOURCE
|
||||
# define _DEFAULT_SOURCE 1
|
||||
#endif
|
||||
|
||||
/* If _GNU_SOURCE was defined by the user, turn on all the other features. */
|
||||
#ifdef _GNU_SOURCE
|
||||
# undef _ISOC95_SOURCE
|
||||
# define _ISOC95_SOURCE 1
|
||||
# undef _ISOC99_SOURCE
|
||||
# define _ISOC99_SOURCE 1
|
||||
# undef _ISOC11_SOURCE
|
||||
# define _ISOC11_SOURCE 1
|
||||
# undef _POSIX_SOURCE
|
||||
# define _POSIX_SOURCE 1
|
||||
# undef _POSIX_C_SOURCE
|
||||
# define _POSIX_C_SOURCE 200809L
|
||||
# undef _XOPEN_SOURCE
|
||||
# define _XOPEN_SOURCE 700
|
||||
# undef _XOPEN_SOURCE_EXTENDED
|
||||
# define _XOPEN_SOURCE_EXTENDED 1
|
||||
# undef _LARGEFILE64_SOURCE
|
||||
# define _LARGEFILE64_SOURCE 1
|
||||
# undef _DEFAULT_SOURCE
|
||||
# define _DEFAULT_SOURCE 1
|
||||
# undef _ATFILE_SOURCE
|
||||
# define _ATFILE_SOURCE 1
|
||||
#endif
|
||||
|
||||
/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
|
||||
define _DEFAULT_SOURCE. */
|
||||
#if (defined _DEFAULT_SOURCE \
|
||||
|| (!defined __STRICT_ANSI__ \
|
||||
&& !defined _ISOC99_SOURCE \
|
||||
&& !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \
|
||||
&& !defined _XOPEN_SOURCE))
|
||||
# undef _DEFAULT_SOURCE
|
||||
# define _DEFAULT_SOURCE 1
|
||||
#endif
|
||||
|
||||
/* This is to enable the ISO C11 extension. */
|
||||
#if (defined _ISOC11_SOURCE \
|
||||
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L))
|
||||
# define __USE_ISOC11 1
|
||||
#endif
|
||||
|
||||
/* This is to enable the ISO C99 extension. */
|
||||
#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \
|
||||
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
|
||||
# define __USE_ISOC99 1
|
||||
#endif
|
||||
|
||||
/* This is to enable the ISO C90 Amendment 1:1995 extension. */
|
||||
#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \
|
||||
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L))
|
||||
# define __USE_ISOC95 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* This is to enable compatibility for ISO C++17. */
|
||||
# if __cplusplus >= 201703L
|
||||
# define __USE_ISOC11 1
|
||||
# endif
|
||||
/* This is to enable compatibility for ISO C++11.
|
||||
Check the temporary macro for now, too. */
|
||||
# if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__
|
||||
# define __USE_ISOCXX11 1
|
||||
# define __USE_ISOC99 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
|
||||
is defined, use POSIX.1-2008 (or another version depending on
|
||||
_XOPEN_SOURCE). */
|
||||
#ifdef _DEFAULT_SOURCE
|
||||
# if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE
|
||||
# define __USE_POSIX_IMPLICITLY 1
|
||||
# endif
|
||||
# undef _POSIX_SOURCE
|
||||
# define _POSIX_SOURCE 1
|
||||
# undef _POSIX_C_SOURCE
|
||||
# define _POSIX_C_SOURCE 200809L
|
||||
#endif
|
||||
|
||||
#if ((!defined __STRICT_ANSI__ \
|
||||
|| (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500)) \
|
||||
&& !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE)
|
||||
# define _POSIX_SOURCE 1
|
||||
# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
|
||||
# define _POSIX_C_SOURCE 2
|
||||
# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600
|
||||
# define _POSIX_C_SOURCE 199506L
|
||||
# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700
|
||||
# define _POSIX_C_SOURCE 200112L
|
||||
# else
|
||||
# define _POSIX_C_SOURCE 200809L
|
||||
# endif
|
||||
# define __USE_POSIX_IMPLICITLY 1
|
||||
#endif
|
||||
|
||||
/* Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
|
||||
defined in all multithreaded code. GNU libc has not required this
|
||||
for many years. We now treat them as compatibility synonyms for
|
||||
_POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
|
||||
comprehensive support for multithreaded code. Using them never
|
||||
lowers the selected level of POSIX conformance, only raises it. */
|
||||
#if ((!defined _POSIX_C_SOURCE || (_POSIX_C_SOURCE - 0) < 199506L) \
|
||||
&& (defined _REENTRANT || defined _THREAD_SAFE))
|
||||
# define _POSIX_SOURCE 1
|
||||
# undef _POSIX_C_SOURCE
|
||||
# define _POSIX_C_SOURCE 199506L
|
||||
#endif
|
||||
|
||||
#if (defined _POSIX_SOURCE \
|
||||
|| (defined _POSIX_C_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 defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L
|
||||
# define __USE_POSIX199309 1
|
||||
#endif
|
||||
|
||||
#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L
|
||||
# define __USE_POSIX199506 1
|
||||
#endif
|
||||
|
||||
#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L
|
||||
# define __USE_XOPEN2K 1
|
||||
# undef __USE_ISOC95
|
||||
# define __USE_ISOC95 1
|
||||
# undef __USE_ISOC99
|
||||
# define __USE_ISOC99 1
|
||||
#endif
|
||||
|
||||
#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L
|
||||
# define __USE_XOPEN2K8 1
|
||||
# undef _ATFILE_SOURCE
|
||||
# define _ATFILE_SOURCE 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
|
||||
# if (_XOPEN_SOURCE - 0) >= 700
|
||||
# define __USE_XOPEN2K8 1
|
||||
# define __USE_XOPEN2K8XSI 1
|
||||
# endif
|
||||
# define __USE_XOPEN2K 1
|
||||
# define __USE_XOPEN2KXSI 1
|
||||
# undef __USE_ISOC95
|
||||
# define __USE_ISOC95 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 _DEFAULT_SOURCE
|
||||
# define __USE_MISC 1
|
||||
#endif
|
||||
|
||||
#ifdef _ATFILE_SOURCE
|
||||
# define __USE_ATFILE 1
|
||||
#endif
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
# define __USE_GNU 1
|
||||
#endif
|
||||
|
||||
#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
|
||||
&& __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
|
||||
# if _FORTIFY_SOURCE > 1
|
||||
# define __USE_FORTIFY_LEVEL 2
|
||||
# else
|
||||
# define __USE_FORTIFY_LEVEL 1
|
||||
# endif
|
||||
#else
|
||||
# define __USE_FORTIFY_LEVEL 0
|
||||
#endif
|
||||
|
||||
/* The function 'gets' existed in C89, but is impossible to use
|
||||
safely. It has been removed from ISO C11 and ISO C++14. Note: for
|
||||
compatibility with various implementations of <cstdio>, this test
|
||||
must consider only the value of __cplusplus when compiling C++. */
|
||||
#if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11
|
||||
# define __GLIBC_USE_DEPRECATED_GETS 0
|
||||
#else
|
||||
# define __GLIBC_USE_DEPRECATED_GETS 1
|
||||
#endif
|
||||
|
||||
/* Get definitions of __STDC_* predefined macros, if the compiler has
|
||||
not preincluded this header automatically. */
|
||||
#include <stdc-predef.h>
|
||||
|
||||
/* This macro indicates that the installed library is the GNU C Library.
|
||||
For historic reasons the value now is 6 and this will stay from now
|
||||
on. The use of this variable is deprecated. Use __GLIBC__ and
|
||||
__GLIBC_MINOR__ now (see below) when you want to test for a specific
|
||||
GNU C library version and use the values in <gnu/lib-names.h> to get
|
||||
the sonames of the shared libraries. */
|
||||
#undef __GNU_LIBRARY__
|
||||
#define __GNU_LIBRARY__ 6
|
||||
|
||||
/* Major and minor version number of the GNU C library package. Use
|
||||
these macros to test for features in specific releases. */
|
||||
#define __GLIBC__ 2
|
||||
#define __GLIBC_MINOR__ 27
|
||||
|
||||
#define __GLIBC_PREREQ(maj, min) \
|
||||
((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
|
||||
|
||||
/* This is here only because every header file already includes this one. */
|
||||
#ifndef __ASSEMBLER__
|
||||
# ifndef _SYS_CDEFS_H
|
||||
# include <sys/cdefs.h>
|
||||
# endif
|
||||
|
||||
/* 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
|
||||
|
||||
#endif /* !ASSEMBLER */
|
||||
|
||||
/* Decide whether we can define 'extern inline' functions in headers. */
|
||||
#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
|
||||
&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \
|
||||
&& defined __extern_inline
|
||||
# define __USE_EXTERN_INLINES 1
|
||||
#endif
|
||||
|
||||
|
||||
/* This is here only because every header file already includes this one.
|
||||
Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
|
||||
<gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
|
||||
that will always return failure (and set errno to ENOSYS). */
|
||||
#include <gnu/stubs.h>
|
||||
|
||||
|
||||
#endif /* features.h */
|
174
contrib/libc-headers/fenv.h
Normal file
174
contrib/libc-headers/fenv.h
Normal file
@ -0,0 +1,174 @@
|
||||
/* Copyright (C) 1997-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 7.6: Floating-point environment <fenv.h>
|
||||
*/
|
||||
|
||||
#ifndef _FENV_H
|
||||
#define _FENV_H 1
|
||||
|
||||
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
|
||||
#include <bits/libc-header-start.h>
|
||||
|
||||
/* Get the architecture dependend definitions. The following definitions
|
||||
are expected to be done:
|
||||
|
||||
fenv_t type for object representing an entire floating-point
|
||||
environment
|
||||
|
||||
FE_DFL_ENV macro of type pointer to fenv_t to be used as the argument
|
||||
to functions taking an argument of type fenv_t; in this
|
||||
case the default environment will be used
|
||||
|
||||
fexcept_t type for object representing the floating-point exception
|
||||
flags including status associated with the flags
|
||||
|
||||
femode_t type for object representing floating-point control modes
|
||||
|
||||
FE_DFL_MODE macro of type pointer to const femode_t to be used as the
|
||||
argument to fesetmode; in this case the default control
|
||||
modes will be used
|
||||
|
||||
The following macros are defined iff the implementation supports this
|
||||
kind of exception.
|
||||
FE_INEXACT inexact result
|
||||
FE_DIVBYZERO division by zero
|
||||
FE_UNDERFLOW result not representable due to underflow
|
||||
FE_OVERFLOW result not representable due to overflow
|
||||
FE_INVALID invalid operation
|
||||
|
||||
FE_ALL_EXCEPT bitwise OR of all supported exceptions
|
||||
|
||||
The next macros are defined iff the appropriate rounding mode is
|
||||
supported by the implementation.
|
||||
FE_TONEAREST round to nearest
|
||||
FE_UPWARD round toward +Inf
|
||||
FE_DOWNWARD round toward -Inf
|
||||
FE_TOWARDZERO round toward 0
|
||||
*/
|
||||
#include <bits/fenv.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Floating-point exception handling. */
|
||||
|
||||
/* Clear the supported exceptions represented by EXCEPTS. */
|
||||
extern int feclearexcept (int __excepts) __THROW;
|
||||
|
||||
/* Store implementation-defined representation of the exception flags
|
||||
indicated by EXCEPTS in the object pointed to by FLAGP. */
|
||||
extern int fegetexceptflag (fexcept_t *__flagp, int __excepts) __THROW;
|
||||
|
||||
/* Raise the supported exceptions represented by EXCEPTS. */
|
||||
extern int feraiseexcept (int __excepts) __THROW;
|
||||
|
||||
#if __GLIBC_USE (IEC_60559_BFP_EXT)
|
||||
/* Set the supported exception flags represented by EXCEPTS, without
|
||||
causing enabled traps to be taken. */
|
||||
extern int fesetexcept (int __excepts) __THROW;
|
||||
#endif
|
||||
|
||||
/* Set complete status for exceptions indicated by EXCEPTS according to
|
||||
the representation in the object pointed to by FLAGP. */
|
||||
extern int fesetexceptflag (const fexcept_t *__flagp, int __excepts) __THROW;
|
||||
|
||||
/* Determine which of subset of the exceptions specified by EXCEPTS are
|
||||
currently set. */
|
||||
extern int fetestexcept (int __excepts) __THROW;
|
||||
|
||||
#if __GLIBC_USE (IEC_60559_BFP_EXT)
|
||||
/* Determine which of subset of the exceptions specified by EXCEPTS
|
||||
are set in *FLAGP. */
|
||||
extern int fetestexceptflag (const fexcept_t *__flagp, int __excepts) __THROW;
|
||||
#endif
|
||||
|
||||
|
||||
/* Rounding control. */
|
||||
|
||||
/* Get current rounding direction. */
|
||||
extern int fegetround (void) __THROW __attribute_pure__;
|
||||
|
||||
/* Establish the rounding direction represented by ROUND. */
|
||||
extern int fesetround (int __rounding_direction) __THROW;
|
||||
|
||||
|
||||
/* Floating-point environment. */
|
||||
|
||||
/* Store the current floating-point environment in the object pointed
|
||||
to by ENVP. */
|
||||
extern int fegetenv (fenv_t *__envp) __THROW;
|
||||
|
||||
/* Save the current environment in the object pointed to by ENVP, clear
|
||||
exception flags and install a non-stop mode (if available) for all
|
||||
exceptions. */
|
||||
extern int feholdexcept (fenv_t *__envp) __THROW;
|
||||
|
||||
/* Establish the floating-point environment represented by the object
|
||||
pointed to by ENVP. */
|
||||
extern int fesetenv (const fenv_t *__envp) __THROW;
|
||||
|
||||
/* Save current exceptions in temporary storage, install environment
|
||||
represented by object pointed to by ENVP and raise exceptions
|
||||
according to saved exceptions. */
|
||||
extern int feupdateenv (const fenv_t *__envp) __THROW;
|
||||
|
||||
|
||||
/* Control modes. */
|
||||
|
||||
#if __GLIBC_USE (IEC_60559_BFP_EXT)
|
||||
/* Store the current floating-point control modes in the object
|
||||
pointed to by MODEP. */
|
||||
extern int fegetmode (femode_t *__modep) __THROW;
|
||||
|
||||
/* Establish the floating-point control modes represented by the
|
||||
object pointed to by MODEP. */
|
||||
extern int fesetmode (const femode_t *__modep) __THROW;
|
||||
#endif
|
||||
|
||||
/* Include optimization. */
|
||||
#ifdef __OPTIMIZE__
|
||||
# include <bits/fenvinline.h>
|
||||
#endif
|
||||
|
||||
/* NaN support. */
|
||||
|
||||
#if (__GLIBC_USE (IEC_60559_BFP_EXT) \
|
||||
&& defined FE_INVALID \
|
||||
&& defined __SUPPORT_SNAN__)
|
||||
# define FE_SNANS_ALWAYS_SIGNAL 1
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
|
||||
/* Enable individual exceptions. Will not enable more exceptions than
|
||||
EXCEPTS specifies. Returns the previous enabled exceptions if all
|
||||
exceptions are successfully set, otherwise returns -1. */
|
||||
extern int feenableexcept (int __excepts) __THROW;
|
||||
|
||||
/* Disable individual exceptions. Will not disable more exceptions than
|
||||
EXCEPTS specifies. Returns the previous enabled exceptions if all
|
||||
exceptions are successfully disabled, otherwise returns -1. */
|
||||
extern int fedisableexcept (int __excepts) __THROW;
|
||||
|
||||
/* Return enabled exceptions. */
|
||||
extern int fegetexcept (void) __THROW;
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* fenv.h */
|
62
contrib/libc-headers/fnmatch.h
Normal file
62
contrib/libc-headers/fnmatch.h
Normal file
@ -0,0 +1,62 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _FNMATCH_H
|
||||
#define _FNMATCH_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
# 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
|
||||
|
||||
/* 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 (const char *__pattern, const char *__name, int __flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* fnmatch.h */
|
181
contrib/libc-headers/glob.h
Normal file
181
contrib/libc-headers/glob.h
Normal file
@ -0,0 +1,181 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GLOB_H
|
||||
#define _GLOB_H 1
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* We need `size_t' for the following definitions. */
|
||||
#ifndef __size_t
|
||||
typedef __SIZE_TYPE__ __size_t;
|
||||
# if defined __USE_XOPEN || defined __USE_XOPEN2K8
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
# endif
|
||||
#else
|
||||
/* The GNU CC stddef.h version defines __size_t as empty. We need a real
|
||||
definition. */
|
||||
# undef __size_t
|
||||
# define __size_t size_t
|
||||
#endif
|
||||
|
||||
/* Bits set in the FLAGS argument to `glob'. */
|
||||
#define GLOB_ERR (1 << 0)/* Return on read errors. */
|
||||
#define GLOB_MARK (1 << 1)/* Append a slash to each name. */
|
||||
#define GLOB_NOSORT (1 << 2)/* Don't sort the names. */
|
||||
#define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */
|
||||
#define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */
|
||||
#define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */
|
||||
#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */
|
||||
#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
|
||||
|
||||
#if !defined __USE_POSIX2 || defined __USE_MISC
|
||||
# define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
|
||||
# define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
|
||||
# define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
|
||||
# define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */
|
||||
# define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */
|
||||
# define GLOB_ONLYDIR (1 << 13)/* Match only directories. */
|
||||
# define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error
|
||||
if the user name is not available. */
|
||||
# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
|
||||
GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \
|
||||
GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \
|
||||
GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK)
|
||||
#else
|
||||
# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
|
||||
GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \
|
||||
GLOB_PERIOD)
|
||||
#endif
|
||||
|
||||
/* Error returns from `glob'. */
|
||||
#define GLOB_NOSPACE 1 /* Ran out of memory. */
|
||||
#define GLOB_ABORTED 2 /* Read error. */
|
||||
#define GLOB_NOMATCH 3 /* No matches found. */
|
||||
#define GLOB_NOSYS 4 /* Not implemented. */
|
||||
#ifdef __USE_GNU
|
||||
/* Previous versions of this file defined GLOB_ABEND instead of
|
||||
GLOB_ABORTED. Provide a compatibility definition here. */
|
||||
# define GLOB_ABEND GLOB_ABORTED
|
||||
#endif
|
||||
|
||||
/* Structure describing a globbing run. */
|
||||
#ifdef __USE_GNU
|
||||
struct stat;
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
__size_t gl_pathc; /* Count of paths matched by the pattern. */
|
||||
char **gl_pathv; /* List of matched pathnames. */
|
||||
__size_t gl_offs; /* Slots to reserve in `gl_pathv'. */
|
||||
int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */
|
||||
|
||||
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
|
||||
are used instead of the normal file access functions. */
|
||||
void (*gl_closedir) (void *);
|
||||
#ifdef __USE_GNU
|
||||
struct dirent *(*gl_readdir) (void *);
|
||||
#else
|
||||
void *(*gl_readdir) (void *);
|
||||
#endif
|
||||
void *(*gl_opendir) (const char *);
|
||||
#ifdef __USE_GNU
|
||||
int (*gl_lstat) (const char *__restrict, struct stat *__restrict);
|
||||
int (*gl_stat) (const char *__restrict, struct stat *__restrict);
|
||||
#else
|
||||
int (*gl_lstat) (const char *__restrict, void *__restrict);
|
||||
int (*gl_stat) (const char *__restrict, void *__restrict);
|
||||
#endif
|
||||
} glob_t;
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
# ifdef __USE_GNU
|
||||
struct stat64;
|
||||
# endif
|
||||
typedef struct
|
||||
{
|
||||
__size_t gl_pathc;
|
||||
char **gl_pathv;
|
||||
__size_t gl_offs;
|
||||
int gl_flags;
|
||||
|
||||
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
|
||||
are used instead of the normal file access functions. */
|
||||
void (*gl_closedir) (void *);
|
||||
# ifdef __USE_GNU
|
||||
struct dirent64 *(*gl_readdir) (void *);
|
||||
# else
|
||||
void *(*gl_readdir) (void *);
|
||||
# endif
|
||||
void *(*gl_opendir) (const char *);
|
||||
# ifdef __USE_GNU
|
||||
int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict);
|
||||
int (*gl_stat) (const char *__restrict, struct stat64 *__restrict);
|
||||
# else
|
||||
int (*gl_lstat) (const char *__restrict, void *__restrict);
|
||||
int (*gl_stat) (const char *__restrict, void *__restrict);
|
||||
# endif
|
||||
} glob64_t;
|
||||
#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,
|
||||
it is called with the pathname that caused the error, and the
|
||||
`errno' value from the failing call; if it returns non-zero
|
||||
`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 !defined __USE_FILE_OFFSET64
|
||||
extern int glob (const char *__restrict __pattern, int __flags,
|
||||
int (*__errfunc) (const char *, int),
|
||||
glob_t *__restrict __pglob) __THROW;
|
||||
|
||||
/* Free storage allocated in PGLOB by a previous `glob' call. */
|
||||
extern void globfree (glob_t *__pglob) __THROW;
|
||||
#else
|
||||
extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern,
|
||||
int __flags,
|
||||
int (*__errfunc) (const char *, int),
|
||||
glob_t *__restrict __pglob), glob64);
|
||||
|
||||
extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
|
||||
#endif
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
extern int glob64 (const char *__restrict __pattern, int __flags,
|
||||
int (*__errfunc) (const char *, int),
|
||||
glob64_t *__restrict __pglob) __THROW;
|
||||
|
||||
extern void globfree64 (glob64_t *__pglob) __THROW;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Return nonzero if PATTERN contains any metacharacters.
|
||||
Metacharacters can be quoted with backslashes if QUOTE is nonzero.
|
||||
|
||||
This function is not part of the interface specified by POSIX.2
|
||||
but several programs want to use it. */
|
||||
extern int glob_pattern_p (const char *__pattern, int __quote) __THROW;
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* glob.h */
|
55
contrib/libc-headers/iconv.h
Normal file
55
contrib/libc-headers/iconv.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* Copyright (C) 1997-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _ICONV_H
|
||||
#define _ICONV_H 1
|
||||
|
||||
#include <features.h>
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Identifier for conversion method from one codeset to another. */
|
||||
typedef void *iconv_t;
|
||||
|
||||
|
||||
/* Allocate descriptor for code conversion from codeset FROMCODE to
|
||||
codeset TOCODE.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern iconv_t iconv_open (const char *__tocode, const char *__fromcode);
|
||||
|
||||
/* Convert at most *INBYTESLEFT bytes from *INBUF according to the
|
||||
code conversion algorithm specified by CD and place up to
|
||||
*OUTBYTESLEFT bytes in buffer at *OUTBUF. */
|
||||
extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
|
||||
size_t *__restrict __inbytesleft,
|
||||
char **__restrict __outbuf,
|
||||
size_t *__restrict __outbytesleft);
|
||||
|
||||
/* Free resources allocated for descriptor CD for code conversion.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int iconv_close (iconv_t __cd);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* iconv.h */
|
73
contrib/libc-headers/ifaddrs.h
Normal file
73
contrib/libc-headers/ifaddrs.h
Normal file
@ -0,0 +1,73 @@
|
||||
/* ifaddrs.h -- declarations for getting network interface addresses
|
||||
Copyright (C) 2002-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _IFADDRS_H
|
||||
#define _IFADDRS_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* The `getifaddrs' function generates a linked list of these structures.
|
||||
Each element of the list describes one network interface. */
|
||||
struct ifaddrs
|
||||
{
|
||||
struct ifaddrs *ifa_next; /* Pointer to the next structure. */
|
||||
|
||||
char *ifa_name; /* Name of this network interface. */
|
||||
unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */
|
||||
|
||||
struct sockaddr *ifa_addr; /* Network address of this interface. */
|
||||
struct sockaddr *ifa_netmask; /* Netmask of this interface. */
|
||||
union
|
||||
{
|
||||
/* At most one of the following two is valid. If the IFF_BROADCAST
|
||||
bit is set in `ifa_flags', then `ifa_broadaddr' is valid. If the
|
||||
IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid.
|
||||
It is never the case that both these bits are set at once. */
|
||||
struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */
|
||||
struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */
|
||||
} ifa_ifu;
|
||||
/* These very same macros are defined by <net/if.h> for `struct ifaddr'.
|
||||
So if they are defined already, the existing definitions will be fine. */
|
||||
# ifndef ifa_broadaddr
|
||||
# define ifa_broadaddr ifa_ifu.ifu_broadaddr
|
||||
# endif
|
||||
# ifndef ifa_dstaddr
|
||||
# define ifa_dstaddr ifa_ifu.ifu_dstaddr
|
||||
# endif
|
||||
|
||||
void *ifa_data; /* Address-specific data (may be unused). */
|
||||
};
|
||||
|
||||
|
||||
/* Create a linked list of `struct ifaddrs' structures, one for each
|
||||
network interface on the host machine. If successful, store the
|
||||
list in *IFAP and return 0. On errors, return -1 and set `errno'.
|
||||
|
||||
The storage returned in *IFAP is allocated dynamically and can
|
||||
only be properly freed by passing it to `freeifaddrs'. */
|
||||
extern int getifaddrs (struct ifaddrs **__ifap) __THROW;
|
||||
|
||||
/* Reclaim the storage allocated by a previous `getifaddrs' call. */
|
||||
extern void freeifaddrs (struct ifaddrs *__ifa) __THROW;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ifaddrs.h */
|
434
contrib/libc-headers/inttypes.h
Normal file
434
contrib/libc-headers/inttypes.h
Normal file
@ -0,0 +1,434 @@
|
||||
/* Copyright (C) 1997-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99: 7.8 Format conversion of integer types <inttypes.h>
|
||||
*/
|
||||
|
||||
#ifndef _INTTYPES_H
|
||||
#define _INTTYPES_H 1
|
||||
|
||||
#include <features.h>
|
||||
/* Get the type definitions. */
|
||||
#include <stdint.h>
|
||||
|
||||
/* Get a definition for wchar_t. But we must not define wchar_t itself. */
|
||||
#ifndef ____gwchar_t_defined
|
||||
# ifdef __cplusplus
|
||||
# define __gwchar_t wchar_t
|
||||
# elif defined __WCHAR_TYPE__
|
||||
typedef __WCHAR_TYPE__ __gwchar_t;
|
||||
# else
|
||||
# define __need_wchar_t
|
||||
# include <stddef.h>
|
||||
typedef wchar_t __gwchar_t;
|
||||
# endif
|
||||
# define ____gwchar_t_defined 1
|
||||
#endif
|
||||
|
||||
# if __WORDSIZE == 64
|
||||
# define __PRI64_PREFIX "l"
|
||||
# define __PRIPTR_PREFIX "l"
|
||||
# else
|
||||
# define __PRI64_PREFIX "ll"
|
||||
# define __PRIPTR_PREFIX
|
||||
# endif
|
||||
|
||||
/* Macros for printing format specifiers. */
|
||||
|
||||
/* Decimal notation. */
|
||||
# define PRId8 "d"
|
||||
# define PRId16 "d"
|
||||
# define PRId32 "d"
|
||||
# define PRId64 __PRI64_PREFIX "d"
|
||||
|
||||
# define PRIdLEAST8 "d"
|
||||
# define PRIdLEAST16 "d"
|
||||
# define PRIdLEAST32 "d"
|
||||
# define PRIdLEAST64 __PRI64_PREFIX "d"
|
||||
|
||||
# define PRIdFAST8 "d"
|
||||
# define PRIdFAST16 __PRIPTR_PREFIX "d"
|
||||
# define PRIdFAST32 __PRIPTR_PREFIX "d"
|
||||
# define PRIdFAST64 __PRI64_PREFIX "d"
|
||||
|
||||
|
||||
# define PRIi8 "i"
|
||||
# define PRIi16 "i"
|
||||
# define PRIi32 "i"
|
||||
# define PRIi64 __PRI64_PREFIX "i"
|
||||
|
||||
# define PRIiLEAST8 "i"
|
||||
# define PRIiLEAST16 "i"
|
||||
# define PRIiLEAST32 "i"
|
||||
# define PRIiLEAST64 __PRI64_PREFIX "i"
|
||||
|
||||
# define PRIiFAST8 "i"
|
||||
# define PRIiFAST16 __PRIPTR_PREFIX "i"
|
||||
# define PRIiFAST32 __PRIPTR_PREFIX "i"
|
||||
# define PRIiFAST64 __PRI64_PREFIX "i"
|
||||
|
||||
/* Octal notation. */
|
||||
# define PRIo8 "o"
|
||||
# define PRIo16 "o"
|
||||
# define PRIo32 "o"
|
||||
# define PRIo64 __PRI64_PREFIX "o"
|
||||
|
||||
# define PRIoLEAST8 "o"
|
||||
# define PRIoLEAST16 "o"
|
||||
# define PRIoLEAST32 "o"
|
||||
# define PRIoLEAST64 __PRI64_PREFIX "o"
|
||||
|
||||
# define PRIoFAST8 "o"
|
||||
# define PRIoFAST16 __PRIPTR_PREFIX "o"
|
||||
# define PRIoFAST32 __PRIPTR_PREFIX "o"
|
||||
# define PRIoFAST64 __PRI64_PREFIX "o"
|
||||
|
||||
/* Unsigned integers. */
|
||||
# define PRIu8 "u"
|
||||
# define PRIu16 "u"
|
||||
# define PRIu32 "u"
|
||||
# define PRIu64 __PRI64_PREFIX "u"
|
||||
|
||||
# define PRIuLEAST8 "u"
|
||||
# define PRIuLEAST16 "u"
|
||||
# define PRIuLEAST32 "u"
|
||||
# define PRIuLEAST64 __PRI64_PREFIX "u"
|
||||
|
||||
# define PRIuFAST8 "u"
|
||||
# define PRIuFAST16 __PRIPTR_PREFIX "u"
|
||||
# define PRIuFAST32 __PRIPTR_PREFIX "u"
|
||||
# define PRIuFAST64 __PRI64_PREFIX "u"
|
||||
|
||||
/* lowercase hexadecimal notation. */
|
||||
# define PRIx8 "x"
|
||||
# define PRIx16 "x"
|
||||
# define PRIx32 "x"
|
||||
# define PRIx64 __PRI64_PREFIX "x"
|
||||
|
||||
# define PRIxLEAST8 "x"
|
||||
# define PRIxLEAST16 "x"
|
||||
# define PRIxLEAST32 "x"
|
||||
# define PRIxLEAST64 __PRI64_PREFIX "x"
|
||||
|
||||
# define PRIxFAST8 "x"
|
||||
# define PRIxFAST16 __PRIPTR_PREFIX "x"
|
||||
# define PRIxFAST32 __PRIPTR_PREFIX "x"
|
||||
# define PRIxFAST64 __PRI64_PREFIX "x"
|
||||
|
||||
/* UPPERCASE hexadecimal notation. */
|
||||
# define PRIX8 "X"
|
||||
# define PRIX16 "X"
|
||||
# define PRIX32 "X"
|
||||
# define PRIX64 __PRI64_PREFIX "X"
|
||||
|
||||
# define PRIXLEAST8 "X"
|
||||
# define PRIXLEAST16 "X"
|
||||
# define PRIXLEAST32 "X"
|
||||
# define PRIXLEAST64 __PRI64_PREFIX "X"
|
||||
|
||||
# define PRIXFAST8 "X"
|
||||
# define PRIXFAST16 __PRIPTR_PREFIX "X"
|
||||
# define PRIXFAST32 __PRIPTR_PREFIX "X"
|
||||
# define PRIXFAST64 __PRI64_PREFIX "X"
|
||||
|
||||
|
||||
/* Macros for printing `intmax_t' and `uintmax_t'. */
|
||||
# define PRIdMAX __PRI64_PREFIX "d"
|
||||
# define PRIiMAX __PRI64_PREFIX "i"
|
||||
# define PRIoMAX __PRI64_PREFIX "o"
|
||||
# define PRIuMAX __PRI64_PREFIX "u"
|
||||
# define PRIxMAX __PRI64_PREFIX "x"
|
||||
# define PRIXMAX __PRI64_PREFIX "X"
|
||||
|
||||
|
||||
/* Macros for printing `intptr_t' and `uintptr_t'. */
|
||||
# define PRIdPTR __PRIPTR_PREFIX "d"
|
||||
# define PRIiPTR __PRIPTR_PREFIX "i"
|
||||
# define PRIoPTR __PRIPTR_PREFIX "o"
|
||||
# define PRIuPTR __PRIPTR_PREFIX "u"
|
||||
# define PRIxPTR __PRIPTR_PREFIX "x"
|
||||
# define PRIXPTR __PRIPTR_PREFIX "X"
|
||||
|
||||
|
||||
/* Macros for scanning format specifiers. */
|
||||
|
||||
/* Signed decimal notation. */
|
||||
# define SCNd8 "hhd"
|
||||
# define SCNd16 "hd"
|
||||
# define SCNd32 "d"
|
||||
# define SCNd64 __PRI64_PREFIX "d"
|
||||
|
||||
# define SCNdLEAST8 "hhd"
|
||||
# define SCNdLEAST16 "hd"
|
||||
# define SCNdLEAST32 "d"
|
||||
# define SCNdLEAST64 __PRI64_PREFIX "d"
|
||||
|
||||
# define SCNdFAST8 "hhd"
|
||||
# define SCNdFAST16 __PRIPTR_PREFIX "d"
|
||||
# define SCNdFAST32 __PRIPTR_PREFIX "d"
|
||||
# define SCNdFAST64 __PRI64_PREFIX "d"
|
||||
|
||||
/* Signed decimal notation. */
|
||||
# define SCNi8 "hhi"
|
||||
# define SCNi16 "hi"
|
||||
# define SCNi32 "i"
|
||||
# define SCNi64 __PRI64_PREFIX "i"
|
||||
|
||||
# define SCNiLEAST8 "hhi"
|
||||
# define SCNiLEAST16 "hi"
|
||||
# define SCNiLEAST32 "i"
|
||||
# define SCNiLEAST64 __PRI64_PREFIX "i"
|
||||
|
||||
# define SCNiFAST8 "hhi"
|
||||
# define SCNiFAST16 __PRIPTR_PREFIX "i"
|
||||
# define SCNiFAST32 __PRIPTR_PREFIX "i"
|
||||
# define SCNiFAST64 __PRI64_PREFIX "i"
|
||||
|
||||
/* Unsigned decimal notation. */
|
||||
# define SCNu8 "hhu"
|
||||
# define SCNu16 "hu"
|
||||
# define SCNu32 "u"
|
||||
# define SCNu64 __PRI64_PREFIX "u"
|
||||
|
||||
# define SCNuLEAST8 "hhu"
|
||||
# define SCNuLEAST16 "hu"
|
||||
# define SCNuLEAST32 "u"
|
||||
# define SCNuLEAST64 __PRI64_PREFIX "u"
|
||||
|
||||
# define SCNuFAST8 "hhu"
|
||||
# define SCNuFAST16 __PRIPTR_PREFIX "u"
|
||||
# define SCNuFAST32 __PRIPTR_PREFIX "u"
|
||||
# define SCNuFAST64 __PRI64_PREFIX "u"
|
||||
|
||||
/* Octal notation. */
|
||||
# define SCNo8 "hho"
|
||||
# define SCNo16 "ho"
|
||||
# define SCNo32 "o"
|
||||
# define SCNo64 __PRI64_PREFIX "o"
|
||||
|
||||
# define SCNoLEAST8 "hho"
|
||||
# define SCNoLEAST16 "ho"
|
||||
# define SCNoLEAST32 "o"
|
||||
# define SCNoLEAST64 __PRI64_PREFIX "o"
|
||||
|
||||
# define SCNoFAST8 "hho"
|
||||
# define SCNoFAST16 __PRIPTR_PREFIX "o"
|
||||
# define SCNoFAST32 __PRIPTR_PREFIX "o"
|
||||
# define SCNoFAST64 __PRI64_PREFIX "o"
|
||||
|
||||
/* Hexadecimal notation. */
|
||||
# define SCNx8 "hhx"
|
||||
# define SCNx16 "hx"
|
||||
# define SCNx32 "x"
|
||||
# define SCNx64 __PRI64_PREFIX "x"
|
||||
|
||||
# define SCNxLEAST8 "hhx"
|
||||
# define SCNxLEAST16 "hx"
|
||||
# define SCNxLEAST32 "x"
|
||||
# define SCNxLEAST64 __PRI64_PREFIX "x"
|
||||
|
||||
# define SCNxFAST8 "hhx"
|
||||
# define SCNxFAST16 __PRIPTR_PREFIX "x"
|
||||
# define SCNxFAST32 __PRIPTR_PREFIX "x"
|
||||
# define SCNxFAST64 __PRI64_PREFIX "x"
|
||||
|
||||
|
||||
/* Macros for scanning `intmax_t' and `uintmax_t'. */
|
||||
# define SCNdMAX __PRI64_PREFIX "d"
|
||||
# define SCNiMAX __PRI64_PREFIX "i"
|
||||
# define SCNoMAX __PRI64_PREFIX "o"
|
||||
# define SCNuMAX __PRI64_PREFIX "u"
|
||||
# define SCNxMAX __PRI64_PREFIX "x"
|
||||
|
||||
/* Macros for scaning `intptr_t' and `uintptr_t'. */
|
||||
# define SCNdPTR __PRIPTR_PREFIX "d"
|
||||
# define SCNiPTR __PRIPTR_PREFIX "i"
|
||||
# define SCNoPTR __PRIPTR_PREFIX "o"
|
||||
# define SCNuPTR __PRIPTR_PREFIX "u"
|
||||
# define SCNxPTR __PRIPTR_PREFIX "x"
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __WORDSIZE == 64
|
||||
|
||||
/* We have to define the `uintmax_t' type using `ldiv_t'. */
|
||||
typedef struct
|
||||
{
|
||||
long int quot; /* Quotient. */
|
||||
long int rem; /* Remainder. */
|
||||
} imaxdiv_t;
|
||||
|
||||
#else
|
||||
|
||||
/* We have to define the `uintmax_t' type using `lldiv_t'. */
|
||||
typedef struct
|
||||
{
|
||||
__extension__ long long int quot; /* Quotient. */
|
||||
__extension__ long long int rem; /* Remainder. */
|
||||
} imaxdiv_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Compute absolute value of N. */
|
||||
extern intmax_t imaxabs (intmax_t __n) __THROW __attribute__ ((__const__));
|
||||
|
||||
/* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */
|
||||
extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)
|
||||
__THROW __attribute__ ((__const__));
|
||||
|
||||
/* Like `strtol' but convert to `intmax_t'. */
|
||||
extern intmax_t strtoimax (const char *__restrict __nptr,
|
||||
char **__restrict __endptr, int __base) __THROW;
|
||||
|
||||
/* Like `strtoul' but convert to `uintmax_t'. */
|
||||
extern uintmax_t strtoumax (const char *__restrict __nptr,
|
||||
char ** __restrict __endptr, int __base) __THROW;
|
||||
|
||||
/* Like `wcstol' but convert to `intmax_t'. */
|
||||
extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr,
|
||||
__gwchar_t **__restrict __endptr, int __base)
|
||||
__THROW;
|
||||
|
||||
/* Like `wcstoul' but convert to `uintmax_t'. */
|
||||
extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr,
|
||||
__gwchar_t ** __restrict __endptr, int __base)
|
||||
__THROW;
|
||||
|
||||
#ifdef __USE_EXTERN_INLINES
|
||||
|
||||
# if __WORDSIZE == 64
|
||||
|
||||
extern long int __strtol_internal (const char *__restrict __nptr,
|
||||
char **__restrict __endptr,
|
||||
int __base, int __group)
|
||||
__THROW __nonnull ((1)) __wur;
|
||||
/* Like `strtol' but convert to `intmax_t'. */
|
||||
__extern_inline intmax_t
|
||||
__NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr,
|
||||
int base))
|
||||
{
|
||||
return __strtol_internal (nptr, endptr, base, 0);
|
||||
}
|
||||
|
||||
extern unsigned long int __strtoul_internal (const char *__restrict __nptr,
|
||||
char ** __restrict __endptr,
|
||||
int __base, int __group)
|
||||
__THROW __nonnull ((1)) __wur;
|
||||
/* Like `strtoul' but convert to `uintmax_t'. */
|
||||
__extern_inline uintmax_t
|
||||
__NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr,
|
||||
int base))
|
||||
{
|
||||
return __strtoul_internal (nptr, endptr, base, 0);
|
||||
}
|
||||
|
||||
extern long int __wcstol_internal (const __gwchar_t * __restrict __nptr,
|
||||
__gwchar_t **__restrict __endptr,
|
||||
int __base, int __group)
|
||||
__THROW __nonnull ((1)) __wur;
|
||||
/* Like `wcstol' but convert to `intmax_t'. */
|
||||
__extern_inline intmax_t
|
||||
__NTH (wcstoimax (const __gwchar_t *__restrict nptr,
|
||||
__gwchar_t **__restrict endptr, int base))
|
||||
{
|
||||
return __wcstol_internal (nptr, endptr, base, 0);
|
||||
}
|
||||
|
||||
extern unsigned long int __wcstoul_internal (const __gwchar_t *
|
||||
__restrict __nptr,
|
||||
__gwchar_t **
|
||||
__restrict __endptr,
|
||||
int __base, int __group)
|
||||
__THROW __nonnull ((1)) __wur;
|
||||
/* Like `wcstoul' but convert to `uintmax_t'. */
|
||||
__extern_inline uintmax_t
|
||||
__NTH (wcstoumax (const __gwchar_t *__restrict nptr,
|
||||
__gwchar_t **__restrict endptr, int base))
|
||||
{
|
||||
return __wcstoul_internal (nptr, endptr, base, 0);
|
||||
}
|
||||
|
||||
# else /* __WORDSIZE == 32 */
|
||||
|
||||
__extension__
|
||||
extern long long int __strtoll_internal (const char *__restrict __nptr,
|
||||
char **__restrict __endptr,
|
||||
int __base, int __group)
|
||||
__THROW __nonnull ((1)) __wur;
|
||||
/* Like `strtol' but convert to `intmax_t'. */
|
||||
__extern_inline intmax_t
|
||||
__NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr,
|
||||
int base))
|
||||
{
|
||||
return __strtoll_internal (nptr, endptr, base, 0);
|
||||
}
|
||||
|
||||
__extension__
|
||||
extern unsigned long long int __strtoull_internal (const char *
|
||||
__restrict __nptr,
|
||||
char **
|
||||
__restrict __endptr,
|
||||
int __base,
|
||||
int __group)
|
||||
__THROW __nonnull ((1)) __wur;
|
||||
/* Like `strtoul' but convert to `uintmax_t'. */
|
||||
__extern_inline uintmax_t
|
||||
__NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr,
|
||||
int base))
|
||||
{
|
||||
return __strtoull_internal (nptr, endptr, base, 0);
|
||||
}
|
||||
|
||||
__extension__
|
||||
extern long long int __wcstoll_internal (const __gwchar_t *__restrict __nptr,
|
||||
__gwchar_t **__restrict __endptr,
|
||||
int __base, int __group)
|
||||
__THROW __nonnull ((1)) __wur;
|
||||
/* Like `wcstol' but convert to `intmax_t'. */
|
||||
__extern_inline intmax_t
|
||||
__NTH (wcstoimax (const __gwchar_t *__restrict nptr,
|
||||
__gwchar_t **__restrict endptr, int base))
|
||||
{
|
||||
return __wcstoll_internal (nptr, endptr, base, 0);
|
||||
}
|
||||
|
||||
|
||||
__extension__
|
||||
extern unsigned long long int __wcstoull_internal (const __gwchar_t *
|
||||
__restrict __nptr,
|
||||
__gwchar_t **
|
||||
__restrict __endptr,
|
||||
int __base,
|
||||
int __group)
|
||||
__THROW __nonnull ((1)) __wur;
|
||||
/* Like `wcstoul' but convert to `uintmax_t'. */
|
||||
__extern_inline uintmax_t
|
||||
__NTH (wcstoumax (const __gwchar_t *__restrict nptr,
|
||||
__gwchar_t **__restrict endptr, int base))
|
||||
{
|
||||
return __wcstoull_internal (nptr, endptr, base, 0);
|
||||
}
|
||||
|
||||
# endif /* __WORDSIZE == 32 */
|
||||
#endif /* Use extern inlines. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* inttypes.h */
|
674
contrib/libc-headers/langinfo.h
Normal file
674
contrib/libc-headers/langinfo.h
Normal file
@ -0,0 +1,674 @@
|
||||
/* Access to locale-dependent parameters.
|
||||
Copyright (C) 1995-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LANGINFO_H
|
||||
#define _LANGINFO_H 1
|
||||
|
||||
/* Get the type definition. */
|
||||
#include <nl_types.h>
|
||||
|
||||
#include <bits/locale.h> /* Define the __LC_* category names. */
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Construct an `nl_item' value for `nl_langinfo' from a locale category
|
||||
(LC_*) and an item index within the category. Some code may depend on
|
||||
the item values within a category increasing monotonically with the
|
||||
indices. */
|
||||
#define _NL_ITEM(category, index) (((category) << 16) | (index))
|
||||
|
||||
/* Extract the category and item index from a constructed `nl_item' value. */
|
||||
#define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16)
|
||||
#define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff)
|
||||
|
||||
/* Enumeration of locale items that can be queried with `nl_langinfo'. */
|
||||
enum
|
||||
{
|
||||
/* LC_TIME category: date and time formatting. */
|
||||
|
||||
/* Abbreviated days of the week. */
|
||||
ABDAY_1 = _NL_ITEM (__LC_TIME, 0), /* Sun */
|
||||
#define ABDAY_1 ABDAY_1
|
||||
ABDAY_2,
|
||||
#define ABDAY_2 ABDAY_2
|
||||
ABDAY_3,
|
||||
#define ABDAY_3 ABDAY_3
|
||||
ABDAY_4,
|
||||
#define ABDAY_4 ABDAY_4
|
||||
ABDAY_5,
|
||||
#define ABDAY_5 ABDAY_5
|
||||
ABDAY_6,
|
||||
#define ABDAY_6 ABDAY_6
|
||||
ABDAY_7,
|
||||
#define ABDAY_7 ABDAY_7
|
||||
|
||||
/* Long-named days of the week. */
|
||||
DAY_1, /* Sunday */
|
||||
#define DAY_1 DAY_1
|
||||
DAY_2, /* Monday */
|
||||
#define DAY_2 DAY_2
|
||||
DAY_3, /* Tuesday */
|
||||
#define DAY_3 DAY_3
|
||||
DAY_4, /* Wednesday */
|
||||
#define DAY_4 DAY_4
|
||||
DAY_5, /* Thursday */
|
||||
#define DAY_5 DAY_5
|
||||
DAY_6, /* Friday */
|
||||
#define DAY_6 DAY_6
|
||||
DAY_7, /* Saturday */
|
||||
#define DAY_7 DAY_7
|
||||
|
||||
/* Abbreviated month names, in the grammatical form used when the month
|
||||
is a part of a complete date. */
|
||||
ABMON_1, /* Jan */
|
||||
#define ABMON_1 ABMON_1
|
||||
ABMON_2,
|
||||
#define ABMON_2 ABMON_2
|
||||
ABMON_3,
|
||||
#define ABMON_3 ABMON_3
|
||||
ABMON_4,
|
||||
#define ABMON_4 ABMON_4
|
||||
ABMON_5,
|
||||
#define ABMON_5 ABMON_5
|
||||
ABMON_6,
|
||||
#define ABMON_6 ABMON_6
|
||||
ABMON_7,
|
||||
#define ABMON_7 ABMON_7
|
||||
ABMON_8,
|
||||
#define ABMON_8 ABMON_8
|
||||
ABMON_9,
|
||||
#define ABMON_9 ABMON_9
|
||||
ABMON_10,
|
||||
#define ABMON_10 ABMON_10
|
||||
ABMON_11,
|
||||
#define ABMON_11 ABMON_11
|
||||
ABMON_12,
|
||||
#define ABMON_12 ABMON_12
|
||||
|
||||
/* Long month names, in the grammatical form used when the month
|
||||
is a part of a complete date. */
|
||||
MON_1, /* January */
|
||||
#define MON_1 MON_1
|
||||
MON_2,
|
||||
#define MON_2 MON_2
|
||||
MON_3,
|
||||
#define MON_3 MON_3
|
||||
MON_4,
|
||||
#define MON_4 MON_4
|
||||
MON_5,
|
||||
#define MON_5 MON_5
|
||||
MON_6,
|
||||
#define MON_6 MON_6
|
||||
MON_7,
|
||||
#define MON_7 MON_7
|
||||
MON_8,
|
||||
#define MON_8 MON_8
|
||||
MON_9,
|
||||
#define MON_9 MON_9
|
||||
MON_10,
|
||||
#define MON_10 MON_10
|
||||
MON_11,
|
||||
#define MON_11 MON_11
|
||||
MON_12,
|
||||
#define MON_12 MON_12
|
||||
|
||||
AM_STR, /* Ante meridiem string. */
|
||||
#define AM_STR AM_STR
|
||||
PM_STR, /* Post meridiem string. */
|
||||
#define PM_STR PM_STR
|
||||
|
||||
D_T_FMT, /* Date and time format for strftime. */
|
||||
#define D_T_FMT D_T_FMT
|
||||
D_FMT, /* Date format for strftime. */
|
||||
#define D_FMT D_FMT
|
||||
T_FMT, /* Time format for strftime. */
|
||||
#define T_FMT T_FMT
|
||||
T_FMT_AMPM, /* 12-hour time format for strftime. */
|
||||
#define T_FMT_AMPM T_FMT_AMPM
|
||||
|
||||
ERA, /* Alternate era. */
|
||||
#define ERA ERA
|
||||
__ERA_YEAR, /* Year in alternate era format. */
|
||||
#ifdef __USE_GNU
|
||||
# define ERA_YEAR __ERA_YEAR
|
||||
#endif
|
||||
ERA_D_FMT, /* Date in alternate era format. */
|
||||
#define ERA_D_FMT ERA_D_FMT
|
||||
ALT_DIGITS, /* Alternate symbols for digits. */
|
||||
#define ALT_DIGITS ALT_DIGITS
|
||||
ERA_D_T_FMT, /* Date and time in alternate era format. */
|
||||
#define ERA_D_T_FMT ERA_D_T_FMT
|
||||
ERA_T_FMT, /* Time in alternate era format. */
|
||||
#define ERA_T_FMT ERA_T_FMT
|
||||
|
||||
_NL_TIME_ERA_NUM_ENTRIES, /* Number entries in the era arrays. */
|
||||
_NL_TIME_ERA_ENTRIES, /* Structure with era entries in usable form.*/
|
||||
|
||||
_NL_WABDAY_1, /* Sun */
|
||||
_NL_WABDAY_2,
|
||||
_NL_WABDAY_3,
|
||||
_NL_WABDAY_4,
|
||||
_NL_WABDAY_5,
|
||||
_NL_WABDAY_6,
|
||||
_NL_WABDAY_7,
|
||||
|
||||
/* Long-named days of the week. */
|
||||
_NL_WDAY_1, /* Sunday */
|
||||
_NL_WDAY_2, /* Monday */
|
||||
_NL_WDAY_3, /* Tuesday */
|
||||
_NL_WDAY_4, /* Wednesday */
|
||||
_NL_WDAY_5, /* Thursday */
|
||||
_NL_WDAY_6, /* Friday */
|
||||
_NL_WDAY_7, /* Saturday */
|
||||
|
||||
/* Abbreviated month names, in the grammatical form used when the month
|
||||
is a part of a complete date. */
|
||||
_NL_WABMON_1, /* Jan */
|
||||
_NL_WABMON_2,
|
||||
_NL_WABMON_3,
|
||||
_NL_WABMON_4,
|
||||
_NL_WABMON_5,
|
||||
_NL_WABMON_6,
|
||||
_NL_WABMON_7,
|
||||
_NL_WABMON_8,
|
||||
_NL_WABMON_9,
|
||||
_NL_WABMON_10,
|
||||
_NL_WABMON_11,
|
||||
_NL_WABMON_12,
|
||||
|
||||
/* Long month names, in the grammatical form used when the month
|
||||
is a part of a complete date. */
|
||||
_NL_WMON_1, /* January */
|
||||
_NL_WMON_2,
|
||||
_NL_WMON_3,
|
||||
_NL_WMON_4,
|
||||
_NL_WMON_5,
|
||||
_NL_WMON_6,
|
||||
_NL_WMON_7,
|
||||
_NL_WMON_8,
|
||||
_NL_WMON_9,
|
||||
_NL_WMON_10,
|
||||
_NL_WMON_11,
|
||||
_NL_WMON_12,
|
||||
|
||||
_NL_WAM_STR, /* Ante meridiem string. */
|
||||
_NL_WPM_STR, /* Post meridiem string. */
|
||||
|
||||
_NL_WD_T_FMT, /* Date and time format for strftime. */
|
||||
_NL_WD_FMT, /* Date format for strftime. */
|
||||
_NL_WT_FMT, /* Time format for strftime. */
|
||||
_NL_WT_FMT_AMPM, /* 12-hour time format for strftime. */
|
||||
|
||||
_NL_WERA_YEAR, /* Year in alternate era format. */
|
||||
_NL_WERA_D_FMT, /* Date in alternate era format. */
|
||||
_NL_WALT_DIGITS, /* Alternate symbols for digits. */
|
||||
_NL_WERA_D_T_FMT, /* Date and time in alternate era format. */
|
||||
_NL_WERA_T_FMT, /* Time in alternate era format. */
|
||||
|
||||
_NL_TIME_WEEK_NDAYS,
|
||||
_NL_TIME_WEEK_1STDAY,
|
||||
_NL_TIME_WEEK_1STWEEK,
|
||||
_NL_TIME_FIRST_WEEKDAY,
|
||||
_NL_TIME_FIRST_WORKDAY,
|
||||
_NL_TIME_CAL_DIRECTION,
|
||||
_NL_TIME_TIMEZONE,
|
||||
|
||||
_DATE_FMT, /* strftime format for date. */
|
||||
#define _DATE_FMT _DATE_FMT
|
||||
_NL_W_DATE_FMT,
|
||||
|
||||
_NL_TIME_CODESET,
|
||||
|
||||
/* Long month names, in the grammatical form used when the month
|
||||
is named by itself. */
|
||||
__ALTMON_1, /* January */
|
||||
__ALTMON_2,
|
||||
__ALTMON_3,
|
||||
__ALTMON_4,
|
||||
__ALTMON_5,
|
||||
__ALTMON_6,
|
||||
__ALTMON_7,
|
||||
__ALTMON_8,
|
||||
__ALTMON_9,
|
||||
__ALTMON_10,
|
||||
__ALTMON_11,
|
||||
__ALTMON_12,
|
||||
#ifdef __USE_GNU
|
||||
# define ALTMON_1 __ALTMON_1
|
||||
# define ALTMON_2 __ALTMON_2
|
||||
# define ALTMON_3 __ALTMON_3
|
||||
# define ALTMON_4 __ALTMON_4
|
||||
# define ALTMON_5 __ALTMON_5
|
||||
# define ALTMON_6 __ALTMON_6
|
||||
# define ALTMON_7 __ALTMON_7
|
||||
# define ALTMON_8 __ALTMON_8
|
||||
# define ALTMON_9 __ALTMON_9
|
||||
# define ALTMON_10 __ALTMON_10
|
||||
# define ALTMON_11 __ALTMON_11
|
||||
# define ALTMON_12 __ALTMON_12
|
||||
#endif
|
||||
|
||||
/* Long month names, in the grammatical form used when the month
|
||||
is named by itself. */
|
||||
_NL_WALTMON_1, /* January */
|
||||
_NL_WALTMON_2,
|
||||
_NL_WALTMON_3,
|
||||
_NL_WALTMON_4,
|
||||
_NL_WALTMON_5,
|
||||
_NL_WALTMON_6,
|
||||
_NL_WALTMON_7,
|
||||
_NL_WALTMON_8,
|
||||
_NL_WALTMON_9,
|
||||
_NL_WALTMON_10,
|
||||
_NL_WALTMON_11,
|
||||
_NL_WALTMON_12,
|
||||
|
||||
/* Abbreviated month names, in the grammatical form used when the month
|
||||
is named by itself. */
|
||||
_NL_ABALTMON_1, /* Jan */
|
||||
_NL_ABALTMON_2,
|
||||
_NL_ABALTMON_3,
|
||||
_NL_ABALTMON_4,
|
||||
_NL_ABALTMON_5,
|
||||
_NL_ABALTMON_6,
|
||||
_NL_ABALTMON_7,
|
||||
_NL_ABALTMON_8,
|
||||
_NL_ABALTMON_9,
|
||||
_NL_ABALTMON_10,
|
||||
_NL_ABALTMON_11,
|
||||
_NL_ABALTMON_12,
|
||||
|
||||
/* Abbreviated month names, in the grammatical form used when the month
|
||||
is named by itself. */
|
||||
_NL_WABALTMON_1, /* Jan */
|
||||
_NL_WABALTMON_2,
|
||||
_NL_WABALTMON_3,
|
||||
_NL_WABALTMON_4,
|
||||
_NL_WABALTMON_5,
|
||||
_NL_WABALTMON_6,
|
||||
_NL_WABALTMON_7,
|
||||
_NL_WABALTMON_8,
|
||||
_NL_WABALTMON_9,
|
||||
_NL_WABALTMON_10,
|
||||
_NL_WABALTMON_11,
|
||||
_NL_WABALTMON_12,
|
||||
|
||||
_NL_NUM_LC_TIME, /* Number of indices in LC_TIME category. */
|
||||
|
||||
/* LC_COLLATE category: text sorting.
|
||||
This information is accessed by the strcoll and strxfrm functions.
|
||||
These `nl_langinfo' names are used only internally. */
|
||||
_NL_COLLATE_NRULES = _NL_ITEM (__LC_COLLATE, 0),
|
||||
_NL_COLLATE_RULESETS,
|
||||
_NL_COLLATE_TABLEMB,
|
||||
_NL_COLLATE_WEIGHTMB,
|
||||
_NL_COLLATE_EXTRAMB,
|
||||
_NL_COLLATE_INDIRECTMB,
|
||||
_NL_COLLATE_GAP1,
|
||||
_NL_COLLATE_GAP2,
|
||||
_NL_COLLATE_GAP3,
|
||||
_NL_COLLATE_TABLEWC,
|
||||
_NL_COLLATE_WEIGHTWC,
|
||||
_NL_COLLATE_EXTRAWC,
|
||||
_NL_COLLATE_INDIRECTWC,
|
||||
_NL_COLLATE_SYMB_HASH_SIZEMB,
|
||||
_NL_COLLATE_SYMB_TABLEMB,
|
||||
_NL_COLLATE_SYMB_EXTRAMB,
|
||||
_NL_COLLATE_COLLSEQMB,
|
||||
_NL_COLLATE_COLLSEQWC,
|
||||
_NL_COLLATE_CODESET,
|
||||
_NL_NUM_LC_COLLATE,
|
||||
|
||||
/* LC_CTYPE category: character classification.
|
||||
This information is accessed by the functions in <ctype.h>.
|
||||
These `nl_langinfo' names are used only internally. */
|
||||
_NL_CTYPE_CLASS = _NL_ITEM (__LC_CTYPE, 0),
|
||||
_NL_CTYPE_TOUPPER,
|
||||
_NL_CTYPE_GAP1,
|
||||
_NL_CTYPE_TOLOWER,
|
||||
_NL_CTYPE_GAP2,
|
||||
_NL_CTYPE_CLASS32,
|
||||
_NL_CTYPE_GAP3,
|
||||
_NL_CTYPE_GAP4,
|
||||
_NL_CTYPE_GAP5,
|
||||
_NL_CTYPE_GAP6,
|
||||
_NL_CTYPE_CLASS_NAMES,
|
||||
_NL_CTYPE_MAP_NAMES,
|
||||
_NL_CTYPE_WIDTH,
|
||||
_NL_CTYPE_MB_CUR_MAX,
|
||||
_NL_CTYPE_CODESET_NAME,
|
||||
CODESET = _NL_CTYPE_CODESET_NAME,
|
||||
#define CODESET CODESET
|
||||
_NL_CTYPE_TOUPPER32,
|
||||
_NL_CTYPE_TOLOWER32,
|
||||
_NL_CTYPE_CLASS_OFFSET,
|
||||
_NL_CTYPE_MAP_OFFSET,
|
||||
_NL_CTYPE_INDIGITS_MB_LEN,
|
||||
_NL_CTYPE_INDIGITS0_MB,
|
||||
_NL_CTYPE_INDIGITS1_MB,
|
||||
_NL_CTYPE_INDIGITS2_MB,
|
||||
_NL_CTYPE_INDIGITS3_MB,
|
||||
_NL_CTYPE_INDIGITS4_MB,
|
||||
_NL_CTYPE_INDIGITS5_MB,
|
||||
_NL_CTYPE_INDIGITS6_MB,
|
||||
_NL_CTYPE_INDIGITS7_MB,
|
||||
_NL_CTYPE_INDIGITS8_MB,
|
||||
_NL_CTYPE_INDIGITS9_MB,
|
||||
_NL_CTYPE_INDIGITS_WC_LEN,
|
||||
_NL_CTYPE_INDIGITS0_WC,
|
||||
_NL_CTYPE_INDIGITS1_WC,
|
||||
_NL_CTYPE_INDIGITS2_WC,
|
||||
_NL_CTYPE_INDIGITS3_WC,
|
||||
_NL_CTYPE_INDIGITS4_WC,
|
||||
_NL_CTYPE_INDIGITS5_WC,
|
||||
_NL_CTYPE_INDIGITS6_WC,
|
||||
_NL_CTYPE_INDIGITS7_WC,
|
||||
_NL_CTYPE_INDIGITS8_WC,
|
||||
_NL_CTYPE_INDIGITS9_WC,
|
||||
_NL_CTYPE_OUTDIGIT0_MB,
|
||||
_NL_CTYPE_OUTDIGIT1_MB,
|
||||
_NL_CTYPE_OUTDIGIT2_MB,
|
||||
_NL_CTYPE_OUTDIGIT3_MB,
|
||||
_NL_CTYPE_OUTDIGIT4_MB,
|
||||
_NL_CTYPE_OUTDIGIT5_MB,
|
||||
_NL_CTYPE_OUTDIGIT6_MB,
|
||||
_NL_CTYPE_OUTDIGIT7_MB,
|
||||
_NL_CTYPE_OUTDIGIT8_MB,
|
||||
_NL_CTYPE_OUTDIGIT9_MB,
|
||||
_NL_CTYPE_OUTDIGIT0_WC,
|
||||
_NL_CTYPE_OUTDIGIT1_WC,
|
||||
_NL_CTYPE_OUTDIGIT2_WC,
|
||||
_NL_CTYPE_OUTDIGIT3_WC,
|
||||
_NL_CTYPE_OUTDIGIT4_WC,
|
||||
_NL_CTYPE_OUTDIGIT5_WC,
|
||||
_NL_CTYPE_OUTDIGIT6_WC,
|
||||
_NL_CTYPE_OUTDIGIT7_WC,
|
||||
_NL_CTYPE_OUTDIGIT8_WC,
|
||||
_NL_CTYPE_OUTDIGIT9_WC,
|
||||
_NL_CTYPE_TRANSLIT_TAB_SIZE,
|
||||
_NL_CTYPE_TRANSLIT_FROM_IDX,
|
||||
_NL_CTYPE_TRANSLIT_FROM_TBL,
|
||||
_NL_CTYPE_TRANSLIT_TO_IDX,
|
||||
_NL_CTYPE_TRANSLIT_TO_TBL,
|
||||
_NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN,
|
||||
_NL_CTYPE_TRANSLIT_DEFAULT_MISSING,
|
||||
_NL_CTYPE_TRANSLIT_IGNORE_LEN,
|
||||
_NL_CTYPE_TRANSLIT_IGNORE,
|
||||
_NL_CTYPE_MAP_TO_NONASCII,
|
||||
_NL_CTYPE_NONASCII_CASE,
|
||||
_NL_CTYPE_EXTRA_MAP_1,
|
||||
_NL_CTYPE_EXTRA_MAP_2,
|
||||
_NL_CTYPE_EXTRA_MAP_3,
|
||||
_NL_CTYPE_EXTRA_MAP_4,
|
||||
_NL_CTYPE_EXTRA_MAP_5,
|
||||
_NL_CTYPE_EXTRA_MAP_6,
|
||||
_NL_CTYPE_EXTRA_MAP_7,
|
||||
_NL_CTYPE_EXTRA_MAP_8,
|
||||
_NL_CTYPE_EXTRA_MAP_9,
|
||||
_NL_CTYPE_EXTRA_MAP_10,
|
||||
_NL_CTYPE_EXTRA_MAP_11,
|
||||
_NL_CTYPE_EXTRA_MAP_12,
|
||||
_NL_CTYPE_EXTRA_MAP_13,
|
||||
_NL_CTYPE_EXTRA_MAP_14,
|
||||
_NL_NUM_LC_CTYPE,
|
||||
|
||||
/* LC_MONETARY category: formatting of monetary quantities.
|
||||
These items each correspond to a member of `struct lconv',
|
||||
defined in <locale.h>. */
|
||||
__INT_CURR_SYMBOL = _NL_ITEM (__LC_MONETARY, 0),
|
||||
#ifdef __USE_GNU
|
||||
# define INT_CURR_SYMBOL __INT_CURR_SYMBOL
|
||||
#endif
|
||||
__CURRENCY_SYMBOL,
|
||||
#ifdef __USE_GNU
|
||||
# define CURRENCY_SYMBOL __CURRENCY_SYMBOL
|
||||
#endif
|
||||
__MON_DECIMAL_POINT,
|
||||
#ifdef __USE_GNU
|
||||
# define MON_DECIMAL_POINT __MON_DECIMAL_POINT
|
||||
#endif
|
||||
__MON_THOUSANDS_SEP,
|
||||
#ifdef __USE_GNU
|
||||
# define MON_THOUSANDS_SEP __MON_THOUSANDS_SEP
|
||||
#endif
|
||||
__MON_GROUPING,
|
||||
#ifdef __USE_GNU
|
||||
# define MON_GROUPING __MON_GROUPING
|
||||
#endif
|
||||
__POSITIVE_SIGN,
|
||||
#ifdef __USE_GNU
|
||||
# define POSITIVE_SIGN __POSITIVE_SIGN
|
||||
#endif
|
||||
__NEGATIVE_SIGN,
|
||||
#ifdef __USE_GNU
|
||||
# define NEGATIVE_SIGN __NEGATIVE_SIGN
|
||||
#endif
|
||||
__INT_FRAC_DIGITS,
|
||||
#ifdef __USE_GNU
|
||||
# define INT_FRAC_DIGITS __INT_FRAC_DIGITS
|
||||
#endif
|
||||
__FRAC_DIGITS,
|
||||
#ifdef __USE_GNU
|
||||
# define FRAC_DIGITS __FRAC_DIGITS
|
||||
#endif
|
||||
__P_CS_PRECEDES,
|
||||
#ifdef __USE_GNU
|
||||
# define P_CS_PRECEDES __P_CS_PRECEDES
|
||||
#endif
|
||||
__P_SEP_BY_SPACE,
|
||||
#ifdef __USE_GNU
|
||||
# define P_SEP_BY_SPACE __P_SEP_BY_SPACE
|
||||
#endif
|
||||
__N_CS_PRECEDES,
|
||||
#ifdef __USE_GNU
|
||||
# define N_CS_PRECEDES __N_CS_PRECEDES
|
||||
#endif
|
||||
__N_SEP_BY_SPACE,
|
||||
#ifdef __USE_GNU
|
||||
# define N_SEP_BY_SPACE __N_SEP_BY_SPACE
|
||||
#endif
|
||||
__P_SIGN_POSN,
|
||||
#ifdef __USE_GNU
|
||||
# define P_SIGN_POSN __P_SIGN_POSN
|
||||
#endif
|
||||
__N_SIGN_POSN,
|
||||
#ifdef __USE_GNU
|
||||
# define N_SIGN_POSN __N_SIGN_POSN
|
||||
#endif
|
||||
_NL_MONETARY_CRNCYSTR,
|
||||
#define CRNCYSTR _NL_MONETARY_CRNCYSTR
|
||||
__INT_P_CS_PRECEDES,
|
||||
#ifdef __USE_GNU
|
||||
# define INT_P_CS_PRECEDES __INT_P_CS_PRECEDES
|
||||
#endif
|
||||
__INT_P_SEP_BY_SPACE,
|
||||
#ifdef __USE_GNU
|
||||
# define INT_P_SEP_BY_SPACE __INT_P_SEP_BY_SPACE
|
||||
#endif
|
||||
__INT_N_CS_PRECEDES,
|
||||
#ifdef __USE_GNU
|
||||
# define INT_N_CS_PRECEDES __INT_N_CS_PRECEDES
|
||||
#endif
|
||||
__INT_N_SEP_BY_SPACE,
|
||||
#ifdef __USE_GNU
|
||||
# define INT_N_SEP_BY_SPACE __INT_N_SEP_BY_SPACE
|
||||
#endif
|
||||
__INT_P_SIGN_POSN,
|
||||
#ifdef __USE_GNU
|
||||
# define INT_P_SIGN_POSN __INT_P_SIGN_POSN
|
||||
#endif
|
||||
__INT_N_SIGN_POSN,
|
||||
#ifdef __USE_GNU
|
||||
# define INT_N_SIGN_POSN __INT_N_SIGN_POSN
|
||||
#endif
|
||||
_NL_MONETARY_DUO_INT_CURR_SYMBOL,
|
||||
_NL_MONETARY_DUO_CURRENCY_SYMBOL,
|
||||
_NL_MONETARY_DUO_INT_FRAC_DIGITS,
|
||||
_NL_MONETARY_DUO_FRAC_DIGITS,
|
||||
_NL_MONETARY_DUO_P_CS_PRECEDES,
|
||||
_NL_MONETARY_DUO_P_SEP_BY_SPACE,
|
||||
_NL_MONETARY_DUO_N_CS_PRECEDES,
|
||||
_NL_MONETARY_DUO_N_SEP_BY_SPACE,
|
||||
_NL_MONETARY_DUO_INT_P_CS_PRECEDES,
|
||||
_NL_MONETARY_DUO_INT_P_SEP_BY_SPACE,
|
||||
_NL_MONETARY_DUO_INT_N_CS_PRECEDES,
|
||||
_NL_MONETARY_DUO_INT_N_SEP_BY_SPACE,
|
||||
_NL_MONETARY_DUO_P_SIGN_POSN,
|
||||
_NL_MONETARY_DUO_N_SIGN_POSN,
|
||||
_NL_MONETARY_DUO_INT_P_SIGN_POSN,
|
||||
_NL_MONETARY_DUO_INT_N_SIGN_POSN,
|
||||
_NL_MONETARY_UNO_VALID_FROM,
|
||||
_NL_MONETARY_UNO_VALID_TO,
|
||||
_NL_MONETARY_DUO_VALID_FROM,
|
||||
_NL_MONETARY_DUO_VALID_TO,
|
||||
_NL_MONETARY_CONVERSION_RATE,
|
||||
_NL_MONETARY_DECIMAL_POINT_WC,
|
||||
_NL_MONETARY_THOUSANDS_SEP_WC,
|
||||
_NL_MONETARY_CODESET,
|
||||
_NL_NUM_LC_MONETARY,
|
||||
|
||||
/* LC_NUMERIC category: formatting of numbers.
|
||||
These also correspond to members of `struct lconv'; see <locale.h>. */
|
||||
__DECIMAL_POINT = _NL_ITEM (__LC_NUMERIC, 0),
|
||||
#ifdef __USE_GNU
|
||||
# define DECIMAL_POINT __DECIMAL_POINT
|
||||
#endif
|
||||
RADIXCHAR = __DECIMAL_POINT,
|
||||
#define RADIXCHAR RADIXCHAR
|
||||
__THOUSANDS_SEP,
|
||||
#ifdef __USE_GNU
|
||||
# define THOUSANDS_SEP __THOUSANDS_SEP
|
||||
#endif
|
||||
THOUSEP = __THOUSANDS_SEP,
|
||||
#define THOUSEP THOUSEP
|
||||
__GROUPING,
|
||||
#ifdef __USE_GNU
|
||||
# define GROUPING __GROUPING
|
||||
#endif
|
||||
_NL_NUMERIC_DECIMAL_POINT_WC,
|
||||
_NL_NUMERIC_THOUSANDS_SEP_WC,
|
||||
_NL_NUMERIC_CODESET,
|
||||
_NL_NUM_LC_NUMERIC,
|
||||
|
||||
__YESEXPR = _NL_ITEM (__LC_MESSAGES, 0), /* Regex matching ``yes'' input. */
|
||||
#define YESEXPR __YESEXPR
|
||||
__NOEXPR, /* Regex matching ``no'' input. */
|
||||
#define NOEXPR __NOEXPR
|
||||
__YESSTR, /* Output string for ``yes''. */
|
||||
#if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
|
||||
# define YESSTR __YESSTR
|
||||
#endif
|
||||
__NOSTR, /* Output string for ``no''. */
|
||||
#if defined __USE_GNU || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
|
||||
# define NOSTR __NOSTR
|
||||
#endif
|
||||
_NL_MESSAGES_CODESET,
|
||||
_NL_NUM_LC_MESSAGES,
|
||||
|
||||
_NL_PAPER_HEIGHT = _NL_ITEM (__LC_PAPER, 0),
|
||||
_NL_PAPER_WIDTH,
|
||||
_NL_PAPER_CODESET,
|
||||
_NL_NUM_LC_PAPER,
|
||||
|
||||
_NL_NAME_NAME_FMT = _NL_ITEM (__LC_NAME, 0),
|
||||
_NL_NAME_NAME_GEN,
|
||||
_NL_NAME_NAME_MR,
|
||||
_NL_NAME_NAME_MRS,
|
||||
_NL_NAME_NAME_MISS,
|
||||
_NL_NAME_NAME_MS,
|
||||
_NL_NAME_CODESET,
|
||||
_NL_NUM_LC_NAME,
|
||||
|
||||
_NL_ADDRESS_POSTAL_FMT = _NL_ITEM (__LC_ADDRESS, 0),
|
||||
_NL_ADDRESS_COUNTRY_NAME,
|
||||
_NL_ADDRESS_COUNTRY_POST,
|
||||
_NL_ADDRESS_COUNTRY_AB2,
|
||||
_NL_ADDRESS_COUNTRY_AB3,
|
||||
_NL_ADDRESS_COUNTRY_CAR,
|
||||
_NL_ADDRESS_COUNTRY_NUM,
|
||||
_NL_ADDRESS_COUNTRY_ISBN,
|
||||
_NL_ADDRESS_LANG_NAME,
|
||||
_NL_ADDRESS_LANG_AB,
|
||||
_NL_ADDRESS_LANG_TERM,
|
||||
_NL_ADDRESS_LANG_LIB,
|
||||
_NL_ADDRESS_CODESET,
|
||||
_NL_NUM_LC_ADDRESS,
|
||||
|
||||
_NL_TELEPHONE_TEL_INT_FMT = _NL_ITEM (__LC_TELEPHONE, 0),
|
||||
_NL_TELEPHONE_TEL_DOM_FMT,
|
||||
_NL_TELEPHONE_INT_SELECT,
|
||||
_NL_TELEPHONE_INT_PREFIX,
|
||||
_NL_TELEPHONE_CODESET,
|
||||
_NL_NUM_LC_TELEPHONE,
|
||||
|
||||
_NL_MEASUREMENT_MEASUREMENT = _NL_ITEM (__LC_MEASUREMENT, 0),
|
||||
_NL_MEASUREMENT_CODESET,
|
||||
_NL_NUM_LC_MEASUREMENT,
|
||||
|
||||
_NL_IDENTIFICATION_TITLE = _NL_ITEM (__LC_IDENTIFICATION, 0),
|
||||
_NL_IDENTIFICATION_SOURCE,
|
||||
_NL_IDENTIFICATION_ADDRESS,
|
||||
_NL_IDENTIFICATION_CONTACT,
|
||||
_NL_IDENTIFICATION_EMAIL,
|
||||
_NL_IDENTIFICATION_TEL,
|
||||
_NL_IDENTIFICATION_FAX,
|
||||
_NL_IDENTIFICATION_LANGUAGE,
|
||||
_NL_IDENTIFICATION_TERRITORY,
|
||||
_NL_IDENTIFICATION_AUDIENCE,
|
||||
_NL_IDENTIFICATION_APPLICATION,
|
||||
_NL_IDENTIFICATION_ABBREVIATION,
|
||||
_NL_IDENTIFICATION_REVISION,
|
||||
_NL_IDENTIFICATION_DATE,
|
||||
_NL_IDENTIFICATION_CATEGORY,
|
||||
_NL_IDENTIFICATION_CODESET,
|
||||
_NL_NUM_LC_IDENTIFICATION,
|
||||
|
||||
/* This marks the highest value used. */
|
||||
_NL_NUM
|
||||
};
|
||||
|
||||
/* This macro produces an item you can pass to `nl_langinfo' or
|
||||
`nl_langinfo_l' to get the name of the locale in use for CATEGORY. */
|
||||
#define _NL_LOCALE_NAME(category) _NL_ITEM ((category), \
|
||||
_NL_ITEM_INDEX (-1))
|
||||
#ifdef __USE_GNU
|
||||
# define NL_LOCALE_NAME(category) _NL_LOCALE_NAME (category)
|
||||
#endif
|
||||
|
||||
|
||||
/* Return the current locale's value for ITEM.
|
||||
If ITEM is invalid, an empty string is returned.
|
||||
|
||||
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) __THROW;
|
||||
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* POSIX.1-2008 extended locale interface (see locale.h). */
|
||||
# include <bits/types/locale_t.h>
|
||||
|
||||
/* Just like nl_langinfo but get the information from the locale object L. */
|
||||
extern char *nl_langinfo_l (nl_item __item, locale_t __l);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* langinfo.h */
|
123
contrib/libc-headers/libintl.h
Normal file
123
contrib/libc-headers/libintl.h
Normal file
@ -0,0 +1,123 @@
|
||||
/* Message catalogs for internationalization.
|
||||
Copyright (C) 1995-2018 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
This file is derived from the file libgettext.h in the GNU gettext package.
|
||||
|
||||
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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* We define an additional symbol to signal that we use the GNU
|
||||
implementation of gettext. */
|
||||
#define __USE_GNU_GETTEXT 1
|
||||
|
||||
/* Provide information about the supported file formats. Returns the
|
||||
maximum minor revision number supported for a given major revision. */
|
||||
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
|
||||
((major) == 0 ? 1 : -1)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
extern char *gettext (const char *__msgid)
|
||||
__THROW __attribute_format_arg__ (1);
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||
LC_MESSAGES locale. */
|
||||
extern char *dgettext (const char *__domainname, const char *__msgid)
|
||||
__THROW __attribute_format_arg__ (2);
|
||||
extern char *__dgettext (const char *__domainname, const char *__msgid)
|
||||
__THROW __attribute_format_arg__ (2);
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
extern char *dcgettext (const char *__domainname,
|
||||
const char *__msgid, int __category)
|
||||
__THROW __attribute_format_arg__ (2);
|
||||
extern char *__dcgettext (const char *__domainname,
|
||||
const char *__msgid, int __category)
|
||||
__THROW __attribute_format_arg__ (2);
|
||||
|
||||
|
||||
/* Similar to `gettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
extern char *ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
__THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2);
|
||||
|
||||
/* Similar to `dgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
extern char *dngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n)
|
||||
__THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
|
||||
|
||||
/* Similar to `dcgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
extern char *dcngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n,
|
||||
int __category)
|
||||
__THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
|
||||
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
extern char *textdomain (const char *__domainname) __THROW;
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
extern char *bindtextdomain (const char *__domainname,
|
||||
const char *__dirname) __THROW;
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
extern char *bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset) __THROW;
|
||||
|
||||
|
||||
/* Optimized version of the function above. */
|
||||
#if defined __OPTIMIZE__ && !defined __cplusplus
|
||||
|
||||
/* We need NULL for `gettext'. */
|
||||
# define __need_NULL
|
||||
# include <stddef.h>
|
||||
|
||||
/* We need LC_MESSAGES for `dgettext'. */
|
||||
# include <locale.h>
|
||||
|
||||
/* These must be macros. Inlined functions are useless because the
|
||||
`__builtin_constant_p' predicate in dcgettext would always return
|
||||
false. */
|
||||
|
||||
# define gettext(msgid) dgettext (NULL, msgid)
|
||||
|
||||
# define dgettext(domainname, msgid) \
|
||||
dcgettext (domainname, msgid, LC_MESSAGES)
|
||||
|
||||
# define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
|
||||
|
||||
# define dngettext(domainname, msgid1, msgid2, n) \
|
||||
dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
|
||||
|
||||
#endif /* Optimizing. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* libintl.h */
|
192
contrib/libc-headers/limits.h
Normal file
192
contrib/libc-headers/limits.h
Normal file
@ -0,0 +1,192 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types <limits.h>
|
||||
*/
|
||||
|
||||
#ifndef _LIBC_LIMITS_H_
|
||||
#define _LIBC_LIMITS_H_ 1
|
||||
|
||||
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
|
||||
#include <bits/libc-header-start.h>
|
||||
|
||||
|
||||
/* 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 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. */
|
||||
|
||||
/* These assume 8-bit `char's, 16-bit `short int's,
|
||||
and 32-bit `int's and `long int's. */
|
||||
|
||||
/* Number of bits in a `char'. */
|
||||
# define CHAR_BIT 8
|
||||
|
||||
/* Minimum and maximum values a `signed char' can hold. */
|
||||
# define SCHAR_MIN (-128)
|
||||
# define SCHAR_MAX 127
|
||||
|
||||
/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
|
||||
# define UCHAR_MAX 255
|
||||
|
||||
/* Minimum and maximum values a `char' can hold. */
|
||||
# ifdef __CHAR_UNSIGNED__
|
||||
# define CHAR_MIN 0
|
||||
# define CHAR_MAX UCHAR_MAX
|
||||
# else
|
||||
# define CHAR_MIN SCHAR_MIN
|
||||
# define CHAR_MAX SCHAR_MAX
|
||||
# endif
|
||||
|
||||
/* Minimum and maximum values a `signed short int' can hold. */
|
||||
# define SHRT_MIN (-32768)
|
||||
# define SHRT_MAX 32767
|
||||
|
||||
/* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */
|
||||
# define USHRT_MAX 65535
|
||||
|
||||
/* Minimum and maximum values a `signed int' can hold. */
|
||||
# define INT_MIN (-INT_MAX - 1)
|
||||
# define INT_MAX 2147483647
|
||||
|
||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
|
||||
# define UINT_MAX 4294967295U
|
||||
|
||||
/* Minimum and maximum values a `signed long int' can hold. */
|
||||
# if __WORDSIZE == 64
|
||||
# define LONG_MAX 9223372036854775807L
|
||||
# else
|
||||
# define LONG_MAX 2147483647L
|
||||
# endif
|
||||
# define LONG_MIN (-LONG_MAX - 1L)
|
||||
|
||||
/* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
|
||||
# if __WORDSIZE == 64
|
||||
# define ULONG_MAX 18446744073709551615UL
|
||||
# else
|
||||
# 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_ */
|
||||
|
||||
/* Get the compiler's limits.h, which defines almost all the ISO constants.
|
||||
|
||||
We put this #include_next outside the double inclusion check because
|
||||
it should be possible to include this file more than once and still get
|
||||
the definitions from gcc's header. */
|
||||
#if defined __GNUC__ && !defined _GCC_LIMITS_H_
|
||||
/* `_GCC_LIMITS_H_' is what GCC's file defines. */
|
||||
# include_next <limits.h>
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
#if defined __USE_ISOC99 && defined __GNUC__
|
||||
# ifndef LLONG_MIN
|
||||
# define LLONG_MIN (-LLONG_MAX-1)
|
||||
# endif
|
||||
# ifndef LLONG_MAX
|
||||
# define LLONG_MAX __LONG_LONG_MAX__
|
||||
# endif
|
||||
# ifndef ULLONG_MAX
|
||||
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The integer width macros are not defined by GCC's <limits.h> before
|
||||
GCC 7, or if _GNU_SOURCE rather than
|
||||
__STDC_WANT_IEC_60559_BFP_EXT__ is used to enable this feature. */
|
||||
#if __GLIBC_USE (IEC_60559_BFP_EXT)
|
||||
# ifndef CHAR_WIDTH
|
||||
# define CHAR_WIDTH 8
|
||||
# endif
|
||||
# ifndef SCHAR_WIDTH
|
||||
# define SCHAR_WIDTH 8
|
||||
# endif
|
||||
# ifndef UCHAR_WIDTH
|
||||
# define UCHAR_WIDTH 8
|
||||
# endif
|
||||
# ifndef SHRT_WIDTH
|
||||
# define SHRT_WIDTH 16
|
||||
# endif
|
||||
# ifndef USHRT_WIDTH
|
||||
# define USHRT_WIDTH 16
|
||||
# endif
|
||||
# ifndef INT_WIDTH
|
||||
# define INT_WIDTH 32
|
||||
# endif
|
||||
# ifndef UINT_WIDTH
|
||||
# define UINT_WIDTH 32
|
||||
# endif
|
||||
# ifndef LONG_WIDTH
|
||||
# define LONG_WIDTH __WORDSIZE
|
||||
# endif
|
||||
# ifndef ULONG_WIDTH
|
||||
# define ULONG_WIDTH __WORDSIZE
|
||||
# endif
|
||||
# ifndef LLONG_WIDTH
|
||||
# define LLONG_WIDTH 64
|
||||
# endif
|
||||
# ifndef ULLONG_WIDTH
|
||||
# define ULLONG_WIDTH 64
|
||||
# endif
|
||||
#endif /* Use IEC_60559_BFP_EXT. */
|
||||
|
||||
#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
|
194
contrib/libc-headers/link.h
Normal file
194
contrib/libc-headers/link.h
Normal file
@ -0,0 +1,194 @@
|
||||
/* Data structure for communication from the run-time dynamic linker for
|
||||
loaded ELF shared objects.
|
||||
Copyright (C) 1995-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LINK_H
|
||||
#define _LINK_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <elf.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* We use this macro to refer to ELF types independent of the native wordsize.
|
||||
`ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */
|
||||
#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type)
|
||||
#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t)
|
||||
#define _ElfW_1(e,w,t) e##w##t
|
||||
|
||||
#include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */
|
||||
#include <bits/link.h>
|
||||
|
||||
/* Rendezvous structure used by the run-time dynamic linker to communicate
|
||||
details of shared object loading to the debugger. If the executable's
|
||||
dynamic section has a DT_DEBUG element, the run-time linker sets that
|
||||
element's value to the address where this structure can be found. */
|
||||
|
||||
struct r_debug
|
||||
{
|
||||
int r_version; /* Version number for this protocol. */
|
||||
|
||||
struct link_map *r_map; /* Head of the chain of loaded objects. */
|
||||
|
||||
/* This is the address of a function internal to the run-time linker,
|
||||
that will always be called when the linker begins to map in a
|
||||
library or unmap it, and again when the mapping change is complete.
|
||||
The debugger can set a breakpoint at this address if it wants to
|
||||
notice shared object mapping changes. */
|
||||
ElfW(Addr) r_brk;
|
||||
enum
|
||||
{
|
||||
/* This state value describes the mapping change taking place when
|
||||
the `r_brk' address is called. */
|
||||
RT_CONSISTENT, /* Mapping change is complete. */
|
||||
RT_ADD, /* Beginning to add a new object. */
|
||||
RT_DELETE /* Beginning to remove an object mapping. */
|
||||
} r_state;
|
||||
|
||||
ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */
|
||||
};
|
||||
|
||||
/* This is the instance of that structure used by the dynamic linker. */
|
||||
extern struct r_debug _r_debug;
|
||||
|
||||
/* This symbol refers to the "dynamic structure" in the `.dynamic' section
|
||||
of whatever module refers to `_DYNAMIC'. So, to find its own
|
||||
`struct r_debug', a program could do:
|
||||
for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn)
|
||||
if (dyn->d_tag == DT_DEBUG)
|
||||
r_debug = (struct r_debug *) dyn->d_un.d_ptr;
|
||||
*/
|
||||
extern ElfW(Dyn) _DYNAMIC[];
|
||||
|
||||
/* Structure describing a loaded shared object. The `l_next' and `l_prev'
|
||||
members form a chain of all the shared objects loaded at startup.
|
||||
|
||||
These data structures exist in space used by the run-time dynamic linker;
|
||||
modifying them may have disastrous results. */
|
||||
|
||||
struct link_map
|
||||
{
|
||||
/* These first few members are part of the protocol with the debugger.
|
||||
This is the same format used in SVR4. */
|
||||
|
||||
ElfW(Addr) l_addr; /* Difference between the address in the ELF
|
||||
file and the addresses in memory. */
|
||||
char *l_name; /* Absolute file name object was found in. */
|
||||
ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */
|
||||
struct link_map *l_next, *l_prev; /* Chain of loaded objects. */
|
||||
};
|
||||
|
||||
#ifdef __USE_GNU
|
||||
|
||||
/* Version numbers for la_version handshake interface. */
|
||||
#define LAV_CURRENT 1
|
||||
|
||||
/* Activity types signaled through la_activity. */
|
||||
enum
|
||||
{
|
||||
LA_ACT_CONSISTENT, /* Link map consistent again. */
|
||||
LA_ACT_ADD, /* New object will be added. */
|
||||
LA_ACT_DELETE /* Objects will be removed. */
|
||||
};
|
||||
|
||||
/* Values representing origin of name for dynamic loading. */
|
||||
enum
|
||||
{
|
||||
LA_SER_ORIG = 0x01, /* Original name. */
|
||||
LA_SER_LIBPATH = 0x02, /* Directory from LD_LIBRARY_PATH. */
|
||||
LA_SER_RUNPATH = 0x04, /* Directory from RPATH/RUNPATH. */
|
||||
LA_SER_CONFIG = 0x08, /* Found through ldconfig. */
|
||||
LA_SER_DEFAULT = 0x40, /* Default directory. */
|
||||
LA_SER_SECURE = 0x80 /* Unused. */
|
||||
};
|
||||
|
||||
/* Values for la_objopen return value. */
|
||||
enum
|
||||
{
|
||||
LA_FLG_BINDTO = 0x01, /* Audit symbols bound to this object. */
|
||||
LA_FLG_BINDFROM = 0x02 /* Audit symbols bound from this object. */
|
||||
};
|
||||
|
||||
/* Values for la_symbind flags parameter. */
|
||||
enum
|
||||
{
|
||||
LA_SYMB_NOPLTENTER = 0x01, /* la_pltenter will not be called. */
|
||||
LA_SYMB_NOPLTEXIT = 0x02, /* la_pltexit will not be called. */
|
||||
LA_SYMB_STRUCTCALL = 0x04, /* Return value is a structure. */
|
||||
LA_SYMB_DLSYM = 0x08, /* Binding due to dlsym call. */
|
||||
LA_SYMB_ALTVALUE = 0x10 /* Value has been changed by a previous
|
||||
la_symbind call. */
|
||||
};
|
||||
|
||||
struct dl_phdr_info
|
||||
{
|
||||
ElfW(Addr) dlpi_addr;
|
||||
const char *dlpi_name;
|
||||
const ElfW(Phdr) *dlpi_phdr;
|
||||
ElfW(Half) dlpi_phnum;
|
||||
|
||||
/* Note: Following members were introduced after the first
|
||||
version of this structure was available. Check the SIZE
|
||||
argument passed to the dl_iterate_phdr callback to determine
|
||||
whether or not each later member is available. */
|
||||
|
||||
/* Incremented when a new object may have been added. */
|
||||
__extension__ unsigned long long int dlpi_adds;
|
||||
/* Incremented when an object may have been removed. */
|
||||
__extension__ unsigned long long int dlpi_subs;
|
||||
|
||||
/* If there is a PT_TLS segment, its module ID as used in
|
||||
TLS relocations, else zero. */
|
||||
size_t dlpi_tls_modid;
|
||||
|
||||
/* The address of the calling thread's instance of this module's
|
||||
PT_TLS segment, if it has one and it has been allocated
|
||||
in the calling thread, otherwise a null pointer. */
|
||||
void *dlpi_tls_data;
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern int dl_iterate_phdr (int (*__callback) (struct dl_phdr_info *,
|
||||
size_t, void *),
|
||||
void *__data);
|
||||
|
||||
|
||||
/* Prototypes for the ld.so auditing interfaces. These are not
|
||||
defined anywhere in ld.so but instead have to be provided by the
|
||||
auditing DSO. */
|
||||
extern unsigned int la_version (unsigned int __version);
|
||||
extern void la_activity (uintptr_t *__cookie, unsigned int __flag);
|
||||
extern char *la_objsearch (const char *__name, uintptr_t *__cookie,
|
||||
unsigned int __flag);
|
||||
extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid,
|
||||
uintptr_t *__cookie);
|
||||
extern void la_preinit (uintptr_t *__cookie);
|
||||
extern uintptr_t la_symbind32 (Elf32_Sym *__sym, unsigned int __ndx,
|
||||
uintptr_t *__refcook, uintptr_t *__defcook,
|
||||
unsigned int *__flags, const char *__symname);
|
||||
extern uintptr_t la_symbind64 (Elf64_Sym *__sym, unsigned int __ndx,
|
||||
uintptr_t *__refcook, uintptr_t *__defcook,
|
||||
unsigned int *__flags, const char *__symname);
|
||||
extern unsigned int la_objclose (uintptr_t *__cookie);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* link.h */
|
112
contrib/libc-headers/linux/aio_abi.h
Normal file
112
contrib/libc-headers/linux/aio_abi.h
Normal file
@ -0,0 +1,112 @@
|
||||
/* include/linux/aio_abi.h
|
||||
*
|
||||
* Copyright 2000,2001,2002 Red Hat.
|
||||
*
|
||||
* Written by Benjamin LaHaise <bcrl@kvack.org>
|
||||
*
|
||||
* Distribute under the terms of the GPLv2 (see ../../COPYING) or under
|
||||
* the following terms.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation is hereby granted, provided that the above copyright
|
||||
* notice appears in all copies. This software is provided without any
|
||||
* warranty, express or implied. Red Hat makes no representations about
|
||||
* the suitability of this software for any purpose.
|
||||
*
|
||||
* IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||
* SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
|
||||
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
|
||||
* RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
#ifndef __LINUX__AIO_ABI_H
|
||||
#define __LINUX__AIO_ABI_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/fs.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
typedef __kernel_ulong_t aio_context_t;
|
||||
|
||||
enum {
|
||||
IOCB_CMD_PREAD = 0,
|
||||
IOCB_CMD_PWRITE = 1,
|
||||
IOCB_CMD_FSYNC = 2,
|
||||
IOCB_CMD_FDSYNC = 3,
|
||||
/* These two are experimental.
|
||||
* IOCB_CMD_PREADX = 4,
|
||||
* IOCB_CMD_POLL = 5,
|
||||
*/
|
||||
IOCB_CMD_NOOP = 6,
|
||||
IOCB_CMD_PREADV = 7,
|
||||
IOCB_CMD_PWRITEV = 8,
|
||||
};
|
||||
|
||||
/*
|
||||
* Valid flags for the "aio_flags" member of the "struct iocb".
|
||||
*
|
||||
* IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb"
|
||||
* is valid.
|
||||
*/
|
||||
#define IOCB_FLAG_RESFD (1 << 0)
|
||||
|
||||
/* read() from /dev/aio returns these structures. */
|
||||
struct io_event {
|
||||
__u64 data; /* the data field from the iocb */
|
||||
__u64 obj; /* what iocb this event came from */
|
||||
__s64 res; /* result code for this event */
|
||||
__s64 res2; /* secondary result */
|
||||
};
|
||||
|
||||
/*
|
||||
* we always use a 64bit off_t when communicating
|
||||
* with userland. its up to libraries to do the
|
||||
* proper padding and aio_error abstraction
|
||||
*/
|
||||
|
||||
struct iocb {
|
||||
/* these are internal to the kernel/libc. */
|
||||
__u64 aio_data; /* data to be returned in event's data */
|
||||
|
||||
#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
|
||||
__u32 aio_key; /* the kernel sets aio_key to the req # */
|
||||
__kernel_rwf_t aio_rw_flags; /* RWF_* flags */
|
||||
#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
|
||||
__kernel_rwf_t aio_rw_flags; /* RWF_* flags */
|
||||
__u32 aio_key; /* the kernel sets aio_key to the req # */
|
||||
#else
|
||||
#error edit for your odd byteorder.
|
||||
#endif
|
||||
|
||||
/* common fields */
|
||||
__u16 aio_lio_opcode; /* see IOCB_CMD_ above */
|
||||
__s16 aio_reqprio;
|
||||
__u32 aio_fildes;
|
||||
|
||||
__u64 aio_buf;
|
||||
__u64 aio_nbytes;
|
||||
__s64 aio_offset;
|
||||
|
||||
/* extra parameters */
|
||||
__u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */
|
||||
|
||||
/* flags for the "struct iocb" */
|
||||
__u32 aio_flags;
|
||||
|
||||
/*
|
||||
* if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an
|
||||
* eventfd to signal AIO readiness to
|
||||
*/
|
||||
__u32 aio_resfd;
|
||||
}; /* 64 bytes */
|
||||
|
||||
#undef IFBIG
|
||||
#undef IFLITTLE
|
||||
|
||||
#endif /* __LINUX__AIO_ABI_H */
|
||||
|
106
contrib/libc-headers/linux/byteorder/little_endian.h
Normal file
106
contrib/libc-headers/linux/byteorder/little_endian.h
Normal file
@ -0,0 +1,106 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
|
||||
#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
|
||||
|
||||
#ifndef __LITTLE_ENDIAN
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
#ifndef __LITTLE_ENDIAN_BITFIELD
|
||||
#define __LITTLE_ENDIAN_BITFIELD
|
||||
#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/swab.h>
|
||||
|
||||
#define __constant_htonl(x) ((__be32)___constant_swab32((x)))
|
||||
#define __constant_ntohl(x) ___constant_swab32((__be32)(x))
|
||||
#define __constant_htons(x) ((__be16)___constant_swab16((x)))
|
||||
#define __constant_ntohs(x) ___constant_swab16((__be16)(x))
|
||||
#define __constant_cpu_to_le64(x) ((__le64)(__u64)(x))
|
||||
#define __constant_le64_to_cpu(x) ((__u64)(__le64)(x))
|
||||
#define __constant_cpu_to_le32(x) ((__le32)(__u32)(x))
|
||||
#define __constant_le32_to_cpu(x) ((__u32)(__le32)(x))
|
||||
#define __constant_cpu_to_le16(x) ((__le16)(__u16)(x))
|
||||
#define __constant_le16_to_cpu(x) ((__u16)(__le16)(x))
|
||||
#define __constant_cpu_to_be64(x) ((__be64)___constant_swab64((x)))
|
||||
#define __constant_be64_to_cpu(x) ___constant_swab64((__u64)(__be64)(x))
|
||||
#define __constant_cpu_to_be32(x) ((__be32)___constant_swab32((x)))
|
||||
#define __constant_be32_to_cpu(x) ___constant_swab32((__u32)(__be32)(x))
|
||||
#define __constant_cpu_to_be16(x) ((__be16)___constant_swab16((x)))
|
||||
#define __constant_be16_to_cpu(x) ___constant_swab16((__u16)(__be16)(x))
|
||||
#define __cpu_to_le64(x) ((__le64)(__u64)(x))
|
||||
#define __le64_to_cpu(x) ((__u64)(__le64)(x))
|
||||
#define __cpu_to_le32(x) ((__le32)(__u32)(x))
|
||||
#define __le32_to_cpu(x) ((__u32)(__le32)(x))
|
||||
#define __cpu_to_le16(x) ((__le16)(__u16)(x))
|
||||
#define __le16_to_cpu(x) ((__u16)(__le16)(x))
|
||||
#define __cpu_to_be64(x) ((__be64)__swab64((x)))
|
||||
#define __be64_to_cpu(x) __swab64((__u64)(__be64)(x))
|
||||
#define __cpu_to_be32(x) ((__be32)__swab32((x)))
|
||||
#define __be32_to_cpu(x) __swab32((__u32)(__be32)(x))
|
||||
#define __cpu_to_be16(x) ((__be16)__swab16((x)))
|
||||
#define __be16_to_cpu(x) __swab16((__u16)(__be16)(x))
|
||||
|
||||
static __always_inline __le64 __cpu_to_le64p(const __u64 *p)
|
||||
{
|
||||
return (__le64)*p;
|
||||
}
|
||||
static __always_inline __u64 __le64_to_cpup(const __le64 *p)
|
||||
{
|
||||
return (__u64)*p;
|
||||
}
|
||||
static __always_inline __le32 __cpu_to_le32p(const __u32 *p)
|
||||
{
|
||||
return (__le32)*p;
|
||||
}
|
||||
static __always_inline __u32 __le32_to_cpup(const __le32 *p)
|
||||
{
|
||||
return (__u32)*p;
|
||||
}
|
||||
static __always_inline __le16 __cpu_to_le16p(const __u16 *p)
|
||||
{
|
||||
return (__le16)*p;
|
||||
}
|
||||
static __always_inline __u16 __le16_to_cpup(const __le16 *p)
|
||||
{
|
||||
return (__u16)*p;
|
||||
}
|
||||
static __always_inline __be64 __cpu_to_be64p(const __u64 *p)
|
||||
{
|
||||
return (__be64)__swab64p(p);
|
||||
}
|
||||
static __always_inline __u64 __be64_to_cpup(const __be64 *p)
|
||||
{
|
||||
return __swab64p((__u64 *)p);
|
||||
}
|
||||
static __always_inline __be32 __cpu_to_be32p(const __u32 *p)
|
||||
{
|
||||
return (__be32)__swab32p(p);
|
||||
}
|
||||
static __always_inline __u32 __be32_to_cpup(const __be32 *p)
|
||||
{
|
||||
return __swab32p((__u32 *)p);
|
||||
}
|
||||
static __always_inline __be16 __cpu_to_be16p(const __u16 *p)
|
||||
{
|
||||
return (__be16)__swab16p(p);
|
||||
}
|
||||
static __always_inline __u16 __be16_to_cpup(const __be16 *p)
|
||||
{
|
||||
return __swab16p((__u16 *)p);
|
||||
}
|
||||
#define __cpu_to_le64s(x) do { (void)(x); } while (0)
|
||||
#define __le64_to_cpus(x) do { (void)(x); } while (0)
|
||||
#define __cpu_to_le32s(x) do { (void)(x); } while (0)
|
||||
#define __le32_to_cpus(x) do { (void)(x); } while (0)
|
||||
#define __cpu_to_le16s(x) do { (void)(x); } while (0)
|
||||
#define __le16_to_cpus(x) do { (void)(x); } while (0)
|
||||
#define __cpu_to_be64s(x) __swab64s((x))
|
||||
#define __be64_to_cpus(x) __swab64s((x))
|
||||
#define __cpu_to_be32s(x) __swab32s((x))
|
||||
#define __be32_to_cpus(x) __swab32s((x))
|
||||
#define __cpu_to_be16s(x) __swab16s((x))
|
||||
#define __be16_to_cpus(x) __swab16s((x))
|
||||
|
||||
|
||||
#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
|
380
contrib/libc-headers/linux/capability.h
Normal file
380
contrib/libc-headers/linux/capability.h
Normal file
@ -0,0 +1,380 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/*
|
||||
* This is <linux/capability.h>
|
||||
*
|
||||
* Andrew G. Morgan <morgan@kernel.org>
|
||||
* Alexander Kjeldaas <astor@guardian.no>
|
||||
* with help from Aleph1, Roland Buresund and Andrew Main.
|
||||
*
|
||||
* See here for the libcap library ("POSIX draft" compliance):
|
||||
*
|
||||
* ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_CAPABILITY_H
|
||||
#define _LINUX_CAPABILITY_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* User-level do most of the mapping between kernel and user
|
||||
capabilities based on the version tag given by the kernel. The
|
||||
kernel might be somewhat backwards compatible, but don't bet on
|
||||
it. */
|
||||
|
||||
/* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to
|
||||
a set of three capability sets. The transposition of 3*the
|
||||
following structure to such a composite is better handled in a user
|
||||
library since the draft standard requires the use of malloc/free
|
||||
etc.. */
|
||||
|
||||
#define _LINUX_CAPABILITY_VERSION_1 0x19980330
|
||||
#define _LINUX_CAPABILITY_U32S_1 1
|
||||
|
||||
#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
|
||||
#define _LINUX_CAPABILITY_U32S_2 2
|
||||
|
||||
#define _LINUX_CAPABILITY_VERSION_3 0x20080522
|
||||
#define _LINUX_CAPABILITY_U32S_3 2
|
||||
|
||||
typedef struct __user_cap_header_struct {
|
||||
__u32 version;
|
||||
int pid;
|
||||
} *cap_user_header_t;
|
||||
|
||||
typedef struct __user_cap_data_struct {
|
||||
__u32 effective;
|
||||
__u32 permitted;
|
||||
__u32 inheritable;
|
||||
} *cap_user_data_t;
|
||||
|
||||
|
||||
#define VFS_CAP_REVISION_MASK 0xFF000000
|
||||
#define VFS_CAP_REVISION_SHIFT 24
|
||||
#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
|
||||
#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
|
||||
|
||||
#define VFS_CAP_REVISION_1 0x01000000
|
||||
#define VFS_CAP_U32_1 1
|
||||
#define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
|
||||
|
||||
#define VFS_CAP_REVISION_2 0x02000000
|
||||
#define VFS_CAP_U32_2 2
|
||||
#define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
|
||||
|
||||
#define VFS_CAP_REVISION_3 0x03000000
|
||||
#define VFS_CAP_U32_3 2
|
||||
#define XATTR_CAPS_SZ_3 (sizeof(__le32)*(2 + 2*VFS_CAP_U32_3))
|
||||
|
||||
#define XATTR_CAPS_SZ XATTR_CAPS_SZ_3
|
||||
#define VFS_CAP_U32 VFS_CAP_U32_3
|
||||
#define VFS_CAP_REVISION VFS_CAP_REVISION_3
|
||||
|
||||
struct vfs_cap_data {
|
||||
__le32 magic_etc; /* Little endian */
|
||||
struct {
|
||||
__le32 permitted; /* Little endian */
|
||||
__le32 inheritable; /* Little endian */
|
||||
} data[VFS_CAP_U32];
|
||||
};
|
||||
|
||||
/*
|
||||
* same as vfs_cap_data but with a rootid at the end
|
||||
*/
|
||||
struct vfs_ns_cap_data {
|
||||
__le32 magic_etc;
|
||||
struct {
|
||||
__le32 permitted; /* Little endian */
|
||||
__le32 inheritable; /* Little endian */
|
||||
} data[VFS_CAP_U32];
|
||||
__le32 rootid;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Backwardly compatible definition for source code - trapped in a
|
||||
* 32-bit world. If you find you need this, please consider using
|
||||
* libcap to untrap yourself...
|
||||
*/
|
||||
#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
|
||||
#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
|
||||
|
||||
|
||||
|
||||
/**
|
||||
** POSIX-draft defined capabilities.
|
||||
**/
|
||||
|
||||
/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
|
||||
overrides the restriction of changing file ownership and group
|
||||
ownership. */
|
||||
|
||||
#define CAP_CHOWN 0
|
||||
|
||||
/* Override all DAC access, including ACL execute access if
|
||||
[_POSIX_ACL] is defined. Excluding DAC access covered by
|
||||
CAP_LINUX_IMMUTABLE. */
|
||||
|
||||
#define CAP_DAC_OVERRIDE 1
|
||||
|
||||
/* Overrides all DAC restrictions regarding read and search on files
|
||||
and directories, including ACL restrictions if [_POSIX_ACL] is
|
||||
defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
|
||||
|
||||
#define CAP_DAC_READ_SEARCH 2
|
||||
|
||||
/* Overrides all restrictions about allowed operations on files, where
|
||||
file owner ID must be equal to the user ID, except where CAP_FSETID
|
||||
is applicable. It doesn't override MAC and DAC restrictions. */
|
||||
|
||||
#define CAP_FOWNER 3
|
||||
|
||||
/* Overrides the following restrictions that the effective user ID
|
||||
shall match the file owner ID when setting the S_ISUID and S_ISGID
|
||||
bits on that file; that the effective group ID (or one of the
|
||||
supplementary group IDs) shall match the file owner ID when setting
|
||||
the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
|
||||
cleared on successful return from chown(2) (not implemented). */
|
||||
|
||||
#define CAP_FSETID 4
|
||||
|
||||
/* Overrides the restriction that the real or effective user ID of a
|
||||
process sending a signal must match the real or effective user ID
|
||||
of the process receiving the signal. */
|
||||
|
||||
#define CAP_KILL 5
|
||||
|
||||
/* Allows setgid(2) manipulation */
|
||||
/* Allows setgroups(2) */
|
||||
/* Allows forged gids on socket credentials passing. */
|
||||
|
||||
#define CAP_SETGID 6
|
||||
|
||||
/* Allows set*uid(2) manipulation (including fsuid). */
|
||||
/* Allows forged pids on socket credentials passing. */
|
||||
|
||||
#define CAP_SETUID 7
|
||||
|
||||
|
||||
/**
|
||||
** Linux-specific capabilities
|
||||
**/
|
||||
|
||||
/* Without VFS support for capabilities:
|
||||
* Transfer any capability in your permitted set to any pid,
|
||||
* remove any capability in your permitted set from any pid
|
||||
* With VFS support for capabilities (neither of above, but)
|
||||
* Add any capability from current's capability bounding set
|
||||
* to the current process' inheritable set
|
||||
* Allow taking bits out of capability bounding set
|
||||
* Allow modification of the securebits for a process
|
||||
*/
|
||||
|
||||
#define CAP_SETPCAP 8
|
||||
|
||||
/* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
|
||||
|
||||
#define CAP_LINUX_IMMUTABLE 9
|
||||
|
||||
/* Allows binding to TCP/UDP sockets below 1024 */
|
||||
/* Allows binding to ATM VCIs below 32 */
|
||||
|
||||
#define CAP_NET_BIND_SERVICE 10
|
||||
|
||||
/* Allow broadcasting, listen to multicast */
|
||||
|
||||
#define CAP_NET_BROADCAST 11
|
||||
|
||||
/* Allow interface configuration */
|
||||
/* Allow administration of IP firewall, masquerading and accounting */
|
||||
/* Allow setting debug option on sockets */
|
||||
/* Allow modification of routing tables */
|
||||
/* Allow setting arbitrary process / process group ownership on
|
||||
sockets */
|
||||
/* Allow binding to any address for transparent proxying (also via NET_RAW) */
|
||||
/* Allow setting TOS (type of service) */
|
||||
/* Allow setting promiscuous mode */
|
||||
/* Allow clearing driver statistics */
|
||||
/* Allow multicasting */
|
||||
/* Allow read/write of device-specific registers */
|
||||
/* Allow activation of ATM control sockets */
|
||||
|
||||
#define CAP_NET_ADMIN 12
|
||||
|
||||
/* Allow use of RAW sockets */
|
||||
/* Allow use of PACKET sockets */
|
||||
/* Allow binding to any address for transparent proxying (also via NET_ADMIN) */
|
||||
|
||||
#define CAP_NET_RAW 13
|
||||
|
||||
/* Allow locking of shared memory segments */
|
||||
/* Allow mlock and mlockall (which doesn't really have anything to do
|
||||
with IPC) */
|
||||
|
||||
#define CAP_IPC_LOCK 14
|
||||
|
||||
/* Override IPC ownership checks */
|
||||
|
||||
#define CAP_IPC_OWNER 15
|
||||
|
||||
/* Insert and remove kernel modules - modify kernel without limit */
|
||||
#define CAP_SYS_MODULE 16
|
||||
|
||||
/* Allow ioperm/iopl access */
|
||||
/* Allow sending USB messages to any device via /dev/bus/usb */
|
||||
|
||||
#define CAP_SYS_RAWIO 17
|
||||
|
||||
/* Allow use of chroot() */
|
||||
|
||||
#define CAP_SYS_CHROOT 18
|
||||
|
||||
/* Allow ptrace() of any process */
|
||||
|
||||
#define CAP_SYS_PTRACE 19
|
||||
|
||||
/* Allow configuration of process accounting */
|
||||
|
||||
#define CAP_SYS_PACCT 20
|
||||
|
||||
/* Allow configuration of the secure attention key */
|
||||
/* Allow administration of the random device */
|
||||
/* Allow examination and configuration of disk quotas */
|
||||
/* Allow setting the domainname */
|
||||
/* Allow setting the hostname */
|
||||
/* Allow calling bdflush() */
|
||||
/* Allow mount() and umount(), setting up new smb connection */
|
||||
/* Allow some autofs root ioctls */
|
||||
/* Allow nfsservctl */
|
||||
/* Allow VM86_REQUEST_IRQ */
|
||||
/* Allow to read/write pci config on alpha */
|
||||
/* Allow irix_prctl on mips (setstacksize) */
|
||||
/* Allow flushing all cache on m68k (sys_cacheflush) */
|
||||
/* Allow removing semaphores */
|
||||
/* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores
|
||||
and shared memory */
|
||||
/* Allow locking/unlocking of shared memory segment */
|
||||
/* Allow turning swap on/off */
|
||||
/* Allow forged pids on socket credentials passing */
|
||||
/* Allow setting readahead and flushing buffers on block devices */
|
||||
/* Allow setting geometry in floppy driver */
|
||||
/* Allow turning DMA on/off in xd driver */
|
||||
/* Allow administration of md devices (mostly the above, but some
|
||||
extra ioctls) */
|
||||
/* Allow tuning the ide driver */
|
||||
/* Allow access to the nvram device */
|
||||
/* Allow administration of apm_bios, serial and bttv (TV) device */
|
||||
/* Allow manufacturer commands in isdn CAPI support driver */
|
||||
/* Allow reading non-standardized portions of pci configuration space */
|
||||
/* Allow DDI debug ioctl on sbpcd driver */
|
||||
/* Allow setting up serial ports */
|
||||
/* Allow sending raw qic-117 commands */
|
||||
/* Allow enabling/disabling tagged queuing on SCSI controllers and sending
|
||||
arbitrary SCSI commands */
|
||||
/* Allow setting encryption key on loopback filesystem */
|
||||
/* Allow setting zone reclaim policy */
|
||||
|
||||
#define CAP_SYS_ADMIN 21
|
||||
|
||||
/* Allow use of reboot() */
|
||||
|
||||
#define CAP_SYS_BOOT 22
|
||||
|
||||
/* Allow raising priority and setting priority on other (different
|
||||
UID) processes */
|
||||
/* Allow use of FIFO and round-robin (realtime) scheduling on own
|
||||
processes and setting the scheduling algorithm used by another
|
||||
process. */
|
||||
/* Allow setting cpu affinity on other processes */
|
||||
|
||||
#define CAP_SYS_NICE 23
|
||||
|
||||
/* Override resource limits. Set resource limits. */
|
||||
/* Override quota limits. */
|
||||
/* Override reserved space on ext2 filesystem */
|
||||
/* Modify data journaling mode on ext3 filesystem (uses journaling
|
||||
resources) */
|
||||
/* NOTE: ext2 honors fsuid when checking for resource overrides, so
|
||||
you can override using fsuid too */
|
||||
/* Override size restrictions on IPC message queues */
|
||||
/* Allow more than 64hz interrupts from the real-time clock */
|
||||
/* Override max number of consoles on console allocation */
|
||||
/* Override max number of keymaps */
|
||||
|
||||
#define CAP_SYS_RESOURCE 24
|
||||
|
||||
/* Allow manipulation of system clock */
|
||||
/* Allow irix_stime on mips */
|
||||
/* Allow setting the real-time clock */
|
||||
|
||||
#define CAP_SYS_TIME 25
|
||||
|
||||
/* Allow configuration of tty devices */
|
||||
/* Allow vhangup() of tty */
|
||||
|
||||
#define CAP_SYS_TTY_CONFIG 26
|
||||
|
||||
/* Allow the privileged aspects of mknod() */
|
||||
|
||||
#define CAP_MKNOD 27
|
||||
|
||||
/* Allow taking of leases on files */
|
||||
|
||||
#define CAP_LEASE 28
|
||||
|
||||
/* Allow writing the audit log via unicast netlink socket */
|
||||
|
||||
#define CAP_AUDIT_WRITE 29
|
||||
|
||||
/* Allow configuration of audit via unicast netlink socket */
|
||||
|
||||
#define CAP_AUDIT_CONTROL 30
|
||||
|
||||
#define CAP_SETFCAP 31
|
||||
|
||||
/* Override MAC access.
|
||||
The base kernel enforces no MAC policy.
|
||||
An LSM may enforce a MAC policy, and if it does and it chooses
|
||||
to implement capability based overrides of that policy, this is
|
||||
the capability it should use to do so. */
|
||||
|
||||
#define CAP_MAC_OVERRIDE 32
|
||||
|
||||
/* Allow MAC configuration or state changes.
|
||||
The base kernel requires no MAC configuration.
|
||||
An LSM may enforce a MAC policy, and if it does and it chooses
|
||||
to implement capability based checks on modifications to that
|
||||
policy or the data required to maintain it, this is the
|
||||
capability it should use to do so. */
|
||||
|
||||
#define CAP_MAC_ADMIN 33
|
||||
|
||||
/* Allow configuring the kernel's syslog (printk behaviour) */
|
||||
|
||||
#define CAP_SYSLOG 34
|
||||
|
||||
/* Allow triggering something that will wake the system */
|
||||
|
||||
#define CAP_WAKE_ALARM 35
|
||||
|
||||
/* Allow preventing system suspends */
|
||||
|
||||
#define CAP_BLOCK_SUSPEND 36
|
||||
|
||||
/* Allow reading the audit log via multicast netlink socket */
|
||||
|
||||
#define CAP_AUDIT_READ 37
|
||||
|
||||
|
||||
#define CAP_LAST_CAP CAP_AUDIT_READ
|
||||
|
||||
#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
|
||||
|
||||
/*
|
||||
* Bit location of each capability (used by user-space library and kernel)
|
||||
*/
|
||||
|
||||
#define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */
|
||||
#define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */
|
||||
|
||||
|
||||
#endif /* _LINUX_CAPABILITY_H */
|
1
contrib/libc-headers/linux/errno.h
Normal file
1
contrib/libc-headers/linux/errno.h
Normal file
@ -0,0 +1 @@
|
||||
#include <asm/errno.h>
|
80
contrib/libc-headers/linux/falloc.h
Normal file
80
contrib/libc-headers/linux/falloc.h
Normal file
@ -0,0 +1,80 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _FALLOC_H_
|
||||
#define _FALLOC_H_
|
||||
|
||||
#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
|
||||
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
|
||||
#define FALLOC_FL_NO_HIDE_STALE 0x04 /* reserved codepoint */
|
||||
|
||||
/*
|
||||
* FALLOC_FL_COLLAPSE_RANGE is used to remove a range of a file
|
||||
* without leaving a hole in the file. The contents of the file beyond
|
||||
* the range being removed is appended to the start offset of the range
|
||||
* being removed (i.e. the hole that was punched is "collapsed"),
|
||||
* resulting in a file layout that looks like the range that was
|
||||
* removed never existed. As such collapsing a range of a file changes
|
||||
* the size of the file, reducing it by the same length of the range
|
||||
* that has been removed by the operation.
|
||||
*
|
||||
* Different filesystems may implement different limitations on the
|
||||
* granularity of the operation. Most will limit operations to
|
||||
* filesystem block size boundaries, but this boundary may be larger or
|
||||
* smaller depending on the filesystem and/or the configuration of the
|
||||
* filesystem or file.
|
||||
*
|
||||
* Attempting to collapse a range that crosses the end of the file is
|
||||
* considered an illegal operation - just use ftruncate(2) if you need
|
||||
* to collapse a range that crosses EOF.
|
||||
*/
|
||||
#define FALLOC_FL_COLLAPSE_RANGE 0x08
|
||||
|
||||
/*
|
||||
* FALLOC_FL_ZERO_RANGE is used to convert a range of file to zeros preferably
|
||||
* without issuing data IO. Blocks should be preallocated for the regions that
|
||||
* span holes in the file, and the entire range is preferable converted to
|
||||
* unwritten extents - even though file system may choose to zero out the
|
||||
* extent or do whatever which will result in reading zeros from the range
|
||||
* while the range remains allocated for the file.
|
||||
*
|
||||
* This can be also used to preallocate blocks past EOF in the same way as
|
||||
* with fallocate. Flag FALLOC_FL_KEEP_SIZE should cause the inode
|
||||
* size to remain the same.
|
||||
*/
|
||||
#define FALLOC_FL_ZERO_RANGE 0x10
|
||||
|
||||
/*
|
||||
* FALLOC_FL_INSERT_RANGE is use to insert space within the file size without
|
||||
* overwriting any existing data. The contents of the file beyond offset are
|
||||
* shifted towards right by len bytes to create a hole. As such, this
|
||||
* operation will increase the size of the file by len bytes.
|
||||
*
|
||||
* Different filesystems may implement different limitations on the granularity
|
||||
* of the operation. Most will limit operations to filesystem block size
|
||||
* boundaries, but this boundary may be larger or smaller depending on
|
||||
* the filesystem and/or the configuration of the filesystem or file.
|
||||
*
|
||||
* Attempting to insert space using this flag at OR beyond the end of
|
||||
* the file is considered an illegal operation - just use ftruncate(2) or
|
||||
* fallocate(2) with mode 0 for such type of operations.
|
||||
*/
|
||||
#define FALLOC_FL_INSERT_RANGE 0x20
|
||||
|
||||
/*
|
||||
* FALLOC_FL_UNSHARE_RANGE is used to unshare shared blocks within the
|
||||
* file size without overwriting any existing data. The purpose of this
|
||||
* call is to preemptively reallocate any blocks that are subject to
|
||||
* copy-on-write.
|
||||
*
|
||||
* Different filesystems may implement different limitations on the
|
||||
* granularity of the operation. Most will limit operations to filesystem
|
||||
* block size boundaries, but this boundary may be larger or smaller
|
||||
* depending on the filesystem and/or the configuration of the filesystem
|
||||
* or file.
|
||||
*
|
||||
* This flag can only be used with allocate-mode fallocate, which is
|
||||
* to say that it cannot be used with the punch, zero, collapse, or
|
||||
* insert range modes.
|
||||
*/
|
||||
#define FALLOC_FL_UNSHARE_RANGE 0x40
|
||||
|
||||
#endif /* _FALLOC_H_ */
|
383
contrib/libc-headers/linux/fs.h
Normal file
383
contrib/libc-headers/linux/fs.h
Normal file
@ -0,0 +1,383 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_FS_H
|
||||
#define _LINUX_FS_H
|
||||
|
||||
/*
|
||||
* This file has definitions for some important file table structures
|
||||
* and constants and structures used by various generic file system
|
||||
* ioctl's. Please do not make any changes in this file before
|
||||
* sending patches for review to linux-fsdevel@vger.kernel.org and
|
||||
* linux-api@vger.kernel.org.
|
||||
*/
|
||||
|
||||
#include <linux/limits.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* It's silly to have NR_OPEN bigger than NR_FILE, but you can change
|
||||
* the file limit at runtime and only root can increase the per-process
|
||||
* nr_file rlimit, so it's safe to set up a ridiculously high absolute
|
||||
* upper limit on files-per-process.
|
||||
*
|
||||
* Some programs (notably those using select()) may have to be
|
||||
* recompiled to take full advantage of the new limits..
|
||||
*/
|
||||
|
||||
/* Fixed constants first: */
|
||||
#undef NR_OPEN
|
||||
#define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */
|
||||
#define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */
|
||||
|
||||
#define BLOCK_SIZE_BITS 10
|
||||
#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
|
||||
|
||||
#define SEEK_SET 0 /* seek relative to beginning of file */
|
||||
#define SEEK_CUR 1 /* seek relative to current file position */
|
||||
#define SEEK_END 2 /* seek relative to end of file */
|
||||
#define SEEK_DATA 3 /* seek to the next data */
|
||||
#define SEEK_HOLE 4 /* seek to the next hole */
|
||||
#define SEEK_MAX SEEK_HOLE
|
||||
|
||||
#define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */
|
||||
#define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */
|
||||
#define RENAME_WHITEOUT (1 << 2) /* Whiteout source */
|
||||
|
||||
struct file_clone_range {
|
||||
__s64 src_fd;
|
||||
__u64 src_offset;
|
||||
__u64 src_length;
|
||||
__u64 dest_offset;
|
||||
};
|
||||
|
||||
struct fstrim_range {
|
||||
__u64 start;
|
||||
__u64 len;
|
||||
__u64 minlen;
|
||||
};
|
||||
|
||||
/* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */
|
||||
#define FILE_DEDUPE_RANGE_SAME 0
|
||||
#define FILE_DEDUPE_RANGE_DIFFERS 1
|
||||
|
||||
/* from struct btrfs_ioctl_file_extent_same_info */
|
||||
struct file_dedupe_range_info {
|
||||
__s64 dest_fd; /* in - destination file */
|
||||
__u64 dest_offset; /* in - start of extent in destination */
|
||||
__u64 bytes_deduped; /* out - total # of bytes we were able
|
||||
* to dedupe from this file. */
|
||||
/* status of this dedupe operation:
|
||||
* < 0 for error
|
||||
* == FILE_DEDUPE_RANGE_SAME if dedupe succeeds
|
||||
* == FILE_DEDUPE_RANGE_DIFFERS if data differs
|
||||
*/
|
||||
__s32 status; /* out - see above description */
|
||||
__u32 reserved; /* must be zero */
|
||||
};
|
||||
|
||||
/* from struct btrfs_ioctl_file_extent_same_args */
|
||||
struct file_dedupe_range {
|
||||
__u64 src_offset; /* in - start of extent in source */
|
||||
__u64 src_length; /* in - length of extent */
|
||||
__u16 dest_count; /* in - total elements in info array */
|
||||
__u16 reserved1; /* must be zero */
|
||||
__u32 reserved2; /* must be zero */
|
||||
struct file_dedupe_range_info info[0];
|
||||
};
|
||||
|
||||
/* And dynamically-tunable limits and defaults: */
|
||||
struct files_stat_struct {
|
||||
unsigned long nr_files; /* read only */
|
||||
unsigned long nr_free_files; /* read only */
|
||||
unsigned long max_files; /* tunable */
|
||||
};
|
||||
|
||||
struct inodes_stat_t {
|
||||
long nr_inodes;
|
||||
long nr_unused;
|
||||
long dummy[5]; /* padding for sysctl ABI compatibility */
|
||||
};
|
||||
|
||||
|
||||
#define NR_FILE 8192 /* this can well be larger on a larger system */
|
||||
|
||||
|
||||
/*
|
||||
* These are the fs-independent mount-flags: up to 32 flags are supported
|
||||
*/
|
||||
#define MS_RDONLY 1 /* Mount read-only */
|
||||
#define MS_NOSUID 2 /* Ignore suid and sgid bits */
|
||||
#define MS_NODEV 4 /* Disallow access to device special files */
|
||||
#define MS_NOEXEC 8 /* Disallow program execution */
|
||||
#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
|
||||
#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
|
||||
#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
|
||||
#define MS_DIRSYNC 128 /* Directory modifications are synchronous */
|
||||
#define MS_NOATIME 1024 /* Do not update access times. */
|
||||
#define MS_NODIRATIME 2048 /* Do not update directory access times */
|
||||
#define MS_BIND 4096
|
||||
#define MS_MOVE 8192
|
||||
#define MS_REC 16384
|
||||
#define MS_VERBOSE 32768 /* War is peace. Verbosity is silence.
|
||||
MS_VERBOSE is deprecated. */
|
||||
#define MS_SILENT 32768
|
||||
#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
|
||||
#define MS_UNBINDABLE (1<<17) /* change to unbindable */
|
||||
#define MS_PRIVATE (1<<18) /* change to private */
|
||||
#define MS_SLAVE (1<<19) /* change to slave */
|
||||
#define MS_SHARED (1<<20) /* change to shared */
|
||||
#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
|
||||
#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
|
||||
#define MS_I_VERSION (1<<23) /* Update inode I_version field */
|
||||
#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
|
||||
#define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */
|
||||
|
||||
/* These sb flags are internal to the kernel */
|
||||
#define MS_SUBMOUNT (1<<26)
|
||||
#define MS_NOREMOTELOCK (1<<27)
|
||||
#define MS_NOSEC (1<<28)
|
||||
#define MS_BORN (1<<29)
|
||||
#define MS_ACTIVE (1<<30)
|
||||
#define MS_NOUSER (1<<31)
|
||||
|
||||
/*
|
||||
* Superblock flags that can be altered by MS_REMOUNT
|
||||
*/
|
||||
#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\
|
||||
MS_LAZYTIME)
|
||||
|
||||
/*
|
||||
* Old magic mount flag and mask
|
||||
*/
|
||||
#define MS_MGC_VAL 0xC0ED0000
|
||||
#define MS_MGC_MSK 0xffff0000
|
||||
|
||||
/*
|
||||
* Structure for FS_IOC_FSGETXATTR[A] and FS_IOC_FSSETXATTR.
|
||||
*/
|
||||
struct fsxattr {
|
||||
__u32 fsx_xflags; /* xflags field value (get/set) */
|
||||
__u32 fsx_extsize; /* extsize field value (get/set)*/
|
||||
__u32 fsx_nextents; /* nextents field value (get) */
|
||||
__u32 fsx_projid; /* project identifier (get/set) */
|
||||
__u32 fsx_cowextsize; /* CoW extsize field value (get/set)*/
|
||||
unsigned char fsx_pad[8];
|
||||
};
|
||||
|
||||
/*
|
||||
* Flags for the fsx_xflags field
|
||||
*/
|
||||
#define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */
|
||||
#define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */
|
||||
#define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */
|
||||
#define FS_XFLAG_APPEND 0x00000010 /* all writes append */
|
||||
#define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */
|
||||
#define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */
|
||||
#define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */
|
||||
#define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */
|
||||
#define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */
|
||||
#define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */
|
||||
#define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */
|
||||
#define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
|
||||
#define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
|
||||
#define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
|
||||
#define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */
|
||||
#define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */
|
||||
#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
|
||||
|
||||
/* the read-only stuff doesn't really belong here, but any other place is
|
||||
probably as bad and I don't want to create yet another include file. */
|
||||
|
||||
#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */
|
||||
#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
|
||||
#define BLKRRPART _IO(0x12,95) /* re-read partition table */
|
||||
#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
|
||||
#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */
|
||||
#define BLKRASET _IO(0x12,98) /* set read ahead for block device */
|
||||
#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */
|
||||
#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
|
||||
#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
|
||||
#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
|
||||
#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
|
||||
#define BLKSSZGET _IO(0x12,104)/* get block device sector size */
|
||||
#if 0
|
||||
#define BLKPG _IO(0x12,105)/* See blkpg.h */
|
||||
|
||||
/* Some people are morons. Do not use sizeof! */
|
||||
|
||||
#define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */
|
||||
#define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */
|
||||
/* This was here just to show that the number is taken -
|
||||
probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */
|
||||
#endif
|
||||
/* A jump here: 108-111 have been used for various private purposes. */
|
||||
#define BLKBSZGET _IOR(0x12,112,size_t)
|
||||
#define BLKBSZSET _IOW(0x12,113,size_t)
|
||||
#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
|
||||
#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
|
||||
#define BLKTRACESTART _IO(0x12,116)
|
||||
#define BLKTRACESTOP _IO(0x12,117)
|
||||
#define BLKTRACETEARDOWN _IO(0x12,118)
|
||||
#define BLKDISCARD _IO(0x12,119)
|
||||
#define BLKIOMIN _IO(0x12,120)
|
||||
#define BLKIOOPT _IO(0x12,121)
|
||||
#define BLKALIGNOFF _IO(0x12,122)
|
||||
#define BLKPBSZGET _IO(0x12,123)
|
||||
#define BLKDISCARDZEROES _IO(0x12,124)
|
||||
#define BLKSECDISCARD _IO(0x12,125)
|
||||
#define BLKROTATIONAL _IO(0x12,126)
|
||||
#define BLKZEROOUT _IO(0x12,127)
|
||||
/*
|
||||
* A jump here: 130-131 are reserved for zoned block devices
|
||||
* (see uapi/linux/blkzoned.h)
|
||||
*/
|
||||
|
||||
#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
|
||||
#define FIBMAP _IO(0x00,1) /* bmap access */
|
||||
#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
|
||||
#define FIFREEZE _IOWR('X', 119, int) /* Freeze */
|
||||
#define FITHAW _IOWR('X', 120, int) /* Thaw */
|
||||
#define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */
|
||||
#define FICLONE _IOW(0x94, 9, int)
|
||||
#define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
|
||||
#define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range)
|
||||
|
||||
#define FS_IOC_GETFLAGS _IOR('f', 1, long)
|
||||
#define FS_IOC_SETFLAGS _IOW('f', 2, long)
|
||||
#define FS_IOC_GETVERSION _IOR('v', 1, long)
|
||||
#define FS_IOC_SETVERSION _IOW('v', 2, long)
|
||||
#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
|
||||
#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
|
||||
#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
|
||||
#define FS_IOC32_GETVERSION _IOR('v', 1, int)
|
||||
#define FS_IOC32_SETVERSION _IOW('v', 2, int)
|
||||
#define FS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
|
||||
#define FS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr)
|
||||
|
||||
/*
|
||||
* File system encryption support
|
||||
*/
|
||||
/* Policy provided via an ioctl on the topmost directory */
|
||||
#define FS_KEY_DESCRIPTOR_SIZE 8
|
||||
|
||||
#define FS_POLICY_FLAGS_PAD_4 0x00
|
||||
#define FS_POLICY_FLAGS_PAD_8 0x01
|
||||
#define FS_POLICY_FLAGS_PAD_16 0x02
|
||||
#define FS_POLICY_FLAGS_PAD_32 0x03
|
||||
#define FS_POLICY_FLAGS_PAD_MASK 0x03
|
||||
#define FS_POLICY_FLAGS_VALID 0x03
|
||||
|
||||
/* Encryption algorithms */
|
||||
#define FS_ENCRYPTION_MODE_INVALID 0
|
||||
#define FS_ENCRYPTION_MODE_AES_256_XTS 1
|
||||
#define FS_ENCRYPTION_MODE_AES_256_GCM 2
|
||||
#define FS_ENCRYPTION_MODE_AES_256_CBC 3
|
||||
#define FS_ENCRYPTION_MODE_AES_256_CTS 4
|
||||
#define FS_ENCRYPTION_MODE_AES_128_CBC 5
|
||||
#define FS_ENCRYPTION_MODE_AES_128_CTS 6
|
||||
|
||||
struct fscrypt_policy {
|
||||
__u8 version;
|
||||
__u8 contents_encryption_mode;
|
||||
__u8 filenames_encryption_mode;
|
||||
__u8 flags;
|
||||
__u8 master_key_descriptor[FS_KEY_DESCRIPTOR_SIZE];
|
||||
};
|
||||
|
||||
#define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy)
|
||||
#define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16])
|
||||
#define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy)
|
||||
|
||||
/* Parameters for passing an encryption key into the kernel keyring */
|
||||
#define FS_KEY_DESC_PREFIX "fscrypt:"
|
||||
#define FS_KEY_DESC_PREFIX_SIZE 8
|
||||
|
||||
/* Structure that userspace passes to the kernel keyring */
|
||||
#define FS_MAX_KEY_SIZE 64
|
||||
|
||||
struct fscrypt_key {
|
||||
__u32 mode;
|
||||
__u8 raw[FS_MAX_KEY_SIZE];
|
||||
__u32 size;
|
||||
};
|
||||
|
||||
/*
|
||||
* Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
|
||||
*
|
||||
* Note: for historical reasons, these flags were originally used and
|
||||
* defined for use by ext2/ext3, and then other file systems started
|
||||
* using these flags so they wouldn't need to write their own version
|
||||
* of chattr/lsattr (which was shipped as part of e2fsprogs). You
|
||||
* should think twice before trying to use these flags in new
|
||||
* contexts, or trying to assign these flags, since they are used both
|
||||
* as the UAPI and the on-disk encoding for ext2/3/4. Also, we are
|
||||
* almost out of 32-bit flags. :-)
|
||||
*
|
||||
* We have recently hoisted FS_IOC_FSGETXATTR / FS_IOC_FSSETXATTR from
|
||||
* XFS to the generic FS level interface. This uses a structure that
|
||||
* has padding and hence has more room to grow, so it may be more
|
||||
* appropriate for many new use cases.
|
||||
*
|
||||
* Please do not change these flags or interfaces before checking with
|
||||
* linux-fsdevel@vger.kernel.org and linux-api@vger.kernel.org.
|
||||
*/
|
||||
#define FS_SECRM_FL 0x00000001 /* Secure deletion */
|
||||
#define FS_UNRM_FL 0x00000002 /* Undelete */
|
||||
#define FS_COMPR_FL 0x00000004 /* Compress file */
|
||||
#define FS_SYNC_FL 0x00000008 /* Synchronous updates */
|
||||
#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */
|
||||
#define FS_APPEND_FL 0x00000020 /* writes to file may only append */
|
||||
#define FS_NODUMP_FL 0x00000040 /* do not dump file */
|
||||
#define FS_NOATIME_FL 0x00000080 /* do not update atime */
|
||||
/* Reserved for compression usage... */
|
||||
#define FS_DIRTY_FL 0x00000100
|
||||
#define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
|
||||
#define FS_NOCOMP_FL 0x00000400 /* Don't compress */
|
||||
/* End compression flags --- maybe not all used */
|
||||
#define FS_ENCRYPT_FL 0x00000800 /* Encrypted file */
|
||||
#define FS_BTREE_FL 0x00001000 /* btree format dir */
|
||||
#define FS_INDEX_FL 0x00001000 /* hash-indexed directory */
|
||||
#define FS_IMAGIC_FL 0x00002000 /* AFS directory */
|
||||
#define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */
|
||||
#define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
|
||||
#define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
|
||||
#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
|
||||
#define FS_HUGE_FILE_FL 0x00040000 /* Reserved for ext4 */
|
||||
#define FS_EXTENT_FL 0x00080000 /* Extents */
|
||||
#define FS_EA_INODE_FL 0x00200000 /* Inode used for large EA */
|
||||
#define FS_EOFBLOCKS_FL 0x00400000 /* Reserved for ext4 */
|
||||
#define FS_NOCOW_FL 0x00800000 /* Do not cow file */
|
||||
#define FS_INLINE_DATA_FL 0x10000000 /* Reserved for ext4 */
|
||||
#define FS_PROJINHERIT_FL 0x20000000 /* Create with parents projid */
|
||||
#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
|
||||
|
||||
#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
|
||||
#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
|
||||
|
||||
|
||||
#define SYNC_FILE_RANGE_WAIT_BEFORE 1
|
||||
#define SYNC_FILE_RANGE_WRITE 2
|
||||
#define SYNC_FILE_RANGE_WAIT_AFTER 4
|
||||
|
||||
/*
|
||||
* Flags for preadv2/pwritev2:
|
||||
*/
|
||||
|
||||
typedef int __bitwise __kernel_rwf_t;
|
||||
|
||||
/* high priority request, poll if possible */
|
||||
#define RWF_HIPRI ((__kernel_rwf_t)0x00000001)
|
||||
|
||||
/* per-IO O_DSYNC */
|
||||
#define RWF_DSYNC ((__kernel_rwf_t)0x00000002)
|
||||
|
||||
/* per-IO O_SYNC */
|
||||
#define RWF_SYNC ((__kernel_rwf_t)0x00000004)
|
||||
|
||||
/* per-IO, return -EAGAIN if operation would block */
|
||||
#define RWF_NOWAIT ((__kernel_rwf_t)0x00000008)
|
||||
|
||||
/* mask of flags supported by the kernel */
|
||||
#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT)
|
||||
|
||||
#endif /* _LINUX_FS_H */
|
153
contrib/libc-headers/linux/futex.h
Normal file
153
contrib/libc-headers/linux/futex.h
Normal file
@ -0,0 +1,153 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_FUTEX_H
|
||||
#define _LINUX_FUTEX_H
|
||||
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Second argument to futex syscall */
|
||||
|
||||
|
||||
#define FUTEX_WAIT 0
|
||||
#define FUTEX_WAKE 1
|
||||
#define FUTEX_FD 2
|
||||
#define FUTEX_REQUEUE 3
|
||||
#define FUTEX_CMP_REQUEUE 4
|
||||
#define FUTEX_WAKE_OP 5
|
||||
#define FUTEX_LOCK_PI 6
|
||||
#define FUTEX_UNLOCK_PI 7
|
||||
#define FUTEX_TRYLOCK_PI 8
|
||||
#define FUTEX_WAIT_BITSET 9
|
||||
#define FUTEX_WAKE_BITSET 10
|
||||
#define FUTEX_WAIT_REQUEUE_PI 11
|
||||
#define FUTEX_CMP_REQUEUE_PI 12
|
||||
|
||||
#define FUTEX_PRIVATE_FLAG 128
|
||||
#define FUTEX_CLOCK_REALTIME 256
|
||||
#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
|
||||
|
||||
#define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \
|
||||
FUTEX_PRIVATE_FLAG)
|
||||
#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \
|
||||
FUTEX_PRIVATE_FLAG)
|
||||
|
||||
/*
|
||||
* Support for robust futexes: the kernel cleans up held futexes at
|
||||
* thread exit time.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Per-lock list entry - embedded in user-space locks, somewhere close
|
||||
* to the futex field. (Note: user-space uses a double-linked list to
|
||||
* achieve O(1) list add and remove, but the kernel only needs to know
|
||||
* about the forward link)
|
||||
*
|
||||
* NOTE: this structure is part of the syscall ABI, and must not be
|
||||
* changed.
|
||||
*/
|
||||
struct robust_list {
|
||||
struct robust_list *next;
|
||||
};
|
||||
|
||||
/*
|
||||
* Per-thread list head:
|
||||
*
|
||||
* NOTE: this structure is part of the syscall ABI, and must only be
|
||||
* changed if the change is first communicated with the glibc folks.
|
||||
* (When an incompatible change is done, we'll increase the structure
|
||||
* size, which glibc will detect)
|
||||
*/
|
||||
struct robust_list_head {
|
||||
/*
|
||||
* The head of the list. Points back to itself if empty:
|
||||
*/
|
||||
struct robust_list list;
|
||||
|
||||
/*
|
||||
* This relative offset is set by user-space, it gives the kernel
|
||||
* the relative position of the futex field to examine. This way
|
||||
* we keep userspace flexible, to freely shape its data-structure,
|
||||
* without hardcoding any particular offset into the kernel:
|
||||
*/
|
||||
long futex_offset;
|
||||
|
||||
/*
|
||||
* The death of the thread may race with userspace setting
|
||||
* up a lock's links. So to handle this race, userspace first
|
||||
* sets this field to the address of the to-be-taken lock,
|
||||
* then does the lock acquire, and then adds itself to the
|
||||
* list, and then clears this field. Hence the kernel will
|
||||
* always have full knowledge of all locks that the thread
|
||||
* _might_ have taken. We check the owner TID in any case,
|
||||
* so only truly owned locks will be handled.
|
||||
*/
|
||||
struct robust_list *list_op_pending;
|
||||
};
|
||||
|
||||
/*
|
||||
* Are there any waiters for this robust futex:
|
||||
*/
|
||||
#define FUTEX_WAITERS 0x80000000
|
||||
|
||||
/*
|
||||
* The kernel signals via this bit that a thread holding a futex
|
||||
* has exited without unlocking the futex. The kernel also does
|
||||
* a FUTEX_WAKE on such futexes, after setting the bit, to wake
|
||||
* up any possible waiters:
|
||||
*/
|
||||
#define FUTEX_OWNER_DIED 0x40000000
|
||||
|
||||
/*
|
||||
* The rest of the robust-futex field is for the TID:
|
||||
*/
|
||||
#define FUTEX_TID_MASK 0x3fffffff
|
||||
|
||||
/*
|
||||
* This limit protects against a deliberately circular list.
|
||||
* (Not worth introducing an rlimit for it)
|
||||
*/
|
||||
#define ROBUST_LIST_LIMIT 2048
|
||||
|
||||
/*
|
||||
* bitset with all bits set for the FUTEX_xxx_BITSET OPs to request a
|
||||
* match of any bit.
|
||||
*/
|
||||
#define FUTEX_BITSET_MATCH_ANY 0xffffffff
|
||||
|
||||
|
||||
#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
|
||||
#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */
|
||||
#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */
|
||||
#define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */
|
||||
#define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */
|
||||
|
||||
#define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */
|
||||
|
||||
#define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */
|
||||
#define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */
|
||||
#define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */
|
||||
#define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */
|
||||
#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */
|
||||
#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */
|
||||
|
||||
/* FUTEX_WAKE_OP will perform atomically
|
||||
int oldval = *(int *)UADDR2;
|
||||
*(int *)UADDR2 = oldval OP OPARG;
|
||||
if (oldval CMP CMPARG)
|
||||
wake UADDR2; */
|
||||
|
||||
#define FUTEX_OP(op, oparg, cmp, cmparg) \
|
||||
(((op & 0xf) << 28) | ((cmp & 0xf) << 24) \
|
||||
| ((oparg & 0xfff) << 12) | (cmparg & 0xfff))
|
||||
|
||||
#endif /* _LINUX_FUTEX_H */
|
89
contrib/libc-headers/linux/genetlink.h
Normal file
89
contrib/libc-headers/linux/genetlink.h
Normal file
@ -0,0 +1,89 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef __LINUX_GENERIC_NETLINK_H
|
||||
#define __LINUX_GENERIC_NETLINK_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/netlink.h>
|
||||
|
||||
#define GENL_NAMSIZ 16 /* length of family name */
|
||||
|
||||
#define GENL_MIN_ID NLMSG_MIN_TYPE
|
||||
#define GENL_MAX_ID 1023
|
||||
|
||||
struct genlmsghdr {
|
||||
__u8 cmd;
|
||||
__u8 version;
|
||||
__u16 reserved;
|
||||
};
|
||||
|
||||
#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
|
||||
|
||||
#define GENL_ADMIN_PERM 0x01
|
||||
#define GENL_CMD_CAP_DO 0x02
|
||||
#define GENL_CMD_CAP_DUMP 0x04
|
||||
#define GENL_CMD_CAP_HASPOL 0x08
|
||||
#define GENL_UNS_ADMIN_PERM 0x10
|
||||
|
||||
/*
|
||||
* List of reserved static generic netlink identifiers:
|
||||
*/
|
||||
#define GENL_ID_CTRL NLMSG_MIN_TYPE
|
||||
#define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1)
|
||||
#define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2)
|
||||
/* must be last reserved + 1 */
|
||||
#define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3)
|
||||
|
||||
/**************************************************************************
|
||||
* Controller
|
||||
**************************************************************************/
|
||||
|
||||
enum {
|
||||
CTRL_CMD_UNSPEC,
|
||||
CTRL_CMD_NEWFAMILY,
|
||||
CTRL_CMD_DELFAMILY,
|
||||
CTRL_CMD_GETFAMILY,
|
||||
CTRL_CMD_NEWOPS,
|
||||
CTRL_CMD_DELOPS,
|
||||
CTRL_CMD_GETOPS,
|
||||
CTRL_CMD_NEWMCAST_GRP,
|
||||
CTRL_CMD_DELMCAST_GRP,
|
||||
CTRL_CMD_GETMCAST_GRP, /* unused */
|
||||
__CTRL_CMD_MAX,
|
||||
};
|
||||
|
||||
#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
|
||||
|
||||
enum {
|
||||
CTRL_ATTR_UNSPEC,
|
||||
CTRL_ATTR_FAMILY_ID,
|
||||
CTRL_ATTR_FAMILY_NAME,
|
||||
CTRL_ATTR_VERSION,
|
||||
CTRL_ATTR_HDRSIZE,
|
||||
CTRL_ATTR_MAXATTR,
|
||||
CTRL_ATTR_OPS,
|
||||
CTRL_ATTR_MCAST_GROUPS,
|
||||
__CTRL_ATTR_MAX,
|
||||
};
|
||||
|
||||
#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
|
||||
|
||||
enum {
|
||||
CTRL_ATTR_OP_UNSPEC,
|
||||
CTRL_ATTR_OP_ID,
|
||||
CTRL_ATTR_OP_FLAGS,
|
||||
__CTRL_ATTR_OP_MAX,
|
||||
};
|
||||
|
||||
#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
|
||||
|
||||
enum {
|
||||
CTRL_ATTR_MCAST_GRP_UNSPEC,
|
||||
CTRL_ATTR_MCAST_GRP_NAME,
|
||||
CTRL_ATTR_MCAST_GRP_ID,
|
||||
__CTRL_ATTR_MCAST_GRP_MAX,
|
||||
};
|
||||
|
||||
#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
|
||||
|
||||
|
||||
#endif /* __LINUX_GENERIC_NETLINK_H */
|
303
contrib/libc-headers/linux/if_packet.h
Normal file
303
contrib/libc-headers/linux/if_packet.h
Normal file
@ -0,0 +1,303 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef __LINUX_IF_PACKET_H
|
||||
#define __LINUX_IF_PACKET_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct sockaddr_pkt {
|
||||
unsigned short spkt_family;
|
||||
unsigned char spkt_device[14];
|
||||
__be16 spkt_protocol;
|
||||
};
|
||||
|
||||
struct sockaddr_ll {
|
||||
unsigned short sll_family;
|
||||
__be16 sll_protocol;
|
||||
int sll_ifindex;
|
||||
unsigned short sll_hatype;
|
||||
unsigned char sll_pkttype;
|
||||
unsigned char sll_halen;
|
||||
unsigned char sll_addr[8];
|
||||
};
|
||||
|
||||
/* Packet types */
|
||||
|
||||
#define PACKET_HOST 0 /* To us */
|
||||
#define PACKET_BROADCAST 1 /* To all */
|
||||
#define PACKET_MULTICAST 2 /* To group */
|
||||
#define PACKET_OTHERHOST 3 /* To someone else */
|
||||
#define PACKET_OUTGOING 4 /* Outgoing of any type */
|
||||
#define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */
|
||||
#define PACKET_USER 6 /* To user space */
|
||||
#define PACKET_KERNEL 7 /* To kernel space */
|
||||
/* Unused, PACKET_FASTROUTE and PACKET_LOOPBACK are invisible to user space */
|
||||
#define PACKET_FASTROUTE 6 /* Fastrouted frame */
|
||||
|
||||
/* Packet socket options */
|
||||
|
||||
#define PACKET_ADD_MEMBERSHIP 1
|
||||
#define PACKET_DROP_MEMBERSHIP 2
|
||||
#define PACKET_RECV_OUTPUT 3
|
||||
/* Value 4 is still used by obsolete turbo-packet. */
|
||||
#define PACKET_RX_RING 5
|
||||
#define PACKET_STATISTICS 6
|
||||
#define PACKET_COPY_THRESH 7
|
||||
#define PACKET_AUXDATA 8
|
||||
#define PACKET_ORIGDEV 9
|
||||
#define PACKET_VERSION 10
|
||||
#define PACKET_HDRLEN 11
|
||||
#define PACKET_RESERVE 12
|
||||
#define PACKET_TX_RING 13
|
||||
#define PACKET_LOSS 14
|
||||
#define PACKET_VNET_HDR 15
|
||||
#define PACKET_TX_TIMESTAMP 16
|
||||
#define PACKET_TIMESTAMP 17
|
||||
#define PACKET_FANOUT 18
|
||||
#define PACKET_TX_HAS_OFF 19
|
||||
#define PACKET_QDISC_BYPASS 20
|
||||
#define PACKET_ROLLOVER_STATS 21
|
||||
#define PACKET_FANOUT_DATA 22
|
||||
|
||||
#define PACKET_FANOUT_HASH 0
|
||||
#define PACKET_FANOUT_LB 1
|
||||
#define PACKET_FANOUT_CPU 2
|
||||
#define PACKET_FANOUT_ROLLOVER 3
|
||||
#define PACKET_FANOUT_RND 4
|
||||
#define PACKET_FANOUT_QM 5
|
||||
#define PACKET_FANOUT_CBPF 6
|
||||
#define PACKET_FANOUT_EBPF 7
|
||||
#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
|
||||
#define PACKET_FANOUT_FLAG_UNIQUEID 0x2000
|
||||
#define PACKET_FANOUT_FLAG_DEFRAG 0x8000
|
||||
|
||||
struct tpacket_stats {
|
||||
unsigned int tp_packets;
|
||||
unsigned int tp_drops;
|
||||
};
|
||||
|
||||
struct tpacket_stats_v3 {
|
||||
unsigned int tp_packets;
|
||||
unsigned int tp_drops;
|
||||
unsigned int tp_freeze_q_cnt;
|
||||
};
|
||||
|
||||
struct tpacket_rollover_stats {
|
||||
__aligned_u64 tp_all;
|
||||
__aligned_u64 tp_huge;
|
||||
__aligned_u64 tp_failed;
|
||||
};
|
||||
|
||||
union tpacket_stats_u {
|
||||
struct tpacket_stats stats1;
|
||||
struct tpacket_stats_v3 stats3;
|
||||
};
|
||||
|
||||
struct tpacket_auxdata {
|
||||
__u32 tp_status;
|
||||
__u32 tp_len;
|
||||
__u32 tp_snaplen;
|
||||
__u16 tp_mac;
|
||||
__u16 tp_net;
|
||||
__u16 tp_vlan_tci;
|
||||
__u16 tp_vlan_tpid;
|
||||
};
|
||||
|
||||
/* Rx ring - header status */
|
||||
#define TP_STATUS_KERNEL 0
|
||||
#define TP_STATUS_USER (1 << 0)
|
||||
#define TP_STATUS_COPY (1 << 1)
|
||||
#define TP_STATUS_LOSING (1 << 2)
|
||||
#define TP_STATUS_CSUMNOTREADY (1 << 3)
|
||||
#define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */
|
||||
#define TP_STATUS_BLK_TMO (1 << 5)
|
||||
#define TP_STATUS_VLAN_TPID_VALID (1 << 6) /* auxdata has valid tp_vlan_tpid */
|
||||
#define TP_STATUS_CSUM_VALID (1 << 7)
|
||||
|
||||
/* Tx ring - header status */
|
||||
#define TP_STATUS_AVAILABLE 0
|
||||
#define TP_STATUS_SEND_REQUEST (1 << 0)
|
||||
#define TP_STATUS_SENDING (1 << 1)
|
||||
#define TP_STATUS_WRONG_FORMAT (1 << 2)
|
||||
|
||||
/* Rx and Tx ring - header status */
|
||||
#define TP_STATUS_TS_SOFTWARE (1 << 29)
|
||||
#define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */
|
||||
#define TP_STATUS_TS_RAW_HARDWARE (1 << 31)
|
||||
|
||||
/* Rx ring - feature request bits */
|
||||
#define TP_FT_REQ_FILL_RXHASH 0x1
|
||||
|
||||
struct tpacket_hdr {
|
||||
unsigned long tp_status;
|
||||
unsigned int tp_len;
|
||||
unsigned int tp_snaplen;
|
||||
unsigned short tp_mac;
|
||||
unsigned short tp_net;
|
||||
unsigned int tp_sec;
|
||||
unsigned int tp_usec;
|
||||
};
|
||||
|
||||
#define TPACKET_ALIGNMENT 16
|
||||
#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1))
|
||||
#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll))
|
||||
|
||||
struct tpacket2_hdr {
|
||||
__u32 tp_status;
|
||||
__u32 tp_len;
|
||||
__u32 tp_snaplen;
|
||||
__u16 tp_mac;
|
||||
__u16 tp_net;
|
||||
__u32 tp_sec;
|
||||
__u32 tp_nsec;
|
||||
__u16 tp_vlan_tci;
|
||||
__u16 tp_vlan_tpid;
|
||||
__u8 tp_padding[4];
|
||||
};
|
||||
|
||||
struct tpacket_hdr_variant1 {
|
||||
__u32 tp_rxhash;
|
||||
__u32 tp_vlan_tci;
|
||||
__u16 tp_vlan_tpid;
|
||||
__u16 tp_padding;
|
||||
};
|
||||
|
||||
struct tpacket3_hdr {
|
||||
__u32 tp_next_offset;
|
||||
__u32 tp_sec;
|
||||
__u32 tp_nsec;
|
||||
__u32 tp_snaplen;
|
||||
__u32 tp_len;
|
||||
__u32 tp_status;
|
||||
__u16 tp_mac;
|
||||
__u16 tp_net;
|
||||
/* pkt_hdr variants */
|
||||
union {
|
||||
struct tpacket_hdr_variant1 hv1;
|
||||
};
|
||||
__u8 tp_padding[8];
|
||||
};
|
||||
|
||||
struct tpacket_bd_ts {
|
||||
unsigned int ts_sec;
|
||||
union {
|
||||
unsigned int ts_usec;
|
||||
unsigned int ts_nsec;
|
||||
};
|
||||
};
|
||||
|
||||
struct tpacket_hdr_v1 {
|
||||
__u32 block_status;
|
||||
__u32 num_pkts;
|
||||
__u32 offset_to_first_pkt;
|
||||
|
||||
/* Number of valid bytes (including padding)
|
||||
* blk_len <= tp_block_size
|
||||
*/
|
||||
__u32 blk_len;
|
||||
|
||||
/*
|
||||
* Quite a few uses of sequence number:
|
||||
* 1. Make sure cache flush etc worked.
|
||||
* Well, one can argue - why not use the increasing ts below?
|
||||
* But look at 2. below first.
|
||||
* 2. When you pass around blocks to other user space decoders,
|
||||
* you can see which blk[s] is[are] outstanding etc.
|
||||
* 3. Validate kernel code.
|
||||
*/
|
||||
__aligned_u64 seq_num;
|
||||
|
||||
/*
|
||||
* ts_last_pkt:
|
||||
*
|
||||
* Case 1. Block has 'N'(N >=1) packets and TMO'd(timed out)
|
||||
* ts_last_pkt == 'time-stamp of last packet' and NOT the
|
||||
* time when the timer fired and the block was closed.
|
||||
* By providing the ts of the last packet we can absolutely
|
||||
* guarantee that time-stamp wise, the first packet in the
|
||||
* next block will never precede the last packet of the
|
||||
* previous block.
|
||||
* Case 2. Block has zero packets and TMO'd
|
||||
* ts_last_pkt = time when the timer fired and the block
|
||||
* was closed.
|
||||
* Case 3. Block has 'N' packets and NO TMO.
|
||||
* ts_last_pkt = time-stamp of the last pkt in the block.
|
||||
*
|
||||
* ts_first_pkt:
|
||||
* Is always the time-stamp when the block was opened.
|
||||
* Case a) ZERO packets
|
||||
* No packets to deal with but atleast you know the
|
||||
* time-interval of this block.
|
||||
* Case b) Non-zero packets
|
||||
* Use the ts of the first packet in the block.
|
||||
*
|
||||
*/
|
||||
struct tpacket_bd_ts ts_first_pkt, ts_last_pkt;
|
||||
};
|
||||
|
||||
union tpacket_bd_header_u {
|
||||
struct tpacket_hdr_v1 bh1;
|
||||
};
|
||||
|
||||
struct tpacket_block_desc {
|
||||
__u32 version;
|
||||
__u32 offset_to_priv;
|
||||
union tpacket_bd_header_u hdr;
|
||||
};
|
||||
|
||||
#define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll))
|
||||
#define TPACKET3_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket3_hdr)) + sizeof(struct sockaddr_ll))
|
||||
|
||||
enum tpacket_versions {
|
||||
TPACKET_V1,
|
||||
TPACKET_V2,
|
||||
TPACKET_V3
|
||||
};
|
||||
|
||||
/*
|
||||
Frame structure:
|
||||
|
||||
- Start. Frame must be aligned to TPACKET_ALIGNMENT=16
|
||||
- struct tpacket_hdr
|
||||
- pad to TPACKET_ALIGNMENT=16
|
||||
- struct sockaddr_ll
|
||||
- Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16
|
||||
- Start+tp_mac: [ Optional MAC header ]
|
||||
- Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16.
|
||||
- Pad to align to TPACKET_ALIGNMENT=16
|
||||
*/
|
||||
|
||||
struct tpacket_req {
|
||||
unsigned int tp_block_size; /* Minimal size of contiguous block */
|
||||
unsigned int tp_block_nr; /* Number of blocks */
|
||||
unsigned int tp_frame_size; /* Size of frame */
|
||||
unsigned int tp_frame_nr; /* Total number of frames */
|
||||
};
|
||||
|
||||
struct tpacket_req3 {
|
||||
unsigned int tp_block_size; /* Minimal size of contiguous block */
|
||||
unsigned int tp_block_nr; /* Number of blocks */
|
||||
unsigned int tp_frame_size; /* Size of frame */
|
||||
unsigned int tp_frame_nr; /* Total number of frames */
|
||||
unsigned int tp_retire_blk_tov; /* timeout in msecs */
|
||||
unsigned int tp_sizeof_priv; /* offset to private data area */
|
||||
unsigned int tp_feature_req_word;
|
||||
};
|
||||
|
||||
union tpacket_req_u {
|
||||
struct tpacket_req req;
|
||||
struct tpacket_req3 req3;
|
||||
};
|
||||
|
||||
struct packet_mreq {
|
||||
int mr_ifindex;
|
||||
unsigned short mr_type;
|
||||
unsigned short mr_alen;
|
||||
unsigned char mr_address[8];
|
||||
};
|
||||
|
||||
#define PACKET_MR_MULTICAST 0
|
||||
#define PACKET_MR_PROMISC 1
|
||||
#define PACKET_MR_ALLMULTI 2
|
||||
#define PACKET_MR_UNICAST 3
|
||||
|
||||
#endif
|
8
contrib/libc-headers/linux/ioctl.h
Normal file
8
contrib/libc-headers/linux/ioctl.h
Normal file
@ -0,0 +1,8 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_IOCTL_H
|
||||
#define _LINUX_IOCTL_H
|
||||
|
||||
#include <asm/ioctl.h>
|
||||
|
||||
#endif /* _LINUX_IOCTL_H */
|
||||
|
4
contrib/libc-headers/linux/irqnr.h
Normal file
4
contrib/libc-headers/linux/irqnr.h
Normal file
@ -0,0 +1,4 @@
|
||||
/*
|
||||
* There isn't anything here anymore, but the file must not be empty or patch
|
||||
* will delete it.
|
||||
*/
|
15
contrib/libc-headers/linux/kernel.h
Normal file
15
contrib/libc-headers/linux/kernel.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_KERNEL_H
|
||||
#define _LINUX_KERNEL_H
|
||||
|
||||
#include <linux/sysinfo.h>
|
||||
|
||||
/*
|
||||
* 'kernel.h' contains some often-used function prototypes etc
|
||||
*/
|
||||
#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
|
||||
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
|
||||
|
||||
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
|
||||
|
||||
#endif /* _LINUX_KERNEL_H */
|
21
contrib/libc-headers/linux/limits.h
Normal file
21
contrib/libc-headers/linux/limits.h
Normal file
@ -0,0 +1,21 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_LIMITS_H
|
||||
#define _LINUX_LIMITS_H
|
||||
|
||||
#define NR_OPEN 1024
|
||||
|
||||
#define NGROUPS_MAX 65536 /* supplemental group IDs are available */
|
||||
#define ARG_MAX 131072 /* # bytes of args + environ for exec() */
|
||||
#define LINK_MAX 127 /* # links a file may have */
|
||||
#define MAX_CANON 255 /* size of the canonical input queue */
|
||||
#define MAX_INPUT 255 /* size of the type-ahead buffer */
|
||||
#define NAME_MAX 255 /* # chars in a file name */
|
||||
#define PATH_MAX 4096 /* # chars in a path name including nul */
|
||||
#define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */
|
||||
#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */
|
||||
#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */
|
||||
#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */
|
||||
|
||||
#define RTSIG_MAX 32
|
||||
|
||||
#endif
|
247
contrib/libc-headers/linux/netlink.h
Normal file
247
contrib/libc-headers/linux/netlink.h
Normal file
@ -0,0 +1,247 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef __LINUX_NETLINK_H
|
||||
#define __LINUX_NETLINK_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/socket.h> /* for __kernel_sa_family_t */
|
||||
#include <linux/types.h>
|
||||
|
||||
#define NETLINK_ROUTE 0 /* Routing/device hook */
|
||||
#define NETLINK_UNUSED 1 /* Unused number */
|
||||
#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
|
||||
#define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */
|
||||
#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
|
||||
#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
|
||||
#define NETLINK_XFRM 6 /* ipsec */
|
||||
#define NETLINK_SELINUX 7 /* SELinux event notifications */
|
||||
#define NETLINK_ISCSI 8 /* Open-iSCSI */
|
||||
#define NETLINK_AUDIT 9 /* auditing */
|
||||
#define NETLINK_FIB_LOOKUP 10
|
||||
#define NETLINK_CONNECTOR 11
|
||||
#define NETLINK_NETFILTER 12 /* netfilter subsystem */
|
||||
#define NETLINK_IP6_FW 13
|
||||
#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
|
||||
#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
|
||||
#define NETLINK_GENERIC 16
|
||||
/* leave room for NETLINK_DM (DM Events) */
|
||||
#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */
|
||||
#define NETLINK_ECRYPTFS 19
|
||||
#define NETLINK_RDMA 20
|
||||
#define NETLINK_CRYPTO 21 /* Crypto layer */
|
||||
#define NETLINK_SMC 22 /* SMC monitoring */
|
||||
|
||||
#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
|
||||
|
||||
#define MAX_LINKS 32
|
||||
|
||||
struct sockaddr_nl {
|
||||
__kernel_sa_family_t nl_family; /* AF_NETLINK */
|
||||
unsigned short nl_pad; /* zero */
|
||||
__u32 nl_pid; /* port ID */
|
||||
__u32 nl_groups; /* multicast groups mask */
|
||||
};
|
||||
|
||||
struct nlmsghdr {
|
||||
__u32 nlmsg_len; /* Length of message including header */
|
||||
__u16 nlmsg_type; /* Message content */
|
||||
__u16 nlmsg_flags; /* Additional flags */
|
||||
__u32 nlmsg_seq; /* Sequence number */
|
||||
__u32 nlmsg_pid; /* Sending process port ID */
|
||||
};
|
||||
|
||||
/* Flags values */
|
||||
|
||||
#define NLM_F_REQUEST 0x01 /* It is request message. */
|
||||
#define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */
|
||||
#define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */
|
||||
#define NLM_F_ECHO 0x08 /* Echo this request */
|
||||
#define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */
|
||||
#define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */
|
||||
|
||||
/* Modifiers to GET request */
|
||||
#define NLM_F_ROOT 0x100 /* specify tree root */
|
||||
#define NLM_F_MATCH 0x200 /* return all matching */
|
||||
#define NLM_F_ATOMIC 0x400 /* atomic GET */
|
||||
#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
|
||||
|
||||
/* Modifiers to NEW request */
|
||||
#define NLM_F_REPLACE 0x100 /* Override existing */
|
||||
#define NLM_F_EXCL 0x200 /* Do not touch, if it exists */
|
||||
#define NLM_F_CREATE 0x400 /* Create, if it does not exist */
|
||||
#define NLM_F_APPEND 0x800 /* Add to end of list */
|
||||
|
||||
/* Modifiers to DELETE request */
|
||||
#define NLM_F_NONREC 0x100 /* Do not delete recursively */
|
||||
|
||||
/* Flags for ACK message */
|
||||
#define NLM_F_CAPPED 0x100 /* request was capped */
|
||||
#define NLM_F_ACK_TLVS 0x200 /* extended ACK TVLs were included */
|
||||
|
||||
/*
|
||||
4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL
|
||||
4.4BSD CHANGE NLM_F_REPLACE
|
||||
|
||||
True CHANGE NLM_F_CREATE|NLM_F_REPLACE
|
||||
Append NLM_F_CREATE
|
||||
Check NLM_F_EXCL
|
||||
*/
|
||||
|
||||
#define NLMSG_ALIGNTO 4U
|
||||
#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
|
||||
#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
|
||||
#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
|
||||
#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
|
||||
#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
|
||||
#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
|
||||
(struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
|
||||
#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
|
||||
(nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
|
||||
(nlh)->nlmsg_len <= (len))
|
||||
#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
|
||||
|
||||
#define NLMSG_NOOP 0x1 /* Nothing. */
|
||||
#define NLMSG_ERROR 0x2 /* Error */
|
||||
#define NLMSG_DONE 0x3 /* End of a dump */
|
||||
#define NLMSG_OVERRUN 0x4 /* Data lost */
|
||||
|
||||
#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
|
||||
|
||||
struct nlmsgerr {
|
||||
int error;
|
||||
struct nlmsghdr msg;
|
||||
/*
|
||||
* followed by the message contents unless NETLINK_CAP_ACK was set
|
||||
* or the ACK indicates success (error == 0)
|
||||
* message length is aligned with NLMSG_ALIGN()
|
||||
*/
|
||||
/*
|
||||
* followed by TLVs defined in enum nlmsgerr_attrs
|
||||
* if NETLINK_EXT_ACK was set
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* enum nlmsgerr_attrs - nlmsgerr attributes
|
||||
* @NLMSGERR_ATTR_UNUSED: unused
|
||||
* @NLMSGERR_ATTR_MSG: error message string (string)
|
||||
* @NLMSGERR_ATTR_OFFS: offset of the invalid attribute in the original
|
||||
* message, counting from the beginning of the header (u32)
|
||||
* @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to
|
||||
* be used - in the success case - to identify a created
|
||||
* object or operation or similar (binary)
|
||||
* @__NLMSGERR_ATTR_MAX: number of attributes
|
||||
* @NLMSGERR_ATTR_MAX: highest attribute number
|
||||
*/
|
||||
enum nlmsgerr_attrs {
|
||||
NLMSGERR_ATTR_UNUSED,
|
||||
NLMSGERR_ATTR_MSG,
|
||||
NLMSGERR_ATTR_OFFS,
|
||||
NLMSGERR_ATTR_COOKIE,
|
||||
|
||||
__NLMSGERR_ATTR_MAX,
|
||||
NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1
|
||||
};
|
||||
|
||||
#define NETLINK_ADD_MEMBERSHIP 1
|
||||
#define NETLINK_DROP_MEMBERSHIP 2
|
||||
#define NETLINK_PKTINFO 3
|
||||
#define NETLINK_BROADCAST_ERROR 4
|
||||
#define NETLINK_NO_ENOBUFS 5
|
||||
#define NETLINK_RX_RING 6
|
||||
#define NETLINK_TX_RING 7
|
||||
#define NETLINK_LISTEN_ALL_NSID 8
|
||||
#define NETLINK_LIST_MEMBERSHIPS 9
|
||||
#define NETLINK_CAP_ACK 10
|
||||
#define NETLINK_EXT_ACK 11
|
||||
|
||||
struct nl_pktinfo {
|
||||
__u32 group;
|
||||
};
|
||||
|
||||
struct nl_mmap_req {
|
||||
unsigned int nm_block_size;
|
||||
unsigned int nm_block_nr;
|
||||
unsigned int nm_frame_size;
|
||||
unsigned int nm_frame_nr;
|
||||
};
|
||||
|
||||
struct nl_mmap_hdr {
|
||||
unsigned int nm_status;
|
||||
unsigned int nm_len;
|
||||
__u32 nm_group;
|
||||
/* credentials */
|
||||
__u32 nm_pid;
|
||||
__u32 nm_uid;
|
||||
__u32 nm_gid;
|
||||
};
|
||||
|
||||
enum nl_mmap_status {
|
||||
NL_MMAP_STATUS_UNUSED,
|
||||
NL_MMAP_STATUS_RESERVED,
|
||||
NL_MMAP_STATUS_VALID,
|
||||
NL_MMAP_STATUS_COPY,
|
||||
NL_MMAP_STATUS_SKIP,
|
||||
};
|
||||
|
||||
#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO
|
||||
#define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)
|
||||
#define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr))
|
||||
|
||||
#define NET_MAJOR 36 /* Major 36 is reserved for networking */
|
||||
|
||||
enum {
|
||||
NETLINK_UNCONNECTED = 0,
|
||||
NETLINK_CONNECTED,
|
||||
};
|
||||
|
||||
/*
|
||||
* <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
|
||||
* +---------------------+- - -+- - - - - - - - - -+- - -+
|
||||
* | Header | Pad | Payload | Pad |
|
||||
* | (struct nlattr) | ing | | ing |
|
||||
* +---------------------+- - -+- - - - - - - - - -+- - -+
|
||||
* <-------------- nlattr->nla_len -------------->
|
||||
*/
|
||||
|
||||
struct nlattr {
|
||||
__u16 nla_len;
|
||||
__u16 nla_type;
|
||||
};
|
||||
|
||||
/*
|
||||
* nla_type (16 bits)
|
||||
* +---+---+-------------------------------+
|
||||
* | N | O | Attribute Type |
|
||||
* +---+---+-------------------------------+
|
||||
* N := Carries nested attributes
|
||||
* O := Payload stored in network byte order
|
||||
*
|
||||
* Note: The N and O flag are mutually exclusive.
|
||||
*/
|
||||
#define NLA_F_NESTED (1 << 15)
|
||||
#define NLA_F_NET_BYTEORDER (1 << 14)
|
||||
#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
|
||||
|
||||
#define NLA_ALIGNTO 4
|
||||
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
|
||||
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
|
||||
|
||||
/* Generic 32 bitflags attribute content sent to the kernel.
|
||||
*
|
||||
* The value is a bitmap that defines the values being set
|
||||
* The selector is a bitmask that defines which value is legit
|
||||
*
|
||||
* Examples:
|
||||
* value = 0x0, and selector = 0x1
|
||||
* implies we are selecting bit 1 and we want to set its value to 0.
|
||||
*
|
||||
* value = 0x2, and selector = 0x2
|
||||
* implies we are selecting bit 2 and we want to set its value to 1.
|
||||
*
|
||||
*/
|
||||
struct nla_bitfield32 {
|
||||
__u32 value;
|
||||
__u32 selector;
|
||||
};
|
||||
|
||||
#endif /* __LINUX_NETLINK_H */
|
7
contrib/libc-headers/linux/param.h
Normal file
7
contrib/libc-headers/linux/param.h
Normal file
@ -0,0 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_PARAM_H
|
||||
#define _LINUX_PARAM_H
|
||||
|
||||
#include <asm/param.h>
|
||||
|
||||
#endif
|
38
contrib/libc-headers/linux/posix_types.h
Normal file
38
contrib/libc-headers/linux/posix_types.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_POSIX_TYPES_H
|
||||
#define _LINUX_POSIX_TYPES_H
|
||||
|
||||
#include <linux/stddef.h>
|
||||
|
||||
/*
|
||||
* This allows for 1024 file descriptors: if NR_OPEN is ever grown
|
||||
* beyond that you'll have to change this too. But 1024 fd's seem to be
|
||||
* enough even for such "real" unices like OSF/1, so hopefully this is
|
||||
* one limit that doesn't have to be changed [again].
|
||||
*
|
||||
* Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in
|
||||
* <sys/time.h> (and thus <linux/time.h>) - but this is a more logical
|
||||
* place for them. Solved by having dummy defines in <sys/time.h>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This macro may have been defined in <gnu/types.h>. But we always
|
||||
* use the one here.
|
||||
*/
|
||||
#undef __FD_SETSIZE
|
||||
#define __FD_SETSIZE 1024
|
||||
|
||||
typedef struct {
|
||||
unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))];
|
||||
} __kernel_fd_set;
|
||||
|
||||
/* Type of a signal handler. */
|
||||
typedef void (*__kernel_sighandler_t)(int);
|
||||
|
||||
/* Type of a SYSV IPC key. */
|
||||
typedef int __kernel_key_t;
|
||||
typedef int __kernel_mqd_t;
|
||||
|
||||
#include <asm/posix_types.h>
|
||||
|
||||
#endif /* _LINUX_POSIX_TYPES_H */
|
233
contrib/libc-headers/linux/prctl.h
Normal file
233
contrib/libc-headers/linux/prctl.h
Normal file
@ -0,0 +1,233 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_PRCTL_H
|
||||
#define _LINUX_PRCTL_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Values to pass as first argument to prctl() */
|
||||
|
||||
#define PR_SET_PDEATHSIG 1 /* Second arg is a signal */
|
||||
#define PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */
|
||||
|
||||
/* Get/set current->mm->dumpable */
|
||||
#define PR_GET_DUMPABLE 3
|
||||
#define PR_SET_DUMPABLE 4
|
||||
|
||||
/* Get/set unaligned access control bits (if meaningful) */
|
||||
#define PR_GET_UNALIGN 5
|
||||
#define PR_SET_UNALIGN 6
|
||||
# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */
|
||||
# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */
|
||||
|
||||
/* Get/set whether or not to drop capabilities on setuid() away from
|
||||
* uid 0 (as per security/commoncap.c) */
|
||||
#define PR_GET_KEEPCAPS 7
|
||||
#define PR_SET_KEEPCAPS 8
|
||||
|
||||
/* Get/set floating-point emulation control bits (if meaningful) */
|
||||
#define PR_GET_FPEMU 9
|
||||
#define PR_SET_FPEMU 10
|
||||
# define PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */
|
||||
# define PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */
|
||||
|
||||
/* Get/set floating-point exception mode (if meaningful) */
|
||||
#define PR_GET_FPEXC 11
|
||||
#define PR_SET_FPEXC 12
|
||||
# define PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */
|
||||
# define PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */
|
||||
# define PR_FP_EXC_OVF 0x020000 /* floating point overflow */
|
||||
# define PR_FP_EXC_UND 0x040000 /* floating point underflow */
|
||||
# define PR_FP_EXC_RES 0x080000 /* floating point inexact result */
|
||||
# define PR_FP_EXC_INV 0x100000 /* floating point invalid operation */
|
||||
# define PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */
|
||||
# define PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */
|
||||
# define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */
|
||||
# define PR_FP_EXC_PRECISE 3 /* precise exception mode */
|
||||
|
||||
/* Get/set whether we use statistical process timing or accurate timestamp
|
||||
* based process timing */
|
||||
#define PR_GET_TIMING 13
|
||||
#define PR_SET_TIMING 14
|
||||
# define PR_TIMING_STATISTICAL 0 /* Normal, traditional,
|
||||
statistical process timing */
|
||||
# define PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based
|
||||
process timing */
|
||||
|
||||
#define PR_SET_NAME 15 /* Set process name */
|
||||
#define PR_GET_NAME 16 /* Get process name */
|
||||
|
||||
/* Get/set process endian */
|
||||
#define PR_GET_ENDIAN 19
|
||||
#define PR_SET_ENDIAN 20
|
||||
# define PR_ENDIAN_BIG 0
|
||||
# define PR_ENDIAN_LITTLE 1 /* True little endian mode */
|
||||
# define PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */
|
||||
|
||||
/* Get/set process seccomp mode */
|
||||
#define PR_GET_SECCOMP 21
|
||||
#define PR_SET_SECCOMP 22
|
||||
|
||||
/* Get/set the capability bounding set (as per security/commoncap.c) */
|
||||
#define PR_CAPBSET_READ 23
|
||||
#define PR_CAPBSET_DROP 24
|
||||
|
||||
/* Get/set the process' ability to use the timestamp counter instruction */
|
||||
#define PR_GET_TSC 25
|
||||
#define PR_SET_TSC 26
|
||||
# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */
|
||||
# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
|
||||
|
||||
/* Get/set securebits (as per security/commoncap.c) */
|
||||
#define PR_GET_SECUREBITS 27
|
||||
#define PR_SET_SECUREBITS 28
|
||||
|
||||
/*
|
||||
* Get/set the timerslack as used by poll/select/nanosleep
|
||||
* A value of 0 means "use default"
|
||||
*/
|
||||
#define PR_SET_TIMERSLACK 29
|
||||
#define PR_GET_TIMERSLACK 30
|
||||
|
||||
#define PR_TASK_PERF_EVENTS_DISABLE 31
|
||||
#define PR_TASK_PERF_EVENTS_ENABLE 32
|
||||
|
||||
/*
|
||||
* Set early/late kill mode for hwpoison memory corruption.
|
||||
* This influences when the process gets killed on a memory corruption.
|
||||
*/
|
||||
#define PR_MCE_KILL 33
|
||||
# define PR_MCE_KILL_CLEAR 0
|
||||
# define PR_MCE_KILL_SET 1
|
||||
|
||||
# define PR_MCE_KILL_LATE 0
|
||||
# define PR_MCE_KILL_EARLY 1
|
||||
# define PR_MCE_KILL_DEFAULT 2
|
||||
|
||||
#define PR_MCE_KILL_GET 34
|
||||
|
||||
/*
|
||||
* Tune up process memory map specifics.
|
||||
*/
|
||||
#define PR_SET_MM 35
|
||||
# define PR_SET_MM_START_CODE 1
|
||||
# define PR_SET_MM_END_CODE 2
|
||||
# define PR_SET_MM_START_DATA 3
|
||||
# define PR_SET_MM_END_DATA 4
|
||||
# define PR_SET_MM_START_STACK 5
|
||||
# define PR_SET_MM_START_BRK 6
|
||||
# define PR_SET_MM_BRK 7
|
||||
# define PR_SET_MM_ARG_START 8
|
||||
# define PR_SET_MM_ARG_END 9
|
||||
# define PR_SET_MM_ENV_START 10
|
||||
# define PR_SET_MM_ENV_END 11
|
||||
# define PR_SET_MM_AUXV 12
|
||||
# define PR_SET_MM_EXE_FILE 13
|
||||
# define PR_SET_MM_MAP 14
|
||||
# define PR_SET_MM_MAP_SIZE 15
|
||||
|
||||
/*
|
||||
* This structure provides new memory descriptor
|
||||
* map which mostly modifies /proc/pid/stat[m]
|
||||
* output for a task. This mostly done in a
|
||||
* sake of checkpoint/restore functionality.
|
||||
*/
|
||||
struct prctl_mm_map {
|
||||
__u64 start_code; /* code section bounds */
|
||||
__u64 end_code;
|
||||
__u64 start_data; /* data section bounds */
|
||||
__u64 end_data;
|
||||
__u64 start_brk; /* heap for brk() syscall */
|
||||
__u64 brk;
|
||||
__u64 start_stack; /* stack starts at */
|
||||
__u64 arg_start; /* command line arguments bounds */
|
||||
__u64 arg_end;
|
||||
__u64 env_start; /* environment variables bounds */
|
||||
__u64 env_end;
|
||||
__u64 *auxv; /* auxiliary vector */
|
||||
__u32 auxv_size; /* vector size */
|
||||
__u32 exe_fd; /* /proc/$pid/exe link file */
|
||||
};
|
||||
|
||||
/*
|
||||
* Set specific pid that is allowed to ptrace the current task.
|
||||
* A value of 0 mean "no process".
|
||||
*/
|
||||
#define PR_SET_PTRACER 0x59616d61
|
||||
# define PR_SET_PTRACER_ANY ((unsigned long)-1)
|
||||
|
||||
#define PR_SET_CHILD_SUBREAPER 36
|
||||
#define PR_GET_CHILD_SUBREAPER 37
|
||||
|
||||
/*
|
||||
* If no_new_privs is set, then operations that grant new privileges (i.e.
|
||||
* execve) will either fail or not grant them. This affects suid/sgid,
|
||||
* file capabilities, and LSMs.
|
||||
*
|
||||
* Operations that merely manipulate or drop existing privileges (setresuid,
|
||||
* capset, etc.) will still work. Drop those privileges if you want them gone.
|
||||
*
|
||||
* Changing LSM security domain is considered a new privilege. So, for example,
|
||||
* asking selinux for a specific new context (e.g. with runcon) will result
|
||||
* in execve returning -EPERM.
|
||||
*
|
||||
* See Documentation/prctl/no_new_privs.txt for more details.
|
||||
*/
|
||||
#define PR_SET_NO_NEW_PRIVS 38
|
||||
#define PR_GET_NO_NEW_PRIVS 39
|
||||
|
||||
#define PR_GET_TID_ADDRESS 40
|
||||
|
||||
#define PR_SET_THP_DISABLE 41
|
||||
#define PR_GET_THP_DISABLE 42
|
||||
|
||||
/*
|
||||
* Tell the kernel to start/stop helping userspace manage bounds tables.
|
||||
*/
|
||||
#define PR_MPX_ENABLE_MANAGEMENT 43
|
||||
#define PR_MPX_DISABLE_MANAGEMENT 44
|
||||
|
||||
#define PR_SET_FP_MODE 45
|
||||
#define PR_GET_FP_MODE 46
|
||||
# define PR_FP_MODE_FR (1 << 0) /* 64b FP registers */
|
||||
# define PR_FP_MODE_FRE (1 << 1) /* 32b compatibility */
|
||||
|
||||
/* Control the ambient capability set */
|
||||
#define PR_CAP_AMBIENT 47
|
||||
# define PR_CAP_AMBIENT_IS_SET 1
|
||||
# define PR_CAP_AMBIENT_RAISE 2
|
||||
# define PR_CAP_AMBIENT_LOWER 3
|
||||
# define PR_CAP_AMBIENT_CLEAR_ALL 4
|
||||
|
||||
/* arm64 Scalable Vector Extension controls */
|
||||
/* Flag values must be kept in sync with ptrace NT_ARM_SVE interface */
|
||||
#define PR_SVE_SET_VL 50 /* set task vector length */
|
||||
# define PR_SVE_SET_VL_ONEXEC (1 << 18) /* defer effect until exec */
|
||||
#define PR_SVE_GET_VL 51 /* get task vector length */
|
||||
/* Bits common to PR_SVE_SET_VL and PR_SVE_GET_VL */
|
||||
# define PR_SVE_VL_LEN_MASK 0xffff
|
||||
# define PR_SVE_VL_INHERIT (1 << 17) /* inherit across exec */
|
||||
|
||||
/* Per task speculation control */
|
||||
#define PR_GET_SPECULATION_CTRL 52
|
||||
#define PR_SET_SPECULATION_CTRL 53
|
||||
/* Speculation control variants */
|
||||
# define PR_SPEC_STORE_BYPASS 0
|
||||
# define PR_SPEC_INDIRECT_BRANCH 1
|
||||
/* Return and control values for PR_SET/GET_SPECULATION_CTRL */
|
||||
# define PR_SPEC_NOT_AFFECTED 0
|
||||
# define PR_SPEC_PRCTL (1UL << 0)
|
||||
# define PR_SPEC_ENABLE (1UL << 1)
|
||||
# define PR_SPEC_DISABLE (1UL << 2)
|
||||
# define PR_SPEC_FORCE_DISABLE (1UL << 3)
|
||||
|
||||
/*
|
||||
* Control the LSM specific peer information
|
||||
*
|
||||
* The Ubuntu kernel provides an early preview of LSM Stacking. Use these
|
||||
* PRCTLs at your own risk. Their values are not guaranteed to be stable in the
|
||||
* case of colliding with an upstream PRCTL.
|
||||
*/
|
||||
#define PR_GET_DISPLAY_LSM 1000000
|
||||
#define PR_SET_DISPLAY_LSM 1000001
|
||||
|
||||
#endif /* _LINUX_PRCTL_H */
|
56
contrib/libc-headers/linux/random.h
Normal file
56
contrib/libc-headers/linux/random.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/*
|
||||
* include/linux/random.h
|
||||
*
|
||||
* Include file for the random number generator.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_RANDOM_H
|
||||
#define _LINUX_RANDOM_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/irqnr.h>
|
||||
|
||||
/* ioctl()'s for the random number generator */
|
||||
|
||||
/* Get the entropy count. */
|
||||
#define RNDGETENTCNT _IOR( 'R', 0x00, int )
|
||||
|
||||
/* Add to (or subtract from) the entropy count. (Superuser only.) */
|
||||
#define RNDADDTOENTCNT _IOW( 'R', 0x01, int )
|
||||
|
||||
/* Get the contents of the entropy pool. (Superuser only.) */
|
||||
#define RNDGETPOOL _IOR( 'R', 0x02, int [2] )
|
||||
|
||||
/*
|
||||
* Write bytes into the entropy pool and add to the entropy count.
|
||||
* (Superuser only.)
|
||||
*/
|
||||
#define RNDADDENTROPY _IOW( 'R', 0x03, int [2] )
|
||||
|
||||
/* Clear entropy count to 0. (Superuser only.) */
|
||||
#define RNDZAPENTCNT _IO( 'R', 0x04 )
|
||||
|
||||
/* Clear the entropy pool and associated counters. (Superuser only.) */
|
||||
#define RNDCLEARPOOL _IO( 'R', 0x06 )
|
||||
|
||||
/* Reseed CRNG. (Superuser only.) */
|
||||
#define RNDRESEEDCRNG _IO( 'R', 0x07 )
|
||||
|
||||
struct rand_pool_info {
|
||||
int entropy_count;
|
||||
int buf_size;
|
||||
__u32 buf[0];
|
||||
};
|
||||
|
||||
/*
|
||||
* Flags for getrandom(2)
|
||||
*
|
||||
* GRND_NONBLOCK Don't block and return EAGAIN instead
|
||||
* GRND_RANDOM Use the /dev/random pool instead of /dev/urandom
|
||||
*/
|
||||
#define GRND_NONBLOCK 0x0001
|
||||
#define GRND_RANDOM 0x0002
|
||||
|
||||
#endif /* _LINUX_RANDOM_H */
|
22
contrib/libc-headers/linux/socket.h
Normal file
22
contrib/libc-headers/linux/socket.h
Normal file
@ -0,0 +1,22 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_SOCKET_H
|
||||
#define _LINUX_SOCKET_H
|
||||
|
||||
/*
|
||||
* Desired design of maximum size and alignment (see RFC2553)
|
||||
*/
|
||||
#define _K_SS_MAXSIZE 128 /* Implementation specific max size */
|
||||
#define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *))
|
||||
/* Implementation specific desired alignment */
|
||||
|
||||
typedef unsigned short __kernel_sa_family_t;
|
||||
|
||||
struct __kernel_sockaddr_storage {
|
||||
__kernel_sa_family_t ss_family; /* address family */
|
||||
/* Following field(s) are implementation specific */
|
||||
char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
|
||||
/* space to achieve desired size, */
|
||||
/* _SS_MAXSIZE value minus size of ss_family */
|
||||
} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */
|
||||
|
||||
#endif /* _LINUX_SOCKET_H */
|
6
contrib/libc-headers/linux/stddef.h
Normal file
6
contrib/libc-headers/linux/stddef.h
Normal file
@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
|
||||
|
||||
#ifndef __always_inline
|
||||
#define __always_inline __inline__
|
||||
#endif
|
295
contrib/libc-headers/linux/swab.h
Normal file
295
contrib/libc-headers/linux/swab.h
Normal file
@ -0,0 +1,295 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_SWAB_H
|
||||
#define _LINUX_SWAB_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <asm/swab.h>
|
||||
|
||||
/*
|
||||
* casts are necessary for constants, because we never know how for sure
|
||||
* how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
|
||||
*/
|
||||
#define ___constant_swab16(x) ((__u16)( \
|
||||
(((__u16)(x) & (__u16)0x00ffU) << 8) | \
|
||||
(((__u16)(x) & (__u16)0xff00U) >> 8)))
|
||||
|
||||
#define ___constant_swab32(x) ((__u32)( \
|
||||
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
|
||||
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
|
||||
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
|
||||
(((__u32)(x) & (__u32)0xff000000UL) >> 24)))
|
||||
|
||||
#define ___constant_swab64(x) ((__u64)( \
|
||||
(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
|
||||
(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
|
||||
(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
|
||||
(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
|
||||
(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
|
||||
(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
|
||||
(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
|
||||
(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
|
||||
|
||||
#define ___constant_swahw32(x) ((__u32)( \
|
||||
(((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
|
||||
(((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
|
||||
|
||||
#define ___constant_swahb32(x) ((__u32)( \
|
||||
(((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
|
||||
(((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
|
||||
|
||||
/*
|
||||
* Implement the following as inlines, but define the interface using
|
||||
* macros to allow constant folding when possible:
|
||||
* ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32
|
||||
*/
|
||||
|
||||
static __inline__ __u16 __fswab16(__u16 val)
|
||||
{
|
||||
#if defined (__arch_swab16)
|
||||
return __arch_swab16(val);
|
||||
#else
|
||||
return ___constant_swab16(val);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ __u32 __fswab32(__u32 val)
|
||||
{
|
||||
#if defined(__arch_swab32)
|
||||
return __arch_swab32(val);
|
||||
#else
|
||||
return ___constant_swab32(val);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ __u64 __fswab64(__u64 val)
|
||||
{
|
||||
#if defined (__arch_swab64)
|
||||
return __arch_swab64(val);
|
||||
#elif defined(__SWAB_64_THRU_32__)
|
||||
__u32 h = val >> 32;
|
||||
__u32 l = val & ((1ULL << 32) - 1);
|
||||
return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h)));
|
||||
#else
|
||||
return ___constant_swab64(val);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ __u32 __fswahw32(__u32 val)
|
||||
{
|
||||
#ifdef __arch_swahw32
|
||||
return __arch_swahw32(val);
|
||||
#else
|
||||
return ___constant_swahw32(val);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ __u32 __fswahb32(__u32 val)
|
||||
{
|
||||
#ifdef __arch_swahb32
|
||||
return __arch_swahb32(val);
|
||||
#else
|
||||
return ___constant_swahb32(val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* __swab16 - return a byteswapped 16-bit value
|
||||
* @x: value to byteswap
|
||||
*/
|
||||
#ifdef __HAVE_BUILTIN_BSWAP16__
|
||||
#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
|
||||
#else
|
||||
#define __swab16(x) \
|
||||
(__builtin_constant_p((__u16)(x)) ? \
|
||||
___constant_swab16(x) : \
|
||||
__fswab16(x))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* __swab32 - return a byteswapped 32-bit value
|
||||
* @x: value to byteswap
|
||||
*/
|
||||
#ifdef __HAVE_BUILTIN_BSWAP32__
|
||||
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
|
||||
#else
|
||||
#define __swab32(x) \
|
||||
(__builtin_constant_p((__u32)(x)) ? \
|
||||
___constant_swab32(x) : \
|
||||
__fswab32(x))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* __swab64 - return a byteswapped 64-bit value
|
||||
* @x: value to byteswap
|
||||
*/
|
||||
#ifdef __HAVE_BUILTIN_BSWAP64__
|
||||
#define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
|
||||
#else
|
||||
#define __swab64(x) \
|
||||
(__builtin_constant_p((__u64)(x)) ? \
|
||||
___constant_swab64(x) : \
|
||||
__fswab64(x))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* __swahw32 - return a word-swapped 32-bit value
|
||||
* @x: value to wordswap
|
||||
*
|
||||
* __swahw32(0x12340000) is 0x00001234
|
||||
*/
|
||||
#define __swahw32(x) \
|
||||
(__builtin_constant_p((__u32)(x)) ? \
|
||||
___constant_swahw32(x) : \
|
||||
__fswahw32(x))
|
||||
|
||||
/**
|
||||
* __swahb32 - return a high and low byte-swapped 32-bit value
|
||||
* @x: value to byteswap
|
||||
*
|
||||
* __swahb32(0x12345678) is 0x34127856
|
||||
*/
|
||||
#define __swahb32(x) \
|
||||
(__builtin_constant_p((__u32)(x)) ? \
|
||||
___constant_swahb32(x) : \
|
||||
__fswahb32(x))
|
||||
|
||||
/**
|
||||
* __swab16p - return a byteswapped 16-bit value from a pointer
|
||||
* @p: pointer to a naturally-aligned 16-bit value
|
||||
*/
|
||||
static __always_inline __u16 __swab16p(const __u16 *p)
|
||||
{
|
||||
#ifdef __arch_swab16p
|
||||
return __arch_swab16p(p);
|
||||
#else
|
||||
return __swab16(*p);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* __swab32p - return a byteswapped 32-bit value from a pointer
|
||||
* @p: pointer to a naturally-aligned 32-bit value
|
||||
*/
|
||||
static __always_inline __u32 __swab32p(const __u32 *p)
|
||||
{
|
||||
#ifdef __arch_swab32p
|
||||
return __arch_swab32p(p);
|
||||
#else
|
||||
return __swab32(*p);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* __swab64p - return a byteswapped 64-bit value from a pointer
|
||||
* @p: pointer to a naturally-aligned 64-bit value
|
||||
*/
|
||||
static __always_inline __u64 __swab64p(const __u64 *p)
|
||||
{
|
||||
#ifdef __arch_swab64p
|
||||
return __arch_swab64p(p);
|
||||
#else
|
||||
return __swab64(*p);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* __swahw32p - return a wordswapped 32-bit value from a pointer
|
||||
* @p: pointer to a naturally-aligned 32-bit value
|
||||
*
|
||||
* See __swahw32() for details of wordswapping.
|
||||
*/
|
||||
static __inline__ __u32 __swahw32p(const __u32 *p)
|
||||
{
|
||||
#ifdef __arch_swahw32p
|
||||
return __arch_swahw32p(p);
|
||||
#else
|
||||
return __swahw32(*p);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* __swahb32p - return a high and low byteswapped 32-bit value from a pointer
|
||||
* @p: pointer to a naturally-aligned 32-bit value
|
||||
*
|
||||
* See __swahb32() for details of high/low byteswapping.
|
||||
*/
|
||||
static __inline__ __u32 __swahb32p(const __u32 *p)
|
||||
{
|
||||
#ifdef __arch_swahb32p
|
||||
return __arch_swahb32p(p);
|
||||
#else
|
||||
return __swahb32(*p);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* __swab16s - byteswap a 16-bit value in-place
|
||||
* @p: pointer to a naturally-aligned 16-bit value
|
||||
*/
|
||||
static __inline__ void __swab16s(__u16 *p)
|
||||
{
|
||||
#ifdef __arch_swab16s
|
||||
__arch_swab16s(p);
|
||||
#else
|
||||
*p = __swab16p(p);
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* __swab32s - byteswap a 32-bit value in-place
|
||||
* @p: pointer to a naturally-aligned 32-bit value
|
||||
*/
|
||||
static __always_inline void __swab32s(__u32 *p)
|
||||
{
|
||||
#ifdef __arch_swab32s
|
||||
__arch_swab32s(p);
|
||||
#else
|
||||
*p = __swab32p(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* __swab64s - byteswap a 64-bit value in-place
|
||||
* @p: pointer to a naturally-aligned 64-bit value
|
||||
*/
|
||||
static __always_inline void __swab64s(__u64 *p)
|
||||
{
|
||||
#ifdef __arch_swab64s
|
||||
__arch_swab64s(p);
|
||||
#else
|
||||
*p = __swab64p(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* __swahw32s - wordswap a 32-bit value in-place
|
||||
* @p: pointer to a naturally-aligned 32-bit value
|
||||
*
|
||||
* See __swahw32() for details of wordswapping
|
||||
*/
|
||||
static __inline__ void __swahw32s(__u32 *p)
|
||||
{
|
||||
#ifdef __arch_swahw32s
|
||||
__arch_swahw32s(p);
|
||||
#else
|
||||
*p = __swahw32p(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* __swahb32s - high and low byteswap a 32-bit value in-place
|
||||
* @p: pointer to a naturally-aligned 32-bit value
|
||||
*
|
||||
* See __swahb32() for details of high and low byte swapping
|
||||
*/
|
||||
static __inline__ void __swahb32s(__u32 *p)
|
||||
{
|
||||
#ifdef __arch_swahb32s
|
||||
__arch_swahb32s(p);
|
||||
#else
|
||||
*p = __swahb32p(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif /* _LINUX_SWAB_H */
|
934
contrib/libc-headers/linux/sysctl.h
Normal file
934
contrib/libc-headers/linux/sysctl.h
Normal file
@ -0,0 +1,934 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/*
|
||||
* sysctl.h: General linux system control interface
|
||||
*
|
||||
* Begun 24 March 1995, Stephen Tweedie
|
||||
*
|
||||
****************************************************************
|
||||
****************************************************************
|
||||
**
|
||||
** WARNING:
|
||||
** The values in this file are exported to user space via
|
||||
** the sysctl() binary interface. Do *NOT* change the
|
||||
** numbering of any existing values here, and do not change
|
||||
** any numbers within any one set of values. If you have to
|
||||
** redefine an existing interface, use a new number for it.
|
||||
** The kernel will then return -ENOTDIR to any application using
|
||||
** the old binary interface.
|
||||
**
|
||||
****************************************************************
|
||||
****************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_SYSCTL_H
|
||||
#define _LINUX_SYSCTL_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
|
||||
#define CTL_MAXNAME 10 /* how many path components do we allow in a
|
||||
call to sysctl? In other words, what is
|
||||
the largest acceptable value for the nlen
|
||||
member of a struct __sysctl_args to have? */
|
||||
|
||||
struct __sysctl_args {
|
||||
int *name;
|
||||
int nlen;
|
||||
void *oldval;
|
||||
size_t *oldlenp;
|
||||
void *newval;
|
||||
size_t newlen;
|
||||
unsigned long __unused[4];
|
||||
};
|
||||
|
||||
/* Define sysctl names first */
|
||||
|
||||
/* Top-level names: */
|
||||
|
||||
enum
|
||||
{
|
||||
CTL_KERN=1, /* General kernel info and control */
|
||||
CTL_VM=2, /* VM management */
|
||||
CTL_NET=3, /* Networking */
|
||||
CTL_PROC=4, /* removal breaks strace(1) compilation */
|
||||
CTL_FS=5, /* Filesystems */
|
||||
CTL_DEBUG=6, /* Debugging */
|
||||
CTL_DEV=7, /* Devices */
|
||||
CTL_BUS=8, /* Busses */
|
||||
CTL_ABI=9, /* Binary emulation */
|
||||
CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
|
||||
CTL_ARLAN=254, /* arlan wireless driver */
|
||||
CTL_S390DBF=5677, /* s390 debug */
|
||||
CTL_SUNRPC=7249, /* sunrpc debug */
|
||||
CTL_PM=9899, /* frv power management */
|
||||
CTL_FRV=9898, /* frv specific sysctls */
|
||||
};
|
||||
|
||||
/* CTL_BUS names: */
|
||||
enum
|
||||
{
|
||||
CTL_BUS_ISA=1 /* ISA */
|
||||
};
|
||||
|
||||
/* /proc/sys/fs/inotify/ */
|
||||
enum
|
||||
{
|
||||
INOTIFY_MAX_USER_INSTANCES=1, /* max instances per user */
|
||||
INOTIFY_MAX_USER_WATCHES=2, /* max watches per user */
|
||||
INOTIFY_MAX_QUEUED_EVENTS=3 /* max queued events per instance */
|
||||
};
|
||||
|
||||
/* CTL_KERN names: */
|
||||
enum
|
||||
{
|
||||
KERN_OSTYPE=1, /* string: system version */
|
||||
KERN_OSRELEASE=2, /* string: system release */
|
||||
KERN_OSREV=3, /* int: system revision */
|
||||
KERN_VERSION=4, /* string: compile time info */
|
||||
KERN_SECUREMASK=5, /* struct: maximum rights mask */
|
||||
KERN_PROF=6, /* table: profiling information */
|
||||
KERN_NODENAME=7, /* string: hostname */
|
||||
KERN_DOMAINNAME=8, /* string: domainname */
|
||||
|
||||
KERN_PANIC=15, /* int: panic timeout */
|
||||
KERN_REALROOTDEV=16, /* real root device to mount after initrd */
|
||||
|
||||
KERN_SPARC_REBOOT=21, /* reboot command on Sparc */
|
||||
KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */
|
||||
KERN_PRINTK=23, /* struct: control printk logging parameters */
|
||||
KERN_NAMETRANS=24, /* Name translation */
|
||||
KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */
|
||||
KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */
|
||||
KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */
|
||||
KERN_MODPROBE=28, /* string: modprobe path */
|
||||
KERN_SG_BIG_BUFF=29, /* int: sg driver reserved buffer size */
|
||||
KERN_ACCT=30, /* BSD process accounting parameters */
|
||||
KERN_PPC_L2CR=31, /* l2cr register on PPC */
|
||||
|
||||
KERN_RTSIGNR=32, /* Number of rt sigs queued */
|
||||
KERN_RTSIGMAX=33, /* Max queuable */
|
||||
|
||||
KERN_SHMMAX=34, /* long: Maximum shared memory segment */
|
||||
KERN_MSGMAX=35, /* int: Maximum size of a messege */
|
||||
KERN_MSGMNB=36, /* int: Maximum message queue size */
|
||||
KERN_MSGPOOL=37, /* int: Maximum system message pool size */
|
||||
KERN_SYSRQ=38, /* int: Sysreq enable */
|
||||
KERN_MAX_THREADS=39, /* int: Maximum nr of threads in the system */
|
||||
KERN_RANDOM=40, /* Random driver */
|
||||
KERN_SHMALL=41, /* int: Maximum size of shared memory */
|
||||
KERN_MSGMNI=42, /* int: msg queue identifiers */
|
||||
KERN_SEM=43, /* struct: sysv semaphore limits */
|
||||
KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */
|
||||
KERN_SHMMNI=45, /* int: shm array identifiers */
|
||||
KERN_OVERFLOWUID=46, /* int: overflow UID */
|
||||
KERN_OVERFLOWGID=47, /* int: overflow GID */
|
||||
KERN_SHMPATH=48, /* string: path to shm fs */
|
||||
KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */
|
||||
KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
|
||||
KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */
|
||||
KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
|
||||
KERN_TAINTED=53, /* int: various kernel tainted flags */
|
||||
KERN_CADPID=54, /* int: PID of the process to notify on CAD */
|
||||
KERN_PIDMAX=55, /* int: PID # limit */
|
||||
KERN_CORE_PATTERN=56, /* string: pattern for core-file names */
|
||||
KERN_PANIC_ON_OOPS=57, /* int: whether we will panic on an oops */
|
||||
KERN_HPPA_PWRSW=58, /* int: hppa soft-power enable */
|
||||
KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */
|
||||
KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */
|
||||
KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */
|
||||
KERN_PTY=62, /* dir: pty driver */
|
||||
KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */
|
||||
KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */
|
||||
KERN_HZ_TIMER=65, /* int: hz timer on or off */
|
||||
KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
|
||||
KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
|
||||
KERN_RANDOMIZE=68, /* int: randomize virtual address space */
|
||||
KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
|
||||
KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
|
||||
KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
|
||||
KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
|
||||
KERN_COMPAT_LOG=73, /* int: print compat layer messages */
|
||||
KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */
|
||||
KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
|
||||
KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
|
||||
KERN_PANIC_ON_WARN=77, /* int: call panic() in WARN() functions */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* CTL_VM names: */
|
||||
enum
|
||||
{
|
||||
VM_UNUSED1=1, /* was: struct: Set vm swapping control */
|
||||
VM_UNUSED2=2, /* was; int: Linear or sqrt() swapout for hogs */
|
||||
VM_UNUSED3=3, /* was: struct: Set free page thresholds */
|
||||
VM_UNUSED4=4, /* Spare */
|
||||
VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */
|
||||
VM_UNUSED5=6, /* was: struct: Set buffer memory thresholds */
|
||||
VM_UNUSED7=7, /* was: struct: Set cache memory thresholds */
|
||||
VM_UNUSED8=8, /* was: struct: Control kswapd behaviour */
|
||||
VM_UNUSED9=9, /* was: struct: Set page table cache parameters */
|
||||
VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */
|
||||
VM_DIRTY_BACKGROUND=11, /* dirty_background_ratio */
|
||||
VM_DIRTY_RATIO=12, /* dirty_ratio */
|
||||
VM_DIRTY_WB_CS=13, /* dirty_writeback_centisecs */
|
||||
VM_DIRTY_EXPIRE_CS=14, /* dirty_expire_centisecs */
|
||||
VM_NR_PDFLUSH_THREADS=15, /* nr_pdflush_threads */
|
||||
VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */
|
||||
VM_PAGEBUF=17, /* struct: Control pagebuf parameters */
|
||||
VM_HUGETLB_PAGES=18, /* int: Number of available Huge Pages */
|
||||
VM_SWAPPINESS=19, /* Tendency to steal mapped memory */
|
||||
VM_LOWMEM_RESERVE_RATIO=20,/* reservation ratio for lower memory zones */
|
||||
VM_MIN_FREE_KBYTES=21, /* Minimum free kilobytes to maintain */
|
||||
VM_MAX_MAP_COUNT=22, /* int: Maximum number of mmaps/address-space */
|
||||
VM_LAPTOP_MODE=23, /* vm laptop mode */
|
||||
VM_BLOCK_DUMP=24, /* block dump mode */
|
||||
VM_HUGETLB_GROUP=25, /* permitted hugetlb group */
|
||||
VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */
|
||||
VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */
|
||||
VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */
|
||||
VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */
|
||||
VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
|
||||
VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
|
||||
VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */
|
||||
VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
|
||||
VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
|
||||
VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
|
||||
};
|
||||
|
||||
|
||||
/* CTL_NET names: */
|
||||
enum
|
||||
{
|
||||
NET_CORE=1,
|
||||
NET_ETHER=2,
|
||||
NET_802=3,
|
||||
NET_UNIX=4,
|
||||
NET_IPV4=5,
|
||||
NET_IPX=6,
|
||||
NET_ATALK=7,
|
||||
NET_NETROM=8,
|
||||
NET_AX25=9,
|
||||
NET_BRIDGE=10,
|
||||
NET_ROSE=11,
|
||||
NET_IPV6=12,
|
||||
NET_X25=13,
|
||||
NET_TR=14,
|
||||
NET_DECNET=15,
|
||||
NET_ECONET=16,
|
||||
NET_SCTP=17,
|
||||
NET_LLC=18,
|
||||
NET_NETFILTER=19,
|
||||
NET_DCCP=20,
|
||||
NET_IRDA=412,
|
||||
};
|
||||
|
||||
/* /proc/sys/kernel/random */
|
||||
enum
|
||||
{
|
||||
RANDOM_POOLSIZE=1,
|
||||
RANDOM_ENTROPY_COUNT=2,
|
||||
RANDOM_READ_THRESH=3,
|
||||
RANDOM_WRITE_THRESH=4,
|
||||
RANDOM_BOOT_ID=5,
|
||||
RANDOM_UUID=6
|
||||
};
|
||||
|
||||
/* /proc/sys/kernel/pty */
|
||||
enum
|
||||
{
|
||||
PTY_MAX=1,
|
||||
PTY_NR=2
|
||||
};
|
||||
|
||||
/* /proc/sys/bus/isa */
|
||||
enum
|
||||
{
|
||||
BUS_ISA_MEM_BASE=1,
|
||||
BUS_ISA_PORT_BASE=2,
|
||||
BUS_ISA_PORT_SHIFT=3
|
||||
};
|
||||
|
||||
/* /proc/sys/net/core */
|
||||
enum
|
||||
{
|
||||
NET_CORE_WMEM_MAX=1,
|
||||
NET_CORE_RMEM_MAX=2,
|
||||
NET_CORE_WMEM_DEFAULT=3,
|
||||
NET_CORE_RMEM_DEFAULT=4,
|
||||
/* was NET_CORE_DESTROY_DELAY */
|
||||
NET_CORE_MAX_BACKLOG=6,
|
||||
NET_CORE_FASTROUTE=7,
|
||||
NET_CORE_MSG_COST=8,
|
||||
NET_CORE_MSG_BURST=9,
|
||||
NET_CORE_OPTMEM_MAX=10,
|
||||
NET_CORE_HOT_LIST_LENGTH=11,
|
||||
NET_CORE_DIVERT_VERSION=12,
|
||||
NET_CORE_NO_CONG_THRESH=13,
|
||||
NET_CORE_NO_CONG=14,
|
||||
NET_CORE_LO_CONG=15,
|
||||
NET_CORE_MOD_CONG=16,
|
||||
NET_CORE_DEV_WEIGHT=17,
|
||||
NET_CORE_SOMAXCONN=18,
|
||||
NET_CORE_BUDGET=19,
|
||||
NET_CORE_AEVENT_ETIME=20,
|
||||
NET_CORE_AEVENT_RSEQTH=21,
|
||||
NET_CORE_WARNINGS=22,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/ethernet */
|
||||
|
||||
/* /proc/sys/net/802 */
|
||||
|
||||
/* /proc/sys/net/unix */
|
||||
|
||||
enum
|
||||
{
|
||||
NET_UNIX_DESTROY_DELAY=1,
|
||||
NET_UNIX_DELETE_DELAY=2,
|
||||
NET_UNIX_MAX_DGRAM_QLEN=3,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/netfilter */
|
||||
enum
|
||||
{
|
||||
NET_NF_CONNTRACK_MAX=1,
|
||||
NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2,
|
||||
NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3,
|
||||
NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4,
|
||||
NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5,
|
||||
NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6,
|
||||
NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7,
|
||||
NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8,
|
||||
NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9,
|
||||
NET_NF_CONNTRACK_UDP_TIMEOUT=10,
|
||||
NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11,
|
||||
NET_NF_CONNTRACK_ICMP_TIMEOUT=12,
|
||||
NET_NF_CONNTRACK_GENERIC_TIMEOUT=13,
|
||||
NET_NF_CONNTRACK_BUCKETS=14,
|
||||
NET_NF_CONNTRACK_LOG_INVALID=15,
|
||||
NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16,
|
||||
NET_NF_CONNTRACK_TCP_LOOSE=17,
|
||||
NET_NF_CONNTRACK_TCP_BE_LIBERAL=18,
|
||||
NET_NF_CONNTRACK_TCP_MAX_RETRANS=19,
|
||||
NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20,
|
||||
NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21,
|
||||
NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22,
|
||||
NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23,
|
||||
NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
|
||||
NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
|
||||
NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
|
||||
NET_NF_CONNTRACK_COUNT=27,
|
||||
NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28,
|
||||
NET_NF_CONNTRACK_FRAG6_TIMEOUT=29,
|
||||
NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30,
|
||||
NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31,
|
||||
NET_NF_CONNTRACK_CHECKSUM=32,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/ipv4 */
|
||||
enum
|
||||
{
|
||||
/* v2.0 compatibile variables */
|
||||
NET_IPV4_FORWARD=8,
|
||||
NET_IPV4_DYNADDR=9,
|
||||
|
||||
NET_IPV4_CONF=16,
|
||||
NET_IPV4_NEIGH=17,
|
||||
NET_IPV4_ROUTE=18,
|
||||
NET_IPV4_FIB_HASH=19,
|
||||
NET_IPV4_NETFILTER=20,
|
||||
|
||||
NET_IPV4_TCP_TIMESTAMPS=33,
|
||||
NET_IPV4_TCP_WINDOW_SCALING=34,
|
||||
NET_IPV4_TCP_SACK=35,
|
||||
NET_IPV4_TCP_RETRANS_COLLAPSE=36,
|
||||
NET_IPV4_DEFAULT_TTL=37,
|
||||
NET_IPV4_AUTOCONFIG=38,
|
||||
NET_IPV4_NO_PMTU_DISC=39,
|
||||
NET_IPV4_TCP_SYN_RETRIES=40,
|
||||
NET_IPV4_IPFRAG_HIGH_THRESH=41,
|
||||
NET_IPV4_IPFRAG_LOW_THRESH=42,
|
||||
NET_IPV4_IPFRAG_TIME=43,
|
||||
NET_IPV4_TCP_MAX_KA_PROBES=44,
|
||||
NET_IPV4_TCP_KEEPALIVE_TIME=45,
|
||||
NET_IPV4_TCP_KEEPALIVE_PROBES=46,
|
||||
NET_IPV4_TCP_RETRIES1=47,
|
||||
NET_IPV4_TCP_RETRIES2=48,
|
||||
NET_IPV4_TCP_FIN_TIMEOUT=49,
|
||||
NET_IPV4_IP_MASQ_DEBUG=50,
|
||||
NET_TCP_SYNCOOKIES=51,
|
||||
NET_TCP_STDURG=52,
|
||||
NET_TCP_RFC1337=53,
|
||||
NET_TCP_SYN_TAILDROP=54,
|
||||
NET_TCP_MAX_SYN_BACKLOG=55,
|
||||
NET_IPV4_LOCAL_PORT_RANGE=56,
|
||||
NET_IPV4_ICMP_ECHO_IGNORE_ALL=57,
|
||||
NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58,
|
||||
NET_IPV4_ICMP_SOURCEQUENCH_RATE=59,
|
||||
NET_IPV4_ICMP_DESTUNREACH_RATE=60,
|
||||
NET_IPV4_ICMP_TIMEEXCEED_RATE=61,
|
||||
NET_IPV4_ICMP_PARAMPROB_RATE=62,
|
||||
NET_IPV4_ICMP_ECHOREPLY_RATE=63,
|
||||
NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64,
|
||||
NET_IPV4_IGMP_MAX_MEMBERSHIPS=65,
|
||||
NET_TCP_TW_RECYCLE=66,
|
||||
NET_IPV4_ALWAYS_DEFRAG=67,
|
||||
NET_IPV4_TCP_KEEPALIVE_INTVL=68,
|
||||
NET_IPV4_INET_PEER_THRESHOLD=69,
|
||||
NET_IPV4_INET_PEER_MINTTL=70,
|
||||
NET_IPV4_INET_PEER_MAXTTL=71,
|
||||
NET_IPV4_INET_PEER_GC_MINTIME=72,
|
||||
NET_IPV4_INET_PEER_GC_MAXTIME=73,
|
||||
NET_TCP_ORPHAN_RETRIES=74,
|
||||
NET_TCP_ABORT_ON_OVERFLOW=75,
|
||||
NET_TCP_SYNACK_RETRIES=76,
|
||||
NET_TCP_MAX_ORPHANS=77,
|
||||
NET_TCP_MAX_TW_BUCKETS=78,
|
||||
NET_TCP_FACK=79,
|
||||
NET_TCP_REORDERING=80,
|
||||
NET_TCP_ECN=81,
|
||||
NET_TCP_DSACK=82,
|
||||
NET_TCP_MEM=83,
|
||||
NET_TCP_WMEM=84,
|
||||
NET_TCP_RMEM=85,
|
||||
NET_TCP_APP_WIN=86,
|
||||
NET_TCP_ADV_WIN_SCALE=87,
|
||||
NET_IPV4_NONLOCAL_BIND=88,
|
||||
NET_IPV4_ICMP_RATELIMIT=89,
|
||||
NET_IPV4_ICMP_RATEMASK=90,
|
||||
NET_TCP_TW_REUSE=91,
|
||||
NET_TCP_FRTO=92,
|
||||
NET_TCP_LOW_LATENCY=93,
|
||||
NET_IPV4_IPFRAG_SECRET_INTERVAL=94,
|
||||
NET_IPV4_IGMP_MAX_MSF=96,
|
||||
NET_TCP_NO_METRICS_SAVE=97,
|
||||
NET_TCP_DEFAULT_WIN_SCALE=105,
|
||||
NET_TCP_MODERATE_RCVBUF=106,
|
||||
NET_TCP_TSO_WIN_DIVISOR=107,
|
||||
NET_TCP_BIC_BETA=108,
|
||||
NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
|
||||
NET_TCP_CONG_CONTROL=110,
|
||||
NET_TCP_ABC=111,
|
||||
NET_IPV4_IPFRAG_MAX_DIST=112,
|
||||
NET_TCP_MTU_PROBING=113,
|
||||
NET_TCP_BASE_MSS=114,
|
||||
NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
|
||||
NET_TCP_DMA_COPYBREAK=116,
|
||||
NET_TCP_SLOW_START_AFTER_IDLE=117,
|
||||
NET_CIPSOV4_CACHE_ENABLE=118,
|
||||
NET_CIPSOV4_CACHE_BUCKET_SIZE=119,
|
||||
NET_CIPSOV4_RBM_OPTFMT=120,
|
||||
NET_CIPSOV4_RBM_STRICTVALID=121,
|
||||
NET_TCP_AVAIL_CONG_CONTROL=122,
|
||||
NET_TCP_ALLOWED_CONG_CONTROL=123,
|
||||
NET_TCP_MAX_SSTHRESH=124,
|
||||
NET_TCP_FRTO_RESPONSE=125,
|
||||
};
|
||||
|
||||
enum {
|
||||
NET_IPV4_ROUTE_FLUSH=1,
|
||||
NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */
|
||||
NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */
|
||||
NET_IPV4_ROUTE_GC_THRESH=4,
|
||||
NET_IPV4_ROUTE_MAX_SIZE=5,
|
||||
NET_IPV4_ROUTE_GC_MIN_INTERVAL=6,
|
||||
NET_IPV4_ROUTE_GC_TIMEOUT=7,
|
||||
NET_IPV4_ROUTE_GC_INTERVAL=8, /* obsolete since 2.6.38 */
|
||||
NET_IPV4_ROUTE_REDIRECT_LOAD=9,
|
||||
NET_IPV4_ROUTE_REDIRECT_NUMBER=10,
|
||||
NET_IPV4_ROUTE_REDIRECT_SILENCE=11,
|
||||
NET_IPV4_ROUTE_ERROR_COST=12,
|
||||
NET_IPV4_ROUTE_ERROR_BURST=13,
|
||||
NET_IPV4_ROUTE_GC_ELASTICITY=14,
|
||||
NET_IPV4_ROUTE_MTU_EXPIRES=15,
|
||||
NET_IPV4_ROUTE_MIN_PMTU=16,
|
||||
NET_IPV4_ROUTE_MIN_ADVMSS=17,
|
||||
NET_IPV4_ROUTE_SECRET_INTERVAL=18,
|
||||
NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
NET_PROTO_CONF_ALL=-2,
|
||||
NET_PROTO_CONF_DEFAULT=-3
|
||||
|
||||
/* And device ifindices ... */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
NET_IPV4_CONF_FORWARDING=1,
|
||||
NET_IPV4_CONF_MC_FORWARDING=2,
|
||||
NET_IPV4_CONF_PROXY_ARP=3,
|
||||
NET_IPV4_CONF_ACCEPT_REDIRECTS=4,
|
||||
NET_IPV4_CONF_SECURE_REDIRECTS=5,
|
||||
NET_IPV4_CONF_SEND_REDIRECTS=6,
|
||||
NET_IPV4_CONF_SHARED_MEDIA=7,
|
||||
NET_IPV4_CONF_RP_FILTER=8,
|
||||
NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9,
|
||||
NET_IPV4_CONF_BOOTP_RELAY=10,
|
||||
NET_IPV4_CONF_LOG_MARTIANS=11,
|
||||
NET_IPV4_CONF_TAG=12,
|
||||
NET_IPV4_CONF_ARPFILTER=13,
|
||||
NET_IPV4_CONF_MEDIUM_ID=14,
|
||||
NET_IPV4_CONF_NOXFRM=15,
|
||||
NET_IPV4_CONF_NOPOLICY=16,
|
||||
NET_IPV4_CONF_FORCE_IGMP_VERSION=17,
|
||||
NET_IPV4_CONF_ARP_ANNOUNCE=18,
|
||||
NET_IPV4_CONF_ARP_IGNORE=19,
|
||||
NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
|
||||
NET_IPV4_CONF_ARP_ACCEPT=21,
|
||||
NET_IPV4_CONF_ARP_NOTIFY=22,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/ipv4/netfilter */
|
||||
enum
|
||||
{
|
||||
NET_IPV4_NF_CONNTRACK_MAX=1,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9,
|
||||
NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT=10,
|
||||
NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11,
|
||||
NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT=12,
|
||||
NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT=13,
|
||||
NET_IPV4_NF_CONNTRACK_BUCKETS=14,
|
||||
NET_IPV4_NF_CONNTRACK_LOG_INVALID=15,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_LOOSE=17,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL=18,
|
||||
NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS=19,
|
||||
NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20,
|
||||
NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21,
|
||||
NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22,
|
||||
NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23,
|
||||
NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
|
||||
NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
|
||||
NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
|
||||
NET_IPV4_NF_CONNTRACK_COUNT=27,
|
||||
NET_IPV4_NF_CONNTRACK_CHECKSUM=28,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/ipv6 */
|
||||
enum {
|
||||
NET_IPV6_CONF=16,
|
||||
NET_IPV6_NEIGH=17,
|
||||
NET_IPV6_ROUTE=18,
|
||||
NET_IPV6_ICMP=19,
|
||||
NET_IPV6_BINDV6ONLY=20,
|
||||
NET_IPV6_IP6FRAG_HIGH_THRESH=21,
|
||||
NET_IPV6_IP6FRAG_LOW_THRESH=22,
|
||||
NET_IPV6_IP6FRAG_TIME=23,
|
||||
NET_IPV6_IP6FRAG_SECRET_INTERVAL=24,
|
||||
NET_IPV6_MLD_MAX_MSF=25,
|
||||
};
|
||||
|
||||
enum {
|
||||
NET_IPV6_ROUTE_FLUSH=1,
|
||||
NET_IPV6_ROUTE_GC_THRESH=2,
|
||||
NET_IPV6_ROUTE_MAX_SIZE=3,
|
||||
NET_IPV6_ROUTE_GC_MIN_INTERVAL=4,
|
||||
NET_IPV6_ROUTE_GC_TIMEOUT=5,
|
||||
NET_IPV6_ROUTE_GC_INTERVAL=6,
|
||||
NET_IPV6_ROUTE_GC_ELASTICITY=7,
|
||||
NET_IPV6_ROUTE_MTU_EXPIRES=8,
|
||||
NET_IPV6_ROUTE_MIN_ADVMSS=9,
|
||||
NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS=10
|
||||
};
|
||||
|
||||
enum {
|
||||
NET_IPV6_FORWARDING=1,
|
||||
NET_IPV6_HOP_LIMIT=2,
|
||||
NET_IPV6_MTU=3,
|
||||
NET_IPV6_ACCEPT_RA=4,
|
||||
NET_IPV6_ACCEPT_REDIRECTS=5,
|
||||
NET_IPV6_AUTOCONF=6,
|
||||
NET_IPV6_DAD_TRANSMITS=7,
|
||||
NET_IPV6_RTR_SOLICITS=8,
|
||||
NET_IPV6_RTR_SOLICIT_INTERVAL=9,
|
||||
NET_IPV6_RTR_SOLICIT_DELAY=10,
|
||||
NET_IPV6_USE_TEMPADDR=11,
|
||||
NET_IPV6_TEMP_VALID_LFT=12,
|
||||
NET_IPV6_TEMP_PREFERED_LFT=13,
|
||||
NET_IPV6_REGEN_MAX_RETRY=14,
|
||||
NET_IPV6_MAX_DESYNC_FACTOR=15,
|
||||
NET_IPV6_MAX_ADDRESSES=16,
|
||||
NET_IPV6_FORCE_MLD_VERSION=17,
|
||||
NET_IPV6_ACCEPT_RA_DEFRTR=18,
|
||||
NET_IPV6_ACCEPT_RA_PINFO=19,
|
||||
NET_IPV6_ACCEPT_RA_RTR_PREF=20,
|
||||
NET_IPV6_RTR_PROBE_INTERVAL=21,
|
||||
NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
|
||||
NET_IPV6_PROXY_NDP=23,
|
||||
NET_IPV6_ACCEPT_SOURCE_ROUTE=25,
|
||||
NET_IPV6_ACCEPT_RA_FROM_LOCAL=26,
|
||||
NET_IPV6_ACCEPT_RA_RT_INFO_MIN_PLEN=27,
|
||||
__NET_IPV6_MAX
|
||||
};
|
||||
|
||||
/* /proc/sys/net/ipv6/icmp */
|
||||
enum {
|
||||
NET_IPV6_ICMP_RATELIMIT=1
|
||||
};
|
||||
|
||||
/* /proc/sys/net/<protocol>/neigh/<dev> */
|
||||
enum {
|
||||
NET_NEIGH_MCAST_SOLICIT=1,
|
||||
NET_NEIGH_UCAST_SOLICIT=2,
|
||||
NET_NEIGH_APP_SOLICIT=3,
|
||||
NET_NEIGH_RETRANS_TIME=4,
|
||||
NET_NEIGH_REACHABLE_TIME=5,
|
||||
NET_NEIGH_DELAY_PROBE_TIME=6,
|
||||
NET_NEIGH_GC_STALE_TIME=7,
|
||||
NET_NEIGH_UNRES_QLEN=8,
|
||||
NET_NEIGH_PROXY_QLEN=9,
|
||||
NET_NEIGH_ANYCAST_DELAY=10,
|
||||
NET_NEIGH_PROXY_DELAY=11,
|
||||
NET_NEIGH_LOCKTIME=12,
|
||||
NET_NEIGH_GC_INTERVAL=13,
|
||||
NET_NEIGH_GC_THRESH1=14,
|
||||
NET_NEIGH_GC_THRESH2=15,
|
||||
NET_NEIGH_GC_THRESH3=16,
|
||||
NET_NEIGH_RETRANS_TIME_MS=17,
|
||||
NET_NEIGH_REACHABLE_TIME_MS=18,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/dccp */
|
||||
enum {
|
||||
NET_DCCP_DEFAULT=1,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/ipx */
|
||||
enum {
|
||||
NET_IPX_PPROP_BROADCASTING=1,
|
||||
NET_IPX_FORWARDING=2
|
||||
};
|
||||
|
||||
/* /proc/sys/net/llc */
|
||||
enum {
|
||||
NET_LLC2=1,
|
||||
NET_LLC_STATION=2,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/llc/llc2 */
|
||||
enum {
|
||||
NET_LLC2_TIMEOUT=1,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/llc/station */
|
||||
enum {
|
||||
NET_LLC_STATION_ACK_TIMEOUT=1,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/llc/llc2/timeout */
|
||||
enum {
|
||||
NET_LLC2_ACK_TIMEOUT=1,
|
||||
NET_LLC2_P_TIMEOUT=2,
|
||||
NET_LLC2_REJ_TIMEOUT=3,
|
||||
NET_LLC2_BUSY_TIMEOUT=4,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/appletalk */
|
||||
enum {
|
||||
NET_ATALK_AARP_EXPIRY_TIME=1,
|
||||
NET_ATALK_AARP_TICK_TIME=2,
|
||||
NET_ATALK_AARP_RETRANSMIT_LIMIT=3,
|
||||
NET_ATALK_AARP_RESOLVE_TIME=4
|
||||
};
|
||||
|
||||
|
||||
/* /proc/sys/net/netrom */
|
||||
enum {
|
||||
NET_NETROM_DEFAULT_PATH_QUALITY=1,
|
||||
NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2,
|
||||
NET_NETROM_NETWORK_TTL_INITIALISER=3,
|
||||
NET_NETROM_TRANSPORT_TIMEOUT=4,
|
||||
NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5,
|
||||
NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6,
|
||||
NET_NETROM_TRANSPORT_BUSY_DELAY=7,
|
||||
NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8,
|
||||
NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9,
|
||||
NET_NETROM_ROUTING_CONTROL=10,
|
||||
NET_NETROM_LINK_FAILS_COUNT=11,
|
||||
NET_NETROM_RESET=12
|
||||
};
|
||||
|
||||
/* /proc/sys/net/ax25 */
|
||||
enum {
|
||||
NET_AX25_IP_DEFAULT_MODE=1,
|
||||
NET_AX25_DEFAULT_MODE=2,
|
||||
NET_AX25_BACKOFF_TYPE=3,
|
||||
NET_AX25_CONNECT_MODE=4,
|
||||
NET_AX25_STANDARD_WINDOW=5,
|
||||
NET_AX25_EXTENDED_WINDOW=6,
|
||||
NET_AX25_T1_TIMEOUT=7,
|
||||
NET_AX25_T2_TIMEOUT=8,
|
||||
NET_AX25_T3_TIMEOUT=9,
|
||||
NET_AX25_IDLE_TIMEOUT=10,
|
||||
NET_AX25_N2=11,
|
||||
NET_AX25_PACLEN=12,
|
||||
NET_AX25_PROTOCOL=13,
|
||||
NET_AX25_DAMA_SLAVE_TIMEOUT=14
|
||||
};
|
||||
|
||||
/* /proc/sys/net/rose */
|
||||
enum {
|
||||
NET_ROSE_RESTART_REQUEST_TIMEOUT=1,
|
||||
NET_ROSE_CALL_REQUEST_TIMEOUT=2,
|
||||
NET_ROSE_RESET_REQUEST_TIMEOUT=3,
|
||||
NET_ROSE_CLEAR_REQUEST_TIMEOUT=4,
|
||||
NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5,
|
||||
NET_ROSE_ROUTING_CONTROL=6,
|
||||
NET_ROSE_LINK_FAIL_TIMEOUT=7,
|
||||
NET_ROSE_MAX_VCS=8,
|
||||
NET_ROSE_WINDOW_SIZE=9,
|
||||
NET_ROSE_NO_ACTIVITY_TIMEOUT=10
|
||||
};
|
||||
|
||||
/* /proc/sys/net/x25 */
|
||||
enum {
|
||||
NET_X25_RESTART_REQUEST_TIMEOUT=1,
|
||||
NET_X25_CALL_REQUEST_TIMEOUT=2,
|
||||
NET_X25_RESET_REQUEST_TIMEOUT=3,
|
||||
NET_X25_CLEAR_REQUEST_TIMEOUT=4,
|
||||
NET_X25_ACK_HOLD_BACK_TIMEOUT=5,
|
||||
NET_X25_FORWARD=6
|
||||
};
|
||||
|
||||
/* /proc/sys/net/token-ring */
|
||||
enum
|
||||
{
|
||||
NET_TR_RIF_TIMEOUT=1
|
||||
};
|
||||
|
||||
/* /proc/sys/net/decnet/ */
|
||||
enum {
|
||||
NET_DECNET_NODE_TYPE = 1,
|
||||
NET_DECNET_NODE_ADDRESS = 2,
|
||||
NET_DECNET_NODE_NAME = 3,
|
||||
NET_DECNET_DEFAULT_DEVICE = 4,
|
||||
NET_DECNET_TIME_WAIT = 5,
|
||||
NET_DECNET_DN_COUNT = 6,
|
||||
NET_DECNET_DI_COUNT = 7,
|
||||
NET_DECNET_DR_COUNT = 8,
|
||||
NET_DECNET_DST_GC_INTERVAL = 9,
|
||||
NET_DECNET_CONF = 10,
|
||||
NET_DECNET_NO_FC_MAX_CWND = 11,
|
||||
NET_DECNET_MEM = 12,
|
||||
NET_DECNET_RMEM = 13,
|
||||
NET_DECNET_WMEM = 14,
|
||||
NET_DECNET_DEBUG_LEVEL = 255
|
||||
};
|
||||
|
||||
/* /proc/sys/net/decnet/conf/<dev> */
|
||||
enum {
|
||||
NET_DECNET_CONF_LOOPBACK = -2,
|
||||
NET_DECNET_CONF_DDCMP = -3,
|
||||
NET_DECNET_CONF_PPP = -4,
|
||||
NET_DECNET_CONF_X25 = -5,
|
||||
NET_DECNET_CONF_GRE = -6,
|
||||
NET_DECNET_CONF_ETHER = -7
|
||||
|
||||
/* ... and ifindex of devices */
|
||||
};
|
||||
|
||||
/* /proc/sys/net/decnet/conf/<dev>/ */
|
||||
enum {
|
||||
NET_DECNET_CONF_DEV_PRIORITY = 1,
|
||||
NET_DECNET_CONF_DEV_T1 = 2,
|
||||
NET_DECNET_CONF_DEV_T2 = 3,
|
||||
NET_DECNET_CONF_DEV_T3 = 4,
|
||||
NET_DECNET_CONF_DEV_FORWARDING = 5,
|
||||
NET_DECNET_CONF_DEV_BLKSIZE = 6,
|
||||
NET_DECNET_CONF_DEV_STATE = 7
|
||||
};
|
||||
|
||||
/* /proc/sys/net/sctp */
|
||||
enum {
|
||||
NET_SCTP_RTO_INITIAL = 1,
|
||||
NET_SCTP_RTO_MIN = 2,
|
||||
NET_SCTP_RTO_MAX = 3,
|
||||
NET_SCTP_RTO_ALPHA = 4,
|
||||
NET_SCTP_RTO_BETA = 5,
|
||||
NET_SCTP_VALID_COOKIE_LIFE = 6,
|
||||
NET_SCTP_ASSOCIATION_MAX_RETRANS = 7,
|
||||
NET_SCTP_PATH_MAX_RETRANS = 8,
|
||||
NET_SCTP_MAX_INIT_RETRANSMITS = 9,
|
||||
NET_SCTP_HB_INTERVAL = 10,
|
||||
NET_SCTP_PRESERVE_ENABLE = 11,
|
||||
NET_SCTP_MAX_BURST = 12,
|
||||
NET_SCTP_ADDIP_ENABLE = 13,
|
||||
NET_SCTP_PRSCTP_ENABLE = 14,
|
||||
NET_SCTP_SNDBUF_POLICY = 15,
|
||||
NET_SCTP_SACK_TIMEOUT = 16,
|
||||
NET_SCTP_RCVBUF_POLICY = 17,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/bridge */
|
||||
enum {
|
||||
NET_BRIDGE_NF_CALL_ARPTABLES = 1,
|
||||
NET_BRIDGE_NF_CALL_IPTABLES = 2,
|
||||
NET_BRIDGE_NF_CALL_IP6TABLES = 3,
|
||||
NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
|
||||
NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
|
||||
};
|
||||
|
||||
/* proc/sys/net/irda */
|
||||
enum {
|
||||
NET_IRDA_DISCOVERY=1,
|
||||
NET_IRDA_DEVNAME=2,
|
||||
NET_IRDA_DEBUG=3,
|
||||
NET_IRDA_FAST_POLL=4,
|
||||
NET_IRDA_DISCOVERY_SLOTS=5,
|
||||
NET_IRDA_DISCOVERY_TIMEOUT=6,
|
||||
NET_IRDA_SLOT_TIMEOUT=7,
|
||||
NET_IRDA_MAX_BAUD_RATE=8,
|
||||
NET_IRDA_MIN_TX_TURN_TIME=9,
|
||||
NET_IRDA_MAX_TX_DATA_SIZE=10,
|
||||
NET_IRDA_MAX_TX_WINDOW=11,
|
||||
NET_IRDA_MAX_NOREPLY_TIME=12,
|
||||
NET_IRDA_WARN_NOREPLY_TIME=13,
|
||||
NET_IRDA_LAP_KEEPALIVE_TIME=14,
|
||||
};
|
||||
|
||||
|
||||
/* CTL_FS names: */
|
||||
enum
|
||||
{
|
||||
FS_NRINODE=1, /* int:current number of allocated inodes */
|
||||
FS_STATINODE=2,
|
||||
FS_MAXINODE=3, /* int:maximum number of inodes that can be allocated */
|
||||
FS_NRDQUOT=4, /* int:current number of allocated dquots */
|
||||
FS_MAXDQUOT=5, /* int:maximum number of dquots that can be allocated */
|
||||
FS_NRFILE=6, /* int:current number of allocated filedescriptors */
|
||||
FS_MAXFILE=7, /* int:maximum number of filedescriptors that can be allocated */
|
||||
FS_DENTRY=8,
|
||||
FS_NRSUPER=9, /* int:current number of allocated super_blocks */
|
||||
FS_MAXSUPER=10, /* int:maximum number of super_blocks that can be allocated */
|
||||
FS_OVERFLOWUID=11, /* int: overflow UID */
|
||||
FS_OVERFLOWGID=12, /* int: overflow GID */
|
||||
FS_LEASES=13, /* int: leases enabled */
|
||||
FS_DIR_NOTIFY=14, /* int: directory notification enabled */
|
||||
FS_LEASE_TIME=15, /* int: maximum time to wait for a lease break */
|
||||
FS_DQSTATS=16, /* disc quota usage statistics and control */
|
||||
FS_XFS=17, /* struct: control xfs parameters */
|
||||
FS_AIO_NR=18, /* current system-wide number of aio requests */
|
||||
FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */
|
||||
FS_INOTIFY=20, /* inotify submenu */
|
||||
FS_OCFS2=988, /* ocfs2 */
|
||||
};
|
||||
|
||||
/* /proc/sys/fs/quota/ */
|
||||
enum {
|
||||
FS_DQ_LOOKUPS = 1,
|
||||
FS_DQ_DROPS = 2,
|
||||
FS_DQ_READS = 3,
|
||||
FS_DQ_WRITES = 4,
|
||||
FS_DQ_CACHE_HITS = 5,
|
||||
FS_DQ_ALLOCATED = 6,
|
||||
FS_DQ_FREE = 7,
|
||||
FS_DQ_SYNCS = 8,
|
||||
FS_DQ_WARNINGS = 9,
|
||||
};
|
||||
|
||||
/* CTL_DEBUG names: */
|
||||
|
||||
/* CTL_DEV names: */
|
||||
enum {
|
||||
DEV_CDROM=1,
|
||||
DEV_HWMON=2,
|
||||
DEV_PARPORT=3,
|
||||
DEV_RAID=4,
|
||||
DEV_MAC_HID=5,
|
||||
DEV_SCSI=6,
|
||||
DEV_IPMI=7,
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/cdrom */
|
||||
enum {
|
||||
DEV_CDROM_INFO=1,
|
||||
DEV_CDROM_AUTOCLOSE=2,
|
||||
DEV_CDROM_AUTOEJECT=3,
|
||||
DEV_CDROM_DEBUG=4,
|
||||
DEV_CDROM_LOCK=5,
|
||||
DEV_CDROM_CHECK_MEDIA=6
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/parport */
|
||||
enum {
|
||||
DEV_PARPORT_DEFAULT=-3
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/raid */
|
||||
enum {
|
||||
DEV_RAID_SPEED_LIMIT_MIN=1,
|
||||
DEV_RAID_SPEED_LIMIT_MAX=2
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/parport/default */
|
||||
enum {
|
||||
DEV_PARPORT_DEFAULT_TIMESLICE=1,
|
||||
DEV_PARPORT_DEFAULT_SPINTIME=2
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/parport/parport n */
|
||||
enum {
|
||||
DEV_PARPORT_SPINTIME=1,
|
||||
DEV_PARPORT_BASE_ADDR=2,
|
||||
DEV_PARPORT_IRQ=3,
|
||||
DEV_PARPORT_DMA=4,
|
||||
DEV_PARPORT_MODES=5,
|
||||
DEV_PARPORT_DEVICES=6,
|
||||
DEV_PARPORT_AUTOPROBE=16
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/parport/parport n/devices/ */
|
||||
enum {
|
||||
DEV_PARPORT_DEVICES_ACTIVE=-3,
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/parport/parport n/devices/device n */
|
||||
enum {
|
||||
DEV_PARPORT_DEVICE_TIMESLICE=1,
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/mac_hid */
|
||||
enum {
|
||||
DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1,
|
||||
DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2,
|
||||
DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3,
|
||||
DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4,
|
||||
DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
|
||||
DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/scsi */
|
||||
enum {
|
||||
DEV_SCSI_LOGGING_LEVEL=1,
|
||||
};
|
||||
|
||||
/* /proc/sys/dev/ipmi */
|
||||
enum {
|
||||
DEV_IPMI_POWEROFF_POWERCYCLE=1,
|
||||
};
|
||||
|
||||
/* /proc/sys/abi */
|
||||
enum
|
||||
{
|
||||
ABI_DEFHANDLER_COFF=1, /* default handler for coff binaries */
|
||||
ABI_DEFHANDLER_ELF=2, /* default handler for ELF binaries */
|
||||
ABI_DEFHANDLER_LCALL7=3,/* default handler for procs using lcall7 */
|
||||
ABI_DEFHANDLER_LIBCSO=4,/* default handler for an libc.so ELF interp */
|
||||
ABI_TRACE=5, /* tracing flags */
|
||||
ABI_FAKE_UTSNAME=6, /* fake target utsname information */
|
||||
};
|
||||
|
||||
|
||||
#endif /* _LINUX_SYSCTL_H */
|
25
contrib/libc-headers/linux/sysinfo.h
Normal file
25
contrib/libc-headers/linux/sysinfo.h
Normal file
@ -0,0 +1,25 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_SYSINFO_H
|
||||
#define _LINUX_SYSINFO_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define SI_LOAD_SHIFT 16
|
||||
struct sysinfo {
|
||||
__kernel_long_t uptime; /* Seconds since boot */
|
||||
__kernel_ulong_t loads[3]; /* 1, 5, and 15 minute load averages */
|
||||
__kernel_ulong_t totalram; /* Total usable main memory size */
|
||||
__kernel_ulong_t freeram; /* Available memory size */
|
||||
__kernel_ulong_t sharedram; /* Amount of shared memory */
|
||||
__kernel_ulong_t bufferram; /* Memory used by buffers */
|
||||
__kernel_ulong_t totalswap; /* Total swap space size */
|
||||
__kernel_ulong_t freeswap; /* swap space still available */
|
||||
__u16 procs; /* Number of current processes */
|
||||
__u16 pad; /* Explicit padding for m68k */
|
||||
__kernel_ulong_t totalhigh; /* Total high memory size */
|
||||
__kernel_ulong_t freehigh; /* Available high memory size */
|
||||
__u32 mem_unit; /* Memory unit size in bytes */
|
||||
char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; /* Padding: libc5 uses this.. */
|
||||
};
|
||||
|
||||
#endif /* _LINUX_SYSINFO_H */
|
214
contrib/libc-headers/linux/taskstats.h
Normal file
214
contrib/libc-headers/linux/taskstats.h
Normal file
@ -0,0 +1,214 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */
|
||||
/* taskstats.h - exporting per-task statistics
|
||||
*
|
||||
* Copyright (C) Shailabh Nagar, IBM Corp. 2006
|
||||
* (C) Balbir Singh, IBM Corp. 2006
|
||||
* (C) Jay Lan, SGI, 2006
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2.1 of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it would be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_TASKSTATS_H
|
||||
#define _LINUX_TASKSTATS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Format for per-task data returned to userland when
|
||||
* - a task exits
|
||||
* - listener requests stats for a task
|
||||
*
|
||||
* The struct is versioned. Newer versions should only add fields to
|
||||
* the bottom of the struct to maintain backward compatibility.
|
||||
*
|
||||
*
|
||||
* To add new fields
|
||||
* a) bump up TASKSTATS_VERSION
|
||||
* b) add comment indicating new version number at end of struct
|
||||
* c) add new fields after version comment; maintain 64-bit alignment
|
||||
*/
|
||||
|
||||
|
||||
#define TASKSTATS_VERSION 8
|
||||
#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
|
||||
* in linux/sched.h */
|
||||
|
||||
struct taskstats {
|
||||
|
||||
/* The version number of this struct. This field is always set to
|
||||
* TAKSTATS_VERSION, which is defined in <linux/taskstats.h>.
|
||||
* Each time the struct is changed, the value should be incremented.
|
||||
*/
|
||||
__u16 version;
|
||||
__u32 ac_exitcode; /* Exit status */
|
||||
|
||||
/* The accounting flags of a task as defined in <linux/acct.h>
|
||||
* Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG.
|
||||
*/
|
||||
__u8 ac_flag; /* Record flags */
|
||||
__u8 ac_nice; /* task_nice */
|
||||
|
||||
/* Delay accounting fields start
|
||||
*
|
||||
* All values, until comment "Delay accounting fields end" are
|
||||
* available only if delay accounting is enabled, even though the last
|
||||
* few fields are not delays
|
||||
*
|
||||
* xxx_count is the number of delay values recorded
|
||||
* xxx_delay_total is the corresponding cumulative delay in nanoseconds
|
||||
*
|
||||
* xxx_delay_total wraps around to zero on overflow
|
||||
* xxx_count incremented regardless of overflow
|
||||
*/
|
||||
|
||||
/* Delay waiting for cpu, while runnable
|
||||
* count, delay_total NOT updated atomically
|
||||
*/
|
||||
__u64 cpu_count __attribute__((aligned(8)));
|
||||
__u64 cpu_delay_total;
|
||||
|
||||
/* Following four fields atomically updated using task->delays->lock */
|
||||
|
||||
/* Delay waiting for synchronous block I/O to complete
|
||||
* does not account for delays in I/O submission
|
||||
*/
|
||||
__u64 blkio_count;
|
||||
__u64 blkio_delay_total;
|
||||
|
||||
/* Delay waiting for page fault I/O (swap in only) */
|
||||
__u64 swapin_count;
|
||||
__u64 swapin_delay_total;
|
||||
|
||||
/* cpu "wall-clock" running time
|
||||
* On some architectures, value will adjust for cpu time stolen
|
||||
* from the kernel in involuntary waits due to virtualization.
|
||||
* Value is cumulative, in nanoseconds, without a corresponding count
|
||||
* and wraps around to zero silently on overflow
|
||||
*/
|
||||
__u64 cpu_run_real_total;
|
||||
|
||||
/* cpu "virtual" running time
|
||||
* Uses time intervals seen by the kernel i.e. no adjustment
|
||||
* for kernel's involuntary waits due to virtualization.
|
||||
* Value is cumulative, in nanoseconds, without a corresponding count
|
||||
* and wraps around to zero silently on overflow
|
||||
*/
|
||||
__u64 cpu_run_virtual_total;
|
||||
/* Delay accounting fields end */
|
||||
/* version 1 ends here */
|
||||
|
||||
/* Basic Accounting Fields start */
|
||||
char ac_comm[TS_COMM_LEN]; /* Command name */
|
||||
__u8 ac_sched __attribute__((aligned(8)));
|
||||
/* Scheduling discipline */
|
||||
__u8 ac_pad[3];
|
||||
__u32 ac_uid __attribute__((aligned(8)));
|
||||
/* User ID */
|
||||
__u32 ac_gid; /* Group ID */
|
||||
__u32 ac_pid; /* Process ID */
|
||||
__u32 ac_ppid; /* Parent process ID */
|
||||
__u32 ac_btime; /* Begin time [sec since 1970] */
|
||||
__u64 ac_etime __attribute__((aligned(8)));
|
||||
/* Elapsed time [usec] */
|
||||
__u64 ac_utime; /* User CPU time [usec] */
|
||||
__u64 ac_stime; /* SYstem CPU time [usec] */
|
||||
__u64 ac_minflt; /* Minor Page Fault Count */
|
||||
__u64 ac_majflt; /* Major Page Fault Count */
|
||||
/* Basic Accounting Fields end */
|
||||
|
||||
/* Extended accounting fields start */
|
||||
/* Accumulated RSS usage in duration of a task, in MBytes-usecs.
|
||||
* The current rss usage is added to this counter every time
|
||||
* a tick is charged to a task's system time. So, at the end we
|
||||
* will have memory usage multiplied by system time. Thus an
|
||||
* average usage per system time unit can be calculated.
|
||||
*/
|
||||
__u64 coremem; /* accumulated RSS usage in MB-usec */
|
||||
/* Accumulated virtual memory usage in duration of a task.
|
||||
* Same as acct_rss_mem1 above except that we keep track of VM usage.
|
||||
*/
|
||||
__u64 virtmem; /* accumulated VM usage in MB-usec */
|
||||
|
||||
/* High watermark of RSS and virtual memory usage in duration of
|
||||
* a task, in KBytes.
|
||||
*/
|
||||
__u64 hiwater_rss; /* High-watermark of RSS usage, in KB */
|
||||
__u64 hiwater_vm; /* High-water VM usage, in KB */
|
||||
|
||||
/* The following four fields are I/O statistics of a task. */
|
||||
__u64 read_char; /* bytes read */
|
||||
__u64 write_char; /* bytes written */
|
||||
__u64 read_syscalls; /* read syscalls */
|
||||
__u64 write_syscalls; /* write syscalls */
|
||||
/* Extended accounting fields end */
|
||||
|
||||
#define TASKSTATS_HAS_IO_ACCOUNTING
|
||||
/* Per-task storage I/O accounting starts */
|
||||
__u64 read_bytes; /* bytes of read I/O */
|
||||
__u64 write_bytes; /* bytes of write I/O */
|
||||
__u64 cancelled_write_bytes; /* bytes of cancelled write I/O */
|
||||
|
||||
__u64 nvcsw; /* voluntary_ctxt_switches */
|
||||
__u64 nivcsw; /* nonvoluntary_ctxt_switches */
|
||||
|
||||
/* time accounting for SMT machines */
|
||||
__u64 ac_utimescaled; /* utime scaled on frequency etc */
|
||||
__u64 ac_stimescaled; /* stime scaled on frequency etc */
|
||||
__u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */
|
||||
|
||||
/* Delay waiting for memory reclaim */
|
||||
__u64 freepages_count;
|
||||
__u64 freepages_delay_total;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Commands sent from userspace
|
||||
* Not versioned. New commands should only be inserted at the enum's end
|
||||
* prior to __TASKSTATS_CMD_MAX
|
||||
*/
|
||||
|
||||
enum {
|
||||
TASKSTATS_CMD_UNSPEC = 0, /* Reserved */
|
||||
TASKSTATS_CMD_GET, /* user->kernel request/get-response */
|
||||
TASKSTATS_CMD_NEW, /* kernel->user event */
|
||||
__TASKSTATS_CMD_MAX,
|
||||
};
|
||||
|
||||
#define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1)
|
||||
|
||||
enum {
|
||||
TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */
|
||||
TASKSTATS_TYPE_PID, /* Process id */
|
||||
TASKSTATS_TYPE_TGID, /* Thread group id */
|
||||
TASKSTATS_TYPE_STATS, /* taskstats structure */
|
||||
TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */
|
||||
TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */
|
||||
TASKSTATS_TYPE_NULL, /* contains nothing */
|
||||
__TASKSTATS_TYPE_MAX,
|
||||
};
|
||||
|
||||
#define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1)
|
||||
|
||||
enum {
|
||||
TASKSTATS_CMD_ATTR_UNSPEC = 0,
|
||||
TASKSTATS_CMD_ATTR_PID,
|
||||
TASKSTATS_CMD_ATTR_TGID,
|
||||
TASKSTATS_CMD_ATTR_REGISTER_CPUMASK,
|
||||
TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK,
|
||||
__TASKSTATS_CMD_ATTR_MAX,
|
||||
};
|
||||
|
||||
#define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1)
|
||||
|
||||
/* NETLINK_GENERIC related info */
|
||||
|
||||
#define TASKSTATS_GENL_NAME "TASKSTATS"
|
||||
#define TASKSTATS_GENL_VERSION 0x1
|
||||
|
||||
#endif /* _LINUX_TASKSTATS_H */
|
48
contrib/libc-headers/linux/types.h
Normal file
48
contrib/libc-headers/linux/types.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_TYPES_H
|
||||
#define _LINUX_TYPES_H
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/posix_types.h>
|
||||
|
||||
|
||||
/*
|
||||
* Below are truly Linux-specific types that should never collide with
|
||||
* any application/library that wants linux/types.h.
|
||||
*/
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#define __bitwise__ __attribute__((bitwise))
|
||||
#else
|
||||
#define __bitwise__
|
||||
#endif
|
||||
#define __bitwise __bitwise__
|
||||
|
||||
typedef __u16 __bitwise __le16;
|
||||
typedef __u16 __bitwise __be16;
|
||||
typedef __u32 __bitwise __le32;
|
||||
typedef __u32 __bitwise __be32;
|
||||
typedef __u64 __bitwise __le64;
|
||||
typedef __u64 __bitwise __be64;
|
||||
|
||||
typedef __u16 __bitwise __sum16;
|
||||
typedef __u32 __bitwise __wsum;
|
||||
|
||||
/*
|
||||
* aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
|
||||
* common 32/64-bit compat problems.
|
||||
* 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
|
||||
* architectures) and to 8-byte boundaries on 64-bit architectures. The new
|
||||
* aligned_64 type enforces 8-byte alignment so that structs containing
|
||||
* aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
|
||||
* No conversions are necessary between 32-bit user-space and a 64-bit kernel.
|
||||
*/
|
||||
#define __aligned_u64 __u64 __attribute__((aligned(8)))
|
||||
#define __aligned_be64 __be64 __attribute__((aligned(8)))
|
||||
#define __aligned_le64 __le64 __attribute__((aligned(8)))
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _LINUX_TYPES_H */
|
197
contrib/libc-headers/locale.h
Normal file
197
contrib/libc-headers/locale.h
Normal file
@ -0,0 +1,197 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.11 Localization <locale.h>
|
||||
*/
|
||||
|
||||
#ifndef _LOCALE_H
|
||||
#define _LOCALE_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
#include <bits/locale.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* These are the possibilities for the first argument to setlocale.
|
||||
The code assumes that the lowest LC_* symbol has the value zero. */
|
||||
#define LC_CTYPE __LC_CTYPE
|
||||
#define LC_NUMERIC __LC_NUMERIC
|
||||
#define LC_TIME __LC_TIME
|
||||
#define LC_COLLATE __LC_COLLATE
|
||||
#define LC_MONETARY __LC_MONETARY
|
||||
#define LC_MESSAGES __LC_MESSAGES
|
||||
#define LC_ALL __LC_ALL
|
||||
#define LC_PAPER __LC_PAPER
|
||||
#define LC_NAME __LC_NAME
|
||||
#define LC_ADDRESS __LC_ADDRESS
|
||||
#define LC_TELEPHONE __LC_TELEPHONE
|
||||
#define LC_MEASUREMENT __LC_MEASUREMENT
|
||||
#define LC_IDENTIFICATION __LC_IDENTIFICATION
|
||||
|
||||
|
||||
/* Structure giving information about numeric and monetary notation. */
|
||||
struct lconv
|
||||
{
|
||||
/* Numeric (non-monetary) information. */
|
||||
|
||||
char *decimal_point; /* Decimal point character. */
|
||||
char *thousands_sep; /* Thousands separator. */
|
||||
/* Each element is the number of digits in each group;
|
||||
elements with higher indices are farther left.
|
||||
An element with value CHAR_MAX means that no further grouping is done.
|
||||
An element with value 0 means that the previous element is used
|
||||
for all groups farther left. */
|
||||
char *grouping;
|
||||
|
||||
/* Monetary information. */
|
||||
|
||||
/* First three chars are a currency symbol from ISO 4217.
|
||||
Fourth char is the separator. Fifth char is '\0'. */
|
||||
char *int_curr_symbol;
|
||||
char *currency_symbol; /* Local currency symbol. */
|
||||
char *mon_decimal_point; /* Decimal point character. */
|
||||
char *mon_thousands_sep; /* Thousands separator. */
|
||||
char *mon_grouping; /* Like `grouping' element (above). */
|
||||
char *positive_sign; /* Sign for positive values. */
|
||||
char *negative_sign; /* Sign for negative values. */
|
||||
char int_frac_digits; /* Int'l fractional digits. */
|
||||
char frac_digits; /* Local fractional digits. */
|
||||
/* 1 if currency_symbol precedes a positive value, 0 if succeeds. */
|
||||
char p_cs_precedes;
|
||||
/* 1 iff a space separates currency_symbol from a positive value. */
|
||||
char p_sep_by_space;
|
||||
/* 1 if currency_symbol precedes a negative value, 0 if succeeds. */
|
||||
char n_cs_precedes;
|
||||
/* 1 iff a space separates currency_symbol from a negative value. */
|
||||
char n_sep_by_space;
|
||||
/* Positive and negative sign positions:
|
||||
0 Parentheses surround the quantity and currency_symbol.
|
||||
1 The sign string precedes the quantity and currency_symbol.
|
||||
2 The sign string follows the quantity and currency_symbol.
|
||||
3 The sign string immediately precedes the currency_symbol.
|
||||
4 The sign string immediately follows the currency_symbol. */
|
||||
char p_sign_posn;
|
||||
char n_sign_posn;
|
||||
#ifdef __USE_ISOC99
|
||||
/* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */
|
||||
char int_p_cs_precedes;
|
||||
/* 1 iff a space separates int_curr_symbol from a positive value. */
|
||||
char int_p_sep_by_space;
|
||||
/* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */
|
||||
char int_n_cs_precedes;
|
||||
/* 1 iff a space separates int_curr_symbol from a negative value. */
|
||||
char int_n_sep_by_space;
|
||||
/* Positive and negative sign positions:
|
||||
0 Parentheses surround the quantity and int_curr_symbol.
|
||||
1 The sign string precedes the quantity and int_curr_symbol.
|
||||
2 The sign string follows the quantity and int_curr_symbol.
|
||||
3 The sign string immediately precedes the int_curr_symbol.
|
||||
4 The sign string immediately follows the int_curr_symbol. */
|
||||
char int_p_sign_posn;
|
||||
char int_n_sign_posn;
|
||||
#else
|
||||
char __int_p_cs_precedes;
|
||||
char __int_p_sep_by_space;
|
||||
char __int_n_cs_precedes;
|
||||
char __int_n_sep_by_space;
|
||||
char __int_p_sign_posn;
|
||||
char __int_n_sign_posn;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/* 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 (void) __THROW;
|
||||
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* POSIX.1-2008 extends the locale interface with functions for
|
||||
explicit creation and manipulation of 'locale_t' objects
|
||||
representing locale contexts, and a set of parallel
|
||||
locale-sensitive text processing functions that take a locale_t
|
||||
argument. This enables applications to work with data from
|
||||
multiple locales simultaneously and thread-safely. */
|
||||
# include <bits/types/locale_t.h>
|
||||
|
||||
/* Return a reference to a data structure representing a set of locale
|
||||
datasets. Unlike for the CATEGORY parameter for `setlocale' the
|
||||
CATEGORY_MASK parameter here uses a single bit for each category,
|
||||
made by OR'ing together LC_*_MASK bits above. */
|
||||
extern locale_t newlocale (int __category_mask, const char *__locale,
|
||||
locale_t __base) __THROW;
|
||||
|
||||
/* These are the bits that can be set in the CATEGORY_MASK argument to
|
||||
`newlocale'. In the GNU implementation, LC_FOO_MASK has the value
|
||||
of (1 << LC_FOO), but this is not a part of the interface that
|
||||
callers can assume will be true. */
|
||||
# define LC_CTYPE_MASK (1 << __LC_CTYPE)
|
||||
# define LC_NUMERIC_MASK (1 << __LC_NUMERIC)
|
||||
# define LC_TIME_MASK (1 << __LC_TIME)
|
||||
# define LC_COLLATE_MASK (1 << __LC_COLLATE)
|
||||
# define LC_MONETARY_MASK (1 << __LC_MONETARY)
|
||||
# define LC_MESSAGES_MASK (1 << __LC_MESSAGES)
|
||||
# define LC_PAPER_MASK (1 << __LC_PAPER)
|
||||
# define LC_NAME_MASK (1 << __LC_NAME)
|
||||
# define LC_ADDRESS_MASK (1 << __LC_ADDRESS)
|
||||
# define LC_TELEPHONE_MASK (1 << __LC_TELEPHONE)
|
||||
# define LC_MEASUREMENT_MASK (1 << __LC_MEASUREMENT)
|
||||
# define LC_IDENTIFICATION_MASK (1 << __LC_IDENTIFICATION)
|
||||
# define LC_ALL_MASK (LC_CTYPE_MASK \
|
||||
| LC_NUMERIC_MASK \
|
||||
| LC_TIME_MASK \
|
||||
| LC_COLLATE_MASK \
|
||||
| LC_MONETARY_MASK \
|
||||
| LC_MESSAGES_MASK \
|
||||
| LC_PAPER_MASK \
|
||||
| LC_NAME_MASK \
|
||||
| LC_ADDRESS_MASK \
|
||||
| LC_TELEPHONE_MASK \
|
||||
| LC_MEASUREMENT_MASK \
|
||||
| LC_IDENTIFICATION_MASK \
|
||||
)
|
||||
|
||||
/* Return a duplicate of the set of locale in DATASET. All usage
|
||||
counters are increased if necessary. */
|
||||
extern locale_t duplocale (locale_t __dataset) __THROW;
|
||||
|
||||
/* Free the data associated with a locale dataset previously returned
|
||||
by a call to `setlocale_r'. */
|
||||
extern void freelocale (locale_t __dataset) __THROW;
|
||||
|
||||
/* Switch the current thread's locale to DATASET.
|
||||
If DATASET is null, instead just return the current setting.
|
||||
The special value LC_GLOBAL_LOCALE is the initial setting
|
||||
for all threads and can also be installed any time, meaning
|
||||
the thread uses the global settings controlled by `setlocale'. */
|
||||
extern locale_t uselocale (locale_t __dataset) __THROW;
|
||||
|
||||
/* This value can be passed to `uselocale' and may be returned by it.
|
||||
Passing this value to any other function has undefined behavior. */
|
||||
# define LC_GLOBAL_LOCALE ((locale_t) -1L)
|
||||
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* locale.h */
|
164
contrib/libc-headers/malloc.h
Normal file
164
contrib/libc-headers/malloc.h
Normal file
@ -0,0 +1,164 @@
|
||||
/* Prototypes and definition for malloc implementation.
|
||||
Copyright (C) 1996-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _MALLOC_H
|
||||
#define _MALLOC_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# define __MALLOC_HOOK_VOLATILE
|
||||
# define __MALLOC_DEPRECATED
|
||||
#else
|
||||
# define __MALLOC_HOOK_VOLATILE volatile
|
||||
# define __MALLOC_DEPRECATED __attribute_deprecated__
|
||||
#endif
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Allocate SIZE bytes of memory. */
|
||||
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
|
||||
|
||||
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
|
||||
extern void *calloc (size_t __nmemb, size_t __size)
|
||||
__THROW __attribute_malloc__ __wur;
|
||||
|
||||
/* Re-allocate the previously allocated block in __ptr, making the new
|
||||
block SIZE bytes long. */
|
||||
/* __attribute_malloc__ is not used, because if realloc returns
|
||||
the same pointer that was passed to it, aliasing needs to be allowed
|
||||
between objects pointed by the old and new pointers. */
|
||||
extern void *realloc (void *__ptr, size_t __size)
|
||||
__THROW __attribute_warn_unused_result__;
|
||||
|
||||
/* Re-allocate the previously allocated block in PTR, making the new
|
||||
block large enough for NMEMB elements of SIZE bytes each. */
|
||||
/* __attribute_malloc__ is not used, because if reallocarray returns
|
||||
the same pointer that was passed to it, aliasing needs to be allowed
|
||||
between objects pointed by the old and new pointers. */
|
||||
extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
|
||||
__THROW __attribute_warn_unused_result__;
|
||||
|
||||
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
|
||||
extern void free (void *__ptr) __THROW;
|
||||
|
||||
/* Allocate SIZE bytes allocated to ALIGNMENT bytes. */
|
||||
extern void *memalign (size_t __alignment, size_t __size)
|
||||
__THROW __attribute_malloc__ __wur;
|
||||
|
||||
/* Allocate SIZE bytes on a page boundary. */
|
||||
extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
|
||||
|
||||
/* Equivalent to valloc(minimum-page-that-holds(n)), that is, round up
|
||||
__size to nearest pagesize. */
|
||||
extern void *pvalloc (size_t __size) __THROW __attribute_malloc__ __wur;
|
||||
|
||||
/* Underlying allocation function; successive calls should return
|
||||
contiguous pieces of memory. */
|
||||
extern void *(*__morecore) (ptrdiff_t __size);
|
||||
|
||||
/* Default value of `__morecore'. */
|
||||
extern void *__default_morecore (ptrdiff_t __size)
|
||||
__THROW __attribute_malloc__;
|
||||
|
||||
/* SVID2/XPG mallinfo structure */
|
||||
|
||||
struct mallinfo
|
||||
{
|
||||
int arena; /* non-mmapped space allocated from system */
|
||||
int ordblks; /* number of free chunks */
|
||||
int smblks; /* number of fastbin blocks */
|
||||
int hblks; /* number of mmapped regions */
|
||||
int hblkhd; /* space in mmapped regions */
|
||||
int usmblks; /* always 0, preserved for backwards compatibility */
|
||||
int fsmblks; /* space available in freed fastbin blocks */
|
||||
int uordblks; /* total allocated space */
|
||||
int fordblks; /* total free space */
|
||||
int keepcost; /* top-most, releasable (via malloc_trim) space */
|
||||
};
|
||||
|
||||
/* Returns a copy of the updated current mallinfo. */
|
||||
extern struct mallinfo mallinfo (void) __THROW;
|
||||
|
||||
/* SVID2/XPG mallopt options */
|
||||
#ifndef M_MXFAST
|
||||
# define M_MXFAST 1 /* maximum request size for "fastbins" */
|
||||
#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
|
||||
#define M_PERTURB -6
|
||||
#define M_ARENA_TEST -7
|
||||
#define M_ARENA_MAX -8
|
||||
|
||||
/* General SVID/XPG interface to tunable parameters. */
|
||||
extern int mallopt (int __param, int __val) __THROW;
|
||||
|
||||
/* Release all but __pad bytes of freed top-most memory back to the
|
||||
system. Return 1 if successful, else 0. */
|
||||
extern int malloc_trim (size_t __pad) __THROW;
|
||||
|
||||
/* Report the number of usable allocated bytes associated with allocated
|
||||
chunk __ptr. */
|
||||
extern size_t malloc_usable_size (void *__ptr) __THROW;
|
||||
|
||||
/* Prints brief summary statistics on stderr. */
|
||||
extern void malloc_stats (void) __THROW;
|
||||
|
||||
/* Output information about state of allocator to stream FP. */
|
||||
extern int malloc_info (int __options, FILE *__fp) __THROW;
|
||||
|
||||
/* Hooks for debugging and user-defined versions. */
|
||||
extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr,
|
||||
const void *)
|
||||
__MALLOC_DEPRECATED;
|
||||
extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook)(size_t __size,
|
||||
const void *)
|
||||
__MALLOC_DEPRECATED;
|
||||
extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook)(void *__ptr,
|
||||
size_t __size,
|
||||
const void *)
|
||||
__MALLOC_DEPRECATED;
|
||||
extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
|
||||
size_t __size,
|
||||
const void *)
|
||||
__MALLOC_DEPRECATED;
|
||||
extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void);
|
||||
|
||||
/* Activate a standard set of debugging hooks. */
|
||||
extern void __malloc_check_init (void) __THROW __MALLOC_DEPRECATED;
|
||||
|
||||
|
||||
__END_DECLS
|
||||
#endif /* malloc.h */
|
1266
contrib/libc-headers/math.h
Normal file
1266
contrib/libc-headers/math.h
Normal file
File diff suppressed because it is too large
Load Diff
33
contrib/libc-headers/memory.h
Normal file
33
contrib/libc-headers/memory.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* SVID
|
||||
*/
|
||||
|
||||
#ifndef _MEMORY_H
|
||||
#define _MEMORY_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
|
||||
#ifndef _STRING_H
|
||||
# include <string.h>
|
||||
#endif /* string.h */
|
||||
|
||||
|
||||
#endif /* memory.h */
|
204
contrib/libc-headers/net/if.h
Normal file
204
contrib/libc-headers/net/if.h
Normal file
@ -0,0 +1,204 @@
|
||||
/* net/if.h -- declarations for inquiring about network interfaces
|
||||
Copyright (C) 1997-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _NET_IF_H
|
||||
#define _NET_IF_H 1
|
||||
|
||||
#include <features.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
|
||||
IFF_BROADCAST = 0x2, /* Broadcast address valid. */
|
||||
# define IFF_BROADCAST IFF_BROADCAST
|
||||
IFF_DEBUG = 0x4, /* Turn on debugging. */
|
||||
# define IFF_DEBUG IFF_DEBUG
|
||||
IFF_LOOPBACK = 0x8, /* Is a loopback net. */
|
||||
# define IFF_LOOPBACK IFF_LOOPBACK
|
||||
IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link. */
|
||||
# define IFF_POINTOPOINT IFF_POINTOPOINT
|
||||
IFF_NOTRAILERS = 0x20, /* Avoid use of trailers. */
|
||||
# define IFF_NOTRAILERS IFF_NOTRAILERS
|
||||
IFF_RUNNING = 0x40, /* Resources allocated. */
|
||||
# define IFF_RUNNING IFF_RUNNING
|
||||
IFF_NOARP = 0x80, /* No address resolution protocol. */
|
||||
# define IFF_NOARP IFF_NOARP
|
||||
IFF_PROMISC = 0x100, /* Receive all packets. */
|
||||
# define IFF_PROMISC IFF_PROMISC
|
||||
|
||||
/* Not supported */
|
||||
IFF_ALLMULTI = 0x200, /* Receive all multicast packets. */
|
||||
# define IFF_ALLMULTI IFF_ALLMULTI
|
||||
|
||||
IFF_MASTER = 0x400, /* Master of a load balancer. */
|
||||
# define IFF_MASTER IFF_MASTER
|
||||
IFF_SLAVE = 0x800, /* Slave of a load balancer. */
|
||||
# define IFF_SLAVE IFF_SLAVE
|
||||
|
||||
IFF_MULTICAST = 0x1000, /* Supports multicast. */
|
||||
# define IFF_MULTICAST IFF_MULTICAST
|
||||
|
||||
IFF_PORTSEL = 0x2000, /* Can set media type. */
|
||||
# define IFF_PORTSEL IFF_PORTSEL
|
||||
IFF_AUTOMEDIA = 0x4000, /* Auto media select active. */
|
||||
# define IFF_AUTOMEDIA IFF_AUTOMEDIA
|
||||
IFF_DYNAMIC = 0x8000 /* Dialup device with changing addresses. */
|
||||
# define IFF_DYNAMIC IFF_DYNAMIC
|
||||
};
|
||||
|
||||
/* The ifaddr structure contains information about one address of an
|
||||
interface. They are maintained by the different address families,
|
||||
are allocated and attached when an address is set, and are linked
|
||||
together so all addresses for an interface can be located. */
|
||||
|
||||
struct ifaddr
|
||||
{
|
||||
struct sockaddr ifa_addr; /* Address of interface. */
|
||||
union
|
||||
{
|
||||
struct sockaddr ifu_broadaddr;
|
||||
struct sockaddr ifu_dstaddr;
|
||||
} ifa_ifu;
|
||||
struct iface *ifa_ifp; /* Back-pointer to interface. */
|
||||
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 */
|
||||
|
||||
/* Device mapping structure. I'd just gone off and designed a
|
||||
beautiful scheme using only loadable modules with arguments for
|
||||
driver options and along come the PCMCIA people 8)
|
||||
|
||||
Ah well. The get() side of this is good for WDSETUP, and it'll be
|
||||
handy for debugging things. The set side is fine for now and being
|
||||
very small might be worth keeping for clean configuration. */
|
||||
|
||||
struct ifmap
|
||||
{
|
||||
unsigned long int mem_start;
|
||||
unsigned long int mem_end;
|
||||
unsigned short int base_addr;
|
||||
unsigned char irq;
|
||||
unsigned char dma;
|
||||
unsigned char port;
|
||||
/* 3 bytes spare */
|
||||
};
|
||||
|
||||
/* Interface request structure used for socket ioctl's. All interface
|
||||
ioctl's must have parameter definitions which begin with ifr_name.
|
||||
The remainder may be interface specific. */
|
||||
|
||||
struct ifreq
|
||||
{
|
||||
# define IFHWADDRLEN 6
|
||||
# define IFNAMSIZ IF_NAMESIZE
|
||||
union
|
||||
{
|
||||
char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */
|
||||
} ifr_ifrn;
|
||||
|
||||
union
|
||||
{
|
||||
struct sockaddr ifru_addr;
|
||||
struct sockaddr ifru_dstaddr;
|
||||
struct sockaddr ifru_broadaddr;
|
||||
struct sockaddr ifru_netmask;
|
||||
struct sockaddr ifru_hwaddr;
|
||||
short int ifru_flags;
|
||||
int ifru_ivalue;
|
||||
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_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
|
||||
configuration for machine (useful for programs which must know all
|
||||
networks accessible). */
|
||||
|
||||
struct ifconf
|
||||
{
|
||||
int ifc_len; /* Size of buffer. */
|
||||
union
|
||||
{
|
||||
__caddr_t ifcu_buf;
|
||||
struct ifreq *ifcu_req;
|
||||
} ifc_ifcu;
|
||||
};
|
||||
# define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */
|
||||
# define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */
|
||||
# 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 (const char *__ifname) __THROW;
|
||||
extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW;
|
||||
|
||||
/* Return a list of all interfaces and their indices. */
|
||||
extern struct if_nameindex *if_nameindex (void) __THROW;
|
||||
|
||||
/* Free the data returned from if_nameindex. */
|
||||
extern void if_freenameindex (struct if_nameindex *__ptr) __THROW;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* net/if.h */
|
183
contrib/libc-headers/net/if_arp.h
Normal file
183
contrib/libc-headers/net/if_arp.h
Normal file
@ -0,0 +1,183 @@
|
||||
/* Definitions for Address Resolution Protocol.
|
||||
Copyright (C) 1997-2018 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 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Based on the 4.4BSD and Linux version of this file. */
|
||||
|
||||
#ifndef _NET_IF_ARP_H
|
||||
#define _NET_IF_ARP_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdint.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Some internals from deep down in the kernel. */
|
||||
#define MAX_ADDR_LEN 7
|
||||
|
||||
|
||||
/* This structure defines an ethernet arp header. */
|
||||
|
||||
/* ARP protocol opcodes. */
|
||||
#define ARPOP_REQUEST 1 /* ARP request. */
|
||||
#define ARPOP_REPLY 2 /* ARP reply. */
|
||||
#define ARPOP_RREQUEST 3 /* RARP request. */
|
||||
#define ARPOP_RREPLY 4 /* RARP reply. */
|
||||
#define ARPOP_InREQUEST 8 /* InARP request. */
|
||||
#define ARPOP_InREPLY 9 /* InARP reply. */
|
||||
#define ARPOP_NAK 10 /* (ATM)ARP NAK. */
|
||||
|
||||
/* See RFC 826 for protocol description. ARP packets are variable
|
||||
in size; the arphdr structure defines the fixed-length portion.
|
||||
Protocol type values are the same as those for 10 Mb/s Ethernet.
|
||||
It is followed by the variable-sized fields ar_sha, arp_spa,
|
||||
arp_tha and arp_tpa in that order, according to the lengths
|
||||
specified. Field names used correspond to RFC 826. */
|
||||
|
||||
struct arphdr
|
||||
{
|
||||
unsigned short int ar_hrd; /* Format of hardware address. */
|
||||
unsigned short int ar_pro; /* Format of protocol address. */
|
||||
unsigned char ar_hln; /* Length of hardware address. */
|
||||
unsigned char ar_pln; /* Length of protocol address. */
|
||||
unsigned short int ar_op; /* ARP opcode (command). */
|
||||
#if 0
|
||||
/* Ethernet looks like this : This bit is variable sized
|
||||
however... */
|
||||
unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */
|
||||
unsigned char __ar_sip[4]; /* Sender IP address. */
|
||||
unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */
|
||||
unsigned char __ar_tip[4]; /* Target IP address. */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/* ARP protocol HARDWARE identifiers. */
|
||||
#define ARPHRD_NETROM 0 /* From KA9Q: NET/ROM pseudo. */
|
||||
#define ARPHRD_ETHER 1 /* Ethernet 10/100Mbps. */
|
||||
#define ARPHRD_EETHER 2 /* Experimental Ethernet. */
|
||||
#define ARPHRD_AX25 3 /* AX.25 Level 2. */
|
||||
#define ARPHRD_PRONET 4 /* PROnet token ring. */
|
||||
#define ARPHRD_CHAOS 5 /* Chaosnet. */
|
||||
#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB. */
|
||||
#define ARPHRD_ARCNET 7 /* ARCnet. */
|
||||
#define ARPHRD_APPLETLK 8 /* APPLEtalk. */
|
||||
#define ARPHRD_DLCI 15 /* Frame Relay DLCI. */
|
||||
#define ARPHRD_ATM 19 /* ATM. */
|
||||
#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id). */
|
||||
#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734. */
|
||||
#define ARPHRD_EUI64 27 /* EUI-64. */
|
||||
#define ARPHRD_INFINIBAND 32 /* InfiniBand. */
|
||||
|
||||
/* Dummy types for non ARP hardware */
|
||||
#define ARPHRD_SLIP 256
|
||||
#define ARPHRD_CSLIP 257
|
||||
#define ARPHRD_SLIP6 258
|
||||
#define ARPHRD_CSLIP6 259
|
||||
#define ARPHRD_RSRVD 260 /* Notional KISS type. */
|
||||
#define ARPHRD_ADAPT 264
|
||||
#define ARPHRD_ROSE 270
|
||||
#define ARPHRD_X25 271 /* CCITT X.25. */
|
||||
#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware. */
|
||||
#define ARPHRD_PPP 512
|
||||
#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_RAWIP 519 /* Raw IP. */
|
||||
|
||||
#define ARPHRD_TUNNEL 768 /* IPIP tunnel. */
|
||||
#define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel. */
|
||||
#define ARPHRD_FRAD 770 /* Frame Relay Access Device. */
|
||||
#define ARPHRD_SKIP 771 /* SKIP vif. */
|
||||
#define ARPHRD_LOOPBACK 772 /* Loopback device. */
|
||||
#define ARPHRD_LOCALTLK 773 /* Localtalk device. */
|
||||
#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface. */
|
||||
#define ARPHRD_BIF 775 /* AP1000 BIF. */
|
||||
#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4. */
|
||||
#define ARPHRD_IPDDP 777 /* IP-in-DDP tunnel. */
|
||||
#define ARPHRD_IPGRE 778 /* GRE over IP. */
|
||||
#define ARPHRD_PIMREG 779 /* PIMSM register interface. */
|
||||
#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-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_FCFABRIC 787 /* Fibrechanel fabric. */
|
||||
#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR. */
|
||||
#define ARPHRD_IEEE80211 801 /* IEEE 802.11. */
|
||||
#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header. */
|
||||
#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header. */
|
||||
#define ARPHRD_IEEE802154 804 /* IEEE 802.15.4 header. */
|
||||
#define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */
|
||||
|
||||
#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known. */
|
||||
#define ARPHRD_NONE 0xFFFE /* Zero header length. */
|
||||
|
||||
|
||||
/* ARP ioctl request. */
|
||||
struct arpreq
|
||||
{
|
||||
struct sockaddr arp_pa; /* Protocol address. */
|
||||
struct sockaddr arp_ha; /* Hardware address. */
|
||||
int arp_flags; /* Flags. */
|
||||
struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */
|
||||
char arp_dev[16];
|
||||
};
|
||||
|
||||
struct arpreq_old
|
||||
{
|
||||
struct sockaddr arp_pa; /* Protocol address. */
|
||||
struct sockaddr arp_ha; /* Hardware address. */
|
||||
int arp_flags; /* Flags. */
|
||||
struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */
|
||||
};
|
||||
|
||||
/* ARP Flag values. */
|
||||
#define ATF_COM 0x02 /* Completed entry (ha valid). */
|
||||
#define ATF_PERM 0x04 /* Permanent entry. */
|
||||
#define ATF_PUBL 0x08 /* Publish entry. */
|
||||
#define ATF_USETRAILERS 0x10 /* Has requested trailers. */
|
||||
#define ATF_NETMASK 0x20 /* Want to use a netmask (only
|
||||
for proxy entries). */
|
||||
#define ATF_DONTPUB 0x40 /* Don't answer this addresses. */
|
||||
#define ATF_MAGIC 0x80 /* Automatically added entry. */
|
||||
|
||||
|
||||
/* Support for the user space arp daemon, arpd. */
|
||||
#define ARPD_UPDATE 0x01
|
||||
#define ARPD_LOOKUP 0x02
|
||||
#define ARPD_FLUSH 0x03
|
||||
|
||||
struct arpd_request
|
||||
{
|
||||
unsigned short int req; /* Request type. */
|
||||
uint32_t ip; /* IP address of entry. */
|
||||
unsigned long int dev; /* Device entry is tied to. */
|
||||
unsigned long int stamp;
|
||||
unsigned long int updated;
|
||||
unsigned char ha[MAX_ADDR_LEN]; /* Hardware address. */
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* net/if_arp.h */
|
713
contrib/libc-headers/netdb.h
Normal file
713
contrib/libc-headers/netdb.h
Normal file
@ -0,0 +1,713 @@
|
||||
/* Copyright (C) 1996-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* 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 <bits/stdint-uintn.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
|
||||
# include <bits/types/sigevent_t.h>
|
||||
# include <bits/types/struct_timespec.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
|
||||
|
||||
#if defined __USE_MISC || !defined __USE_XOPEN2K8
|
||||
/* Error status for non-reentrant lookup functions.
|
||||
We use a macro to access always the thread-specific `h_errno' variable. */
|
||||
# define h_errno (*__h_errno_location ())
|
||||
|
||||
/* Function to get address of global `h_errno' variable. */
|
||||
extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
|
||||
|
||||
|
||||
/* Possible values left in `h_errno'. */
|
||||
# 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. */
|
||||
#endif
|
||||
#ifdef __USE_MISC
|
||||
# define NETDB_INTERNAL -1 /* See errno. */
|
||||
# define NETDB_SUCCESS 0 /* No problem. */
|
||||
# define NO_ADDRESS NO_DATA /* No address, look for MX record. */
|
||||
#endif
|
||||
|
||||
#if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED
|
||||
/* Highest reserved Internet port number. */
|
||||
# define IPPORT_RESERVED 1024
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Scope delimiter for getaddrinfo(), getnameinfo(). */
|
||||
# define SCOPE_DELIMITER '%'
|
||||
#endif
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* 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;
|
||||
#endif
|
||||
|
||||
|
||||
/* 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. */
|
||||
#ifdef __USE_MISC
|
||||
# define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Open host data base files and mark them as staying open even after
|
||||
a later search if STAY_OPEN is non-zero.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void sethostent (int __stay_open);
|
||||
|
||||
/* Close host data base files and clear `stay open' flag.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void endhostent (void);
|
||||
|
||||
/* Get next entry from host data base file. Open data base if
|
||||
necessary.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct hostent *gethostent (void);
|
||||
|
||||
/* Return entry from host data base which address match ADDR with
|
||||
length LEN and type TYPE.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len,
|
||||
int __type);
|
||||
|
||||
/* Return entry from host data base for host with NAME.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct hostent *gethostbyname (const char *__name);
|
||||
|
||||
#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.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern struct hostent *gethostbyname2 (const char *__name, int __af);
|
||||
|
||||
/* 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.
|
||||
|
||||
These functions are not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation they are cancellation points and
|
||||
therefore not marked with __THROW. */
|
||||
extern int gethostent_r (struct hostent *__restrict __result_buf,
|
||||
char *__restrict __buf, size_t __buflen,
|
||||
struct hostent **__restrict __result,
|
||||
int *__restrict __h_errnop);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
#endif /* misc */
|
||||
|
||||
|
||||
/* Open network data base files and mark them as staying open even
|
||||
after a later search if STAY_OPEN is non-zero.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void setnetent (int __stay_open);
|
||||
|
||||
/* Close network data base files and clear `stay open' flag.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void endnetent (void);
|
||||
|
||||
/* Get next entry from network data base file. Open data base if
|
||||
necessary.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct netent *getnetent (void);
|
||||
|
||||
/* Return entry from network data base which address match NET and
|
||||
type TYPE.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct netent *getnetbyaddr (uint32_t __net, int __type);
|
||||
|
||||
/* Return entry from network data base for network with NAME.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct netent *getnetbyname (const char *__name);
|
||||
|
||||
#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.
|
||||
|
||||
These functions are not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation they are cancellation points and
|
||||
therefore not marked with __THROW. */
|
||||
extern int getnetent_r (struct netent *__restrict __result_buf,
|
||||
char *__restrict __buf, size_t __buflen,
|
||||
struct netent **__restrict __result,
|
||||
int *__restrict __h_errnop);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
#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. */
|
||||
};
|
||||
|
||||
/* Open service data base files and mark them as staying open even
|
||||
after a later search if STAY_OPEN is non-zero.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void setservent (int __stay_open);
|
||||
|
||||
/* Close service data base files and clear `stay open' flag.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void endservent (void);
|
||||
|
||||
/* Get next entry from service data base file. Open data base if
|
||||
necessary.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct servent *getservent (void);
|
||||
|
||||
/* Return entry from network data base for network with NAME and
|
||||
protocol PROTO.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct servent *getservbyname (const char *__name, const char *__proto);
|
||||
|
||||
/* Return entry from service data base which matches port PORT and
|
||||
protocol PROTO.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct servent *getservbyport (int __port, const char *__proto);
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Reentrant versions of the functions above. The additional
|
||||
arguments specify a buffer of BUFLEN starting at BUF.
|
||||
|
||||
These functions are not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation they are cancellation points and
|
||||
therefore not marked with __THROW. */
|
||||
extern int getservent_r (struct servent *__restrict __result_buf,
|
||||
char *__restrict __buf, size_t __buflen,
|
||||
struct servent **__restrict __result);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
#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. */
|
||||
};
|
||||
|
||||
/* Open protocol data base files and mark them as staying open even
|
||||
after a later search if STAY_OPEN is non-zero.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void setprotoent (int __stay_open);
|
||||
|
||||
/* Close protocol data base files and clear `stay open' flag.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void endprotoent (void);
|
||||
|
||||
/* Get next entry from protocol data base file. Open data base if
|
||||
necessary.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct protoent *getprotoent (void);
|
||||
|
||||
/* Return entry from protocol data base for network with NAME.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct protoent *getprotobyname (const char *__name);
|
||||
|
||||
/* Return entry from protocol data base which number is PROTO.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct protoent *getprotobynumber (int __proto);
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Reentrant versions of the functions above. The additional
|
||||
arguments specify a buffer of BUFLEN starting at BUF.
|
||||
|
||||
These functions are not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation they are cancellation points and
|
||||
therefore not marked with __THROW. */
|
||||
extern int getprotoent_r (struct protoent *__restrict __result_buf,
|
||||
char *__restrict __buf, size_t __buflen,
|
||||
struct protoent **__restrict __result);
|
||||
|
||||
extern int getprotobyname_r (const char *__restrict __name,
|
||||
struct protoent *__restrict __result_buf,
|
||||
char *__restrict __buf, size_t __buflen,
|
||||
struct protoent **__restrict __result);
|
||||
|
||||
extern int getprotobynumber_r (int __proto,
|
||||
struct protoent *__restrict __result_buf,
|
||||
char *__restrict __buf, size_t __buflen,
|
||||
struct protoent **__restrict __result);
|
||||
|
||||
|
||||
/* Establish network group NETGROUP for enumeration.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int setnetgrent (const char *__netgroup);
|
||||
|
||||
/* Free all space allocated by previous `setnetgrent' call.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern void endnetgrent (void);
|
||||
|
||||
/* Get next member of netgroup established by last `setnetgrent' call
|
||||
and return pointers to elements in HOSTP, USERP, and DOMAINP.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int getnetgrent (char **__restrict __hostp,
|
||||
char **__restrict __userp,
|
||||
char **__restrict __domainp);
|
||||
|
||||
|
||||
/* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN).
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int innetgr (const char *__netgroup, const char *__host,
|
||||
const char *__user, const char *__domain);
|
||||
|
||||
/* Reentrant version of `getnetgrent' where result is placed in BUFFER.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int getnetgrent_r (char **__restrict __hostp,
|
||||
char **__restrict __userp,
|
||||
char **__restrict __domainp,
|
||||
char *__restrict __buffer, size_t __buflen);
|
||||
#endif /* misc */
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* 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.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
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);
|
||||
|
||||
/* This is the equivalent function where the protocol can be selected
|
||||
and which therefore can be used for IPv6.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
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);
|
||||
|
||||
/* 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.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int rexec (char **__restrict __ahost, int __rport,
|
||||
const char *__restrict __name,
|
||||
const char *__restrict __pass,
|
||||
const char *__restrict __cmd, int *__restrict __fd2p);
|
||||
|
||||
/* This is the equivalent function where the protocol can be selected
|
||||
and which therefore can be used for IPv6.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
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);
|
||||
|
||||
/* 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.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int ruserok (const char *__rhost, int __suser,
|
||||
const char *__remuser, const char *__locuser);
|
||||
|
||||
/* This is the equivalent function where the protocol can be selected
|
||||
and which therefore can be used for IPv6.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int ruserok_af (const char *__rhost, int __suser,
|
||||
const char *__remuser, const char *__locuser,
|
||||
sa_family_t __af);
|
||||
|
||||
/* Check whether user REMUSER on system indicated by IPv4 address
|
||||
RADDR is allowed to login as LOCUSER. Non-IPv4 (e.g., IPv6) are
|
||||
not supported. If SUSER is not zero the user tries to become
|
||||
superuser. Return 0 if it is possible.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int iruserok (uint32_t __raddr, int __suser,
|
||||
const char *__remuser, const char *__locuser);
|
||||
|
||||
/* This is the equivalent function where the pfamiliy if the address
|
||||
pointed to by RADDR is determined by the value of AF. It therefore
|
||||
can be used for IPv6
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int iruserok_af (const void *__raddr, int __suser,
|
||||
const char *__remuser, const char *__locuser,
|
||||
sa_family_t __af);
|
||||
|
||||
/* 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.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int rresvport (int *__alport);
|
||||
|
||||
/* This is the equivalent function where the protocol can be selected
|
||||
and which therefore can be used for IPv6.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int rresvport_af (int *__alport, sa_family_t __af);
|
||||
#endif
|
||||
|
||||
|
||||
/* Extension from POSIX.1:2001. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
/* 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. */
|
||||
};
|
||||
|
||||
# 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 __glibc_reserved[5];
|
||||
};
|
||||
|
||||
/* Lookup mode. */
|
||||
# define GAI_WAIT 0
|
||||
# define GAI_NOWAIT 1
|
||||
# endif
|
||||
|
||||
/* 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. */
|
||||
# define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
|
||||
# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
|
||||
# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
|
||||
returned address type.. */
|
||||
# ifdef __USE_GNU
|
||||
# define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
|
||||
in the current locale's character set)
|
||||
before looking it up. */
|
||||
# define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
|
||||
# define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode
|
||||
code points. */
|
||||
# define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to
|
||||
STD3 rules. */
|
||||
# endif
|
||||
# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
|
||||
|
||||
/* 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_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_MEMORY -10 /* Memory allocation failure. */
|
||||
# define EAI_SYSTEM -11 /* System error returned in `errno'. */
|
||||
# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
|
||||
# ifdef __USE_GNU
|
||||
# define EAI_NODATA -5 /* No address associated with NAME. */
|
||||
# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
|
||||
# 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. */
|
||||
# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
|
||||
# endif
|
||||
|
||||
# ifdef __USE_MISC
|
||||
# define NI_MAXHOST 1025
|
||||
# define NI_MAXSERV 32
|
||||
# endif
|
||||
|
||||
# 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. */
|
||||
# ifdef __USE_GNU
|
||||
# define NI_IDN 32 /* Convert name from IDN format. */
|
||||
# define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
|
||||
code points. */
|
||||
# define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to
|
||||
STD3 rules. */
|
||||
# endif
|
||||
|
||||
/* Translate name of a service location and/or a service name to set of
|
||||
socket addresses.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int getaddrinfo (const char *__restrict __name,
|
||||
const char *__restrict __service,
|
||||
const struct addrinfo *__restrict __req,
|
||||
struct addrinfo **__restrict __pai);
|
||||
|
||||
/* Free `addrinfo' structure AI including associated storage. */
|
||||
extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
|
||||
|
||||
/* Convert error return from getaddrinfo() to a string. */
|
||||
extern const char *gai_strerror (int __ecode) __THROW;
|
||||
|
||||
/* Translate a socket address to a location and service name.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int getnameinfo (const struct sockaddr *__restrict __sa,
|
||||
socklen_t __salen, char *__restrict __host,
|
||||
socklen_t __hostlen, char *__restrict __serv,
|
||||
socklen_t __servlen, int __flags);
|
||||
#endif /* POSIX */
|
||||
|
||||
#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.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
|
||||
int __ent, struct sigevent *__restrict __sig);
|
||||
|
||||
/* 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.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int gai_suspend (const struct gaicb *const __list[], int __ent,
|
||||
const struct timespec *__timeout);
|
||||
|
||||
/* 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 */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* netdb.h */
|
632
contrib/libc-headers/netinet/in.h
Normal file
632
contrib/libc-headers/netinet/in.h
Normal file
@ -0,0 +1,632 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _NETINET_IN_H
|
||||
#define _NETINET_IN_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <bits/stdint-uintn.h>
|
||||
#include <sys/socket.h>
|
||||
#include <bits/types.h>
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Internet address. */
|
||||
typedef uint32_t in_addr_t;
|
||||
struct in_addr
|
||||
{
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
|
||||
/* Get system-specific definitions. */
|
||||
#include <bits/in.h>
|
||||
|
||||
/* Standard well-defined IP protocols. */
|
||||
enum
|
||||
{
|
||||
IPPROTO_IP = 0, /* Dummy protocol for TCP. */
|
||||
#define IPPROTO_IP IPPROTO_IP
|
||||
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_DCCP = 33, /* Datagram Congestion Control Protocol. */
|
||||
#define IPPROTO_DCCP IPPROTO_DCCP
|
||||
IPPROTO_IPV6 = 41, /* IPv6 header. */
|
||||
#define IPPROTO_IPV6 IPPROTO_IPV6
|
||||
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_MTP = 92, /* Multicast Transport Protocol. */
|
||||
#define IPPROTO_MTP IPPROTO_MTP
|
||||
IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET. */
|
||||
#define IPPROTO_BEETPH IPPROTO_BEETPH
|
||||
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_SCTP = 132, /* Stream Control Transmission Protocol. */
|
||||
#define IPPROTO_SCTP IPPROTO_SCTP
|
||||
IPPROTO_UDPLITE = 136, /* UDP-Lite protocol. */
|
||||
#define IPPROTO_UDPLITE IPPROTO_UDPLITE
|
||||
IPPROTO_MPLS = 137, /* MPLS in IP. */
|
||||
#define IPPROTO_MPLS IPPROTO_MPLS
|
||||
IPPROTO_RAW = 255, /* Raw IP packets. */
|
||||
#define IPPROTO_RAW IPPROTO_RAW
|
||||
IPPROTO_MAX
|
||||
};
|
||||
|
||||
/* If __USE_KERNEL_IPV6_DEFS is 1 then the user has included the kernel
|
||||
network headers first and we should use those ABI-identical definitions
|
||||
instead of our own, otherwise 0. */
|
||||
#if !__USE_KERNEL_IPV6_DEFS
|
||||
enum
|
||||
{
|
||||
IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
|
||||
#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
|
||||
IPPROTO_ROUTING = 43, /* IPv6 routing header. */
|
||||
#define IPPROTO_ROUTING IPPROTO_ROUTING
|
||||
IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
|
||||
#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
|
||||
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_MH = 135 /* IPv6 mobility header. */
|
||||
#define IPPROTO_MH IPPROTO_MH
|
||||
};
|
||||
#endif /* !__USE_KERNEL_IPV6_DEFS */
|
||||
|
||||
/* Type to represent a port. */
|
||||
typedef uint16_t in_port_t;
|
||||
|
||||
/* Standard well-known ports. */
|
||||
enum
|
||||
{
|
||||
IPPORT_ECHO = 7, /* Echo service. */
|
||||
IPPORT_DISCARD = 9, /* Discard transmissions service. */
|
||||
IPPORT_SYSTAT = 11, /* System status service. */
|
||||
IPPORT_DAYTIME = 13, /* Time of day service. */
|
||||
IPPORT_NETSTAT = 15, /* Network status service. */
|
||||
IPPORT_FTP = 21, /* File Transfer Protocol. */
|
||||
IPPORT_TELNET = 23, /* Telnet protocol. */
|
||||
IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */
|
||||
IPPORT_TIMESERVER = 37, /* Timeserver service. */
|
||||
IPPORT_NAMESERVER = 42, /* Domain Name Service. */
|
||||
IPPORT_WHOIS = 43, /* Internet Whois service. */
|
||||
IPPORT_MTP = 57,
|
||||
|
||||
IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */
|
||||
IPPORT_RJE = 77,
|
||||
IPPORT_FINGER = 79, /* Finger service. */
|
||||
IPPORT_TTYLINK = 87,
|
||||
IPPORT_SUPDUP = 95, /* SUPDUP protocol. */
|
||||
|
||||
|
||||
IPPORT_EXECSERVER = 512, /* execd service. */
|
||||
IPPORT_LOGINSERVER = 513, /* rlogind service. */
|
||||
IPPORT_CMDSERVER = 514,
|
||||
IPPORT_EFSSERVER = 520,
|
||||
|
||||
/* UDP ports. */
|
||||
IPPORT_BIFFUDP = 512,
|
||||
IPPORT_WHOSERVER = 513,
|
||||
IPPORT_ROUTESERVER = 520,
|
||||
|
||||
/* Ports less than this value are reserved for privileged processes. */
|
||||
IPPORT_RESERVED = 1024,
|
||||
|
||||
/* Ports greater this value are reserved for (non-privileged) servers. */
|
||||
IPPORT_USERRESERVED = 5000
|
||||
};
|
||||
|
||||
/* Definitions of the bits in an Internet address integer.
|
||||
|
||||
On subnets, host and network parts are found according to
|
||||
the subnet mask, not these masks. */
|
||||
|
||||
#define IN_CLASSA(a) ((((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) ((((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) ((((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) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
|
||||
#define IN_MULTICAST(a) IN_CLASSD(a)
|
||||
|
||||
#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 ((in_addr_t) 0x00000000)
|
||||
/* Address to send to all hosts. */
|
||||
#define INADDR_BROADCAST ((in_addr_t) 0xffffffff)
|
||||
/* Address indicating an error return. */
|
||||
#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 ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1. */
|
||||
#endif
|
||||
|
||||
/* Defines for Multicast INADDR. */
|
||||
#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 */
|
||||
|
||||
#if !__USE_KERNEL_IPV6_DEFS
|
||||
/* IPv6 address */
|
||||
struct in6_addr
|
||||
{
|
||||
union
|
||||
{
|
||||
uint8_t __u6_addr8[16];
|
||||
uint16_t __u6_addr16[8];
|
||||
uint32_t __u6_addr32[4];
|
||||
} __in6_u;
|
||||
#define s6_addr __in6_u.__u6_addr8
|
||||
#ifdef __USE_MISC
|
||||
# define s6_addr16 __in6_u.__u6_addr16
|
||||
# define s6_addr32 __in6_u.__u6_addr32
|
||||
#endif
|
||||
};
|
||||
#endif /* !__USE_KERNEL_IPV6_DEFS */
|
||||
|
||||
extern const struct in6_addr in6addr_any; /* :: */
|
||||
extern const struct in6_addr in6addr_loopback; /* ::1 */
|
||||
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
|
||||
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
|
||||
|
||||
#define INET_ADDRSTRLEN 16
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
|
||||
|
||||
/* Structure describing an Internet socket address. */
|
||||
struct sockaddr_in
|
||||
{
|
||||
__SOCKADDR_COMMON (sin_);
|
||||
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 (in_port_t) -
|
||||
sizeof (struct in_addr)];
|
||||
};
|
||||
|
||||
#if !__USE_KERNEL_IPV6_DEFS
|
||||
/* Ditto, for IPv6. */
|
||||
struct sockaddr_in6
|
||||
{
|
||||
__SOCKADDR_COMMON (sin6_);
|
||||
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 */
|
||||
};
|
||||
#endif /* !__USE_KERNEL_IPV6_DEFS */
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* IPv4 multicast request. */
|
||||
struct ip_mreq
|
||||
{
|
||||
/* IP multicast address of group. */
|
||||
struct in_addr imr_multiaddr;
|
||||
|
||||
/* Local IP address of interface. */
|
||||
struct in_addr imr_interface;
|
||||
};
|
||||
|
||||
struct ip_mreq_source
|
||||
{
|
||||
/* IP multicast address of group. */
|
||||
struct in_addr imr_multiaddr;
|
||||
|
||||
/* IP address of interface. */
|
||||
struct in_addr imr_interface;
|
||||
|
||||
/* IP address of source. */
|
||||
struct in_addr imr_sourceaddr;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !__USE_KERNEL_IPV6_DEFS
|
||||
/* Likewise, for IPv6. */
|
||||
struct ipv6_mreq
|
||||
{
|
||||
/* IPv6 multicast address of group */
|
||||
struct in6_addr ipv6mr_multiaddr;
|
||||
|
||||
/* local interface */
|
||||
unsigned int ipv6mr_interface;
|
||||
};
|
||||
#endif /* !__USE_KERNEL_IPV6_DEFS */
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Multicast group request. */
|
||||
struct group_req
|
||||
{
|
||||
/* Interface index. */
|
||||
uint32_t gr_interface;
|
||||
|
||||
/* Group address. */
|
||||
struct sockaddr_storage gr_group;
|
||||
};
|
||||
|
||||
struct group_source_req
|
||||
{
|
||||
/* Interface index. */
|
||||
uint32_t gsr_interface;
|
||||
|
||||
/* Group address. */
|
||||
struct sockaddr_storage gsr_group;
|
||||
|
||||
/* Source address. */
|
||||
struct sockaddr_storage gsr_source;
|
||||
};
|
||||
|
||||
|
||||
/* Full-state filter operations. */
|
||||
struct ip_msfilter
|
||||
{
|
||||
/* IP multicast address of group. */
|
||||
struct in_addr imsf_multiaddr;
|
||||
|
||||
/* Local IP address of interface. */
|
||||
struct in_addr imsf_interface;
|
||||
|
||||
/* Filter mode. */
|
||||
uint32_t imsf_fmode;
|
||||
|
||||
/* Number of source addresses. */
|
||||
uint32_t imsf_numsrc;
|
||||
/* Source addresses. */
|
||||
struct in_addr imsf_slist[1];
|
||||
};
|
||||
|
||||
#define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
|
||||
- sizeof (struct in_addr) \
|
||||
+ (numsrc) * sizeof (struct in_addr))
|
||||
|
||||
struct group_filter
|
||||
{
|
||||
/* Interface index. */
|
||||
uint32_t gf_interface;
|
||||
|
||||
/* Group address. */
|
||||
struct sockaddr_storage gf_group;
|
||||
|
||||
/* Filter mode. */
|
||||
uint32_t gf_fmode;
|
||||
|
||||
/* Number of source addresses. */
|
||||
uint32_t gf_numsrc;
|
||||
/* Source addresses. */
|
||||
struct sockaddr_storage gf_slist[1];
|
||||
};
|
||||
|
||||
#define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
|
||||
- sizeof (struct sockaddr_storage) \
|
||||
+ ((numsrc) \
|
||||
* sizeof (struct sockaddr_storage)))
|
||||
#endif
|
||||
|
||||
/* Functions to convert between host and network byte order.
|
||||
|
||||
Please note that these functions normally take `unsigned long int' or
|
||||
`unsigned short int' values as arguments and also return them. But
|
||||
this was a short-sighted decision since on different systems the types
|
||||
may have different representations but the values are always the same. */
|
||||
|
||||
extern uint32_t ntohl (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>
|
||||
#include <bits/uintn-identity.h>
|
||||
|
||||
#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) __uint32_identity (x)
|
||||
# define ntohs(x) __uint16_identity (x)
|
||||
# define htonl(x) __uint32_identity (x)
|
||||
# define htons(x) __uint16_identity (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
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define IN6_IS_ADDR_UNSPECIFIED(a) \
|
||||
(__extension__ \
|
||||
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
|
||||
__a->__in6_u.__u6_addr32[0] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[1] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[2] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[3] == 0; }))
|
||||
|
||||
# define IN6_IS_ADDR_LOOPBACK(a) \
|
||||
(__extension__ \
|
||||
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
|
||||
__a->__in6_u.__u6_addr32[0] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[1] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[2] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[3] == htonl (1); }))
|
||||
|
||||
# define IN6_IS_ADDR_LINKLOCAL(a) \
|
||||
(__extension__ \
|
||||
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
|
||||
(__a->__in6_u.__u6_addr32[0] & htonl (0xffc00000)) == htonl (0xfe800000); }))
|
||||
|
||||
# define IN6_IS_ADDR_SITELOCAL(a) \
|
||||
(__extension__ \
|
||||
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
|
||||
(__a->__in6_u.__u6_addr32[0] & htonl (0xffc00000)) == htonl (0xfec00000); }))
|
||||
|
||||
# define IN6_IS_ADDR_V4MAPPED(a) \
|
||||
(__extension__ \
|
||||
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
|
||||
__a->__in6_u.__u6_addr32[0] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[1] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[2] == htonl (0xffff); }))
|
||||
|
||||
# define IN6_IS_ADDR_V4COMPAT(a) \
|
||||
(__extension__ \
|
||||
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
|
||||
__a->__in6_u.__u6_addr32[0] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[1] == 0 \
|
||||
&& __a->__in6_u.__u6_addr32[2] == 0 \
|
||||
&& ntohl (__a->__in6_u.__u6_addr32[3]) > 1; }))
|
||||
|
||||
# define IN6_ARE_ADDR_EQUAL(a,b) \
|
||||
(__extension__ \
|
||||
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
|
||||
const struct in6_addr *__b = (const struct in6_addr *) (b); \
|
||||
__a->__in6_u.__u6_addr32[0] == __b->__in6_u.__u6_addr32[0] \
|
||||
&& __a->__in6_u.__u6_addr32[1] == __b->__in6_u.__u6_addr32[1] \
|
||||
&& __a->__in6_u.__u6_addr32[2] == __b->__in6_u.__u6_addr32[2] \
|
||||
&& __a->__in6_u.__u6_addr32[3] == __b->__in6_u.__u6_addr32[3]; }))
|
||||
#else
|
||||
# define IN6_IS_ADDR_UNSPECIFIED(a) \
|
||||
(((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) \
|
||||
(((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_LINKLOCAL(a) \
|
||||
((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
|
||||
== htonl (0xfe800000))
|
||||
|
||||
# define IN6_IS_ADDR_SITELOCAL(a) \
|
||||
((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
|
||||
== htonl (0xfec00000))
|
||||
|
||||
# define IN6_IS_ADDR_V4MAPPED(a) \
|
||||
((((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) \
|
||||
((((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) \
|
||||
((((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]))
|
||||
#endif
|
||||
|
||||
#define IN6_IS_ADDR_MULTICAST(a) (((const uint8_t *) (a))[0] == 0xff)
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Bind socket to a privileged IP port. */
|
||||
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;
|
||||
#endif
|
||||
|
||||
|
||||
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) \
|
||||
&& ((((const uint8_t *) (a))[1] & 0xf) == 0x1))
|
||||
|
||||
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) \
|
||||
&& ((((const uint8_t *) (a))[1] & 0xf) == 0x2))
|
||||
|
||||
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) \
|
||||
&& ((((const uint8_t *) (a))[1] & 0xf) == 0x5))
|
||||
|
||||
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) \
|
||||
&& ((((const uint8_t *) (a))[1] & 0xf) == 0x8))
|
||||
|
||||
#define IN6_IS_ADDR_MC_GLOBAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) \
|
||||
&& ((((const uint8_t *) (a))[1] & 0xf) == 0xe))
|
||||
|
||||
|
||||
#ifdef __USE_GNU
|
||||
struct cmsghdr; /* Forward declaration. */
|
||||
|
||||
#if !__USE_KERNEL_IPV6_DEFS
|
||||
/* IPv6 packet information. */
|
||||
struct in6_pktinfo
|
||||
{
|
||||
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
|
||||
unsigned int ipi6_ifindex; /* send/recv interface index */
|
||||
};
|
||||
|
||||
/* IPv6 MTU information. */
|
||||
struct ip6_mtuinfo
|
||||
{
|
||||
struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
|
||||
uint32_t ip6m_mtu; /* path MTU in host byte order */
|
||||
};
|
||||
#endif /* !__USE_KERNEL_IPV6_DEFS */
|
||||
|
||||
/* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */
|
||||
extern int inet6_option_space (int __nbytes)
|
||||
__THROW __attribute_deprecated__;
|
||||
extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,
|
||||
int __type) __THROW __attribute_deprecated__;
|
||||
extern int inet6_option_append (struct cmsghdr *__cmsg,
|
||||
const uint8_t *__typep, int __multx,
|
||||
int __plusy) __THROW __attribute_deprecated__;
|
||||
extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,
|
||||
int __multx, int __plusy)
|
||||
__THROW __attribute_deprecated__;
|
||||
extern int inet6_option_next (const struct cmsghdr *__cmsg,
|
||||
uint8_t **__tptrp)
|
||||
__THROW __attribute_deprecated__;
|
||||
extern int inet6_option_find (const struct cmsghdr *__cmsg,
|
||||
uint8_t **__tptrp, int __type)
|
||||
__THROW __attribute_deprecated__;
|
||||
|
||||
|
||||
/* Hop-by-Hop and Destination Options Processing (RFC 3542). */
|
||||
extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW;
|
||||
extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset,
|
||||
uint8_t __type, socklen_t __len, uint8_t __align,
|
||||
void **__databufp) __THROW;
|
||||
extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset)
|
||||
__THROW;
|
||||
extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val,
|
||||
socklen_t __vallen) __THROW;
|
||||
extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset,
|
||||
uint8_t *__typep, socklen_t *__lenp,
|
||||
void **__databufp) __THROW;
|
||||
extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset,
|
||||
uint8_t __type, socklen_t *__lenp,
|
||||
void **__databufp) __THROW;
|
||||
extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val,
|
||||
socklen_t __vallen) __THROW;
|
||||
|
||||
|
||||
/* Routing Header Option (RFC 3542). */
|
||||
extern socklen_t inet6_rth_space (int __type, int __segments) __THROW;
|
||||
extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type,
|
||||
int __segments) __THROW;
|
||||
extern int inet6_rth_add (void *__bp, const struct in6_addr *__addr) __THROW;
|
||||
extern int inet6_rth_reverse (const void *__in, void *__out) __THROW;
|
||||
extern int inet6_rth_segments (const void *__bp) __THROW;
|
||||
extern struct in6_addr *inet6_rth_getaddr (const void *__bp, int __index)
|
||||
__THROW;
|
||||
|
||||
|
||||
/* Multicast source filter support. */
|
||||
|
||||
/* Get IPv4 source filter. */
|
||||
extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,
|
||||
struct in_addr __group, uint32_t *__fmode,
|
||||
uint32_t *__numsrc, struct in_addr *__slist)
|
||||
__THROW;
|
||||
|
||||
/* Set IPv4 source filter. */
|
||||
extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,
|
||||
struct in_addr __group, uint32_t __fmode,
|
||||
uint32_t __numsrc,
|
||||
const struct in_addr *__slist)
|
||||
__THROW;
|
||||
|
||||
|
||||
/* Get source filter. */
|
||||
extern int getsourcefilter (int __s, uint32_t __interface_addr,
|
||||
const struct sockaddr *__group,
|
||||
socklen_t __grouplen, uint32_t *__fmode,
|
||||
uint32_t *__numsrc,
|
||||
struct sockaddr_storage *__slist) __THROW;
|
||||
|
||||
/* Set source filter. */
|
||||
extern int setsourcefilter (int __s, uint32_t __interface_addr,
|
||||
const struct sockaddr *__group,
|
||||
socklen_t __grouplen, uint32_t __fmode,
|
||||
uint32_t __numsrc,
|
||||
const struct sockaddr_storage *__slist) __THROW;
|
||||
#endif /* use GNU */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* netinet/in.h */
|
40
contrib/libc-headers/netinet/in_systm.h
Normal file
40
contrib/libc-headers/netinet/in_systm.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* System specific type definitions for networking code.
|
||||
Copyright (C) 1997-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _NETINET_IN_SYSTM_H
|
||||
#define _NETINET_IN_SYSTM_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Network order versions of various data types. Unfortunately, BSD
|
||||
* assumes specific sizes for shorts (16 bit) and longs (32 bit) which
|
||||
* don't hold in general. As a consequence, the network order versions
|
||||
* may not reflect the actual size of the native data types.
|
||||
*/
|
||||
|
||||
typedef uint16_t n_short; /* short as received from the net */
|
||||
typedef uint32_t n_long; /* long as received from the net */
|
||||
typedef uint32_t n_time; /* ms since 00:00 GMT, byte rev */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* netinet/in_systm.h */
|
302
contrib/libc-headers/netinet/ip.h
Normal file
302
contrib/libc-headers/netinet/ip.h
Normal file
@ -0,0 +1,302 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef __NETINET_IP_H
|
||||
#define __NETINET_IP_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
struct timestamp
|
||||
{
|
||||
uint8_t len;
|
||||
uint8_t ptr;
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
unsigned int flags:4;
|
||||
unsigned int overflow:4;
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
unsigned int overflow:4;
|
||||
unsigned int flags:4;
|
||||
#else
|
||||
# error "Please fix <bits/endian.h>"
|
||||
#endif
|
||||
uint32_t data[9];
|
||||
};
|
||||
|
||||
struct iphdr
|
||||
{
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
unsigned int ihl:4;
|
||||
unsigned int version:4;
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
unsigned int version:4;
|
||||
unsigned int ihl:4;
|
||||
#else
|
||||
# error "Please fix <bits/endian.h>"
|
||||
#endif
|
||||
uint8_t tos;
|
||||
uint16_t tot_len;
|
||||
uint16_t id;
|
||||
uint16_t frag_off;
|
||||
uint8_t ttl;
|
||||
uint8_t protocol;
|
||||
uint16_t check;
|
||||
uint32_t saddr;
|
||||
uint32_t daddr;
|
||||
/*The options start here. */
|
||||
};
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ip.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Definitions for internet protocol version 4.
|
||||
* Per RFC 791, September 1981.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure of an internet header, naked of options.
|
||||
*/
|
||||
struct ip
|
||||
{
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
unsigned int ip_hl:4; /* header length */
|
||||
unsigned int ip_v:4; /* version */
|
||||
#endif
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
unsigned int ip_v:4; /* version */
|
||||
unsigned int ip_hl:4; /* header length */
|
||||
#endif
|
||||
uint8_t ip_tos; /* type of service */
|
||||
unsigned short ip_len; /* total length */
|
||||
unsigned short ip_id; /* identification */
|
||||
unsigned short ip_off; /* fragment offset field */
|
||||
#define IP_RF 0x8000 /* reserved fragment flag */
|
||||
#define IP_DF 0x4000 /* dont fragment flag */
|
||||
#define IP_MF 0x2000 /* more fragments flag */
|
||||
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
||||
uint8_t ip_ttl; /* time to live */
|
||||
uint8_t ip_p; /* protocol */
|
||||
unsigned short ip_sum; /* checksum */
|
||||
struct in_addr ip_src, ip_dst; /* source and dest address */
|
||||
};
|
||||
|
||||
/*
|
||||
* Time stamp option structure.
|
||||
*/
|
||||
struct ip_timestamp
|
||||
{
|
||||
uint8_t ipt_code; /* IPOPT_TS */
|
||||
uint8_t ipt_len; /* size of structure (variable) */
|
||||
uint8_t ipt_ptr; /* index of current entry */
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
unsigned int ipt_flg:4; /* flags, see below */
|
||||
unsigned int ipt_oflw:4; /* overflow counter */
|
||||
#endif
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
unsigned int ipt_oflw:4; /* overflow counter */
|
||||
unsigned int ipt_flg:4; /* flags, see below */
|
||||
#endif
|
||||
uint32_t data[9];
|
||||
};
|
||||
#endif /* __USE_MISC */
|
||||
|
||||
#define IPVERSION 4 /* IP version number */
|
||||
#define IP_MAXPACKET 65535 /* maximum packet size */
|
||||
|
||||
/*
|
||||
* Definitions for Explicit Congestion Notification (ECN)
|
||||
*
|
||||
* Taken from RFC-3168, Section 5.
|
||||
*/
|
||||
|
||||
#define IPTOS_ECN_MASK 0x03
|
||||
#define IPTOS_ECN(x) ((x) & IPTOS_ECN_MASK)
|
||||
#define IPTOS_ECN_NOT_ECT 0x00
|
||||
#define IPTOS_ECN_ECT1 0x01
|
||||
#define IPTOS_ECN_ECT0 0x02
|
||||
#define IPTOS_ECN_CE 0x03
|
||||
|
||||
/*
|
||||
* Definitions for IP differentiated services code points (DSCP)
|
||||
*
|
||||
* Taken from RFC-2597, Section 6 and RFC-2598, Section 2.3.
|
||||
*/
|
||||
|
||||
#define IPTOS_DSCP_MASK 0xfc
|
||||
#define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK)
|
||||
#define IPTOS_DSCP_AF11 0x28
|
||||
#define IPTOS_DSCP_AF12 0x30
|
||||
#define IPTOS_DSCP_AF13 0x38
|
||||
#define IPTOS_DSCP_AF21 0x48
|
||||
#define IPTOS_DSCP_AF22 0x50
|
||||
#define IPTOS_DSCP_AF23 0x58
|
||||
#define IPTOS_DSCP_AF31 0x68
|
||||
#define IPTOS_DSCP_AF32 0x70
|
||||
#define IPTOS_DSCP_AF33 0x78
|
||||
#define IPTOS_DSCP_AF41 0x88
|
||||
#define IPTOS_DSCP_AF42 0x90
|
||||
#define IPTOS_DSCP_AF43 0x98
|
||||
#define IPTOS_DSCP_EF 0xb8
|
||||
|
||||
/*
|
||||
* In RFC 2474, Section 4.2.2.1, the Class Selector Codepoints subsume
|
||||
* the old ToS Precedence values.
|
||||
*/
|
||||
|
||||
#define IPTOS_CLASS_MASK 0xe0
|
||||
#define IPTOS_CLASS(class) ((class) & IPTOS_CLASS_MASK)
|
||||
#define IPTOS_CLASS_CS0 0x00
|
||||
#define IPTOS_CLASS_CS1 0x20
|
||||
#define IPTOS_CLASS_CS2 0x40
|
||||
#define IPTOS_CLASS_CS3 0x60
|
||||
#define IPTOS_CLASS_CS4 0x80
|
||||
#define IPTOS_CLASS_CS5 0xa0
|
||||
#define IPTOS_CLASS_CS6 0xc0
|
||||
#define IPTOS_CLASS_CS7 0xe0
|
||||
|
||||
#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0
|
||||
|
||||
/*
|
||||
* Definitions for IP type of service (ip_tos) [deprecated; use DSCP
|
||||
* and CS definitions above instead.]
|
||||
*/
|
||||
#define IPTOS_TOS_MASK 0x1E
|
||||
#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
|
||||
#define IPTOS_LOWDELAY 0x10
|
||||
#define IPTOS_THROUGHPUT 0x08
|
||||
#define IPTOS_RELIABILITY 0x04
|
||||
#define IPTOS_LOWCOST 0x02
|
||||
#define IPTOS_MINCOST IPTOS_LOWCOST
|
||||
|
||||
/*
|
||||
* Definitions for IP precedence (also in ip_tos) [also deprecated.]
|
||||
*/
|
||||
#define IPTOS_PREC_MASK IPTOS_CLASS_MASK
|
||||
#define IPTOS_PREC(tos) IPTOS_CLASS(tos)
|
||||
#define IPTOS_PREC_NETCONTROL IPTOS_CLASS_CS7
|
||||
#define IPTOS_PREC_INTERNETCONTROL IPTOS_CLASS_CS6
|
||||
#define IPTOS_PREC_CRITIC_ECP IPTOS_CLASS_CS5
|
||||
#define IPTOS_PREC_FLASHOVERRIDE IPTOS_CLASS_CS4
|
||||
#define IPTOS_PREC_FLASH IPTOS_CLASS_CS3
|
||||
#define IPTOS_PREC_IMMEDIATE IPTOS_CLASS_CS2
|
||||
#define IPTOS_PREC_PRIORITY IPTOS_CLASS_CS1
|
||||
#define IPTOS_PREC_ROUTINE IPTOS_CLASS_CS0
|
||||
|
||||
/*
|
||||
* Definitions for options.
|
||||
*/
|
||||
#define IPOPT_COPY 0x80
|
||||
#define IPOPT_CLASS_MASK 0x60
|
||||
#define IPOPT_NUMBER_MASK 0x1f
|
||||
|
||||
#define IPOPT_COPIED(o) ((o) & IPOPT_COPY)
|
||||
#define IPOPT_CLASS(o) ((o) & IPOPT_CLASS_MASK)
|
||||
#define IPOPT_NUMBER(o) ((o) & IPOPT_NUMBER_MASK)
|
||||
|
||||
#define IPOPT_CONTROL 0x00
|
||||
#define IPOPT_RESERVED1 0x20
|
||||
#define IPOPT_DEBMEAS 0x40
|
||||
#define IPOPT_MEASUREMENT IPOPT_DEBMEAS
|
||||
#define IPOPT_RESERVED2 0x60
|
||||
|
||||
#define IPOPT_EOL 0 /* end of option list */
|
||||
#define IPOPT_END IPOPT_EOL
|
||||
#define IPOPT_NOP 1 /* no operation */
|
||||
#define IPOPT_NOOP IPOPT_NOP
|
||||
|
||||
#define IPOPT_RR 7 /* record packet route */
|
||||
#define IPOPT_TS 68 /* timestamp */
|
||||
#define IPOPT_TIMESTAMP IPOPT_TS
|
||||
#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
|
||||
#define IPOPT_SEC IPOPT_SECURITY
|
||||
#define IPOPT_LSRR 131 /* loose source route */
|
||||
#define IPOPT_SATID 136 /* satnet id */
|
||||
#define IPOPT_SID IPOPT_SATID
|
||||
#define IPOPT_SSRR 137 /* strict source route */
|
||||
#define IPOPT_RA 148 /* router alert */
|
||||
|
||||
/*
|
||||
* Offsets to fields in options other than EOL and NOP.
|
||||
*/
|
||||
#define IPOPT_OPTVAL 0 /* option ID */
|
||||
#define IPOPT_OLEN 1 /* option length */
|
||||
#define IPOPT_OFFSET 2 /* offset within option */
|
||||
#define IPOPT_MINOFF 4 /* min value of above */
|
||||
|
||||
#define MAX_IPOPTLEN 40
|
||||
|
||||
/* flag bits for ipt_flg */
|
||||
#define IPOPT_TS_TSONLY 0 /* timestamps only */
|
||||
#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
|
||||
#define IPOPT_TS_PRESPEC 3 /* specified modules only */
|
||||
|
||||
/* bits for security (not byte swapped) */
|
||||
#define IPOPT_SECUR_UNCLASS 0x0000
|
||||
#define IPOPT_SECUR_CONFID 0xf135
|
||||
#define IPOPT_SECUR_EFTO 0x789a
|
||||
#define IPOPT_SECUR_MMMM 0xbc4d
|
||||
#define IPOPT_SECUR_RESTR 0xaf13
|
||||
#define IPOPT_SECUR_SECRET 0xd788
|
||||
#define IPOPT_SECUR_TOPSECRET 0x6bc5
|
||||
|
||||
/*
|
||||
* Internet implementation parameters.
|
||||
*/
|
||||
#define MAXTTL 255 /* maximum time to live (seconds) */
|
||||
#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
|
||||
#define IPFRAGTTL 60 /* time to live for frags, slowhz */
|
||||
#define IPTTLDEC 1 /* subtracted when forwarding */
|
||||
|
||||
#define IP_MSS 576 /* default maximum segment size */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* netinet/ip.h */
|
330
contrib/libc-headers/netinet/tcp.h
Normal file
330
contrib/libc-headers/netinet/tcp.h
Normal file
@ -0,0 +1,330 @@
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tcp.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_TCP_H
|
||||
#define _NETINET_TCP_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/*
|
||||
* 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. */
|
||||
#define TCP_CONGESTION 13 /* Congestion control algorithm. */
|
||||
#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
|
||||
#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */
|
||||
#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
|
||||
#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
|
||||
#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
|
||||
#define TCP_REPAIR 19 /* TCP sock is under repair right now */
|
||||
#define TCP_REPAIR_QUEUE 20 /* Set TCP queue to repair */
|
||||
#define TCP_QUEUE_SEQ 21 /* Set sequence number of repaired queue. */
|
||||
#define TCP_REPAIR_OPTIONS 22 /* Repair TCP connection options */
|
||||
#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */
|
||||
#define TCP_TIMESTAMP 24 /* TCP time stamp */
|
||||
#define TCP_NOTSENT_LOWAT 25 /* Limit number of unsent bytes in
|
||||
write queue. */
|
||||
#define TCP_CC_INFO 26 /* Get Congestion Control
|
||||
(optional) info. */
|
||||
#define TCP_SAVE_SYN 27 /* Record SYN headers for new
|
||||
connections. */
|
||||
#define TCP_SAVED_SYN 28 /* Get SYN headers recorded for
|
||||
connection. */
|
||||
#define TCP_REPAIR_WINDOW 29 /* Get/set window parameters. */
|
||||
#define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect. */
|
||||
#define TCP_ULP 31 /* Attach a ULP to a TCP connection. */
|
||||
#define TCP_MD5SIG_EXT 32 /* TCP MD5 Signature with extensions. */
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
# include <stdint.h>
|
||||
|
||||
typedef uint32_t tcp_seq;
|
||||
/*
|
||||
* TCP header.
|
||||
* Per RFC 793, September, 1981.
|
||||
*/
|
||||
struct tcphdr
|
||||
{
|
||||
__extension__ union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint16_t th_sport; /* source port */
|
||||
uint16_t th_dport; /* destination port */
|
||||
tcp_seq th_seq; /* sequence number */
|
||||
tcp_seq th_ack; /* acknowledgement number */
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
uint8_t th_x2:4; /* (unused) */
|
||||
uint8_t th_off:4; /* data offset */
|
||||
# endif
|
||||
# if __BYTE_ORDER == __BIG_ENDIAN
|
||||
uint8_t th_off:4; /* data offset */
|
||||
uint8_t th_x2:4; /* (unused) */
|
||||
# endif
|
||||
uint8_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
|
||||
uint16_t th_win; /* window */
|
||||
uint16_t th_sum; /* checksum */
|
||||
uint16_t th_urp; /* urgent pointer */
|
||||
};
|
||||
struct
|
||||
{
|
||||
uint16_t source;
|
||||
uint16_t dest;
|
||||
uint32_t seq;
|
||||
uint32_t ack_seq;
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
uint16_t res1:4;
|
||||
uint16_t doff:4;
|
||||
uint16_t fin:1;
|
||||
uint16_t syn:1;
|
||||
uint16_t rst:1;
|
||||
uint16_t psh:1;
|
||||
uint16_t ack:1;
|
||||
uint16_t urg:1;
|
||||
uint16_t res2:2;
|
||||
# elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
uint16_t doff:4;
|
||||
uint16_t res1:4;
|
||||
uint16_t res2:2;
|
||||
uint16_t urg:1;
|
||||
uint16_t ack:1;
|
||||
uint16_t psh:1;
|
||||
uint16_t rst:1;
|
||||
uint16_t syn:1;
|
||||
uint16_t fin:1;
|
||||
# else
|
||||
# error "Adjust your <bits/endian.h> defines"
|
||||
# endif
|
||||
uint16_t window;
|
||||
uint16_t check;
|
||||
uint16_t urg_ptr;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TCP_ESTABLISHED = 1,
|
||||
TCP_SYN_SENT,
|
||||
TCP_SYN_RECV,
|
||||
TCP_FIN_WAIT1,
|
||||
TCP_FIN_WAIT2,
|
||||
TCP_TIME_WAIT,
|
||||
TCP_CLOSE,
|
||||
TCP_CLOSE_WAIT,
|
||||
TCP_LAST_ACK,
|
||||
TCP_LISTEN,
|
||||
TCP_CLOSING /* now a valid state */
|
||||
};
|
||||
|
||||
# define TCPOPT_EOL 0
|
||||
# define TCPOPT_NOP 1
|
||||
# define TCPOPT_MAXSEG 2
|
||||
# define TCPOLEN_MAXSEG 4
|
||||
# define TCPOPT_WINDOW 3
|
||||
# define TCPOLEN_WINDOW 3
|
||||
# define TCPOPT_SACK_PERMITTED 4 /* Experimental */
|
||||
# define TCPOLEN_SACK_PERMITTED 2
|
||||
# define TCPOPT_SACK 5 /* Experimental */
|
||||
# define TCPOPT_TIMESTAMP 8
|
||||
# define TCPOLEN_TIMESTAMP 10
|
||||
# define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
|
||||
|
||||
# define TCPOPT_TSTAMP_HDR \
|
||||
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
|
||||
|
||||
/*
|
||||
* Default maximum segment size for TCP.
|
||||
* With an IP MSS of 576, this is 536,
|
||||
* but 512 is probably more convenient.
|
||||
* This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
|
||||
*/
|
||||
# define TCP_MSS 512
|
||||
|
||||
# define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
|
||||
|
||||
# define TCP_MAX_WINSHIFT 14 /* maximum window shift */
|
||||
|
||||
# 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 /* ECN was negociated at TCP session init */
|
||||
# define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */
|
||||
# define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */
|
||||
|
||||
/* 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
|
||||
{
|
||||
uint8_t tcpi_state;
|
||||
uint8_t tcpi_ca_state;
|
||||
uint8_t tcpi_retransmits;
|
||||
uint8_t tcpi_probes;
|
||||
uint8_t tcpi_backoff;
|
||||
uint8_t tcpi_options;
|
||||
uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
|
||||
|
||||
uint32_t tcpi_rto;
|
||||
uint32_t tcpi_ato;
|
||||
uint32_t tcpi_snd_mss;
|
||||
uint32_t tcpi_rcv_mss;
|
||||
|
||||
uint32_t tcpi_unacked;
|
||||
uint32_t tcpi_sacked;
|
||||
uint32_t tcpi_lost;
|
||||
uint32_t tcpi_retrans;
|
||||
uint32_t tcpi_fackets;
|
||||
|
||||
/* Times. */
|
||||
uint32_t tcpi_last_data_sent;
|
||||
uint32_t tcpi_last_ack_sent; /* Not remembered, sorry. */
|
||||
uint32_t tcpi_last_data_recv;
|
||||
uint32_t tcpi_last_ack_recv;
|
||||
|
||||
/* Metrics. */
|
||||
uint32_t tcpi_pmtu;
|
||||
uint32_t tcpi_rcv_ssthresh;
|
||||
uint32_t tcpi_rtt;
|
||||
uint32_t tcpi_rttvar;
|
||||
uint32_t tcpi_snd_ssthresh;
|
||||
uint32_t tcpi_snd_cwnd;
|
||||
uint32_t tcpi_advmss;
|
||||
uint32_t tcpi_reordering;
|
||||
|
||||
uint32_t tcpi_rcv_rtt;
|
||||
uint32_t tcpi_rcv_space;
|
||||
|
||||
uint32_t tcpi_total_retrans;
|
||||
};
|
||||
|
||||
|
||||
/* For TCP_MD5SIG socket option. */
|
||||
#define TCP_MD5SIG_MAXKEYLEN 80
|
||||
|
||||
/* tcp_md5sig extension flags for TCP_MD5SIG_EXT. */
|
||||
#define TCP_MD5SIG_FLAG_PREFIX 1 /* Address prefix length. */
|
||||
|
||||
struct tcp_md5sig
|
||||
{
|
||||
struct sockaddr_storage tcpm_addr; /* Address associated. */
|
||||
uint8_t tcpm_flags; /* Extension flags. */
|
||||
uint8_t tcpm_prefixlen; /* Address prefix. */
|
||||
uint16_t tcpm_keylen; /* Key length. */
|
||||
uint32_t __tcpm_pad; /* Zero. */
|
||||
uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */
|
||||
};
|
||||
|
||||
/* For socket repair options. */
|
||||
struct tcp_repair_opt
|
||||
{
|
||||
uint32_t opt_code;
|
||||
uint32_t opt_val;
|
||||
};
|
||||
|
||||
/* Queue to repair, for TCP_REPAIR_QUEUE. */
|
||||
enum
|
||||
{
|
||||
TCP_NO_QUEUE,
|
||||
TCP_RECV_QUEUE,
|
||||
TCP_SEND_QUEUE,
|
||||
TCP_QUEUES_NR,
|
||||
};
|
||||
|
||||
/* For cookie transactions socket options. */
|
||||
#define TCP_COOKIE_MIN 8 /* 64-bits */
|
||||
#define TCP_COOKIE_MAX 16 /* 128-bits */
|
||||
#define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX)
|
||||
|
||||
/* Flags for both getsockopt and setsockopt */
|
||||
#define TCP_COOKIE_IN_ALWAYS (1 << 0) /* Discard SYN without cookie */
|
||||
#define TCP_COOKIE_OUT_NEVER (1 << 1) /* Prohibit outgoing cookies,
|
||||
* supercedes everything. */
|
||||
|
||||
/* Flags for getsockopt */
|
||||
#define TCP_S_DATA_IN (1 << 2) /* Was data received? */
|
||||
#define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */
|
||||
|
||||
#define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */
|
||||
#define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */
|
||||
|
||||
struct tcp_cookie_transactions
|
||||
{
|
||||
uint16_t tcpct_flags;
|
||||
uint8_t __tcpct_pad1;
|
||||
uint8_t tcpct_cookie_desired;
|
||||
uint16_t tcpct_s_data_desired;
|
||||
uint16_t tcpct_used;
|
||||
uint8_t tcpct_value[TCP_MSS_DEFAULT];
|
||||
};
|
||||
|
||||
/* For use with TCP_REPAIR_WINDOW. */
|
||||
struct tcp_repair_window
|
||||
{
|
||||
uint32_t snd_wl1;
|
||||
uint32_t snd_wnd;
|
||||
uint32_t max_window;
|
||||
uint32_t rcv_wnd;
|
||||
uint32_t rcv_wup;
|
||||
};
|
||||
|
||||
#endif /* Misc. */
|
||||
|
||||
#endif /* netinet/tcp.h */
|
54
contrib/libc-headers/nl_types.h
Normal file
54
contrib/libc-headers/nl_types.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* Copyright (C) 1996-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _NL_TYPES_H
|
||||
#define _NL_TYPES_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* The default message set used by the gencat program. */
|
||||
#define NL_SETD 1
|
||||
|
||||
/* Value for FLAG parameter of `catgets' to say we want XPG4 compliance. */
|
||||
#define NL_CAT_LOCALE 1
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Message catalog descriptor type. */
|
||||
typedef void *nl_catd;
|
||||
|
||||
/* Type used by `nl_langinfo'. */
|
||||
typedef int nl_item;
|
||||
|
||||
/* Open message catalog for later use, returning descriptor.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern nl_catd catopen (const char *__cat_name, int __flag) __nonnull ((1));
|
||||
|
||||
/* 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) __THROW __nonnull ((1));
|
||||
|
||||
/* Close message CATALOG. */
|
||||
extern int catclose (nl_catd __catalog) __THROW __nonnull ((1));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* nl_types.h */
|
1
contrib/libc-headers/poll.h
Normal file
1
contrib/libc-headers/poll.h
Normal file
@ -0,0 +1 @@
|
||||
#include <sys/poll.h>
|
1162
contrib/libc-headers/pthread.h
Normal file
1162
contrib/libc-headers/pthread.h
Normal file
File diff suppressed because it is too large
Load Diff
188
contrib/libc-headers/pwd.h
Normal file
188
contrib/libc-headers/pwd.h
Normal file
@ -0,0 +1,188 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* POSIX Standard: 9.2.2 User Database Access <pwd.h>
|
||||
*/
|
||||
|
||||
#ifndef _PWD_H
|
||||
#define _PWD_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <bits/types.h>
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined __USE_XOPEN || defined __USE_XOPEN2K
|
||||
/* 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. */
|
||||
char *pw_gecos; /* Real name. */
|
||||
char *pw_dir; /* Home directory. */
|
||||
char *pw_shell; /* Shell program. */
|
||||
};
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# include <bits/types/FILE.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
|
||||
/* Rewind the password-file stream.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void setpwent (void);
|
||||
|
||||
/* Close the password-file stream.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void endpwent (void);
|
||||
|
||||
/* Read an entry from the password-file stream, opening it if necessary.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct passwd *getpwent (void);
|
||||
#endif
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Read an entry from STREAM.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern struct passwd *fgetpwent (FILE *__stream) __nonnull ((1));
|
||||
|
||||
/* Write the given entry onto the given stream.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int putpwent (const struct passwd *__restrict __p,
|
||||
FILE *__restrict __f);
|
||||
#endif
|
||||
|
||||
/* Search for an entry with a matching user ID.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct passwd *getpwuid (__uid_t __uid);
|
||||
|
||||
/* Search for an entry with a matching username.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct passwd *getpwnam (const char *__name) __nonnull ((1));
|
||||
|
||||
#ifdef __USE_POSIX
|
||||
|
||||
# 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. */
|
||||
|
||||
# ifdef __USE_MISC
|
||||
/* This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int getpwent_r (struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result)
|
||||
__nonnull ((1, 2, 4));
|
||||
# endif
|
||||
|
||||
extern int getpwuid_r (__uid_t __uid,
|
||||
struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result)
|
||||
__nonnull ((2, 3, 5));
|
||||
|
||||
extern int getpwnam_r (const char *__restrict __name,
|
||||
struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result)
|
||||
__nonnull ((1, 2, 3, 5));
|
||||
|
||||
|
||||
# ifdef __USE_MISC
|
||||
/* Read an entry from STREAM. This function is not standardized and
|
||||
probably never will.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int fgetpwent_r (FILE *__restrict __stream,
|
||||
struct passwd *__restrict __resultbuf,
|
||||
char *__restrict __buffer, size_t __buflen,
|
||||
struct passwd **__restrict __result)
|
||||
__nonnull ((1, 2, 3, 5));
|
||||
# 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.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int getpw (__uid_t __uid, char *__buffer);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* pwd.h */
|
581
contrib/libc-headers/regex.h
Normal file
581
contrib/libc-headers/regex.h
Normal file
@ -0,0 +1,581 @@
|
||||
/* Definitions for data structures and routines for the regular
|
||||
expression library.
|
||||
Copyright (C) 1985, 1989-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _REGEX_H
|
||||
#define _REGEX_H 1
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Allow the use in C++ code. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The following two types have to be signed and unsigned integer type
|
||||
wide enough to hold a value of a pointer. For most ANSI compilers
|
||||
ptrdiff_t and size_t should be likely OK. Still size of these two
|
||||
types is 2 for Microsoft C. Ugh... */
|
||||
typedef long int s_reg_t;
|
||||
typedef unsigned long int active_reg_t;
|
||||
|
||||
/* The following bits are used to determine the regexp syntax we
|
||||
recognize. The set/not-set meanings are chosen so that Emacs syntax
|
||||
remains the value 0. The bits are given in alphabetical order, and
|
||||
the definitions shifted by one from the previous bit; thus, when we
|
||||
add or remove a bit, only one other definition need change. */
|
||||
typedef unsigned long int reg_syntax_t;
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* If this bit is not set, then \ inside a bracket expression is literal.
|
||||
If set, then such a \ quotes the following character. */
|
||||
# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
|
||||
|
||||
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||
literals.
|
||||
If set, then \+ and \? are operators and + and ? are literals. */
|
||||
# define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
||||
|
||||
/* If this bit is set, then character classes are supported. They are:
|
||||
[:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
|
||||
[:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
|
||||
If not set, then character classes are not supported. */
|
||||
# define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
|
||||
|
||||
/* If this bit is set, then ^ and $ are always anchors (outside bracket
|
||||
expressions, of course).
|
||||
If this bit is not set, then it depends:
|
||||
^ is an anchor if it is at the beginning of a regular
|
||||
expression or after an open-group or an alternation operator;
|
||||
$ is an anchor if it is at the end of a regular expression, or
|
||||
before a close-group or an alternation operator.
|
||||
|
||||
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
||||
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
||||
We already implemented a previous draft which made those constructs
|
||||
invalid, though, so we haven't changed the code back. */
|
||||
# define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
|
||||
|
||||
/* If this bit is set, then special characters are always special
|
||||
regardless of where they are in the pattern.
|
||||
If this bit is not set, then special characters are special only in
|
||||
some contexts; otherwise they are ordinary. Specifically,
|
||||
* + ? and intervals are only special when not after the beginning,
|
||||
open-group, or alternation operator. */
|
||||
# define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
||||
|
||||
/* If this bit is set, then *, +, ?, and { cannot be first in an re or
|
||||
immediately after an alternation or begin-group operator. */
|
||||
# define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . matches newline.
|
||||
If not set, then it doesn't. */
|
||||
# define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . doesn't match NUL.
|
||||
If not set, then it does. */
|
||||
# define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, nonmatching lists [^...] do not match newline.
|
||||
If not set, they do. */
|
||||
# define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
||||
|
||||
/* If this bit is set, either \{...\} or {...} defines an
|
||||
interval, depending on RE_NO_BK_BRACES.
|
||||
If not set, \{, \}, {, and } are literals. */
|
||||
# define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, +, ? and | aren't recognized as operators.
|
||||
If not set, they are. */
|
||||
# define RE_LIMITED_OPS (RE_INTERVALS << 1)
|
||||
|
||||
/* If this bit is set, newline is an alternation operator.
|
||||
If not set, newline is literal. */
|
||||
# define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
|
||||
|
||||
/* If this bit is set, then `{...}' defines an interval, and \{ and \}
|
||||
are literals.
|
||||
If not set, then `\{...\}' defines an interval. */
|
||||
# define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
|
||||
|
||||
/* If this bit is set, (...) defines a group, and \( and \) are literals.
|
||||
If not set, \(...\) defines a group, and ( and ) are literals. */
|
||||
# define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
|
||||
|
||||
/* If this bit is set, then \<digit> matches <digit>.
|
||||
If not set, then \<digit> is a back-reference. */
|
||||
# define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
||||
|
||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||
If not set, then \| is an alternation operator, and | is literal. */
|
||||
# define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
||||
|
||||
/* If this bit is set, then an ending range point collating higher
|
||||
than the starting range point, as in [z-a], is invalid.
|
||||
If not set, then when ending range point collates higher than the
|
||||
starting range point, the range is ignored. */
|
||||
# define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
|
||||
|
||||
/* If this bit is set, then an unmatched ) is ordinary.
|
||||
If not set, then an unmatched ) is invalid. */
|
||||
# define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
|
||||
|
||||
/* If this bit is set, succeed as soon as we match the whole pattern,
|
||||
without further backtracking. */
|
||||
# define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
|
||||
|
||||
/* If this bit is set, do not process the GNU regex operators.
|
||||
If not set, then the GNU regex operators are recognized. */
|
||||
# define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
|
||||
|
||||
/* If this bit is set, turn on internal regex debugging.
|
||||
If not set, and debugging was on, turn it off.
|
||||
This only works if regex.c is compiled -DDEBUG.
|
||||
We define this bit always, so that all that's needed to turn on
|
||||
debugging is to recompile regex.c; the calling code can always have
|
||||
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)
|
||||
|
||||
/* If this bit is set, then ignore case when matching.
|
||||
If not set, then case is significant. */
|
||||
# define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
|
||||
|
||||
/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
|
||||
for ^, because it is difficult to scan the regex backwards to find
|
||||
whether ^ should be special. */
|
||||
# define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
|
||||
|
||||
/* If this bit is set, then \{ cannot be first in an bre or
|
||||
immediately after an alternation or begin-group operator. */
|
||||
# define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
|
||||
|
||||
/* If this bit is set, then no_sub will be set to 1 during
|
||||
re_compile_pattern. */
|
||||
# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
already-compiled regexps. */
|
||||
extern reg_syntax_t re_syntax_options;
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Define combinations of the above bits for the standard possibilities.
|
||||
(The [[[ comments delimit what gets put into the Texinfo file, so
|
||||
don't delete them!) */
|
||||
/* [[[begin syntaxes]]] */
|
||||
#define RE_SYNTAX_EMACS 0
|
||||
|
||||
#define RE_SYNTAX_AWK \
|
||||
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CHAR_CLASSES \
|
||||
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
|
||||
|
||||
#define RE_SYNTAX_GNU_AWK \
|
||||
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
|
||||
| RE_INVALID_INTERVAL_ORD) \
|
||||
& ~(RE_DOT_NOT_NULL | RE_CONTEXT_INDEP_OPS \
|
||||
| RE_CONTEXT_INVALID_OPS ))
|
||||
|
||||
#define RE_SYNTAX_POSIX_AWK \
|
||||
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
|
||||
| RE_INTERVALS | RE_NO_GNU_OPS \
|
||||
| RE_INVALID_INTERVAL_ORD)
|
||||
|
||||
#define RE_SYNTAX_GREP \
|
||||
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
|
||||
| RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
|
||||
| RE_NEWLINE_ALT)
|
||||
|
||||
#define RE_SYNTAX_EGREP \
|
||||
(RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
|
||||
| RE_NEWLINE_ALT | RE_NO_BK_PARENS \
|
||||
| RE_NO_BK_VBAR)
|
||||
|
||||
#define RE_SYNTAX_POSIX_EGREP \
|
||||
(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
|
||||
|
||||
#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
/* Syntax bits common to both basic and extended POSIX regex syntax. */
|
||||
#define _RE_SYNTAX_POSIX_COMMON \
|
||||
(RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
|
||||
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
|
||||
|
||||
#define RE_SYNTAX_POSIX_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
|
||||
|
||||
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
|
||||
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
|
||||
isn't minimal, since other operators, such as \`, aren't disabled. */
|
||||
#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
|
||||
|
||||
#define RE_SYNTAX_POSIX_EXTENDED \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
|
||||
| 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_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 \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
/* [[[end syntaxes]]] */
|
||||
|
||||
/* Maximum number of duplicates an interval can allow. Some systems
|
||||
(erroneously) define this in other header files, but we want our
|
||||
value, so remove any previous define. */
|
||||
# ifdef RE_DUP_MAX
|
||||
# undef RE_DUP_MAX
|
||||
# endif
|
||||
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
|
||||
# define RE_DUP_MAX (0x7fff)
|
||||
#endif
|
||||
|
||||
|
||||
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
||||
|
||||
/* If this bit is set, then use extended regular expression syntax.
|
||||
If not set, then use basic regular expression syntax. */
|
||||
#define REG_EXTENDED 1
|
||||
|
||||
/* If this bit is set, then ignore case when matching.
|
||||
If not set, then case is significant. */
|
||||
#define REG_ICASE (REG_EXTENDED << 1)
|
||||
|
||||
/* If this bit is set, then anchors do not match at newline
|
||||
characters in the string.
|
||||
If not set, then anchors do match at newlines. */
|
||||
#define REG_NEWLINE (REG_ICASE << 1)
|
||||
|
||||
/* If this bit is set, then report only success or fail in regexec.
|
||||
If not set, then returns differ between not matching and errors. */
|
||||
#define REG_NOSUB (REG_NEWLINE << 1)
|
||||
|
||||
|
||||
/* POSIX `eflags' bits (i.e., information for regexec). */
|
||||
|
||||
/* If this bit is set, then the beginning-of-line operator doesn't match
|
||||
the beginning of the string (presumably because it's not the
|
||||
beginning of a line).
|
||||
If not set, then the beginning-of-line operator does match the
|
||||
beginning of the string. */
|
||||
#define REG_NOTBOL 1
|
||||
|
||||
/* Like REG_NOTBOL, except for the end-of-line. */
|
||||
#define REG_NOTEOL (1 << 1)
|
||||
|
||||
/* Use PMATCH[0] to delimit the start and end of the search in the
|
||||
buffer. */
|
||||
#define REG_STARTEND (1 << 2)
|
||||
|
||||
|
||||
/* If any error codes are removed, changed, or added, update the
|
||||
`re_error_msg' table in regex.c. */
|
||||
typedef enum
|
||||
{
|
||||
#if defined _XOPEN_SOURCE || defined __USE_XOPEN2K
|
||||
REG_ENOSYS = -1, /* This will never happen for this implementation. */
|
||||
#endif
|
||||
|
||||
REG_NOERROR = 0, /* Success. */
|
||||
REG_NOMATCH, /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
REG_BADPAT, /* Invalid pattern. */
|
||||
REG_ECOLLATE, /* Invalid collating element. */
|
||||
REG_ECTYPE, /* Invalid character class name. */
|
||||
REG_EESCAPE, /* Trailing backslash. */
|
||||
REG_ESUBREG, /* Invalid back reference. */
|
||||
REG_EBRACK, /* Unmatched left bracket. */
|
||||
REG_EPAREN, /* Parenthesis imbalance. */
|
||||
REG_EBRACE, /* Unmatched \{. */
|
||||
REG_BADBR, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE, /* Invalid range end. */
|
||||
REG_ESPACE, /* Ran out of memory. */
|
||||
REG_BADRPT, /* No preceding re for repetition op. */
|
||||
|
||||
/* Error codes we've added. */
|
||||
REG_EEND, /* Premature end. */
|
||||
REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
|
||||
REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
|
||||
} reg_errcode_t;
|
||||
|
||||
/* This data structure represents a compiled pattern. Before calling
|
||||
the pattern compiler, the fields `buffer', `allocated', `fastmap',
|
||||
and `translate' can be set. After the pattern has been compiled,
|
||||
the fields `re_nsub', `not_bol' and `not_eol' are available. All
|
||||
other fields are private to the regex routines. */
|
||||
|
||||
#ifndef RE_TRANSLATE_TYPE
|
||||
# define __RE_TRANSLATE_TYPE unsigned char *
|
||||
# ifdef __USE_GNU
|
||||
# define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
# define __REPB_PREFIX(name) name
|
||||
#else
|
||||
# define __REPB_PREFIX(name) __##name
|
||||
#endif
|
||||
|
||||
struct re_pattern_buffer
|
||||
{
|
||||
/* Space that holds the compiled pattern. It is declared as
|
||||
`unsigned char *' because its elements are sometimes used as
|
||||
array indexes. */
|
||||
unsigned char *__REPB_PREFIX(buffer);
|
||||
|
||||
/* Number of bytes to which `buffer' points. */
|
||||
unsigned long int __REPB_PREFIX(allocated);
|
||||
|
||||
/* Number of bytes actually used in `buffer'. */
|
||||
unsigned long int __REPB_PREFIX(used);
|
||||
|
||||
/* Syntax setting with which the pattern was compiled. */
|
||||
reg_syntax_t __REPB_PREFIX(syntax);
|
||||
|
||||
/* Pointer to a fastmap, if any, otherwise zero. re_search uses the
|
||||
fastmap, if there is one, to skip over impossible starting points
|
||||
for matches. */
|
||||
char *__REPB_PREFIX(fastmap);
|
||||
|
||||
/* Either a translate table to apply to all characters before
|
||||
comparing them, or zero for no translation. The translation is
|
||||
applied to a pattern when it is compiled and to a string when it
|
||||
is matched. */
|
||||
__RE_TRANSLATE_TYPE __REPB_PREFIX(translate);
|
||||
|
||||
/* Number of subexpressions found by the compiler. */
|
||||
size_t re_nsub;
|
||||
|
||||
/* Zero if this pattern cannot match the empty string, one else.
|
||||
Well, in truth it's used only in `re_search_2', to see whether or
|
||||
not we should use the fastmap, so we don't set this absolutely
|
||||
perfectly; see `re_compile_fastmap' (the `duplicate' case). */
|
||||
unsigned __REPB_PREFIX(can_be_null) : 1;
|
||||
|
||||
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
|
||||
for `max (RE_NREGS, re_nsub + 1)' groups.
|
||||
If REGS_REALLOCATE, reallocate space if necessary.
|
||||
If REGS_FIXED, use what's there. */
|
||||
#ifdef __USE_GNU
|
||||
# define REGS_UNALLOCATED 0
|
||||
# define REGS_REALLOCATE 1
|
||||
# define REGS_FIXED 2
|
||||
#endif
|
||||
unsigned __REPB_PREFIX(regs_allocated) : 2;
|
||||
|
||||
/* Set to zero when `regex_compile' compiles a pattern; set to one
|
||||
by `re_compile_fastmap' if it updates the fastmap. */
|
||||
unsigned __REPB_PREFIX(fastmap_accurate) : 1;
|
||||
|
||||
/* If set, `re_match_2' does not return information about
|
||||
subexpressions. */
|
||||
unsigned __REPB_PREFIX(no_sub) : 1;
|
||||
|
||||
/* If set, a beginning-of-line anchor doesn't match at the beginning
|
||||
of the string. */
|
||||
unsigned __REPB_PREFIX(not_bol) : 1;
|
||||
|
||||
/* Similarly for an end-of-line anchor. */
|
||||
unsigned __REPB_PREFIX(not_eol) : 1;
|
||||
|
||||
/* If true, an anchor at a newline matches. */
|
||||
unsigned __REPB_PREFIX(newline_anchor) : 1;
|
||||
};
|
||||
|
||||
typedef struct re_pattern_buffer regex_t;
|
||||
|
||||
/* Type for byte offsets within the string. POSIX mandates this. */
|
||||
typedef int regoff_t;
|
||||
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* This is the structure we store register match data in. See
|
||||
regex.texinfo for a full description of what registers match. */
|
||||
struct re_registers
|
||||
{
|
||||
unsigned num_regs;
|
||||
regoff_t *start;
|
||||
regoff_t *end;
|
||||
};
|
||||
|
||||
|
||||
/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
|
||||
`re_match_2' returns information about at least this many registers
|
||||
the first time a `regs' structure is passed. */
|
||||
# ifndef RE_NREGS
|
||||
# define RE_NREGS 30
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* POSIX specification for registers. Aside from the different names than
|
||||
`re_registers', POSIX uses an array of structures, instead of a
|
||||
structure of arrays. */
|
||||
typedef struct
|
||||
{
|
||||
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
|
||||
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
|
||||
} regmatch_t;
|
||||
|
||||
/* Declarations for routines. */
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Sets the current default syntax to SYNTAX, and return the old syntax.
|
||||
You can also simply assign to the `re_syntax_options' variable. */
|
||||
extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
|
||||
|
||||
/* Compile the regular expression PATTERN, with length LENGTH
|
||||
and syntax given by the global `re_syntax_options', into the buffer
|
||||
BUFFER. Return NULL if successful, and an error string if not.
|
||||
|
||||
To free the allocated storage, you must call `regfree' on BUFFER.
|
||||
Note that the translate table must either have been initialised by
|
||||
`regcomp', with a malloc'ed value, or set to NULL before calling
|
||||
`regfree'. */
|
||||
extern const char *re_compile_pattern (const char *__pattern, size_t __length,
|
||||
struct re_pattern_buffer *__buffer);
|
||||
|
||||
|
||||
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
||||
accelerate searches. Return 0 if successful and -2 if was an
|
||||
internal error. */
|
||||
extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
|
||||
|
||||
|
||||
/* Search in the string STRING (with length LENGTH) for the pattern
|
||||
compiled into BUFFER. Start searching at position START, for RANGE
|
||||
characters. Return the starting position of the match, -1 for no
|
||||
match, or -2 for an internal error. Also return register
|
||||
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
||||
extern int re_search (struct re_pattern_buffer *__buffer, const char *__string,
|
||||
int __length, int __start, int __range,
|
||||
struct re_registers *__regs);
|
||||
|
||||
|
||||
/* Like `re_search', but search in the concatenation of STRING1 and
|
||||
STRING2. Also, stop searching at index START + STOP. */
|
||||
extern int re_search_2 (struct re_pattern_buffer *__buffer,
|
||||
const char *__string1, int __length1,
|
||||
const char *__string2, int __length2, int __start,
|
||||
int __range, struct re_registers *__regs, int __stop);
|
||||
|
||||
|
||||
/* Like `re_search', but return how many characters in STRING the regexp
|
||||
in BUFFER matched, starting at position START. */
|
||||
extern int re_match (struct re_pattern_buffer *__buffer, const char *__string,
|
||||
int __length, int __start, struct re_registers *__regs);
|
||||
|
||||
|
||||
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
||||
extern int re_match_2 (struct re_pattern_buffer *__buffer,
|
||||
const char *__string1, int __length1,
|
||||
const char *__string2, int __length2, int __start,
|
||||
struct re_registers *__regs, int __stop);
|
||||
|
||||
|
||||
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
||||
ENDS. Subsequent matches using BUFFER and REGS will use this memory
|
||||
for recording register information. STARTS and ENDS must be
|
||||
allocated with malloc, and must each be at least `NUM_REGS * sizeof
|
||||
(regoff_t)' bytes long.
|
||||
|
||||
If NUM_REGS == 0, then subsequent matches should allocate their own
|
||||
register data.
|
||||
|
||||
Unless this function is called, the first search or match using
|
||||
PATTERN_BUFFER will allocate its own register data, without
|
||||
freeing the old data. */
|
||||
extern void re_set_registers (struct re_pattern_buffer *__buffer,
|
||||
struct re_registers *__regs,
|
||||
unsigned int __num_regs,
|
||||
regoff_t *__starts, regoff_t *__ends);
|
||||
#endif /* Use GNU */
|
||||
|
||||
#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_MISC)
|
||||
# ifndef _CRAY
|
||||
/* 4.2 bsd compatibility. */
|
||||
extern char *re_comp (const char *);
|
||||
extern int re_exec (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
|
||||
/* gcc 3.1 and up support the [restrict] syntax. */
|
||||
#ifndef __restrict_arr
|
||||
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \
|
||||
&& !defined __GNUG__
|
||||
# define __restrict_arr __restrict
|
||||
# else
|
||||
# define __restrict_arr
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* POSIX compatibility. */
|
||||
extern int regcomp (regex_t *__restrict __preg,
|
||||
const char *__restrict __pattern,
|
||||
int __cflags);
|
||||
|
||||
extern int regexec (const regex_t *__restrict __preg,
|
||||
const char *__restrict __string, size_t __nmatch,
|
||||
regmatch_t __pmatch[__restrict_arr],
|
||||
int __eflags);
|
||||
|
||||
extern size_t regerror (int __errcode, const regex_t *__restrict __preg,
|
||||
char *__restrict __errbuf, size_t __errbuf_size);
|
||||
|
||||
extern void regfree (regex_t *__preg);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
||||
#endif /* regex.h */
|
304
contrib/libc-headers/resolv.h
Normal file
304
contrib/libc-headers/resolv.h
Normal file
@ -0,0 +1,304 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1987, 1989
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)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/cdefs.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/nameser.h>
|
||||
#include <bits/types/res_state.h>
|
||||
|
||||
/*
|
||||
* Global defines and variables for resolver stub.
|
||||
*/
|
||||
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
|
||||
|
||||
#define RES_TIMEOUT 5 /* min. seconds between retries */
|
||||
#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. */
|
||||
|
||||
#define nsaddr nsaddr_list[0] /* for backward compatibility */
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define __RES 19991006
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
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" */
|
||||
};
|
||||
|
||||
/*
|
||||
* 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 \
|
||||
__glibc_macro_warning ("RES_AAONLY is deprecated") 0x00000004
|
||||
#define RES_USEVC 0x00000008 /* use virtual circuit */
|
||||
#define RES_PRIMARY \
|
||||
__glibc_macro_warning ("RES_PRIMARY is deprecated") 0x00000010
|
||||
#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 \
|
||||
__glibc_macro_warning ("RES_USE_INET6 is deprecated") 0x00002000
|
||||
#define RES_ROTATE 0x00004000 /* rotate ns list after each query */
|
||||
#define RES_NOCHECKNAME \
|
||||
__glibc_macro_warning ("RES_NOCHECKNAME is deprecated") 0x00008000
|
||||
#define RES_KEEPTSIG \
|
||||
__glibc_macro_warning ("RES_KEEPTSIG is deprecated") 0x00010000
|
||||
#define RES_BLAST \
|
||||
__glibc_macro_warning ("RES_BLAST is deprecated") 0x00020000
|
||||
#define RES_USE_EDNS0 0x00100000 /* Use EDNS0. */
|
||||
#define RES_SNGLKUP 0x00200000 /* one outstanding request at a time */
|
||||
#define RES_SNGLKUPREOP 0x00400000 /* -"-, but open new socket for each
|
||||
request */
|
||||
#define RES_USE_DNSSEC 0x00800000 /* use DNSSEC using OK bit in OPT */
|
||||
#define RES_NOTLDQUERY 0x01000000 /* Do not look up unqualified name
|
||||
as a TLD. */
|
||||
#define RES_NORELOAD 0x02000000 /* No automatic configuration reload. */
|
||||
|
||||
#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. */
|
||||
__BEGIN_DECLS
|
||||
extern struct __res_state *__res_state(void) __attribute__ ((__const__));
|
||||
__END_DECLS
|
||||
#define _res (*__res_state())
|
||||
|
||||
#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 (const unsigned char *, int, FILE *) __THROW;
|
||||
void fp_query (const unsigned char *, FILE *) __THROW;
|
||||
const char * hostalias (const char *) __THROW;
|
||||
void p_query (const unsigned char *) __THROW;
|
||||
void res_close (void) __THROW;
|
||||
int res_init (void) __THROW;
|
||||
int res_isourserver (const struct sockaddr_in *) __THROW;
|
||||
int res_mkquery (int, const char *, int, int,
|
||||
const unsigned char *, int, const unsigned char *,
|
||||
unsigned char *, int) __THROW;
|
||||
int res_query (const char *, int, int, unsigned char *, int)
|
||||
__THROW;
|
||||
int res_querydomain (const char *, const char *, int, int,
|
||||
unsigned char *, int) __THROW;
|
||||
int res_search (const char *, int, int, unsigned char *, int)
|
||||
__THROW;
|
||||
int res_send (const unsigned char *, int, unsigned char *, int)
|
||||
__THROW;
|
||||
__END_DECLS
|
||||
|
||||
#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_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_nquery __res_nquery
|
||||
#define res_nquerydomain __res_nquerydomain
|
||||
#define res_nsearch __res_nsearch
|
||||
#define res_nsend __res_nsend
|
||||
#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 (const char *) __THROW;
|
||||
int res_ownok (const char *) __THROW;
|
||||
int res_mailok (const char *) __THROW;
|
||||
int res_dnok (const char *) __THROW;
|
||||
int sym_ston (const struct res_sym *, const char *, int *) __THROW;
|
||||
const char * sym_ntos (const struct res_sym *, int, int *) __THROW;
|
||||
const char * sym_ntop (const struct res_sym *, int, int *) __THROW;
|
||||
int b64_ntop (const unsigned char *, size_t, char *, size_t)
|
||||
__THROW;
|
||||
int b64_pton (char const *, unsigned char *, size_t) __THROW;
|
||||
int loc_aton (const char *__ascii, unsigned char *__binary) __THROW;
|
||||
const char * loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW;
|
||||
int dn_skipname (const unsigned char *, const unsigned char *)
|
||||
__THROW;
|
||||
void putlong (uint32_t, unsigned char *) __THROW;
|
||||
void putshort (uint16_t, unsigned char *) __THROW;
|
||||
const char * p_class (int) __THROW;
|
||||
const char * p_time (uint32_t) __THROW;
|
||||
const char * p_type (int) __THROW;
|
||||
const char * p_rcode (int) __THROW;
|
||||
const unsigned char * p_cdnname (const unsigned char *,
|
||||
const unsigned char *, int, FILE *) __THROW;
|
||||
const unsigned char * p_cdname (const unsigned char *, const unsigned char *,
|
||||
FILE *) __THROW;
|
||||
const unsigned char * p_fqnname (const unsigned char *__cp,
|
||||
const unsigned char *__msg,
|
||||
int, char *, int) __THROW;
|
||||
const unsigned char * p_fqname (const unsigned char *,
|
||||
const unsigned char *, FILE *) __THROW;
|
||||
const char * p_option (unsigned long __option) __THROW;
|
||||
int dn_count_labels (const char *) __THROW;
|
||||
int dn_comp (const char *, unsigned char *, int, unsigned char **,
|
||||
unsigned char **) __THROW;
|
||||
int dn_expand (const unsigned char *, const unsigned char *,
|
||||
const unsigned char *, char *, int) __THROW;
|
||||
unsigned int res_randomid (void) __THROW;
|
||||
int res_nameinquery (const char *, int, int,
|
||||
const unsigned char *,
|
||||
const unsigned char *) __THROW;
|
||||
int res_queriesmatch (const unsigned char *,
|
||||
const unsigned char *,
|
||||
const unsigned char *,
|
||||
const unsigned char *) __THROW;
|
||||
/* Things involving a resolver context. */
|
||||
int res_ninit (res_state) __THROW;
|
||||
void fp_resstat (const res_state, FILE *) __THROW;
|
||||
const char * res_hostalias (const res_state, const char *, char *, size_t)
|
||||
__THROW;
|
||||
int res_nquery (res_state, const char *, int, int,
|
||||
unsigned char *, int) __THROW;
|
||||
int res_nsearch (res_state, const char *, int, int,
|
||||
unsigned char *, int) __THROW;
|
||||
int res_nquerydomain (res_state, const char *, const char *, int,
|
||||
int, unsigned char *, int) __THROW;
|
||||
int res_nmkquery (res_state, int, const char *, int, int,
|
||||
const unsigned char *, int,
|
||||
const unsigned char *, unsigned char *, int)
|
||||
__THROW;
|
||||
int res_nsend (res_state, const unsigned char *, int,
|
||||
unsigned char *, int) __THROW;
|
||||
void res_nclose (res_state) __THROW;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RESOLV_H_ */
|
74
contrib/libc-headers/rpc/netdb.h
Normal file
74
contrib/libc-headers/rpc/netdb.h
Normal file
@ -0,0 +1,74 @@
|
||||
/* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle America, Inc.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * 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.
|
||||
* * Neither the name of the "Oracle America, Inc." 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 COPYRIGHT HOLDERS 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
|
||||
* COPYRIGHT HOLDER 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.
|
||||
*/
|
||||
|
||||
/* Cleaned up for GNU C library roland@gnu.ai.mit.edu:
|
||||
added multiple inclusion protection and use of <sys/cdefs.h>.
|
||||
In GNU this file is #include'd by <netdb.h>. */
|
||||
|
||||
#ifndef _RPC_NETDB_H
|
||||
#define _RPC_NETDB_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
struct rpcent
|
||||
{
|
||||
char *r_name; /* Name of server for this rpc program. */
|
||||
char **r_aliases; /* Alias list. */
|
||||
int r_number; /* RPC program number. */
|
||||
};
|
||||
|
||||
extern void setrpcent (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 (const char *__name, struct rpcent *__result_buf,
|
||||
char *__buffer, size_t __buflen,
|
||||
struct rpcent **__result) __THROW;
|
||||
|
||||
extern int getrpcbynumber_r (int __number, struct rpcent *__result_buf,
|
||||
char *__buffer, size_t __buflen,
|
||||
struct rpcent **__result) __THROW;
|
||||
|
||||
extern int getrpcent_r (struct rpcent *__result_buf, char *__buffer,
|
||||
size_t __buflen, struct rpcent **__result) __THROW;
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* rpc/netdb.h */
|
131
contrib/libc-headers/sched.h
Normal file
131
contrib/libc-headers/sched.h
Normal file
@ -0,0 +1,131 @@
|
||||
/* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface.
|
||||
Copyright (C) 1996-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SCHED_H
|
||||
#define _SCHED_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* Get type definitions. */
|
||||
#include <bits/types.h>
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#include <bits/types/time_t.h>
|
||||
#include <bits/types/struct_timespec.h>
|
||||
#ifndef __USE_XOPEN2K
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
#ifndef __pid_t_defined
|
||||
typedef __pid_t pid_t;
|
||||
# define __pid_t_defined
|
||||
#endif
|
||||
|
||||
/* Get system specific constant and data structure definitions. */
|
||||
#include <bits/sched.h>
|
||||
#include <bits/cpu-set.h>
|
||||
|
||||
/* Backward compatibility. */
|
||||
#define sched_priority sched_priority
|
||||
#define __sched_priority sched_priority
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Set scheduling parameters for a process. */
|
||||
extern int sched_setparam (__pid_t __pid, const struct sched_param *__param)
|
||||
__THROW;
|
||||
|
||||
/* Retrieve scheduling parameters for a particular process. */
|
||||
extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __THROW;
|
||||
|
||||
/* Set scheduling algorithm and/or parameters for a process. */
|
||||
extern int sched_setscheduler (__pid_t __pid, int __policy,
|
||||
const struct sched_param *__param) __THROW;
|
||||
|
||||
/* Retrieve scheduling algorithm for a particular purpose. */
|
||||
extern int sched_getscheduler (__pid_t __pid) __THROW;
|
||||
|
||||
/* Yield the processor. */
|
||||
extern int sched_yield (void) __THROW;
|
||||
|
||||
/* Get maximum priority value for a scheduler. */
|
||||
extern int sched_get_priority_max (int __algorithm) __THROW;
|
||||
|
||||
/* Get minimum priority value for a scheduler. */
|
||||
extern int sched_get_priority_min (int __algorithm) __THROW;
|
||||
|
||||
/* Get the SCHED_RR interval for the named process. */
|
||||
extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
|
||||
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Access macros for `cpu_set'. */
|
||||
# define CPU_SETSIZE __CPU_SETSIZE
|
||||
# define CPU_SET(cpu, cpusetp) __CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp)
|
||||
# define CPU_CLR(cpu, cpusetp) __CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp)
|
||||
# define CPU_ISSET(cpu, cpusetp) __CPU_ISSET_S (cpu, sizeof (cpu_set_t), \
|
||||
cpusetp)
|
||||
# define CPU_ZERO(cpusetp) __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)
|
||||
# define CPU_COUNT(cpusetp) __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp)
|
||||
|
||||
# define CPU_SET_S(cpu, setsize, cpusetp) __CPU_SET_S (cpu, setsize, cpusetp)
|
||||
# define CPU_CLR_S(cpu, setsize, cpusetp) __CPU_CLR_S (cpu, setsize, cpusetp)
|
||||
# define CPU_ISSET_S(cpu, setsize, cpusetp) __CPU_ISSET_S (cpu, setsize, \
|
||||
cpusetp)
|
||||
# define CPU_ZERO_S(setsize, cpusetp) __CPU_ZERO_S (setsize, cpusetp)
|
||||
# define CPU_COUNT_S(setsize, cpusetp) __CPU_COUNT_S (setsize, cpusetp)
|
||||
|
||||
# define CPU_EQUAL(cpusetp1, cpusetp2) \
|
||||
__CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2)
|
||||
# define CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
|
||||
__CPU_EQUAL_S (setsize, cpusetp1, cpusetp2)
|
||||
|
||||
# define CPU_AND(destset, srcset1, srcset2) \
|
||||
__CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, &)
|
||||
# define CPU_OR(destset, srcset1, srcset2) \
|
||||
__CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |)
|
||||
# define CPU_XOR(destset, srcset1, srcset2) \
|
||||
__CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, ^)
|
||||
# define CPU_AND_S(setsize, destset, srcset1, srcset2) \
|
||||
__CPU_OP_S (setsize, destset, srcset1, srcset2, &)
|
||||
# define CPU_OR_S(setsize, destset, srcset1, srcset2) \
|
||||
__CPU_OP_S (setsize, destset, srcset1, srcset2, |)
|
||||
# define CPU_XOR_S(setsize, destset, srcset1, srcset2) \
|
||||
__CPU_OP_S (setsize, destset, srcset1, srcset2, ^)
|
||||
|
||||
# define CPU_ALLOC_SIZE(count) __CPU_ALLOC_SIZE (count)
|
||||
# define CPU_ALLOC(count) __CPU_ALLOC (count)
|
||||
# define CPU_FREE(cpuset) __CPU_FREE (cpuset)
|
||||
|
||||
|
||||
/* Set the CPU affinity for a task */
|
||||
extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
|
||||
const cpu_set_t *__cpuset) __THROW;
|
||||
|
||||
/* Get the CPU affinity for a task */
|
||||
extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize,
|
||||
cpu_set_t *__cpuset) __THROW;
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* sched.h */
|
105
contrib/libc-headers/setjmp.h
Normal file
105
contrib/libc-headers/setjmp.h
Normal file
@ -0,0 +1,105 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.13 Nonlocal jumps <setjmp.h>
|
||||
*/
|
||||
|
||||
#ifndef _SETJMP_H
|
||||
#define _SETJMP_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <bits/setjmp.h> /* Get `__jmp_buf'. */
|
||||
#include <bits/types/__sigset_t.h>
|
||||
|
||||
/* Calling environment, plus possibly a saved signal mask. */
|
||||
struct __jmp_buf_tag
|
||||
{
|
||||
/* NOTE: The machine-dependent definitions of `__sigsetjmp'
|
||||
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. */
|
||||
};
|
||||
|
||||
|
||||
typedef struct __jmp_buf_tag jmp_buf[1];
|
||||
|
||||
/* Store the calling environment in ENV, also saving the signal mask.
|
||||
Return 0. */
|
||||
extern int setjmp (jmp_buf __env) __THROWNL;
|
||||
|
||||
/* 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 (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL;
|
||||
|
||||
/* Store the calling environment in ENV, not saving the signal mask.
|
||||
Return 0. */
|
||||
extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
|
||||
|
||||
/* Do not save the signal mask. This is equivalent to the `_setjmp'
|
||||
BSD function. */
|
||||
#define setjmp(env) _setjmp (env)
|
||||
|
||||
|
||||
/* Jump to the environment saved in ENV, making the
|
||||
`setjmp' call there return VAL, or 1 if VAL is 0. */
|
||||
extern void longjmp (struct __jmp_buf_tag __env[1], int __val)
|
||||
__THROWNL __attribute__ ((__noreturn__));
|
||||
|
||||
#if defined __USE_MISC || 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 (struct __jmp_buf_tag __env[1], int __val)
|
||||
__THROWNL __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. */
|
||||
typedef struct __jmp_buf_tag sigjmp_buf[1];
|
||||
|
||||
/* Store the calling environment in ENV, also saving the
|
||||
signal mask if SAVEMASK is nonzero. Return 0. */
|
||||
# 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 (sigjmp_buf __env, int __val)
|
||||
__THROWNL __attribute__ ((__noreturn__));
|
||||
#endif /* Use POSIX. */
|
||||
|
||||
|
||||
/* Define helper functions to catch unsafe code. */
|
||||
#if __USE_FORTIFY_LEVEL > 0
|
||||
# include <bits/setjmp2.h>
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* setjmp.h */
|
375
contrib/libc-headers/signal.h
Normal file
375
contrib/libc-headers/signal.h
Normal file
@ -0,0 +1,375 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.14 Signal handling <signal.h>
|
||||
*/
|
||||
|
||||
#ifndef _SIGNAL_H
|
||||
#define _SIGNAL_H
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <bits/types.h>
|
||||
#include <bits/signum.h>
|
||||
|
||||
#include <bits/types/sig_atomic_t.h>
|
||||
|
||||
#if defined __USE_POSIX
|
||||
#include <bits/types/sigset_t.h>
|
||||
#endif
|
||||
|
||||
#if defined __USE_XOPEN || defined __USE_XOPEN2K
|
||||
# ifndef __pid_t_defined
|
||||
typedef __pid_t pid_t;
|
||||
# define __pid_t_defined
|
||||
#endif
|
||||
#ifdef __USE_XOPEN
|
||||
# endif
|
||||
# ifndef __uid_t_defined
|
||||
typedef __uid_t uid_t;
|
||||
# define __uid_t_defined
|
||||
# endif
|
||||
#endif /* Unix98 */
|
||||
|
||||
#ifdef __USE_POSIX199309
|
||||
/* We need `struct timespec' later on. */
|
||||
# include <bits/types/struct_timespec.h>
|
||||
#endif
|
||||
|
||||
#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
|
||||
# include <bits/types/siginfo_t.h>
|
||||
# include <bits/siginfo-consts.h>
|
||||
#endif
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# include <bits/types/sigval_t.h>
|
||||
#endif
|
||||
|
||||
#ifdef __USE_POSIX199309
|
||||
# include <bits/types/sigevent_t.h>
|
||||
# include <bits/sigevent-consts.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Type of a signal handler. */
|
||||
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 (int __sig, __sighandler_t __handler)
|
||||
__THROW;
|
||||
#ifdef __USE_GNU
|
||||
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_MISC
|
||||
extern __sighandler_t signal (int __sig, __sighandler_t __handler)
|
||||
__THROW;
|
||||
#else
|
||||
/* Make sure the used `signal' implementation is the SVID version. */
|
||||
# ifdef __REDIRECT_NTH
|
||||
extern __sighandler_t __REDIRECT_NTH (signal,
|
||||
(int __sig, __sighandler_t __handler),
|
||||
__sysv_signal);
|
||||
# else
|
||||
# define signal __sysv_signal
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8
|
||||
/* The X/Open definition of `signal' conflicts with the BSD version.
|
||||
So they defined another function `bsd_signal'. */
|
||||
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 (__pid_t __pid, int __sig) __THROW;
|
||||
#endif /* Use POSIX. */
|
||||
|
||||
#if defined __USE_MISC || 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 (__pid_t __pgrp, int __sig) __THROW;
|
||||
#endif /* Use misc || X/Open Unix. */
|
||||
|
||||
/* Raise signal SIG, i.e., send SIG to yourself. */
|
||||
extern int raise (int __sig) __THROW;
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* SVID names for the same things. */
|
||||
extern __sighandler_t ssignal (int __sig, __sighandler_t __handler)
|
||||
__THROW;
|
||||
extern int gsignal (int __sig) __THROW;
|
||||
#endif /* Use misc. */
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Print a message describing the meaning of the given signal number. */
|
||||
extern void psignal (int __sig, const char *__s);
|
||||
|
||||
/* Print a message describing the meaning of the given signal information. */
|
||||
extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
|
||||
#endif /* POSIX 2008. */
|
||||
|
||||
|
||||
|
||||
/* The `sigpause' function in X/Open defines the argument as the
|
||||
signal number. This requires redirecting to another function
|
||||
because the default version in glibc uses an old BSD interface.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
|
||||
#ifdef __USE_XOPEN_EXTENDED
|
||||
# ifdef __GNUC__
|
||||
extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
|
||||
# else
|
||||
extern int __sigpause (int __sig_or_mask, int __is_sig);
|
||||
/* Remove a signal from the signal mask and suspend the process. */
|
||||
# define sigpause(sig) __sigpause ((sig), 1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* None of the following functions should be used anymore. They are here
|
||||
only for compatibility. A single word (`int') is not guaranteed to be
|
||||
enough to hold a complete signal mask and therefore these functions
|
||||
simply do not work in many situations. Use `sigprocmask' instead. */
|
||||
|
||||
/* Compute mask for signal SIG. */
|
||||
# define sigmask(sig) ((int)(1u << ((sig) - 1)))
|
||||
|
||||
/* Block signals in MASK, returning the old mask. */
|
||||
extern int sigblock (int __mask) __THROW __attribute_deprecated__;
|
||||
|
||||
/* Set the mask of blocked signals to MASK, returning the old mask. */
|
||||
extern int sigsetmask (int __mask) __THROW __attribute_deprecated__;
|
||||
|
||||
/* Return currently selected signal mask. */
|
||||
extern int siggetmask (void) __THROW __attribute_deprecated__;
|
||||
#endif /* Use misc. */
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# define NSIG _NSIG
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
typedef __sighandler_t sighandler_t;
|
||||
#endif
|
||||
|
||||
/* 4.4 BSD uses the name `sig_t' for this. */
|
||||
#ifdef __USE_MISC
|
||||
typedef __sighandler_t sig_t;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_POSIX
|
||||
|
||||
/* Clear all signals from SET. */
|
||||
extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1));
|
||||
|
||||
/* Set all signals in SET. */
|
||||
extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1));
|
||||
|
||||
/* Add SIGNO to SET. */
|
||||
extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
|
||||
|
||||
/* Remove SIGNO from SET. */
|
||||
extern int sigdelset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
|
||||
|
||||
/* Return 1 if SIGNO is in SET, 0 if not. */
|
||||
extern int sigismember (const sigset_t *__set, int __signo)
|
||||
__THROW __nonnull ((1));
|
||||
|
||||
# ifdef __USE_GNU
|
||||
/* Return non-empty value is SET is not empty. */
|
||||
extern int sigisemptyset (const sigset_t *__set) __THROW __nonnull ((1));
|
||||
|
||||
/* Build new signal set by combining the two inputs set using logical AND. */
|
||||
extern int sigandset (sigset_t *__set, const sigset_t *__left,
|
||||
const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
|
||||
|
||||
/* Build new signal set by combining the two inputs set using logical OR. */
|
||||
extern int sigorset (sigset_t *__set, const sigset_t *__left,
|
||||
const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
|
||||
# endif /* GNU */
|
||||
|
||||
/* Get the system-specific definitions of `struct sigaction'
|
||||
and the `SA_*' and `SIG_*'. constants. */
|
||||
# include <bits/sigaction.h>
|
||||
|
||||
/* Get and/or change the set of blocked signals. */
|
||||
extern int sigprocmask (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.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
extern int sigsuspend (const sigset_t *__set) __nonnull ((1));
|
||||
|
||||
/* Get and/or set the action for signal SIG. */
|
||||
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 (sigset_t *__set) __THROW __nonnull ((1));
|
||||
|
||||
|
||||
# ifdef __USE_POSIX199506
|
||||
/* Select any of pending signals from SET or wait for any to arrive.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig)
|
||||
__nonnull ((1, 2));
|
||||
# endif /* Use POSIX 1995. */
|
||||
|
||||
# ifdef __USE_POSIX199309
|
||||
/* Select any of pending signals from SET and place information in INFO.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
extern int sigwaitinfo (const sigset_t *__restrict __set,
|
||||
siginfo_t *__restrict __info) __nonnull ((1));
|
||||
|
||||
/* Select any of pending signals from SET and place information in INFO.
|
||||
Wait the time specified by TIMEOUT if no signal is pending.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
extern int sigtimedwait (const sigset_t *__restrict __set,
|
||||
siginfo_t *__restrict __info,
|
||||
const struct timespec *__restrict __timeout)
|
||||
__nonnull ((1));
|
||||
|
||||
/* Send signal SIG to the process PID. Associate data in VAL with the
|
||||
signal. */
|
||||
extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
|
||||
__THROW;
|
||||
# endif /* Use POSIX 199306. */
|
||||
|
||||
#endif /* Use POSIX. */
|
||||
|
||||
#ifdef __USE_MISC
|
||||
|
||||
/* Names of the signals. This variable exists only for compatibility.
|
||||
Use `strsignal' instead (see <string.h>). */
|
||||
extern const char *const _sys_siglist[_NSIG];
|
||||
extern const char *const sys_siglist[_NSIG];
|
||||
|
||||
|
||||
/* Get machine-dependent `struct sigcontext' and signal subcodes. */
|
||||
# include <bits/sigcontext.h>
|
||||
|
||||
/* Restore the state saved in SCP. */
|
||||
extern int sigreturn (struct sigcontext *__scp) __THROW;
|
||||
|
||||
#endif /* Use misc. */
|
||||
|
||||
|
||||
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
|
||||
# define __need_size_t
|
||||
# include <stddef.h>
|
||||
|
||||
# include <bits/types/stack_t.h>
|
||||
# if defined __USE_XOPEN || defined __USE_XOPEN2K8
|
||||
/* This will define `ucontext_t' and `mcontext_t'. */
|
||||
# include <sys/ucontext.h>
|
||||
# endif
|
||||
#endif /* Use POSIX.1-2008 or X/Open Unix. */
|
||||
|
||||
#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
|
||||
/* 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 (int __sig, int __interrupt) __THROW;
|
||||
|
||||
# include <bits/sigstack.h>
|
||||
# include <bits/ss_flags.h>
|
||||
|
||||
/* Alternate signal handler stack interface.
|
||||
This interface should always be preferred over `sigstack'. */
|
||||
extern int sigaltstack (const stack_t *__restrict __ss,
|
||||
stack_t *__restrict __oss) __THROW;
|
||||
#endif /* __USE_XOPEN_EXTENDED || __USE_MISC */
|
||||
|
||||
#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
|
||||
|| defined __USE_MISC)
|
||||
# include <bits/types/struct_sigstack.h>
|
||||
#endif
|
||||
|
||||
#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
|
||||
|| defined __USE_MISC)
|
||||
/* 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 (struct sigstack *__ss, struct sigstack *__oss)
|
||||
__THROW __attribute_deprecated__;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN_EXTENDED
|
||||
/* Simplified interface for signal management. */
|
||||
|
||||
/* Add SIG to the calling process' signal mask. */
|
||||
extern int sighold (int __sig) __THROW;
|
||||
|
||||
/* Remove SIG from the calling process' signal mask. */
|
||||
extern int sigrelse (int __sig) __THROW;
|
||||
|
||||
/* Set the disposition of SIG to SIG_IGN. */
|
||||
extern int sigignore (int __sig) __THROW;
|
||||
|
||||
/* Set the disposition of SIG. */
|
||||
extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;
|
||||
#endif
|
||||
|
||||
#if defined __USE_POSIX199506 || defined __USE_UNIX98
|
||||
/* Some of the functions for handling signals in threaded programs must
|
||||
be defined here. */
|
||||
# include <bits/pthreadtypes.h>
|
||||
# include <bits/sigthread.h>
|
||||
#endif /* use Unix98 */
|
||||
|
||||
/* The following functions are used internally in the C library and in
|
||||
other code which need deep insights. */
|
||||
|
||||
/* Return number of available real-time signal with highest priority. */
|
||||
extern int __libc_current_sigrtmin (void) __THROW;
|
||||
/* Return number of available real-time signal with lowest priority. */
|
||||
extern int __libc_current_sigrtmax (void) __THROW;
|
||||
|
||||
#define SIGRTMIN (__libc_current_sigrtmin ())
|
||||
#define SIGRTMAX (__libc_current_sigrtmax ())
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* not signal.h */
|
190
contrib/libc-headers/spawn.h
Normal file
190
contrib/libc-headers/spawn.h
Normal file
@ -0,0 +1,190 @@
|
||||
/* Definitions for POSIX spawn interface.
|
||||
Copyright (C) 2000-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SPAWN_H
|
||||
#define _SPAWN_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <sched.h>
|
||||
#include <sys/types.h>
|
||||
#include <bits/types/sigset_t.h>
|
||||
|
||||
|
||||
/* Data structure to contain attributes for thread creation. */
|
||||
typedef struct
|
||||
{
|
||||
short int __flags;
|
||||
pid_t __pgrp;
|
||||
sigset_t __sd;
|
||||
sigset_t __ss;
|
||||
struct sched_param __sp;
|
||||
int __policy;
|
||||
int __pad[16];
|
||||
} posix_spawnattr_t;
|
||||
|
||||
|
||||
/* Data structure to contain information about the actions to be
|
||||
performed in the new process with respect to file descriptors. */
|
||||
typedef struct
|
||||
{
|
||||
int __allocated;
|
||||
int __used;
|
||||
struct __spawn_action *__actions;
|
||||
int __pad[16];
|
||||
} posix_spawn_file_actions_t;
|
||||
|
||||
|
||||
/* Flags to be set in the `posix_spawnattr_t'. */
|
||||
#define POSIX_SPAWN_RESETIDS 0x01
|
||||
#define POSIX_SPAWN_SETPGROUP 0x02
|
||||
#define POSIX_SPAWN_SETSIGDEF 0x04
|
||||
#define POSIX_SPAWN_SETSIGMASK 0x08
|
||||
#define POSIX_SPAWN_SETSCHEDPARAM 0x10
|
||||
#define POSIX_SPAWN_SETSCHEDULER 0x20
|
||||
#ifdef __USE_GNU
|
||||
# define POSIX_SPAWN_USEVFORK 0x40
|
||||
# define POSIX_SPAWN_SETSID 0x80
|
||||
#endif
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
|
||||
Before running the process perform the actions described in FILE-ACTIONS.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int posix_spawn (pid_t *__restrict __pid,
|
||||
const char *__restrict __path,
|
||||
const posix_spawn_file_actions_t *__restrict
|
||||
__file_actions,
|
||||
const posix_spawnattr_t *__restrict __attrp,
|
||||
char *const __argv[__restrict_arr],
|
||||
char *const __envp[__restrict_arr]);
|
||||
|
||||
/* Similar to `posix_spawn' but search for FILE in the PATH.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int posix_spawnp (pid_t *__pid, const char *__file,
|
||||
const posix_spawn_file_actions_t *__file_actions,
|
||||
const posix_spawnattr_t *__attrp,
|
||||
char *const __argv[], char *const __envp[]);
|
||||
|
||||
|
||||
/* Initialize data structure with attributes for `spawn' to default values. */
|
||||
extern int posix_spawnattr_init (posix_spawnattr_t *__attr) __THROW;
|
||||
|
||||
/* Free resources associated with ATTR. */
|
||||
extern int posix_spawnattr_destroy (posix_spawnattr_t *__attr) __THROW;
|
||||
|
||||
/* Store signal mask for signals with default handling from ATTR in
|
||||
SIGDEFAULT. */
|
||||
extern int posix_spawnattr_getsigdefault (const posix_spawnattr_t *
|
||||
__restrict __attr,
|
||||
sigset_t *__restrict __sigdefault)
|
||||
__THROW;
|
||||
|
||||
/* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
|
||||
extern int posix_spawnattr_setsigdefault (posix_spawnattr_t *__restrict __attr,
|
||||
const sigset_t *__restrict
|
||||
__sigdefault)
|
||||
__THROW;
|
||||
|
||||
/* Store signal mask for the new process from ATTR in SIGMASK. */
|
||||
extern int posix_spawnattr_getsigmask (const posix_spawnattr_t *__restrict
|
||||
__attr,
|
||||
sigset_t *__restrict __sigmask) __THROW;
|
||||
|
||||
/* Set signal mask for the new process in ATTR to SIGMASK. */
|
||||
extern int posix_spawnattr_setsigmask (posix_spawnattr_t *__restrict __attr,
|
||||
const sigset_t *__restrict __sigmask)
|
||||
__THROW;
|
||||
|
||||
/* Get flag word from the attribute structure. */
|
||||
extern int posix_spawnattr_getflags (const posix_spawnattr_t *__restrict
|
||||
__attr,
|
||||
short int *__restrict __flags) __THROW;
|
||||
|
||||
/* Store flags in the attribute structure. */
|
||||
extern int posix_spawnattr_setflags (posix_spawnattr_t *_attr,
|
||||
short int __flags) __THROW;
|
||||
|
||||
/* Get process group ID from the attribute structure. */
|
||||
extern int posix_spawnattr_getpgroup (const posix_spawnattr_t *__restrict
|
||||
__attr, pid_t *__restrict __pgroup)
|
||||
__THROW;
|
||||
|
||||
/* Store process group ID in the attribute structure. */
|
||||
extern int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr,
|
||||
pid_t __pgroup) __THROW;
|
||||
|
||||
/* Get scheduling policy from the attribute structure. */
|
||||
extern int posix_spawnattr_getschedpolicy (const posix_spawnattr_t *
|
||||
__restrict __attr,
|
||||
int *__restrict __schedpolicy)
|
||||
__THROW;
|
||||
|
||||
/* Store scheduling policy in the attribute structure. */
|
||||
extern int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr,
|
||||
int __schedpolicy) __THROW;
|
||||
|
||||
/* Get scheduling parameters from the attribute structure. */
|
||||
extern int posix_spawnattr_getschedparam (const posix_spawnattr_t *
|
||||
__restrict __attr,
|
||||
struct sched_param *__restrict
|
||||
__schedparam) __THROW;
|
||||
|
||||
/* Store scheduling parameters in the attribute structure. */
|
||||
extern int posix_spawnattr_setschedparam (posix_spawnattr_t *__restrict __attr,
|
||||
const struct sched_param *
|
||||
__restrict __schedparam) __THROW;
|
||||
|
||||
|
||||
/* Initialize data structure for file attribute for `spawn' call. */
|
||||
extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *
|
||||
__file_actions) __THROW;
|
||||
|
||||
/* Free resources associated with FILE-ACTIONS. */
|
||||
extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *
|
||||
__file_actions) __THROW;
|
||||
|
||||
/* Add an action to FILE-ACTIONS which tells the implementation to call
|
||||
`open' for the given file during the `spawn' call. */
|
||||
extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *
|
||||
__restrict __file_actions,
|
||||
int __fd,
|
||||
const char *__restrict __path,
|
||||
int __oflag, mode_t __mode)
|
||||
__THROW;
|
||||
|
||||
/* Add an action to FILE-ACTIONS which tells the implementation to call
|
||||
`close' for the given file descriptor during the `spawn' call. */
|
||||
extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *
|
||||
__file_actions, int __fd)
|
||||
__THROW;
|
||||
|
||||
/* Add an action to FILE-ACTIONS which tells the implementation to call
|
||||
`dup2' for the given file descriptors during the `spawn' call. */
|
||||
extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *
|
||||
__file_actions,
|
||||
int __fd, int __newfd) __THROW;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* spawn.h */
|
63
contrib/libc-headers/stdc-predef.h
Normal file
63
contrib/libc-headers/stdc-predef.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _STDC_PREDEF_H
|
||||
#define _STDC_PREDEF_H 1
|
||||
|
||||
/* This header is separate from features.h so that the compiler can
|
||||
include it implicitly at the start of every compilation. It must
|
||||
not itself include <features.h> or any other header that includes
|
||||
<features.h> because the implicit include comes before any feature
|
||||
test macros that may be defined in a source file before it first
|
||||
explicitly includes a system header. GCC knows the name of this
|
||||
header in order to preinclude it. */
|
||||
|
||||
/* glibc's intent is to support the IEC 559 math functionality, real
|
||||
and complex. If the GCC (4.9 and later) predefined macros
|
||||
specifying compiler intent are available, use them to determine
|
||||
whether the overall intent is to support these features; otherwise,
|
||||
presume an older compiler has intent to support these features and
|
||||
define these macros by default. */
|
||||
|
||||
#ifdef __GCC_IEC_559
|
||||
# if __GCC_IEC_559 > 0
|
||||
# define __STDC_IEC_559__ 1
|
||||
# endif
|
||||
#else
|
||||
# define __STDC_IEC_559__ 1
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_IEC_559_COMPLEX
|
||||
# if __GCC_IEC_559_COMPLEX > 0
|
||||
# define __STDC_IEC_559_COMPLEX__ 1
|
||||
# endif
|
||||
#else
|
||||
# define __STDC_IEC_559_COMPLEX__ 1
|
||||
#endif
|
||||
|
||||
/* wchar_t uses Unicode 10.0.0. Version 10.0 of the Unicode Standard is
|
||||
synchronized with ISO/IEC 10646:2017, fifth edition, plus
|
||||
the following additions from Amendment 1 to the fifth edition:
|
||||
- 56 emoji characters
|
||||
- 285 hentaigana
|
||||
- 3 additional Zanabazar Square characters */
|
||||
#define __STDC_ISO_10646__ 201706L
|
||||
|
||||
/* We do not support C11 <threads.h>. */
|
||||
#define __STDC_NO_THREADS__ 1
|
||||
|
||||
#endif
|
329
contrib/libc-headers/stdint.h
Normal file
329
contrib/libc-headers/stdint.h
Normal file
@ -0,0 +1,329 @@
|
||||
/* Copyright (C) 1997-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99: 7.18 Integer types <stdint.h>
|
||||
*/
|
||||
|
||||
#ifndef _STDINT_H
|
||||
#define _STDINT_H 1
|
||||
|
||||
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
|
||||
#include <bits/libc-header-start.h>
|
||||
#include <bits/types.h>
|
||||
#include <bits/wchar.h>
|
||||
#include <bits/wordsize.h>
|
||||
|
||||
/* Exact integral types. */
|
||||
|
||||
/* Signed. */
|
||||
#include <bits/stdint-intn.h>
|
||||
|
||||
/* Unsigned. */
|
||||
#include <bits/stdint-uintn.h>
|
||||
|
||||
|
||||
/* Small types. */
|
||||
|
||||
/* Signed. */
|
||||
typedef signed char int_least8_t;
|
||||
typedef short int int_least16_t;
|
||||
typedef int int_least32_t;
|
||||
#if __WORDSIZE == 64
|
||||
typedef long int int_least64_t;
|
||||
#else
|
||||
__extension__
|
||||
typedef long long int int_least64_t;
|
||||
#endif
|
||||
|
||||
/* Unsigned. */
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef unsigned short int uint_least16_t;
|
||||
typedef unsigned int uint_least32_t;
|
||||
#if __WORDSIZE == 64
|
||||
typedef unsigned long int uint_least64_t;
|
||||
#else
|
||||
__extension__
|
||||
typedef unsigned long long int uint_least64_t;
|
||||
#endif
|
||||
|
||||
|
||||
/* Fast types. */
|
||||
|
||||
/* Signed. */
|
||||
typedef signed char int_fast8_t;
|
||||
#if __WORDSIZE == 64
|
||||
typedef long int int_fast16_t;
|
||||
typedef long int int_fast32_t;
|
||||
typedef long int int_fast64_t;
|
||||
#else
|
||||
typedef int int_fast16_t;
|
||||
typedef int int_fast32_t;
|
||||
__extension__
|
||||
typedef long long int int_fast64_t;
|
||||
#endif
|
||||
|
||||
/* Unsigned. */
|
||||
typedef unsigned char uint_fast8_t;
|
||||
#if __WORDSIZE == 64
|
||||
typedef unsigned long int uint_fast16_t;
|
||||
typedef unsigned long int uint_fast32_t;
|
||||
typedef unsigned long int uint_fast64_t;
|
||||
#else
|
||||
typedef unsigned int uint_fast16_t;
|
||||
typedef unsigned int uint_fast32_t;
|
||||
__extension__
|
||||
typedef unsigned long long int uint_fast64_t;
|
||||
#endif
|
||||
|
||||
|
||||
/* Types for `void *' pointers. */
|
||||
#if __WORDSIZE == 64
|
||||
# ifndef __intptr_t_defined
|
||||
typedef long int intptr_t;
|
||||
# define __intptr_t_defined
|
||||
# endif
|
||||
typedef unsigned long int uintptr_t;
|
||||
#else
|
||||
# ifndef __intptr_t_defined
|
||||
typedef int intptr_t;
|
||||
# define __intptr_t_defined
|
||||
# endif
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif
|
||||
|
||||
|
||||
/* Largest integral types. */
|
||||
typedef __intmax_t intmax_t;
|
||||
typedef __uintmax_t uintmax_t;
|
||||
|
||||
|
||||
# if __WORDSIZE == 64
|
||||
# define __INT64_C(c) c ## L
|
||||
# define __UINT64_C(c) c ## UL
|
||||
# else
|
||||
# define __INT64_C(c) c ## LL
|
||||
# define __UINT64_C(c) c ## ULL
|
||||
# endif
|
||||
|
||||
/* Limits of integral types. */
|
||||
|
||||
/* Minimum of signed integral types. */
|
||||
# define INT8_MIN (-128)
|
||||
# define INT16_MIN (-32767-1)
|
||||
# define INT32_MIN (-2147483647-1)
|
||||
# define INT64_MIN (-__INT64_C(9223372036854775807)-1)
|
||||
/* Maximum of signed integral types. */
|
||||
# define INT8_MAX (127)
|
||||
# define INT16_MAX (32767)
|
||||
# define INT32_MAX (2147483647)
|
||||
# define INT64_MAX (__INT64_C(9223372036854775807))
|
||||
|
||||
/* Maximum of unsigned integral types. */
|
||||
# define UINT8_MAX (255)
|
||||
# define UINT16_MAX (65535)
|
||||
# define UINT32_MAX (4294967295U)
|
||||
# define UINT64_MAX (__UINT64_C(18446744073709551615))
|
||||
|
||||
|
||||
/* Minimum of signed integral types having a minimum size. */
|
||||
# define INT_LEAST8_MIN (-128)
|
||||
# define INT_LEAST16_MIN (-32767-1)
|
||||
# define INT_LEAST32_MIN (-2147483647-1)
|
||||
# define INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1)
|
||||
/* Maximum of signed integral types having a minimum size. */
|
||||
# define INT_LEAST8_MAX (127)
|
||||
# define INT_LEAST16_MAX (32767)
|
||||
# define INT_LEAST32_MAX (2147483647)
|
||||
# define INT_LEAST64_MAX (__INT64_C(9223372036854775807))
|
||||
|
||||
/* Maximum of unsigned integral types having a minimum size. */
|
||||
# define UINT_LEAST8_MAX (255)
|
||||
# define UINT_LEAST16_MAX (65535)
|
||||
# define UINT_LEAST32_MAX (4294967295U)
|
||||
# define UINT_LEAST64_MAX (__UINT64_C(18446744073709551615))
|
||||
|
||||
|
||||
/* Minimum of fast signed integral types having a minimum size. */
|
||||
# define INT_FAST8_MIN (-128)
|
||||
# if __WORDSIZE == 64
|
||||
# define INT_FAST16_MIN (-9223372036854775807L-1)
|
||||
# define INT_FAST32_MIN (-9223372036854775807L-1)
|
||||
# else
|
||||
# define INT_FAST16_MIN (-2147483647-1)
|
||||
# define INT_FAST32_MIN (-2147483647-1)
|
||||
# endif
|
||||
# define INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1)
|
||||
/* Maximum of fast signed integral types having a minimum size. */
|
||||
# define INT_FAST8_MAX (127)
|
||||
# if __WORDSIZE == 64
|
||||
# define INT_FAST16_MAX (9223372036854775807L)
|
||||
# define INT_FAST32_MAX (9223372036854775807L)
|
||||
# else
|
||||
# define INT_FAST16_MAX (2147483647)
|
||||
# define INT_FAST32_MAX (2147483647)
|
||||
# endif
|
||||
# define INT_FAST64_MAX (__INT64_C(9223372036854775807))
|
||||
|
||||
/* Maximum of fast unsigned integral types having a minimum size. */
|
||||
# define UINT_FAST8_MAX (255)
|
||||
# if __WORDSIZE == 64
|
||||
# define UINT_FAST16_MAX (18446744073709551615UL)
|
||||
# define UINT_FAST32_MAX (18446744073709551615UL)
|
||||
# else
|
||||
# define UINT_FAST16_MAX (4294967295U)
|
||||
# define UINT_FAST32_MAX (4294967295U)
|
||||
# endif
|
||||
# define UINT_FAST64_MAX (__UINT64_C(18446744073709551615))
|
||||
|
||||
|
||||
/* Values to test for integral types holding `void *' pointer. */
|
||||
# if __WORDSIZE == 64
|
||||
# define INTPTR_MIN (-9223372036854775807L-1)
|
||||
# define INTPTR_MAX (9223372036854775807L)
|
||||
# define UINTPTR_MAX (18446744073709551615UL)
|
||||
# else
|
||||
# define INTPTR_MIN (-2147483647-1)
|
||||
# define INTPTR_MAX (2147483647)
|
||||
# define UINTPTR_MAX (4294967295U)
|
||||
# endif
|
||||
|
||||
|
||||
/* Minimum for largest signed integral type. */
|
||||
# define INTMAX_MIN (-__INT64_C(9223372036854775807)-1)
|
||||
/* Maximum for largest signed integral type. */
|
||||
# define INTMAX_MAX (__INT64_C(9223372036854775807))
|
||||
|
||||
/* Maximum for largest unsigned integral type. */
|
||||
# define UINTMAX_MAX (__UINT64_C(18446744073709551615))
|
||||
|
||||
|
||||
/* Limits of other integer types. */
|
||||
|
||||
/* Limits of `ptrdiff_t' type. */
|
||||
# if __WORDSIZE == 64
|
||||
# define PTRDIFF_MIN (-9223372036854775807L-1)
|
||||
# define PTRDIFF_MAX (9223372036854775807L)
|
||||
# else
|
||||
# if __WORDSIZE32_PTRDIFF_LONG
|
||||
# define PTRDIFF_MIN (-2147483647L-1)
|
||||
# define PTRDIFF_MAX (2147483647L)
|
||||
# else
|
||||
# define PTRDIFF_MIN (-2147483647-1)
|
||||
# define PTRDIFF_MAX (2147483647)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Limits of `sig_atomic_t'. */
|
||||
# define SIG_ATOMIC_MIN (-2147483647-1)
|
||||
# define SIG_ATOMIC_MAX (2147483647)
|
||||
|
||||
/* Limit of `size_t' type. */
|
||||
# if __WORDSIZE == 64
|
||||
# define SIZE_MAX (18446744073709551615UL)
|
||||
# else
|
||||
# if __WORDSIZE32_SIZE_ULONG
|
||||
# define SIZE_MAX (4294967295UL)
|
||||
# else
|
||||
# define SIZE_MAX (4294967295U)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Limits of `wchar_t'. */
|
||||
# ifndef WCHAR_MIN
|
||||
/* These constants might also be defined in <wchar.h>. */
|
||||
# define WCHAR_MIN __WCHAR_MIN
|
||||
# define WCHAR_MAX __WCHAR_MAX
|
||||
# endif
|
||||
|
||||
/* Limits of `wint_t'. */
|
||||
# define WINT_MIN (0u)
|
||||
# define WINT_MAX (4294967295u)
|
||||
|
||||
/* Signed. */
|
||||
# define INT8_C(c) c
|
||||
# define INT16_C(c) c
|
||||
# define INT32_C(c) c
|
||||
# if __WORDSIZE == 64
|
||||
# define INT64_C(c) c ## L
|
||||
# else
|
||||
# define INT64_C(c) c ## LL
|
||||
# endif
|
||||
|
||||
/* Unsigned. */
|
||||
# define UINT8_C(c) c
|
||||
# define UINT16_C(c) c
|
||||
# define UINT32_C(c) c ## U
|
||||
# if __WORDSIZE == 64
|
||||
# define UINT64_C(c) c ## UL
|
||||
# else
|
||||
# define UINT64_C(c) c ## ULL
|
||||
# endif
|
||||
|
||||
/* Maximal type. */
|
||||
# if __WORDSIZE == 64
|
||||
# define INTMAX_C(c) c ## L
|
||||
# define UINTMAX_C(c) c ## UL
|
||||
# else
|
||||
# define INTMAX_C(c) c ## LL
|
||||
# define UINTMAX_C(c) c ## ULL
|
||||
# endif
|
||||
|
||||
#if __GLIBC_USE (IEC_60559_BFP_EXT)
|
||||
|
||||
# define INT8_WIDTH 8
|
||||
# define UINT8_WIDTH 8
|
||||
# define INT16_WIDTH 16
|
||||
# define UINT16_WIDTH 16
|
||||
# define INT32_WIDTH 32
|
||||
# define UINT32_WIDTH 32
|
||||
# define INT64_WIDTH 64
|
||||
# define UINT64_WIDTH 64
|
||||
|
||||
# define INT_LEAST8_WIDTH 8
|
||||
# define UINT_LEAST8_WIDTH 8
|
||||
# define INT_LEAST16_WIDTH 16
|
||||
# define UINT_LEAST16_WIDTH 16
|
||||
# define INT_LEAST32_WIDTH 32
|
||||
# define UINT_LEAST32_WIDTH 32
|
||||
# define INT_LEAST64_WIDTH 64
|
||||
# define UINT_LEAST64_WIDTH 64
|
||||
|
||||
# define INT_FAST8_WIDTH 8
|
||||
# define UINT_FAST8_WIDTH 8
|
||||
# define INT_FAST16_WIDTH __WORDSIZE
|
||||
# define UINT_FAST16_WIDTH __WORDSIZE
|
||||
# define INT_FAST32_WIDTH __WORDSIZE
|
||||
# define UINT_FAST32_WIDTH __WORDSIZE
|
||||
# define INT_FAST64_WIDTH 64
|
||||
# define UINT_FAST64_WIDTH 64
|
||||
|
||||
# define INTPTR_WIDTH __WORDSIZE
|
||||
# define UINTPTR_WIDTH __WORDSIZE
|
||||
|
||||
# define INTMAX_WIDTH 64
|
||||
# define UINTMAX_WIDTH 64
|
||||
|
||||
# define PTRDIFF_WIDTH __WORDSIZE
|
||||
# define SIG_ATOMIC_WIDTH 32
|
||||
# define SIZE_WIDTH __WORDSIZE
|
||||
# define WCHAR_WIDTH 32
|
||||
# define WINT_WIDTH 32
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* stdint.h */
|
870
contrib/libc-headers/stdio.h
Normal file
870
contrib/libc-headers/stdio.h
Normal file
@ -0,0 +1,870 @@
|
||||
/* Define ISO C stdio on top of C++ iostreams.
|
||||
Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.19 Input/output <stdio.h>
|
||||
*/
|
||||
|
||||
#ifndef _STDIO_H
|
||||
#define _STDIO_H 1
|
||||
|
||||
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
|
||||
#include <bits/libc-header-start.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#include <bits/types.h>
|
||||
#include <bits/types/__FILE.h>
|
||||
#include <bits/types/FILE.h>
|
||||
|
||||
#define _STDIO_USES_IOSTREAM
|
||||
|
||||
#include <bits/libio.h>
|
||||
|
||||
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
|
||||
# ifdef __GNUC__
|
||||
# ifndef _VA_LIST_DEFINED
|
||||
typedef _G_va_list va_list;
|
||||
# define _VA_LIST_DEFINED
|
||||
# endif
|
||||
# else
|
||||
# include <stdarg.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
|
||||
# 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
|
||||
# if defined __USE_LARGEFILE64 && !defined __off64_t_defined
|
||||
typedef __off64_t off64_t;
|
||||
# define __off64_t_defined
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
# ifndef __ssize_t_defined
|
||||
typedef __ssize_t ssize_t;
|
||||
# define __ssize_t_defined
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The type of the second argument to `fgetpos' and `fsetpos'. */
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
typedef _G_fpos_t fpos_t;
|
||||
#else
|
||||
typedef _G_fpos64_t fpos_t;
|
||||
#endif
|
||||
#ifdef __USE_LARGEFILE64
|
||||
typedef _G_fpos64_t fpos64_t;
|
||||
#endif
|
||||
|
||||
/* The possibilities for the third argument to `setvbuf'. */
|
||||
#define _IOFBF 0 /* Fully buffered. */
|
||||
#define _IOLBF 1 /* Line buffered. */
|
||||
#define _IONBF 2 /* No buffering. */
|
||||
|
||||
|
||||
/* Default buffer size. */
|
||||
#ifndef BUFSIZ
|
||||
# define BUFSIZ _IO_BUFSIZ
|
||||
#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. */
|
||||
#ifdef __USE_GNU
|
||||
# define SEEK_DATA 3 /* Seek to next data. */
|
||||
# define SEEK_HOLE 4 /* Seek to next hole. */
|
||||
#endif
|
||||
|
||||
|
||||
#if defined __USE_MISC || defined __USE_XOPEN
|
||||
/* Default path prefix for `tempnam' and `tmpnam'. */
|
||||
# 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
|
||||
(and tempnam when it uses tmpnam's name space),
|
||||
or tempnam (the two are separate).
|
||||
L_ctermid How long an array to pass to `ctermid'.
|
||||
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. */
|
||||
#include <bits/stdio_lim.h>
|
||||
|
||||
|
||||
/* Standard streams. */
|
||||
extern struct _IO_FILE *stdin; /* Standard input stream. */
|
||||
extern struct _IO_FILE *stdout; /* Standard output stream. */
|
||||
extern struct _IO_FILE *stderr; /* Standard error output stream. */
|
||||
/* C89/C99 say they're macros. Make them happy. */
|
||||
#define stdin stdin
|
||||
#define stdout stdout
|
||||
#define stderr stderr
|
||||
|
||||
/* Remove file FILENAME. */
|
||||
extern int remove (const char *__filename) __THROW;
|
||||
/* Rename file OLD to NEW. */
|
||||
extern int rename (const char *__old, const char *__new) __THROW;
|
||||
|
||||
#ifdef __USE_ATFILE
|
||||
/* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */
|
||||
extern int renameat (int __oldfd, const char *__old, int __newfd,
|
||||
const char *__new) __THROW;
|
||||
#endif
|
||||
|
||||
/* Create a temporary file and open it read/write.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
extern FILE *tmpfile (void) __wur;
|
||||
#else
|
||||
# ifdef __REDIRECT
|
||||
extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
|
||||
# else
|
||||
# define tmpfile tmpfile64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
extern FILE *tmpfile64 (void) __wur;
|
||||
#endif
|
||||
|
||||
/* Generate a temporary filename. */
|
||||
extern char *tmpnam (char *__s) __THROW __wur;
|
||||
|
||||
#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 (char *__s) __THROW __wur;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined __USE_MISC || defined __USE_XOPEN
|
||||
/* Generate a unique temporary filename using up to five characters of PFX
|
||||
if it is not NULL. The directory to put this file in is searched for
|
||||
as follows: First the environment variable "TMPDIR" is checked.
|
||||
If it contains the name of a writable directory, that directory is used.
|
||||
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 (const char *__dir, const char *__pfx)
|
||||
__THROW __attribute_malloc__ __wur;
|
||||
#endif
|
||||
|
||||
|
||||
/* Close STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fclose (FILE *__stream);
|
||||
/* Flush STREAM, or all streams if STREAM is NULL.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fflush (FILE *__stream);
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Faster versions when locking is not required.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int fflush_unlocked (FILE *__stream);
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Close all streams.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int fcloseall (void);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
/* Open a file and create a new stream for it.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern FILE *fopen (const char *__restrict __filename,
|
||||
const char *__restrict __modes) __wur;
|
||||
/* Open a file, replacing an existing stream with it.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern FILE *freopen (const char *__restrict __filename,
|
||||
const char *__restrict __modes,
|
||||
FILE *__restrict __stream) __wur;
|
||||
#else
|
||||
# ifdef __REDIRECT
|
||||
extern FILE *__REDIRECT (fopen, (const char *__restrict __filename,
|
||||
const char *__restrict __modes), fopen64)
|
||||
__wur;
|
||||
extern FILE *__REDIRECT (freopen, (const char *__restrict __filename,
|
||||
const char *__restrict __modes,
|
||||
FILE *__restrict __stream), freopen64)
|
||||
__wur;
|
||||
# else
|
||||
# define fopen fopen64
|
||||
# define freopen freopen64
|
||||
# endif
|
||||
#endif
|
||||
#ifdef __USE_LARGEFILE64
|
||||
extern FILE *fopen64 (const char *__restrict __filename,
|
||||
const char *__restrict __modes) __wur;
|
||||
extern FILE *freopen64 (const char *__restrict __filename,
|
||||
const char *__restrict __modes,
|
||||
FILE *__restrict __stream) __wur;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_POSIX
|
||||
/* Create a new stream that refers to an existing system file descriptor. */
|
||||
extern FILE *fdopen (int __fd, const char *__modes) __THROW __wur;
|
||||
#endif
|
||||
|
||||
#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 __wur;
|
||||
#endif
|
||||
|
||||
#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
|
||||
/* Create a new stream that refers to a memory buffer. */
|
||||
extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
|
||||
__THROW __wur;
|
||||
|
||||
/* 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 **__bufloc, size_t *__sizeloc) __THROW __wur;
|
||||
#endif
|
||||
|
||||
|
||||
/* If BUF is NULL, make STREAM unbuffered.
|
||||
Else make it use buffer BUF, of size BUFSIZ. */
|
||||
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_MISC
|
||||
/* If BUF is NULL, make STREAM unbuffered.
|
||||
Else make it use SIZE bytes of BUF for buffering. */
|
||||
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
|
||||
size_t __size) __THROW;
|
||||
|
||||
/* Make STREAM line-buffered. */
|
||||
extern void setlinebuf (FILE *__stream) __THROW;
|
||||
#endif
|
||||
|
||||
|
||||
/* Write formatted output to STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fprintf (FILE *__restrict __stream,
|
||||
const char *__restrict __format, ...);
|
||||
/* Write formatted output to stdout.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int printf (const char *__restrict __format, ...);
|
||||
/* Write formatted output to S. */
|
||||
extern int sprintf (char *__restrict __s,
|
||||
const char *__restrict __format, ...) __THROWNL;
|
||||
|
||||
/* Write formatted output to S from argument list ARG.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
|
||||
_G_va_list __arg);
|
||||
/* Write formatted output to stdout from argument list ARG.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int vprintf (const char *__restrict __format, _G_va_list __arg);
|
||||
/* Write formatted output to S from argument list ARG. */
|
||||
extern int vsprintf (char *__restrict __s, const char *__restrict __format,
|
||||
_G_va_list __arg) __THROWNL;
|
||||
|
||||
#if defined __USE_ISOC99 || defined __USE_UNIX98
|
||||
/* Maximum chars of output to write in MAXLEN. */
|
||||
extern int snprintf (char *__restrict __s, size_t __maxlen,
|
||||
const char *__restrict __format, ...)
|
||||
__THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
|
||||
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
|
||||
const char *__restrict __format, _G_va_list __arg)
|
||||
__THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
|
||||
#endif
|
||||
|
||||
#if __GLIBC_USE (LIB_EXT2)
|
||||
/* 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)
|
||||
__THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
|
||||
extern int __asprintf (char **__restrict __ptr,
|
||||
const char *__restrict __fmt, ...)
|
||||
__THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
|
||||
extern int asprintf (char **__restrict __ptr,
|
||||
const char *__restrict __fmt, ...)
|
||||
__THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Write formatted output to a file descriptor. */
|
||||
extern int vdprintf (int __fd, const char *__restrict __fmt,
|
||||
_G_va_list __arg)
|
||||
__attribute__ ((__format__ (__printf__, 2, 0)));
|
||||
extern int dprintf (int __fd, const char *__restrict __fmt, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
#endif
|
||||
|
||||
|
||||
/* Read formatted input from STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fscanf (FILE *__restrict __stream,
|
||||
const char *__restrict __format, ...) __wur;
|
||||
/* Read formatted input from stdin.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int scanf (const char *__restrict __format, ...) __wur;
|
||||
/* Read formatted input from S. */
|
||||
extern int sscanf (const char *__restrict __s,
|
||||
const char *__restrict __format, ...) __THROW;
|
||||
|
||||
#if defined __USE_ISOC99 && !defined __USE_GNU \
|
||||
&& (!defined __LDBL_COMPAT || !defined __REDIRECT) \
|
||||
&& (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
|
||||
# ifdef __REDIRECT
|
||||
/* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
|
||||
GNU extension which conflicts with valid %a followed by letter
|
||||
s, S or [. */
|
||||
extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
|
||||
const char *__restrict __format, ...),
|
||||
__isoc99_fscanf) __wur;
|
||||
extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
|
||||
__isoc99_scanf) __wur;
|
||||
extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
|
||||
const char *__restrict __format, ...),
|
||||
__isoc99_sscanf);
|
||||
# else
|
||||
extern int __isoc99_fscanf (FILE *__restrict __stream,
|
||||
const char *__restrict __format, ...) __wur;
|
||||
extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
|
||||
extern int __isoc99_sscanf (const char *__restrict __s,
|
||||
const char *__restrict __format, ...) __THROW;
|
||||
# define fscanf __isoc99_fscanf
|
||||
# define scanf __isoc99_scanf
|
||||
# define sscanf __isoc99_sscanf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_ISOC99
|
||||
/* Read formatted input from S into argument list ARG.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
|
||||
_G_va_list __arg)
|
||||
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
|
||||
|
||||
/* Read formatted input from stdin into argument list ARG.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int vscanf (const char *__restrict __format, _G_va_list __arg)
|
||||
__attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
|
||||
|
||||
/* Read formatted input from S into argument list ARG. */
|
||||
extern int vsscanf (const char *__restrict __s,
|
||||
const char *__restrict __format, _G_va_list __arg)
|
||||
__THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
|
||||
|
||||
# if !defined __USE_GNU \
|
||||
&& (!defined __LDBL_COMPAT || !defined __REDIRECT) \
|
||||
&& (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
|
||||
# ifdef __REDIRECT
|
||||
/* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
|
||||
GNU extension which conflicts with valid %a followed by letter
|
||||
s, S or [. */
|
||||
extern int __REDIRECT (vfscanf,
|
||||
(FILE *__restrict __s,
|
||||
const char *__restrict __format, _G_va_list __arg),
|
||||
__isoc99_vfscanf)
|
||||
__attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
|
||||
extern int __REDIRECT (vscanf, (const char *__restrict __format,
|
||||
_G_va_list __arg), __isoc99_vscanf)
|
||||
__attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
|
||||
extern int __REDIRECT_NTH (vsscanf,
|
||||
(const char *__restrict __s,
|
||||
const char *__restrict __format,
|
||||
_G_va_list __arg), __isoc99_vsscanf)
|
||||
__attribute__ ((__format__ (__scanf__, 2, 0)));
|
||||
# else
|
||||
extern int __isoc99_vfscanf (FILE *__restrict __s,
|
||||
const char *__restrict __format,
|
||||
_G_va_list __arg) __wur;
|
||||
extern int __isoc99_vscanf (const char *__restrict __format,
|
||||
_G_va_list __arg) __wur;
|
||||
extern int __isoc99_vsscanf (const char *__restrict __s,
|
||||
const char *__restrict __format,
|
||||
_G_va_list __arg) __THROW;
|
||||
# define vfscanf __isoc99_vfscanf
|
||||
# define vscanf __isoc99_vscanf
|
||||
# define vsscanf __isoc99_vsscanf
|
||||
# endif
|
||||
# endif
|
||||
#endif /* Use ISO C9x. */
|
||||
|
||||
|
||||
/* Read a character from STREAM.
|
||||
|
||||
These functions are possible cancellation points and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fgetc (FILE *__stream);
|
||||
extern int getc (FILE *__stream);
|
||||
|
||||
/* Read a character from stdin.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int getchar (void);
|
||||
|
||||
/* The C standard explicitly says this is a macro, so we always do the
|
||||
optimization for it. */
|
||||
#define getc(_fp) _IO_getc (_fp)
|
||||
|
||||
#ifdef __USE_POSIX199506
|
||||
/* These are defined in POSIX.1:1996.
|
||||
|
||||
These functions are possible cancellation points and therefore not
|
||||
marked with __THROW. */
|
||||
extern int getc_unlocked (FILE *__stream);
|
||||
extern int getchar_unlocked (void);
|
||||
#endif /* Use POSIX. */
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Faster version when locking is not necessary.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int fgetc_unlocked (FILE *__stream);
|
||||
#endif /* Use MISC. */
|
||||
|
||||
|
||||
/* Write a character to STREAM.
|
||||
|
||||
These functions are possible cancellation points and therefore not
|
||||
marked with __THROW.
|
||||
|
||||
These functions is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fputc (int __c, FILE *__stream);
|
||||
extern int putc (int __c, FILE *__stream);
|
||||
|
||||
/* Write a character to stdout.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int putchar (int __c);
|
||||
|
||||
/* The C standard explicitly says this can be a macro,
|
||||
so we always do the optimization for it. */
|
||||
#define putc(_ch, _fp) _IO_putc (_ch, _fp)
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Faster version when locking is not necessary.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int fputc_unlocked (int __c, FILE *__stream);
|
||||
#endif /* Use MISC. */
|
||||
|
||||
#ifdef __USE_POSIX199506
|
||||
/* These are defined in POSIX.1:1996.
|
||||
|
||||
These functions are possible cancellation points and therefore not
|
||||
marked with __THROW. */
|
||||
extern int putc_unlocked (int __c, FILE *__stream);
|
||||
extern int putchar_unlocked (int __c);
|
||||
#endif /* Use POSIX. */
|
||||
|
||||
|
||||
#if defined __USE_MISC \
|
||||
|| (defined __USE_XOPEN && !defined __USE_XOPEN2K)
|
||||
/* Get a word (int) from STREAM. */
|
||||
extern int getw (FILE *__stream);
|
||||
|
||||
/* Write a word (int) to STREAM. */
|
||||
extern int putw (int __w, FILE *__stream);
|
||||
#endif
|
||||
|
||||
|
||||
/* Get a newline-terminated string of finite length from STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
|
||||
__wur;
|
||||
|
||||
#if __GLIBC_USE (DEPRECATED_GETS)
|
||||
/* Get a newline-terminated string from stdin, removing the newline.
|
||||
|
||||
This function is impossible to use safely. It has been officially
|
||||
removed from ISO C11 and ISO C++14, and we have also removed it
|
||||
from the _GNU_SOURCE feature list. It remains available when
|
||||
explicitly using an old ISO C, Unix, or POSIX standard.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern char *gets (char *__s) __wur __attribute_deprecated__;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* This function does the same as `fgets' but does not lock the stream.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern char *fgets_unlocked (char *__restrict __s, int __n,
|
||||
FILE *__restrict __stream) __wur;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
|
||||
/* 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.
|
||||
|
||||
These functions are not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation they are cancellation points and
|
||||
therefore not marked with __THROW. */
|
||||
extern _IO_ssize_t __getdelim (char **__restrict __lineptr,
|
||||
size_t *__restrict __n, int __delimiter,
|
||||
FILE *__restrict __stream) __wur;
|
||||
extern _IO_ssize_t getdelim (char **__restrict __lineptr,
|
||||
size_t *__restrict __n, int __delimiter,
|
||||
FILE *__restrict __stream) __wur;
|
||||
|
||||
/* Like `getdelim', but reads up to a newline.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern _IO_ssize_t getline (char **__restrict __lineptr,
|
||||
size_t *__restrict __n,
|
||||
FILE *__restrict __stream) __wur;
|
||||
#endif
|
||||
|
||||
|
||||
/* Write a string to STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
|
||||
|
||||
/* Write a string, followed by a newline, to stdout.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int puts (const char *__s);
|
||||
|
||||
|
||||
/* Push a character back onto the input buffer of STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int ungetc (int __c, FILE *__stream);
|
||||
|
||||
|
||||
/* Read chunks of generic data from STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern size_t fread (void *__restrict __ptr, size_t __size,
|
||||
size_t __n, FILE *__restrict __stream) __wur;
|
||||
/* Write chunks of generic data to STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern size_t fwrite (const void *__restrict __ptr, size_t __size,
|
||||
size_t __n, FILE *__restrict __s);
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* This function does the same as `fputs' but does not lock the stream.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int fputs_unlocked (const char *__restrict __s,
|
||||
FILE *__restrict __stream);
|
||||
#endif
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Faster versions when locking is not necessary.
|
||||
|
||||
These functions are not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation they are cancellation points and
|
||||
therefore not marked with __THROW. */
|
||||
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
|
||||
size_t __n, FILE *__restrict __stream) __wur;
|
||||
extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
|
||||
size_t __n, FILE *__restrict __stream);
|
||||
#endif
|
||||
|
||||
|
||||
/* Seek to a certain position on STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fseek (FILE *__stream, long int __off, int __whence);
|
||||
/* Return the current position of STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern long int ftell (FILE *__stream) __wur;
|
||||
/* Rewind to the beginning of STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void rewind (FILE *__stream);
|
||||
|
||||
/* 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. */
|
||||
|
||||
#if defined __USE_LARGEFILE || defined __USE_XOPEN2K
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
/* Seek to a certain position on STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fseeko (FILE *__stream, __off_t __off, int __whence);
|
||||
/* Return the current position of STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern __off_t ftello (FILE *__stream) __wur;
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (fseeko,
|
||||
(FILE *__stream, __off64_t __off, int __whence),
|
||||
fseeko64);
|
||||
extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
|
||||
# else
|
||||
# define fseeko fseeko64
|
||||
# define ftello ftello64
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __USE_FILE_OFFSET64
|
||||
/* Get STREAM's position.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
|
||||
/* Set STREAM's position.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fsetpos (FILE *__stream, const fpos_t *__pos);
|
||||
#else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
|
||||
fpos_t *__restrict __pos), fgetpos64);
|
||||
extern int __REDIRECT (fsetpos,
|
||||
(FILE *__stream, const fpos_t *__pos), fsetpos64);
|
||||
# else
|
||||
# define fgetpos fgetpos64
|
||||
# define fsetpos fsetpos64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
|
||||
extern __off64_t ftello64 (FILE *__stream) __wur;
|
||||
extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
|
||||
extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos);
|
||||
#endif
|
||||
|
||||
/* Clear the error and EOF indicators for STREAM. */
|
||||
extern void clearerr (FILE *__stream) __THROW;
|
||||
/* Return the EOF indicator for STREAM. */
|
||||
extern int feof (FILE *__stream) __THROW __wur;
|
||||
/* Return the error indicator for STREAM. */
|
||||
extern int ferror (FILE *__stream) __THROW __wur;
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Faster versions when locking is not required. */
|
||||
extern void clearerr_unlocked (FILE *__stream) __THROW;
|
||||
extern int feof_unlocked (FILE *__stream) __THROW __wur;
|
||||
extern int ferror_unlocked (FILE *__stream) __THROW __wur;
|
||||
#endif
|
||||
|
||||
|
||||
/* Print a message describing the meaning of the value of errno.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern void perror (const char *__s);
|
||||
|
||||
/* Provide the declarations for `sys_errlist' and `sys_nerr' if they
|
||||
are available on this system. Even if available, these variables
|
||||
should not be used directly. The `strerror' function provides
|
||||
all the necessary functionality. */
|
||||
#include <bits/sys_errlist.h>
|
||||
|
||||
|
||||
#ifdef __USE_POSIX
|
||||
/* Return the system file descriptor for STREAM. */
|
||||
extern int fileno (FILE *__stream) __THROW __wur;
|
||||
#endif /* Use POSIX. */
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Faster version when locking is not required. */
|
||||
extern int fileno_unlocked (FILE *__stream) __THROW __wur;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_POSIX2
|
||||
/* Create a new stream connected to a pipe running the given command.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern FILE *popen (const char *__command, const char *__modes) __wur;
|
||||
|
||||
/* Close a stream opened by popen and return the status of its child.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int pclose (FILE *__stream);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_POSIX
|
||||
/* Return the name of the controlling terminal. */
|
||||
extern char *ctermid (char *__s) __THROW;
|
||||
#endif /* Use POSIX. */
|
||||
|
||||
|
||||
#if (defined __USE_XOPEN && !defined __USE_XOPEN2K) || defined __USE_GNU
|
||||
/* Return the name of the current user. */
|
||||
extern char *cuserid (char *__s);
|
||||
#endif /* Use X/Open, but not issue 6. */
|
||||
|
||||
|
||||
#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, ...)
|
||||
__THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
extern int obstack_vprintf (struct obstack *__restrict __obstack,
|
||||
const char *__restrict __format,
|
||||
_G_va_list __args)
|
||||
__THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
|
||||
#endif /* Use GNU. */
|
||||
|
||||
|
||||
#ifdef __USE_POSIX199506
|
||||
/* These are defined in POSIX.1:1996. */
|
||||
|
||||
/* Acquire ownership of 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 (FILE *__stream) __THROW __wur;
|
||||
|
||||
/* Relinquish the ownership granted for STREAM. */
|
||||
extern void funlockfile (FILE *__stream) __THROW;
|
||||
#endif /* POSIX */
|
||||
|
||||
#if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
|
||||
/* X/Open Issues 1-5 required getopt to be declared in this
|
||||
header. It was removed in Issue 6. GNU follows Issue 6. */
|
||||
# include <bits/getopt_posix.h>
|
||||
#endif
|
||||
|
||||
/* If we are compiling with optimizing read this file. It contains
|
||||
several optimizing inline functions and macros. */
|
||||
#ifdef __USE_EXTERN_INLINES
|
||||
# include <bits/stdio.h>
|
||||
#endif
|
||||
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
|
||||
# include <bits/stdio2.h>
|
||||
#endif
|
||||
#ifdef __LDBL_COMPAT
|
||||
# include <bits/stdio-ldbl.h>
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* <stdio.h> included. */
|
1028
contrib/libc-headers/stdlib.h
Normal file
1028
contrib/libc-headers/stdlib.h
Normal file
File diff suppressed because it is too large
Load Diff
500
contrib/libc-headers/string.h
Normal file
500
contrib/libc-headers/string.h
Normal file
@ -0,0 +1,500 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.21 String handling <string.h>
|
||||
*/
|
||||
|
||||
#ifndef _STRING_H
|
||||
#define _STRING_H 1
|
||||
|
||||
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
|
||||
#include <bits/libc-header-start.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Get size_t and NULL from <stddef.h>. */
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
/* Tell the caller that we provide correct C++ prototypes. */
|
||||
#if defined __cplusplus && __GNUC_PREREQ (4, 4)
|
||||
# define __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
#endif
|
||||
|
||||
|
||||
/* Copy N bytes of SRC to DEST. */
|
||||
extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
|
||||
size_t __n) __THROW __nonnull ((1, 2));
|
||||
/* 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 __nonnull ((1, 2));
|
||||
|
||||
/* 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. */
|
||||
#if defined __USE_MISC || defined __USE_XOPEN
|
||||
extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
|
||||
int __c, size_t __n)
|
||||
__THROW __nonnull ((1, 2));
|
||||
#endif /* Misc || X/Open. */
|
||||
|
||||
|
||||
/* Set N bytes of S to C. */
|
||||
extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
|
||||
|
||||
/* Compare N bytes of S1 and S2. */
|
||||
extern int memcmp (const void *__s1, const void *__s2, size_t __n)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
|
||||
/* Search N bytes of S for C. */
|
||||
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++"
|
||||
{
|
||||
extern void *memchr (void *__s, int __c, size_t __n)
|
||||
__THROW __asm ("memchr") __attribute_pure__ __nonnull ((1));
|
||||
extern const void *memchr (const void *__s, int __c, size_t __n)
|
||||
__THROW __asm ("memchr") __attribute_pure__ __nonnull ((1));
|
||||
|
||||
# ifdef __OPTIMIZE__
|
||||
__extern_always_inline void *
|
||||
memchr (void *__s, int __c, size_t __n) __THROW
|
||||
{
|
||||
return __builtin_memchr (__s, __c, __n);
|
||||
}
|
||||
|
||||
__extern_always_inline const void *
|
||||
memchr (const void *__s, int __c, size_t __n) __THROW
|
||||
{
|
||||
return __builtin_memchr (__s, __c, __n);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
extern void *memchr (const void *__s, int __c, size_t __n)
|
||||
__THROW __attribute_pure__ __nonnull ((1));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Search in S for C. This is similar to `memchr' but there is no
|
||||
length limit. */
|
||||
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++" void *rawmemchr (void *__s, int __c)
|
||||
__THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1));
|
||||
extern "C++" const void *rawmemchr (const void *__s, int __c)
|
||||
__THROW __asm ("rawmemchr") __attribute_pure__ __nonnull ((1));
|
||||
# else
|
||||
extern void *rawmemchr (const void *__s, int __c)
|
||||
__THROW __attribute_pure__ __nonnull ((1));
|
||||
# endif
|
||||
|
||||
/* Search N bytes of S for the final occurrence of C. */
|
||||
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++" void *memrchr (void *__s, int __c, size_t __n)
|
||||
__THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1));
|
||||
extern "C++" const void *memrchr (const void *__s, int __c, size_t __n)
|
||||
__THROW __asm ("memrchr") __attribute_pure__ __nonnull ((1));
|
||||
# else
|
||||
extern void *memrchr (const void *__s, int __c, size_t __n)
|
||||
__THROW __attribute_pure__ __nonnull ((1));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Copy SRC to DEST. */
|
||||
extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
|
||||
__THROW __nonnull ((1, 2));
|
||||
/* Copy no more than N characters of SRC to DEST. */
|
||||
extern char *strncpy (char *__restrict __dest,
|
||||
const char *__restrict __src, size_t __n)
|
||||
__THROW __nonnull ((1, 2));
|
||||
|
||||
/* Append SRC onto DEST. */
|
||||
extern char *strcat (char *__restrict __dest, const char *__restrict __src)
|
||||
__THROW __nonnull ((1, 2));
|
||||
/* Append no more than N characters from SRC onto DEST. */
|
||||
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
|
||||
size_t __n) __THROW __nonnull ((1, 2));
|
||||
|
||||
/* Compare S1 and S2. */
|
||||
extern int strcmp (const char *__s1, const char *__s2)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
/* Compare N characters of S1 and S2. */
|
||||
extern int strncmp (const char *__s1, const char *__s2, size_t __n)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
|
||||
/* Compare the collated forms of S1 and S2. */
|
||||
extern int strcoll (const char *__s1, const char *__s2)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
/* 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 __nonnull ((2));
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* POSIX.1-2008 extended locale interface (see locale.h). */
|
||||
# include <bits/types/locale_t.h>
|
||||
|
||||
/* Compare the collated forms of S1 and S2, using sorting rules from L. */
|
||||
extern int strcoll_l (const char *__s1, const char *__s2, locale_t __l)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2, 3));
|
||||
/* Put a transformation of SRC into no more than N bytes of DEST,
|
||||
using sorting rules from L. */
|
||||
extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
|
||||
locale_t __l) __THROW __nonnull ((2, 4));
|
||||
#endif
|
||||
|
||||
#if (defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 \
|
||||
|| __GLIBC_USE (LIB_EXT2))
|
||||
/* Duplicate S, returning an identical malloc'd string. */
|
||||
extern char *strdup (const char *__s)
|
||||
__THROW __attribute_malloc__ __nonnull ((1));
|
||||
#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 defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
|
||||
extern char *strndup (const char *__string, size_t __n)
|
||||
__THROW __attribute_malloc__ __nonnull ((1));
|
||||
#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 = (char *) __builtin_alloca (__len); \
|
||||
(char *) memcpy (__new, __old, __len); \
|
||||
}))
|
||||
|
||||
/* Return an alloca'd copy of at most N bytes of string. */
|
||||
# define strndupa(s, n) \
|
||||
(__extension__ \
|
||||
({ \
|
||||
const char *__old = (s); \
|
||||
size_t __len = strnlen (__old, (n)); \
|
||||
char *__new = (char *) __builtin_alloca (__len + 1); \
|
||||
__new[__len] = '\0'; \
|
||||
(char *) memcpy (__new, __old, __len); \
|
||||
}))
|
||||
#endif
|
||||
|
||||
/* Find the first occurrence of C in S. */
|
||||
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++"
|
||||
{
|
||||
extern char *strchr (char *__s, int __c)
|
||||
__THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));
|
||||
extern const char *strchr (const char *__s, int __c)
|
||||
__THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));
|
||||
|
||||
# ifdef __OPTIMIZE__
|
||||
__extern_always_inline char *
|
||||
strchr (char *__s, int __c) __THROW
|
||||
{
|
||||
return __builtin_strchr (__s, __c);
|
||||
}
|
||||
|
||||
__extern_always_inline const char *
|
||||
strchr (const char *__s, int __c) __THROW
|
||||
{
|
||||
return __builtin_strchr (__s, __c);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
extern char *strchr (const char *__s, int __c)
|
||||
__THROW __attribute_pure__ __nonnull ((1));
|
||||
#endif
|
||||
/* Find the last occurrence of C in S. */
|
||||
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++"
|
||||
{
|
||||
extern char *strrchr (char *__s, int __c)
|
||||
__THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1));
|
||||
extern const char *strrchr (const char *__s, int __c)
|
||||
__THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1));
|
||||
|
||||
# ifdef __OPTIMIZE__
|
||||
__extern_always_inline char *
|
||||
strrchr (char *__s, int __c) __THROW
|
||||
{
|
||||
return __builtin_strrchr (__s, __c);
|
||||
}
|
||||
|
||||
__extern_always_inline const char *
|
||||
strrchr (const char *__s, int __c) __THROW
|
||||
{
|
||||
return __builtin_strrchr (__s, __c);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
extern char *strrchr (const char *__s, int __c)
|
||||
__THROW __attribute_pure__ __nonnull ((1));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* This function is similar to `strchr'. But it returns a pointer to
|
||||
the closing NUL byte in case C is not found in S. */
|
||||
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++" char *strchrnul (char *__s, int __c)
|
||||
__THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1));
|
||||
extern "C++" const char *strchrnul (const char *__s, int __c)
|
||||
__THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1));
|
||||
# else
|
||||
extern char *strchrnul (const char *__s, int __c)
|
||||
__THROW __attribute_pure__ __nonnull ((1));
|
||||
# endif
|
||||
#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__ __nonnull ((1, 2));
|
||||
/* 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__ __nonnull ((1, 2));
|
||||
/* Find the first occurrence in S of any character in ACCEPT. */
|
||||
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++"
|
||||
{
|
||||
extern char *strpbrk (char *__s, const char *__accept)
|
||||
__THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
|
||||
extern const char *strpbrk (const char *__s, const char *__accept)
|
||||
__THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2));
|
||||
|
||||
# ifdef __OPTIMIZE__
|
||||
__extern_always_inline char *
|
||||
strpbrk (char *__s, const char *__accept) __THROW
|
||||
{
|
||||
return __builtin_strpbrk (__s, __accept);
|
||||
}
|
||||
|
||||
__extern_always_inline const char *
|
||||
strpbrk (const char *__s, const char *__accept) __THROW
|
||||
{
|
||||
return __builtin_strpbrk (__s, __accept);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
extern char *strpbrk (const char *__s, const char *__accept)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
#endif
|
||||
/* Find the first occurrence of NEEDLE in HAYSTACK. */
|
||||
#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++"
|
||||
{
|
||||
extern char *strstr (char *__haystack, const char *__needle)
|
||||
__THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
|
||||
extern const char *strstr (const char *__haystack, const char *__needle)
|
||||
__THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2));
|
||||
|
||||
# ifdef __OPTIMIZE__
|
||||
__extern_always_inline char *
|
||||
strstr (char *__haystack, const char *__needle) __THROW
|
||||
{
|
||||
return __builtin_strstr (__haystack, __needle);
|
||||
}
|
||||
|
||||
__extern_always_inline const char *
|
||||
strstr (const char *__haystack, const char *__needle) __THROW
|
||||
{
|
||||
return __builtin_strstr (__haystack, __needle);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
extern char *strstr (const char *__haystack, const char *__needle)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
#endif
|
||||
|
||||
|
||||
/* Divide S into tokens separated by characters in DELIM. */
|
||||
extern char *strtok (char *__restrict __s, const char *__restrict __delim)
|
||||
__THROW __nonnull ((2));
|
||||
|
||||
/* 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 __nonnull ((2, 3));
|
||||
#ifdef __USE_POSIX
|
||||
extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
|
||||
char **__restrict __save_ptr)
|
||||
__THROW __nonnull ((2, 3));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Similar to `strstr' but this function ignores the case of both strings. */
|
||||
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++" char *strcasestr (char *__haystack, const char *__needle)
|
||||
__THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2));
|
||||
extern "C++" const char *strcasestr (const char *__haystack,
|
||||
const char *__needle)
|
||||
__THROW __asm ("strcasestr") __attribute_pure__ __nonnull ((1, 2));
|
||||
# else
|
||||
extern char *strcasestr (const char *__haystack, const char *__needle)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#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__ __nonnull ((1, 3));
|
||||
|
||||
/* 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 __nonnull ((1, 2));
|
||||
extern void *mempcpy (void *__restrict __dest,
|
||||
const void *__restrict __src, size_t __n)
|
||||
__THROW __nonnull ((1, 2));
|
||||
#endif
|
||||
|
||||
|
||||
/* Return the length of S. */
|
||||
extern size_t strlen (const char *__s)
|
||||
__THROW __attribute_pure__ __nonnull ((1));
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* 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__ __nonnull ((1));
|
||||
#endif
|
||||
|
||||
|
||||
/* Return a string describing the meaning of the `errno' code in ERRNUM. */
|
||||
extern char *strerror (int __errnum) __THROW;
|
||||
#ifdef __USE_XOPEN2K
|
||||
/* Reentrant version of `strerror'.
|
||||
There are 2 flavors of `strerror_r', GNU which returns the string
|
||||
and may or may not use the supplied temporary buffer and POSIX one
|
||||
which fills the string into the buffer.
|
||||
To use the POSIX version, -D_XOPEN_SOURCE=600 or -D_POSIX_C_SOURCE=200112L
|
||||
without -D_GNU_SOURCE is needed, otherwise the GNU version is
|
||||
preferred. */
|
||||
# if defined __USE_XOPEN2K && !defined __USE_GNU
|
||||
/* Fill BUF with a string describing the meaning of the `errno' code in
|
||||
ERRNUM. */
|
||||
# ifdef __REDIRECT_NTH
|
||||
extern int __REDIRECT_NTH (strerror_r,
|
||||
(int __errnum, char *__buf, size_t __buflen),
|
||||
__xpg_strerror_r) __nonnull ((2));
|
||||
# else
|
||||
extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
|
||||
__THROW __nonnull ((2));
|
||||
# define strerror_r __xpg_strerror_r
|
||||
# endif
|
||||
# else
|
||||
/* 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 __nonnull ((2)) __wur;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Translate error number to string according to the locale L. */
|
||||
extern char *strerror_l (int __errnum, locale_t __l) __THROW;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# include <strings.h>
|
||||
|
||||
/* Set N bytes of S to 0. The compiler will not delete a call to this
|
||||
function, even if S is dead after the call. */
|
||||
extern void explicit_bzero (void *__s, size_t __n) __THROW __nonnull ((1));
|
||||
|
||||
/* 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 __nonnull ((1, 2));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Return a string describing the meaning of the signal number in SIG. */
|
||||
extern char *strsignal (int __sig) __THROW;
|
||||
|
||||
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
|
||||
extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
|
||||
__THROW __nonnull ((1, 2));
|
||||
extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
|
||||
__THROW __nonnull ((1, 2));
|
||||
|
||||
/* 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 __nonnull ((1, 2));
|
||||
extern char *stpncpy (char *__restrict __dest,
|
||||
const char *__restrict __src, size_t __n)
|
||||
__THROW __nonnull ((1, 2));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Compare S1 and S2 as strings holding name & indices/version numbers. */
|
||||
extern int strverscmp (const char *__s1, const char *__s2)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
|
||||
/* Sautee STRING briskly. */
|
||||
extern char *strfry (char *__string) __THROW __nonnull ((1));
|
||||
|
||||
/* Frobnicate N bytes of S. */
|
||||
extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1));
|
||||
|
||||
# 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. */
|
||||
# ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
|
||||
extern "C++" char *basename (char *__filename)
|
||||
__THROW __asm ("basename") __nonnull ((1));
|
||||
extern "C++" const char *basename (const char *__filename)
|
||||
__THROW __asm ("basename") __nonnull ((1));
|
||||
# else
|
||||
extern char *basename (const char *__filename) __THROW __nonnull ((1));
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ (3,4)
|
||||
# if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
|
||||
/* Functions with security checks. */
|
||||
# include <bits/string_fortified.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* string.h */
|
148
contrib/libc-headers/strings.h
Normal file
148
contrib/libc-headers/strings.h
Normal file
@ -0,0 +1,148 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _STRINGS_H
|
||||
#define _STRINGS_H 1
|
||||
|
||||
#include <features.h>
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
/* Tell the caller that we provide correct C++ prototypes. */
|
||||
#if defined __cplusplus && __GNUC_PREREQ (4, 4)
|
||||
# define __CORRECT_ISO_CPP_STRINGS_H_PROTO
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if defined __USE_MISC || !defined __USE_XOPEN2K8
|
||||
/* 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__ __nonnull ((1, 2));
|
||||
|
||||
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
|
||||
extern void bcopy (const void *__src, void *__dest, size_t __n)
|
||||
__THROW __nonnull ((1, 2));
|
||||
|
||||
/* Set N bytes of S to 0. */
|
||||
extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
|
||||
|
||||
/* Find the first occurrence of C in S (same as strchr). */
|
||||
# ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO
|
||||
extern "C++"
|
||||
{
|
||||
extern char *index (char *__s, int __c)
|
||||
__THROW __asm ("index") __attribute_pure__ __nonnull ((1));
|
||||
extern const char *index (const char *__s, int __c)
|
||||
__THROW __asm ("index") __attribute_pure__ __nonnull ((1));
|
||||
|
||||
# if defined __OPTIMIZE__
|
||||
__extern_always_inline char *
|
||||
index (char *__s, int __c) __THROW
|
||||
{
|
||||
return __builtin_index (__s, __c);
|
||||
}
|
||||
|
||||
__extern_always_inline const char *
|
||||
index (const char *__s, int __c) __THROW
|
||||
{
|
||||
return __builtin_index (__s, __c);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
# else
|
||||
extern char *index (const char *__s, int __c)
|
||||
__THROW __attribute_pure__ __nonnull ((1));
|
||||
# endif
|
||||
|
||||
/* Find the last occurrence of C in S (same as strrchr). */
|
||||
# ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO
|
||||
extern "C++"
|
||||
{
|
||||
extern char *rindex (char *__s, int __c)
|
||||
__THROW __asm ("rindex") __attribute_pure__ __nonnull ((1));
|
||||
extern const char *rindex (const char *__s, int __c)
|
||||
__THROW __asm ("rindex") __attribute_pure__ __nonnull ((1));
|
||||
|
||||
# if defined __OPTIMIZE__
|
||||
__extern_always_inline char *
|
||||
rindex (char *__s, int __c) __THROW
|
||||
{
|
||||
return __builtin_rindex (__s, __c);
|
||||
}
|
||||
|
||||
__extern_always_inline const char *
|
||||
rindex (const char *__s, int __c) __THROW
|
||||
{
|
||||
return __builtin_rindex (__s, __c);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
# else
|
||||
extern char *rindex (const char *__s, int __c)
|
||||
__THROW __attribute_pure__ __nonnull ((1));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined __USE_MISC || !defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8XSI
|
||||
/* 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__;
|
||||
#endif
|
||||
|
||||
/* The following two functions are non-standard but necessary for non-32 bit
|
||||
platforms. */
|
||||
# ifdef __USE_MISC
|
||||
extern int ffsl (long int __l) __THROW __attribute_const__;
|
||||
__extension__ extern int ffsll (long long int __ll)
|
||||
__THROW __attribute_const__;
|
||||
# endif
|
||||
|
||||
/* Compare S1 and S2, ignoring case. */
|
||||
extern int strcasecmp (const char *__s1, const char *__s2)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
|
||||
/* 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__ __nonnull ((1, 2));
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* POSIX.1-2008 extended locale interface (see locale.h). */
|
||||
# include <bits/types/locale_t.h>
|
||||
|
||||
/* Compare S1 and S2, ignoring case, using collation rules from LOC. */
|
||||
extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2, 3));
|
||||
|
||||
/* Compare no more than N chars of S1 and S2, ignoring case, using
|
||||
collation rules from LOC. */
|
||||
extern int strncasecmp_l (const char *__s1, const char *__s2,
|
||||
size_t __n, locale_t __loc)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2, 4));
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#if __GNUC_PREREQ (3,4) && __USE_FORTIFY_LEVEL > 0 \
|
||||
&& defined __fortify_function
|
||||
/* Functions with security checks. */
|
||||
# if defined __USE_MISC || !defined __USE_XOPEN2K8
|
||||
# include <bits/strings_fortified.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* strings.h */
|
1
contrib/libc-headers/syscall.h
Normal file
1
contrib/libc-headers/syscall.h
Normal file
@ -0,0 +1 @@
|
||||
#include <sys/syscall.h>
|
1
contrib/libc-headers/syslog.h
Normal file
1
contrib/libc-headers/syslog.h
Normal file
@ -0,0 +1 @@
|
||||
#include <sys/syslog.h>
|
109
contrib/libc-headers/termios.h
Normal file
109
contrib/libc-headers/termios.h
Normal file
@ -0,0 +1,109 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* POSIX Standard: 7.1-2 General Terminal Interface <termios.h>
|
||||
*/
|
||||
|
||||
#ifndef _TERMIOS_H
|
||||
#define _TERMIOS_H 1
|
||||
|
||||
#include <features.h>
|
||||
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
|
||||
/* We need `pid_t'. */
|
||||
# include <bits/types.h>
|
||||
# ifndef __pid_t_defined
|
||||
typedef __pid_t pid_t;
|
||||
# define __pid_t_defined
|
||||
# endif
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Get the system-dependent definitions of `struct termios', `tcflag_t',
|
||||
`cc_t', `speed_t', and all the macros specifying the flag bits. */
|
||||
#include <bits/termios.h>
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Compare a character C to a value VAL from the `c_cc' array in a
|
||||
`struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
|
||||
# define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
|
||||
#endif
|
||||
|
||||
/* Return the output baud rate stored in *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 (const struct termios *__termios_p) __THROW;
|
||||
|
||||
/* Set the output baud rate stored in *TERMIOS_P to 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 (struct termios *__termios_p, speed_t __speed) __THROW;
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */
|
||||
extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW;
|
||||
#endif
|
||||
|
||||
|
||||
/* Put the state of FD into *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 (int __fd, int __optional_actions,
|
||||
const struct termios *__termios_p) __THROW;
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Set *TERMIOS_P to indicate raw mode. */
|
||||
extern void cfmakeraw (struct termios *__termios_p) __THROW;
|
||||
#endif
|
||||
|
||||
/* Send zero bits on FD. */
|
||||
extern int tcsendbreak (int __fd, int __duration) __THROW;
|
||||
|
||||
/* Wait for pending output to be written on FD.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
extern int tcdrain (int __fd);
|
||||
|
||||
/* Flush pending data on FD.
|
||||
Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */
|
||||
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 (int __fd, int __action) __THROW;
|
||||
|
||||
|
||||
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
|
||||
/* Get process group ID for session leader for controlling terminal FD. */
|
||||
extern __pid_t tcgetsid (int __fd) __THROW;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# include <sys/ttydefaults.h>
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* termios.h */
|
309
contrib/libc-headers/time.h
Normal file
309
contrib/libc-headers/time.h
Normal file
@ -0,0 +1,309 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.23 Date and time <time.h>
|
||||
*/
|
||||
|
||||
#ifndef _TIME_H
|
||||
#define _TIME_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
/* This defines CLOCKS_PER_SEC, which is the number of processor clock
|
||||
ticks per second, and possibly a number of other constants. */
|
||||
#include <bits/time.h>
|
||||
|
||||
/* Many of the typedefs and structs whose official home is this header
|
||||
may also need to be defined by other headers. */
|
||||
#include <bits/types/clock_t.h>
|
||||
#include <bits/types/time_t.h>
|
||||
#include <bits/types/struct_tm.h>
|
||||
|
||||
#if defined __USE_POSIX199309 || defined __USE_ISOC11
|
||||
# include <bits/types/struct_timespec.h>
|
||||
#endif
|
||||
|
||||
#ifdef __USE_POSIX199309
|
||||
# include <bits/types/clockid_t.h>
|
||||
# include <bits/types/timer_t.h>
|
||||
# include <bits/types/struct_itimerspec.h>
|
||||
struct sigevent;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN2K
|
||||
# ifndef __pid_t_defined
|
||||
typedef __pid_t pid_t;
|
||||
# define __pid_t_defined
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
# include <bits/types/locale_t.h>
|
||||
#endif
|
||||
|
||||
#ifdef __USE_ISOC11
|
||||
/* Time base values for timespec_get. */
|
||||
# define TIME_UTC 1
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Time used by the program so far (user time + system time).
|
||||
The result / CLOCKS_PER_SEC 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
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Similar to the two functions above but take the information from
|
||||
the provided locale and not the global locale. */
|
||||
|
||||
extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
|
||||
const char *__restrict __format,
|
||||
const struct tm *__restrict __tp,
|
||||
locale_t __loc) __THROW;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
extern char *strptime_l (const char *__restrict __s,
|
||||
const char *__restrict __fmt, struct tm *__tp,
|
||||
locale_t __loc) __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;
|
||||
|
||||
#ifdef __USE_POSIX
|
||||
/* 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 */
|
||||
|
||||
/* 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;
|
||||
|
||||
#ifdef __USE_POSIX
|
||||
/* 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 */
|
||||
|
||||
|
||||
/* 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];
|
||||
|
||||
/* 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
|
||||
|
||||
#if defined __USE_MISC || defined __USE_XOPEN
|
||||
extern int daylight;
|
||||
extern long int timezone;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Set the system time to *WHEN.
|
||||
This call is restricted to the superuser. */
|
||||
extern int stime (const time_t *__when) __THROW;
|
||||
#endif
|
||||
|
||||
|
||||
/* 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))
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Miscellaneous functions many Unices inherited from the public domain
|
||||
localtime package. These are included only for compatibility. */
|
||||
|
||||
/* Like `mktime', but for TP represents Universal Time, not local time. */
|
||||
extern time_t timegm (struct tm *__tp) __THROW;
|
||||
|
||||
/* Another name for `mktime'. */
|
||||
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.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
extern int nanosleep (const struct timespec *__requested_time,
|
||||
struct timespec *__remaining);
|
||||
|
||||
|
||||
/* 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.
|
||||
|
||||
This function is a cancellation point and therefore not marked with
|
||||
__THROW. */
|
||||
extern int clock_nanosleep (clockid_t __clock_id, int __flags,
|
||||
const struct timespec *__req,
|
||||
struct timespec *__rem);
|
||||
|
||||
/* Return clock ID for CPU-time clock. */
|
||||
extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
|
||||
# endif
|
||||
|
||||
|
||||
/* 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 OVALUE. */
|
||||
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 VALUE. */
|
||||
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_ISOC11
|
||||
/* Set TS to calendar time based in time base BASE. */
|
||||
extern int timespec_get (struct timespec *__ts, int __base)
|
||||
__THROW __nonnull ((1));
|
||||
#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.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern struct tm *getdate (const char *__string);
|
||||
#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'.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int getdate_r (const char *__restrict __string,
|
||||
struct tm *__restrict __resbufp);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* time.h. */
|
52
contrib/libc-headers/ucontext.h
Normal file
52
contrib/libc-headers/ucontext.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* Copyright (C) 1997-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* System V ABI compliant user-level context switching support. */
|
||||
|
||||
#ifndef _UCONTEXT_H
|
||||
#define _UCONTEXT_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
/* Get machine dependent definition of data structures. */
|
||||
#include <sys/ucontext.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Get user context and store it in variable pointed to by UCP. */
|
||||
extern int getcontext (ucontext_t *__ucp) __THROWNL;
|
||||
|
||||
/* Set user context from information of variable pointed to by UCP. */
|
||||
extern int setcontext (const ucontext_t *__ucp) __THROWNL;
|
||||
|
||||
/* Save current context in context variable pointed to by OUCP and set
|
||||
context from variable pointed to by UCP. */
|
||||
extern int swapcontext (ucontext_t *__restrict __oucp,
|
||||
const ucontext_t *__restrict __ucp) __THROWNL;
|
||||
|
||||
/* Manipulate user context UCP to continue with calling functions FUNC
|
||||
and the ARGC-1 parameters following ARGC when the context is used
|
||||
the next time in `setcontext' or `swapcontext'.
|
||||
|
||||
We cannot say anything about the parameters FUNC takes; `void'
|
||||
is as good as any other choice. */
|
||||
extern void makecontext (ucontext_t *__ucp, void (*__func) (void),
|
||||
int __argc, ...) __THROW;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ucontext.h */
|
1177
contrib/libc-headers/unistd.h
Normal file
1177
contrib/libc-headers/unistd.h
Normal file
File diff suppressed because it is too large
Load Diff
50
contrib/libc-headers/utime.h
Normal file
50
contrib/libc-headers/utime.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* Copyright (C) 1991-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* POSIX Standard: 5.6.6 Set File Access and Modification Times <utime.h>
|
||||
*/
|
||||
|
||||
#ifndef _UTIME_H
|
||||
#define _UTIME_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <bits/types.h>
|
||||
|
||||
#if defined __USE_XOPEN || defined __USE_XOPEN2K
|
||||
# include <bits/types/time_t.h>
|
||||
#endif
|
||||
|
||||
/* Structure describing file times. */
|
||||
struct utimbuf
|
||||
{
|
||||
__time_t actime; /* Access time. */
|
||||
__time_t modtime; /* Modification time. */
|
||||
};
|
||||
|
||||
/* 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 __nonnull ((1));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* utime.h */
|
859
contrib/libc-headers/wchar.h
Normal file
859
contrib/libc-headers/wchar.h
Normal file
@ -0,0 +1,859 @@
|
||||
/* Copyright (C) 1995-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.24
|
||||
* Extended multibyte and wide character utilities <wchar.h>
|
||||
*/
|
||||
|
||||
#ifndef _WCHAR_H
|
||||
#define _WCHAR_H 1
|
||||
|
||||
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
|
||||
#include <bits/libc-header-start.h>
|
||||
|
||||
/* Gather machine dependent type support. */
|
||||
#include <bits/floatn.h>
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_wchar_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#define __need___va_list
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <bits/wchar.h>
|
||||
#include <bits/types/wint_t.h>
|
||||
#include <bits/types/mbstate_t.h>
|
||||
#include <bits/types/__FILE.h>
|
||||
|
||||
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
|
||||
# include <bits/types/FILE.h>
|
||||
#endif
|
||||
#ifdef __USE_XOPEN2K8
|
||||
# include <bits/types/locale_t.h>
|
||||
#endif
|
||||
|
||||
/* Tell the caller that we provide correct C++ prototypes. */
|
||||
#if defined __cplusplus && __GNUC_PREREQ (4, 4)
|
||||
# define __CORRECT_ISO_CPP_WCHAR_H_PROTO
|
||||
#endif
|
||||
|
||||
#ifndef WCHAR_MIN
|
||||
/* These constants might also be defined in <inttypes.h>. */
|
||||
# define WCHAR_MIN __WCHAR_MIN
|
||||
# define WCHAR_MAX __WCHAR_MAX
|
||||
#endif
|
||||
|
||||
#ifndef WEOF
|
||||
# define WEOF (0xffffffffu)
|
||||
#endif
|
||||
|
||||
/* All versions of XPG prior to the publication of ISO C99 required
|
||||
the bulk of <wctype.h>'s declarations to appear in this header
|
||||
(because <wctype.h> did not exist prior to C99). In POSIX.1-2001
|
||||
those declarations were marked as XSI extensions; in -2008 they
|
||||
were additionally marked as obsolescent. _GNU_SOURCE mode
|
||||
anticipates the removal of these declarations in the next revision
|
||||
of POSIX. */
|
||||
#if (defined __USE_XOPEN && !defined __USE_GNU \
|
||||
&& !(defined __USE_XOPEN2K && !defined __USE_XOPEN2KXSI))
|
||||
# include <bits/wctype-wchar.h>
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* This incomplete type is defined in <time.h> but needed here because
|
||||
of `wcsftime'. */
|
||||
struct tm;
|
||||
|
||||
|
||||
/* Copy SRC to DEST. */
|
||||
extern wchar_t *wcscpy (wchar_t *__restrict __dest,
|
||||
const wchar_t *__restrict __src)
|
||||
__THROW __nonnull ((1, 2));
|
||||
|
||||
/* Copy no more than N wide-characters of SRC to DEST. */
|
||||
extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
|
||||
const wchar_t *__restrict __src, size_t __n)
|
||||
__THROW __nonnull ((1, 2));
|
||||
|
||||
/* Append SRC onto DEST. */
|
||||
extern wchar_t *wcscat (wchar_t *__restrict __dest,
|
||||
const wchar_t *__restrict __src)
|
||||
__THROW __nonnull ((1, 2));
|
||||
/* Append no more than N wide-characters of SRC onto DEST. */
|
||||
extern wchar_t *wcsncat (wchar_t *__restrict __dest,
|
||||
const wchar_t *__restrict __src, size_t __n)
|
||||
__THROW __nonnull ((1, 2));
|
||||
|
||||
/* Compare S1 and S2. */
|
||||
extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
/* Compare N wide-characters of S1 and S2. */
|
||||
extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
|
||||
__THROW __attribute_pure__ __nonnull ((1, 2));
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Compare S1 and S2, ignoring case. */
|
||||
extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW;
|
||||
|
||||
/* Compare no more than N chars of S1 and S2, ignoring case. */
|
||||
extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
|
||||
size_t __n) __THROW;
|
||||
|
||||
/* Similar to the two functions above but take the information from
|
||||
the provided locale and not the global locale. */
|
||||
extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
|
||||
locale_t __loc) __THROW;
|
||||
|
||||
extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
|
||||
size_t __n, locale_t __loc) __THROW;
|
||||
#endif
|
||||
|
||||
/* Compare S1 and S2, both interpreted as appropriate to the
|
||||
LC_COLLATE category of the current locale. */
|
||||
extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
|
||||
/* Transform S2 into array pointed to by S1 such that if wcscmp is
|
||||
applied to two transformed strings the result is the as applying
|
||||
`wcscoll' to the original strings. */
|
||||
extern size_t wcsxfrm (wchar_t *__restrict __s1,
|
||||
const wchar_t *__restrict __s2, size_t __n) __THROW;
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Similar to the two functions above but take the information from
|
||||
the provided locale and not the global locale. */
|
||||
|
||||
/* Compare S1 and S2, both interpreted as appropriate to the
|
||||
LC_COLLATE category of the given locale. */
|
||||
extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2,
|
||||
locale_t __loc) __THROW;
|
||||
|
||||
/* Transform S2 into array pointed to by S1 such that if wcscmp is
|
||||
applied to two transformed strings the result is the as applying
|
||||
`wcscoll' to the original strings. */
|
||||
extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
|
||||
size_t __n, locale_t __loc) __THROW;
|
||||
|
||||
/* Duplicate S, returning an identical malloc'd string. */
|
||||
extern wchar_t *wcsdup (const wchar_t *__s) __THROW __attribute_malloc__;
|
||||
#endif
|
||||
|
||||
/* Find the first occurrence of WC in WCS. */
|
||||
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
|
||||
extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc)
|
||||
__THROW __asm ("wcschr") __attribute_pure__;
|
||||
extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
|
||||
__THROW __asm ("wcschr") __attribute_pure__;
|
||||
#else
|
||||
extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
|
||||
__THROW __attribute_pure__;
|
||||
#endif
|
||||
/* Find the last occurrence of WC in WCS. */
|
||||
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
|
||||
extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc)
|
||||
__THROW __asm ("wcsrchr") __attribute_pure__;
|
||||
extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
|
||||
__THROW __asm ("wcsrchr") __attribute_pure__;
|
||||
#else
|
||||
extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
|
||||
__THROW __attribute_pure__;
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* This function is similar to `wcschr'. But it returns a pointer to
|
||||
the closing NUL wide character in case C is not found in S. */
|
||||
extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
|
||||
__THROW __attribute_pure__;
|
||||
#endif
|
||||
|
||||
/* Return the length of the initial segmet of WCS which
|
||||
consists entirely of wide characters not in REJECT. */
|
||||
extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
|
||||
__THROW __attribute_pure__;
|
||||
/* Return the length of the initial segmet of WCS which
|
||||
consists entirely of wide characters in ACCEPT. */
|
||||
extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
|
||||
__THROW __attribute_pure__;
|
||||
/* Find the first occurrence in WCS of any character in ACCEPT. */
|
||||
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
|
||||
extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept)
|
||||
__THROW __asm ("wcspbrk") __attribute_pure__;
|
||||
extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs,
|
||||
const wchar_t *__accept)
|
||||
__THROW __asm ("wcspbrk") __attribute_pure__;
|
||||
#else
|
||||
extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept)
|
||||
__THROW __attribute_pure__;
|
||||
#endif
|
||||
/* Find the first occurrence of NEEDLE in HAYSTACK. */
|
||||
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
|
||||
extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle)
|
||||
__THROW __asm ("wcsstr") __attribute_pure__;
|
||||
extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack,
|
||||
const wchar_t *__needle)
|
||||
__THROW __asm ("wcsstr") __attribute_pure__;
|
||||
#else
|
||||
extern wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle)
|
||||
__THROW __attribute_pure__;
|
||||
#endif
|
||||
|
||||
/* Divide WCS into tokens separated by characters in DELIM. */
|
||||
extern wchar_t *wcstok (wchar_t *__restrict __s,
|
||||
const wchar_t *__restrict __delim,
|
||||
wchar_t **__restrict __ptr) __THROW;
|
||||
|
||||
/* Return the number of wide characters in S. */
|
||||
extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
|
||||
|
||||
#ifdef __USE_XOPEN
|
||||
/* Another name for `wcsstr' from XPG4. */
|
||||
# ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
|
||||
extern "C++" wchar_t *wcswcs (wchar_t *__haystack, const wchar_t *__needle)
|
||||
__THROW __asm ("wcswcs") __attribute_pure__;
|
||||
extern "C++" const wchar_t *wcswcs (const wchar_t *__haystack,
|
||||
const wchar_t *__needle)
|
||||
__THROW __asm ("wcswcs") __attribute_pure__;
|
||||
# else
|
||||
extern wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle)
|
||||
__THROW __attribute_pure__;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Return the number of wide characters in S, but at most MAXLEN. */
|
||||
extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
|
||||
__THROW __attribute_pure__;
|
||||
#endif
|
||||
|
||||
|
||||
/* Search N wide characters of S for C. */
|
||||
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
|
||||
extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n)
|
||||
__THROW __asm ("wmemchr") __attribute_pure__;
|
||||
extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c,
|
||||
size_t __n)
|
||||
__THROW __asm ("wmemchr") __attribute_pure__;
|
||||
#else
|
||||
extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
|
||||
__THROW __attribute_pure__;
|
||||
#endif
|
||||
|
||||
/* Compare N wide characters of S1 and S2. */
|
||||
extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
|
||||
__THROW __attribute_pure__;
|
||||
|
||||
/* Copy N wide characters of SRC to DEST. */
|
||||
extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
|
||||
const wchar_t *__restrict __s2, size_t __n) __THROW;
|
||||
|
||||
/* Copy N wide characters of SRC to DEST, guaranteeing
|
||||
correct behavior for overlapping strings. */
|
||||
extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
|
||||
__THROW;
|
||||
|
||||
/* Set N wide characters of S to C. */
|
||||
extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Copy N wide characters of SRC to DEST and return pointer to following
|
||||
wide character. */
|
||||
extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
|
||||
const wchar_t *__restrict __s2, size_t __n)
|
||||
__THROW;
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine whether C constitutes a valid (one-byte) multibyte
|
||||
character. */
|
||||
extern wint_t btowc (int __c) __THROW;
|
||||
|
||||
/* Determine whether C corresponds to a member of the extended
|
||||
character set whose multibyte representation is a single byte. */
|
||||
extern int wctob (wint_t __c) __THROW;
|
||||
|
||||
/* Determine whether PS points to an object representing the initial
|
||||
state. */
|
||||
extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__;
|
||||
|
||||
/* Write wide character representation of multibyte character pointed
|
||||
to by S to PWC. */
|
||||
extern size_t mbrtowc (wchar_t *__restrict __pwc,
|
||||
const char *__restrict __s, size_t __n,
|
||||
mbstate_t *__restrict __p) __THROW;
|
||||
|
||||
/* Write multibyte representation of wide character WC to S. */
|
||||
extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
|
||||
mbstate_t *__restrict __ps) __THROW;
|
||||
|
||||
/* Return number of bytes in multibyte character pointed to by S. */
|
||||
extern size_t __mbrlen (const char *__restrict __s, size_t __n,
|
||||
mbstate_t *__restrict __ps) __THROW;
|
||||
extern size_t mbrlen (const char *__restrict __s, size_t __n,
|
||||
mbstate_t *__restrict __ps) __THROW;
|
||||
|
||||
#ifdef __USE_EXTERN_INLINES
|
||||
/* Define inline function as optimization. */
|
||||
|
||||
/* We can use the BTOWC and WCTOB optimizations since we know that all
|
||||
locales must use ASCII encoding for the values in the ASCII range
|
||||
and because the wchar_t encoding is always ISO 10646. */
|
||||
extern wint_t __btowc_alias (int __c) __asm ("btowc");
|
||||
__extern_inline wint_t
|
||||
__NTH (btowc (int __c))
|
||||
{ return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
|
||||
? (wint_t) __c : __btowc_alias (__c)); }
|
||||
|
||||
extern int __wctob_alias (wint_t __c) __asm ("wctob");
|
||||
__extern_inline int
|
||||
__NTH (wctob (wint_t __wc))
|
||||
{ return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
|
||||
? (int) __wc : __wctob_alias (__wc)); }
|
||||
|
||||
__extern_inline size_t
|
||||
__NTH (mbrlen (const char *__restrict __s, size_t __n,
|
||||
mbstate_t *__restrict __ps))
|
||||
{ return (__ps != NULL
|
||||
? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
|
||||
#endif
|
||||
|
||||
/* Write wide character representation of multibyte character string
|
||||
SRC to DST. */
|
||||
extern size_t mbsrtowcs (wchar_t *__restrict __dst,
|
||||
const char **__restrict __src, size_t __len,
|
||||
mbstate_t *__restrict __ps) __THROW;
|
||||
|
||||
/* Write multibyte character representation of wide character string
|
||||
SRC to DST. */
|
||||
extern size_t wcsrtombs (char *__restrict __dst,
|
||||
const wchar_t **__restrict __src, size_t __len,
|
||||
mbstate_t *__restrict __ps) __THROW;
|
||||
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Write wide character representation of at most NMC bytes of the
|
||||
multibyte character string SRC to DST. */
|
||||
extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
|
||||
const char **__restrict __src, size_t __nmc,
|
||||
size_t __len, mbstate_t *__restrict __ps) __THROW;
|
||||
|
||||
/* Write multibyte character representation of at most NWC characters
|
||||
from the wide character string SRC to DST. */
|
||||
extern size_t wcsnrtombs (char *__restrict __dst,
|
||||
const wchar_t **__restrict __src,
|
||||
size_t __nwc, size_t __len,
|
||||
mbstate_t *__restrict __ps) __THROW;
|
||||
#endif /* use POSIX 2008 */
|
||||
|
||||
|
||||
/* The following functions are extensions found in X/Open CAE. */
|
||||
#ifdef __USE_XOPEN
|
||||
/* Determine number of column positions required for C. */
|
||||
extern int wcwidth (wchar_t __c) __THROW;
|
||||
|
||||
/* Determine number of column positions required for first N wide
|
||||
characters (or fewer if S ends before this) in S. */
|
||||
extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
|
||||
#endif /* Use X/Open. */
|
||||
|
||||
|
||||
/* Convert initial portion of the wide string NPTR to `double'
|
||||
representation. */
|
||||
extern double wcstod (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
|
||||
#ifdef __USE_ISOC99
|
||||
/* Likewise for `float' and `long double' sizes of floating-point numbers. */
|
||||
extern float wcstof (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
extern long double wcstold (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
#endif /* C99 */
|
||||
|
||||
/* Likewise for `_FloatN' and `_FloatNx' when support is enabled. */
|
||||
|
||||
#if __HAVE_FLOAT16 && defined __USE_GNU
|
||||
extern _Float16 wcstof16 (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
#endif
|
||||
|
||||
#if __HAVE_FLOAT32 && defined __USE_GNU
|
||||
extern _Float32 wcstof32 (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
#endif
|
||||
|
||||
#if __HAVE_FLOAT64 && defined __USE_GNU
|
||||
extern _Float64 wcstof64 (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
#endif
|
||||
|
||||
#if __HAVE_FLOAT128 && defined __USE_GNU
|
||||
extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
#endif
|
||||
|
||||
#if __HAVE_FLOAT32X && defined __USE_GNU
|
||||
extern _Float32x wcstof32x (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
#endif
|
||||
|
||||
#if __HAVE_FLOAT64X && defined __USE_GNU
|
||||
extern _Float64x wcstof64x (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
#endif
|
||||
|
||||
#if __HAVE_FLOAT128X && defined __USE_GNU
|
||||
extern _Float128x wcstof128x (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr) __THROW;
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert initial portion of wide string NPTR to `long int'
|
||||
representation. */
|
||||
extern long int wcstol (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr, int __base) __THROW;
|
||||
|
||||
/* Convert initial portion of wide string NPTR to `unsigned long int'
|
||||
representation. */
|
||||
extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr, int __base)
|
||||
__THROW;
|
||||
|
||||
#ifdef __USE_ISOC99
|
||||
/* Convert initial portion of wide string NPTR to `long long int'
|
||||
representation. */
|
||||
__extension__
|
||||
extern long long int wcstoll (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr, int __base)
|
||||
__THROW;
|
||||
|
||||
/* Convert initial portion of wide string NPTR to `unsigned long long int'
|
||||
representation. */
|
||||
__extension__
|
||||
extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
int __base) __THROW;
|
||||
#endif /* ISO C99. */
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Convert initial portion of wide string NPTR to `long long int'
|
||||
representation. */
|
||||
__extension__
|
||||
extern long long int wcstoq (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr, int __base)
|
||||
__THROW;
|
||||
|
||||
/* Convert initial portion of wide string NPTR to `unsigned long long int'
|
||||
representation. */
|
||||
__extension__
|
||||
extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
int __base) __THROW;
|
||||
#endif /* Use GNU. */
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Parallel versions of the functions above which take the locale to
|
||||
use as an additional parameter. These are GNU extensions inspired
|
||||
by the POSIX.1-2008 extended locale API. */
|
||||
extern long int wcstol_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr, int __base,
|
||||
locale_t __loc) __THROW;
|
||||
|
||||
extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
int __base, locale_t __loc) __THROW;
|
||||
|
||||
__extension__
|
||||
extern long long int wcstoll_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
int __base, locale_t __loc) __THROW;
|
||||
|
||||
__extension__
|
||||
extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
int __base, locale_t __loc)
|
||||
__THROW;
|
||||
|
||||
extern double wcstod_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr, locale_t __loc)
|
||||
__THROW;
|
||||
|
||||
extern float wcstof_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr, locale_t __loc)
|
||||
__THROW;
|
||||
|
||||
extern long double wcstold_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
locale_t __loc) __THROW;
|
||||
|
||||
# if __HAVE_FLOAT16
|
||||
extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
locale_t __loc) __THROW;
|
||||
# endif
|
||||
|
||||
# if __HAVE_FLOAT32
|
||||
extern _Float32 wcstof32_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
locale_t __loc) __THROW;
|
||||
# endif
|
||||
|
||||
# if __HAVE_FLOAT64
|
||||
extern _Float64 wcstof64_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
locale_t __loc) __THROW;
|
||||
# endif
|
||||
|
||||
# if __HAVE_FLOAT128
|
||||
extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
locale_t __loc) __THROW;
|
||||
# endif
|
||||
|
||||
# if __HAVE_FLOAT32X
|
||||
extern _Float32x wcstof32x_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
locale_t __loc) __THROW;
|
||||
# endif
|
||||
|
||||
# if __HAVE_FLOAT64X
|
||||
extern _Float64x wcstof64x_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
locale_t __loc) __THROW;
|
||||
# endif
|
||||
|
||||
# if __HAVE_FLOAT128X
|
||||
extern _Float128x wcstof128x_l (const wchar_t *__restrict __nptr,
|
||||
wchar_t **__restrict __endptr,
|
||||
locale_t __loc) __THROW;
|
||||
# endif
|
||||
#endif /* use GNU */
|
||||
|
||||
|
||||
#ifdef __USE_XOPEN2K8
|
||||
/* Copy SRC to DEST, returning the address of the terminating L'\0' in
|
||||
DEST. */
|
||||
extern wchar_t *wcpcpy (wchar_t *__restrict __dest,
|
||||
const wchar_t *__restrict __src) __THROW;
|
||||
|
||||
/* Copy no more than N characters of SRC to DEST, returning the address of
|
||||
the last character written into DEST. */
|
||||
extern wchar_t *wcpncpy (wchar_t *__restrict __dest,
|
||||
const wchar_t *__restrict __src, size_t __n)
|
||||
__THROW;
|
||||
#endif
|
||||
|
||||
|
||||
/* Wide character I/O functions. */
|
||||
|
||||
#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
|
||||
/* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
|
||||
a wide character string. */
|
||||
extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW;
|
||||
#endif
|
||||
|
||||
#if defined __USE_ISOC95 || defined __USE_UNIX98
|
||||
|
||||
/* Select orientation for stream. */
|
||||
extern int fwide (__FILE *__fp, int __mode) __THROW;
|
||||
|
||||
|
||||
/* Write formatted output to STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fwprintf (__FILE *__restrict __stream,
|
||||
const wchar_t *__restrict __format, ...)
|
||||
/* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
|
||||
/* Write formatted output to stdout.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int wprintf (const wchar_t *__restrict __format, ...)
|
||||
/* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
|
||||
/* Write formatted output of at most N characters to S. */
|
||||
extern int swprintf (wchar_t *__restrict __s, size_t __n,
|
||||
const wchar_t *__restrict __format, ...)
|
||||
__THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
|
||||
|
||||
/* Write formatted output to S from argument list ARG.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int vfwprintf (__FILE *__restrict __s,
|
||||
const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg)
|
||||
/* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
|
||||
/* Write formatted output to stdout from argument list ARG.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int vwprintf (const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg)
|
||||
/* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
|
||||
/* Write formatted output of at most N character to S from argument
|
||||
list ARG. */
|
||||
extern int vswprintf (wchar_t *__restrict __s, size_t __n,
|
||||
const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg)
|
||||
__THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
|
||||
|
||||
|
||||
/* Read formatted input from STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fwscanf (__FILE *__restrict __stream,
|
||||
const wchar_t *__restrict __format, ...)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
|
||||
/* Read formatted input from stdin.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int wscanf (const wchar_t *__restrict __format, ...)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
|
||||
/* Read formatted input from S. */
|
||||
extern int swscanf (const wchar_t *__restrict __s,
|
||||
const wchar_t *__restrict __format, ...)
|
||||
__THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
|
||||
|
||||
# if defined __USE_ISOC99 && !defined __USE_GNU \
|
||||
&& (!defined __LDBL_COMPAT || !defined __REDIRECT) \
|
||||
&& (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
|
||||
# ifdef __REDIRECT
|
||||
/* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
|
||||
GNU extension which conflicts with valid %a followed by letter
|
||||
s, S or [. */
|
||||
extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream,
|
||||
const wchar_t *__restrict __format, ...),
|
||||
__isoc99_fwscanf)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
|
||||
extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...),
|
||||
__isoc99_wscanf)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
|
||||
extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s,
|
||||
const wchar_t *__restrict __format,
|
||||
...), __isoc99_swscanf)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
|
||||
# else
|
||||
extern int __isoc99_fwscanf (__FILE *__restrict __stream,
|
||||
const wchar_t *__restrict __format, ...);
|
||||
extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...);
|
||||
extern int __isoc99_swscanf (const wchar_t *__restrict __s,
|
||||
const wchar_t *__restrict __format, ...)
|
||||
__THROW;
|
||||
# define fwscanf __isoc99_fwscanf
|
||||
# define wscanf __isoc99_wscanf
|
||||
# define swscanf __isoc99_swscanf
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* Use ISO C95, C99 and Unix98. */
|
||||
|
||||
#ifdef __USE_ISOC99
|
||||
/* Read formatted input from S into argument list ARG.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int vfwscanf (__FILE *__restrict __s,
|
||||
const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
|
||||
/* Read formatted input from stdin into argument list ARG.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int vwscanf (const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
|
||||
/* Read formatted input from S into argument list ARG. */
|
||||
extern int vswscanf (const wchar_t *__restrict __s,
|
||||
const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg)
|
||||
__THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
|
||||
|
||||
# if !defined __USE_GNU \
|
||||
&& (!defined __LDBL_COMPAT || !defined __REDIRECT) \
|
||||
&& (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s,
|
||||
const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg), __isoc99_vfwscanf)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
|
||||
extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg), __isoc99_vwscanf)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
|
||||
extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s,
|
||||
const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg), __isoc99_vswscanf)
|
||||
/* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
|
||||
# else
|
||||
extern int __isoc99_vfwscanf (__FILE *__restrict __s,
|
||||
const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg);
|
||||
extern int __isoc99_vwscanf (const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg);
|
||||
extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
|
||||
const wchar_t *__restrict __format,
|
||||
__gnuc_va_list __arg) __THROW;
|
||||
# define vfwscanf __isoc99_vfwscanf
|
||||
# define vwscanf __isoc99_vwscanf
|
||||
# define vswscanf __isoc99_vswscanf
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* Use ISO C99. */
|
||||
|
||||
|
||||
/* Read a character from STREAM.
|
||||
|
||||
These functions are possible cancellation points and therefore not
|
||||
marked with __THROW. */
|
||||
extern wint_t fgetwc (__FILE *__stream);
|
||||
extern wint_t getwc (__FILE *__stream);
|
||||
|
||||
/* Read a character from stdin.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern wint_t getwchar (void);
|
||||
|
||||
|
||||
/* Write a character to STREAM.
|
||||
|
||||
These functions are possible cancellation points and therefore not
|
||||
marked with __THROW. */
|
||||
extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
|
||||
extern wint_t putwc (wchar_t __wc, __FILE *__stream);
|
||||
|
||||
/* Write a character to stdout.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern wint_t putwchar (wchar_t __wc);
|
||||
|
||||
|
||||
/* Get a newline-terminated wide character string of finite length
|
||||
from STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
|
||||
__FILE *__restrict __stream);
|
||||
|
||||
/* Write a string to STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern int fputws (const wchar_t *__restrict __ws,
|
||||
__FILE *__restrict __stream);
|
||||
|
||||
|
||||
/* Push a character back onto the input buffer of STREAM.
|
||||
|
||||
This function is a possible cancellation point and therefore not
|
||||
marked with __THROW. */
|
||||
extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
|
||||
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* These are defined to be equivalent to the `char' functions defined
|
||||
in POSIX.1:1996.
|
||||
|
||||
These functions are not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation they are cancellation points and
|
||||
therefore not marked with __THROW. */
|
||||
extern wint_t getwc_unlocked (__FILE *__stream);
|
||||
extern wint_t getwchar_unlocked (void);
|
||||
|
||||
/* This is the wide character version of a GNU extension.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern wint_t fgetwc_unlocked (__FILE *__stream);
|
||||
|
||||
/* Faster version when locking is not necessary.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
|
||||
|
||||
/* These are defined to be equivalent to the `char' functions defined
|
||||
in POSIX.1:1996.
|
||||
|
||||
These functions are not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation they are cancellation points and
|
||||
therefore not marked with __THROW. */
|
||||
extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream);
|
||||
extern wint_t putwchar_unlocked (wchar_t __wc);
|
||||
|
||||
|
||||
/* This function does the same as `fgetws' but does not lock the stream.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
|
||||
__FILE *__restrict __stream);
|
||||
|
||||
/* This function does the same as `fputws' but does not lock the stream.
|
||||
|
||||
This function is not part of POSIX and therefore no official
|
||||
cancellation point. But due to similarity with an POSIX interface
|
||||
or due to the implementation it is a cancellation point and
|
||||
therefore not marked with __THROW. */
|
||||
extern int fputws_unlocked (const wchar_t *__restrict __ws,
|
||||
__FILE *__restrict __stream);
|
||||
#endif
|
||||
|
||||
|
||||
/* Format TP into S according to FORMAT.
|
||||
Write no more than MAXSIZE wide characters and return the number
|
||||
of wide characters written, or 0 if it would exceed MAXSIZE. */
|
||||
extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
|
||||
const wchar_t *__restrict __format,
|
||||
const struct tm *__restrict __tp) __THROW;
|
||||
|
||||
# ifdef __USE_GNU
|
||||
/* Similar to `wcsftime' but takes the information from
|
||||
the provided locale and not the global locale. */
|
||||
extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
|
||||
const wchar_t *__restrict __format,
|
||||
const struct tm *__restrict __tp,
|
||||
locale_t __loc) __THROW;
|
||||
# endif
|
||||
|
||||
/* Define some macros helping to catch buffer overflows. */
|
||||
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
|
||||
# include <bits/wchar2.h>
|
||||
#endif
|
||||
|
||||
#ifdef __LDBL_COMPAT
|
||||
# include <bits/wchar-ldbl.h>
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* wchar.h */
|
148
contrib/libc-headers/wctype.h
Normal file
148
contrib/libc-headers/wctype.h
Normal file
@ -0,0 +1,148 @@
|
||||
/* Copyright (C) 1996-2018 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/*
|
||||
* ISO C99 Standard: 7.25
|
||||
* Wide character classification and mapping utilities <wctype.h>
|
||||
*/
|
||||
|
||||
#ifndef _WCTYPE_H
|
||||
#define _WCTYPE_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <bits/types.h>
|
||||
#include <bits/types/wint_t.h>
|
||||
|
||||
/* Constant expression of type `wint_t' whose value does not correspond
|
||||
to any member of the extended character set. */
|
||||
#ifndef WEOF
|
||||
# define WEOF (0xffffffffu)
|
||||
#endif
|
||||
|
||||
/* Some definitions from this header also appear in <wchar.h> in
|
||||
Unix98 mode. */
|
||||
#include <bits/wctype-wchar.h>
|
||||
|
||||
/*
|
||||
* Extensible wide-character mapping functions: 7.15.3.2.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Scalar type that can hold values which represent locale-specific
|
||||
character mappings. */
|
||||
typedef const __int32_t *wctrans_t;
|
||||
|
||||
/* Construct value that describes a mapping between wide characters
|
||||
identified by the string argument PROPERTY. */
|
||||
extern wctrans_t wctrans (const char *__property) __THROW;
|
||||
|
||||
/* Map the wide character WC using the mapping described by DESC. */
|
||||
extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
|
||||
|
||||
# ifdef __USE_XOPEN2K8
|
||||
/* POSIX.1-2008 extended locale interface (see locale.h). */
|
||||
# include <bits/types/locale_t.h>
|
||||
|
||||
/* Test for any wide character for which `iswalpha' or `iswdigit' is
|
||||
true. */
|
||||
extern int iswalnum_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any wide character for which `iswupper' or 'iswlower' is
|
||||
true, or any wide character that is one of a locale-specific set of
|
||||
wide-characters for which none of `iswcntrl', `iswdigit',
|
||||
`iswpunct', or `iswspace' is true. */
|
||||
extern int iswalpha_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any control wide character. */
|
||||
extern int iswcntrl_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any wide character that corresponds to a decimal-digit
|
||||
character. */
|
||||
extern int iswdigit_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any wide character for which `iswprint' is true and
|
||||
`iswspace' is false. */
|
||||
extern int iswgraph_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any wide character that corresponds to a lowercase letter
|
||||
or is one of a locale-specific set of wide characters for which
|
||||
none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
|
||||
extern int iswlower_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any printing wide character. */
|
||||
extern int iswprint_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any printing wide character that is one of a
|
||||
locale-specific et of wide characters for which neither `iswspace'
|
||||
nor `iswalnum' is true. */
|
||||
extern int iswpunct_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any wide character that corresponds to a locale-specific
|
||||
set of wide characters for which none of `iswalnum', `iswgraph', or
|
||||
`iswpunct' is true. */
|
||||
extern int iswspace_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any wide character that corresponds to an uppercase letter
|
||||
or is one of a locale-specific set of wide character for which none
|
||||
of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
|
||||
extern int iswupper_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any wide character that corresponds to a hexadecimal-digit
|
||||
character equivalent to that performed be the functions described
|
||||
in the previous subclause. */
|
||||
extern int iswxdigit_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Test for any wide character that corresponds to a standard blank
|
||||
wide character or a locale-specific set of wide characters for
|
||||
which `iswalnum' is false. */
|
||||
extern int iswblank_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Construct value that describes a class of wide characters identified
|
||||
by the string argument PROPERTY. */
|
||||
extern wctype_t wctype_l (const char *__property, locale_t __locale)
|
||||
__THROW;
|
||||
|
||||
/* Determine whether the wide-character WC has the property described by
|
||||
DESC. */
|
||||
extern int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale)
|
||||
__THROW;
|
||||
|
||||
/*
|
||||
* Wide-character case-mapping functions.
|
||||
*/
|
||||
|
||||
/* Converts an uppercase letter to the corresponding lowercase letter. */
|
||||
extern wint_t towlower_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Converts an lowercase letter to the corresponding uppercase letter. */
|
||||
extern wint_t towupper_l (wint_t __wc, locale_t __locale) __THROW;
|
||||
|
||||
/* Construct value that describes a mapping between wide characters
|
||||
identified by the string argument PROPERTY. */
|
||||
extern wctrans_t wctrans_l (const char *__property, locale_t __locale)
|
||||
__THROW;
|
||||
|
||||
/* Map the wide character WC using the mapping described by DESC. */
|
||||
extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
|
||||
locale_t __locale) __THROW;
|
||||
|
||||
# endif /* Use POSIX 2008. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* wctype.h */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user