13.4. Data Definitions for libc

This section defines global identifiers and their values that are associated with interfaces contained in libc. These definitions are organized into groups that correspond to system headers. This convention is used as a convenience for the reader, and does not imply the existence of these headers, or their content. Where an interface is defined as requiring a particular system header file all of the data definitions for that system header file presented here shall be in effect.

This section gives data definitions to promote binary application portability, not to repeat source interface definitions available elsewhere. System providers and application developers should use this ABI to supplement - not to replace - source interface definition specifications.

This specification uses the ISO C (1999) C Language as the reference programming language, and data definitions are specified in ISO C format. The C language is used here as a convenient notation. Using a C language description of these data objects does not preclude their use by other programming languages.

13.4.1. arpa/inet.h

extern uint32_t htonl(uint32_t);
extern uint16_t htons(uint16_t);
extern in_addr_t inet_addr(const char *__cp);
extern int inet_aton(const char *__cp, struct in_addr *__inp);
extern char *inet_ntoa(struct in_addr __in);
extern const char *inet_ntop(int __af, const void *__cp, char *__buf,
			     socklen_t __len);
extern int inet_pton(int __af, const char *__cp, void *__buf);
extern uint32_t ntohl(uint32_t);
extern uint16_t ntohs(uint16_t);

13.4.2. assert.h

#ifdef NDEBUG
#define assert(expr) ((void)0)
#define assert(expr)	((void) ((expr) ? 0 : (__assert_fail (#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__), 0)))

extern void __assert_fail(const char *__assertion, const char *__file,
			  unsigned int __line, const char *__function);

13.4.3. cpio.h

#define C_IXOTH	000001
#define C_IWOTH	000002
#define C_IROTH	000004
#define C_IXGRP	000010
#define C_IWGRP	000020
#define C_IRGRP	000040
#define C_IXUSR	000100
#define C_IWUSR	000200
#define C_IRUSR	000400
#define C_ISVTX	001000
#define C_ISGID	002000
#define C_ISUID	004000
#define C_ISFIFO	010000
#define C_ISREG	0100000
#define C_ISCTG	0110000
#define C_ISLNK	0120000
#define C_ISSOCK	0140000
#define C_ISCHR	020000
#define C_ISDIR	040000
#define C_ISBLK	060000
#define MAGIC	"070707"

13.4.4. ctype.h

extern const unsigned short **__ctype_b_loc(void);
extern const int32_t **__ctype_tolower_loc(void);
extern const int32_t **__ctype_toupper_loc(void);
extern int _tolower(int);
extern int _toupper(int);
extern int isalnum(int);
extern int isalpha(int);
extern int isascii(int __c);
extern int isblank(int);
extern int iscntrl(int);
extern int isdigit(int);
extern int isgraph(int);
extern int islower(int);
extern int isprint(int);
extern int ispunct(int);
extern int isspace(int);
extern int isupper(int);
extern int isxdigit(int);
extern int toascii(int __c);
extern int tolower(int __c);
extern int toupper(int __c);

13.4.5. dirent.h

typedef struct __dirstream DIR;

