From 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Thu, 8 Jun 2017 15:39:03 -0400 Subject: Prepare for radical source tree reorganization. All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control). --- REORG.TODO/sysdeps/gnu/Makefile | 89 ++ REORG.TODO/sysdeps/gnu/bits/ipc.h | 51 + REORG.TODO/sysdeps/gnu/bits/msq.h | 76 ++ REORG.TODO/sysdeps/gnu/bits/sem.h | 87 ++ REORG.TODO/sysdeps/gnu/bits/shm.h | 95 ++ REORG.TODO/sysdeps/gnu/bits/utmp.h | 123 +++ REORG.TODO/sysdeps/gnu/bits/utmpx.h | 102 ++ REORG.TODO/sysdeps/gnu/configure | 37 + REORG.TODO/sysdeps/gnu/configure.ac | 26 + REORG.TODO/sysdeps/gnu/errlist-compat.awk | 133 +++ REORG.TODO/sysdeps/gnu/errlist.awk | 110 +++ REORG.TODO/sysdeps/gnu/errlist.c | 1482 +++++++++++++++++++++++++++++ REORG.TODO/sysdeps/gnu/getutmp.c | 34 + REORG.TODO/sysdeps/gnu/getutmpx.c | 1 + REORG.TODO/sysdeps/gnu/glob64.c | 25 + REORG.TODO/sysdeps/gnu/ifaddrs.c | 164 ++++ REORG.TODO/sysdeps/gnu/ldsodefs.h | 48 + REORG.TODO/sysdeps/gnu/net/if.h | 204 ++++ REORG.TODO/sysdeps/gnu/netinet/ip_icmp.h | 282 ++++++ REORG.TODO/sysdeps/gnu/netinet/tcp.h | 324 +++++++ REORG.TODO/sysdeps/gnu/netinet/udp.h | 94 ++ REORG.TODO/sysdeps/gnu/rt-unwind-resume.c | 1 + REORG.TODO/sysdeps/gnu/siglist.c | 78 ++ REORG.TODO/sysdeps/gnu/sys/mtio.h | 276 ++++++ REORG.TODO/sysdeps/gnu/unwind-resume.c | 82 ++ REORG.TODO/sysdeps/gnu/updwtmp.c | 29 + REORG.TODO/sysdeps/gnu/utmp_file.c | 29 + REORG.TODO/sysdeps/gnu/utmpx.h | 125 +++ 28 files changed, 4207 insertions(+) create mode 100644 REORG.TODO/sysdeps/gnu/Makefile create mode 100644 REORG.TODO/sysdeps/gnu/bits/ipc.h create mode 100644 REORG.TODO/sysdeps/gnu/bits/msq.h create mode 100644 REORG.TODO/sysdeps/gnu/bits/sem.h create mode 100644 REORG.TODO/sysdeps/gnu/bits/shm.h create mode 100644 REORG.TODO/sysdeps/gnu/bits/utmp.h create mode 100644 REORG.TODO/sysdeps/gnu/bits/utmpx.h create mode 100644 REORG.TODO/sysdeps/gnu/configure create mode 100644 REORG.TODO/sysdeps/gnu/configure.ac create mode 100644 REORG.TODO/sysdeps/gnu/errlist-compat.awk create mode 100644 REORG.TODO/sysdeps/gnu/errlist.awk create mode 100644 REORG.TODO/sysdeps/gnu/errlist.c create mode 100644 REORG.TODO/sysdeps/gnu/getutmp.c create mode 100644 REORG.TODO/sysdeps/gnu/getutmpx.c create mode 100644 REORG.TODO/sysdeps/gnu/glob64.c create mode 100644 REORG.TODO/sysdeps/gnu/ifaddrs.c create mode 100644 REORG.TODO/sysdeps/gnu/ldsodefs.h create mode 100644 REORG.TODO/sysdeps/gnu/net/if.h create mode 100644 REORG.TODO/sysdeps/gnu/netinet/ip_icmp.h create mode 100644 REORG.TODO/sysdeps/gnu/netinet/tcp.h create mode 100644 REORG.TODO/sysdeps/gnu/netinet/udp.h create mode 100644 REORG.TODO/sysdeps/gnu/rt-unwind-resume.c create mode 100644 REORG.TODO/sysdeps/gnu/siglist.c create mode 100644 REORG.TODO/sysdeps/gnu/sys/mtio.h create mode 100644 REORG.TODO/sysdeps/gnu/unwind-resume.c create mode 100644 REORG.TODO/sysdeps/gnu/updwtmp.c create mode 100644 REORG.TODO/sysdeps/gnu/utmp_file.c create mode 100644 REORG.TODO/sysdeps/gnu/utmpx.h (limited to 'REORG.TODO/sysdeps/gnu') diff --git a/REORG.TODO/sysdeps/gnu/Makefile b/REORG.TODO/sysdeps/gnu/Makefile new file mode 100644 index 0000000000..da6ddab150 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/Makefile @@ -0,0 +1,89 @@ +# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +# Generate the list of strings for errno codes from the section of the +# manual which documents the codes. + +$(..)sysdeps/gnu/errlist.c: $(..)sysdeps/gnu/errlist.awk \ + $(..)manual/errno.texi + $(AWK) -f $^ > $@-tmp +# Make it unwritable so noone will edit it by mistake. + -chmod a-w $@-tmp + mv -f $@-tmp $@ + +ifeq ($(subdir),stdio-common) + +errlist-c = $(firstword $(wildcard $(addsuffix /errlist.c,$(sysdirs) .))) + +libof-errlist-compat = extramodules + +ifeq ($(build-shared),yes) +$(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \ + $(common-objpfx)Versions.v.i $(before-compile) +else +$(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \ + $(before-compile) +endif + $(make-target-directory) + $(AWK) -v maxerr=`\ + $(CC) -S $(CPPFLAGS) $(CFLAGS) -DEMIT_ERR_MAX $< -o - \ + | sed -n 's/^.*@@@[^0-9]*\([0-9]*\)[^0-9]*@@@.*$$/\1/p'` \ + -f $(..)sysdeps/gnu/errlist-compat.awk \ + $(wildcard $(sysdirs:=/Versions)) > $@T +# Make it unwritable so noone will edit it by mistake. + -chmod a-w $@T + mv -f $@T $@ +$(objpfx)errlist-compat.h: $(objpfx)errlist-compat.c + sed -n '1p;/ERR_MAX/p' $< > $@T + -chmod a-w $@T + mv -f $@T $@ +generated += errlist-compat.c errlist-compat.h + +# This will force the generation above to happy if need be. +$(foreach o,$(object-suffixes) $(object-suffixes:=.d),\ + $(objpfx)errlist$o): $(objpfx)errlist-compat.h +endif + +ifeq ($(subdir),login) +sysdep_routines += setutxent getutxent endutxent getutxid getutxline \ + pututxline utmpxname updwtmpx getutmpx getutmp + +sysdep_headers += utmpx.h bits/utmpx.h +endif + + +ifeq ($(subdir),inet) +sysdep_headers += netinet/udp.h netinet/ip_icmp.h +endif + + +ifeq ($(subdir),misc) +sysdep_headers += sys/mtio.h +endif + + +ifeq ($(subdir),csu) +routines += unwind-resume +shared-only-routines += unwind-resume +CFLAGS-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables +endif + +ifeq ($(subdir),rt) +librt-sysdep_routines += rt-unwind-resume +librt-shared-only-routines += rt-unwind-resume +CFLAGS-rt-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables +endif diff --git a/REORG.TODO/sysdeps/gnu/bits/ipc.h b/REORG.TODO/sysdeps/gnu/bits/ipc.h new file mode 100644 index 0000000000..c83f0fc3f8 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/bits/ipc.h @@ -0,0 +1,51 @@ +/* Copyright (C) 1995-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_IPC_H +# error "Never use directly; include instead." +#endif + +#include + +/* Mode bits for `msgget', `semget', and `shmget'. */ +#define IPC_CREAT 01000 /* Create key if key does not exist. */ +#define IPC_EXCL 02000 /* Fail if key exists. */ +#define IPC_NOWAIT 04000 /* Return error on wait. */ + +/* Control commands for `msgctl', `semctl', and `shmctl'. */ +#define IPC_RMID 0 /* Remove identifier. */ +#define IPC_SET 1 /* Set `ipc_perm' options. */ +#define IPC_STAT 2 /* Get `ipc_perm' options. */ +#ifdef __USE_GNU +# define IPC_INFO 3 /* See ipcs. */ +#endif + +/* Special key values. */ +#define IPC_PRIVATE ((__key_t) 0) /* Private key. */ + + +/* Data structure used to pass permission information to IPC operations. */ +struct ipc_perm + { + __key_t __key; /* Key. */ + unsigned short int uid; /* Owner's user ID. */ + unsigned short int gid; /* Owner's group ID. */ + unsigned short int cuid; /* Creator's user ID. */ + unsigned short int cgid; /* Creator's group ID. */ + unsigned short int mode; /* Read/write permission. */ + unsigned short int __seq; /* Sequence number. */ + }; diff --git a/REORG.TODO/sysdeps/gnu/bits/msq.h b/REORG.TODO/sysdeps/gnu/bits/msq.h new file mode 100644 index 0000000000..a2f3b8d27c --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/bits/msq.h @@ -0,0 +1,76 @@ +/* Copyright (C) 1995-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_MSG_H +# error "Never use directly; include instead." +#endif + +#include +#include + +/* Define options for message queue functions. */ +#define MSG_NOERROR 010000 /* no error if message is too big */ +#ifdef __USE_GNU +# define MSG_EXCEPT 020000 /* recv any msg except of specified type */ +#endif + +/* Types used in the structure definition. */ +typedef unsigned short int msgqnum_t; +typedef unsigned short int msglen_t; + + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ + struct ipc_perm msg_perm; /* structure describing operation permission */ + struct msg *__msg_first; /* pointer to first message on queue */ + struct msg *__msg_last; /* pointer to last message on queue */ + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgrcv command */ + __time_t msg_ctime; /* time of last change */ + struct wait_queue *__wwait; /* ??? */ + struct wait_queue *__rwait; /* ??? */ + unsigned short int __msg_cbytes;/* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __ipc_pid_t msg_lspid; /* pid of last msgsnd() */ + __ipc_pid_t msg_lrpid; /* pid of last msgrcv() */ +}; + +#ifdef __USE_MISC + +# define msg_cbytes __msg_cbytes + +/* ipcs ctl commands */ +# define MSG_STAT 11 +# define MSG_INFO 12 + +/* buffer for msgctl calls IPC_INFO, MSG_INFO */ +struct msginfo + { + int msgpool; + int msgmap; + int msgmax; + int msgmnb; + int msgmni; + int msgssz; + int msgtql; + unsigned short int msgseg; + }; + +#endif /* __USE_MISC */ diff --git a/REORG.TODO/sysdeps/gnu/bits/sem.h b/REORG.TODO/sysdeps/gnu/bits/sem.h new file mode 100644 index 0000000000..3667572f84 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/bits/sem.h @@ -0,0 +1,87 @@ +/* Copyright (C) 1995-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +#include + +/* Flags for `semop'. */ +#define SEM_UNDO 0x1000 /* undo the operation on exit */ + +/* Commands for `semctl'. */ +#define GETPID 11 /* get sempid */ +#define GETVAL 12 /* get semval */ +#define GETALL 13 /* get all semval's */ +#define GETNCNT 14 /* get semncnt */ +#define GETZCNT 15 /* get semzcnt */ +#define SETVAL 16 /* set semval */ +#define SETALL 17 /* set all semval's */ + + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ + struct ipc_perm sem_perm; /* operation permission struct */ + __time_t sem_otime; /* last semop() time */ + __time_t sem_ctime; /* last time changed by semctl() */ + struct sem *__sembase; /* ptr to first semaphore in array */ + struct __sem_queue *__sem_pending; /* pending operations */ + struct __sem_queue *__sem_pending_last;/* last pending operation */ + struct __sem_undo *__undo; /* ondo requests on this array */ + unsigned short int sem_nsems; /* number of semaphores in set */ +}; + + +/* The user should define a union like the following to use it for arguments + for `semctl'. + + union semun + { + int val; <= value for SETVAL + struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET + unsigned short int *array; <= array for GETALL & SETALL + struct seminfo *__buf; <= buffer for IPC_INFO + }; + + Previous versions of this file used to define this union but this is + incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether + one must define the union or not. */ +#define _SEM_SEMUN_UNDEFINED 1 + +#ifdef __USE_MISC + +/* ipcs ctl cmds */ +# define SEM_STAT 18 +# define SEM_INFO 19 + +struct seminfo +{ + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvmx; + int semaem; +}; + +#endif /* __USE_MISC */ diff --git a/REORG.TODO/sysdeps/gnu/bits/shm.h b/REORG.TODO/sysdeps/gnu/bits/shm.h new file mode 100644 index 0000000000..27eabb5e64 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/bits/shm.h @@ -0,0 +1,95 @@ +/* Copyright (C) 1995-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_SHM_H +# error "Never include directly; use instead." +#endif + +#include +#include + +/* Permission flag for shmget. */ +#define SHM_R 0400 /* or S_IRUGO from */ +#define SHM_W 0200 /* or S_IWUGO from */ + +/* Flags for `shmat'. */ +#define SHM_RDONLY 010000 /* attach read-only else read-write */ +#define SHM_RND 020000 /* round attach address to SHMLBA */ +#define SHM_REMAP 040000 /* take-over region on attach */ + +/* Commands for `shmctl'. */ +#define SHM_LOCK 11 /* lock segment (root only) */ +#define SHM_UNLOCK 12 /* unlock segment (root only) */ + +__BEGIN_DECLS + +/* Segment low boundary address multiple. */ +#define SHMLBA (__getpagesize ()) +extern int __getpagesize (void) __THROW __attribute__ ((__const__)); + + +/* Type to count number of attaches. */ +typedef unsigned short int shmatt_t; + +/* Data structure describing a shared memory segment. */ +struct shmid_ds + { + struct ipc_perm shm_perm; /* operation permission struct */ + int shm_segsz; /* size of segment in bytes */ + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ + __ipc_pid_t shm_cpid; /* pid of creator */ + __ipc_pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ + unsigned short int __shm_npages; /* size of segment (pages) */ + unsigned long int *__shm_pages; /* array of ptrs to frames -> SHMMAX */ + struct vm_area_struct *__attaches; /* descriptors for attaches */ + }; + +#ifdef __USE_MISC + +/* ipcs ctl commands */ +# define SHM_STAT 13 +# define SHM_INFO 14 + +/* shm_mode upper byte flags */ +# define SHM_DEST 01000 /* segment will be destroyed on last detach */ +# define SHM_LOCKED 02000 /* segment will not be swapped */ + +struct shminfo + { + int shmmax; + int shmmin; + int shmmni; + int shmseg; + int shmall; + }; + +struct shm_info + { + int used_ids; + unsigned long int shm_tot; /* total allocated shm */ + unsigned long int shm_rss; /* total resident shm */ + unsigned long int shm_swp; /* total swapped shm */ + unsigned long int swap_attempts; + unsigned long int swap_successes; + }; + +#endif /* __USE_MISC */ + +__END_DECLS diff --git a/REORG.TODO/sysdeps/gnu/bits/utmp.h b/REORG.TODO/sysdeps/gnu/bits/utmp.h new file mode 100644 index 0000000000..2ee11cb706 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/bits/utmp.h @@ -0,0 +1,123 @@ +/* The `struct utmp' type, describing entries in the utmp file. GNU version. + Copyright (C) 1993-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _UTMP_H +# error "Never include directly; use instead." +#endif + +#include +#include +#include +#include + + +#define UT_LINESIZE 32 +#define UT_NAMESIZE 32 +#define UT_HOSTSIZE 256 + + +/* The structure describing an entry in the database of + previous logins. */ +struct lastlog + { +#if __WORDSIZE_TIME64_COMPAT32 + int32_t ll_time; +#else + __time_t ll_time; +#endif + char ll_line[UT_LINESIZE]; + char ll_host[UT_HOSTSIZE]; + }; + + +/* The structure describing the status of a terminated process. This + type is used in `struct utmp' below. */ +struct exit_status + { + short int e_termination; /* Process termination status. */ + short int e_exit; /* Process exit status. */ + }; + + +/* The structure describing an entry in the user accounting database. */ +struct utmp +{ + short int ut_type; /* Type of login. */ + pid_t ut_pid; /* Process ID of login process. */ + char ut_line[UT_LINESIZE]; /* Devicename. */ + char ut_id[4]; /* Inittab ID. */ + char ut_user[UT_NAMESIZE]; /* Username. */ + char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */ + struct exit_status ut_exit; /* Exit status of a process marked + as DEAD_PROCESS. */ +/* The ut_session and ut_tv fields must be the same size when compiled + 32- and 64-bit. This allows data files and shared memory to be + shared between 32- and 64-bit applications. */ +#if __WORDSIZE_TIME64_COMPAT32 + int32_t ut_session; /* Session ID, used for windowing. */ + struct + { + int32_t tv_sec; /* Seconds. */ + int32_t tv_usec; /* Microseconds. */ + } ut_tv; /* Time entry was made. */ +#else + long int ut_session; /* Session ID, used for windowing. */ + struct timeval ut_tv; /* Time entry was made. */ +#endif + + int32_t ut_addr_v6[4]; /* Internet address of remote host. */ + char __glibc_reserved[20]; /* Reserved for future use. */ +}; + +/* Backwards compatibility hacks. */ +#define ut_name ut_user +#ifndef _NO_UT_TIME +/* We have a problem here: `ut_time' is also used otherwise. Define + _NO_UT_TIME if the compiler complains. */ +# define ut_time ut_tv.tv_sec +#endif +#define ut_xtime ut_tv.tv_sec +#define ut_addr ut_addr_v6[0] + + +/* Values for the `ut_type' field of a `struct utmp'. */ +#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 + +/* Old Linux name for the EMPTY type. */ +#define UT_UNKNOWN EMPTY + + +/* Tell the user that we have a modern system with UT_HOST, UT_PID, + UT_TYPE, UT_ID and UT_TV fields. */ +#define _HAVE_UT_TYPE 1 +#define _HAVE_UT_PID 1 +#define _HAVE_UT_ID 1 +#define _HAVE_UT_TV 1 +#define _HAVE_UT_HOST 1 diff --git a/REORG.TODO/sysdeps/gnu/bits/utmpx.h b/REORG.TODO/sysdeps/gnu/bits/utmpx.h new file mode 100644 index 0000000000..3d947563c9 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/bits/utmpx.h @@ -0,0 +1,102 @@ +/* Structures and definitions for the user accounting database. GNU version. + Copyright (C) 1997-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _UTMPX_H +# error "Never include directly; use instead." +#endif + +#include +#include +#include + + +#ifdef __USE_GNU +# include +# define _PATH_UTMPX _PATH_UTMP +# define _PATH_WTMPX _PATH_WTMP +#endif + + +#define __UT_LINESIZE 32 +#define __UT_NAMESIZE 32 +#define __UT_HOSTSIZE 256 + + +/* The structure describing the status of a terminated process. This + type is used in `struct utmpx' below. */ +struct __exit_status + { +#ifdef __USE_GNU + short int e_termination; /* Process termination status. */ + short int e_exit; /* Process exit status. */ +#else + short int __e_termination; /* Process termination status. */ + short int __e_exit; /* Process exit status. */ +#endif + }; + + +/* The structure describing an entry in the user accounting database. */ +struct utmpx +{ + short int ut_type; /* Type of login. */ + __pid_t ut_pid; /* Process ID of login process. */ + char ut_line[__UT_LINESIZE]; /* Devicename. */ + char ut_id[4]; /* Inittab ID. */ + char ut_user[__UT_NAMESIZE]; /* Username. */ + char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */ + struct __exit_status ut_exit; /* Exit status of a process marked + as DEAD_PROCESS. */ + +/* The fields ut_session and ut_tv must be the same size when compiled + 32- and 64-bit. This allows files and shared memory to be shared + between 32- and 64-bit applications. */ +#if __WORDSIZE_TIME64_COMPAT32 + __int32_t ut_session; /* Session ID, used for windowing. */ + struct + { + __int32_t tv_sec; /* Seconds. */ + __int32_t tv_usec; /* Microseconds. */ + } ut_tv; /* Time entry was made. */ +#else + long int ut_session; /* Session ID, used for windowing. */ + struct timeval ut_tv; /* Time entry was made. */ +#endif + __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ + char __glibc_reserved[20]; /* Reserved for future use. */ +}; + + +/* Values for the `ut_type' field of a `struct utmpx'. */ +#define EMPTY 0 /* No valid user accounting information. */ + +#ifdef __USE_GNU +# define RUN_LVL 1 /* The system's runlevel. */ +#endif +#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. */ + +#ifdef __USE_GNU +# define ACCOUNTING 9 /* System accounting. */ +#endif diff --git a/REORG.TODO/sysdeps/gnu/configure b/REORG.TODO/sysdeps/gnu/configure new file mode 100644 index 0000000000..71243ad0c6 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/configure @@ -0,0 +1,37 @@ +# This file is generated from configure.ac by Autoconf. DO NOT EDIT! + +# Local configure fragment for sysdeps/gnu. + +# The Filesystem Hierarchy Standard prescribes where to place "essential" +# files. I.e., when the installation prefix is "/usr" we have to place +# shared library objects and the configuration files on the root partition +# in /lib and /etc. +test -n "$libc_cv_slibdir" || +case "$prefix" in +/usr | /usr/) + libc_cv_slibdir=/lib + libc_cv_rtlddir=/lib + if test "$libdir" = '${exec_prefix}/lib'; then + libdir='${exec_prefix}/lib'; + # Locale data can be shared between 32-bit and 64-bit libraries. + libc_cv_complocaledir='${exec_prefix}/lib/locale' + fi + ;; +esac +case "$prefix" in +/usr | /usr/) + # Allow the user to override the path with --sysconfdir. + if test "$sysconfdir" = '${prefix}/etc'; then + libc_cv_sysconfdir=/etc + else + libc_cv_sysconfdir=$sysconfdir + fi + # Allow the user to override the path with --localstatedir. + if test "$localstatedir" = '${prefix}/var'; then + libc_cv_localstatedir=/var + else + libc_cv_localstatedir=$localstatedir + fi + libc_cv_rootsbindir=/sbin + ;; +esac diff --git a/REORG.TODO/sysdeps/gnu/configure.ac b/REORG.TODO/sysdeps/gnu/configure.ac new file mode 100644 index 0000000000..634fe4de2a --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/configure.ac @@ -0,0 +1,26 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. + +# Local configure fragment for sysdeps/gnu. + +# The Filesystem Hierarchy Standard prescribes where to place "essential" +# files. I.e., when the installation prefix is "/usr" we have to place +# shared library objects and the configuration files on the root partition +# in /lib and /etc. +LIBC_SLIBDIR_RTLDDIR([lib], [lib]) +case "$prefix" in +/usr | /usr/) + # Allow the user to override the path with --sysconfdir. + if test "$sysconfdir" = '${prefix}/etc'; then + libc_cv_sysconfdir=/etc + else + libc_cv_sysconfdir=$sysconfdir + fi + # Allow the user to override the path with --localstatedir. + if test "$localstatedir" = '${prefix}/var'; then + libc_cv_localstatedir=/var + else + libc_cv_localstatedir=$localstatedir + fi + libc_cv_rootsbindir=/sbin + ;; +esac diff --git a/REORG.TODO/sysdeps/gnu/errlist-compat.awk b/REORG.TODO/sysdeps/gnu/errlist-compat.awk new file mode 100644 index 0000000000..7e2c33e89b --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/errlist-compat.awk @@ -0,0 +1,133 @@ +# awk script to generate errlist-compat.c +# Copyright (C) 2002-2017 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +# +# This script takes the Versions file as input and looks for #errlist-compat +# magic comments, which have the form: +# #errlist-compat NNN +# where NNN is the number of elements in the sys_errlist for that version set. +# We need the awk variable `maxerr' defined to the current size of sys_errlist. +# +# If there is no magic comment matching the current size, we barf. +# Otherwise we generate code (errlist-compat.c) to define all the +# necessary compatibility symbols for older, smaller versions of sys_errlist. +# + +# These two rules catch the Versions file contents. +NF == 2 && $2 == "{" { last_version = $1; next } +$1 == "#errlist-compat" { + # Don't process any further Versions files + ARGC = ARGIND + 1; + cnt = $2 + 0; + if (cnt < 80) { + print "*** this line seems bogus:", $0 > "/dev/stderr"; + exit 1; + } + version[pos + 0] = cnt SUBSEP last_version; + pos++; + if (cnt < highest) { + printf "*** %s #errlist-compat counts are not sorted\n", ARGV[ARGIND]; + exit 1; + } + if (cnt > highest) + highest = cnt; + highest_version = last_version; + next; +} + +END { + if (! highest_version) { + print "/* No sys_errlist/sys_nerr symbols defined on this platform. */"; + exit 0; + } + + count = maxerr + 1; + + if (highest < count) { + printf "*** errlist.c count %d vs Versions sys_errlist@%s count %d\n", \ + count, highest_version, highest > "/dev/stderr"; + exit 1; + } + + lastv = ""; + for (n = 0; n < pos; ++n) { + split(version[n], t, SUBSEP) + v = t[2]; + gsub(/[^A-Z0-9_]/, "_", v); + if (lastv != "") + compat[lastv] = v; + lastv = v; + vcount[v] = t[1]; + } + + print "/* This file was generated by errlist-compat.awk; DO NOT EDIT! */\n"; + print "#include \n"; + + if (highest > count) { + printf "*** errlist.c count %d inflated to %s count %d (old errno.h?)\n", \ + count, highest_version, highest > "/dev/stderr"; + printf "#define ERR_MAX %d\n\n", highest - 1; + } + + # same regardless of awk's ordering of the associative array. + num_compat_elems = asorti(compat, compat_indices) + for (i = 1; i <= num_compat_elems; i++) { + old = compat_indices[i] + new = compat[old]; + n = vcount[old]; + printf "#if SHLIB_COMPAT (libc, %s, %s)\n", old, new; + printf "# include \n"; + printf "extern const char *const __sys_errlist_%s[NERR];\n", old; + printf "const int __sys_nerr_%s = %d;\n", old, n; + printf "declare_symbol_alias (__sys_errlist_%s, _sys_errlist_internal,", \ + old; + printf " object, __WORDSIZE/8*%d)\n", n; + printf "compat_symbol (libc, __sys_errlist_%s, sys_errlist, %s);\n", \ + old, old; + printf "compat_symbol (libc, __sys_nerr_%s, sys_nerr, %s);\n", old, old; + + printf "extern const char *const ___sys_errlist_%s[NERR];\n", old; + printf "extern const int __sys_nerr_%s;\n", old; + printf "declare_symbol_alias (___sys_errlist_%s, _sys_errlist_internal,", \ + old; + printf " object, __WORDSIZE/8*%d)\n", n; + printf "strong_alias (__sys_nerr_%s, ___sys_nerr_%s)\n", old, old; + printf "compat_symbol (libc, ___sys_errlist_%s, _sys_errlist, %s);\n", \ + old, old; + printf "compat_symbol (libc, ___sys_nerr_%s, _sys_nerr, %s);\n", old, old; + printf "#endif\n\n"; + } + + printf "\ +extern const char *const __sys_errlist_internal[NERR];\n\ +extern const int __sys_nerr_internal;\n\ +strong_alias (_sys_errlist_internal, __sys_errlist_internal)\n\ +strong_alias (_sys_nerr_internal, __sys_nerr_internal)\n\ +extern const char *const sys_errlist[NERR];\n\ +versioned_symbol (libc, _sys_errlist_internal, sys_errlist, %s);\n\ +versioned_symbol (libc, __sys_errlist_internal, _sys_errlist, %s);\n\ +versioned_symbol (libc, _sys_nerr_internal, sys_nerr, %s);\n\ +versioned_symbol (libc, __sys_nerr_internal, _sys_nerr, %s);\n", \ + lastv, lastv, lastv, lastv; + + print "\n\ +link_warning (sys_errlist, \"\ +`sys_errlist' is deprecated; use `strerror' or `strerror_r' instead\")\n\ +link_warning (sys_nerr, \"\ +`sys_nerr' is deprecated; use `strerror' or `strerror_r' instead\")"; +} diff --git a/REORG.TODO/sysdeps/gnu/errlist.awk b/REORG.TODO/sysdeps/gnu/errlist.awk new file mode 100644 index 0000000000..d5a0555114 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/errlist.awk @@ -0,0 +1,110 @@ +# Copyright (C) 1991-2017 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +# errno.texi contains lines like: +# @deftypevr Macro int ENOSYS +# @errno{ENOSYS, 78, Function not implemented} +# Descriptive paragraph... +# @end deftypevr + +BEGIN { + + # Here we list the E* names that might be duplicate names for the + # same integer value on some systems. This causes the code below + # to generate ``#if defined (ALIAS) && ALIAS != ORIGINAL'' in the code, + # so the output does not presume that these are in fact aliases. + # We list here all the known potential cases on any system, + # so that the C source we produce will do the right thing based + # on the actual #define'd values it's compiled with. + alias["EWOULDBLOCK"]= "EAGAIN"; + alias["EDEADLOCK"] = "EDEADLK"; + alias["ENOTSUP"] = "EOPNOTSUPP"; + + print "/* This file is generated from errno.texi by errlist.awk. */" + print ""; + print "#include "; + print "#include "; + print ""; + print "#ifndef ERR_REMAP"; + print "# define ERR_REMAP(n) n"; + print "#endif"; + print ""; + + print "#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT"; + print "# include "; + print "#endif"; + print "#ifdef ERR_MAX"; + print "# define ERRLIST_SIZE ERR_MAX + 1"; + print "#else" + print "# define ERR_MAX 0"; + print "# define ERRLIST_SIZE"; + print "#endif"; + + print "const char *const _sys_errlist_internal[ERRLIST_SIZE] ="; + print " {"; + print " [0] = N_(\"Success\")," + } + +/^@errno\{/ \ + { + etext = $3; + for (i = 4; i <= NF; ++i) + etext = etext " " $i; + etext = substr(etext, 1, length(etext)-1) + e = substr($1, 8, length($1)-8) + errno = substr($2, 1, length($2)-1) + 0 + if (alias[e]) + printf "#if defined (%s) && %s != %s\n", e, e, alias[e]; + else + printf "#ifdef %s\n", e; + errnoh = 4; + desc=""; + next; + } +errnoh == 4 && $1 == "@end" && $2 == "deftypevr" \ + { + printf "/*%s */\n", desc; + printf " [ERR_REMAP (%s)] = N_(\"%s\"),\n", e, etext; + printf "# if %s > ERR_MAX\n", e; + print "# undef ERR_MAX"; + printf "# define ERR_MAX %s\n", e; + print "# endif"; + print "#endif"; + errnoh = 0; + next; + } +errnoh == 4 \ + { + # This magic tag in C comments gets them copied into libc.pot. + desc = desc "\nTRANS" ($0 != "" ? " " : "") $0; next + } +END { + print " };"; + print ""; + print "#define NERR \\"; + print " (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0])"; + print "const int _sys_nerr_internal = NERR;" + print ""; + print "#if IS_IN (libc) && !defined ERRLIST_NO_COMPAT"; + print "# include "; + print "#endif"; + print ""; + print "#ifdef EMIT_ERR_MAX"; + print "void dummy (void)" + print "{ asm volatile (\" @@@ %0 @@@ \" : : \"i\" (ERR_REMAP (ERR_MAX))); }" + print "#endif"; +} diff --git a/REORG.TODO/sysdeps/gnu/errlist.c b/REORG.TODO/sysdeps/gnu/errlist.c new file mode 100644 index 0000000000..4a1c093ed0 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/errlist.c @@ -0,0 +1,1482 @@ +/* This file is generated from errno.texi by errlist.awk. */ + +#include +#include + +#ifndef ERR_REMAP +# define ERR_REMAP(n) n +#endif + +#if !defined EMIT_ERR_MAX && !defined ERRLIST_NO_COMPAT +# include +#endif +#ifdef ERR_MAX +# define ERRLIST_SIZE ERR_MAX + 1 +#else +# define ERR_MAX 0 +# define ERRLIST_SIZE +#endif +const char *const _sys_errlist_internal[ERRLIST_SIZE] = + { + [0] = N_("Success"), +#ifdef EPERM +/* +TRANS Only the owner of the file (or other resource) +TRANS or processes with special privileges can perform the operation. */ + [ERR_REMAP (EPERM)] = N_("Operation not permitted"), +# if EPERM > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPERM +# endif +#endif +#ifdef ENOENT +/* +TRANS This is a ``file doesn't exist'' error +TRANS for ordinary files that are referenced in contexts where they are +TRANS expected to already exist. */ + [ERR_REMAP (ENOENT)] = N_("No such file or directory"), +# if ENOENT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOENT +# endif +#endif +#ifdef ESRCH +/* +TRANS No process matches the specified process ID. */ + [ERR_REMAP (ESRCH)] = N_("No such process"), +# if ESRCH > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ESRCH +# endif +#endif +#ifdef EINTR +/* +TRANS An asynchronous signal occurred and prevented +TRANS completion of the call. When this happens, you should try the call +TRANS again. +TRANS +TRANS You can choose to have functions resume after a signal that is handled, +TRANS rather than failing with @code{EINTR}; see @ref{Interrupted +TRANS Primitives}. */ + [ERR_REMAP (EINTR)] = N_("Interrupted system call"), +# if EINTR > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EINTR +# endif +#endif +#ifdef EIO +/* +TRANS Usually used for physical read or write errors. */ + [ERR_REMAP (EIO)] = N_("Input/output error"), +# if EIO > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EIO +# endif +#endif +#ifdef ENXIO +/* +TRANS The system tried to use the device +TRANS represented by a file you specified, and it couldn't find the device. +TRANS This can mean that the device file was installed incorrectly, or that +TRANS the physical device is missing or not correctly attached to the +TRANS computer. */ + [ERR_REMAP (ENXIO)] = N_("No such device or address"), +# if ENXIO > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENXIO +# endif +#endif +#ifdef E2BIG +/* +TRANS Used when the arguments passed to a new program +TRANS being executed with one of the @code{exec} functions (@pxref{Executing a +TRANS File}) occupy too much memory space. This condition never arises on +TRANS @gnuhurdsystems{}. */ + [ERR_REMAP (E2BIG)] = N_("Argument list too long"), +# if E2BIG > ERR_MAX +# undef ERR_MAX +# define ERR_MAX E2BIG +# endif +#endif +#ifdef ENOEXEC +/* +TRANS Invalid executable file format. This condition is detected by the +TRANS @code{exec} functions; see @ref{Executing a File}. */ + [ERR_REMAP (ENOEXEC)] = N_("Exec format error"), +# if ENOEXEC > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOEXEC +# endif +#endif +#ifdef EBADF +/* +TRANS For example, I/O on a descriptor that has been +TRANS closed or reading from a descriptor open only for writing (or vice +TRANS versa). */ + [ERR_REMAP (EBADF)] = N_("Bad file descriptor"), +# if EBADF > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBADF +# endif +#endif +#ifdef ECHILD +/* +TRANS This error happens on operations that are +TRANS supposed to manipulate child processes, when there aren't any processes +TRANS to manipulate. */ + [ERR_REMAP (ECHILD)] = N_("No child processes"), +# if ECHILD > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ECHILD +# endif +#endif +#ifdef EDEADLK +/* +TRANS Allocating a system resource would have resulted in a +TRANS deadlock situation. The system does not guarantee that it will notice +TRANS all such situations. This error means you got lucky and the system +TRANS noticed; it might just hang. @xref{File Locks}, for an example. */ + [ERR_REMAP (EDEADLK)] = N_("Resource deadlock avoided"), +# if EDEADLK > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EDEADLK +# endif +#endif +#ifdef ENOMEM +/* +TRANS The system cannot allocate more virtual memory +TRANS because its capacity is full. */ + [ERR_REMAP (ENOMEM)] = N_("Cannot allocate memory"), +# if ENOMEM > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOMEM +# endif +#endif +#ifdef EACCES +/* +TRANS The file permissions do not allow the attempted operation. */ + [ERR_REMAP (EACCES)] = N_("Permission denied"), +# if EACCES > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EACCES +# endif +#endif +#ifdef EFAULT +/* +TRANS An invalid pointer was detected. +TRANS On @gnuhurdsystems{}, this error never happens; you get a signal instead. */ + [ERR_REMAP (EFAULT)] = N_("Bad address"), +# if EFAULT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EFAULT +# endif +#endif +#ifdef ENOTBLK +/* +TRANS A file that isn't a block special file was given in a situation that +TRANS requires one. For example, trying to mount an ordinary file as a file +TRANS system in Unix gives this error. */ + [ERR_REMAP (ENOTBLK)] = N_("Block device required"), +# if ENOTBLK > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTBLK +# endif +#endif +#ifdef EBUSY +/* +TRANS A system resource that can't be shared is already in use. +TRANS For example, if you try to delete a file that is the root of a currently +TRANS mounted filesystem, you get this error. */ + [ERR_REMAP (EBUSY)] = N_("Device or resource busy"), +# if EBUSY > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBUSY +# endif +#endif +#ifdef EEXIST +/* +TRANS An existing file was specified in a context where it only +TRANS makes sense to specify a new file. */ + [ERR_REMAP (EEXIST)] = N_("File exists"), +# if EEXIST > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EEXIST +# endif +#endif +#ifdef EXDEV +/* +TRANS An attempt to make an improper link across file systems was detected. +TRANS This happens not only when you use @code{link} (@pxref{Hard Links}) but +TRANS also when you rename a file with @code{rename} (@pxref{Renaming Files}). */ + [ERR_REMAP (EXDEV)] = N_("Invalid cross-device link"), +# if EXDEV > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EXDEV +# endif +#endif +#ifdef ENODEV +/* +TRANS The wrong type of device was given to a function that expects a +TRANS particular sort of device. */ + [ERR_REMAP (ENODEV)] = N_("No such device"), +# if ENODEV > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENODEV +# endif +#endif +#ifdef ENOTDIR +/* +TRANS A file that isn't a directory was specified when a directory is required. */ + [ERR_REMAP (ENOTDIR)] = N_("Not a directory"), +# if ENOTDIR > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTDIR +# endif +#endif +#ifdef EISDIR +/* +TRANS You cannot open a directory for writing, +TRANS or create or remove hard links to it. */ + [ERR_REMAP (EISDIR)] = N_("Is a directory"), +# if EISDIR > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EISDIR +# endif +#endif +#ifdef EINVAL +/* +TRANS This is used to indicate various kinds of problems +TRANS with passing the wrong argument to a library function. */ + [ERR_REMAP (EINVAL)] = N_("Invalid argument"), +# if EINVAL > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EINVAL +# endif +#endif +#ifdef EMFILE +/* +TRANS The current process has too many files open and can't open any more. +TRANS Duplicate descriptors do count toward this limit. +TRANS +TRANS In BSD and GNU, the number of open files is controlled by a resource +TRANS limit that can usually be increased. If you get this error, you might +TRANS want to increase the @code{RLIMIT_NOFILE} limit or make it unlimited; +TRANS @pxref{Limits on Resources}. */ + [ERR_REMAP (EMFILE)] = N_("Too many open files"), +# if EMFILE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EMFILE +# endif +#endif +#ifdef ENFILE +/* +TRANS There are too many distinct file openings in the entire system. Note +TRANS that any number of linked channels count as just one file opening; see +TRANS @ref{Linked Channels}. This error never occurs on @gnuhurdsystems{}. */ + [ERR_REMAP (ENFILE)] = N_("Too many open files in system"), +# if ENFILE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENFILE +# endif +#endif +#ifdef ENOTTY +/* +TRANS Inappropriate I/O control operation, such as trying to set terminal +TRANS modes on an ordinary file. */ + [ERR_REMAP (ENOTTY)] = N_("Inappropriate ioctl for device"), +# if ENOTTY > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTTY +# endif +#endif +#ifdef ETXTBSY +/* +TRANS An attempt to execute a file that is currently open for writing, or +TRANS write to a file that is currently being executed. Often using a +TRANS debugger to run a program is considered having it open for writing and +TRANS will cause this error. (The name stands for ``text file busy''.) This +TRANS is not an error on @gnuhurdsystems{}; the text is copied as necessary. */ + [ERR_REMAP (ETXTBSY)] = N_("Text file busy"), +# if ETXTBSY > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ETXTBSY +# endif +#endif +#ifdef EFBIG +/* +TRANS The size of a file would be larger than allowed by the system. */ + [ERR_REMAP (EFBIG)] = N_("File too large"), +# if EFBIG > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EFBIG +# endif +#endif +#ifdef ENOSPC +/* +TRANS Write operation on a file failed because the +TRANS disk is full. */ + [ERR_REMAP (ENOSPC)] = N_("No space left on device"), +# if ENOSPC > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOSPC +# endif +#endif +#ifdef ESPIPE +/* +TRANS Invalid seek operation (such as on a pipe). */ + [ERR_REMAP (ESPIPE)] = N_("Illegal seek"), +# if ESPIPE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ESPIPE +# endif +#endif +#ifdef EROFS +/* +TRANS An attempt was made to modify something on a read-only file system. */ + [ERR_REMAP (EROFS)] = N_("Read-only file system"), +# if EROFS > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EROFS +# endif +#endif +#ifdef EMLINK +/* +TRANS The link count of a single file would become too large. +TRANS @code{rename} can cause this error if the file being renamed already has +TRANS as many links as it can take (@pxref{Renaming Files}). */ + [ERR_REMAP (EMLINK)] = N_("Too many links"), +# if EMLINK > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EMLINK +# endif +#endif +#ifdef EPIPE +/* +TRANS There is no process reading from the other end of a pipe. +TRANS Every library function that returns this error code also generates a +TRANS @code{SIGPIPE} signal; this signal terminates the program if not handled +TRANS or blocked. Thus, your program will never actually see @code{EPIPE} +TRANS unless it has handled or blocked @code{SIGPIPE}. */ + [ERR_REMAP (EPIPE)] = N_("Broken pipe"), +# if EPIPE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPIPE +# endif +#endif +#ifdef EDOM +/* +TRANS Used by mathematical functions when an argument value does +TRANS not fall into the domain over which the function is defined. */ + [ERR_REMAP (EDOM)] = N_("Numerical argument out of domain"), +# if EDOM > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EDOM +# endif +#endif +#ifdef ERANGE +/* +TRANS Used by mathematical functions when the result value is +TRANS not representable because of overflow or underflow. */ + [ERR_REMAP (ERANGE)] = N_("Numerical result out of range"), +# if ERANGE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ERANGE +# endif +#endif +#ifdef EAGAIN +/* +TRANS The call might work if you try again +TRANS later. The macro @code{EWOULDBLOCK} is another name for @code{EAGAIN}; +TRANS they are always the same in @theglibc{}. +TRANS +TRANS This error can happen in a few different situations: +TRANS +TRANS @itemize @bullet +TRANS @item +TRANS An operation that would block was attempted on an object that has +TRANS non-blocking mode selected. Trying the same operation again will block +TRANS until some external condition makes it possible to read, write, or +TRANS connect (whatever the operation). You can use @code{select} to find out +TRANS when the operation will be possible; @pxref{Waiting for I/O}. +TRANS +TRANS @strong{Portability Note:} In many older Unix systems, this condition +TRANS was indicated by @code{EWOULDBLOCK}, which was a distinct error code +TRANS different from @code{EAGAIN}. To make your program portable, you should +TRANS check for both codes and treat them the same. +TRANS +TRANS @item +TRANS A temporary resource shortage made an operation impossible. @code{fork} +TRANS can return this error. It indicates that the shortage is expected to +TRANS pass, so your program can try the call again later and it may succeed. +TRANS It is probably a good idea to delay for a few seconds before trying it +TRANS again, to allow time for other processes to release scarce resources. +TRANS Such shortages are usually fairly serious and affect the whole system, +TRANS so usually an interactive program should report the error to the user +TRANS and return to its command loop. +TRANS @end itemize */ + [ERR_REMAP (EAGAIN)] = N_("Resource temporarily unavailable"), +# if EAGAIN > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EAGAIN +# endif +#endif +#if defined (EWOULDBLOCK) && EWOULDBLOCK != EAGAIN +/* +TRANS In @theglibc{}, this is another name for @code{EAGAIN} (above). +TRANS The values are always the same, on every operating system. +TRANS +TRANS C libraries in many older Unix systems have @code{EWOULDBLOCK} as a +TRANS separate error code. */ + [ERR_REMAP (EWOULDBLOCK)] = N_("Operation would block"), +# if EWOULDBLOCK > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EWOULDBLOCK +# endif +#endif +#ifdef EINPROGRESS +/* +TRANS An operation that cannot complete immediately was initiated on an object +TRANS that has non-blocking mode selected. Some functions that must always +TRANS block (such as @code{connect}; @pxref{Connecting}) never return +TRANS @code{EAGAIN}. Instead, they return @code{EINPROGRESS} to indicate that +TRANS the operation has begun and will take some time. Attempts to manipulate +TRANS the object before the call completes return @code{EALREADY}. You can +TRANS use the @code{select} function to find out when the pending operation +TRANS has completed; @pxref{Waiting for I/O}. */ + [ERR_REMAP (EINPROGRESS)] = N_("Operation now in progress"), +# if EINPROGRESS > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EINPROGRESS +# endif +#endif +#ifdef EALREADY +/* +TRANS An operation is already in progress on an object that has non-blocking +TRANS mode selected. */ + [ERR_REMAP (EALREADY)] = N_("Operation already in progress"), +# if EALREADY > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EALREADY +# endif +#endif +#ifdef ENOTSOCK +/* +TRANS A file that isn't a socket was specified when a socket is required. */ + [ERR_REMAP (ENOTSOCK)] = N_("Socket operation on non-socket"), +# if ENOTSOCK > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTSOCK +# endif +#endif +#ifdef EMSGSIZE +/* +TRANS The size of a message sent on a socket was larger than the supported +TRANS maximum size. */ + [ERR_REMAP (EMSGSIZE)] = N_("Message too long"), +# if EMSGSIZE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EMSGSIZE +# endif +#endif +#ifdef EPROTOTYPE +/* +TRANS The socket type does not support the requested communications protocol. */ + [ERR_REMAP (EPROTOTYPE)] = N_("Protocol wrong type for socket"), +# if EPROTOTYPE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPROTOTYPE +# endif +#endif +#ifdef ENOPROTOOPT +/* +TRANS You specified a socket option that doesn't make sense for the +TRANS particular protocol being used by the socket. @xref{Socket Options}. */ + [ERR_REMAP (ENOPROTOOPT)] = N_("Protocol not available"), +# if ENOPROTOOPT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOPROTOOPT +# endif +#endif +#ifdef EPROTONOSUPPORT +/* +TRANS The socket domain does not support the requested communications protocol +TRANS (perhaps because the requested protocol is completely invalid). +TRANS @xref{Creating a Socket}. */ + [ERR_REMAP (EPROTONOSUPPORT)] = N_("Protocol not supported"), +# if EPROTONOSUPPORT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPROTONOSUPPORT +# endif +#endif +#ifdef ESOCKTNOSUPPORT +/* +TRANS The socket type is not supported. */ + [ERR_REMAP (ESOCKTNOSUPPORT)] = N_("Socket type not supported"), +# if ESOCKTNOSUPPORT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ESOCKTNOSUPPORT +# endif +#endif +#ifdef EOPNOTSUPP +/* +TRANS The operation you requested is not supported. Some socket functions +TRANS don't make sense for all types of sockets, and others may not be +TRANS implemented for all communications protocols. On @gnuhurdsystems{}, this +TRANS error can happen for many calls when the object does not support the +TRANS particular operation; it is a generic indication that the server knows +TRANS nothing to do for that call. */ + [ERR_REMAP (EOPNOTSUPP)] = N_("Operation not supported"), +# if EOPNOTSUPP > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EOPNOTSUPP +# endif +#endif +#ifdef EPFNOSUPPORT +/* +TRANS The socket communications protocol family you requested is not supported. */ + [ERR_REMAP (EPFNOSUPPORT)] = N_("Protocol family not supported"), +# if EPFNOSUPPORT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPFNOSUPPORT +# endif +#endif +#ifdef EAFNOSUPPORT +/* +TRANS The address family specified for a socket is not supported; it is +TRANS inconsistent with the protocol being used on the socket. @xref{Sockets}. */ + [ERR_REMAP (EAFNOSUPPORT)] = N_("Address family not supported by protocol"), +# if EAFNOSUPPORT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EAFNOSUPPORT +# endif +#endif +#ifdef EADDRINUSE +/* +TRANS The requested socket address is already in use. @xref{Socket Addresses}. */ + [ERR_REMAP (EADDRINUSE)] = N_("Address already in use"), +# if EADDRINUSE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EADDRINUSE +# endif +#endif +#ifdef EADDRNOTAVAIL +/* +TRANS The requested socket address is not available; for example, you tried +TRANS to give a socket a name that doesn't match the local host name. +TRANS @xref{Socket Addresses}. */ + [ERR_REMAP (EADDRNOTAVAIL)] = N_("Cannot assign requested address"), +# if EADDRNOTAVAIL > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EADDRNOTAVAIL +# endif +#endif +#ifdef ENETDOWN +/* +TRANS A socket operation failed because the network was down. */ + [ERR_REMAP (ENETDOWN)] = N_("Network is down"), +# if ENETDOWN > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENETDOWN +# endif +#endif +#ifdef ENETUNREACH +/* +TRANS A socket operation failed because the subnet containing the remote host +TRANS was unreachable. */ + [ERR_REMAP (ENETUNREACH)] = N_("Network is unreachable"), +# if ENETUNREACH > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENETUNREACH +# endif +#endif +#ifdef ENETRESET +/* +TRANS A network connection was reset because the remote host crashed. */ + [ERR_REMAP (ENETRESET)] = N_("Network dropped connection on reset"), +# if ENETRESET > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENETRESET +# endif +#endif +#ifdef ECONNABORTED +/* +TRANS A network connection was aborted locally. */ + [ERR_REMAP (ECONNABORTED)] = N_("Software caused connection abort"), +# if ECONNABORTED > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ECONNABORTED +# endif +#endif +#ifdef ECONNRESET +/* +TRANS A network connection was closed for reasons outside the control of the +TRANS local host, such as by the remote machine rebooting or an unrecoverable +TRANS protocol violation. */ + [ERR_REMAP (ECONNRESET)] = N_("Connection reset by peer"), +# if ECONNRESET > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ECONNRESET +# endif +#endif +#ifdef ENOBUFS +/* +TRANS The kernel's buffers for I/O operations are all in use. In GNU, this +TRANS error is always synonymous with @code{ENOMEM}; you may get one or the +TRANS other from network operations. */ + [ERR_REMAP (ENOBUFS)] = N_("No buffer space available"), +# if ENOBUFS > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOBUFS +# endif +#endif +#ifdef EISCONN +/* +TRANS You tried to connect a socket that is already connected. +TRANS @xref{Connecting}. */ + [ERR_REMAP (EISCONN)] = N_("Transport endpoint is already connected"), +# if EISCONN > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EISCONN +# endif +#endif +#ifdef ENOTCONN +/* +TRANS The socket is not connected to anything. You get this error when you +TRANS try to transmit data over a socket, without first specifying a +TRANS destination for the data. For a connectionless socket (for datagram +TRANS protocols, such as UDP), you get @code{EDESTADDRREQ} instead. */ + [ERR_REMAP (ENOTCONN)] = N_("Transport endpoint is not connected"), +# if ENOTCONN > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTCONN +# endif +#endif +#ifdef EDESTADDRREQ +/* +TRANS No default destination address was set for the socket. You get this +TRANS error when you try to transmit data over a connectionless socket, +TRANS without first specifying a destination for the data with @code{connect}. */ + [ERR_REMAP (EDESTADDRREQ)] = N_("Destination address required"), +# if EDESTADDRREQ > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EDESTADDRREQ +# endif +#endif +#ifdef ESHUTDOWN +/* +TRANS The socket has already been shut down. */ + [ERR_REMAP (ESHUTDOWN)] = N_("Cannot send after transport endpoint shutdown"), +# if ESHUTDOWN > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ESHUTDOWN +# endif +#endif +#ifdef ETOOMANYREFS +/* */ + [ERR_REMAP (ETOOMANYREFS)] = N_("Too many references: cannot splice"), +# if ETOOMANYREFS > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ETOOMANYREFS +# endif +#endif +#ifdef ETIMEDOUT +/* +TRANS A socket operation with a specified timeout received no response during +TRANS the timeout period. */ + [ERR_REMAP (ETIMEDOUT)] = N_("Connection timed out"), +# if ETIMEDOUT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ETIMEDOUT +# endif +#endif +#ifdef ECONNREFUSED +/* +TRANS A remote host refused to allow the network connection (typically because +TRANS it is not running the requested service). */ + [ERR_REMAP (ECONNREFUSED)] = N_("Connection refused"), +# if ECONNREFUSED > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ECONNREFUSED +# endif +#endif +#ifdef ELOOP +/* +TRANS Too many levels of symbolic links were encountered in looking up a file name. +TRANS This often indicates a cycle of symbolic links. */ + [ERR_REMAP (ELOOP)] = N_("Too many levels of symbolic links"), +# if ELOOP > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ELOOP +# endif +#endif +#ifdef ENAMETOOLONG +/* +TRANS Filename too long (longer than @code{PATH_MAX}; @pxref{Limits for +TRANS Files}) or host name too long (in @code{gethostname} or +TRANS @code{sethostname}; @pxref{Host Identification}). */ + [ERR_REMAP (ENAMETOOLONG)] = N_("File name too long"), +# if ENAMETOOLONG > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENAMETOOLONG +# endif +#endif +#ifdef EHOSTDOWN +/* +TRANS The remote host for a requested network connection is down. */ + [ERR_REMAP (EHOSTDOWN)] = N_("Host is down"), +# if EHOSTDOWN > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EHOSTDOWN +# endif +#endif +#ifdef EHOSTUNREACH +/* +TRANS The remote host for a requested network connection is not reachable. */ + [ERR_REMAP (EHOSTUNREACH)] = N_("No route to host"), +# if EHOSTUNREACH > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EHOSTUNREACH +# endif +#endif +#ifdef ENOTEMPTY +/* +TRANS Directory not empty, where an empty directory was expected. Typically, +TRANS this error occurs when you are trying to delete a directory. */ + [ERR_REMAP (ENOTEMPTY)] = N_("Directory not empty"), +# if ENOTEMPTY > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTEMPTY +# endif +#endif +#ifdef EPROCLIM +/* +TRANS This means that the per-user limit on new process would be exceeded by +TRANS an attempted @code{fork}. @xref{Limits on Resources}, for details on +TRANS the @code{RLIMIT_NPROC} limit. */ + [ERR_REMAP (EPROCLIM)] = N_("Too many processes"), +# if EPROCLIM > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPROCLIM +# endif +#endif +#ifdef EUSERS +/* +TRANS The file quota system is confused because there are too many users. +TRANS @c This can probably happen in a GNU system when using NFS. */ + [ERR_REMAP (EUSERS)] = N_("Too many users"), +# if EUSERS > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EUSERS +# endif +#endif +#ifdef EDQUOT +/* +TRANS The user's disk quota was exceeded. */ + [ERR_REMAP (EDQUOT)] = N_("Disk quota exceeded"), +# if EDQUOT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EDQUOT +# endif +#endif +#ifdef ESTALE +/* +TRANS This indicates an internal confusion in the +TRANS file system which is due to file system rearrangements on the server host +TRANS for NFS file systems or corruption in other file systems. +TRANS Repairing this condition usually requires unmounting, possibly repairing +TRANS and remounting the file system. */ + [ERR_REMAP (ESTALE)] = N_("Stale file handle"), +# if ESTALE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ESTALE +# endif +#endif +#ifdef EREMOTE +/* +TRANS An attempt was made to NFS-mount a remote file system with a file name that +TRANS already specifies an NFS-mounted file. +TRANS (This is an error on some operating systems, but we expect it to work +TRANS properly on @gnuhurdsystems{}, making this error code impossible.) */ + [ERR_REMAP (EREMOTE)] = N_("Object is remote"), +# if EREMOTE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EREMOTE +# endif +#endif +#ifdef EBADRPC +/* */ + [ERR_REMAP (EBADRPC)] = N_("RPC struct is bad"), +# if EBADRPC > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBADRPC +# endif +#endif +#ifdef ERPCMISMATCH +/* */ + [ERR_REMAP (ERPCMISMATCH)] = N_("RPC version wrong"), +# if ERPCMISMATCH > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ERPCMISMATCH +# endif +#endif +#ifdef EPROGUNAVAIL +/* */ + [ERR_REMAP (EPROGUNAVAIL)] = N_("RPC program not available"), +# if EPROGUNAVAIL > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPROGUNAVAIL +# endif +#endif +#ifdef EPROGMISMATCH +/* */ + [ERR_REMAP (EPROGMISMATCH)] = N_("RPC program version wrong"), +# if EPROGMISMATCH > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPROGMISMATCH +# endif +#endif +#ifdef EPROCUNAVAIL +/* */ + [ERR_REMAP (EPROCUNAVAIL)] = N_("RPC bad procedure for program"), +# if EPROCUNAVAIL > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPROCUNAVAIL +# endif +#endif +#ifdef ENOLCK +/* +TRANS This is used by the file locking facilities; see +TRANS @ref{File Locks}. This error is never generated by @gnuhurdsystems{}, but +TRANS it can result from an operation to an NFS server running another +TRANS operating system. */ + [ERR_REMAP (ENOLCK)] = N_("No locks available"), +# if ENOLCK > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOLCK +# endif +#endif +#ifdef EFTYPE +/* +TRANS The file was the wrong type for the +TRANS operation, or a data file had the wrong format. +TRANS +TRANS On some systems @code{chmod} returns this error if you try to set the +TRANS sticky bit on a non-directory file; @pxref{Setting Permissions}. */ + [ERR_REMAP (EFTYPE)] = N_("Inappropriate file type or format"), +# if EFTYPE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EFTYPE +# endif +#endif +#ifdef EAUTH +/* */ + [ERR_REMAP (EAUTH)] = N_("Authentication error"), +# if EAUTH > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EAUTH +# endif +#endif +#ifdef ENEEDAUTH +/* */ + [ERR_REMAP (ENEEDAUTH)] = N_("Need authenticator"), +# if ENEEDAUTH > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENEEDAUTH +# endif +#endif +#ifdef ENOSYS +/* +TRANS This indicates that the function called is +TRANS not implemented at all, either in the C library itself or in the +TRANS operating system. When you get this error, you can be sure that this +TRANS particular function will always fail with @code{ENOSYS} unless you +TRANS install a new version of the C library or the operating system. */ + [ERR_REMAP (ENOSYS)] = N_("Function not implemented"), +# if ENOSYS > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOSYS +# endif +#endif +#if defined (ENOTSUP) && ENOTSUP != EOPNOTSUPP +/* +TRANS A function returns this error when certain parameter +TRANS values are valid, but the functionality they request is not available. +TRANS This can mean that the function does not implement a particular command +TRANS or option value or flag bit at all. For functions that operate on some +TRANS object given in a parameter, such as a file descriptor or a port, it +TRANS might instead mean that only @emph{that specific object} (file +TRANS descriptor, port, etc.) is unable to support the other parameters given; +TRANS different file descriptors might support different ranges of parameter +TRANS values. +TRANS +TRANS If the entire function is not available at all in the implementation, +TRANS it returns @code{ENOSYS} instead. */ + [ERR_REMAP (ENOTSUP)] = N_("Not supported"), +# if ENOTSUP > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTSUP +# endif +#endif +#ifdef EILSEQ +/* +TRANS While decoding a multibyte character the function came along an invalid +TRANS or an incomplete sequence of bytes or the given wide character is invalid. */ + [ERR_REMAP (EILSEQ)] = N_("Invalid or incomplete multibyte or wide character"), +# if EILSEQ > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EILSEQ +# endif +#endif +#ifdef EBACKGROUND +/* +TRANS On @gnuhurdsystems{}, servers supporting the @code{term} protocol return +TRANS this error for certain operations when the caller is not in the +TRANS foreground process group of the terminal. Users do not usually see this +TRANS error because functions such as @code{read} and @code{write} translate +TRANS it into a @code{SIGTTIN} or @code{SIGTTOU} signal. @xref{Job Control}, +TRANS for information on process groups and these signals. */ + [ERR_REMAP (EBACKGROUND)] = N_("Inappropriate operation for background process"), +# if EBACKGROUND > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBACKGROUND +# endif +#endif +#ifdef EDIED +/* +TRANS On @gnuhurdsystems{}, opening a file returns this error when the file is +TRANS translated by a program and the translator program dies while starting +TRANS up, before it has connected to the file. */ + [ERR_REMAP (EDIED)] = N_("Translator died"), +# if EDIED > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EDIED +# endif +#endif +#ifdef ED +/* +TRANS The experienced user will know what is wrong. +TRANS @c This error code is a joke. Its perror text is part of the joke. +TRANS @c Don't change it. */ + [ERR_REMAP (ED)] = N_("?"), +# if ED > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ED +# endif +#endif +#ifdef EGREGIOUS +/* +TRANS You did @strong{what}? */ + [ERR_REMAP (EGREGIOUS)] = N_("You really blew it this time"), +# if EGREGIOUS > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EGREGIOUS +# endif +#endif +#ifdef EIEIO +/* +TRANS Go home and have a glass of warm, dairy-fresh milk. */ + [ERR_REMAP (EIEIO)] = N_("Computer bought the farm"), +# if EIEIO > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EIEIO +# endif +#endif +#ifdef EGRATUITOUS +/* +TRANS This error code has no purpose. */ + [ERR_REMAP (EGRATUITOUS)] = N_("Gratuitous error"), +# if EGRATUITOUS > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EGRATUITOUS +# endif +#endif +#ifdef EBADMSG +/* */ + [ERR_REMAP (EBADMSG)] = N_("Bad message"), +# if EBADMSG > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBADMSG +# endif +#endif +#ifdef EIDRM +/* */ + [ERR_REMAP (EIDRM)] = N_("Identifier removed"), +# if EIDRM > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EIDRM +# endif +#endif +#ifdef EMULTIHOP +/* */ + [ERR_REMAP (EMULTIHOP)] = N_("Multihop attempted"), +# if EMULTIHOP > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EMULTIHOP +# endif +#endif +#ifdef ENODATA +/* */ + [ERR_REMAP (ENODATA)] = N_("No data available"), +# if ENODATA > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENODATA +# endif +#endif +#ifdef ENOLINK +/* */ + [ERR_REMAP (ENOLINK)] = N_("Link has been severed"), +# if ENOLINK > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOLINK +# endif +#endif +#ifdef ENOMSG +/* */ + [ERR_REMAP (ENOMSG)] = N_("No message of desired type"), +# if ENOMSG > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOMSG +# endif +#endif +#ifdef ENOSR +/* */ + [ERR_REMAP (ENOSR)] = N_("Out of streams resources"), +# if ENOSR > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOSR +# endif +#endif +#ifdef ENOSTR +/* */ + [ERR_REMAP (ENOSTR)] = N_("Device not a stream"), +# if ENOSTR > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOSTR +# endif +#endif +#ifdef EOVERFLOW +/* */ + [ERR_REMAP (EOVERFLOW)] = N_("Value too large for defined data type"), +# if EOVERFLOW > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EOVERFLOW +# endif +#endif +#ifdef EPROTO +/* */ + [ERR_REMAP (EPROTO)] = N_("Protocol error"), +# if EPROTO > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EPROTO +# endif +#endif +#ifdef ETIME +/* */ + [ERR_REMAP (ETIME)] = N_("Timer expired"), +# if ETIME > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ETIME +# endif +#endif +#ifdef ECANCELED +/* +TRANS An asynchronous operation was canceled before it +TRANS completed. @xref{Asynchronous I/O}. When you call @code{aio_cancel}, +TRANS the normal result is for the operations affected to complete with this +TRANS error; @pxref{Cancel AIO Operations}. */ + [ERR_REMAP (ECANCELED)] = N_("Operation canceled"), +# if ECANCELED > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ECANCELED +# endif +#endif +#ifdef ERESTART +/* */ + [ERR_REMAP (ERESTART)] = N_("Interrupted system call should be restarted"), +# if ERESTART > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ERESTART +# endif +#endif +#ifdef ECHRNG +/* */ + [ERR_REMAP (ECHRNG)] = N_("Channel number out of range"), +# if ECHRNG > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ECHRNG +# endif +#endif +#ifdef EL2NSYNC +/* */ + [ERR_REMAP (EL2NSYNC)] = N_("Level 2 not synchronized"), +# if EL2NSYNC > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EL2NSYNC +# endif +#endif +#ifdef EL3HLT +/* */ + [ERR_REMAP (EL3HLT)] = N_("Level 3 halted"), +# if EL3HLT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EL3HLT +# endif +#endif +#ifdef EL3RST +/* */ + [ERR_REMAP (EL3RST)] = N_("Level 3 reset"), +# if EL3RST > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EL3RST +# endif +#endif +#ifdef ELNRNG +/* */ + [ERR_REMAP (ELNRNG)] = N_("Link number out of range"), +# if ELNRNG > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ELNRNG +# endif +#endif +#ifdef EUNATCH +/* */ + [ERR_REMAP (EUNATCH)] = N_("Protocol driver not attached"), +# if EUNATCH > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EUNATCH +# endif +#endif +#ifdef ENOCSI +/* */ + [ERR_REMAP (ENOCSI)] = N_("No CSI structure available"), +# if ENOCSI > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOCSI +# endif +#endif +#ifdef EL2HLT +/* */ + [ERR_REMAP (EL2HLT)] = N_("Level 2 halted"), +# if EL2HLT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EL2HLT +# endif +#endif +#ifdef EBADE +/* */ + [ERR_REMAP (EBADE)] = N_("Invalid exchange"), +# if EBADE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBADE +# endif +#endif +#ifdef EBADR +/* */ + [ERR_REMAP (EBADR)] = N_("Invalid request descriptor"), +# if EBADR > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBADR +# endif +#endif +#ifdef EXFULL +/* */ + [ERR_REMAP (EXFULL)] = N_("Exchange full"), +# if EXFULL > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EXFULL +# endif +#endif +#ifdef ENOANO +/* */ + [ERR_REMAP (ENOANO)] = N_("No anode"), +# if ENOANO > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOANO +# endif +#endif +#ifdef EBADRQC +/* */ + [ERR_REMAP (EBADRQC)] = N_("Invalid request code"), +# if EBADRQC > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBADRQC +# endif +#endif +#ifdef EBADSLT +/* */ + [ERR_REMAP (EBADSLT)] = N_("Invalid slot"), +# if EBADSLT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBADSLT +# endif +#endif +#if defined (EDEADLOCK) && EDEADLOCK != EDEADLK +/* */ + [ERR_REMAP (EDEADLOCK)] = N_("File locking deadlock error"), +# if EDEADLOCK > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EDEADLOCK +# endif +#endif +#ifdef EBFONT +/* */ + [ERR_REMAP (EBFONT)] = N_("Bad font file format"), +# if EBFONT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBFONT +# endif +#endif +#ifdef ENONET +/* */ + [ERR_REMAP (ENONET)] = N_("Machine is not on the network"), +# if ENONET > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENONET +# endif +#endif +#ifdef ENOPKG +/* */ + [ERR_REMAP (ENOPKG)] = N_("Package not installed"), +# if ENOPKG > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOPKG +# endif +#endif +#ifdef EADV +/* */ + [ERR_REMAP (EADV)] = N_("Advertise error"), +# if EADV > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EADV +# endif +#endif +#ifdef ESRMNT +/* */ + [ERR_REMAP (ESRMNT)] = N_("Srmount error"), +# if ESRMNT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ESRMNT +# endif +#endif +#ifdef ECOMM +/* */ + [ERR_REMAP (ECOMM)] = N_("Communication error on send"), +# if ECOMM > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ECOMM +# endif +#endif +#ifdef EDOTDOT +/* */ + [ERR_REMAP (EDOTDOT)] = N_("RFS specific error"), +# if EDOTDOT > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EDOTDOT +# endif +#endif +#ifdef ENOTUNIQ +/* */ + [ERR_REMAP (ENOTUNIQ)] = N_("Name not unique on network"), +# if ENOTUNIQ > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTUNIQ +# endif +#endif +#ifdef EBADFD +/* */ + [ERR_REMAP (EBADFD)] = N_("File descriptor in bad state"), +# if EBADFD > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EBADFD +# endif +#endif +#ifdef EREMCHG +/* */ + [ERR_REMAP (EREMCHG)] = N_("Remote address changed"), +# if EREMCHG > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EREMCHG +# endif +#endif +#ifdef ELIBACC +/* */ + [ERR_REMAP (ELIBACC)] = N_("Can not access a needed shared library"), +# if ELIBACC > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ELIBACC +# endif +#endif +#ifdef ELIBBAD +/* */ + [ERR_REMAP (ELIBBAD)] = N_("Accessing a corrupted shared library"), +# if ELIBBAD > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ELIBBAD +# endif +#endif +#ifdef ELIBSCN +/* */ + [ERR_REMAP (ELIBSCN)] = N_(".lib section in a.out corrupted"), +# if ELIBSCN > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ELIBSCN +# endif +#endif +#ifdef ELIBMAX +/* */ + [ERR_REMAP (ELIBMAX)] = N_("Attempting to link in too many shared libraries"), +# if ELIBMAX > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ELIBMAX +# endif +#endif +#ifdef ELIBEXEC +/* */ + [ERR_REMAP (ELIBEXEC)] = N_("Cannot exec a shared library directly"), +# if ELIBEXEC > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ELIBEXEC +# endif +#endif +#ifdef ESTRPIPE +/* */ + [ERR_REMAP (ESTRPIPE)] = N_("Streams pipe error"), +# if ESTRPIPE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ESTRPIPE +# endif +#endif +#ifdef EUCLEAN +/* */ + [ERR_REMAP (EUCLEAN)] = N_("Structure needs cleaning"), +# if EUCLEAN > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EUCLEAN +# endif +#endif +#ifdef ENOTNAM +/* */ + [ERR_REMAP (ENOTNAM)] = N_("Not a XENIX named type file"), +# if ENOTNAM > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTNAM +# endif +#endif +#ifdef ENAVAIL +/* */ + [ERR_REMAP (ENAVAIL)] = N_("No XENIX semaphores available"), +# if ENAVAIL > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENAVAIL +# endif +#endif +#ifdef EISNAM +/* */ + [ERR_REMAP (EISNAM)] = N_("Is a named type file"), +# if EISNAM > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EISNAM +# endif +#endif +#ifdef EREMOTEIO +/* */ + [ERR_REMAP (EREMOTEIO)] = N_("Remote I/O error"), +# if EREMOTEIO > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EREMOTEIO +# endif +#endif +#ifdef ENOMEDIUM +/* */ + [ERR_REMAP (ENOMEDIUM)] = N_("No medium found"), +# if ENOMEDIUM > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOMEDIUM +# endif +#endif +#ifdef EMEDIUMTYPE +/* */ + [ERR_REMAP (EMEDIUMTYPE)] = N_("Wrong medium type"), +# if EMEDIUMTYPE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EMEDIUMTYPE +# endif +#endif +#ifdef ENOKEY +/* */ + [ERR_REMAP (ENOKEY)] = N_("Required key not available"), +# if ENOKEY > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOKEY +# endif +#endif +#ifdef EKEYEXPIRED +/* */ + [ERR_REMAP (EKEYEXPIRED)] = N_("Key has expired"), +# if EKEYEXPIRED > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EKEYEXPIRED +# endif +#endif +#ifdef EKEYREVOKED +/* */ + [ERR_REMAP (EKEYREVOKED)] = N_("Key has been revoked"), +# if EKEYREVOKED > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EKEYREVOKED +# endif +#endif +#ifdef EKEYREJECTED +/* */ + [ERR_REMAP (EKEYREJECTED)] = N_("Key was rejected by service"), +# if EKEYREJECTED > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EKEYREJECTED +# endif +#endif +#ifdef EOWNERDEAD +/* */ + [ERR_REMAP (EOWNERDEAD)] = N_("Owner died"), +# if EOWNERDEAD > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EOWNERDEAD +# endif +#endif +#ifdef ENOTRECOVERABLE +/* */ + [ERR_REMAP (ENOTRECOVERABLE)] = N_("State not recoverable"), +# if ENOTRECOVERABLE > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ENOTRECOVERABLE +# endif +#endif +#ifdef ERFKILL +/* */ + [ERR_REMAP (ERFKILL)] = N_("Operation not possible due to RF-kill"), +# if ERFKILL > ERR_MAX +# undef ERR_MAX +# define ERR_MAX ERFKILL +# endif +#endif +#ifdef EHWPOISON +/* */ + [ERR_REMAP (EHWPOISON)] = N_("Memory page has hardware error"), +# if EHWPOISON > ERR_MAX +# undef ERR_MAX +# define ERR_MAX EHWPOISON +# endif +#endif + }; + +#define NERR \ + (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0]) +const int _sys_nerr_internal = NERR; + +#if IS_IN (libc) && !defined ERRLIST_NO_COMPAT +# include +#endif + +#ifdef EMIT_ERR_MAX +void dummy (void) +{ asm volatile (" @@@ %0 @@@ " : : "i" (ERR_REMAP (ERR_MAX))); } +#endif diff --git a/REORG.TODO/sysdeps/gnu/getutmp.c b/REORG.TODO/sysdeps/gnu/getutmp.c new file mode 100644 index 0000000000..a0c0766923 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/getutmp.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1999-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#ifndef _UTMPX_H +/* This is an ugly hack but we must not see the getutmpx declaration. */ +# define getutmpx XXXgetutmpx +# include +# undef getutmpx +#endif + +void +getutmp (const struct utmpx *utmpx, struct utmp *utmp) +{ + assert (sizeof (struct utmp) == sizeof (struct utmpx)); + memcpy (utmp, utmpx, sizeof (struct utmp)); +} +strong_alias (getutmp, getutmpx) diff --git a/REORG.TODO/sysdeps/gnu/getutmpx.c b/REORG.TODO/sysdeps/gnu/getutmpx.c new file mode 100644 index 0000000000..f393734a63 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/getutmpx.c @@ -0,0 +1 @@ +/* We don't need a separate version. it is the same as getutmp(). */ diff --git a/REORG.TODO/sysdeps/gnu/glob64.c b/REORG.TODO/sysdeps/gnu/glob64.c new file mode 100644 index 0000000000..d1e4e6f0d5 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/glob64.c @@ -0,0 +1,25 @@ +#include +#include +#include + +#define dirent dirent64 +#define __readdir(dirp) __readdir64 (dirp) + +#define glob_t glob64_t +#define glob(pattern, flags, errfunc, pglob) \ + glob64 (pattern, flags, errfunc, pglob) +#define globfree(pglob) globfree64 (pglob) + +#undef stat +#define stat stat64 +#undef __stat +#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf) + +#define NO_GLOB_PATTERN_P 1 + +#define COMPILE_GLOB64 1 + +#include + +libc_hidden_def (glob64) +libc_hidden_def (globfree64) diff --git a/REORG.TODO/sysdeps/gnu/ifaddrs.c b/REORG.TODO/sysdeps/gnu/ifaddrs.c new file mode 100644 index 0000000000..37b3248669 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/ifaddrs.c @@ -0,0 +1,164 @@ +/* getifaddrs -- get names and addresses of all network interfaces + Copyright (C) 2002-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ifreq.h" + +/* Create a linked list of `struct ifaddrs' structures, one for each + network interface on the host machine. If successful, store the + list in *IFAP and return 0. On errors, return -1 and set `errno'. */ +int +__getifaddrs (struct ifaddrs **ifap) +{ + /* This implementation handles only IPv4 interfaces. + The various ioctls below will only work on an AF_INET socket. + Some different mechanism entirely must be used for IPv6. */ + int fd = __socket (AF_INET, SOCK_DGRAM, 0); + struct ifreq *ifreqs; + int nifs; + + if (fd < 0) + return -1; + + __ifreq (&ifreqs, &nifs, fd); + if (ifreqs == NULL) /* XXX doesn't distinguish error vs none */ + { + __close (fd); + return -1; + } + + /* Now we have the list of interfaces and each one's address. + Put it into the expected format and fill in the remaining details. */ + if (nifs == 0) + *ifap = NULL; + else + { + struct + { + struct ifaddrs ia; + struct sockaddr addr, netmask, broadaddr; + char name[IF_NAMESIZE]; + } *storage; + struct ifreq *ifr; + int i; + + storage = malloc (nifs * sizeof storage[0]); + if (storage == NULL) + { + __close (fd); + __if_freereq (ifreqs, nifs); + return -1; + } + + i = 0; + ifr = ifreqs; + do + { + /* Fill in pointers to the storage we've already allocated. */ + storage[i].ia.ifa_next = &storage[i + 1].ia; + storage[i].ia.ifa_addr = &storage[i].addr; + + /* Now copy the information we already have from SIOCGIFCONF. */ + storage[i].ia.ifa_name = strncpy (storage[i].name, ifr->ifr_name, + sizeof storage[i].name); + storage[i].addr = ifr->ifr_addr; + + /* The SIOCGIFCONF call filled in only the name and address. + Now we must also ask for the other information we need. */ + + if (__ioctl (fd, SIOCGIFFLAGS, ifr) < 0) + break; + storage[i].ia.ifa_flags = ifr->ifr_flags; + + ifr->ifr_addr = storage[i].addr; + + if (__ioctl (fd, SIOCGIFNETMASK, ifr) < 0) + storage[i].ia.ifa_netmask = NULL; + else + { + storage[i].ia.ifa_netmask = &storage[i].netmask; + storage[i].netmask = ifr->ifr_netmask; + } + + if (ifr->ifr_flags & IFF_BROADCAST) + { + ifr->ifr_addr = storage[i].addr; + if (__ioctl (fd, SIOCGIFBRDADDR, ifr) < 0) + storage[i].ia.ifa_broadaddr = NULL; + { + storage[i].ia.ifa_broadaddr = &storage[i].broadaddr; + storage[i].broadaddr = ifr->ifr_broadaddr; + } + } + else if (ifr->ifr_flags & IFF_POINTOPOINT) + { + ifr->ifr_addr = storage[i].addr; + if (__ioctl (fd, SIOCGIFDSTADDR, ifr) < 0) + storage[i].ia.ifa_broadaddr = NULL; + else + { + storage[i].ia.ifa_broadaddr = &storage[i].broadaddr; + storage[i].broadaddr = ifr->ifr_dstaddr; + } + } + else + storage[i].ia.ifa_broadaddr = NULL; + + storage[i].ia.ifa_data = NULL; /* Nothing here for now. */ + + ifr = __if_nextreq (ifr); + } while (++i < nifs); + if (i < nifs) /* Broke out early on error. */ + { + __close (fd); + free (storage); + __if_freereq (ifreqs, nifs); + return -1; + } + + storage[i - 1].ia.ifa_next = NULL; + + *ifap = &storage[0].ia; + + __close (fd); + __if_freereq (ifreqs, nifs); + } + + return 0; +} +weak_alias (__getifaddrs, getifaddrs) +#ifndef getifaddrs +libc_hidden_weak (getifaddrs) +#endif + +void +__freeifaddrs (struct ifaddrs *ifa) +{ + free (ifa); +} +weak_alias (__freeifaddrs, freeifaddrs) +libc_hidden_weak (freeifaddrs) diff --git a/REORG.TODO/sysdeps/gnu/ldsodefs.h b/REORG.TODO/sysdeps/gnu/ldsodefs.h new file mode 100644 index 0000000000..cda70ae91a --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/ldsodefs.h @@ -0,0 +1,48 @@ +/* Run-time dynamic linker data structures for loaded ELF shared objects. GNU. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _GNU_LDSODEFS_H +#define _GNU_LDSODEFS_H 1 + +#include +#include +#include + +/* Accept binaries which identify the binary as using GNU extensions. */ +#define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0 \ + || memcmp (hdr, expected2, size) == 0) +#define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV \ + || osabi == ELFOSABI_GNU) +#define VALID_ELF_ABIVERSION(osabi,ver) \ + (ver == 0 || (osabi == ELFOSABI_GNU && ver < LIBC_ABI_MAX)) +#define MORE_ELF_HEADER_DATA \ + static const unsigned char expected2[EI_PAD] = \ + { \ + [EI_MAG0] = ELFMAG0, \ + [EI_MAG1] = ELFMAG1, \ + [EI_MAG2] = ELFMAG2, \ + [EI_MAG3] = ELFMAG3, \ + [EI_CLASS] = ELFW(CLASS), \ + [EI_DATA] = byteorder, \ + [EI_VERSION] = EV_CURRENT, \ + [EI_OSABI] = ELFOSABI_GNU \ + } + +#include_next + +#endif /* _GNU_LDSODEFS_H */ diff --git a/REORG.TODO/sysdeps/gnu/net/if.h b/REORG.TODO/sysdeps/gnu/net/if.h new file mode 100644 index 0000000000..0afce08238 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/net/if.h @@ -0,0 +1,204 @@ +/* net/if.h -- declarations for inquiring about network interfaces + Copyright (C) 1997-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _NET_IF_H +#define _NET_IF_H 1 + +#include + +#ifdef __USE_MISC +# include +# include +#endif + + +/* Length of interface name. */ +#define IF_NAMESIZE 16 + +struct if_nameindex + { + unsigned int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "eth0", ... */ + }; + + +#ifdef __USE_MISC +/* Standard interface flags. */ +enum + { + IFF_UP = 0x1, /* Interface is up. */ +# define IFF_UP IFF_UP + IFF_BROADCAST = 0x2, /* Broadcast address valid. */ +# define IFF_BROADCAST IFF_BROADCAST + IFF_DEBUG = 0x4, /* Turn on debugging. */ +# define IFF_DEBUG IFF_DEBUG + IFF_LOOPBACK = 0x8, /* Is a loopback net. */ +# define IFF_LOOPBACK IFF_LOOPBACK + IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link. */ +# define IFF_POINTOPOINT IFF_POINTOPOINT + IFF_NOTRAILERS = 0x20, /* Avoid use of trailers. */ +# define IFF_NOTRAILERS IFF_NOTRAILERS + IFF_RUNNING = 0x40, /* Resources allocated. */ +# define IFF_RUNNING IFF_RUNNING + IFF_NOARP = 0x80, /* No address resolution protocol. */ +# define IFF_NOARP IFF_NOARP + IFF_PROMISC = 0x100, /* Receive all packets. */ +# define IFF_PROMISC IFF_PROMISC + + /* Not supported */ + IFF_ALLMULTI = 0x200, /* Receive all multicast packets. */ +# define IFF_ALLMULTI IFF_ALLMULTI + + IFF_MASTER = 0x400, /* Master of a load balancer. */ +# define IFF_MASTER IFF_MASTER + IFF_SLAVE = 0x800, /* Slave of a load balancer. */ +# define IFF_SLAVE IFF_SLAVE + + IFF_MULTICAST = 0x1000, /* Supports multicast. */ +# define IFF_MULTICAST IFF_MULTICAST + + IFF_PORTSEL = 0x2000, /* Can set media type. */ +# define IFF_PORTSEL IFF_PORTSEL + IFF_AUTOMEDIA = 0x4000, /* Auto media select active. */ +# define IFF_AUTOMEDIA IFF_AUTOMEDIA + IFF_DYNAMIC = 0x8000 /* Dialup device with changing addresses. */ +# define IFF_DYNAMIC IFF_DYNAMIC + }; + +/* The ifaddr structure contains information about one address of an + interface. They are maintained by the different address families, + are allocated and attached when an address is set, and are linked + together so all addresses for an interface can be located. */ + +struct ifaddr + { + struct sockaddr ifa_addr; /* Address of interface. */ + union + { + struct sockaddr ifu_broadaddr; + struct sockaddr ifu_dstaddr; + } ifa_ifu; + struct iface *ifa_ifp; /* Back-pointer to interface. */ + struct ifaddr *ifa_next; /* Next address for interface. */ + }; + +# define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ +# define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */ + +/* Device mapping structure. I'd just gone off and designed a + beautiful scheme using only loadable modules with arguments for + driver options and along come the PCMCIA people 8) + + Ah well. The get() side of this is good for WDSETUP, and it'll be + handy for debugging things. The set side is fine for now and being + very small might be worth keeping for clean configuration. */ + +struct ifmap + { + unsigned long int mem_start; + unsigned long int mem_end; + unsigned short int base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; + /* 3 bytes spare */ + }; + +/* Interface request structure used for socket ioctl's. All interface + ioctl's must have parameter definitions which begin with ifr_name. + The remainder may be interface specific. */ + +struct ifreq + { +# define IFHWADDRLEN 6 +# define IFNAMSIZ IF_NAMESIZE + union + { + char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */ + } ifr_ifrn; + + union + { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + int ifru_ivalue; + int ifru_mtu; + struct ifmap ifru_map; + char ifru_slave[IFNAMSIZ]; /* Just fits the size */ + char ifru_newname[IFNAMSIZ]; + __caddr_t ifru_data; + } ifr_ifru; + }; +# define ifr_name ifr_ifrn.ifrn_name /* interface name */ +# define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +# define ifr_addr ifr_ifru.ifru_addr /* address */ +# define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ +# define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +# define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +# define ifr_flags ifr_ifru.ifru_flags /* flags */ +# define ifr_metric ifr_ifru.ifru_ivalue /* metric */ +# define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +# define ifr_map ifr_ifru.ifru_map /* device map */ +# define ifr_slave ifr_ifru.ifru_slave /* slave device */ +# define ifr_data ifr_ifru.ifru_data /* for use by interface */ +# define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ +# define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ +# define ifr_qlen ifr_ifru.ifru_ivalue /* queue length */ +# define ifr_newname ifr_ifru.ifru_newname /* New name */ +# define _IOT_ifreq _IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0) +# define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0) +# define _IOT_ifreq_int _IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0) + + +/* Structure used in SIOCGIFCONF request. Used to retrieve interface + configuration for machine (useful for programs which must know all + networks accessible). */ + +struct ifconf + { + int ifc_len; /* Size of buffer. */ + union + { + __caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; + }; +# define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */ +# define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */ +# define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0) /* not right */ +#endif /* Misc. */ + +__BEGIN_DECLS + +/* Convert an interface name to an index, and vice versa. */ +extern unsigned int if_nametoindex (const char *__ifname) __THROW; +extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW; + +/* Return a list of all interfaces and their indices. */ +extern struct if_nameindex *if_nameindex (void) __THROW; + +/* Free the data returned from if_nameindex. */ +extern void if_freenameindex (struct if_nameindex *__ptr) __THROW; + +__END_DECLS + +#endif /* net/if.h */ diff --git a/REORG.TODO/sysdeps/gnu/netinet/ip_icmp.h b/REORG.TODO/sysdeps/gnu/netinet/ip_icmp.h new file mode 100644 index 0000000000..37373357a7 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/netinet/ip_icmp.h @@ -0,0 +1,282 @@ +/* Copyright (C) 1991-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef __NETINET_IP_ICMP_H +#define __NETINET_IP_ICMP_H 1 + +#include +#include + +__BEGIN_DECLS + +struct icmphdr +{ + uint8_t type; /* message type */ + uint8_t code; /* type sub-code */ + uint16_t checksum; + union + { + struct + { + uint16_t id; + uint16_t sequence; + } echo; /* echo datagram */ + uint32_t gateway; /* gateway address */ + struct + { + uint16_t __glibc_reserved; + uint16_t mtu; + } frag; /* path mtu discovery */ + } un; +}; + +#define ICMP_ECHOREPLY 0 /* Echo Reply */ +#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ +#define ICMP_SOURCE_QUENCH 4 /* Source Quench */ +#define ICMP_REDIRECT 5 /* Redirect (change route) */ +#define ICMP_ECHO 8 /* Echo Request */ +#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ +#define ICMP_PARAMETERPROB 12 /* Parameter Problem */ +#define ICMP_TIMESTAMP 13 /* Timestamp Request */ +#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ +#define ICMP_INFO_REQUEST 15 /* Information Request */ +#define ICMP_INFO_REPLY 16 /* Information Reply */ +#define ICMP_ADDRESS 17 /* Address Mask Request */ +#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ +#define NR_ICMP_TYPES 18 + + +/* Codes for UNREACH. */ +#define ICMP_NET_UNREACH 0 /* Network Unreachable */ +#define ICMP_HOST_UNREACH 1 /* Host Unreachable */ +#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ +#define ICMP_PORT_UNREACH 3 /* Port Unreachable */ +#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ +#define ICMP_SR_FAILED 5 /* Source Route failed */ +#define ICMP_NET_UNKNOWN 6 +#define ICMP_HOST_UNKNOWN 7 +#define ICMP_HOST_ISOLATED 8 +#define ICMP_NET_ANO 9 +#define ICMP_HOST_ANO 10 +#define ICMP_NET_UNR_TOS 11 +#define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 /* Packet filtered */ +#define ICMP_PREC_VIOLATION 14 /* Precedence violation */ +#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ +#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ + +/* Codes for REDIRECT. */ +#define ICMP_REDIR_NET 0 /* Redirect Net */ +#define ICMP_REDIR_HOST 1 /* Redirect Host */ +#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ +#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ + +/* Codes for TIME_EXCEEDED. */ +#define ICMP_EXC_TTL 0 /* TTL count exceeded */ +#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ + + +#ifdef __USE_MISC +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + */ + +#include +#include + +/* + * Internal of an ICMP Router Advertisement + */ +struct icmp_ra_addr +{ + uint32_t ira_addr; + uint32_t ira_preference; +}; + +struct icmp +{ + uint8_t icmp_type; /* type of message, see below */ + uint8_t icmp_code; /* type sub code */ + uint16_t icmp_cksum; /* ones complement checksum of struct */ + union + { + unsigned char ih_pptr; /* ICMP_PARAMPROB */ + struct in_addr ih_gwaddr; /* gateway address */ + struct ih_idseq /* echo datagram */ + { + uint16_t icd_id; + uint16_t icd_seq; + } ih_idseq; + uint32_t ih_void; + + /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ + struct ih_pmtu + { + uint16_t ipm_void; + uint16_t ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv + { + uint8_t irt_num_addrs; + uint8_t irt_wpa; + uint16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime + union + { + struct + { + uint32_t its_otime; + uint32_t its_rtime; + uint32_t its_ttime; + } id_ts; + struct + { + struct ip idi_ip; + /* options and then 64 bits of data */ + } id_ip; + struct icmp_ra_addr id_radv; + uint32_t id_mask; + uint8_t id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +}; + +/* + * Lower bounds on packet lengths for various types. + * For the error advice packets must first insure that the + * packet is large enough to contain the returned ip header. + * Only then can we do the check to see if 64 bits of packet + * data have been returned, since we need to check the returned + * ip header length. + */ +#define ICMP_MINLEN 8 /* abs minimum */ +#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ +#define ICMP_MASKLEN 12 /* address mask */ +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ +#ifndef _IP_VHL +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + /* N.B.: must separately check that ip_hl >= 5 */ +#else +#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8) + /* N.B.: must separately check that header length >= 5 */ +#endif + +/* Definition of type and code fields. */ +/* defined above: ICMP_ECHOREPLY, ICMP_REDIRECT, ICMP_ECHO */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_ROUTERADVERT 9 /* router advertisement */ +#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +#define ICMP_MAXTYPE 18 + +/* UNREACH codes */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ +#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ +#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ +#define ICMP_UNREACH_NET_PROHIB 9 /* net denied */ +#define ICMP_UNREACH_HOST_PROHIB 10 /* host denied */ +#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ +#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ +#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */ +#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */ +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */ + +/* REDIRECT codes */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ + +/* TIMEXCEED codes */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ + +/* PARAMPROB code */ +#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ + (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ + (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ + (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ + (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) + +#endif /* __USE_MISC */ + +__END_DECLS + +#endif /* netinet/ip_icmp.h */ diff --git a/REORG.TODO/sysdeps/gnu/netinet/tcp.h b/REORG.TODO/sysdeps/gnu/netinet/tcp.h new file mode 100644 index 0000000000..af94b8e82c --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/netinet/tcp.h @@ -0,0 +1,324 @@ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_TCP_H +#define _NETINET_TCP_H 1 + +#include + +/* + * User-settable options (used with setsockopt). + */ +#define TCP_NODELAY 1 /* Don't delay send to coalesce packets */ +#define TCP_MAXSEG 2 /* Set maximum segment size */ +#define TCP_CORK 3 /* Control sending of partial frames */ +#define TCP_KEEPIDLE 4 /* Start keeplives after this period */ +#define TCP_KEEPINTVL 5 /* Interval between keepalives */ +#define TCP_KEEPCNT 6 /* Number of keepalives before death */ +#define TCP_SYNCNT 7 /* Number of SYN retransmits */ +#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ +#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ +#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ +#define TCP_INFO 11 /* Information about this connection. */ +#define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */ +#define TCP_CONGESTION 13 /* Congestion control algorithm. */ +#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ +#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */ +#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ +#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ +#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ +#define TCP_REPAIR 19 /* TCP sock is under repair right now */ +#define TCP_REPAIR_QUEUE 20 /* Set TCP queue to repair */ +#define TCP_QUEUE_SEQ 21 /* Set sequence number of repaired queue. */ +#define TCP_REPAIR_OPTIONS 22 /* Repair TCP connection options */ +#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */ +#define TCP_TIMESTAMP 24 /* TCP time stamp */ +#define TCP_NOTSENT_LOWAT 25 /* Limit number of unsent bytes in + write queue. */ +#define TCP_CC_INFO 26 /* Get Congestion Control + (optional) info. */ +#define TCP_SAVE_SYN 27 /* Record SYN headers for new + connections. */ +#define TCP_SAVED_SYN 28 /* Get SYN headers recorded for + connection. */ +#define TCP_REPAIR_WINDOW 29 /* Get/set window parameters. */ +#define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect. */ + +#ifdef __USE_MISC +# include +# include +# include + +typedef uint32_t tcp_seq; +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct tcphdr + { + __extension__ union + { + struct + { + uint16_t th_sport; /* source port */ + uint16_t th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +# if __BYTE_ORDER == __LITTLE_ENDIAN + uint8_t th_x2:4; /* (unused) */ + uint8_t th_off:4; /* data offset */ +# endif +# if __BYTE_ORDER == __BIG_ENDIAN + uint8_t th_off:4; /* data offset */ + uint8_t th_x2:4; /* (unused) */ +# endif + uint8_t th_flags; +# define TH_FIN 0x01 +# define TH_SYN 0x02 +# define TH_RST 0x04 +# define TH_PUSH 0x08 +# define TH_ACK 0x10 +# define TH_URG 0x20 + uint16_t th_win; /* window */ + uint16_t th_sum; /* checksum */ + uint16_t th_urp; /* urgent pointer */ + }; + struct + { + uint16_t source; + uint16_t dest; + uint32_t seq; + uint32_t ack_seq; +# if __BYTE_ORDER == __LITTLE_ENDIAN + uint16_t res1:4; + uint16_t doff:4; + uint16_t fin:1; + uint16_t syn:1; + uint16_t rst:1; + uint16_t psh:1; + uint16_t ack:1; + uint16_t urg:1; + uint16_t res2:2; +# elif __BYTE_ORDER == __BIG_ENDIAN + uint16_t doff:4; + uint16_t res1:4; + uint16_t res2:2; + uint16_t urg:1; + uint16_t ack:1; + uint16_t psh:1; + uint16_t rst:1; + uint16_t syn:1; + uint16_t fin:1; +# else +# error "Adjust your defines" +# endif + uint16_t window; + uint16_t check; + uint16_t urg_ptr; + }; + }; +}; + +enum +{ + TCP_ESTABLISHED = 1, + TCP_SYN_SENT, + TCP_SYN_RECV, + TCP_FIN_WAIT1, + TCP_FIN_WAIT2, + TCP_TIME_WAIT, + TCP_CLOSE, + TCP_CLOSE_WAIT, + TCP_LAST_ACK, + TCP_LISTEN, + TCP_CLOSING /* now a valid state */ +}; + +# define TCPOPT_EOL 0 +# define TCPOPT_NOP 1 +# define TCPOPT_MAXSEG 2 +# define TCPOLEN_MAXSEG 4 +# define TCPOPT_WINDOW 3 +# define TCPOLEN_WINDOW 3 +# define TCPOPT_SACK_PERMITTED 4 /* Experimental */ +# define TCPOLEN_SACK_PERMITTED 2 +# define TCPOPT_SACK 5 /* Experimental */ +# define TCPOPT_TIMESTAMP 8 +# define TCPOLEN_TIMESTAMP 10 +# define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ + +# define TCPOPT_TSTAMP_HDR \ + (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). + */ +# define TCP_MSS 512 + +# define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ + +# define TCP_MAX_WINSHIFT 14 /* maximum window shift */ + +# define SOL_TCP 6 /* TCP level */ + + +# define TCPI_OPT_TIMESTAMPS 1 +# define TCPI_OPT_SACK 2 +# define TCPI_OPT_WSCALE 4 +# define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */ +# define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */ +# define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */ + +/* Values for tcpi_state. */ +enum tcp_ca_state +{ + TCP_CA_Open = 0, + TCP_CA_Disorder = 1, + TCP_CA_CWR = 2, + TCP_CA_Recovery = 3, + TCP_CA_Loss = 4 +}; + +struct tcp_info +{ + uint8_t tcpi_state; + uint8_t tcpi_ca_state; + uint8_t tcpi_retransmits; + uint8_t tcpi_probes; + uint8_t tcpi_backoff; + uint8_t tcpi_options; + uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; + + uint32_t tcpi_rto; + uint32_t tcpi_ato; + uint32_t tcpi_snd_mss; + uint32_t tcpi_rcv_mss; + + uint32_t tcpi_unacked; + uint32_t tcpi_sacked; + uint32_t tcpi_lost; + uint32_t tcpi_retrans; + uint32_t tcpi_fackets; + + /* Times. */ + uint32_t tcpi_last_data_sent; + uint32_t tcpi_last_ack_sent; /* Not remembered, sorry. */ + uint32_t tcpi_last_data_recv; + uint32_t tcpi_last_ack_recv; + + /* Metrics. */ + uint32_t tcpi_pmtu; + uint32_t tcpi_rcv_ssthresh; + uint32_t tcpi_rtt; + uint32_t tcpi_rttvar; + uint32_t tcpi_snd_ssthresh; + uint32_t tcpi_snd_cwnd; + uint32_t tcpi_advmss; + uint32_t tcpi_reordering; + + uint32_t tcpi_rcv_rtt; + uint32_t tcpi_rcv_space; + + uint32_t tcpi_total_retrans; +}; + + +/* For TCP_MD5SIG socket option. */ +#define TCP_MD5SIG_MAXKEYLEN 80 + +struct tcp_md5sig +{ + struct sockaddr_storage tcpm_addr; /* Address associated. */ + uint16_t __tcpm_pad1; /* Zero. */ + uint16_t tcpm_keylen; /* Key length. */ + uint32_t __tcpm_pad2; /* Zero. */ + uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */ +}; + +/* For socket repair options. */ +struct tcp_repair_opt +{ + uint32_t opt_code; + uint32_t opt_val; +}; + +/* Queue to repair, for TCP_REPAIR_QUEUE. */ +enum +{ + TCP_NO_QUEUE, + TCP_RECV_QUEUE, + TCP_SEND_QUEUE, + TCP_QUEUES_NR, +}; + +/* For cookie transactions socket options. */ +#define TCP_COOKIE_MIN 8 /* 64-bits */ +#define TCP_COOKIE_MAX 16 /* 128-bits */ +#define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX) + +/* Flags for both getsockopt and setsockopt */ +#define TCP_COOKIE_IN_ALWAYS (1 << 0) /* Discard SYN without cookie */ +#define TCP_COOKIE_OUT_NEVER (1 << 1) /* Prohibit outgoing cookies, + * supercedes everything. */ + +/* Flags for getsockopt */ +#define TCP_S_DATA_IN (1 << 2) /* Was data received? */ +#define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */ + +#define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */ +#define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */ + +struct tcp_cookie_transactions +{ + uint16_t tcpct_flags; + uint8_t __tcpct_pad1; + uint8_t tcpct_cookie_desired; + uint16_t tcpct_s_data_desired; + uint16_t tcpct_used; + uint8_t tcpct_value[TCP_MSS_DEFAULT]; +}; + +/* For use with TCP_REPAIR_WINDOW. */ +struct tcp_repair_window +{ + uint32_t snd_wl1; + uint32_t snd_wnd; + uint32_t max_window; + uint32_t rcv_wnd; + uint32_t rcv_wup; +}; + +#endif /* Misc. */ + +#endif /* netinet/tcp.h */ diff --git a/REORG.TODO/sysdeps/gnu/netinet/udp.h b/REORG.TODO/sysdeps/gnu/netinet/udp.h new file mode 100644 index 0000000000..a4eb32d76b --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/netinet/udp.h @@ -0,0 +1,94 @@ +/* Copyright (C) 1991-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * Copyright (C) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __NETINET_UDP_H +#define __NETINET_UDP_H 1 + +#include +#include + +/* UDP header as specified by RFC 768, August 1980. */ + +struct udphdr +{ + __extension__ union + { + struct + { + uint16_t uh_sport; /* source port */ + uint16_t uh_dport; /* destination port */ + uint16_t uh_ulen; /* udp length */ + uint16_t uh_sum; /* udp checksum */ + }; + struct + { + uint16_t source; + uint16_t dest; + uint16_t len; + uint16_t check; + }; + }; +}; + +/* UDP socket options */ +#define UDP_CORK 1 /* Never send partially complete segments. */ +#define UDP_ENCAP 100 /* Set the socket to accept + encapsulated packets. */ +#define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP + over IPv6. */ +#define UDP_NO_CHECK6_RX 102 /* Disable accepting checksum for UDP + over IPv6. */ + +/* UDP encapsulation types */ +#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ +#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ +#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ +#define UDP_ENCAP_GTP0 4 /* GSM TS 09.60 */ +#define UDP_ENCAP_GTP1U 5 /* 3GPP TS 29.060 */ + +#define SOL_UDP 17 /* sockopt level for UDP */ + +#endif /* netinet/udp.h */ diff --git a/REORG.TODO/sysdeps/gnu/rt-unwind-resume.c b/REORG.TODO/sysdeps/gnu/rt-unwind-resume.c new file mode 100644 index 0000000000..743e675d4d --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/rt-unwind-resume.c @@ -0,0 +1 @@ +#include diff --git a/REORG.TODO/sysdeps/gnu/siglist.c b/REORG.TODO/sysdeps/gnu/siglist.c new file mode 100644 index 0000000000..08d7488bb0 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/siglist.c @@ -0,0 +1,78 @@ +/* Define list of all signal numbers and their names. + Copyright (C) 1997-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include + +const char *const __new_sys_siglist[NSIG] = +{ +#define init_sig(sig, abbrev, desc) [sig] = desc, +#include +#undef init_sig +}; +libc_hidden_ver (__new_sys_siglist, _sys_siglist) + +const char *const __new_sys_sigabbrev[NSIG] = +{ +#define init_sig(sig, abbrev, desc) [sig] = abbrev, +#include +#undef init_sig +}; + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +declare_symbol_alias (__old_sys_siglist, __new_sys_siglist, object, + OLD_SIGLIST_SIZE * __WORDSIZE / 8) + +declare_symbol_alias (__old_sys_sigabbrev, __new_sys_sigabbrev, object, + OLD_SIGLIST_SIZE * __WORDSIZE / 8) + +declare_symbol_alias (_old_sys_siglist, __new_sys_siglist, object, + OLD_SIGLIST_SIZE * __WORDSIZE / 8) + +compat_symbol (libc, __old_sys_siglist, _sys_siglist, GLIBC_2_0); +compat_symbol (libc, _old_sys_siglist, sys_siglist, GLIBC_2_0); +compat_symbol (libc, __old_sys_sigabbrev, sys_sigabbrev, GLIBC_2_0); +#endif + +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3) && defined OLD2_SIGLIST_SIZE +declare_symbol_alias (__old2_sys_siglist, __new_sys_siglist, object, + OLD2_SIGLIST_SIZE * __WORDSIZE / 8) + +declare_symbol_alias (__old2_sys_sigabbrev, __new_sys_sigabbrev, object, + OLD2_SIGLIST_SIZE * __WORDSIZE / 8) + +declare_symbol_alias (_old2_sys_siglist, __new_sys_siglist, object, + OLD2_SIGLIST_SIZE * __WORDSIZE / 8) + +compat_symbol (libc, __old2_sys_siglist, _sys_siglist, GLIBC_2_1); +compat_symbol (libc, _old2_sys_siglist, sys_siglist, GLIBC_2_1); +compat_symbol (libc, __old2_sys_sigabbrev, sys_sigabbrev, GLIBC_2_1); + +strong_alias (__new_sys_siglist, _new_sys_siglist) +versioned_symbol (libc, __new_sys_siglist, _sys_siglist, GLIBC_2_3_3); +versioned_symbol (libc, _new_sys_siglist, sys_siglist, GLIBC_2_3_3); +versioned_symbol (libc, __new_sys_sigabbrev, sys_sigabbrev, GLIBC_2_3_3); +#else +strong_alias (__new_sys_siglist, _new_sys_siglist) +versioned_symbol (libc, __new_sys_siglist, _sys_siglist, GLIBC_2_1); +versioned_symbol (libc, _new_sys_siglist, sys_siglist, GLIBC_2_1); +versioned_symbol (libc, __new_sys_sigabbrev, sys_sigabbrev, GLIBC_2_1); +#endif diff --git a/REORG.TODO/sysdeps/gnu/sys/mtio.h b/REORG.TODO/sysdeps/gnu/sys/mtio.h new file mode 100644 index 0000000000..770b832e02 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/sys/mtio.h @@ -0,0 +1,276 @@ +/* Structures and definitions for magnetic tape I/O control commands. + Copyright (C) 1996-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Written by H. Bergman . */ + +#ifndef _SYS_MTIO_H +#define _SYS_MTIO_H 1 + +/* Get necessary definitions from system and kernel headers. */ +#include +#include + + +/* Structure for MTIOCTOP - magnetic tape operation command. */ +struct mtop + { + short int mt_op; /* Operations defined below. */ + int mt_count; /* How many of them. */ + }; +#define _IOT_mtop /* Hurd ioctl type field. */ \ + _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0) + +/* Magnetic Tape operations [Not all operations supported by all drivers]. */ +#define MTRESET 0 /* +reset drive in case of problems. */ +#define MTFSF 1 /* Forward space over FileMark, + * position at first record of next file. */ +#define MTBSF 2 /* Backward space FileMark (position before FM). */ +#define MTFSR 3 /* Forward space record. */ +#define MTBSR 4 /* Backward space record. */ +#define MTWEOF 5 /* Write an end-of-file record (mark). */ +#define MTREW 6 /* Rewind. */ +#define MTOFFL 7 /* Rewind and put the drive offline (eject?). */ +#define MTNOP 8 /* No op, set status only (read with MTIOCGET). */ +#define MTRETEN 9 /* Retension tape. */ +#define MTBSFM 10 /* +backward space FileMark, position at FM. */ +#define MTFSFM 11 /* +forward space FileMark, position at FM. */ +#define MTEOM 12 /* Goto end of recorded media (for appending files). + MTEOM positions after the last FM, ready for + appending another file. */ +#define MTERASE 13 /* Erase tape -- be careful! */ + +#define MTRAS1 14 /* Run self test 1 (nondestructive). */ +#define MTRAS2 15 /* Run self test 2 (destructive). */ +#define MTRAS3 16 /* Reserved for self test 3. */ + +#define MTSETBLK 20 /* Set block length (SCSI). */ +#define MTSETDENSITY 21 /* Set tape density (SCSI). */ +#define MTSEEK 22 /* Seek to block (Tandberg, etc.). */ +#define MTTELL 23 /* Tell block (Tandberg, etc.). */ +#define MTSETDRVBUFFER 24 /* Set the drive buffering according to SCSI-2. + Ordinary buffered operation with code 1. */ +#define MTFSS 25 /* Space forward over setmarks. */ +#define MTBSS 26 /* Space backward over setmarks. */ +#define MTWSM 27 /* Write setmarks. */ + +#define MTLOCK 28 /* Lock the drive door. */ +#define MTUNLOCK 29 /* Unlock the drive door. */ +#define MTLOAD 30 /* Execute the SCSI load command. */ +#define MTUNLOAD 31 /* Execute the SCSI unload command. */ +#define MTCOMPRESSION 32/* Control compression with SCSI mode page 15. */ +#define MTSETPART 33 /* Change the active tape partition. */ +#define MTMKPART 34 /* Format the tape with one or two partitions. */ + +/* structure for MTIOCGET - mag tape get status command */ + +struct mtget + { + long int mt_type; /* Type of magtape device. */ + long int mt_resid; /* Residual count: (not sure) + number of bytes ignored, or + number of files not skipped, or + number of records not skipped. */ + /* The following registers are device dependent. */ + long int mt_dsreg; /* Status register. */ + long int mt_gstat; /* Generic (device independent) status. */ + long int mt_erreg; /* Error register. */ + /* The next two fields are not always used. */ + __daddr_t mt_fileno; /* Number of current file on tape. */ + __daddr_t mt_blkno; /* Current block number. */ + }; +#define _IOT_mtget /* Hurd ioctl type field. */ \ + _IOT (_IOTS (long), 7, 0, 0, 0, 0) + + +/* Constants for mt_type. Not all of these are supported, and + these are not all of the ones that are supported. */ +#define MT_ISUNKNOWN 0x01 +#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer. */ +#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02. */ +#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02?. */ +#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?). */ +#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24. */ +#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02. */ +#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L. */ +#define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L. */ +#define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller. */ +#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features. */ +#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24. */ +#define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, + Teac DC-1 card (Wangtek type). */ +#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40). */ +#define MT_ISDDS1 0x51 /* DDS device without partitions. */ +#define MT_ISDDS2 0x52 /* DDS device with partitions. */ +#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit. */ +#define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit. */ + +/* QIC-40/80/3010/3020 ftape supported drives. + 20bit vendor ID + 0x800000 (see vendors.h in ftape distribution). */ +#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ +#define MT_ISFTAPE_FLAG 0x800000 + +struct mt_tape_info + { + long int t_type; /* Device type id (mt_type). */ + char *t_name; /* Descriptive name. */ + }; + +#define MT_TAPE_INFO \ + { \ + {MT_ISUNKNOWN, "Unknown type of tape device"}, \ + {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \ + {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \ + {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \ + {MT_ISCMSJ500, "CMS Jumbo 500"}, \ + {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \ + {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \ + {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \ + {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \ + {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \ + {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \ + {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \ + {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \ + {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ + {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ + {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ + {0, NULL} \ + } + + +/* Structure for MTIOCPOS - mag tape get position command. */ + +struct mtpos + { + long int mt_blkno; /* Current block number. */ + }; +#define _IOT_mtpos /* Hurd ioctl type field. */ \ + _IOT_SIMPLE (long) + + +/* Structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended + as an interim solution for QIC-02 until DDI is fully implemented. */ +struct mtconfiginfo + { + long int mt_type; /* Drive type. */ + long int ifc_type; /* Interface card type. */ + unsigned short int irqnr; /* IRQ number to use. */ + unsigned short int dmanr; /* DMA channel to use. */ + unsigned short int port; /* IO port base address. */ + + unsigned long int debug; /* Debugging flags. */ + + unsigned have_dens:1; + unsigned have_bsf:1; + unsigned have_fsr:1; + unsigned have_bsr:1; + unsigned have_eod:1; + unsigned have_seek:1; + unsigned have_tell:1; + unsigned have_ras1:1; + unsigned have_ras2:1; + unsigned have_ras3:1; + unsigned have_qfa:1; + + unsigned pad1:5; + char reserved[10]; + }; +#define _IOT_mtconfiginfo /* Hurd ioctl type field. */ \ + _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1) /* XXX wrong */ + + +/* Magnetic tape I/O control commands. */ +#define MTIOCTOP _IOW('m', 1, struct mtop) /* Do a mag tape op. */ +#define MTIOCGET _IOR('m', 2, struct mtget) /* Get tape status. */ +#define MTIOCPOS _IOR('m', 3, struct mtpos) /* Get tape position.*/ + +/* The next two are used by the QIC-02 driver for runtime reconfiguration. + See tpqic02.h for struct mtconfiginfo. */ +#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* Get tape config.*/ +#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* Set tape config.*/ + +/* Generic Mag Tape (device independent) status macros for examining + mt_gstat -- HP-UX compatible. + There is room for more generic status bits here, but I don't + know which of them are reserved. At least three or so should + be added to make this really useful. */ +#define GMT_EOF(x) ((x) & 0x80000000) +#define GMT_BOT(x) ((x) & 0x40000000) +#define GMT_EOT(x) ((x) & 0x20000000) +#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */ +#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */ +#define GMT_WR_PROT(x) ((x) & 0x04000000) +/* #define GMT_ ? ((x) & 0x02000000) */ +#define GMT_ONLINE(x) ((x) & 0x01000000) +#define GMT_D_6250(x) ((x) & 0x00800000) +#define GMT_D_1600(x) ((x) & 0x00400000) +#define GMT_D_800(x) ((x) & 0x00200000) +/* #define GMT_ ? ((x) & 0x00100000) */ +/* #define GMT_ ? ((x) & 0x00080000) */ +#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* Door open (no tape). */ +/* #define GMT_ ? ((x) & 0x00020000) */ +#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* Immediate report mode.*/ +/* 16 generic status bits unused. */ + + +/* SCSI-tape specific definitions. Bitfield shifts in the status */ +#define MT_ST_BLKSIZE_SHIFT 0 +#define MT_ST_BLKSIZE_MASK 0xffffff +#define MT_ST_DENSITY_SHIFT 24 +#define MT_ST_DENSITY_MASK 0xff000000 + +#define MT_ST_SOFTERR_SHIFT 0 +#define MT_ST_SOFTERR_MASK 0xffff + +/* Bitfields for the MTSETDRVBUFFER ioctl. */ +#define MT_ST_OPTIONS 0xf0000000 +#define MT_ST_BOOLEANS 0x10000000 +#define MT_ST_SETBOOLEANS 0x30000000 +#define MT_ST_CLEARBOOLEANS 0x40000000 +#define MT_ST_WRITE_THRESHOLD 0x20000000 +#define MT_ST_DEF_BLKSIZE 0x50000000 +#define MT_ST_DEF_OPTIONS 0x60000000 + +#define MT_ST_BUFFER_WRITES 0x1 +#define MT_ST_ASYNC_WRITES 0x2 +#define MT_ST_READ_AHEAD 0x4 +#define MT_ST_DEBUGGING 0x8 +#define MT_ST_TWO_FM 0x10 +#define MT_ST_FAST_MTEOM 0x20 +#define MT_ST_AUTO_LOCK 0x40 +#define MT_ST_DEF_WRITES 0x80 +#define MT_ST_CAN_BSR 0x100 +#define MT_ST_NO_BLKLIMS 0x200 +#define MT_ST_CAN_PARTITIONS 0x400 +#define MT_ST_SCSI2LOGICAL 0x800 + +/* The mode parameters to be controlled. Parameter chosen with bits 20-28. */ +#define MT_ST_CLEAR_DEFAULT 0xfffff +#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) +#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) +#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) + +/* The offset for the arguments for the special HP changer load command. */ +#define MT_ST_HPLOADER_OFFSET 10000 + + +/* Specify default tape device. */ +#ifndef DEFTAPE +# define DEFTAPE "/dev/tape" +#endif + +#endif /* mtio.h */ diff --git a/REORG.TODO/sysdeps/gnu/unwind-resume.c b/REORG.TODO/sysdeps/gnu/unwind-resume.c new file mode 100644 index 0000000000..1ea833ba9b --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/unwind-resume.c @@ -0,0 +1,82 @@ +/* Copyright (C) 2003-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#include +#include +#include +#include +#include +#include + + +void (*__libgcc_s_resume) (struct _Unwind_Exception *exc) + attribute_hidden __attribute__ ((noreturn)); + +static _Unwind_Reason_Code (*libgcc_s_personality) PERSONALITY_PROTO; + +void attribute_hidden __attribute__ ((cold)) +__libgcc_s_init (void) +{ + void *resume, *personality; + void *handle; + + handle = __libc_dlopen (LIBGCC_S_SO); + + if (handle == NULL + || (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL + || (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL) + __libc_fatal (LIBGCC_S_SO + " must be installed for pthread_cancel to work\n"); + +#ifdef PTR_MANGLE + PTR_MANGLE (resume); +#endif + __libgcc_s_resume = resume; +#ifdef PTR_MANGLE + PTR_MANGLE (personality); +#endif + libgcc_s_personality = personality; +} + +#if !HAVE_ARCH_UNWIND_RESUME +void +_Unwind_Resume (struct _Unwind_Exception *exc) +{ + if (__glibc_unlikely (__libgcc_s_resume == NULL)) + __libgcc_s_init (); + + __typeof (__libgcc_s_resume) resume = __libgcc_s_resume; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (resume); +#endif + (*resume) (exc); +} +#endif + +_Unwind_Reason_Code +__gcc_personality_v0 PERSONALITY_PROTO +{ + if (__glibc_unlikely (libgcc_s_personality == NULL)) + __libgcc_s_init (); + + __typeof (libgcc_s_personality) personality = libgcc_s_personality; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (personality); +#endif + return (*personality) PERSONALITY_ARGS; +} diff --git a/REORG.TODO/sysdeps/gnu/updwtmp.c b/REORG.TODO/sysdeps/gnu/updwtmp.c new file mode 100644 index 0000000000..ab5ca2b10d --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/updwtmp.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1998-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Mark Kettenis , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +#define TRANSFORM_UTMP_FILE_NAME(file_name) \ + ((strcmp (file_name, _PATH_UTMP "x") == 0 \ + && __access (_PATH_UTMP "x", F_OK) != 0) ? _PATH_UTMP : \ + ((strcmp (file_name, _PATH_WTMP "x") == 0 \ + && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \ + file_name)) + +#include diff --git a/REORG.TODO/sysdeps/gnu/utmp_file.c b/REORG.TODO/sysdeps/gnu/utmp_file.c new file mode 100644 index 0000000000..d4f7a94d9e --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/utmp_file.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1998-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Mark Kettenis , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +#define TRANSFORM_UTMP_FILE_NAME(file_name) \ + ((strcmp (file_name, _PATH_UTMP "x") == 0 \ + && __access (_PATH_UTMP "x", F_OK) != 0) ? _PATH_UTMP : \ + ((strcmp (file_name, _PATH_WTMP "x") == 0 \ + && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \ + file_name)) + +#include diff --git a/REORG.TODO/sysdeps/gnu/utmpx.h b/REORG.TODO/sysdeps/gnu/utmpx.h new file mode 100644 index 0000000000..fbf55bd756 --- /dev/null +++ b/REORG.TODO/sysdeps/gnu/utmpx.h @@ -0,0 +1,125 @@ +/* Copyright (C) 1997-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _UTMPX_H +#define _UTMPX_H 1 + +#include +#include + +/* Required according to Unix98. */ +#ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +#endif + +/* Get system dependent values and data structures. */ +#include + +#ifdef __USE_GNU +/* Compatibility names for the strings of the canonical file names. */ +# define UTMPX_FILE _PATH_UTMPX +# define UTMPX_FILENAME _PATH_UTMPX +# define WTMPX_FILE _PATH_WTMPX +# define WTMPX_FILENAME _PATH_WTMPX +#endif + +/* For the getutmp{,x} functions we need the `struct utmp'. */ +#ifdef __USE_GNU +struct utmp; +#endif + + +__BEGIN_DECLS + +/* Open user accounting database. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void setutxent (void); + +/* Close user accounting database. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void endutxent (void); + +/* Get the next entry from the user accounting database. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct utmpx *getutxent (void); + +/* Get the user accounting database entry corresponding to ID. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct utmpx *getutxid (const struct utmpx *__id); + +/* Get the user accounting database entry corresponding to LINE. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct utmpx *getutxline (const struct utmpx *__line); + +/* Write the entry UTMPX into the user accounting database. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct utmpx *pututxline (const struct utmpx *__utmpx); + + +#ifdef __USE_GNU +/* Change name of the utmpx file to be examined. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int utmpxname (const char *__file); + +/* Append entry UTMP to the wtmpx-like file WTMPX_FILE. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void updwtmpx (const char *__wtmpx_file, + const struct utmpx *__utmpx); + + +/* Copy the information in UTMPX to UTMP. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void getutmp (const struct utmpx *__utmpx, + struct utmp *__utmp); + +/* Copy the information in UTMP to UTMPX. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern void getutmpx (const struct utmp *__utmp, struct utmpx *__utmpx); +#endif + +__END_DECLS + +#endif /* utmpx.h */ -- cgit v1.2.3