struct dirent {
    long int d_ino;
    off_t d_off;
    unsigned short d_reclen;
    unsigned char d_type;
    char d_name[256];
struct dirent64 {
    uint64_t d_ino;
    int64_t d_off;
    unsigned short d_reclen;
    unsigned char d_type;
    char d_name[256];
extern int alphasort(const struct dirent **__e1,
		     const struct dirent **__e2);
extern int alphasort64(const struct dirent64 **__e1,
		       const struct dirent64 **__e2);
extern int closedir(DIR * __dirp);
extern int dirfd(DIR * __dirp);
extern DIR *fdopendir(int __fd);
extern DIR *opendir(const char *__name);
extern struct dirent *readdir(DIR * __dirp);
extern struct dirent64 *readdir64(DIR * __dirp);
extern int readdir64_r(DIR * __dirp, struct dirent64 *__entry,
		       struct dirent64 **__result);
extern int readdir_r(DIR * __dirp, struct dirent *__entry,
		     struct dirent **__result);
extern void rewinddir(DIR * __dirp);
extern int scandir(const char *__dir, struct dirent ***__namelist,
		   int (*__selector) (const struct dirent *),
		   int (*__cmp) (const struct dirent *,
				 const struct dirent *));
extern int scandir64(const char *__dir, struct dirent64 ***__namelist,
		     int (*__selector) (const struct dirent64 *),
		     int (*__cmp) (const struct dirent64 *,
				   const struct dirent64 *));
extern void seekdir(DIR * __dirp, long int __pos);
extern long int telldir(DIR * __dirp);

13.4.6. endian.h

#define __LITTLE_ENDIAN	1234
#define __BIG_ENDIAN	4321

13.4.7. err.h

extern void err(int __status, const char *__format, ...);
extern void error(int, int, const char *, ...);
extern void errx(int __status, const char *__format, ...);
extern void warn(const char *__format, ...);
extern void warnx(const char *__format, ...);

13.4.8. errno.h

#define errno	(*__errno_location())

#define EPERM	1		/* Operation not permitted */
#define ECHILD	10		/* No child processes */
#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 EAGAIN	11		/* Try again */
#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 NFS 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 ENOMEM	12		/* Out of memory */
#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 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 ENOENT	2		/* No such file or directory */
#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 ESRCH	3		/* No such process */
#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 */
#define EDEADLK	35		/* Resource deadlock would occur */
#define ENAMETOOLONG	36	/* File name too long */
#define ENOLCK	37		/* No record locks available */
#define ENOSYS	38		/* Function not implemented */
#define ENOTEMPTY	39	/* Directory not empty */
#define EINTR	4		/* Interrupted system call */
#define ELOOP	40		/* Too many symbolic links encountered */
#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 EIO	5		/* I/O error */
#define ENOANO	55		/* No anode */
#define EBADRQC	56		/* Invalid request code */
#define EBADSLT	57		/* Invalid slot */
#define EBFONT	59		/* Bad font file format */
#define ENXIO	6		/* No such device or address */
#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 E2BIG	7		/* Argument list too long */
#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 ENOEXEC	8		/* Exec format error */
#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 EBADF	9		/* Bad file number */
#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 EWOULDBLOCK	EAGAIN	/* Operation would block */

extern int *__errno_location(void);

13.4.9. fcntl.h

#define O_RDONLY	00
#define O_ACCMODE	0003
#define O_WRONLY	01
#define O_CREAT	0100
#define O_TRUNC	01000
#define O_DSYNC	010000
#define O_RSYNC	010000
#define O_SYNC	010000
#define O_RDWR	02
#define O_EXCL	0200
#define O_APPEND	02000
#define O_ASYNC	020000
#define O_NOCTTY	0400
#define O_NDELAY	04000
#define O_NONBLOCK	04000
#define FD_CLOEXEC	1

struct flock {
    short l_type;
    short l_whence;
    off_t l_start;
    off_t l_len;
    pid_t l_pid;
struct flock64 {
    short l_type;
    short l_whence;
    loff_t l_start;
    loff_t l_len;
    pid_t l_pid;

#define AT_FDCWD	-100
#define AT_EACCESS	0x200
#define AT_REMOVEDIR	0x200
#define AT_SYMLINK_FOLLOW	0x400

#define F_DUPFD	0
#define F_RDLCK	0
#define F_GETFD	1
#define F_WRLCK	1
#define F_SETSIG	10
#define F_GETSIG	11
#define F_SETFD	2
#define F_UNLCK	2
#define F_GETFL	3
#define F_SETFL	4
#define F_GETLK	5
#define F_SETLK	6
#define F_SETLKW	7
#define F_SETOWN	8
#define F_GETOWN	9

extern int creat(const char *__file, mode_t __mode);
extern int creat64(const char *__file, mode_t __mode);
extern int fcntl(int __fd, int __cmd, ...);
extern int open(const char *__file, int __oflag, ...);
extern int open64(const char *__file, int __oflag, ...);
extern int openat(int __fd, const char *__file, int __oflag, ...);
extern int openat64(int __fd, const char *__file, int __oflag, ...);
extern int posix_fadvise(int __fd, off_t __offset, off_t __len,
			 int __advise);
extern int posix_fadvise64(int __fd, off64_t __offset, off64_t __len,
			   int __advise);
extern int posix_fallocate(int __fd, off_t __offset, off_t __len);
extern int posix_fallocate64(int __fd, off64_t __offset, off64_t __len);

13.4.10. fmtmsg.h

#define MM_HARD	1		/* Source of the condition is hardware. */
#define MM_NRECOV	128	/* Non-recoverable error. */
#define MM_UTIL	16		/* Condition detected by utility. */
#define MM_SOFT	2		/* Source of the condition is software. */
#define MM_PRINT	256	/* Display message in standard error. */
#define MM_OPSYS	32	/* Condition detected by operating system. */
#define MM_FIRM	4		/* Source of the condition is firmware. */
#define MM_CONSOLE	512	/* Display message on system console. */
#define MM_RECOVER	64	/* Recoverable error. */
#define MM_APPL	8		/* Condition detected by application. */

#define MM_NOSEV	0	/* No severity level provided for the message. */
#define MM_HALT	1		/* Error causing application to halt. */
#define MM_ERROR	2	/* Application has encountered a non-fatal fault. */
#define MM_WARNING	3	/* Application has detected unusual non-error condition. */
#define MM_INFO	4		/* Informative message. */

#define MM_NULLACT	((char *) 0)
#define MM_NULLLBL	((char *) 0)
#define MM_NULLTAG	((char *) 0)
#define MM_NULLTXT	((char *) 0)
#define MM_NULLMC	((long int) 0)
#define MM_NULLSEV	0

#define MM_NOTOK	-1	/* The function failed completely. */
#define MM_OK	0		/* The function succeeded. */
#define MM_NOMSG	1	/* The function was unable to generate a message on standard error, but otherwise succeeded. */
#define MM_NOCON	4	/* The function was unable to generate a console message, but otherwise succeeded. */

extern int fmtmsg(long int __classification, const char *__label,
		  int __severity, const char *__text, const char *__action,
		  const char *__tag);

13.4.11. fnmatch.h

#define FNM_PATHNAME	(1<<0)
#define FNM_NOESCAPE	(1<<1)
#define FNM_PERIOD	(1<<2)
#define FNM_NOMATCH	1

extern int fnmatch(const char *__pattern, const char *__name, int __flags);

13.4.12. ftw.h

#define FTW_D	FTW_D
#define FTW_DP	FTW_DP
#define FTW_F	FTW_F
#define FTW_NS	FTW_NS
#define FTW_SL	FTW_SL

enum {

enum {
    FTW_PHYS = 1,
    FTW_MOUNT = 2,
    FTW_CHDIR = 4,
    FTW_DEPTH = 8

struct FTW {
    int base;
    int level;

typedef int (*__ftw_func_t) (const char *__filename,
			     const struct stat * __status, int __flag);
typedef int (*__ftw64_func_t) (const char *__filename,
			       const struct stat64 * __status, int __flag);
typedef int (*__nftw_func_t) (const char *__filename,
			      const struct stat * __status, int __flag,
			      struct FTW * __info);
typedef int (*__nftw64_func_t) (const char *__filename,
				const struct stat64 * __status, int __flag,
				struct FTW * __info);
extern int ftw(const char *__dir, __ftw_func_t __func, int __descriptors);
extern int ftw64(const char *__dir, __ftw64_func_t __func,
		 int __descriptors);
extern int nftw(const char *__dir, __nftw_func_t __func, int __descriptors,
		int __flag);
extern int nftw64(const char *__dir, __nftw64_func_t __func,
		  int __descriptors, int __flag);

13.4.13. getopt.h

#define no_argument	0
#define required_argument	1
#define optional_argument	2

struct option {
    const char *name;
    int has_arg;
    int *flag;
    int val;
extern int getopt_long(int ___argc, char *const ___argv[],
		       const char *__shortopts,
		       const struct option *__longopts, int *__longind);
extern int getopt_long_only(int ___argc, char *const ___argv[],
			    const char *__shortopts,
			    const struct option *__longopts,
			    int *__longind);

13.4.14. glob.h

#define GLOB_ERR	(1<<0)
#define GLOB_MARK	(1<<1)
#define GLOB_BRACE	(1<<10)
#define GLOB_NOMAGIC	(1<<11)
#define GLOB_TILDE	(1<<12)
#define GLOB_ONLYDIR	(1<<13)
#define GLOB_TILDE_CHECK	(1<<14)
#define GLOB_NOSORT	(1<<2)
#define GLOB_DOOFFS	(1<<3)
#define GLOB_NOCHECK	(1<<4)
#define GLOB_APPEND	(1<<5)
#define GLOB_NOESCAPE	(1<<6)
#define GLOB_PERIOD	(1<<7)
#define GLOB_MAGCHAR	(1<<8)
#define GLOB_ALTDIRFUNC	(1<<9)

#define GLOB_NOSPACE	1
#define GLOB_ABORTED	2
#define GLOB_NOMATCH	3
#define GLOB_NOSYS	4

typedef struct {
    size_t gl_pathc;
    char **gl_pathv;
    size_t gl_offs;
    int gl_flags;
    void (*gl_closedir) (void *);
    struct dirent *(*gl_readdir) (void *);
    void *(*gl_opendir) (const char *);
    int (*gl_lstat) (const char *, struct stat *);
    int (*gl_stat) (const char *, struct stat *);
} glob_t;

typedef struct {
    size_t gl_pathc;
    char **gl_pathv;
    size_t gl_offs;
    int gl_flags;
    void (*gl_closedir) (void *);
    struct dirent64 *(*gl_readdir) (void *);
    void *(*gl_opendir) (const char *);
    int (*gl_lstat) (const char *, struct stat *);
    int (*gl_stat) (const char *, struct stat *);
} glob64_t;
extern int glob(const char *__pattern, int __flags,
		int (*__errfunc) (const char *, int), glob_t * __pglob);
extern int glob64(const char *__pattern, int __flags,
		  int (*__errfunc) (const char *, int),
		  glob64_t * __pglob);
extern void globfree(glob_t * __pglob);
extern void globfree64(glob64_t * __pglob);

13.4.15. grp.h

struct group {
    char *gr_name;
    char *gr_passwd;
    gid_t gr_gid;
    char **gr_mem;

extern void endgrent(void);
extern struct group *getgrent(void);
extern int getgrent_r(struct group *__resultbuf, char *__buffer,
		      size_t __buflen, struct group **__result);
extern struct group *getgrgid(gid_t __gid);
extern int getgrgid_r(gid_t __gid, struct group *__resultbuf,
		      char *__buffer, size_t __buflen,
		      struct group **__result);
extern struct group *getgrnam(const char *__name);
extern int getgrnam_r(const char *__name, struct group *__resultbuf,
		      char *__buffer, size_t __buflen,
		      struct group **__result);
extern int getgrouplist(const char *__user, gid_t __group,
			gid_t * __groups, int *__ngroups);
extern int initgroups(const char *__user, gid_t __group);
extern void setgrent(void);
extern int setgroups(size_t __n, const gid_t * __groups);

13.4.16. iconv.h

typedef void *iconv_t;
extern size_t iconv(iconv_t __cd, char **__inbuf, size_t * __inbytesleft,
		    char **__outbuf, size_t * __outbytesleft);
extern int iconv_close(iconv_t __cd);
extern iconv_t iconv_open(const char *__tocode, const char *__fromcode);

13.4.17. inttypes.h

typedef lldiv_t imaxdiv_t;

#define __PDP_ENDIAN	3412

extern intmax_t imaxabs(intmax_t __n);
extern imaxdiv_t imaxdiv(intmax_t __numer, intmax_t __denom);
extern intmax_t strtoimax(const char *__nptr, char **__endptr, int __base);
extern uintmax_t strtoumax(const char *__nptr, char **__endptr,
			   int __base);
extern intmax_t wcstoimax(const wchar_t * __nptr, wchar_t * *__endptr,
			  int __base);
extern uintmax_t wcstoumax(const wchar_t * __nptr, wchar_t * *__endptr,
			   int __base);

13.4.18. langinfo.h

#define ABDAY_1	0x20000		/* Sun. */
#define ABDAY_2	0x20001
#define ABDAY_3	0x20002
#define ABDAY_4	0x20003
#define ABDAY_5	0x20004
#define ABDAY_6	0x20005
#define ABDAY_7	0x20006

#define DAY_1	0x20007
#define DAY_2	0x20008
#define DAY_3	0x20009
#define DAY_4	0x2000A
#define DAY_5	0x2000B
#define DAY_6	0x2000C
#define DAY_7	0x2000D

#define ABMON_1	0x2000E
#define ABMON_2	0x2000F
#define ABMON_3	0x20010
#define ABMON_4	0x20011
#define ABMON_5	0x20012
#define ABMON_6	0x20013
#define ABMON_7	0x20014
#define ABMON_8	0x20015
#define ABMON_9	0x20016
#define ABMON_10	0x20017
#define ABMON_11	0x20018
#define ABMON_12	0x20019

#define MON_1	0x2001A
#define MON_2	0x2001B
#define MON_3	0x2001C
#define MON_4	0x2001D
#define MON_5	0x2001E
#define MON_6	0x2001F
#define MON_7	0x20020
#define MON_8	0x20021
#define MON_9	0x20022
#define MON_10	0x20023
#define MON_11	0x20024
#define MON_12	0x20025

#define AM_STR	0x20026
#define PM_STR	0x20027

#define D_T_FMT	0x20028
#define D_FMT	0x20029
#define T_FMT	0x2002A
#define T_FMT_AMPM	0x2002B

#define ERA	0x2002C
#define ERA_D_FMT	0x2002E
#define ALT_DIGITS	0x2002F
#define ERA_D_T_FMT	0x20030
#define ERA_T_FMT	0x20031

#define CODESET	14

#define CRNCYSTR	0x4000F

#define RADIXCHAR	0x10000
#define THOUSEP	0x10001
#define YESEXPR	0x50000
#define NOEXPR	0x50001
#define YESSTR	0x50002
#define NOSTR	0x50003

extern char *nl_langinfo(nl_item __item);

13.4.19. libgen.h

#define basename __xpg_basename

extern char *__xpg_basename(char *__path);
extern char *dirname(char *__path);

13.4.20. libintl.h

extern char *bind_textdomain_codeset(const char *__domainname,
				     const char *__codeset);
extern char *bindtextdomain(const char *__domainname,
			    const char *__dirname);
extern char *dcgettext(const char *__domainname, const char *__msgid,
		       int __category);
extern char *dcngettext(const char *__domainname, const char *__msgid1,
			const char *__msgid2, unsigned long int __n,
			int __category);
extern char *dgettext(const char *__domainname, const char *__msgid);
extern char *dngettext(const char *__domainname, const char *__msgid1,
		       const char *__msgid2, unsigned long int __n);
extern char *gettext(const char *__msgid);
extern char *ngettext(const char *__msgid1, const char *__msgid2,
		      unsigned long int __n);
extern char *textdomain(const char *__domainname);

13.4.21. limits.h

#define _POSIX_AIO_MAX	1
#define _POSIX_QLIMIT	1
#define _POSIX2_BC_STRING_MAX	1000
#define _POSIX_NAME_MAX	14
#define _POSIX_UIO_MAXIOV	16
#define ULLONG_MAX	18446744073709551615ULL
#define _POSIX_OPEN_MAX	20
#define _POSIX_CLOCKRES_MIN	20000000
#define LINE_MAX	2048
#define _POSIX2_BC_DIM_MAX	2048
#define _POSIX2_LINE_MAX	2048
#define _POSIX_CHILD_MAX	25
#define COLL_WEIGHTS_MAX	255
#define _POSIX2_RE_DUP_MAX	255
#define _POSIX_HOST_NAME_MAX	255
#define _POSIX_MAX_CANON	255
#define _POSIX_MAX_INPUT	255
#define _POSIX_RE_DUP_MAX	255
#define _POSIX_SYMLINK_MAX	255
#define _POSIX_PATH_MAX	256
#define _POSIX_SEM_NSEMS_MAX	256
#define NGROUPS_MAX	32
#define _POSIX2_EXPR_NEST_MAX	32
#define _POSIX_MQ_PRIO_MAX	32
#define _POSIX_TIMER_MAX	32
#define _POSIX_SEM_VALUE_MAX	32767
#define _POSIX_SSIZE_MAX	32767
#define PATH_MAX	4096
#define _POSIX_ARG_MAX	4096
#define _POSIX_PIPE_BUF	512
#define _POSIX_LINK_MAX	8
#define _POSIX_MQ_OPEN_MAX	8
#define _POSIX_RTSIG_MAX	8
#define LLONG_MAX	9223372036854775807LL
#define _POSIX2_BC_BASE_MAX	99
#define _POSIX2_BC_SCALE_MAX	99
#define SSIZE_MAX	LONG_MAX	/* Maximum value of an object of type ssize_t */

#define MB_LEN_MAX	16

#define SCHAR_MIN	(-128)
#define SCHAR_MAX	127
#define UCHAR_MAX	255
#define CHAR_BIT	8

#define SHRT_MIN	(-32768)
#define SHRT_MAX	32767
#define USHRT_MAX	65535

#define INT_MIN	(-INT_MAX-1)
#define INT_MAX	2147483647
#define UINT_MAX	4294967295U

#define LONG_MIN	(-LONG_MAX-1L)

#define PTHREAD_KEYS_MAX	1024

13.4.22. locale.h

struct lconv {
    char *decimal_point;
    char *thousands_sep;
    char *grouping;
    char *int_curr_symbol;
    char *currency_symbol;
    char *mon_decimal_point;
    char *mon_thousands_sep;
    char *mon_grouping;
    char *positive_sign;
    char *negative_sign;
    char int_frac_digits;
    char frac_digits;
    char p_cs_precedes;
    char p_sep_by_space;
    char n_cs_precedes;
    char n_sep_by_space;
    char p_sign_posn;
    char n_sign_posn;
    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;

#define LC_GLOBAL_LOCALE	((locale_t) -1L)
#define LC_CTYPE	0
#define LC_NUMERIC	1
#define LC_TELEPHONE	10
#define LC_TIME	2
#define LC_COLLATE	3
#define LC_MONETARY	4
#define LC_MESSAGES	5
#define LC_ALL	6
#define LC_PAPER	7
#define LC_NAME	8
#define LC_ADDRESS	9

struct __locale_struct {
    struct locale_data *__locales[13];
    const unsigned short *__ctype_b;
    const int *__ctype_tolower;
    const int *__ctype_toupper;
    const char *__names[13];
typedef struct __locale_struct *__locale_t;

typedef struct __locale_struct *locale_t;

#define LC_NAME_MASK	(1 << LC_NAME)
#define LC_PAPER_MASK	(1 << LC_PAPER)
#define LC_TIME_MASK	(1 << LC_TIME)
#define LC_ALL_MASK	\

extern locale_t duplocale(locale_t __dataset);
extern void freelocale(locale_t __dataset);
extern struct lconv *localeconv(void);
extern locale_t newlocale(int __category_mask, const char *__locale,
			  locale_t __base);
extern char *setlocale(int __category, const char *__locale);
extern locale_t uselocale(locale_t __dataset);

13.4.23. monetary.h

extern ssize_t strfmon(char *__s, size_t __maxsize, const char *__format,

13.4.24. net/if.h

#define IF_NAMESIZE	16

#define IFF_UP	0x01		/* Interface is up. */
#define IFF_BROADCAST	0x02	/* Broadcast address valid. */
#define IFF_DEBUG	0x04	/* Turn on debugging. */
#define IFF_LOOPBACK	0x08	/* Is a loopback net. */
#define IFF_POINTOPOINT	0x10	/* Interface is point-to-point link. */
#define IFF_PROMISC	0x100	/* Receive all packets. */
#define IFF_MULTICAST	0x1000	/* Supports multicast. */
#define IFF_NOTRAILERS	0x20	/* Avoid use of trailers. */
#define IFF_RUNNING	0x40	/* Resources allocated. */
#define IFF_NOARP	0x80	/* No address resolution protocol. */

struct if_nameindex {
    unsigned int if_index;	/* 1, 2, ... */
    char *if_name;		/* null terminated name: */

struct ifaddr {
    struct sockaddr ifa_addr;	/* Address of interface. */
    union {
	struct sockaddr ifu_broadaddr;
	struct sockaddr ifu_dstaddr;
    } ifa_ifu;
    void *ifa_ifp;
    void *ifa_next;

#define ifr_name	ifr_ifrn.ifrn_name	/* interface name */
#define ifr_addr	ifr_ifru.ifru_addr	/* address */
#define ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address */
#define ifr_data	ifr_ifru.ifru_data	/* for use by interface */
#define ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-p lnk */
#define ifr_flags	ifr_ifru.ifru_flags	/* flags */
#define ifr_hwaddr	ifr_ifru.ifru_hwaddr	/* interface name */
#define ifr_bandwidth	ifr_ifru.ifru_ivalue	/* link bandwidth */
#define ifr_ifindex	ifr_ifru.ifru_ivalue	/* interface index */
#define ifr_metric	ifr_ifru.ifru_ivalue	/* metric */
#define ifr_qlen	ifr_ifru.ifru_ivalue	/* queue length */
#define ifr_mtu	ifr_ifru.ifru_mtu	/* mtu */
#define ifr_netmask	ifr_ifru.ifru_netmask	/* interface net mask */
#define ifr_slave	ifr_ifru.ifru_slave	/* slave device */

struct ifreq {
    union {
	char ifrn_name[IFNAMSIZ];
    } ifr_ifrn;
    union {
	struct sockaddr ifru_addr;
	struct sockaddr ifru_dstaddr;
	struct sockaddr ifru_broadaddr;
	struct sockaddr ifru_netmask;
	struct sockaddr ifru_hwaddr;
	short ifru_flags;
	int ifru_ivalue;
	int ifru_mtu;
	char ifru_slave[IFNAMSIZ];
	char ifru_newname[IFNAMSIZ];
	caddr_t ifru_data;
	struct ifmap ifru_map;
    } ifr_ifru;

#define ifc_buf	ifc_ifcu.ifcu_buf	/* Buffer address. */
#define ifc_req	ifc_ifcu.ifcu_req	/* Array of structures. */

struct ifconf {
    int ifc_len;
    union {
	caddr_t ifcu_buf;
	struct ifreq *ifcu_req;
    } ifc_ifcu;
extern void if_freenameindex(struct if_nameindex *__ptr);
extern char *if_indextoname(unsigned int __ifindex, char *__ifname);
extern struct if_nameindex *if_nameindex(void);
extern unsigned int if_nametoindex(const char *__ifname);

13.4.25. netdb.h

#define h_errno	(*__h_errno_location ())
#define NETDB_INTERNAL	-1	/* See errno. */
#define NETDB_SUCCESS	0	/* No problem. */
#define HOST_NOT_FOUND	1	/* Authoritative Answer Host not found. */
#define IPPORT_RESERVED	1024
#define NI_MAXHOST	1025
#define TRY_AGAIN	2	/* Non-Authoritative Host not found, or SERVERFAIL. */
#define NO_RECOVERY	3	/* Non recoverable errors, FORMERR, REFUSED, NOTIMP. */
#define NI_MAXSERV	32
#define NO_DATA	4		/* Valid name, no data record of requested type. */
#define h_addr	h_addr_list[0]
#define NO_ADDRESS	NO_DATA	/* No address, look for MX record. */

struct servent {
    char *s_name;
    char **s_aliases;
    int s_port;
    char *s_proto;
struct hostent {
    char *h_name;
    char **h_aliases;
    int h_addrtype;
    int h_length;
    char **h_addr_list;
struct protoent {
    char *p_name;
    char **p_aliases;
    int p_proto;
struct netent {
    char *n_name;
    char **n_aliases;
    int n_addrtype;
    unsigned int n_net;

#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.. */
#define AI_NUMERICSERV	0x0400	/* Don't use name resolution */

struct addrinfo {
    int ai_flags;
    int ai_family;
    int ai_socktype;
    int ai_protocol;
    socklen_t ai_addrlen;
    struct sockaddr *ai_addr;
    char *ai_canonname;
    struct addrinfo *ai_next;

#define NI_DGRAM	16
#define NI_NOFQDN	4
#define NI_NAMEREQD	8

#define EAI_BADFLAGS	-1	/* Invalid value for `ai_flags' field. */
#define EAI_MEMORY	-10	/* Memory allocation failure. */
#define EAI_SYSTEM	-11	/* System error returned in `errno'. */
#define EAI_NONAME	-2	/* NAME or SERVICE is unknown. */
#define EAI_AGAIN	-3	/* Temporary failure in name resolution. */
#define EAI_FAIL	-4	/* Non-recoverable failure in name res. */
#define EAI_NODATA	-5	/* No address associated with NAME. */
#define EAI_FAMILY	-6	/* `ai_family' not supported. */
#define EAI_SOCKTYPE	-7	/* `ai_family' not supported. */
#define EAI_SERVICE	-8	/* SERVICE not supported for `ai_socktype'. */
#define EAI_ADDRFAMILY	-9	/* Address family for NAME not supported. */

extern int *__h_errno_location(void);
extern void endprotoent(void);
extern void endservent(void);
extern void freeaddrinfo(struct addrinfo *__ai);
extern const char *gai_strerror(int __ecode);
extern int getaddrinfo(const char *__name, const char *__service,
		       const struct addrinfo *__req,
		       struct addrinfo **__pai);
extern struct hostent *gethostbyaddr(const void *__addr, socklen_t __len,
				     int __type);
extern int gethostbyaddr_r(const void *__addr, socklen_t __len, int __type,
			   struct hostent *__result_buf, char *__buf,
			   size_t __buflen, struct hostent **__result,
			   int *__h_errnop);
extern struct hostent *gethostbyname(const char *__name);
extern struct hostent *gethostbyname2(const char *__name, int __af);
extern int gethostbyname2_r(const char *__name, int __af,
			    struct hostent *__result_buf, char *__buf,
			    size_t __buflen, struct hostent **__result,
			    int *__h_errnop);
extern int gethostbyname_r(const char *__name,
			   struct hostent *__result_buf, char *__buf,
			   size_t __buflen, struct hostent **__result,
			   int *__h_errnop);
extern struct protoent *getprotobyname(const char *__name);
extern int getprotobyname_r(const char *__name,
			    struct protoent *__result_buf, char *__buf,
			    size_t __buflen, struct protoent **__result);
extern struct protoent *getprotobynumber(int __proto);
extern int getprotobynumber_r(int __proto, struct protoent *__result_buf,
			      char *__buf, size_t __buflen,
			      struct protoent **__result);
extern struct protoent *getprotoent(void);
extern int getprotoent_r(struct protoent *__result_buf, char *__buf,
			 size_t __buflen, struct protoent **__result);
extern struct servent *getservbyname(const char *__name,
				     const char *__proto);
extern int getservbyname_r(const char *__name, const char *__proto,
			   struct servent *__result_buf, char *__buf,
			   size_t __buflen, struct servent **__result);
extern struct servent *getservbyport(int __port, const char *__proto);
extern int getservbyport_r(int __port, const char *__proto,
			   struct servent *__result_buf, char *__buf,
			   size_t __buflen, struct servent **__result);
extern struct servent *getservent(void);
extern int getservent_r(struct servent *__result_buf, char *__buf,
			size_t __buflen, struct servent **__result);
extern void setprotoent(int __stay_open);
extern void setservent(int __stay_open);

13.4.26. netinet/icmp6.h

#define ICMP6_FILTER_WILLBLOCK(type,filterp)	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
#define ICMP6_FILTER_WILLPASS(type,filterp)	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
#define ICMP6_FILTER_SETPASS(type,filterp)	((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))))
#define ICMP6_FILTER_SETBLOCK(type,filterp)	((((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))))
#define ND_OPT_PI_FLAG_RADDR	0x20
#define ND_RA_FLAG_HOME_AGENT	0x20
#define ND_OPT_PI_FLAG_AUTO	0x40
#define ND_RA_FLAG_OTHER	0x40
#define ICMP6_INFOMSG_MASK	0x80
#define ICMP6_RR_FLAGS_TEST	0x80
#define ND_OPT_PI_FLAG_ONLINK	0x80
#define ND_RA_FLAG_MANAGED	0x80
#define ICMP6_FILTER	1
#define RPM_PCO_ADD	1
#define ICMP6_ECHO_REQUEST	128
#define ICMP6_ECHO_REPLY	129
#define ND_ROUTER_ADVERT	134
#define ND_REDIRECT	137
#define RPM_PCO_CHANGE	2
#define ICMP6_PARAM_PROB	4
#define ND_OPT_MTU	5
#define icmp6_id	icmp6_data16[0]
#define icmp6_maxdelay	icmp6_data16[0]
#define icmp6_seq	icmp6_data16[1]
#define icmp6_mtu	icmp6_data32[0]
#define icmp6_pptr	icmp6_data32[0]
#define icmp6_data16	icmp6_dataun.icmp6_un_data16
#define icmp6_data32	icmp6_dataun.icmp6_un_data32
#define icmp6_data8	icmp6_dataun.icmp6_un_data8
#define ICMP6_FILTER_SETPASSALL(filterp)	memset (filterp, 0, sizeof (struct icmp6_filter));
#define ICMP6_FILTER_SETBLOCKALL(filterp)	memset (filterp, 0xFF, sizeof (struct icmp6_filter));
#define mld_cksum	mld_icmp6_hdr.icmp6_cksum
#define mld_code	mld_icmp6_hdr.icmp6_code
#define mld_maxdelay	mld_icmp6_hdr.icmp6_data16[0]
#define mld_reserved	mld_icmp6_hdr.icmp6_data16[1]
#define mld_type	mld_icmp6_hdr.icmp6_type
#define nd_na_cksum	nd_na_hdr.icmp6_cksum
#define nd_na_code	nd_na_hdr.icmp6_code
#define nd_na_flags_reserved	nd_na_hdr.icmp6_data32[0]
#define nd_na_type	nd_na_hdr.icmp6_type
#define nd_ns_cksum	nd_ns_hdr.icmp6_cksum
#define nd_ns_code	nd_ns_hdr.icmp6_code
#define nd_ns_reserved	nd_ns_hdr.icmp6_data32[0]
#define nd_ns_type	nd_ns_hdr.icmp6_type
#define nd_ra_cksum	nd_ra_hdr.icmp6_cksum
#define nd_ra_code	nd_ra_hdr.icmp6_code
#define nd_ra_router_lifetime	nd_ra_hdr.icmp6_data16[1]
#define nd_ra_curhoplimit	nd_ra_hdr.icmp6_data8[0]
#define nd_ra_flags_reserved	nd_ra_hdr.icmp6_data8[1]
#define nd_ra_type	nd_ra_hdr.icmp6_type
#define nd_rd_cksum	nd_rd_hdr.icmp6_cksum
#define nd_rd_code	nd_rd_hdr.icmp6_code
#define nd_rd_reserved	nd_rd_hdr.icmp6_data32[0]
#define nd_rd_type	nd_rd_hdr.icmp6_type
#define nd_rs_cksum	nd_rs_hdr.icmp6_cksum
#define nd_rs_code	nd_rs_hdr.icmp6_code
#define nd_rs_reserved	nd_rs_hdr.icmp6_data32[0]
#define nd_rs_type	nd_rs_hdr.icmp6_type
#define rr_cksum	rr_hdr.icmp6_cksum
#define rr_code	rr_hdr.icmp6_code
#define rr_seqnum	rr_hdr.icmp6_data32[0]
#define rr_type	rr_hdr.icmp6_type

struct icmp6_filter {
    uint32_t icmp6_filt[8];
struct icmp6_hdr {
    uint8_t icmp6_type;
    uint8_t icmp6_code;
    uint16_t icmp6_cksum;
    union {
	uint32_t icmp6_un_data32[1];
	uint16_t icmp6_un_data16[2];
	uint8_t icmp6_un_data8[4];
    } icmp6_dataun;
struct nd_router_solicit {
    struct icmp6_hdr nd_rs_hdr;
struct nd_router_advert {
    struct icmp6_hdr nd_ra_hdr;
    uint32_t nd_ra_reachable;
    uint32_t nd_ra_retransmit;
struct nd_neighbor_solicit {
    struct icmp6_hdr nd_ns_hdr;
    struct in6_addr nd_ns_target;
struct nd_neighbor_advert {
    struct icmp6_hdr nd_na_hdr;
    struct in6_addr nd_na_target;
struct nd_redirect {
    struct icmp6_hdr nd_rd_hdr;
    struct in6_addr nd_rd_target;
    struct in6_addr nd_rd_dst;
struct nd_opt_hdr {
    uint8_t nd_opt_type;
    uint8_t nd_opt_len;
struct nd_opt_prefix_info {
    uint8_t nd_opt_pi_type;
    uint8_t nd_opt_pi_len;
    uint8_t nd_opt_pi_prefix_len;
    uint8_t nd_opt_pi_flags_reserved;
    uint32_t nd_opt_pi_valid_time;
    uint32_t nd_opt_pi_preferred_time;
    uint32_t nd_opt_pi_reserved2;
    struct in6_addr nd_opt_pi_prefix;
struct nd_opt_rd_hdr {
    uint8_t nd_opt_rh_type;
    uint8_t nd_opt_rh_len;
    uint16_t nd_opt_rh_reserved1;
    uint32_t nd_opt_rh_reserved2;
struct nd_opt_mtu {
    uint8_t nd_opt_mtu_type;
    uint8_t nd_opt_mtu_len;
    uint16_t nd_opt_mtu_reserved;
    uint32_t nd_opt_mtu_mtu;
struct mld_hdr {
    struct icmp6_hdr mld_icmp6_hdr;
    struct in6_addr mld_addr;
struct icmp6_router_renum {
    struct icmp6_hdr rr_hdr;
    uint8_t rr_segnum;
    uint8_t rr_flags;
    uint16_t rr_maxdelay;
    uint32_t rr_reserved;
struct rr_pco_match {
    uint8_t rpm_code;
    uint8_t rpm_len;
    uint8_t rpm_ordinal;
    uint8_t rpm_matchlen;
    uint8_t rpm_minlen;
    uint8_t rpm_maxlen;
    uint16_t rpm_reserved;
    struct in6_addr rpm_prefix;
struct rr_pco_use {
    uint8_t rpu_uselen;
    uint8_t rpu_keeplen;
    uint8_t rpu_ramask;
    uint8_t rpu_raflags;
    uint32_t rpu_vltime;
    uint32_t rpu_pltime;
    uint32_t rpu_flags;
    struct in6_addr rpu_prefix;
struct rr_result {
    uint16_t rrr_flags;
    uint8_t rrr_ordinal;
    uint8_t rrr_matchedlen;
    uint32_t rrr_ifid;
    struct in6_addr rrr_prefix;
struct nd_opt_adv_interval {
    uint8_t nd_opt_adv_interval_type;
    uint8_t nd_opt_adv_interval_len;
    uint16_t nd_opt_adv_interval_reserved;
    uint32_t nd_opt_adv_interval_ival;
struct nd_opt_home_agent_info {
    uint8_t nd_opt_home_agent_info_type;
    uint8_t nd_opt_home_agent_info_len;
    uint16_t nd_opt_home_agent_info_reserved;
    int16_t nd_opt_home_agent_info_preference;
    uint16_t nd_opt_home_agent_info_lifetime;

13.4.27. netinet/igmp.h

#define IGMP_DVMRP	0x13
#define IGMP_PIM	0x14
#define IGMP_TRACE	0x15
#define IGMP_V2_LEAVE_GROUP	0x17
#define IGMP_MTRACE_RESP	0x1e
#define IGMP_MTRACE	0x1f
#define IGMP_v1_ROUTER	1
#define IGMP_v2_ROUTER	2
#define IGMP_MINLEN	8

struct igmp {
    u_int8_t igmp_type;
    u_int8_t igmp_code;
    u_int16_t igmp_cksum;
    struct in_addr igmp_group;

13.4.28. netinet/in.h

#define IPPROTO_IP	0
#define IPPROTO_ICMP	1
#define IPPROTO_UDP	17
#define IPPROTO_IGMP	2
#define IPPROTO_RAW	255
#define IPPROTO_IPV6	41
#define IPPROTO_ICMPV6	58
#define IPPROTO_TCP	6

typedef uint16_t in_port_t;

struct in_addr {
    uint32_t s_addr;
typedef uint32_t in_addr_t;

#define INADDR_NONE	((in_addr_t) 0xffffffff)
#define INADDR_BROADCAST	(0xffffffff)
#define INADDR_ANY	0
#define INADDR_LOOPBACK	0x7f000001	/* */

#define s6_addr16	in6_u.u6_addr16
#define s6_addr32	in6_u.u6_addr32
#define s6_addr	in6_u.u6_addr8

struct in6_addr {
    union {
	uint8_t u6_addr8[16];
	uint16_t u6_addr16[8];
	uint32_t u6_addr32[4];
    } in6_u;

#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 IN_MULTICAST(a)	((((in_addr_t)(a))&0xf0000000)==0xe0000000)

struct sockaddr_in {
    sa_family_t sin_family;
    unsigned short sin_port;
    struct in_addr sin_addr;
    unsigned char sin_zero[8];

#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_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]))
#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_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_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_MULTICAST(a)	(((const uint8_t *) (a))[0] == 0xff)
#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))

struct sockaddr_in6 {
    unsigned short sin6_family;	/* AF_INET6 */
    uint16_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;	/* scope id (new in RFC2553) */

#define SOL_IP	0
#define IP_TOS	1		/* IP type of service and precedence */
#define IPV6_UNICAST_HOPS	16
#define IPV6_MULTICAST_IF	17
#define IP_TTL	2		/* IP time to live */
#define IPV6_JOIN_GROUP	20
#define IPV6_LEAVE_GROUP	21
#define IPV6_V6ONLY	26
#define IP_MULTICAST_IF	32	/* set/get IP multicast i/f */
#define IP_MULTICAST_TTL	33	/* set/get IP multicast ttl */
#define IP_MULTICAST_LOOP	34	/* set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP	35	/* add an IP group membership */
#define IP_DROP_MEMBERSHIP	36	/* drop an IP group membership */
#define IP_OPTIONS	4	/* IP per-packet options */

struct ipv6_mreq {
    struct in6_addr ipv6mr_multiaddr;	/* IPv6 multicast address of group */
    int ipv6mr_interface;	/* local IPv6 address of interface */
struct ip_mreq {
    struct in_addr imr_multiaddr;	/* IP multicast address of group */
    struct in_addr imr_interface;	/* local IP address of interface */
extern int bindresvport(int, struct sockaddr_in *);
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;

13.4.29. netinet/in_systm.h

typedef u_int16_t n_short;
typedef u_int32_t n_long;
typedef u_int32_t n_time;

13.4.30. netinet/ip.h

#define IPOPT_COPIED(o)	((o) & IPOPT_COPY)
#define IPOPT_EOL	0
#define IPOPT_OPTVAL	0
#define IPOPT_CONTROL	0x00
#define IPOPT_SECUR_UNCLASS	0x0000
#define IPOPT_NUMBER_MASK	0x1f
#define IP_OFFMASK	0x1fff
#define IPOPT_RESERVED1	0x20
#define IP_MF	0x2000
#define IPOPT_DEBMEAS	0x40
#define IP_DF	0x4000
#define IPOPT_CLASS_MASK	0x60
#define IPOPT_RESERVED2	0x60
#define IPOPT_SECUR_EFTO	0x789a
#define IPOPT_COPY	0x80
#define IP_RF	0x8000
#define IPOPT_SECUR_RESTR	0xaf13
#define IPOPT_SECUR_MMMM	0xbc4d
#define IPOPT_SECUR_SECRET	0xd788
#define IPOPT_SECUR_CONFID	0xf135
#define IPOPT_NOP	1
#define IPOPT_OLEN	1
#define IPTTLDEC	1
#define IPOPT_SECURITY	130
#define IPOPT_LSRR	131
#define IPOPT_SATID	136
#define IPOPT_SSRR	137
#define IPOPT_RA	148
#define IPOPT_OFFSET	2
#define MAXTTL	255
#define IPOPT_MINOFF	4
#define IPVERSION	4
#define MAX_IPOPTLEN	40
#define IP_MSS	576
#define IPFRAGTTL	60
#define IPDEFTTL	64
#define IP_MAXPACKET	65535
#define IPOPT_TS	68
#define IPOPT_RR	7

#define IPTOS_TOS(tos)	((tos) & IPTOS_TOS_MASK)
#define IPTOS_LOWCOST	0x02
#define IPTOS_LOWDELAY	0x10
#define IPTOS_TOS_MASK	0x1e

#define IPTOS_PREC(tos)	((tos) & IPTOS_PREC_MASK)
#define IPTOS_PREC_MASK	0xe0

13.4.31. netinet/ip6.h

#define IP6OPT_TYPE(o)	((o) & 0xc0)
#define IP6OPT_PAD1	0
#define IP6OPT_TYPE_SKIP	0x00
#define IP6OPT_TUNNEL_LIMIT	0x04
#define IP6OPT_ROUTER_ALERT	0x05
#define IP6OPT_TYPE_MUTABLE	0x20
#define IP6OPT_TYPE_DISCARD	0x40
#define IP6OPT_TYPE_ICMP	0xc0
#define IP6OPT_JUMBO	0xc2
#define IP6OPT_NSAP_ADDR	0xc3
#define IP6OPT_PADN	1
#define IP6OPT_JUMBO_LEN	6
#define ip6_flow	ip6_ctlun.ip6_un1.ip6_un1_flow
#define ip6_hlim	ip6_ctlun.ip6_un1.ip6_un1_hlim
#define ip6_hops	ip6_ctlun.ip6_un1.ip6_un1_hlim
#define ip6_nxt	ip6_ctlun.ip6_un1.ip6_un1_nxt
#define ip6_plen	ip6_ctlun.ip6_un1.ip6_un1_plen
#define ip6_vfc	ip6_ctlun.ip6_un2_vfc

struct ip6_hdrctl {
    uint32_t ip6_un1_flow;
    uint16_t ip6_un1_plen;
    uint8_t ip6_un1_nxt;
    uint8_t ip6_un1_hlim;
struct ip6_hdr {
    struct in6_addr ip6_src;
    struct in6_addr ip6_dst;
struct ip6_ext {
    uint8_t ip6e_nxt;
    uint8_t ip6e_len;
struct ip6_hbh {
    uint8_t ip6h_nxt;
    uint8_t ip6h_len;
struct ip6_dest {
    uint8_t ip6d_nxt;
    uint8_t ip6d_len;
struct ip6_rthdr {
    uint8_t ip6r_nxt;
    uint8_t ip6r_len;
    uint8_t ip6r_type;
    uint8_t ip6r_segleft;
struct ip6_frag {
    uint8_t ip6f_nxt;
    uint8_t ip6f_reserved;
    uint16_t ip6f_offlg;
    uint32_t ip6f_ident;
struct ip6_opt {
    uint8_t ip6o_type;
    uint8_t ip6o_len;
struct ip6_opt_jumbo {
    uint8_t ip6oj_type;
    uint8_t ip6oj_len;
    uint8_t ip6oj_jumbo_len[4];
struct ip6_opt_nsap {
    uint8_t ip6on_type;
    uint8_t ip6on_len;
    uint8_t ip6on_src_nsap_len;
    uint8_t ip6on_dst_nsap_len;
struct ip6_opt_tunnel {
    uint8_t ip6ot_type;
    uint8_t ip6ot_len;
    uint8_t ip6ot_encap_limit;
struct ip6_opt_router {
    uint8_t ip6or_type;
    uint8_t ip6or_len;
    uint8_t ip6or_value[2];

13.4.32. netinet/ip_icmp.h

#define ICMP_INFOTYPE(type)	((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
#define ICMP_ADVLEN(p)	(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
#define ICMP_TSLEN	(8 + 3 * sizeof (n_time))
#define ICMP_ADVLENMIN	(8 + sizeof (struct ip) + 8)
#define ICMP_EXC_TTL	0
#define ICMP_REDIR_NET	0
#define ICMP_HOST_ANO	10
#define ICMP_NET_UNR_TOS	11
#define ICMP_TIMXCEED	11
#define ICMP_HOST_UNR_TOS	12
#define ICMP_MASKLEN	12
#define ICMP_TSTAMP	13
#define ICMP_IREQ	15
#define NR_ICMP_UNREACH	15
#define ICMP_INFO_REPLY	16
#define ICMP_ADDRESS	17
#define ICMP_MASKREQ	17
#define ICMP_MAXTYPE	18
#define NR_ICMP_TYPES	18
#define ICMP_UNREACH	3
#define ICMP_SR_FAILED	5
#define ICMP_ECHO	8
#define ICMP_MINLEN	8
#define ICMP_NET_ANO	9
#define icmp_data	icmp_dun.id_data
#define icmp_ip	icmp_dun.id_ip.idi_ip
#define icmp_mask	icmp_dun.id_mask
#define icmp_radv	icmp_dun.id_radv
#define icmp_otime	icmp_dun.id_ts.its_otime
#define icmp_rtime	icmp_dun.id_ts.its_rtime
#define icmp_ttime	icmp_dun.id_ts.its_ttime
#define icmp_gwaddr	icmp_hun.ih_gwaddr
#define icmp_id	icmp_hun.ih_idseq.icd_id
#define icmp_seq	icmp_hun.ih_idseq.icd_seq
#define icmp_nextmtu	icmp_hun.ih_pmtu.ipm_nextmtu
#define icmp_pmvoid	icmp_hun.ih_pmtu.ipm_void
#define icmp_pptr	icmp_hun.ih_pptr
#define icmp_lifetime	icmp_hun.ih_rtradv.irt_lifetime
#define icmp_num_addrs	icmp_hun.ih_rtradv.irt_num_addrs
#define icmp_wpa	icmp_hun.ih_rtradv.irt_wpa
#define icmp_void	icmp_hun.ih_void

struct icmphdr {
    u_int8_t type;
    u_int8_t code;
    u_int16_t checksum;
    union {
	struct {
	    u_int16_t id;
	    u_int16_t sequence;
	} echo;
	u_int32_t gateway;
	struct {
	    u_int16_t __unused;
	    u_int16_t mtu;
	} frag;
    } un;
struct icmp_ra_addr {
    u_int32_t ira_addr;
    u_int32_t ira_preference;
struct ih_idseq {
    u_int16_t icd_id;
    u_int16_t icd_seq;
struct ih_pmtu {
    u_int16_t ipm_void;
    u_int16_t ipm_nextmtu;
struct ih_rtradv {
    u_int8_t irt_num_addrs;
    u_int8_t irt_wpa;
    u_int16_t irt_lifetime;
struct icmp {
    u_int8_t icmp_type;
    u_int8_t icmp_code;
    u_int16_t icmp_cksum;
    union {
	u_int16_t ih_pptr;
	struct in_addr ih_gwaddr;
	struct ih_idseq ih_idseq;
	u_int32_t ih_void;
	struct ih_pmtu ih_pmtu;
	struct ih_rtradv ih_rtradv;
    } icmp_hun;
    union {
	struct {
	    u_int32_t its_otime;
	    u_int32_t its_rtime;
	    u_int32_t its_ttime;
	} id_ts;
	struct {
	    struct ip idi_ip;
	} id_ip;
	struct icmp_ra_addr id_radv;
	u_int32_t id_mask;
	u_int8_t id_data[1];
    } icmp_dun;

13.4.33. netinet/tcp.h

#define TCPOPT_EOL	0
#define TCPOPT_NOP	1
#define TCP_NODELAY	1
#define TCP_INFO	11
#define TCP_QUICKACK	12
#define TCPI_OPT_SACK	2
#define TCP_MAXSEG	2
#define TCP_CORK	3
#define TCP_KEEPIDLE	4
#define TCPOPT_SACK	5
#define TCP_MSS	512
#define SOL_TCP	6
#define TCP_KEEPCNT	6
#define TCP_MAXWIN	65535
#define TCP_SYNCNT	7
#define TCPI_OPT_ECN	8
#define TCP_LINGER2	8

enum tcp_ca_state {
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;
    uint8_t 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;
    uint32_t tcpi_last_data_sent;
    uint32_t tcpi_last_ack_sent;
    uint32_t tcpi_last_data_recv;
    uint32_t tcpi_last_ack_recv;
    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;
enum {
    TCP_SYN_SENT = 2,
    TCP_SYN_RECV = 3,
    TCP_FIN_WAIT1 = 4,
    TCP_FIN_WAIT2 = 5,
    TCP_TIME_WAIT = 6,
    TCP_CLOSE = 7,
    TCP_LAST_ACK = 9,
    TCP_LISTEN = 10,
    TCP_CLOSING = 11

13.4.34. netinet/udp.h

#define SOL_UDP	17

struct udphdr {
    u_int16_t source;
    u_int16_t dest;
    u_int16_t len;
    u_int16_t check;

13.4.35. nl_types.h

#define NL_CAT_LOCALE	1
#define NL_SETD	1

typedef void *nl_catd;

typedef int nl_item;
extern int catclose(nl_catd __catalog);
extern char *catgets(nl_catd __catalog, int __set, int __number,
		     const char *__string);
extern nl_catd catopen(const char *__cat_name, int __flag);

13.4.36. poll.h

extern int poll(struct pollfd *__fds, nfds_t __nfds, int __timeout);

13.4.37. pty.h

extern int forkpty(int *__amaster, char *__name, struct termios *__termp,
		   struct winsize *__winp);
extern int openpty(int *__amaster, int *__aslave, char *__name,
		   struct termios *__termp, struct winsize *__winp);

13.4.38. pwd.h

struct passwd {
    char *pw_name;
    char *pw_passwd;
    uid_t pw_uid;
    gid_t pw_gid;
    char *pw_gecos;
    char *pw_dir;
    char *pw_shell;
extern void endpwent(void);
extern struct passwd *getpwent(void);
extern int getpwent_r(struct passwd *__resultbuf, char *__buffer,
		      size_t __buflen, struct passwd **__result);
extern struct passwd *getpwnam(const char *__name);
extern int getpwnam_r(const char *__name, struct passwd *__resultbuf,
		      char *__buffer, size_t __buflen,
		      struct passwd **__result);
extern struct passwd *getpwuid(uid_t __uid);
extern int getpwuid_r(uid_t __uid, struct passwd *__resultbuf,
		      char *__buffer, size_t __buflen,
		      struct passwd **__result);
extern void setpwent(void);

13.4.39. regex.h

#define RE_DUP_MAX	(0x7fff)

typedef unsigned long int reg_syntax_t;

typedef struct re_pattern_buffer {
    unsigned char *buffer;
    unsigned long int allocated;
    unsigned long int used;
    reg_syntax_t syntax;
    char *fastmap;
    char *translate;
    size_t re_nsub;
    unsigned int can_be_null:1;
    unsigned int regs_allocated:2;
    unsigned int fastmap_accurate:1;
    unsigned int no_sub:1;
    unsigned int not_bol:1;
    unsigned int not_eol:1;
    unsigned int newline_anchor:1;
} regex_t;
typedef int regoff_t;
typedef struct {
    regoff_t rm_so;
    regoff_t rm_eo;
} regmatch_t;

#define REG_EXTENDED	1

#define REG_NOTEOL	(1<<1)
#define REG_NOTBOL	1

typedef enum {
    REG_ENOSYS = -1,
    REG_NOERROR = 0,
    REG_NOMATCH = 1,
    REG_BADPAT = 2,
    REG_ECTYPE = 4,
    REG_EESCAPE = 5,
    REG_ESUBREG = 6,
    REG_EBRACK = 7,
    REG_EPAREN = 8,
    REG_EBRACE = 9,
    REG_BADBR = 10,
    REG_ERANGE = 11,
    REG_ESPACE = 12,
    REG_BADRPT = 13,
    REG_EEND = 14,
    REG_ESIZE = 15,
    REG_ERPAREN = 16
} reg_errcode_t;
extern int regcomp(regex_t * __preg, const char *__pattern, int __cflags);
extern size_t regerror(int __errcode, const regex_t * __preg,
		       char *__errbuf, size_t __errbuf_size);
extern int regexec(const regex_t * __preg, const char *__string,
		   size_t __nmatch, regmatch_t __pmatch[], int __eflags);
extern void regfree(regex_t * __preg);

13.4.40. rpc/auth.h

#define auth_destroy(auth)	((*((auth)->ah_ops->ah_destroy))(auth))

enum auth_stat {
    AUTH_OK = 0,
    AUTH_BADCRED = 1,		/* bogus credentials (seal broken) */
    AUTH_REJECTEDCRED = 2,	/* client should begin new session */
    AUTH_BADVERF = 3,		/* bogus verifier (seal broken) */
    AUTH_REJECTEDVERF = 4,	/* verifier expired or was replayed */
    AUTH_TOOWEAK = 5,		/* Rpc calls return an enum clnt_stat. */
    AUTH_INVALIDRESP = 6,	/* bogus response verifier */
    AUTH_FAILED = 7		/* some unknown reason */

union des_block {
    struct {
	u_int32_t high;
	u_int32_t low;
    } key;
    char c[8];

struct opaque_auth {
    enum_t oa_flavor;		/* flavor of auth */
    caddr_t oa_base;		/* address of more auth stuff */
    u_int oa_length;		/* not to exceed MAX_AUTH_BYTES */

typedef struct AUTH {
    struct opaque_auth ah_cred;
    struct opaque_auth ah_verf;
    union des_block ah_key;
    struct auth_ops *ah_ops;
    caddr_t ah_private;

struct auth_ops {
    void (*ah_nextverf) (struct AUTH *);
    int (*ah_marshal) (struct AUTH *, XDR *);	/* nextverf & serialize */
    int (*ah_validate) (struct AUTH *, struct opaque_auth *);	/* validate verifier */
    int (*ah_refresh) (struct AUTH *);	/* refresh credentials */
    void (*ah_destroy) (struct AUTH *);	/* Rpc calls return an enum clnt_stat. */
extern struct AUTH *authnone_create(void);
extern int key_decryptsession(char *, union des_block *);
extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);

13.4.41. rpc/clnt.h

#define clnt_control(cl,rq,in)	((*(cl)->cl_ops->cl_control)(cl,rq,in))
#define clnt_abort(rh)	((*(rh)->cl_ops->cl_abort)(rh))
#define clnt_destroy(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
#define clnt_freeres(rh,xres,resp)	((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
#define clnt_geterr(rh,errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
#define NULLPROC	((u_long)0)	/* By convention, procedure 0 takes null arguments and returns */
#define CLSET_TIMEOUT	1	/* set timeout (timeval) */
#define CLGET_XID	10	/* Get xid */
#define CLSET_XID	11	/* Set xid */
#define CLGET_VERS	12	/* Get version number */
#define CLSET_VERS	13	/* Set version number */
#define CLGET_PROG	14	/* Get program number */
#define CLSET_PROG	15	/* Set program number */
#define CLGET_TIMEOUT	2	/* get timeout (timeval) */
#define CLGET_SERVER_ADDR	3	/* get server's address (sockaddr) */
#define CLSET_RETRY_TIMEOUT	4	/* set retry timeout (timeval) */
#define CLGET_RETRY_TIMEOUT	5	/* get retry timeout (timeval) */
#define CLGET_FD	6	/* get connections file descriptor */
#define CLGET_SVC_ADDR	7	/* get server's address (netbuf) */
#define CLSET_FD_CLOSE	8	/* close fd while clnt_destroy */
#define CLSET_FD_NCLOSE	9	/* Do not close fd while clnt_destroy */
#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs)	\
	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))

enum clnt_stat {
    RPC_SUCCESS = 0,		/* call succeeded */
    RPC_CANTENCODEARGS = 1,	/* can't encode arguments */
    RPC_CANTDECODERES = 2,	/* can't decode results */
    RPC_CANTSEND = 3,		/* failure in sending call */
    RPC_CANTRECV = 4,		/* failure in receiving result */
    RPC_TIMEDOUT = 5,		/* call timed out */
    RPC_VERSMISMATCH = 6,	/* rpc versions not compatible */
    RPC_AUTHERROR = 7,		/* authentication error */
    RPC_PROGUNAVAIL = 8,	/* program not available */
    RPC_PROGVERSMISMATCH = 9,	/* program version mismatched */
    RPC_PROCUNAVAIL = 10,	/* procedure unavailable */
    RPC_CANTDECODEARGS = 11,	/* decode arguments error */
    RPC_SYSTEMERROR = 12,	/* generic "other problem" */
    RPC_NOBROADCAST = 21,	/* Broadcasting not supported */
    RPC_UNKNOWNHOST = 13,	/* unknown host name */
    RPC_UNKNOWNPROTO = 17,	/* unknown protocol */
    RPC_UNKNOWNADDR = 19,	/* Remote address unknown */
    RPC_RPCBFAILURE = 14,	/* portmapper failed in its call */
    RPC_PROGNOTREGISTERED = 15,	/* remote program is not registered */
    RPC_N2AXLATEFAILURE = 22,	/* Name to addr translation failed */
    RPC_FAILED = 16,
    RPC_INTR = 18,
    RPC_TLIERROR = 20,
    RPC_UDERROR = 23,
struct rpc_err {
    enum clnt_stat re_status;
    union {
	int RE_errno;
	enum auth_stat RE_why;
	struct {
	    u_long low;
	    u_long high;
	} RE_vers;
	struct {
	    long int s1;
	    long int s2;
	} RE_lb;
    } ru;

typedef struct CLIENT {
    struct AUTH *cl_auth;
    struct clnt_ops *cl_ops;
    caddr_t cl_private;

struct clnt_ops {
    enum clnt_stat (*cl_call) (struct CLIENT *, u_long, xdrproc_t, caddr_t,
			       xdrproc_t, caddr_t, struct timeval);
    void (*cl_abort) (void);
    void (*cl_geterr) (struct CLIENT *, struct rpc_err *);
     bool_t(*cl_freeres) (struct CLIENT *, xdrproc_t, caddr_t);
    void (*cl_destroy) (struct CLIENT *);
     bool_t(*cl_control) (struct CLIENT *, int, char *);
extern int callrpc(const char *__host, const u_long __prognum,
		   const u_long __versnum, const u_long __procnum,
		   const xdrproc_t __inproc, const char *__in,
		   const xdrproc_t __outproc, char *__out);
extern struct CLIENT *clnt_create(const char *__host, const u_long __prog,
				  const u_long __vers, const char *__prot);
extern void clnt_pcreateerror(const char *__msg);
extern void clnt_perrno(enum clnt_stat __num);
extern void clnt_perror(struct CLIENT *__clnt, const char *__msg);
extern char *clnt_spcreateerror(const char *__msg);
extern char *clnt_sperrno(enum clnt_stat __num);
extern char *clnt_sperror(struct CLIENT *__clnt, const char *__msg);
extern struct CLIENT *clntraw_create(u_long __prog, u_long __vers);
extern struct CLIENT *clnttcp_create(struct sockaddr_in *__raddr,
				     u_long __prog, u_long __version,
				     int *__sockp, u_int __sendsz,
				     u_int __recvsz);
extern struct CLIENT *clntudp_bufcreate(struct sockaddr_in *__raddr,
					u_long __program, u_long __version,
					struct timeval __wait_resend,
					int *__sockp, u_int __sendsz,
					u_int __recvsz);
extern struct CLIENT *clntudp_create(struct sockaddr_in *__raddr,
				     u_long __program, u_long __version,
				     struct timeval __wait_resend,
				     int *__sockp);

13.4.42. rpc/pmap_clnt.h

extern u_short pmap_getport(struct sockaddr_in *__address,
			    const u_long __program, const u_long __version,
			    u_int __protocol);
extern bool_t pmap_set(const u_long __program, const u_long __vers,
		       int __protocol, u_short __port);
extern bool_t pmap_unset(u_long __program, u_long __vers);

13.4.43. rpc/rpc_msg.h

enum msg_type {
    CALL = 0,
    REPLY = 1
enum reply_stat {
    MSG_DENIED = 1
enum accept_stat {
    SUCCESS = 0,
    SYSTEM_ERR = 5
enum reject_stat {
    AUTH_ERROR = 1

#define ar_results	ru.AR_results
#define ar_vers	ru.AR_versions

struct accepted_reply {
    struct opaque_auth ar_verf;
    enum accept_stat ar_stat;
    union {
	struct {
	    unsigned long int low;
	    unsigned long int high;
	} AR_versions;
	struct {
	    caddr_t where;
	    xdrproc_t proc;
	} AR_results;
    } ru;

#define rj_vers	ru.RJ_versions
#define rj_why	ru.RJ_why

struct rejected_reply {
    enum reject_stat rj_stat;
    union {
	struct {
	    unsigned long int low;
	    unsigned long int high;
	} RJ_versions;
	enum auth_stat RJ_why;	/* why authentication did not work */
    } ru;

#define rp_acpt	ru.RP_ar
#define rp_rjct	ru.RP_dr

struct reply_body {
    enum reply_stat rp_stat;
    union {
	struct accepted_reply RP_ar;
	struct rejected_reply RP_dr;
    } ru;

struct call_body {
    unsigned long int cb_rpcvers;	/* must be equal to two */
    unsigned long int cb_prog;
    unsigned long int cb_vers;
    unsigned long int cb_proc;
    struct opaque_auth cb_cred;
    struct opaque_auth cb_verf;	/* protocol specific - provided by client */

#define rm_call	ru.RM_cmb
#define rm_reply	ru.RM_rmb
#define acpted_rply	ru.RM_rmb.ru.RP_ar
#define rjcted_rply	ru.RM_rmb.ru.RP_dr

struct rpc_msg {
    unsigned long int rm_xid;
    enum msg_type rm_direction;
    union {
	struct call_body RM_cmb;
	struct reply_body RM_rmb;
    } ru;
extern bool_t xdr_accepted_reply(XDR *, struct accepted_reply *);
extern bool_t xdr_callhdr(XDR * __xdrs, struct rpc_msg *__cmsg);
extern bool_t xdr_callmsg(XDR * __xdrs, struct rpc_msg *__cmsg);
extern bool_t xdr_rejected_reply(XDR *, struct rejected_reply *);
extern bool_t xdr_replymsg(XDR * __xdrs, struct rpc_msg *__rmsg);

13.4.44. rpc/svc.h

#define svc_getcaller(x)	(&(x)->xp_raddr)
#define svc_destroy(xprt)	(*(xprt)->xp_ops->xp_destroy)(xprt)
#define svc_recv(xprt,msg)	(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
#define svc_reply(xprt,msg)	(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
#define svc_stat(xprt)	(*(xprt)->xp_ops->xp_stat)(xprt)
#define RPC_ANYSOCK	-1
#define svc_freeargs(xprt,xargs, argsp)	\
	(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
#define svc_getargs(xprt,xargs, argsp)	\
	(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))

enum xprt_stat {

typedef struct SVCXPRT {
    int xp_sock;
    u_short xp_port;
    struct xp_ops *xp_ops;
    int xp_addrlen;
    struct sockaddr_in xp_raddr;
    struct opaque_auth xp_verf;
    caddr_t xp_p1;
    caddr_t xp_p2;
    char xp_pad[256];

struct svc_req {
    rpcprog_t rq_prog;
    rpcvers_t rq_vers;
    rpcproc_t rq_proc;
    struct opaque_auth rq_cred;
    caddr_t rq_clntcred;
    SVCXPRT *rq_xprt;

typedef void (*__dispatch_fn_t) (struct svc_req *, SVCXPRT *);

struct xp_ops {
    bool_t(*xp_recv) (SVCXPRT * __xprt, struct rpc_msg * __msg);
    enum xprt_stat (*xp_stat) (SVCXPRT * __xprt);
     bool_t(*xp_getargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args,
			  caddr_t args_ptr);
     bool_t(*xp_reply) (SVCXPRT * __xprt, struct rpc_msg * __msg);
     bool_t(*xp_freeargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args,
			   caddr_t args_ptr);
    void (*xp_destroy) (SVCXPRT * __xprt);
extern void svc_getreqset(fd_set * __readfds);
extern bool_t svc_register(SVCXPRT * __xprt, rpcprog_t __prog,
			   rpcvers_t __vers, __dispatch_fn_t __dispatch,
			   rpcprot_t __protocol);
extern void svc_run(void);
extern bool_t svc_sendreply(SVCXPRT * xprt, xdrproc_t __xdr_results,
			    caddr_t __xdr_location);
extern void svcerr_auth(SVCXPRT * __xprt, enum auth_stat __why);
extern void svcerr_decode(SVCXPRT * __xprt);
extern void svcerr_noproc(SVCXPRT * __xprt);
extern void svcerr_noprog(SVCXPRT * __xprt);
extern void svcerr_progvers(SVCXPRT * __xprt, rpcvers_t __low_vers,
			    rpcvers_t __high_vers);
extern void svcerr_systemerr(SVCXPRT * __xprt);
extern void svcerr_weakauth(SVCXPRT * __xprt);
extern SVCXPRT *svcraw_create(void);
extern SVCXPRT *svctcp_create(int __sock, u_int __sendsize,
			      u_int __recvsize);
extern SVCXPRT *svcudp_create(int __sock);

13.4.45. rpc/types.h

typedef int bool_t;
typedef int enum_t;
typedef unsigned long int rpcprog_t;
typedef unsigned long int rpcvers_t;
typedef unsigned long int rpcproc_t;
typedef unsigned long int rpcprot_t;

13.4.46. rpc/xdr.h

#define XDR_DESTROY(xdrs)	 \
   do { if ((xdrs)->x_ops->x_destroy) (*(xdrs)->x_ops->x_destroy)(xdrs); \
      } while (0)
#define xdr_destroy(xdrs)	 \
   do { if ((xdrs)->x_ops->x_destroy) (*(xdrs)->x_ops->x_destroy)(xdrs); \
      } while (0)
#define XDR_GETBYTES(xdrs,addr,len)	(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
#define xdr_getbytes(xdrs,addr,len)	(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
#define XDR_GETINT32(xdrs,int32p)	(*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
#define xdr_getint32(xdrs,int32p)	(*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
#define XDR_GETLONG(xdrs,longp)	(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
#define xdr_getlong(xdrs,longp)	(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
#define XDR_GETPOS(xdrs)	(*(xdrs)->x_ops->x_getpostn)(xdrs)
#define xdr_getpos(xdrs)	(*(xdrs)->x_ops->x_getpostn)(xdrs)
#define XDR_INLINE(xdrs,len)	(*(xdrs)->x_ops->x_inline)(xdrs, len)
#define xdr_inline(xdrs,len)	(*(xdrs)->x_ops->x_inline)(xdrs, len)
#define XDR_PUTBYTES(xdrs,addr,len)	(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
#define xdr_putbytes(xdrs,addr,len)	(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
#define XDR_PUTINT32(xdrs,int32p)	(*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
#define xdr_putint32(xdrs,int32p)	(*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
#define XDR_PUTLONG(xdrs,longp)	(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
#define xdr_putlong(xdrs,longp)	(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
#define XDR_SETPOS(xdrs,pos)	(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
#define xdr_setpos(xdrs,pos)	(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)

enum xdr_op {
typedef struct XDR {
    enum xdr_op x_op;
    struct xdr_ops *x_ops;
    caddr_t x_public;
    caddr_t x_private;
    caddr_t x_base;
    int x_handy;
} XDR;

struct xdr_ops {
    bool_t(*x_getlong) (XDR * __xdrs, long int *__lp);
    bool_t(*x_putlong) (XDR * __xdrs, long int *__lp);
    bool_t(*x_getbytes) (XDR * __xdrs, caddr_t __addr, u_int __len);
    bool_t(*x_putbytes) (XDR * __xdrs, char *__addr, u_int __len);
    u_int(*x_getpostn) (XDR * __xdrs);
    bool_t(*x_setpostn) (XDR * __xdrs, u_int __pos);
    int32_t *(*x_inline) (XDR * __xdrs, int __len);
    void (*x_destroy) (XDR * __xdrs);
     bool_t(*x_getint32) (XDR * __xdrs, int32_t * __ip);
     bool_t(*x_putint32) (XDR * __xdrs, int32_t * __ip);

typedef bool_t(*xdrproc_t) (XDR *, void *, ...);

struct xdr_discrim {
    int value;
    xdrproc_t proc;
extern bool_t xdr_array(XDR * _xdrs, caddr_t * __addrp, u_int * __sizep,
			u_int __maxsize, u_int __elsize,
			xdrproc_t __elproc);
extern bool_t xdr_bool(XDR * __xdrs, bool_t * __bp);
extern bool_t xdr_bytes(XDR * __xdrs, char **__cpp, u_int * __sizep,
			u_int __maxsize);
extern bool_t xdr_char(XDR * __xdrs, char *__cp);
extern bool_t xdr_double(XDR * __xdrs, double *__dp);
extern bool_t xdr_enum(XDR * __xdrs, enum_t * __ep);
extern bool_t xdr_float(XDR * __xdrs, float *__fp);
extern void xdr_free(xdrproc_t __proc, char *__objp);
extern bool_t xdr_int(XDR * __xdrs, int *__ip);
extern bool_t xdr_long(XDR * __xdrs, long int *__lp);
extern bool_t xdr_opaque(XDR * __xdrs, caddr_t __cp, u_int __cnt);
extern bool_t xdr_pointer(XDR * __xdrs, char **__objpp, u_int __obj_size,
			  xdrproc_t __xdr_obj);
extern bool_t xdr_reference(XDR * __xdrs, caddr_t * __xpp, u_int __size,
			    xdrproc_t __proc);
extern bool_t xdr_short(XDR * __xdrs, short *__sp);
extern bool_t xdr_string(XDR * __xdrs, char **__cpp, u_int __maxsize);
extern bool_t xdr_u_char(XDR * __xdrs, u_char * __cp);
extern bool_t xdr_u_int(XDR * __xdrs, u_int * __up);
extern bool_t xdr_u_long(XDR * __xdrs, u_long * __ulp);
extern bool_t xdr_u_short(XDR * __xdrs, u_short * __usp);
extern bool_t xdr_union(XDR * __xdrs, enum_t * __dscmp, char *__unp,
			const struct xdr_discrim *__choices,
			xdrproc_t dfault);
extern bool_t xdr_vector(XDR * __xdrs, char *__basep, u_int __nelem,
			 u_int __elemsize, xdrproc_t __xdr_elem);
extern bool_t xdr_void(void);
extern bool_t xdr_wrapstring(XDR * __xdrs, char **__cpp);
extern void xdrmem_create(XDR * __xdrs, caddr_t __addr, u_int __size,
			  enum xdr_op __xop);
extern void xdrrec_create(XDR * __xdrs, u_int __sendsize, u_int __recvsize,
			  caddr_t __tcp_handle, int (*__readit) (char *,
								 char *,
			  int (*__writeit) (char *, char *, int));
extern bool_t xdrrec_endofrecord(XDR * __xdrs, bool_t __sendnow);
extern bool_t xdrrec_eof(XDR * __xdrs);
extern bool_t xdrrec_skiprecord(XDR * __xdrs);
extern void xdrstdio_create(XDR * __xdrs, FILE * __file,
			    enum xdr_op __xop);

13.4.47. sched.h

#define __CPUELT(cpu)	((cpu) / __NCPUBITS)
#define __CPUMASK(cpu)	((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
#define __NCPUBITS	(8 * sizeof (__cpu_mask))
#define SCHED_OTHER	0
#define SCHED_FIFO	1
#define __CPU_SETSIZE	1024
#define SCHED_RR	2
#define CPU_ALLOC(count)	__CPU_ALLOC (count)
#define CPU_ALLOC_SIZE(count)	__CPU_ALLOC_SIZE (count)
#define CPU_COUNT(cpusetp)	__CPU_COUNT_S (sizeof (cpu_set_t), cpusetp)
#define CPU_FREE(cpuset)	__CPU_FREE (cpuset)
#define CPU_ZERO(cpusetp)	__CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)

struct sched_param {
    int sched_priority;
typedef unsigned long int __cpu_mask;
typedef struct {
    __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
} cpu_set_t;
extern int sched_get_priority_max(int __algorithm);
extern int sched_get_priority_min(int __algorithm);
extern int sched_getaffinity(pid_t __pid, size_t __cpusetsize,
			     cpu_set_t * __cpuset);
extern int sched_getparam(pid_t __pid, struct sched_param *__param);
extern int sched_getscheduler(pid_t __pid);
extern int sched_rr_get_interval(pid_t __pid, struct timespec *__t);
extern int sched_setaffinity(pid_t __pid, size_t __cpusetsize,
			     const cpu_set_t * __cpuset);
extern int sched_setparam(pid_t __pid, const struct sched_param *__param);
extern int sched_setscheduler(pid_t __pid, int __policy,
			      const struct sched_param *__param);
extern int sched_yield(void);

13.4.48. search.h

typedef struct entry {
    char *key;
    void *data;
typedef enum {
struct _ENTRY;
typedef enum {
struct hsearch_data {
    struct _ENTRY *table;
    unsigned int size;
    unsigned int filled;

typedef void (*__action_fn_t) (const void *__nodep, VISIT __value,
			       int __level);
extern int hcreate(size_t __nel);
extern int hcreate_r(size_t __nel, struct hsearch_data *__htab);
extern void hdestroy(void);
extern void hdestroy_r(struct hsearch_data *__htab);
extern ENTRY *hsearch(ENTRY __item, ACTION __action);
extern int hsearch_r(ENTRY __item, ACTION __action, ENTRY * *__retval,
		     struct hsearch_data *__htab);
extern void insque(void *__elem, void *__prev);
extern void *lfind(const void *__key, const void *__base, size_t * __nmemb,
		   size_t __size, __compar_fn_t __compar);
extern void *lsearch(const void *__key, void *__base, size_t * __nmemb,
		     size_t __size, __compar_fn_t __compar);
extern void remque(void *__elem);
extern void *tdelete(const void *__key, void **__rootp,
		     __compar_fn_t __compar);
extern void *tfind(const void *__key, void *const *__rootp,
		   __compar_fn_t __compar);
extern void *tsearch(const void *__key, void **__rootp,
		     __compar_fn_t __compar);
extern void twalk(const void *__root, __action_fn_t __action);

13.4.49. setjmp.h

#define setjmp(env)	_setjmp(env)
#define sigsetjmp(a,b)	__sigsetjmp(a,b)

struct __jmp_buf_tag {
    __jmp_buf __jmpbuf;
    int __mask_was_saved;
    sigset_t __saved_mask;

typedef struct __jmp_buf_tag jmp_buf[1];
typedef jmp_buf sigjmp_buf;
extern int __sigsetjmp(jmp_buf __env, int __savemask);
extern void _longjmp(jmp_buf __env, int __val);
extern int _setjmp(jmp_buf __env);
extern void longjmp(jmp_buf __env, int __val);
extern void siglongjmp(sigjmp_buf __env, int __val);

13.4.50. signal.h

#define sigpause __xpg_sigpause

#define _SIGSET_NWORDS	(1024/(8*sizeof(unsigned long)))
#define SIGRTMAX	(__libc_current_sigrtmax ())
#define SIGRTMIN	(__libc_current_sigrtmin ())
#define NSIG	65
#define SIG_BLOCK	0	/* Block signals. */
#define SIG_UNBLOCK	1	/* Unblock signals. */
#define SIG_SETMASK	2	/* Set the set of blocked signals. */

typedef int sig_atomic_t;

typedef void (*sighandler_t) (int);

#define SIG_HOLD	((sighandler_t) 2)	/* Request that signal be held. */
#define SIG_DFL	((sighandler_t)0)	/* Request for default signal handling. */
#define SIG_IGN	((sighandler_t)1)	/* Request that signal be ignored. */
#define SIG_ERR	((sighandler_t)-1)	/* Return value from signal() in case of error. */

#define SIGHUP	1		/* Hangup. */
#define SIGINT	2		/* Terminal interrupt signal. */
#define SIGQUIT	3		/* Terminal quit signal. */
#define SIGILL	4		/* Illegal instruction. */
#define SIGTRAP	5		/* Trace/breakpoint trap. */
#define SIGABRT	6		/* Process abort signal. */
#define SIGIOT	6		/* IOT trap */
#define SIGBUS	7		/* Access to an undefined portion of a memory object. */
#define SIGFPE	8		/* Erroneous arithmetic operation. */
#define SIGKILL	9		/* Kill (cannot be caught or ignored). */
#define SIGUSR1	10		/* User-defined signal 1. */
#define SIGSEGV	11		/* Invalid memory reference. */
#define SIGUSR2	12		/* User-defined signal 2. */
#define SIGPIPE	13		/* Write  on a pipe with no one to read it. */
#define SIGALRM	14		/* Alarm clock. */
#define SIGTERM	15		/* Termination signal. */
#define SIGSTKFLT	16	/* Stack fault. */
#define SIGCHLD	17		/* Child process terminated, stopped, or continued. */
#define SIGCLD	SIGCHLD		/* Same as SIGCHLD */
#define SIGCONT	18		/* Continue executing, if stopped. */
#define SIGSTOP	19		/* Stop executing (cannot be caught or ignored). */
#define SIGTSTP	20		/* Terminal stop signal. */
#define SIGTTIN	21		/* Background process attempting read. */
#define SIGTTOU	22		/* Background process attempting write. */
#define SIGURG	23		/* High bandwidth data is available at a socket. */
#define SIGXCPU	24		/* CPU time limit exceeded. */
#define SIGXFSZ	25		/* File size limit exceeded. */
#define SIGVTALRM	26	/* Virtual timer expired. */
#define SIGPROF	27		/* Profiling timer expired. */
#define SIGWINCH	28	/* Window size change. */
#define SIGIO	29		/* I/O now possible. */
#define SIGPOLL	SIGIO		/* Pollable event. */
#define SIGPWR	30		/* Power failure restart */
#define SIGSYS	31		/* Bad system call. */
#define SIGUNUSED	31

#define SV_ONSTACK	(1<<0)	/* Take the signal on the signal stack. */
#define SV_INTERRUPT	(1<<1)	/* Do not restart system calls. */
#define SV_RESETHAND	(1<<2)	/* Reset handler to SIG_DFL on receipt. */

typedef union sigval {
    int sival_int;
    void *sival_ptr;
} sigval_t;

#define SIGEV_SIGNAL	0	/* Notify via signal. */
#define SIGEV_NONE	1	/* Other notification: meaningless. */
#define SIGEV_THREAD	2	/* Deliver via thread creation. */
#define SIGEV_MAX_SIZE	64

typedef struct sigevent {
    sigval_t sigev_value;
    int sigev_signo;
    int sigev_notify;
    union {
	int _pad[SIGEV_PAD_SIZE];
	struct {
	    void (*_function) (sigval_t);
	    void *_attribute;
	} _sigev_thread;
    } _sigev_un;
} sigevent_t;

#define SI_MAX_SIZE	128
#define si_pid	_sifields._kill._pid
#define si_uid	_sifields._kill._uid
#define si_value	_sifields._rt._sigval
#define si_int	_sifields._rt._sigval.sival_int
#define si_ptr	_sifields._rt._sigval.sival_ptr
#define si_status	_sifields._sigchld._status
#define si_stime	_sifields._sigchld._stime
#define si_utime	_sifields._sigchld._utime
#define si_addr	_sifields._sigfault._addr
#define si_band	_sifields._sigpoll._band
#define si_fd	_sifields._sigpoll._fd
#define si_timer1	_sifields._timer._timer1
#define si_timer2	_sifields._timer._timer2

typedef struct siginfo {
    int si_signo;		/* Signal number. */
    int si_errno;
    int si_code;		/* Signal code. */
    union {
	int _pad[SI_PAD_SIZE];
	struct {
	    pid_t _pid;
	    uid_t _uid;
	} _kill;
	struct {
	    unsigned int _timer1;
	    unsigned int _timer2;
	} _timer;
	struct {
	    pid_t _pid;
	    uid_t _uid;
	    sigval_t _sigval;
	} _rt;
	struct {
	    pid_t _pid;
	    uid_t _uid;
	    int _status;
	    clock_t _utime;
	    clock_t _stime;
	} _sigchld;
	struct {
	    void *_addr;
	} _sigfault;
	struct {
	    int _band;
	    int _fd;
	} _sigpoll;
    } _sifields;
} siginfo_t;

#define SI_QUEUE	-1	/* Sent by sigqueue. */
#define SI_TIMER	-2	/* Sent by timer expiration. */
#define SI_MESGQ	-3	/* Sent by real time mesq state change. */
#define SI_ASYNCIO	-4	/* Sent by AIO completion. */
#define SI_SIGIO	-5	/* Sent by queued SIGIO. */
#define SI_TKILL	-6	/* Sent by tkill. */
#define SI_ASYNCNL	-60	/* Sent by asynch name lookup completion. */
#define SI_USER	0		/* Sent by kill, sigsend, raise. */
#define SI_KERNEL	0x80	/* Sent by kernel. */

#define ILL_ILLOPC	1	/* Illegal opcode. */
#define ILL_ILLOPN	2	/* Illegal operand. */
#define ILL_ILLADR	3	/* Illegal addressing mode. */
#define ILL_ILLTRP	4	/* Illegal trap. */
#define ILL_PRVOPC	5	/* Privileged opcode. */
#define ILL_PRVREG	6	/* Privileged register. */
#define ILL_COPROC	7	/* Coprocessor error. */
#define ILL_BADSTK	8	/* Internal stack error. */

#define FPE_INTDIV	1	/* Integer divide by zero. */
#define FPE_INTOVF	2	/* Integer overflow. */
#define FPE_FLTDIV	3	/*  Floating-point divide by zero. */
#define FPE_FLTOVF	4	/* Floating-point overflow. */
#define FPE_FLTUND	5	/*  Floating-point underflow. */
#define FPE_FLTRES	6	/*  Floating-point inexact result. */
#define FPE_FLTINV	7	/* Invalid floating-point operation. */
#define FPE_FLTSUB	8	/* Subscript out of range. */

#define SEGV_MAPERR	1	/* Address not mapped to object. */
#define SEGV_ACCERR	2	/*  Invalid permissions for mapped object. */

#define BUS_ADRALN	1	/*  Invalid address alignment. */
#define BUS_ADRERR	2	/*  Nonexistent physical address. */
#define BUS_OBJERR	3	/*  Object-specific hardware error. */

#define TRAP_BRKPT	1	/*  Process breakpoint. */
#define TRAP_TRACE	2	/*  Process trace trap. */

#define CLD_EXITED	1	/* Child has exited. */
#define CLD_KILLED	2	/* Child has terminated abnormally and did not create a core fi */
#define CLD_DUMPED	3	/* Child has terminated abnormally and created a core file. */
#define CLD_TRAPPED	4	/*  Traced child has trapped. */
#define CLD_STOPPED	5	/* Child has stopped. */
#define CLD_CONTINUED	6	/* Stopped child has continued. */

#define POLL_IN	1		/*  Data input available. */
#define POLL_OUT	2	/*  Output buffers available. */
#define POLL_MSG	3	/*  Input message available. */
#define POLL_ERR	4	/*  I/O error. */
#define POLL_PRI	5	/* High priority input available. */
#define POLL_HUP	6	/*  Device disconnected. */

typedef struct {
    unsigned long int sig[_SIGSET_NWORDS];
} sigset_t;

#define SA_INTERRUPT	0x20000000
#define sa_handler	__sigaction_handler._sa_handler
#define sa_sigaction	__sigaction_handler._sa_sigaction
#define SA_ONSTACK	0x08000000	/* Use signal stack by using `sa_restorer`. */
#define SA_RESETHAND	0x80000000	/* Reset to SIG_DFL on entry to handler. */
#define SA_NOCLDSTOP	0x00000001	/* Don't send SIGCHLD when children stop. */
#define SA_SIGINFO	0x00000004	/* Invoke signal-catching function with three arguments instead of one. */
#define SA_NODEFER	0x40000000	/* Don't automatically block the signal when its handler is being executed. */
#define SA_RESTART	0x10000000	/* Restart syscall on signal return. */
#define SA_NOCLDWAIT	0x00000002	/* Don't create zombie on child death. */

typedef struct sigaltstack {
    void *ss_sp;
    int ss_flags;
    size_t ss_size;
} stack_t;

#define SS_ONSTACK	1
#define SS_DISABLE	2

extern int __libc_current_sigrtmax(void);
extern int __libc_current_sigrtmin(void);
extern sighandler_t __sysv_signal(int __sig, sighandler_t __handler);
extern int __xpg_sigpause(int);
extern char *const _sys_siglist[];
extern sighandler_t bsd_signal(int __sig, sighandler_t __handler);
extern int kill(pid_t __pid, int __sig);
extern int killpg(pid_t __pgrp, int __sig);
extern void psignal(int __sig, const char *__s);
extern int pthread_kill(pthread_t, int);
extern int pthread_sigmask(int, const sigset_t *, sigset_t *);
extern int raise(int __sig);
extern int sigaction(int __sig, const struct sigaction *__act,
		     struct sigaction *__oact);
extern int sigaddset(sigset_t * __set, int __signo);
extern int sigaltstack(const struct sigaltstack *__ss,
		       struct sigaltstack *__oss);
extern int sigandset(sigset_t * __set, const sigset_t * __left,
		     const sigset_t * __right);
extern int sigdelset(sigset_t * __set, int __signo);
extern int sigemptyset(sigset_t * __set);
extern int sigfillset(sigset_t * __set);
extern int sighold(int __sig);
extern int sigignore(int __sig);
extern int siginterrupt(int __sig, int __interrupt);
extern int sigisemptyset(const sigset_t * __set);
extern int sigismember(const sigset_t * __set, int __signo);
extern sighandler_t signal(int __sig, sighandler_t __handler);
extern int sigorset(sigset_t * __set, const sigset_t * __left,
		    const sigset_t * __right);
extern int sigpending(sigset_t * __set);
extern int sigprocmask(int __how, const sigset_t * __set,
		       sigset_t * __oset);
extern int sigqueue(pid_t __pid, int __sig, const union sigval __val);
extern int sigrelse(int __sig);
extern int sigreturn(struct sigcontext *__scp);
extern sighandler_t sigset(int __sig, sighandler_t __disp);
extern int sigsuspend(const sigset_t * __set);
extern int sigtimedwait(const sigset_t * __set, siginfo_t * __info,
			const struct timespec *__timeout);
extern int sigwait(const sigset_t * __set, int *__sig);
extern int sigwaitinfo(const sigset_t * __set, siginfo_t * __info);

13.4.51. spawn.h


typedef struct {
    int __allocated;
    int __used;
    struct __spawn_action *__actions;
    int __pad[16];
} posix_spawn_file_actions_t;
typedef struct {
    short __flags;
    pid_t __pgrp;
    sigset_t __sd;
    sigset_t __ss;
    struct sched_param __sp;
    int __policy;
    int __pad[16];
} posix_spawnattr_t;
extern int posix_spawn(pid_t * __pid, const char *__path,
		       const posix_spawn_file_actions_t * __file_actions,
		       const posix_spawnattr_t * __attrp,
		       char *const argv[], char *const envp[]);
extern int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *
					     __file_actions, int __fd);
extern int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *
					    __file_actions, int __fd,
					    int __newfd);
extern int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *
					    __file_actions, int __fd,
					    const char *__path,
					    int __oflag, mode_t __mode);
extern int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *
extern int posix_spawn_file_actions_init(posix_spawn_file_actions_t *
extern int posix_spawnattr_destroy(posix_spawnattr_t * __attr);
extern int posix_spawnattr_getflags(const posix_spawnattr_t * __attr,
				    short int *__flags);
extern int posix_spawnattr_getpgroup(const posix_spawnattr_t * __attr,
				     pid_t * __pgroup);
extern int posix_spawnattr_getschedparam(const posix_spawnattr_t * __attr,
					 struct sched_param *__schedparam);
extern int posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __attr,
					  int *__schedpolicy);
extern int posix_spawnattr_getsigdefault(const posix_spawnattr_t * __attr,
					 sigset_t * __sigdefault);
extern int posix_spawnattr_getsigmask(const posix_spawnattr_t * __attr,
				      sigset_t * __sigmask);
extern int posix_spawnattr_init(posix_spawnattr_t * __attr);
extern int posix_spawnattr_setflags(posix_spawnattr_t * _attr,
				    short int __flags);
extern int posix_spawnattr_setpgroup(posix_spawnattr_t * __attr,
				     pid_t __pgroup);
extern int posix_spawnattr_setschedparam(posix_spawnattr_t * __attr,
					 const struct sched_param
extern int posix_spawnattr_setschedpolicy(posix_spawnattr_t * __attr,
					  int __schedpolicy);
extern int posix_spawnattr_setsigdefault(posix_spawnattr_t * __attr,
					 const sigset_t * __sigdefault);
extern int posix_spawnattr_setsigmask(posix_spawnattr_t * __attr,
				      const sigset_t * __sigmask);
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[]);

13.4.52. stddef.h

#define offsetof(TYPE,MEMBER)	((size_t)&((TYPE*)0)->MEMBER)
#ifndef NULL
#  ifdef __cplusplus
#    define NULL        (0L)
#  else
#    define NULL        ((void*) 0)
#  endif

13.4.53. stdint.h

#define INT16_C(c)	c
#define INT32_C(c)	c
#define INT8_C(c)	c
#define UINT16_C(c)	c
#define UINT8_C(c)	c
#define UINT32_C(c)	c ## U

#define INT8_MIN	(-128)
#define INT_FAST8_MIN	(-128)
#define INT_LEAST8_MIN	(-128)
#define INT32_MIN	(-2147483647-1)
#define INT_LEAST32_MIN	(-2147483647-1)
#define SIG_ATOMIC_MIN	(-2147483647-1)
#define INT16_MIN	(-32767-1)
#define INT_LEAST16_MIN	(-32767-1)
#define INT64_MIN	(-__INT64_C(9223372036854775807)-1)
#define INTMAX_MIN	(-__INT64_C(9223372036854775807)-1)
#define INT_FAST64_MIN	(-__INT64_C(9223372036854775807)-1)
#define INT_LEAST64_MIN	(-__INT64_C(9223372036854775807)-1)
#define WINT_MIN	(0u)
#define INT8_MAX	(127)
#define INT_FAST8_MAX	(127)
#define INT_LEAST8_MAX	(127)
#define INT32_MAX	(2147483647)
#define INT_LEAST32_MAX	(2147483647)
#define SIG_ATOMIC_MAX	(2147483647)
#define UINT8_MAX	(255)
#define UINT_FAST8_MAX	(255)
#define UINT_LEAST8_MAX	(255)
#define INT16_MAX	(32767)
#define INT_LEAST16_MAX	(32767)
#define UINT32_MAX	(4294967295U)
#define UINT_LEAST32_MAX	(4294967295U)
#define WINT_MAX	(4294967295u)
#define UINT16_MAX	(65535)
#define UINT_LEAST16_MAX	(65535)
#define INT64_MAX	(__INT64_C(9223372036854775807))
#define INTMAX_MAX	(__INT64_C(9223372036854775807))
#define INT_FAST64_MAX	(__INT64_C(9223372036854775807))
#define INT_LEAST64_MAX	(__INT64_C(9223372036854775807))
#define UINT64_MAX	(__UINT64_C(18446744073709551615))
#define UINTMAX_MAX	(__UINT64_C(18446744073709551615))
#define UINT_FAST64_MAX	(__UINT64_C(18446744073709551615))
#define UINT_LEAST64_MAX	(__UINT64_C(18446744073709551615))

typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef int int_least32_t;
typedef unsigned char uint_least8_t;
typedef unsigned short uint_least16_t;
typedef unsigned int uint_least32_t;
typedef signed char int_fast8_t;
typedef unsigned char uint_fast8_t;

13.4.54. stdio.h

#define EOF	(-1)
#define P_tmpdir	"/tmp"
#define FOPEN_MAX	16
#define L_tmpnam	20
#define FILENAME_MAX	4096
#define BUFSIZ	8192
#define L_ctermid	9
#define L_cuserid	9

typedef struct {
    off_t __pos;
    mbstate_t __state;
} fpos_t;
typedef struct {
    off64_t __pos;
    mbstate_t __state;
} fpos64_t;

typedef struct _IO_FILE FILE;

#define _IOFBF	0
#define _IOLBF	1
#define _IONBF	2

extern char *__fgets_chk(char *, size_t, int, FILE *);
extern char *__fgets_unlocked_chk(char *, size_t, int, FILE *);
extern size_t __fpending(FILE *);
extern int __printf_chk(int, const char *, ...);
extern int __snprintf_chk(char *, size_t, int, size_t, const char *, ...);
extern int __sprintf_chk(char *, int, size_t, const char *, ...);
extern int __vprintf_chk(int, const char *, va_list);
extern int __vsnprintf_chk(char *, size_t, int, size_t, const char *,
extern int __vsprintf_chk(char *, int, size_t, const char *, va_list);
extern char *const _sys_errlist[];
extern int asprintf(char **__ptr, const char *__fmt, ...);
extern void clearerr(FILE * __stream);
extern void clearerr_unlocked(FILE * __stream);
extern int dprintf(int __fd, const char *__fmt, ...);
extern int fclose(FILE * __stream);
extern FILE *fdopen(int __fd, const char *__modes);
extern int feof(FILE * __stream);
extern int feof_unlocked(FILE * __stream);
extern int ferror(FILE * __stream);
extern int ferror_unlocked(FILE * __stream);
extern int fflush(FILE * __stream);
extern int fflush_unlocked(FILE * __stream);
extern int fgetc(FILE * __stream);
extern int fgetc_unlocked(FILE * __stream);
extern int fgetpos(FILE * __stream, fpos_t * __pos);
extern int fgetpos64(FILE * __stream, fpos64_t * __pos);
extern char *fgets(char *__s, int __n, FILE * __stream);
extern char *fgets_unlocked(char *__s, int __n, FILE * __stream);
extern int fileno(FILE * __stream);
extern int fileno_unlocked(FILE * __stream);
extern void flockfile(FILE * __stream);
extern FILE *fmemopen(void *__s, size_t __len, const char *__modes);
extern FILE *fopen(const char *__filename, const char *__modes);
extern FILE *fopen64(const char *__filename, const char *__modes);
extern int fprintf(FILE * __stream, const char *__format, ...);
extern int fputc(int __c, FILE * __stream);
extern int fputc_unlocked(int __c, FILE * __stream);
extern int fputs(const char *__s, FILE * __stream);
extern int fputs_unlocked(const char *__s, FILE * __stream);
extern size_t fread(void *__ptr, size_t __size, size_t __n,
		    FILE * __stream);
extern size_t fread_unlocked(void *__ptr, size_t __size, size_t __n,
			     FILE * __stream);
extern FILE *freopen(const char *__filename, const char *__modes,
		     FILE * __stream);
extern FILE *freopen64(const char *__filename, const char *__modes,
		       FILE * __stream);
extern int fscanf(FILE * __stream, const char *__format, ...);
extern int fseek(FILE * __stream, long int __off, int __whence);
extern int fseeko(FILE * __stream, off_t __off, int __whence);
extern int fseeko64(FILE * __stream, loff_t __off, int __whence);
extern int fsetpos(FILE * __stream, const fpos_t * __pos);
extern int fsetpos64(FILE * __stream, const fpos64_t * __pos);
extern long int ftell(FILE * __stream);
extern off_t ftello(FILE * __stream);
extern loff_t ftello64(FILE * __stream);
extern int ftrylockfile(FILE * __stream);
extern void funlockfile(FILE * __stream);
extern size_t fwrite(const void *__ptr, size_t __size, size_t __n,
		     FILE * __s);
extern size_t fwrite_unlocked(const void *__ptr, size_t __size, size_t __n,
			      FILE * __stream);
extern int getc(FILE * __stream);
extern int getc_unlocked(FILE * __stream);
extern int getchar(void);
extern int getchar_unlocked(void);
extern ssize_t getdelim(char **__lineptr, size_t * __n, int __delimiter,
			FILE * __stream);
extern ssize_t getline(char **__lineptr, size_t * __n, FILE * __stream);
extern int getw(FILE * __stream);
extern FILE *open_memstream(char **__bufloc, size_t * __sizeloc);
extern int pclose(FILE * __stream);
extern void perror(const char *__s);
extern FILE *popen(const char *__command, const char *__modes);
extern int printf(const char *__format, ...);
extern int putc(int __c, FILE * __stream);
extern int putc_unlocked(int __c, FILE * __stream);
extern int putchar(int __c);
extern int putchar_unlocked(int __c);
extern int puts(const char *__s);
extern int putw(int __w, FILE * __stream);
extern int remove(const char *__filename);
extern int renameat(int __oldfd, const char *__old, int __newfd,
		    const char *__new);
extern void rewind(FILE * __stream);
extern int scanf(const char *__format, ...);
extern void setbuf(FILE * __stream, char *__buf);
extern void setbuffer(FILE * __stream, char *__buf, size_t __size);
extern int setvbuf(FILE * __stream, char *__buf, int __modes, size_t __n);
extern int snprintf(char *__s, size_t __maxlen, const char *__format, ...);
extern int sprintf(char *__s, const char *__format, ...);
extern int sscanf(const char *__s, const char *__format, ...);
extern FILE *stderr;
extern FILE *stdin;
extern FILE *stdout;
extern char *tempnam(const char *__dir, const char *__pfx);
extern FILE *tmpfile(void);
extern FILE *tmpfile64(void);
extern char *tmpnam(char *__s);
extern int ungetc(int __c, FILE * __stream);
extern int vasprintf(char **__ptr, const char *__f, va_list __arg);
extern int vdprintf(int __fd, const char *__fmt, va_list __arg);
extern int vfprintf(FILE * __s, const char *__format, va_list __arg);
extern int vfscanf(FILE * __s, const char *__format, va_list __arg);
extern int vprintf(const char *__format, va_list __arg);
extern int vscanf(const char *__format, va_list __arg);
extern int vsnprintf(char *__s, size_t __maxlen, const char *__format,
		     va_list __arg);
extern int vsprintf(char *__s, const char *__format, va_list __arg);
extern int vsscanf(const char *__s, const char *__format, va_list __arg);

13.4.55. stdlib.h

#define MB_CUR_MAX	(__ctype_get_mb_cur_max())
#define EXIT_SUCCESS	0
#define EXIT_FAILURE	1
#define RAND_MAX	2147483647

struct drand48_data {
    unsigned short __x[3];
    unsigned short __old_x[3];
    unsigned short __c;
    unsigned short __init;
    unsigned long long int __a;
typedef int (*__compar_fn_t) (const void *, const void *);
struct random_data {
    int32_t *fptr;		/* Front pointer. */
    int32_t *rptr;		/* Rear pointer. */
    int32_t *state;		/* Array of state values. */
    int rand_type;		/* Type of random number generator. */
    int rand_deg;		/* Degree of random number generator. */
    int rand_sep;		/* Distance between front and rear. */
    int32_t *end_ptr;		/* Pointer behind state table. */

typedef struct {
    int quot;
    int rem;
} div_t;

typedef struct {
    long int quot;
    long int rem;
} ldiv_t;

typedef struct {
    long long int quot;
    long long int rem;
} lldiv_t;
extern void _Exit(int __status);
extern size_t __ctype_get_mb_cur_max(void);
extern size_t __mbstowcs_chk(wchar_t *, const char *, size_t, size_t);
extern char *__realpath_chk(const char *, char *, size_t);
extern double __strtod_internal(const char *, char **, int);
extern float __strtof_internal(const char *, char **, int);
extern long int __strtol_internal(const char *, char **, int, int);
extern long double __strtold_internal(const char *, char **, int);
extern long long int __strtoll_internal(const char *, char **, int, int);
extern unsigned long int __strtoul_internal(const char *, char **, int,
extern unsigned long long int __strtoull_internal(const char *, char **,
						  int, int);
extern size_t __wcstombs_chk(char *, const wchar_t *, size_t, size_t);
extern int __wctomb_chk(char *, wchar_t, size_t);
extern long int a64l(const char *__s);
extern void abort(void);
extern int abs(int __x);
extern double atof(const char *__nptr);
extern int atoi(const char *__nptr);
extern long int atol(const char *__nptr);
extern long long int atoll(const char *__nptr);
extern void *bsearch(const void *__key, const void *__base, size_t __nmemb,
		     size_t __size, __compar_fn_t __compar);
extern void *calloc(size_t __nmemb, size_t __size);
extern div_t div(int __numer, int __denom);
extern double drand48(void);
extern int drand48_r(struct drand48_data *__buffer, double *__result);
extern char *ecvt(double __value, int __ndigit, int *__decpt, int *__sign);
extern char **environ;
extern double erand48(unsigned short __xsubi[3]);
extern int erand48_r(unsigned short __xsubi[3],
		     struct drand48_data *__buffer, double *__result);
extern void exit(int __status);
extern char *fcvt(double __value, int __ndigit, int *__decpt, int *__sign);
extern void free(void *__ptr);
extern char *gcvt(double __value, int __ndigit, char *__buf);
extern char *getenv(const char *__name);
extern int getloadavg(double __loadavg[], int __nelem);
extern int getsubopt(char **__optionp, char *const *__tokens,
		     char **__valuep);
extern int grantpt(int __fd);
extern char *initstate(unsigned int __seed, char *__statebuf,
		       size_t __statelen);
extern int initstate_r(unsigned int __seed, char *__statebuf,
		       size_t __statelen, struct random_data *__buf);
extern long int jrand48(unsigned short __xsubi[3]);
extern int jrand48_r(unsigned short __xsubi[3],
		     struct drand48_data *__buffer, long int *__result);
extern char *l64a(long int __n);
extern long int labs(long int __x);
extern void lcong48(unsigned short __param[7]);
extern int lcong48_r(unsigned short __param[7],
		     struct drand48_data *__buffer);
extern ldiv_t ldiv(long int __numer, long int __denom);
extern long long int llabs(long long int __x);
extern lldiv_t lldiv(long long int __numer, long long int __denom);
extern long int lrand48(void);
extern int lrand48_r(struct drand48_data *__buffer, long int *__result);
extern void *malloc(size_t __size);
extern int mblen(const char *__s, size_t __n);
extern size_t mbstowcs(wchar_t * __pwcs, const char *__s, size_t __n);
extern int mbtowc(wchar_t * __pwc, const char *__s, size_t __n);
extern char *mkdtemp(char *__template);
extern int mkstemp64(char *__template);
extern char *mktemp(char *__template);
extern long int mrand48(void);
extern int mrand48_r(struct drand48_data *__buffer, long int *__result);
extern long int nrand48(unsigned short __xsubi[3]);
extern int nrand48_r(unsigned short __xsubi[3],
		     struct drand48_data *__buffer, long int *__result);
extern int posix_memalign(void **__memptr, size_t __alignment,
			  size_t __size);
extern int posix_openpt(int __oflag);
extern char *ptsname(int __fd);
extern int putenv(char *__string);
extern void qsort(void *__base, size_t __nmemb, size_t __size,
		  const __compar_fn_t __compar);
extern int rand(void);
extern int rand_r(unsigned int *__seed);
extern long int random(void);
extern int random_r(struct random_data *__buf, int32_t * __result);
extern void *realloc(void *__ptr, size_t __size);
extern char *realpath(const char *__name, char *__resolved);
extern unsigned short *seed48(unsigned short __seed16v[3]);
extern int seed48_r(unsigned short __seed16v[3],
		    struct drand48_data *__buffer);
extern int setenv(const char *__name, const char *__value, int __replace);
extern char *setstate(char *__statebuf);
extern int setstate_r(char *__statebuf, struct random_data *__buf);
extern void srand(unsigned int __seed);
extern void srand48(long int __seedval);
extern int srand48_r(long int __seedval, struct drand48_data *__buffer);
extern void srandom(unsigned int __seed);
extern int srandom_r(unsigned int __seed, struct random_data *__buf);
extern double strtod(const char *__nptr, char **__endptr);
extern float strtof(const char *__nptr, char **__endptr);
extern long int strtol(const char *__nptr, char **__endptr, int __base);
extern long double strtold(const char *__nptr, char **__endptr);
extern long long int strtoll(const char *__nptr, char **__endptr,
			     int __base);
extern long long int strtoq(const char *__nptr, char **__endptr,
			    int __base);
extern unsigned long int strtoul(const char *__nptr, char **__endptr,
				 int __base);
extern unsigned long long int strtoull(const char *__nptr, char **__endptr,
				       int __base);
extern unsigned long long int strtouq(const char *__nptr, char **__endptr,
				      int __base);
extern int system(const char *__command);
extern int unlockpt(int __fd);
extern int unsetenv(const char *__name);
extern size_t wcstombs(char *__s, const wchar_t * __pwcs, size_t __n);
extern int wctomb(char *__s, wchar_t __wchar);

13.4.56. string.h

#define strerror_r __xpg_strerror_r

extern void *__memcpy_chk(void *, const void *, size_t, size_t);
extern void *__memmove_chk(void *, const void *, size_t, size_t);
extern void *__mempcpy(void *__dest, const void *__src, size_t __n);
extern void *__mempcpy_chk(void *, const void *, size_t, size_t);
extern void *__memset_chk(void *, int, size_t, size_t);
extern char *__stpcpy(char *__dest, const char *__src);
extern char *__stpcpy_chk(char *, const char *, size_t);
extern char *__strcat_chk(char *, const char *, size_t);
extern char *__strcpy_chk(char *, const char *, size_t);
extern char *__strncat_chk(char *, const char *, size_t, size_t);
extern char *__strncpy_chk(char *, const char *, size_t, size_t);
extern char *__strtok_r(char *__s, const char *__delim, char **__save_ptr);
extern int __xpg_strerror_r(int, char *, size_t);
extern void *memccpy(void *__dest, const void *__src, int __c, size_t __n);
extern void *memchr(const void *__s, int __c, size_t __n);
extern int memcmp(const void *__s1, const void *__s2, size_t __n);
extern void *memcpy(void *__dest, const void *__src, size_t __n);
extern void *memmem(const void *__haystack, size_t __haystacklen,
		    const void *__needle, size_t __needlelen);
extern void *memmove(void *__dest, const void *__src, size_t __n);
extern void *memrchr(const void *__s, int __c, size_t __n);
extern void *memset(void *__s, int __c, size_t __n);
extern char *stpcpy(char *__dest, const char *__src);
extern char *stpncpy(char *__dest, const char *__src, size_t __n);
extern char *strcasestr(const char *__haystack, const char *__needle);
extern char *strcat(char *__dest, const char *__src);
extern char *strchr(const char *__s, int __c);
extern int strcmp(const char *__s1, const char *__s2);
extern int strcoll(const char *__s1, const char *__s2);
extern char *strcpy(char *__dest, const char *__src);
extern size_t strcspn(const char *__s, const char *__reject);
extern char *strdup(const char *__s);
extern char *strerror(int __errnum);
extern size_t strlen(const char *__s);
extern char *strncat(char *__dest, const char *__src, size_t __n);
extern int strncmp(const char *__s1, const char *__s2, size_t __n);
extern char *strncpy(char *__dest, const char *__src, size_t __n);
extern char *strndup(const char *__string, size_t __n);
extern size_t strnlen(const char *__string, size_t __maxlen);
extern char *strpbrk(const char *__s, const char *__accept);
extern char *strrchr(const char *__s, int __c);
extern char *strsep(char **__stringp, const char *__delim);
extern char *strsignal(int __sig);
extern size_t strspn(const char *__s, const char *__accept);
extern char *strstr(const char *__haystack, const char *__needle);
extern char *strtok(char *__s, const char *__delim);
extern char *strtok_r(char *__s, const char *__delim, char **__save_ptr);
extern size_t strxfrm(char *__dest, const char *__src, size_t __n);

13.4.57. strings.h

extern int bcmp(const void *__s1, const void *__s2, size_t __n);
extern void bcopy(const void *__src, void *__dest, size_t __n);
extern void bzero(void *__s, size_t __n);
extern int ffs(int __i);
extern char *index(const char *__s, int __c);
extern char *rindex(const char *__s, int __c);
extern int strcasecmp(const char *__s1, const char *__s2);
extern int strncasecmp(const char *__s1, const char *__s2, size_t __n);

13.4.58. sys/epoll.h

#define EPOLL_CTL_ADD	1	/* Add a file decriptor to the interface. */
#define EPOLL_CTL_DEL	2	/* Remove a file decriptor from the interface. */
#define EPOLL_CTL_MOD	3	/* Change file decriptor epoll_event structure. */
#define EPOLLIN	1
#define EPOLLPRI	2
#define EPOLLOUT	4
#define EPOLLERR	8
#define EPOLLHUP	16
#define EPOLLRDHUP	32
#define EPOLLONESHOT	(1 << 30)
#define EPOLLET	(1 << 31)

typedef union epoll_data {
    void *ptr;
    int fd;
    uint32_t u32;
    uint64_t u64;
} epoll_data_t;

struct epoll_event {
    uint32_t events;
    epoll_data_t data;
extern int epoll_create(int __size);
extern int epoll_ctl(int __epfd, int __op, int __fd,
		     struct epoll_event *__event);
extern int epoll_wait(int __epfd, struct epoll_event *__events,
		      int __maxevents, int __timeout);

13.4.59. sys/file.h

#define LOCK_SH	1
#define LOCK_EX	2
#define LOCK_NB	4
#define LOCK_UN	8

extern int flock(int __fd, int __operation);

13.4.60. sys/inotify.h

#define IN_ACCESS	0x00000001
#define IN_MODIFY	0x00000002
#define IN_ATTRIB	0x00000004
#define IN_CLOSE_WRITE	0x00000008
#define IN_CLOSE_NOWRITE	0x00000010
#define IN_OPEN	0x00000020
#define IN_MOVED_FROM	0x00000040
#define IN_MOVED_TO	0x00000080
#define IN_CREATE	0x00000100
#define IN_DELETE	0x00000200
#define IN_DELETE_SELF	0x00000400
#define IN_MOVE_SELF	0x00000800
#define IN_UNMOUNT	0x00002000
#define IN_Q_OVERFLOW	0x00004000
#define IN_IGNORED	0x00008000
#define IN_ISDIR	0x40000000
#define IN_ONESHOT	0x80000000
#define IN_ALL_EVENTS	 \

struct inotify_event {
    int wd;
    uint32_t mask;
    uint32_t cookie;
    uint32_t len;
    char name[];
extern int inotify_add_watch(int __fd, const char *__name,
			     uint32_t __mask);
extern int inotify_init(void);
extern int inotify_rm_watch(int __fd, uint32_t __wd);

13.4.61. sys/ioctl.h

struct winsize {
    unsigned short ws_row;	/* Rows, in characters. */
    unsigned short ws_col;	/* Columns, in characters. */
    unsigned short ws_xpixel;	/* Horizontal pixels. */
    unsigned short ws_ypixel;	/* Vertical pixels. */
extern int ioctl(int __fd, unsigned long int __request, ...);

13.4.62. sys/ipc.h

#define IPC_PRIVATE	((key_t)0)
#define IPC_RMID	0
#define IPC_CREAT	00001000
#define IPC_EXCL	00002000
#define IPC_NOWAIT	00004000
#define IPC_SET	1
#define IPC_STAT	2

extern key_t ftok(const char *__pathname, int __proj_id);

13.4.63. sys/mman.h

#define MAP_FAILED	((void*)-1)
#define PROT_NONE	0x0
#define MAP_SHARED	0x01
#define MAP_PRIVATE	0x02
#define PROT_READ	0x1
#define MAP_FIXED	0x10
#define PROT_WRITE	0x2
#define MAP_ANONYMOUS	0x20
#define PROT_EXEC	0x4
#define MS_ASYNC	1
#define MREMAP_FIXED	2
#define MS_SYNC	4

extern int mlock(const void *__addr, size_t __len);
extern int mlockall(int __flags);
extern void *mmap(void *__addr, size_t __len, int __prot, int __flags,
		  int __fd, off_t __offset);
extern void *mmap64(void *__addr, size_t __len, int __prot, int __flags,
		    int __fd, off64_t __offset);
extern int mprotect(void *__addr, size_t __len, int __prot);
extern void *mremap(void *__addr, size_t __old_len, size_t __new_len,
		    int __flags, ...);
extern int msync(void *__addr, size_t __len, int __flags);
extern int munlock(const void *__addr, size_t __len);
extern int munlockall(void);
extern int munmap(void *__addr, size_t __len);
extern int posix_madvise(void *__addr, size_t __len, int __advice);
extern int shm_open(const char *__name, int __oflag, mode_t __mode);
extern int shm_unlink(const char *__name);

13.4.64. sys/msg.h

#define MSG_NOERROR	010000

extern int msgctl(int __msqid, int __cmd, struct msqid_ds *__buf);
extern int msgget(key_t __key, int __msgflg);
extern ssize_t msgrcv(int __msqid, void *__msgp, size_t __msgsz,
		      long int __msgtyp, int __msgflg);
extern int msgsnd(int __msqid, const void *__msgp, size_t __msgsz,
		  int __msgflg);

13.4.65. sys/param.h

#define NOFILE	256
#define MAXPATHLEN	4096

13.4.66. sys/poll.h

#define POLLIN	0x0001		/* There is data to read */
#define POLLPRI	0x0002		/* There is urgent data to read */
#define POLLOUT	0x0004		/* Writing now will not block */
#define POLLERR	0x0008		/* Error condition */
#define POLLHUP	0x0010		/* Hung up */
#define POLLNVAL	0x0020	/* Invalid request: fd not open */
#define POLLRDNORM	0x0040	/* Normal data may be read */
#define POLLRDBAND	0x0080	/* Priority data may be read */
#define POLLWRNORM	0x0100	/* Writing now will not block */
#define POLLWRBAND	0x0200	/* Priority data may be written */

struct pollfd {
    int fd;			/* File descriptor to poll. */
    short events;		/* Types of events poller cares about. */
    short revents;		/* Types of events that actually occurred. */
typedef unsigned long int nfds_t;

13.4.67. sys/resource.h

#define RUSAGE_CHILDREN	(-1)
#define RLIM_INFINITY	(~0UL)
#define RLIM_SAVED_CUR	-1
#define RLIM_SAVED_MAX	-1
#define RLIMIT_CPU	0
#define RUSAGE_SELF	0
#define RLIMIT_FSIZE	1
#define RLIMIT_LOCKS	10
#define RLIM_NLIMITS	11
#define RLIMIT_DATA	2
#define RLIMIT_STACK	3
#define RLIMIT_CORE	4
#define RLIMIT_RSS	5
#define RLIMIT_NPROC	6
#define RLIMIT_AS	9

typedef unsigned long int rlim_t;
typedef unsigned long long int rlim64_t;
typedef int __rlimit_resource_t;

struct rlimit {
    rlim_t rlim_cur;		/* The current (soft) limit. */
    rlim_t rlim_max;		/* The hard limit. */
struct rlimit64 {
    rlim64_t rlim_cur;		/* The current (soft) limit. */
    rlim64_t rlim_max;		/* The hard limit. */

struct rusage {
    struct timeval ru_utime;	/* Total amount of user time used. */
    struct timeval ru_stime;	/* Total amount of system time used. */
    long int ru_maxrss;		/* Maximum resident set size (in kilobytes). */
    long int ru_ixrss;		/* Amount of sharing of text segment memory        with other p */
    long int ru_idrss;		/* Amount of data segment memory used (kilobyte-seconds). */
    long int ru_isrss;		/* Amount of stack memory used (kilobyte-seconds). */
    long int ru_minflt;		/* Number of soft page faults (i.e. those serviced by reclaimin */
    long int ru_majflt;		/* Number of hard page faults (i.e. those that required I/O). */
    long int ru_nswap;		/* Number of times a process was swapped out of physical memory */
    long int ru_inblock;	/* Number of input operations via the file system.  Note: This */
    long int ru_oublock;	/* Number of output operations via the file system. */
    long int ru_msgsnd;		/* Number of IPC messages sent. */
    long int ru_msgrcv;		/* Number of IPC messages received. */
    long int ru_nsignals;	/* Number of signals delivered. */
    long int ru_nvcsw;		/* Number of voluntary context switches, i.e. because the proce */
    long int ru_nivcsw;		/* Number of involuntary context switches, i.e. a higher priori */

enum __priority_which {
    PRIO_PROCESS = 0,		/* WHO is a process ID. */
    PRIO_PGRP = 1,		/* WHO is a process group ID. */
    PRIO_USER = 2		/* WHO is a user ID. */


typedef enum __priority_which __priority_which_t;
extern int getpriority(__priority_which_t __which, id_t __who);
extern int getrlimit(__rlimit_resource_t __resource,
		     struct rlimit *__rlimits);
extern int getrlimit64(id_t __resource, struct rlimit64 *__rlimits);
extern int getrusage(int __who, struct rusage *__usage);
extern int setpriority(__priority_which_t __which, id_t __who, int __prio);
extern int setrlimit(__rlimit_resource_t __resource,
		     const struct rlimit *__rlimits);
extern int setrlimit64(__rlimit_resource_t __resource,
		       const struct rlimit64 *__rlimits);

13.4.68. sys/select.h

#define NFDBITS	(8 * sizeof (long))

extern int pselect(int __nfds, fd_set * __readfds, fd_set * __writefds,
		   fd_set * __exceptfds, const struct timespec *__timeout,
		   const sigset_t * __sigmask);

13.4.69. sys/sem.h

#define SEM_UNDO	0x1000
#define GETPID	11
#define GETVAL	12
#define GETALL	13
#define GETNCNT	14
#define GETZCNT	15
#define SETVAL	16
#define SETALL	17

struct sembuf {
    short sem_num;
    short sem_op;
    short sem_flg;
extern int semctl(int __semid, int __semnum, int __cmd, ...);
extern int semget(key_t __key, int __nsems, int __semflg);
extern int semop(int __semid, struct sembuf *__sops, size_t __nsops);

13.4.70. sys/sendfile.h

extern ssize_t sendfile(int __out_fd, int __in_fd, off_t * __offset,
			size_t __count);
extern ssize_t sendfile64(int __out_fd, int __in_fd, off64_t * __offset,
			  size_t __count);

13.4.71. sys/shm.h

#define SHM_RDONLY	010000
#define SHM_W	0200
#define SHM_RND	020000
#define SHM_R	0400
#define SHM_REMAP	040000
#define SHM_LOCK	11
#define SHM_UNLOCK	12

extern int __getpagesize(void);
extern void *shmat(int __shmid, const void *__shmaddr, int __shmflg);
extern int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf);
extern int shmdt(const void *__shmaddr);
extern int shmget(key_t __key, size_t __size, int __shmflg);

13.4.72. sys/socket.h

#define CMSG_LEN(len)	(CMSG_ALIGN(sizeof(struct cmsghdr))+(len))
#define SCM_RIGHTS	0x01
#define SOL_SOCKET	1
#define SOMAXCONN	128
#define SOL_RAW	255
#define CMSG_ALIGN(len)	\
#define CMSG_DATA(cmsg)	\
	((unsigned char *) (cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)))
#define CMSG_SPACE(len)	\
	(CMSG_ALIGN(sizeof(struct cmsghdr))+CMSG_ALIGN(len))
#define CMSG_FIRSTHDR(msg)	\
           ((msg)->msg_controllen >= sizeof(struct cmsghdr) ? \
            (struct cmsghdr *)(msg)->msg_control : \
            (struct cmsghdr *)NULL)
#define CMSG_NXTHDR(mhdr,cmsg)	\
        (((cmsg) == NULL) ? CMSG_FIRSTHDR(mhdr) : \
         (((u_char *)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len) \
                            + CMSG_ALIGN(sizeof(struct cmsghdr)) > \
           (u_char *)((mhdr)->msg_control) + (mhdr)->msg_controllen) ? \
          (struct cmsghdr *)NULL : \
          (struct cmsghdr *)((u_char *)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len))))

struct linger {
    int l_onoff;
    int l_linger;
struct cmsghdr {
    size_t cmsg_len;
    int cmsg_level;
    int cmsg_type;
struct iovec {
    void *iov_base;
    size_t iov_len;

typedef unsigned short sa_family_t;
typedef unsigned int socklen_t;

struct sockaddr {
    sa_family_t sa_family;
    char sa_data[14];
struct sockaddr_storage {
    sa_family_t ss_family;
    __ss_aligntype __ss_align;
    char __ss_padding[(128 - (2 * sizeof(__ss_aligntype)))];

struct msghdr {
    void *msg_name;
    int msg_namelen;
    struct iovec *msg_iov;
    size_t msg_iovlen;
    void *msg_control;
    size_t msg_controllen;
    unsigned int msg_flags;

#define AF_UNSPEC	0
#define AF_UNIX	1
#define AF_INET6	10
#define AF_INET	2

#define PF_INET6	AF_INET6

#define SOCK_STREAM	1
#define SOCK_PACKET	10
#define SOCK_DGRAM	2
#define SOCK_RAW	3
#define SOCK_RDM	4

#define SO_DEBUG	1
#define SO_OOBINLINE	10
#define SO_NO_CHECK	11
#define SO_PRIORITY	12
#define SO_LINGER	13
#define SO_BSDCOMPAT	14
#define SO_REUSEADDR	2
#define SO_TYPE	3
#define SO_ACCEPTCONN	30
#define SO_ERROR	4
#define SO_DONTROUTE	5
#define SO_BROADCAST	6
#define SO_SNDBUF	7
#define SO_RCVBUF	8
#define SO_KEEPALIVE	9

#define SIOCGIFNAME	0x8910
#define SIOCGIFCONF	0x8912
#define SIOCGIFFLAGS	0x8913
#define SIOCGIFADDR	0x8915
#define SIOCGIFDSTADDR	0x8917
#define SIOCGIFBRDADDR	0x8919
#define SIOCGIFNETMASK	0x891b
#define SIOCGIFMTU	0x8921
#define SIOCGIFHWADDR	0x8927

#define SHUT_RD	0
#define SHUT_WR	1
#define SHUT_RDWR	2

#define MSG_WAITALL	0x100
#define MSG_TRUNC	0x20
#define MSG_NOSIGNAL	0x4000
#define MSG_EOR	0x80
#define MSG_OOB	1
#define MSG_PEEK	2
#define MSG_CTRUNC	8

extern ssize_t __recv_chk(int, void *, size_t, size_t, int);
extern ssize_t __recvfrom_chk(int, void *, size_t, size_t, int,
			      struct sockaddr *, socklen_t *);
extern int accept(int __fd, struct sockaddr *__addr,
		  socklen_t * __addr_len);
extern int bind(int __fd, const struct sockaddr *__addr, socklen_t __len);
extern int connect(int __fd, const struct sockaddr *__addr,
		   socklen_t __len);
extern int getnameinfo(const struct sockaddr *__sa, socklen_t __salen,
		       char *__host, socklen_t __hostlen, char *__serv,
		       socklen_t __servlen, unsigned int __flags);
extern int getpeername(int __fd, struct sockaddr *__addr,
		       socklen_t * __len);
extern int getsockname(int __fd, struct sockaddr *__addr,
		       socklen_t * __len);
extern int getsockopt(int __fd, int __level, int __optname, void *__optval,
		      socklen_t * __optlen);
extern int listen(int __fd, int __n);
extern ssize_t recv(int __fd, void *__buf, size_t __n, int __flags);
extern ssize_t recvfrom(int __fd, void *__buf, size_t __n, int __flags,
			struct sockaddr *__addr, socklen_t * __addr_len);
extern ssize_t recvmsg(int __fd, struct msghdr *__message, int __flags);
extern ssize_t send(int __fd, const void *__buf, size_t __n, int __flags);
extern ssize_t sendmsg(int __fd, const struct msghdr *__message,
		       int __flags);
extern ssize_t sendto(int __fd, const void *__buf, size_t __n, int __flags,
		      const struct sockaddr *__addr, socklen_t __addr_len);
extern int setsockopt(int __fd, int __level, int __optname,
		      const void *__optval, socklen_t __optlen);
extern int shutdown(int __fd, int __how);
extern int sockatmark(int __fd);
extern int socket(int __domain, int __type, int __protocol);
extern int socketpair(int __domain, int __type, int __protocol,
		      int __fds[2]);

13.4.73. sys/stat.h

#define S_ISBLK(m)	(((m)&S_IFMT)==S_IFBLK)
#define S_ISCHR(m)	(((m)&S_IFMT)==S_IFCHR)
#define S_ISDIR(m)	(((m)&S_IFMT)==S_IFDIR)
#define S_ISFIFO(m)	(((m)&S_IFMT)==S_IFIFO)
#define S_ISLNK(m)	(((m)&S_IFMT)==S_IFLNK)
#define S_ISREG(m)	(((m)&S_IFMT)==S_IFREG)
#define S_ISSOCK(m)	(((m)&S_IFMT)==S_IFSOCK)
#define S_TYPEISMQ(buf)	((buf)->st_mode - (buf)->st_mode)
#define S_TYPEISSEM(buf)	((buf)->st_mode - (buf)->st_mode)
#define S_TYPEISSHM(buf)	((buf)->st_mode - (buf)->st_mode)
#define S_IROTH	(S_IRGRP>>3)
#define S_IRGRP	(S_IRUSR>>3)
#define S_IRWXO	(S_IRWXG>>3)
#define S_IRWXG	(S_IRWXU>>3)
#define S_IWOTH	(S_IWGRP>>3)
#define S_IWGRP	(S_IWUSR>>3)
#define S_IXOTH	(S_IXGRP>>3)
#define S_IXGRP	(S_IXUSR>>3)
#define S_ISVTX	01000
#define S_IXUSR	0x0040
#define S_IWUSR	0x0080
#define S_IRUSR	0x0100
#define S_ISGID	0x0400
#define S_ISUID	0x0800
#define S_IFIFO	0x1000
#define S_IFCHR	0x2000
#define S_IFDIR	0x4000
#define S_IFBLK	0x6000
#define S_IFREG	0x8000
#define S_IFLNK	0xa000
#define S_IFSOCK	0xc000
#define S_IFMT	0xf000
#define st_atime	st_atim.tv_sec
#define st_ctime	st_ctim.tv_sec
#define st_mtime	st_mtim.tv_sec

extern int __fxstat(int __ver, int __fildes, struct stat *__stat_buf);
extern int __fxstat64(int __ver, int __fildes, struct stat64 *__stat_buf);
extern int __fxstatat(int __ver, int __fildes, const char *__filename,
		      struct stat *__stat_buf, int __flag);
extern int __fxstatat64(int __ver, int __fildes, const char *__filename,
			struct stat64 *__stat_buf, int __flag);
extern int __lxstat(int __ver, const char *__filename,
		    struct stat *__stat_buf);
extern int __lxstat64(int __ver, const char *__filename,
		      struct stat64 *__stat_buf);
extern int __xmknod(int __ver, const char *__path, mode_t __mode,
		    dev_t * __dev);
extern int __xmknodat(int __ver, int __fd, const char *__path,
		      mode_t __mode, dev_t * __dev);
extern int __xstat(int __ver, const char *__filename,
		   struct stat *__stat_buf);
extern int __xstat64(int __ver, const char *__filename,
		     struct stat64 *__stat_buf);
extern int chmod(const char *__file, mode_t __mode);
extern int fchmod(int __fd, mode_t __mode);
extern int fchmodat(int __fd, const char *__file, mode_t mode, int __flag);
extern int mkdirat(int __fd, const char *__path, mode_t __mode);
extern int mkfifo(const char *__path, mode_t __mode);
extern int mkfifoat(int __fd, const char *__path, mode_t __mode);
extern mode_t umask(mode_t __mask);

13.4.74. sys/statfs.h

#define NFS_SUPER_MAGIC	0x6969

extern int fstatfs(int __fildes, struct statfs *__buf);
extern int fstatfs64(int __fildes, struct statfs64 *__buf);
extern int statfs(const char *__file, struct statfs *__buf);
extern int statfs64(const char *__file, struct statfs64 *__buf);

13.4.75. sys/statvfs.h

extern int fstatvfs(int __fildes, struct statvfs *__buf);
extern int fstatvfs64(int __fildes, struct statvfs64 *__buf);
extern int statvfs(const char *__file, struct statvfs *__buf);
extern int statvfs64(const char *__file, struct statvfs64 *__buf);

13.4.76. sys/time.h

#define ITIMER_REAL	0
#define ITIMER_PROF	2

struct timezone {
    int tz_minuteswest;
    int tz_dsttime;

typedef int __itimer_which_t;

struct timespec {
    time_t tv_sec;
    long int tv_nsec;

struct timeval {
    time_t tv_sec;
    suseconds_t tv_usec;

struct itimerval {
    struct timeval it_interval;
    struct timeval it_value;
extern int adjtime(const struct timeval *__delta,
		   struct timeval *__olddelta);
extern int getitimer(__itimer_which_t __which, struct itimerval *__value);
extern int gettimeofday(struct timeval *__tv, struct timezone *__tz);
extern int setitimer(__itimer_which_t __which,
		     const struct itimerval *__new,
		     struct itimerval *__old);
extern int utimes(const char *__file, const struct timeval *__tvp);

13.4.77. sys/timeb.h

struct timeb {
    time_t time;		/* Seconds since epoch, as from time. */
    unsigned short millitm;	/* Additional milliseconds. */
    short timezone;		/* Minutes west of GMT. */
    short dstflag;		/* Nonzero if Daylight Savings Time used. */
extern int ftime(struct timeb *__timebuf);

13.4.78. sys/times.h

struct tms {
    clock_t tms_utime;
    clock_t tms_stime;
    clock_t tms_cutime;
    clock_t tms_cstime;
extern clock_t times(struct tms *__buffer);

13.4.79. sys/types.h

#ifndef FALSE
#define FALSE	0
#ifndef TRUE
#define TRUE	1
#define FD_SETSIZE	1024
#define FD_ZERO(fdsetp)	bzero(fdsetp, sizeof(*(fdsetp)))
#define FD_ISSET(d,set)	\
#define FD_CLR(d,set)	\
#define FD_SET(d,set)	\

typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
typedef unsigned long long int u_int64_t;
typedef unsigned int uid_t;
typedef int pid_t;
typedef long int off_t;
typedef int key_t;
typedef long int suseconds_t;
typedef unsigned int u_int;
typedef struct {
    int __val[2];
} fsid_t;
typedef unsigned int useconds_t;
typedef long int blksize_t;
typedef long int fd_mask;
typedef void *timer_t;
typedef int clockid_t;

typedef unsigned int id_t;

typedef unsigned long long int ino64_t;
typedef long long int loff_t;
typedef long int blkcnt_t;
typedef unsigned long int fsblkcnt_t;
typedef unsigned long int fsfilcnt_t;
typedef long long int blkcnt64_t;
typedef unsigned long long int fsblkcnt64_t;
typedef unsigned long long int fsfilcnt64_t;
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long int u_long;

typedef unsigned long int ino_t;
typedef unsigned int gid_t;
typedef unsigned long long int dev_t;
typedef unsigned int mode_t;
typedef unsigned long int nlink_t;
typedef char *caddr_t;

typedef struct {
    unsigned long int fds_bits[__FDSET_LONGS];
} fd_set;

typedef long int clock_t;
typedef long int time_t;

13.4.80. sys/uio.h

extern ssize_t readv(int __fd, const struct iovec *__iovec, int __count);
extern ssize_t writev(int __fd, const struct iovec *__iovec, int __count);

13.4.81. sys/un.h

#define UNIX_PATH_MAX	108

struct sockaddr_un {
    sa_family_t sun_family;	/* AF_UNIX */
    char sun_path[UNIX_PATH_MAX];

13.4.82. sys/utsname.h

#define SYS_NMLN	65

struct utsname {
    char sysname[65];
    char nodename[65];
    char release[65];
    char version[65];
    char machine[65];
    char domainname[65];
extern int uname(struct utsname *__name);

13.4.83. sys/wait.h

#define WIFSIGNALED(status)	(!WIFSTOPPED(status) && !WIFEXITED(status))
#define WIFSTOPPED(status)	(((status) & 0xff) == 0x7f)
#define WEXITSTATUS(status)	(((status) & 0xff00) >> 8)
#define WTERMSIG(status)	((status) & 0x7f)
#define WCOREDUMP(status)	((status) & 0x80)
#define WIFEXITED(status)	(WTERMSIG(status) == 0)
#define WNOHANG	0x00000001
#define WUNTRACED	0x00000002
#define WCOREFLAG	0x80
#define WSTOPSIG(status)	WEXITSTATUS(status)

typedef enum {
} idtype_t;
extern pid_t wait(int *__stat_loc);
extern pid_t wait4(pid_t __pid, int *__stat_loc, int __options,
		   struct rusage *__usage);
extern int waitid(idtype_t __idtype, id_t __id, siginfo_t * __infop,
		  int __options);
extern pid_t waitpid(pid_t __pid, int *__stat_loc, int __options);

13.4.84. syslog.h

#define LOG_MAKEPRI(fac, pri)	(((fac) << 3) | (pri))
#define LOG_PRI(p)	((p) & LOG_PRIMASK)	/* extract priority */
#define LOG_EMERG	0	/* system is unusable */
#define LOG_PRIMASK	0x07	/* mask to extract priority part */
#define LOG_ALERT	1	/* action must be taken immediately */
#define LOG_CRIT	2	/* critical conditions */
#define LOG_ERR	3		/* error conditions */
#define LOG_WARNING	4	/* warning conditions */
#define LOG_NOTICE	5	/* normal but significant condition */
#define LOG_INFO	6	/* informational */
#define LOG_DEBUG	7	/* debug-level messages */

#define LOG_FAC(p)	(((p) & LOG_FACMASK) >> 3)	/* facility of pri */
#define LOG_KERN	(0<<3)	/* kernel messages */
#define LOG_AUTHPRIV	(10<<3)	/* security/authorization messages (private) */
#define LOG_FTP	(11<<3)		/* ftp daemon */
#define LOG_USER	(1<<3)	/* random user-level messages */
#define LOG_MAIL	(2<<3)	/* mail system */
#define LOG_DAEMON	(3<<3)	/* system daemons */
#define LOG_AUTH	(4<<3)	/* security/authorization messages */
#define LOG_SYSLOG	(5<<3)	/* messages generated internally by syslogd */
#define LOG_LPR	(6<<3)		/* line printer subsystem */
#define LOG_NEWS	(7<<3)	/* network news subsystem */
#define LOG_UUCP	(8<<3)	/* UUCP subsystem */
#define LOG_CRON	(9<<3)	/* clock daemon */
#define LOG_FACMASK	0x03f8	/* mask to extract facility part */

#define LOG_LOCAL0	(16<<3)	/* reserved for local use */
#define LOG_LOCAL1	(17<<3)	/* reserved for local use */
#define LOG_LOCAL2	(18<<3)	/* reserved for local use */
#define LOG_LOCAL3	(19<<3)	/* reserved for local use */
#define LOG_LOCAL4	(20<<3)	/* reserved for local use */
#define LOG_LOCAL5	(21<<3)	/* reserved for local use */
#define LOG_LOCAL6	(22<<3)	/* reserved for local use */
#define LOG_LOCAL7	(23<<3)	/* reserved for local use */

#define LOG_UPTO(pri)	((1 << ((pri)+1)) - 1)	/* all priorities through pri */
#define LOG_MASK(pri)	(1 << (pri))	/* mask for one priority */

#define LOG_PID	0x01		/* log the pid with each message */
#define LOG_CONS	0x02	/* log on the console if errors in sending */
#define LOG_ODELAY	0x04	/* delay open until first syslog() (default) */
#define LOG_NDELAY	0x08	/* don't delay open */
#define LOG_NOWAIT	0x10	/* don't wait for console forks: DEPRECATED */
#define LOG_PERROR	0x20	/* log to stderr as well */

extern void __syslog_chk(int, int, const char *, ...);
extern void __vsyslog_chk(int, int, const char *, va_list);
extern void closelog(void);
extern void openlog(const char *__ident, int __option, int __facility);
extern int setlogmask(int __mask);
extern void syslog(int __pri, const char *__fmt, ...);
extern void vsyslog(int __pri, const char *__fmt, va_list __ap);

13.4.85. tar.h

#define REGTYPE	'0'
#define LNKTYPE	'1'
#define SYMTYPE	'2'
#define CHRTYPE	'3'
#define BLKTYPE	'4'
#define DIRTYPE	'5'
#define FIFOTYPE	'6'
#define CONTTYPE	'7'
#define AREGTYPE	'\0'
#define TVERSION	"00"
#define TOEXEC	00001
#define TOWRITE	00002
#define TOREAD	00004
#define TGEXEC	00010
#define TGWRITE	00020
#define TGREAD	00040
#define TUEXEC	00100
#define TUWRITE	00200
#define TUREAD	00400
#define TSVTX	01000
#define TSGID	02000
#define TSUID	04000
#define TVERSLEN	2
#define TMAGLEN	6
#define TMAGIC	"ustar"

13.4.86. termios.h

#define TCIFLUSH	0
#define TCOOFF	0
#define TCSANOW	0
#define BS0	0000000
#define CR0	0000000
#define FF0	0000000
#define NL0	0000000
#define TAB0	0000000
#define VT0	0000000
#define OPOST	0000001
#define OCRNL	0000010
#define ONOCR	0000020
#define ONLRET	0000040
#define OFILL	0000100
#define OFDEL	0000200
#define NL1	0000400
#define TCOFLUSH	1
#define TCOON	1
#define TCSADRAIN	1
#define TCIOFF	2
#define TCIOFLUSH	2
#define TCSAFLUSH	2
#define TCION	3

typedef unsigned int speed_t;
typedef unsigned char cc_t;
typedef unsigned int tcflag_t;

#define NCCS	32

struct termios {
    tcflag_t c_iflag;		/* input mode flags */
    tcflag_t c_oflag;		/* output mode flags */
    tcflag_t c_cflag;		/* control mode flags */
    tcflag_t c_lflag;		/* local mode flags */
    cc_t c_line;		/* line discipline */
    cc_t c_cc[NCCS];		/* control characters */
    speed_t c_ispeed;		/* input speed */
    speed_t c_ospeed;		/* output speed */

#define VINTR	0
#define VQUIT	1
#define VLNEXT	15
#define VERASE	2
#define VKILL	3
#define VEOF	4

#define IGNBRK	0000001
#define BRKINT	0000002
#define IGNPAR	0000004
#define PARMRK	0000010
#define INPCK	0000020
#define ISTRIP	0000040
#define INLCR	0000100
#define IGNCR	0000200
#define ICRNL	0000400
#define IXANY	0004000
#define IMAXBEL	0020000

#define CS5	0000000

#define ECHO	0000010

#define B0	0000000
#define B50	0000001
#define B75	0000002
#define B110	0000003
#define B134	0000004
#define B150	0000005
#define B200	0000006
#define B300	0000007
#define B600	0000010
#define B1200	0000011
#define B1800	0000012
#define B2400	0000013
#define B4800	0000014
#define B9600	0000015
#define B19200	0000016
#define B38400	0000017

extern speed_t cfgetispeed(const struct termios *__termios_p);
extern speed_t cfgetospeed(const struct termios *__termios_p);
extern void cfmakeraw(struct termios *__termios_p);
extern int cfsetispeed(struct termios *__termios_p, speed_t __speed);
extern int cfsetospeed(struct termios *__termios_p, speed_t __speed);
extern int cfsetspeed(struct termios *__termios_p, speed_t __speed);
extern int tcdrain(int __fd);
extern int tcflow(int __fd, int __action);
extern int tcflush(int __fd, int __queue_selector);
extern int tcgetattr(int __fd, struct termios *__termios_p);
extern pid_t tcgetsid(int __fd);
extern int tcsendbreak(int __fd, int __duration);
extern int tcsetattr(int __fd, int __optional_actions,
		     const struct termios *__termios_p);

13.4.87. time.h

#define CLK_TCK	((clock_t)sysconf(2))
#define CLOCKS_PER_SEC	1000000l

struct tm {
    int tm_sec;
    int tm_min;
    int tm_hour;
    int tm_mday;
    int tm_mon;
    int tm_year;
    int tm_wday;
    int tm_yday;
    int tm_isdst;
    long int tm_gmtoff;
    char *tm_zone;
struct itimerspec {
    struct timespec it_interval;
    struct timespec it_value;

extern int __daylight;
extern long int __timezone;
extern char *__tzname[];
extern char *asctime(const struct tm *__tp);
extern char *asctime_r(const struct tm *__tp, char *__buf);
extern clock_t clock(void);
extern int clock_getcpuclockid(pid_t __pid, clockid_t * __clock_id);
extern int clock_getres(clockid_t __clock_id, struct timespec *__res);
extern int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
extern int clock_nanosleep(clockid_t __clock_id, int __flags,
			   const struct timespec *__req,
			   struct timespec *__rem);
extern int clock_settime(clockid_t __clock_id,
			 const struct timespec *__tp);
extern char *ctime(const time_t * __timer);
extern char *ctime_r(const time_t * __timer, char *__buf);
extern int daylight;
extern double difftime(time_t __time1, time_t __time0);
extern struct tm *getdate(const char *__string);
extern int getdate_err;
extern struct tm *gmtime(const time_t * __timer);
extern struct tm *gmtime_r(const time_t * __timer, struct tm *__tp);
extern struct tm *localtime(const time_t * __timer);
extern struct tm *localtime_r(const time_t * __timer, struct tm *__tp);
extern time_t mktime(struct tm *__tp);
extern int nanosleep(const struct timespec *__requested_time,
		     struct timespec *__remaining);
extern int stime(const time_t * __when);
extern size_t strftime(char *__s, size_t __maxsize, const char *__format,
		       const struct tm *__tp);
extern char *strptime(const char *__s, const char *__fmt, struct tm *__tp);
extern time_t time(time_t * __timer);
extern int timer_create(clockid_t __clock_id, struct sigevent *__evp,
			timer_t * __timerid);
extern int timer_delete(timer_t __timerid);
extern int timer_getoverrun(timer_t __timerid);
extern int timer_gettime(timer_t __timerid, struct itimerspec *__value);
extern int timer_settime(timer_t __timerid, int __flags,
			 const struct itimerspec *__value,
			 struct itimerspec *__ovalue);
extern long int timezone;
extern char *tzname[];
extern void tzset(void);

13.4.88. ucontext.h

extern int getcontext(ucontext_t * __ucp);
extern void makecontext(ucontext_t * __ucp, void (*__func) (void),
			int __argc, ...);
extern int setcontext(const struct ucontext *__ucp);
extern int swapcontext(ucontext_t * __oucp, const struct ucontext *__ucp);

13.4.89. ulimit.h

#define UL_GETFSIZE	1
#define UL_SETFSIZE	2

extern long int ulimit(int __cmd, ...);

13.4.90. unistd.h

#define SEEK_SET	0
#define STDIN_FILENO	0
#define SEEK_CUR	1
#define SEEK_END	2

typedef long long int off64_t;

#define F_OK	0
#define X_OK	1
#define W_OK	2
#define R_OK	4

#define _POSIX_VDISABLE	'\0'
#define _POSIX_NO_TRUNC	1
#define _POSIX_SHELL	1
#define _POSIX_FSYNC	200112
#define _POSIX_MAPPED_FILES	200112
#define _POSIX_MEMLOCK	200112
#define _POSIX_MEMLOCK_RANGE	200112
#define _POSIX_SEMAPHORES	200112
#define _POSIX_TIMERS	200112
#define _POSIX2_C_BIND	200112L
#define _POSIX2_VERSION	200112L
#define _POSIX_THREADS	200112L
#define _POSIX_VERSION	200112L

#define _PC_LINK_MAX	0
#define _PC_MAX_CANON	1
#define _PC_ASYNC_IO	10
#define _PC_PRIO_IO	11
#define _PC_REC_MIN_XFER_SIZE	16
#define _PC_REC_XFER_ALIGN	17
#define _PC_ALLOC_SIZE_MIN	18
#define _PC_MAX_INPUT	2
#define _PC_2_SYMLINKS	20
#define _PC_NAME_MAX	3
#define _PC_PATH_MAX	4
#define _PC_PIPE_BUF	5
#define _PC_NO_TRUNC	7
#define _PC_VDISABLE	8
#define _PC_SYNC_IO	9

#define _SC_ARG_MAX	0
#define _SC_CHILD_MAX	1
#define _SC_XOPEN_XPG4	100
#define _SC_CHAR_BIT	101
#define _SC_CHAR_MAX	102
#define _SC_CHAR_MIN	103
#define _SC_INT_MAX	104
#define _SC_INT_MIN	105
#define _SC_LONG_BIT	106
#define _SC_WORD_BIT	107
#define _SC_MB_LEN_MAX	108
#define _SC_NZERO	109
#define _SC_TIMERS	11
#define _SC_SSIZE_MAX	110
#define _SC_SCHAR_MAX	111
#define _SC_SCHAR_MIN	112
#define _SC_SHRT_MAX	113
#define _SC_SHRT_MIN	114
#define _SC_UCHAR_MAX	115
#define _SC_UINT_MAX	116
#define _SC_ULONG_MAX	117
#define _SC_USHRT_MAX	118
#define _SC_NL_ARGMAX	119
#define _SC_NL_LANGMAX	120
#define _SC_NL_MSGMAX	121
#define _SC_NL_NMAX	122
#define _SC_NL_SETMAX	123
#define _SC_NL_TEXTMAX	124
#define _SC_XBS5_ILP32_OFF32	125
#define _SC_XBS5_ILP32_OFFBIG	126
#define _SC_XBS5_LP64_OFF64	127
#define _SC_XBS5_LPBIG_OFFBIG	128
#define _SC_XOPEN_LEGACY	129
#define _SC_XOPEN_REALTIME	130
#define _SC_ADVISORY_INFO	132
#define _SC_BARRIERS	133
#define _SC_BASE	134
#define _SC_C_LANG_SUPPORT	135
#define _SC_C_LANG_SUPPORT_R	136
#define _SC_CPUTIME	138
#define _SC_THREAD_CPUTIME	139
#define _SC_DEVICE_IO	140
#define _SC_FD_MGMT	143
#define _SC_FIFO	144
#define _SC_PIPE	145
#define _SC_FILE_LOCKING	147
#define _SC_FILE_SYSTEM	148
#define _SC_FSYNC	15
#define _SC_MULTI_PROCESS	150
#define _SC_SINGLE_PROCESS	151
#define _SC_NETWORKING	152
#define _SC_SPIN_LOCKS	154
#define _SC_REGEXP	155
#define _SC_REGEX_VERSION	156
#define _SC_SHELL	157
#define _SC_SIGNALS	158
#define _SC_SPAWN	159
#define _SC_MAPPED_FILES	16
#define _SC_TIMEOUTS	164
#define _SC_USER_GROUPS	166
#define _SC_USER_GROUPS_R	167
#define _SC_2_PBS	168
#define _SC_2_PBS_ACCOUNTING	169
#define _SC_MEMLOCK	17
#define _SC_2_PBS_LOCATE	170
#define _SC_2_PBS_MESSAGE	171
#define _SC_2_PBS_TRACK	172
#define _SC_SYMLOOP_MAX	173
#define _SC_STREAMS	174
#define _SC_2_PBS_CHECKPOINT	175
#define _SC_V6_ILP32_OFF32	176
#define _SC_V6_ILP32_OFFBIG	177
#define _SC_V6_LP64_OFF64	178
#define _SC_V6_LPBIG_OFFBIG	179
#define _SC_MEMLOCK_RANGE	18
#define _SC_HOST_NAME_MAX	180
#define _SC_TRACE	181
#define _SC_TRACE_INHERIT	183
#define _SC_TRACE_LOG	184
#define _SC_LEVEL1_ICACHE_SIZE	185
#define _SC_LEVEL1_DCACHE_SIZE	188
#define _SC_LEVEL2_CACHE_SIZE	191
#define _SC_LEVEL2_CACHE_ASSOC	192
#define _SC_LEVEL3_CACHE_SIZE	194
#define _SC_LEVEL3_CACHE_ASSOC	195
#define _SC_LEVEL4_CACHE_SIZE	197
#define _SC_LEVEL4_CACHE_ASSOC	198
#define _SC_CLK_TCK	2
#define _SC_SEMAPHORES	21
#define _SC_AIO_LISTIO_MAX	23
#define _SC_IPV6	235
#define _SC_RAW_SOCKETS	236
#define _SC_AIO_MAX	24
#define _SC_MQ_OPEN_MAX	27
#define _SC_MQ_PRIO_MAX	28
#define _SC_VERSION	29
#define _SC_NGROUPS_MAX	3
#define _SC_PAGESIZE	30
#define _SC_PAGE_SIZE	30
#define _SC_RTSIG_MAX	31
#define _SC_SEM_NSEMS_MAX	32
#define _SC_SEM_VALUE_MAX	33
#define _SC_SIGQUEUE_MAX	34
#define _SC_TIMER_MAX	35
#define _SC_BC_BASE_MAX	36
#define _SC_BC_DIM_MAX	37
#define _SC_BC_SCALE_MAX	38
#define _SC_BC_STRING_MAX	39
#define _SC_OPEN_MAX	4
#define _SC_EQUIV_CLASS_MAX	41
#define _SC_EXPR_NEST_MAX	42
#define _SC_LINE_MAX	43
#define _SC_RE_DUP_MAX	44
#define _SC_2_VERSION	46
#define _SC_2_C_BIND	47
#define _SC_2_C_DEV	48
#define _SC_2_FORT_DEV	49
#define _SC_STREAM_MAX	5
#define _SC_2_FORT_RUN	50
#define _SC_2_SW_DEV	51
#define _SC_2_LOCALEDEF	52
#define _SC_PII	53
#define _SC_PII_XTI	54
#define _SC_PII_SOCKET	55
#define _SC_PII_INTERNET	56
#define _SC_PII_OSI	57
#define _SC_POLL	58
#define _SC_SELECT	59
#define _SC_TZNAME_MAX	6
#define _SC_IOV_MAX	60
#define _SC_UIO_MAXIOV	60
#define _SC_PII_OSI_COTS	63
#define _SC_PII_OSI_CLTS	64
#define _SC_PII_OSI_M	65
#define _SC_T_IOV_MAX	66
#define _SC_THREADS	67
#define _SC_GETGR_R_SIZE_MAX	69
#define _SC_JOB_CONTROL	7
#define _SC_GETPW_R_SIZE_MAX	70
#define _SC_LOGIN_NAME_MAX	71
#define _SC_TTY_NAME_MAX	72
#define _SC_THREAD_KEYS_MAX	74
#define _SC_SAVED_IDS	8
#define _SC_PHYS_PAGES	85
#define _SC_AVPHYS_PAGES	86
#define _SC_ATEXIT_MAX	87
#define _SC_PASS_MAX	88
#define _SC_XOPEN_VERSION	89
#define _SC_XOPEN_UNIX	91
#define _SC_XOPEN_CRYPT	92
#define _SC_XOPEN_ENH_I18N	93
#define _SC_XOPEN_SHM	94
#define _SC_2_CHAR_TERM	95
#define _SC_2_C_VERSION	96
#define _SC_2_UPE	97
#define _SC_XOPEN_XPG2	98
#define _SC_XOPEN_XPG3	99

#define _CS_PATH	0
#define _POSIX_REGEXP	1
#define _CS_XBS5_ILP32_OFF32_CFLAGS	1100
#define _CS_XBS5_ILP32_OFF32_LDFLAGS	1101
#define _CS_XBS5_ILP32_OFF32_LIBS	1102
#define _CS_XBS5_ILP32_OFF32_LINTFLAGS	1103
#define _CS_XBS5_ILP32_OFFBIG_CFLAGS	1104
#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS	1105
#define _CS_XBS5_ILP32_OFFBIG_LIBS	1106
#define _CS_XBS5_LP64_OFF64_CFLAGS	1108
#define _CS_XBS5_LP64_OFF64_LDFLAGS	1109
#define _CS_XBS5_LP64_OFF64_LIBS	1110
#define _CS_XBS5_LP64_OFF64_LINTFLAGS	1111

#define _XOPEN_XPG4	1
#define _XOPEN_VERSION	500

#define F_ULOCK	0
#define F_LOCK	1
#define F_TLOCK	2
#define F_TEST	3

extern size_t __confstr_chk(int, char *, size_t, size_t);
extern char **__environ;
extern char *__getcwd_chk(char *, size_t, size_t);
extern int __getgroups_chk(int, gid_t *, size_t);
extern int __gethostname_chk(char *, size_t, size_t);
extern int __getlogin_r_chk(char *, size_t, size_t);
extern pid_t __getpgid(pid_t __pid);
extern ssize_t __pread64_chk(int, void *, size_t, off64_t, size_t);
extern ssize_t __pread_chk(int, void *, size_t, off_t, size_t);
extern ssize_t __read_chk(int, void *, size_t, size_t);
extern ssize_t __readlink_chk(const char *, char *, size_t, size_t);
extern int __ttyname_r_chk(int, char *, size_t, size_t);
extern char **_environ;
extern void _exit(int __status);
extern int access(const char *__name, int __type);
extern int acct(const char *__name);
extern unsigned int alarm(unsigned int __seconds);
extern int brk(void *__addr);
extern int chdir(const char *__path);
extern int chown(const char *__file, uid_t __owner, gid_t __group);
extern int chroot(const char *__path);
extern int close(int __fd);
extern size_t confstr(int __name, char *__buf, size_t __len);
extern char *crypt(const char *__key, const char *__salt);
extern char *ctermid(char *__s);
extern char *cuserid(char *__s);
extern int daemon(int __nochdir, int __noclose);
extern int dup(int __fd);
extern int dup2(int __fd, int __fd2);
extern void encrypt(char *__block, int __edflag);
extern int execl(const char *__path, const char *__arg, ...);
extern int execle(const char *__path, const char *__arg, ...);
extern int execlp(const char *__file, const char *__arg, ...);
extern int execv(const char *__path, char *const __argv[]);
extern int execve(const char *__path, char *const __argv[],
		  char *const __envp[]);
extern int execvp(const char *__file, char *const __argv[]);
extern int faccessat(int __fd, const char *__file, int __type, int __flag);
extern int fchdir(int __fd);
extern int fchown(int __fd, uid_t __owner, gid_t __group);
extern int fchownat(int __fd, const char *__file, uid_t __owner,
		    gid_t __group, int __flag);
extern int fdatasync(int __fildes);
extern int fexecve(int __fd, char *const __argv[], char *const __envp[]);
extern pid_t fork(void);
extern long int fpathconf(int __fd, int __name);
extern int fsync(int __fd);
extern int ftruncate(int __fd, off_t __length);
extern int ftruncate64(int __fd, off64_t __length);
extern char *getcwd(char *__buf, size_t __size);
extern int getdomainname(char *__name, size_t __len);
extern int getdtablesize(void);
extern gid_t getegid(void);
extern uid_t geteuid(void);
extern gid_t getgid(void);
extern int getgroups(int __size, gid_t __list[]);
extern long int gethostid(void);
extern int gethostname(char *__name, size_t __len);
extern char *getlogin(void);
extern int getlogin_r(char *__name, size_t __name_len);
extern int getopt(int ___argc, char *const ___argv[],
		  const char *__shortopts);
extern int getpagesize(void);
extern pid_t getpgid(pid_t __pid);
extern pid_t getpgrp(void);
extern pid_t getpid(void);
extern pid_t getppid(void);
extern pid_t getsid(pid_t __pid);
extern uid_t getuid(void);
extern char *getwd(char *__buf);
extern int isatty(int __fd);
extern int lchown(const char *__file, uid_t __owner, gid_t __group);
extern int link(const char *__from, const char *__to);
extern int linkat(int __fromfd, const char *__from, int __tofd,
		  const char *__to, int __flags);
extern int lockf(int __fd, int __cmd, off_t __len);
extern int lockf64(int __fd, int __cmd, off64_t __len);
extern off_t lseek(int __fd, off_t __offset, int __whence);
extern loff_t lseek64(int __fd, loff_t __offset, int __whence);
extern int mkdir(const char *__path, mode_t __mode);
extern int mkstemp(char *__template);
extern int nice(int __inc);
extern char *optarg;
extern int opterr;
extern int optind;
extern int optopt;
extern long int pathconf(const char *__path, int __name);
extern int pause(void);
extern int pipe(int __pipedes[2]);
extern ssize_t pread(int __fd, void *__buf, size_t __nbytes,
		     off_t __offset);
extern ssize_t pread64(int __fd, void *__buf, size_t __nbytes,
		       off64_t __offset);
extern ssize_t pwrite(int __fd, const void *__buf, size_t __n,
		      off_t __offset);
extern ssize_t pwrite64(int __fd, const void *__buf, size_t __n,
			off64_t __offset);
extern ssize_t read(int __fd, void *__buf, size_t __nbytes);
extern ssize_t readlink(const char *__path, char *__buf, size_t __len);
extern ssize_t readlinkat(int __fd, const char *__path, char *__buf,
			  size_t __len);
extern int rename(const char *__old, const char *__new);
extern int rmdir(const char *__path);
extern void *sbrk(intptr_t __delta);
extern int select(int __nfds, fd_set * __readfds, fd_set * __writefds,
		  fd_set * __exceptfds, struct timeval *__timeout);
extern int setegid(gid_t __gid);
extern int seteuid(uid_t __uid);
extern int setgid(gid_t __gid);
extern int sethostname(const char *__name, size_t __len);
extern void setkey(const char *__key);
extern int setpgid(pid_t __pid, pid_t __pgid);
extern int setpgrp(void);
extern int setregid(gid_t __rgid, gid_t __egid);
extern int setreuid(uid_t __ruid, uid_t __euid);
extern pid_t setsid(void);
extern int setuid(uid_t __uid);
extern unsigned int sleep(unsigned int __seconds);
extern void swab(const void *__from, void *__to, ssize_t __n);
extern int symlink(const char *__from, const char *__to);
extern int symlinkat(const char *__from, int __tofd, const char *__to);
extern void sync(void);
extern long int sysconf(int __name);
extern pid_t tcgetpgrp(int __fd);
extern int tcsetpgrp(int __fd, pid_t __pgrp_id);
extern int truncate(const char *__file, off_t __length);
extern int truncate64(const char *__file, off64_t __length);
extern char *ttyname(int __fd);
extern int ttyname_r(int __fd, char *__buf, size_t __buflen);
extern unsigned int ualarm(useconds_t __value, useconds_t __interval);
extern int unlink(const char *__name);
extern int unlinkat(int __fd, const char *__name, int __flag);
extern int usleep(useconds_t __useconds);
extern pid_t vfork(void);
extern ssize_t write(int __fd, const void *__buf, size_t __n);

13.4.91. utime.h

struct utimbuf {
    time_t actime;
    time_t modtime;
extern int utime(const char *__file, const struct utimbuf *__file_times);

13.4.92. utmp.h

#define UT_HOSTSIZE	256
#define UT_LINESIZE	32
#define UT_NAMESIZE	32
#define ut_addr	ut_addr_v6[0]
#define ut_time	ut_tv.tv_sec
#define ut_name	ut_user		/* Backwards compatability */

struct exit_status {
    short e_termination;	/* Process termination status. */
    short e_exit;		/* Process exit status. */

#define EMPTY	0		/* No valid user accounting information. */
#define RUN_LVL	1		/* The system's runlevel. */
#define BOOT_TIME	2	/* Time of system boot. */
#define NEW_TIME	3	/* Time after system clock changed. */
#define OLD_TIME	4	/* Time when system clock changed. */
#define INIT_PROCESS	5	/* Process spawned by the init process. */
#define LOGIN_PROCESS	6	/* Session leader of a logged in user. */
#define USER_PROCESS	7	/* Normal process. */
#define DEAD_PROCESS	8	/* Terminated process. */
#define ACCOUNTING	9

extern void endutent(void);
extern struct utmp *getutent(void);
extern int getutent_r(struct utmp *__buffer, struct utmp **__result);
extern void login(const struct utmp *__entry);
extern int login_tty(int __fd);
extern int logout(const char *__ut_line);
extern void logwtmp(const char *__ut_line, const char *__ut_name,
		    const char *__ut_host);
extern void setutent(void);
extern int utmpname(const char *__file);

13.4.93. utmpx.h

extern void endutxent(void);
extern struct utmpx *getutxent(void);
extern struct utmpx *getutxid(const struct utmpx *__id);
extern struct utmpx *getutxline(const struct utmpx *__line);
extern struct utmpx *pututxline(const struct utmpx *__utmpx);
extern void setutxent(void);

13.4.94. wchar.h

#define WEOF	(0xffffffffu)
#define WCHAR_MIN	0x80000000

extern wchar_t *__fgetws_chk(wchar_t *, size_t, int, FILE *);
extern wchar_t *__fgetws_unlocked_chk(wchar_t *, size_t, int, FILE *);
extern int __fwprintf_chk(FILE *, int, const wchar_t *, ...);
extern size_t __mbsnrtowcs_chk(wchar_t *, const char **, size_t, size_t,
			       mbstate_t *, size_t);
extern size_t __mbsrtowcs_chk(wchar_t *, const char **, size_t,
			      mbstate_t *, size_t);
extern int __swprintf_chk(wchar_t *, size_t, int, size_t, const wchar_t *,
extern int __vfwprintf_chk(FILE *, int, const wchar_t *, va_list);
extern int __vswprintf_chk(wchar_t *, size_t, int, size_t, const wchar_t *,
extern int __vwprintf_chk(int, const wchar_t *, va_list);
extern wchar_t *__wcpcpy_chk(wchar_t *, const wchar_t *, size_t);
extern wchar_t *__wcpncpy_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern size_t __wcrtomb_chk(char *, wchar_t, mbstate_t *, size_t);
extern wchar_t *__wcscat_chk(wchar_t *, const wchar_t *, size_t);
extern wchar_t *__wcscpy_chk(wchar_t *, const wchar_t *, size_t);
extern wchar_t *__wcsncat_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern wchar_t *__wcsncpy_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern size_t __wcsnrtombs_chk(char *, const wchar_t * *, size_t, size_t,
			       mbstate_t *, size_t);
extern size_t __wcsrtombs_chk(char *, const wchar_t * *, size_t,
			      mbstate_t *, size_t);
extern double __wcstod_internal(const wchar_t *, wchar_t * *, int);
extern float __wcstof_internal(const wchar_t *, wchar_t * *, int);
extern long int __wcstol_internal(const wchar_t *, wchar_t * *, int, int);
extern long double __wcstold_internal(const wchar_t *, wchar_t * *, int);
extern unsigned long int __wcstoul_internal(const wchar_t *, wchar_t * *,
					    int, int);
extern wchar_t *__wmemcpy_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern wchar_t *__wmemmove_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern wchar_t *__wmempcpy_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern wchar_t *__wmemset_chk(wchar_t *, wchar_t, size_t, size_t);
extern int __wprintf_chk(int, const wchar_t *, ...);
extern wint_t btowc(int __c);
extern wint_t fgetwc(FILE * __stream);
extern wint_t fgetwc_unlocked(FILE * __stream);
extern wchar_t *fgetws(wchar_t * __ws, int __n, FILE * __stream);
extern wchar_t *fgetws_unlocked(wchar_t * __ws, int __n, FILE * __stream);
extern wint_t fputwc(wchar_t __wc, FILE * __stream);
extern wint_t fputwc_unlocked(wchar_t __wc, FILE * __stream);
extern int fputws(const wchar_t * __ws, FILE * __stream);
extern int fputws_unlocked(const wchar_t * __ws, FILE * __stream);
extern int fwide(FILE * __fp, int __mode);
extern int fwprintf(FILE * __stream, const wchar_t * __format, ...);
extern int fwscanf(FILE * __stream, const wchar_t * __format, ...);
extern wint_t getwc(FILE * __stream);
extern wint_t getwc_unlocked(FILE * __stream);
extern wint_t getwchar(void);
extern wint_t getwchar_unlocked(void);
extern size_t mbrlen(const char *__s, size_t __n, mbstate_t * __ps);
extern size_t mbrtowc(wchar_t * __pwc, const char *__s, size_t __n,
		      mbstate_t * __p);
extern int mbsinit(const mbstate_t * __ps);
extern size_t mbsnrtowcs(wchar_t * __dst, const char **__src, size_t __nmc,
			 size_t __len, mbstate_t * __ps);
extern size_t mbsrtowcs(wchar_t * __dst, const char **__src, size_t __len,
			mbstate_t * __ps);
extern FILE *open_wmemstream(wchar_t * *__bufloc, size_t * __sizeloc);
extern wint_t putwc(wchar_t __wc, FILE * __stream);
extern wint_t putwc_unlocked(wchar_t __wc, FILE * __stream);
extern wint_t putwchar(wchar_t __wc);
extern wint_t putwchar_unlocked(wchar_t __wc);
extern int swprintf(wchar_t * __s, size_t __n, const wchar_t * __format,
extern int swscanf(const wchar_t * __s, const wchar_t * __format, ...);
extern wint_t ungetwc(wint_t __wc, FILE * __stream);
extern int vfwprintf(FILE * __s, const wchar_t * __format, va_list __arg);
extern int vfwscanf(FILE * __s, const wchar_t * __format, va_list __arg);
extern int vswprintf(wchar_t * __s, size_t __n, const wchar_t * __format,
		     va_list __arg);
extern int vswscanf(const wchar_t * __s, const wchar_t * __format,
		    va_list __arg);
extern int vwprintf(const wchar_t * __format, va_list __arg);
extern int vwscanf(const wchar_t * __format, va_list __arg);
extern wchar_t *wcpcpy(wchar_t * __dest, const wchar_t * __src);
extern wchar_t *wcpncpy(wchar_t * __dest, const wchar_t * __src,
			size_t __n);
extern size_t wcrtomb(char *__s, wchar_t __wc, mbstate_t * __ps);
extern int wcscasecmp(const wchar_t * __s1, const wchar_t * __s2);
extern wchar_t *wcscat(wchar_t * __dest, const wchar_t * __src);
extern wchar_t *wcschr(const wchar_t * __wcs, wchar_t __wc);
extern int wcscmp(const wchar_t * __s1, const wchar_t * __s2);
extern int wcscoll(const wchar_t * __s1, const wchar_t * __s2);
extern wchar_t *wcscpy(wchar_t * __dest, const wchar_t * __src);
extern size_t wcscspn(const wchar_t * __wcs, const wchar_t * __reject);
extern wchar_t *wcsdup(const wchar_t * __s);
extern size_t wcsftime(wchar_t * __s, size_t __maxsize,
		       const wchar_t * __format, const struct tm *__tp);
extern size_t wcslen(const wchar_t * __s);
extern int wcsncasecmp(const wchar_t * __s1, const wchar_t * __s2,
		       size_t __n);
extern wchar_t *wcsncat(wchar_t * __dest, const wchar_t * __src,
			size_t __n);
extern int wcsncmp(const wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern wchar_t *wcsncpy(wchar_t * __dest, const wchar_t * __src,
			size_t __n);
extern size_t wcsnlen(const wchar_t * __s, size_t __maxlen);
extern size_t wcsnrtombs(char *__dst, const wchar_t * *__src, size_t __nwc,
			 size_t __len, mbstate_t * __ps);
extern wchar_t *wcspbrk(const wchar_t * __wcs, const wchar_t * __accept);
extern wchar_t *wcsrchr(const wchar_t * __wcs, wchar_t __wc);
extern size_t wcsrtombs(char *__dst, const wchar_t * *__src, size_t __len,
			mbstate_t * __ps);
extern size_t wcsspn(const wchar_t * __wcs, const wchar_t * __accept);
extern wchar_t *wcsstr(const wchar_t * __haystack,
		       const wchar_t * __needle);
extern double wcstod(const wchar_t * __nptr, wchar_t * *__endptr);
extern float wcstof(const wchar_t * __nptr, wchar_t * *__endptr);
extern wchar_t *wcstok(wchar_t * __s, const wchar_t * __delim,
		       wchar_t * *__ptr);
extern long int wcstol(const wchar_t * __nptr, wchar_t * *__endptr,
		       int __base);
extern long double wcstold(const wchar_t * __nptr, wchar_t * *__endptr);
extern long long int wcstoll(const wchar_t * __nptr, wchar_t * *__endptr,
			     int __base);
extern long long int wcstoq(const wchar_t * __nptr, wchar_t * *__endptr,
			    int __base);
extern unsigned long int wcstoul(const wchar_t * __nptr,
				 wchar_t * *__endptr, int __base);
extern unsigned long long int wcstoull(const wchar_t * __nptr,
				       wchar_t * *__endptr, int __base);
extern unsigned long long int wcstouq(const wchar_t * __nptr,
				      wchar_t * *__endptr, int __base);
extern wchar_t *wcswcs(const wchar_t * __haystack,
		       const wchar_t * __needle);
extern int wcswidth(const wchar_t * __s, size_t __n);
extern size_t wcsxfrm(wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern int wctob(wint_t __c);
extern int wcwidth(wchar_t __c);
extern wchar_t *wmemchr(const wchar_t * __s, wchar_t __c, size_t __n);
extern int wmemcmp(const wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern wchar_t *wmemcpy(wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern wchar_t *wmemmove(wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern wchar_t *wmemset(wchar_t * __s, wchar_t __c, size_t __n);
extern int wprintf(const wchar_t * __format, ...);
extern int wscanf(const wchar_t * __format, ...);

13.4.95. wctype.h

typedef unsigned long int wctype_t;
typedef unsigned int wint_t;
typedef const int32_t *wctrans_t;
typedef struct {
    int count;
    wint_t value;
} __mbstate_t;

typedef __mbstate_t mbstate_t;
extern int iswalnum(wint_t __wc);
extern int iswalpha(wint_t __wc);
extern int iswblank(wint_t __wc);
extern int iswcntrl(wint_t __wc);
extern int iswctype(wint_t __wc, wctype_t __desc);
extern int iswdigit(wint_t __wc);
extern int iswgraph(wint_t __wc);
extern int iswlower(wint_t __wc);
extern int iswprint(wint_t __wc);
extern int iswpunct(wint_t __wc);
extern int iswspace(wint_t __wc);
extern int iswupper(wint_t __wc);
extern int iswxdigit(wint_t __wc);
extern wint_t towctrans(wint_t __wc, wctrans_t __desc);
extern wint_t towlower(wint_t __wc);
extern wint_t towupper(wint_t __wc);
extern wctrans_t wctrans(const char *__property);
extern wctype_t wctype(const char *__property);

13.4.96. wordexp.h

enum {
    WRDE_DOOFFS = 1,
    WRDE_APPEND = 2,
    WRDE_NOCMD = 4,
    WRDE_REUSE = 8,
    WRDE_SHOWERR = 16,
    WRDE_UNDEF = 32

typedef struct {
    size_t we_wordc;
    char **we_wordv;
    size_t we_offs;
} wordexp_t;

enum {
    WRDE_NOSYS = -1,
    WRDE_BADVAL = 3,
    WRDE_CMDSUB = 4,
extern int wordexp(const char *__words, wordexp_t * __pwordexp,
		   int __flags);
extern void wordfree(wordexp_t * __wordexp);