aboutsummaryrefslogtreecommitdiff
path: root/REORG.TODO/misc
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
committerZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
commit5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch)
tree4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/misc
parent199fc19d3aaaf57944ef036e15904febe877fc93 (diff)
downloadglibc-zack/build-layout-experiment.tar
glibc-zack/build-layout-experiment.tar.gz
glibc-zack/build-layout-experiment.tar.bz2
glibc-zack/build-layout-experiment.zip
Prepare for radical source tree reorganization.zack/build-layout-experiment
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).
Diffstat (limited to 'REORG.TODO/misc')
-rw-r--r--REORG.TODO/misc/Makefile138
-rw-r--r--REORG.TODO/misc/Versions167
-rw-r--r--REORG.TODO/misc/acct.c31
-rw-r--r--REORG.TODO/misc/ar.h47
-rw-r--r--REORG.TODO/misc/bits/error.h73
-rw-r--r--REORG.TODO/misc/bits/select2.h35
-rw-r--r--REORG.TODO/misc/bits/stab.def233
-rw-r--r--REORG.TODO/misc/bits/syslog-ldbl.h35
-rw-r--r--REORG.TODO/misc/bits/syslog.h49
-rw-r--r--REORG.TODO/misc/bits/types/struct_iovec.h32
-rw-r--r--REORG.TODO/misc/brk.c34
-rw-r--r--REORG.TODO/misc/bug-hsearch1.c31
-rw-r--r--REORG.TODO/misc/bug18240.c97
-rw-r--r--REORG.TODO/misc/chflags.c39
-rw-r--r--REORG.TODO/misc/chroot.c31
-rw-r--r--REORG.TODO/misc/daemon.c93
-rw-r--r--REORG.TODO/misc/dirname.c80
-rw-r--r--REORG.TODO/misc/efgcvt.c126
-rw-r--r--REORG.TODO/misc/efgcvt_r.c257
-rw-r--r--REORG.TODO/misc/err.c179
-rw-r--r--REORG.TODO/misc/err.h57
-rw-r--r--REORG.TODO/misc/error.c408
-rw-r--r--REORG.TODO/misc/error.h57
-rw-r--r--REORG.TODO/misc/fchflags.c39
-rw-r--r--REORG.TODO/misc/fdatasync.c27
-rw-r--r--REORG.TODO/misc/fgetxattr.c29
-rw-r--r--REORG.TODO/misc/flistxattr.c28
-rw-r--r--REORG.TODO/misc/fremovexattr.c28
-rw-r--r--REORG.TODO/misc/fsetxattr.c29
-rw-r--r--REORG.TODO/misc/fstab.c186
-rw-r--r--REORG.TODO/misc/fstab.h79
-rw-r--r--REORG.TODO/misc/fsync.c30
-rw-r--r--REORG.TODO/misc/ftruncate.c32
-rw-r--r--REORG.TODO/misc/ftruncate64.c33
-rw-r--r--REORG.TODO/misc/futimes.c32
-rw-r--r--REORG.TODO/misc/futimesat.c41
-rw-r--r--REORG.TODO/misc/getauxval.c45
-rw-r--r--REORG.TODO/misc/getclktck.c29
-rw-r--r--REORG.TODO/misc/getdomain.c58
-rw-r--r--REORG.TODO/misc/getdtsz.c31
-rw-r--r--REORG.TODO/misc/gethostid.c30
-rw-r--r--REORG.TODO/misc/gethostname.c32
-rw-r--r--REORG.TODO/misc/getloadavg.c35
-rw-r--r--REORG.TODO/misc/getpagesize.c31
-rw-r--r--REORG.TODO/misc/getpass.c124
-rw-r--r--REORG.TODO/misc/getsysstats.c67
-rw-r--r--REORG.TODO/misc/getttyent.c215
-rw-r--r--REORG.TODO/misc/getusershell.c143
-rw-r--r--REORG.TODO/misc/getxattr.c29
-rw-r--r--REORG.TODO/misc/gtty.c36
-rw-r--r--REORG.TODO/misc/hsearch.c53
-rw-r--r--REORG.TODO/misc/hsearch_r.c231
-rw-r--r--REORG.TODO/misc/ifunc-impl-list.c32
-rw-r--r--REORG.TODO/misc/init-misc.c40
-rw-r--r--REORG.TODO/misc/insremque.c53
-rw-r--r--REORG.TODO/misc/ioctl.c31
-rw-r--r--REORG.TODO/misc/lgetxattr.c29
-rw-r--r--REORG.TODO/misc/libgen.h39
-rw-r--r--REORG.TODO/misc/listxattr.c28
-rw-r--r--REORG.TODO/misc/llistxattr.c28
-rw-r--r--REORG.TODO/misc/lremovexattr.c28
-rw-r--r--REORG.TODO/misc/lsearch.c58
-rw-r--r--REORG.TODO/misc/lsetxattr.c29
-rw-r--r--REORG.TODO/misc/lutimes.c33
-rw-r--r--REORG.TODO/misc/madvise.c35
-rw-r--r--REORG.TODO/misc/makedev.c30
-rw-r--r--REORG.TODO/misc/mincore.c28
-rw-r--r--REORG.TODO/misc/mkdtemp.c33
-rw-r--r--REORG.TODO/misc/mkostemp.c38
-rw-r--r--REORG.TODO/misc/mkostemp64.c35
-rw-r--r--REORG.TODO/misc/mkostemps.c45
-rw-r--r--REORG.TODO/misc/mkostemps64.c42
-rw-r--r--REORG.TODO/misc/mkstemp.c38
-rw-r--r--REORG.TODO/misc/mkstemp64.c35
-rw-r--r--REORG.TODO/misc/mkstemps.c45
-rw-r--r--REORG.TODO/misc/mkstemps64.c42
-rw-r--r--REORG.TODO/misc/mktemp.c36
-rw-r--r--REORG.TODO/misc/mlock.c33
-rw-r--r--REORG.TODO/misc/mlockall.c34
-rw-r--r--REORG.TODO/misc/mmap.c39
-rw-r--r--REORG.TODO/misc/mmap64.c47
-rw-r--r--REORG.TODO/misc/mntent.c53
-rw-r--r--REORG.TODO/misc/mntent.h95
-rw-r--r--REORG.TODO/misc/mntent_r.c296
-rw-r--r--REORG.TODO/misc/mprotect.c34
-rw-r--r--REORG.TODO/misc/msync.c33
-rw-r--r--REORG.TODO/misc/munlock.c32
-rw-r--r--REORG.TODO/misc/munlockall.c32
-rw-r--r--REORG.TODO/misc/munmap.c33
-rw-r--r--REORG.TODO/misc/preadv.c35
-rw-r--r--REORG.TODO/misc/preadv2.c30
-rw-r--r--REORG.TODO/misc/preadv64.c35
-rw-r--r--REORG.TODO/misc/preadv64v2.c30
-rw-r--r--REORG.TODO/misc/pselect.c78
-rw-r--r--REORG.TODO/misc/ptrace.c108
-rw-r--r--REORG.TODO/misc/pwritev.c35
-rw-r--r--REORG.TODO/misc/pwritev2.c30
-rw-r--r--REORG.TODO/misc/pwritev64.c35
-rw-r--r--REORG.TODO/misc/pwritev64v2.c30
-rw-r--r--REORG.TODO/misc/qefgcvt.c46
-rw-r--r--REORG.TODO/misc/qefgcvt_r.c57
-rw-r--r--REORG.TODO/misc/readv.c35
-rw-r--r--REORG.TODO/misc/reboot.c33
-rw-r--r--REORG.TODO/misc/regexp.c92
-rw-r--r--REORG.TODO/misc/regexp.h33
-rw-r--r--REORG.TODO/misc/remap_file_pages.c33
-rw-r--r--REORG.TODO/misc/removexattr.c28
-rw-r--r--REORG.TODO/misc/revoke.c28
-rw-r--r--REORG.TODO/misc/sbrk.c64
-rw-r--r--REORG.TODO/misc/search.h174
-rw-r--r--REORG.TODO/misc/select.c37
-rw-r--r--REORG.TODO/misc/setdomain.c30
-rw-r--r--REORG.TODO/misc/setegid.c29
-rw-r--r--REORG.TODO/misc/seteuid.c29
-rw-r--r--REORG.TODO/misc/sethostid.c31
-rw-r--r--REORG.TODO/misc/sethostname.c31
-rw-r--r--REORG.TODO/misc/setregid.c32
-rw-r--r--REORG.TODO/misc/setreuid.c32
-rw-r--r--REORG.TODO/misc/setxattr.c29
-rw-r--r--REORG.TODO/misc/sgtty.h40
-rw-r--r--REORG.TODO/misc/sstk.c32
-rw-r--r--REORG.TODO/misc/stab.h17
-rw-r--r--REORG.TODO/misc/stty.c36
-rw-r--r--REORG.TODO/misc/swapoff.c29
-rw-r--r--REORG.TODO/misc/swapon.c31
-rw-r--r--REORG.TODO/misc/sync.c29
-rw-r--r--REORG.TODO/misc/syncfs.c31
-rw-r--r--REORG.TODO/misc/sys/auxv.h36
-rw-r--r--REORG.TODO/misc/sys/cdefs.h483
-rw-r--r--REORG.TODO/misc/sys/dir.h27
-rw-r--r--REORG.TODO/misc/sys/file.h55
-rw-r--r--REORG.TODO/misc/sys/ioctl.h45
-rw-r--r--REORG.TODO/misc/sys/mman.h151
-rw-r--r--REORG.TODO/misc/sys/param.h106
-rw-r--r--REORG.TODO/misc/sys/queue.h574
-rw-r--r--REORG.TODO/misc/sys/select.h128
-rw-r--r--REORG.TODO/misc/sys/syslog.h215
-rw-r--r--REORG.TODO/misc/sys/sysmacros.h110
-rw-r--r--REORG.TODO/misc/sys/uio.h163
-rw-r--r--REORG.TODO/misc/sys/ustat.h37
-rw-r--r--REORG.TODO/misc/sys/xattr.h105
-rw-r--r--REORG.TODO/misc/syscall.c32
-rw-r--r--REORG.TODO/misc/syscall.h1
-rw-r--r--REORG.TODO/misc/sysexits.h114
-rw-r--r--REORG.TODO/misc/syslog.c436
-rw-r--r--REORG.TODO/misc/syslog.h1
-rw-r--r--REORG.TODO/misc/truncate.c30
-rw-r--r--REORG.TODO/misc/truncate64.c32
-rw-r--r--REORG.TODO/misc/tsearch.c750
-rw-r--r--REORG.TODO/misc/tst-atomic-long.c27
-rw-r--r--REORG.TODO/misc/tst-atomic.c639
-rw-r--r--REORG.TODO/misc/tst-dirname.c72
-rw-r--r--REORG.TODO/misc/tst-efgcvt.c216
-rw-r--r--REORG.TODO/misc/tst-empty.c8
-rw-r--r--REORG.TODO/misc/tst-error1.c37
-rw-r--r--REORG.TODO/misc/tst-fdset.c67
-rw-r--r--REORG.TODO/misc/tst-hsearch.c34
-rw-r--r--REORG.TODO/misc/tst-insremque.c61
-rw-r--r--REORG.TODO/misc/tst-makedev.c104
-rw-r--r--REORG.TODO/misc/tst-mntent-blank-corrupt.c45
-rw-r--r--REORG.TODO/misc/tst-mntent-blank-passno.c53
-rw-r--r--REORG.TODO/misc/tst-mntent.c82
-rw-r--r--REORG.TODO/misc/tst-mntent2.c44
-rw-r--r--REORG.TODO/misc/tst-preadvwritev-common.c122
-rw-r--r--REORG.TODO/misc/tst-preadvwritev.c25
-rw-r--r--REORG.TODO/misc/tst-preadvwritev2.c31
-rw-r--r--REORG.TODO/misc/tst-preadvwritev64.c51
-rw-r--r--REORG.TODO/misc/tst-preadvwritev64v2.c33
-rw-r--r--REORG.TODO/misc/tst-pselect.c130
-rw-r--r--REORG.TODO/misc/tst-tsearch.c356
-rw-r--r--REORG.TODO/misc/ttyent.h65
-rw-r--r--REORG.TODO/misc/ttyslot.c72
-rw-r--r--REORG.TODO/misc/ualarm.c33
-rw-r--r--REORG.TODO/misc/usleep.c29
-rw-r--r--REORG.TODO/misc/ustat.c29
-rw-r--r--REORG.TODO/misc/ustat.h1
-rw-r--r--REORG.TODO/misc/utimes.c39
-rw-r--r--REORG.TODO/misc/vhangup.c31
-rw-r--r--REORG.TODO/misc/writev.c35
179 files changed, 13598 insertions, 0 deletions
diff --git a/REORG.TODO/misc/Makefile b/REORG.TODO/misc/Makefile
new file mode 100644
index 0000000000..46072e62d9
--- /dev/null
+++ b/REORG.TODO/misc/Makefile
@@ -0,0 +1,138 @@
+# 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
+# <http://www.gnu.org/licenses/>.
+
+#
+# Sub-makefile for misc portion of the library.
+#
+
+subdir := misc
+
+include ../Makeconfig
+
+headers := sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
+ sys/ptrace.h sys/file.h sys/dir.h sys/cdefs.h \
+ ar.h a.out.h libgen.h stab.h bits/stab.def sgtty.h \
+ ttyent.h paths.h sys/reboot.h \
+ sys/mman.h sys/param.h bits/param.h \
+ fstab.h mntent.h search.h err.h error.h \
+ sys/queue.h sysexits.h syscall.h sys/syscall.h sys/swap.h \
+ sys/select.h ustat.h sys/ustat.h bits/ustat.h sys/sysinfo.h \
+ regexp.h bits/select.h bits/mman.h sys/xattr.h \
+ syslog.h sys/syslog.h \
+ bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h \
+ bits/select2.h bits/hwcap.h sys/auxv.h \
+ sys/sysmacros.h bits/sysmacros.h bits/types/struct_iovec.h
+
+routines := brk sbrk sstk ioctl \
+ readv writev preadv preadv64 pwritev pwritev64 \
+ preadv2 preadv64v2 pwritev2 pwritev64v2 \
+ setreuid setregid \
+ seteuid setegid \
+ getpagesize \
+ getdtsz \
+ gethostname sethostname getdomain setdomain \
+ select pselect \
+ acct chroot fsync sync fdatasync syncfs reboot \
+ gethostid sethostid \
+ revoke vhangup \
+ swapon swapoff mktemp mkstemp mkstemp64 mkdtemp \
+ mkostemp mkostemp64 mkstemps mkstemps64 mkostemps mkostemps64 \
+ ualarm usleep \
+ gtty stty \
+ ptrace \
+ fstab mntent mntent_r \
+ utimes lutimes futimes futimesat \
+ truncate ftruncate truncate64 ftruncate64 \
+ chflags fchflags \
+ insremque getttyent getusershell getpass ttyslot \
+ syslog syscall daemon \
+ mmap mmap64 munmap mprotect msync madvise mincore remap_file_pages\
+ mlock munlock mlockall munlockall \
+ efgcvt efgcvt_r qefgcvt qefgcvt_r \
+ hsearch hsearch_r tsearch lsearch \
+ err error ustat \
+ getsysstats dirname regexp \
+ getloadavg getclktck \
+ fgetxattr flistxattr fremovexattr fsetxattr getxattr \
+ listxattr lgetxattr llistxattr lremovexattr lsetxattr \
+ removexattr setxattr getauxval ifunc-impl-list makedev
+
+generated += tst-error1.mtrace tst-error1-mem.out
+
+aux := init-misc
+install-lib := libg.a
+gpl2lgpl := error.c error.h
+
+tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
+ tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
+ tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 \
+ tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \
+ tst-preadvwritev2 tst-preadvwritev64v2
+
+tests-internal := tst-atomic tst-atomic-long
+tests-static := tst-empty
+
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)tst-error1-mem.out
+endif
+
+CFLAGS-select.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-tsearch.c = $(uses-callbacks)
+CFLAGS-lsearch.c = $(uses-callbacks)
+CFLAGS-pselect.c = -fexceptions
+CFLAGS-readv.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-writev.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-preadv.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-preadv64.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pwritev.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pwritev64.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-preadv2.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-preadv64v2.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pwritev2.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pwritev64v2.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-usleep.c = -fexceptions
+CFLAGS-syslog.c = -fexceptions
+CFLAGS-error.c = -fexceptions
+CFLAGS-getpass.c = -fexceptions
+CFLAGS-mkstemp.c = -fexceptions
+CFLAGS-mkstemp64.c = -fexceptions
+CFLAGS-getsysstats.c = -fexceptions
+CFLAGS-getusershell.c = -fexceptions
+CFLAGS-err.c = -fexceptions
+CFLAGS-tst-tsearch.c = $(stack-align-test-flags)
+CFLAGS-msync.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-fdatasync.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-fsync.c = -fexceptions -fasynchronous-unwind-tables
+
+# Called during static library initialization, so turn stack-protection
+# off for non-shared builds.
+CFLAGS-sbrk.o = $(no-stack-protector)
+CFLAGS-sbrk.op = $(no-stack-protector)
+CFLAGS-brk.o = $(no-stack-protector)
+CFLAGS-brk.op = $(no-stack-protector)
+
+include ../Rules
+
+$(objpfx)libg.a: $(dep-dummy-lib); $(make-dummy-lib)
+
+$(objpfx)tst-tsearch: $(libm)
+
+tst-error1-ENV = MALLOC_TRACE=$(objpfx)tst-error1.mtrace
+tst-error1-ARGS = $(objpfx)tst-error1.out
+$(objpfx)tst-error1-mem.out: $(objpfx)tst-error1.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-error1.mtrace > $@; \
+ $(evaluate-test)
diff --git a/REORG.TODO/misc/Versions b/REORG.TODO/misc/Versions
new file mode 100644
index 0000000000..bafda78a1f
--- /dev/null
+++ b/REORG.TODO/misc/Versions
@@ -0,0 +1,167 @@
+libc {
+ GLIBC_2.0 {
+ # global variables
+ ___brk_addr; __curbrk; __progname; __progname_full;
+
+ # interface of malloc functions
+ __sbrk; __getpagesize;
+
+ # functions used in other libraries
+ __select;
+
+ # variables in normal name space
+ error_message_count; error_one_per_line; error_print_progname;
+
+ # variables in normal name space
+ loc1; loc2; locs;
+ program_invocation_name; program_invocation_short_name;
+
+ # a*
+ acct; addmntent; advance;
+
+ # b*
+ brk;
+
+ # c*
+ chflags; chroot; closelog;
+
+ # d*
+ daemon; dirname;
+
+ # e*
+ ecvt; ecvt_r; endfsent; endmntent; endttyent; endusershell;
+
+ # e*
+ err; error; error_at_line; errx;
+
+ # f*
+ fchflags; fcvt; fcvt_r; fdatasync; fsync; ftruncate;
+
+ # g*
+ gcvt; get_avphys_pages; get_nprocs; get_nprocs_conf; get_phys_pages;
+ getfsent; getfsfile; getfsspec; gethostid; gethostname; getmntent;
+ getmntent_r; getpagesize; getpass; getttyent; getttynam; getusershell;
+ gtty;
+
+ # h*
+ hasmntopt; hcreate; hcreate_r; hdestroy; hdestroy_r; hsearch; hsearch_r;
+
+ # i*
+ insque; ioctl;
+
+ # j*
+ jrand48; jrand48_r; lfind; lsearch;
+
+ # m*
+ madvise; mkstemp; mktemp; mlock; mlockall; mmap; mount; mprotect; msync;
+ munlock; munlockall; munmap;
+
+ # o*
+ openlog;
+
+ # p*
+ ptrace;
+
+ # q*
+ qecvt; qecvt_r; qfcvt; qfcvt_r; qgcvt;
+
+ # r*
+ readv; reboot; remque; revoke;
+
+ # s*
+ sbrk; select; setdomainname; setfsent; sethostent; sethostid; sethostname;
+ setlogmask; setmntent; setregid; setreuid; setttyent; setusershell; sstk;
+ stty; sync; syscall; syslog;
+
+ # t*
+ tdelete; tfind; truncate; tsearch; ttyslot; twalk;
+
+ # u*
+ ualarm; usleep; ustat; utimes;
+
+ # v*
+ verr; verrx; vhangup; vsyslog; vwarn; vwarnx;
+
+ # w*
+ warn; warnx;
+
+ # w*
+ writev;
+ }
+ GLIBC_2.1 {
+ # f*
+ ftruncate64;
+
+ # m*
+ mmap64;
+
+ # t*
+ tdestroy; truncate64;
+ }
+ GLIBC_2.2 {
+ # g*
+ getloadavg;
+
+ # m*
+ mincore; mkdtemp; mkstemp64;
+
+ # p*
+ posix_madvise;
+ }
+ GLIBC_2.3 {
+ # f*
+ fgetxattr; flistxattr; fremovexattr; fsetxattr;
+ futimes;
+
+ # g*
+ getxattr;
+
+ # l*
+ listxattr;
+ lgetxattr; llistxattr; lremovexattr; lsetxattr;
+ lutimes;
+
+ # r*
+ removexattr;
+
+ # s*
+ setxattr;
+ }
+ GLIBC_2.3.3 {
+ remap_file_pages;
+ }
+ GLIBC_2.4 {
+ futimesat;
+ __syslog_chk; __vsyslog_chk;
+ }
+ GLIBC_2.7 {
+ mkostemp; mkostemp64;
+ }
+ GLIBC_2.10 {
+ preadv; preadv64; pwritev; pwritev64;
+ }
+ GLIBC_2.11 {
+ mkstemps; mkstemps64; mkostemps; mkostemps64;
+ }
+ GLIBC_2.14 {
+ syncfs;
+ }
+ GLIBC_2.16 {
+ __getauxval; getauxval;
+ }
+ GLIBC_2.23 {
+ # SHLIB_COMPAT(GLIBC_2_0, GLIBC_2_23) used in regexp.c
+ }
+ GLIBC_2.25 {
+ gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;
+ }
+ GLIBC_2.26 {
+ preadv2; preadv64v2; pwritev2; pwritev64v2;
+ }
+ GLIBC_PRIVATE {
+ __madvise;
+ __mktemp;
+ __libc_ifunc_impl_list;
+ __tdelete; __tfind; __tsearch; __twalk;
+ }
+}
diff --git a/REORG.TODO/misc/acct.c b/REORG.TODO/misc/acct.c
new file mode 100644
index 0000000000..18959113e0
--- /dev/null
+++ b/REORG.TODO/misc/acct.c
@@ -0,0 +1,31 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Turn accounting on if NAME is an existing file. The system will then write
+ a record for each process as it terminates, to this file. If NAME is NULL,
+ turn accounting off. This call is restricted to the super-user. */
+int
+acct (const char *name)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (acct)
diff --git a/REORG.TODO/misc/ar.h b/REORG.TODO/misc/ar.h
new file mode 100644
index 0000000000..bb40a0b8e4
--- /dev/null
+++ b/REORG.TODO/misc/ar.h
@@ -0,0 +1,47 @@
+/* Header describing `ar' archive file format.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _AR_H
+#define _AR_H 1
+
+#include <sys/cdefs.h>
+
+/* Archive files start with the ARMAG identifying string. Then follows a
+ `struct ar_hdr', and as many bytes of member file data as its `ar_size'
+ member indicates, for each member file. */
+
+#define ARMAG "!<arch>\n" /* String that begins an archive file. */
+#define SARMAG 8 /* Size of that string. */
+
+#define ARFMAG "`\n" /* String in ar_fmag at end of each header. */
+
+__BEGIN_DECLS
+
+struct ar_hdr
+ {
+ char ar_name[16]; /* Member file name, sometimes / terminated. */
+ char ar_date[12]; /* File date, decimal seconds since Epoch. */
+ char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */
+ char ar_mode[8]; /* File mode, in ASCII octal. */
+ char ar_size[10]; /* File size, in ASCII decimal. */
+ char ar_fmag[2]; /* Always contains ARFMAG. */
+ };
+
+__END_DECLS
+
+#endif /* ar.h */
diff --git a/REORG.TODO/misc/bits/error.h b/REORG.TODO/misc/bits/error.h
new file mode 100644
index 0000000000..c8f450810a
--- /dev/null
+++ b/REORG.TODO/misc/bits/error.h
@@ -0,0 +1,73 @@
+/* Specializations for error functions.
+ Copyright (C) 2007-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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _ERROR_H
+# error "Never include <bits/error.h> directly; use <error.h> instead."
+#endif
+
+
+extern void __REDIRECT (__error_alias, (int __status, int __errnum,
+ const char *__format, ...),
+ error)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern void __REDIRECT (__error_noreturn, (int __status, int __errnum,
+ const char *__format, ...),
+ error)
+ __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)));
+
+
+/* If we know the function will never return make sure the compiler
+ realizes that, too. */
+__extern_always_inline void
+error (int __status, int __errnum, const char *__format, ...)
+{
+ if (__builtin_constant_p (__status) && __status != 0)
+ __error_noreturn (__status, __errnum, __format, __va_arg_pack ());
+ else
+ __error_alias (__status, __errnum, __format, __va_arg_pack ());
+}
+
+
+extern void __REDIRECT (__error_at_line_alias, (int __status, int __errnum,
+ const char *__fname,
+ unsigned int __line,
+ const char *__format, ...),
+ error_at_line)
+ __attribute__ ((__format__ (__printf__, 5, 6)));
+extern void __REDIRECT (__error_at_line_noreturn, (int __status, int __errnum,
+ const char *__fname,
+ unsigned int __line,
+ const char *__format,
+ ...),
+ error_at_line)
+ __attribute__ ((__noreturn__, __format__ (__printf__, 5, 6)));
+
+
+/* If we know the function will never return make sure the compiler
+ realizes that, too. */
+__extern_always_inline void
+error_at_line (int __status, int __errnum, const char *__fname,
+ unsigned int __line, const char *__format, ...)
+{
+ if (__builtin_constant_p (__status) && __status != 0)
+ __error_at_line_noreturn (__status, __errnum, __fname, __line, __format,
+ __va_arg_pack ());
+ else
+ __error_at_line_alias (__status, __errnum, __fname, __line,
+ __format, __va_arg_pack ());
+}
diff --git a/REORG.TODO/misc/bits/select2.h b/REORG.TODO/misc/bits/select2.h
new file mode 100644
index 0000000000..b4b85121a4
--- /dev/null
+++ b/REORG.TODO/misc/bits/select2.h
@@ -0,0 +1,35 @@
+/* Checking macros for select functions.
+ Copyright (C) 2011-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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_SELECT_H
+# error "Never include <bits/select2.h> directly; use <sys/select.h> instead."
+#endif
+
+/* Helper functions to issue warnings and errors when needed. */
+extern long int __fdelt_chk (long int __d);
+extern long int __fdelt_warn (long int __d)
+ __warnattr ("bit outside of fd_set selected");
+#undef __FD_ELT
+#define __FD_ELT(d) \
+ __extension__ \
+ ({ long int __d = (d); \
+ (__builtin_constant_p (__d) \
+ ? (0 <= __d && __d < __FD_SETSIZE \
+ ? (__d / __NFDBITS) \
+ : __fdelt_warn (__d)) \
+ : __fdelt_chk (__d)); })
diff --git a/REORG.TODO/misc/bits/stab.def b/REORG.TODO/misc/bits/stab.def
new file mode 100644
index 0000000000..127fffac9c
--- /dev/null
+++ b/REORG.TODO/misc/bits/stab.def
@@ -0,0 +1,233 @@
+/* Table of DBX symbol codes for the GNU system.
+ Copyright (C) 1988, 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
+ <http://www.gnu.org/licenses/>. */
+
+/* This contains contribution from Cygnus Support. */
+
+/* Global variable. Only the name is significant.
+ To find the address, look in the corresponding external symbol. */
+__define_stab (N_GSYM, 0x20, "GSYM")
+
+/* Function name for BSD Fortran. Only the name is significant.
+ To find the address, look in the corresponding external symbol. */
+__define_stab (N_FNAME, 0x22, "FNAME")
+
+/* Function name or text-segment variable for C. Value is its address.
+ Desc is supposedly starting line number, but GCC doesn't set it
+ and DBX seems not to miss it. */
+__define_stab (N_FUN, 0x24, "FUN")
+
+/* Data-segment variable with internal linkage. Value is its address.
+ "Static Sym". */
+__define_stab (N_STSYM, 0x26, "STSYM")
+
+/* BSS-segment variable with internal linkage. Value is its address. */
+__define_stab (N_LCSYM, 0x28, "LCSYM")
+
+/* Name of main routine. Only the name is significant.
+ This is not used in C. */
+__define_stab (N_MAIN, 0x2a, "MAIN")
+
+/* Global symbol in Pascal.
+ Supposedly the value is its line number; I'm skeptical. */
+__define_stab (N_PC, 0x30, "PC")
+
+/* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */
+__define_stab (N_NSYMS, 0x32, "NSYMS")
+
+/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */
+__define_stab (N_NOMAP, 0x34, "NOMAP")
+
+/* New stab from Solaris. I don't know what it means, but it
+ don't seem to contain useful information. */
+__define_stab (N_OBJ, 0x38, "OBJ")
+
+/* New stab from Solaris. I don't know what it means, but it
+ don't seem to contain useful information. Possibly related to the
+ optimization flags used in this module. */
+__define_stab (N_OPT, 0x3c, "OPT")
+
+/* Register variable. Value is number of register. */
+__define_stab (N_RSYM, 0x40, "RSYM")
+
+/* Modula-2 compilation unit. Can someone say what info it contains? */
+__define_stab (N_M2C, 0x42, "M2C")
+
+/* Line number in text segment. Desc is the line number;
+ value is corresponding address. */
+__define_stab (N_SLINE, 0x44, "SLINE")
+
+/* Similar, for data segment. */
+__define_stab (N_DSLINE, 0x46, "DSLINE")
+
+/* Similar, for bss segment. */
+__define_stab (N_BSLINE, 0x48, "BSLINE")
+
+/* Sun's source-code browser stabs. ?? Don't know what the fields are.
+ Supposedly the field is "path to associated .cb file". THIS VALUE
+ OVERLAPS WITH N_BSLINE! */
+__define_stab (N_BROWS, 0x48, "BROWS")
+
+/* GNU Modula-2 definition module dependency. Value is the modification time
+ of the definition file. Other is non-zero if it is imported with the
+ GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there
+ are enough empty fields? */
+__define_stab(N_DEFD, 0x4a, "DEFD")
+
+/* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2
+ and one is for C++. Still,... */
+/* GNU C++ exception variable. Name is variable name. */
+__define_stab (N_EHDECL, 0x50, "EHDECL")
+/* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */
+__define_stab (N_MOD2, 0x50, "MOD2")
+
+/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if
+ this entry is immediately followed by a CAUGHT stab saying what exception
+ was caught. Multiple CAUGHT stabs means that multiple exceptions
+ can be caught here. If Desc is 0, it means all exceptions are caught
+ here. */
+__define_stab (N_CATCH, 0x54, "CATCH")
+
+/* Structure or union element. Value is offset in the structure. */
+__define_stab (N_SSYM, 0x60, "SSYM")
+
+/* Name of main source file.
+ Value is starting text address of the compilation. */
+__define_stab (N_SO, 0x64, "SO")
+
+/* Automatic variable in the stack. Value is offset from frame pointer.
+ Also used for type descriptions. */
+__define_stab (N_LSYM, 0x80, "LSYM")
+
+/* Beginning of an include file. Only Sun uses this.
+ In an object file, only the name is significant.
+ The Sun linker puts data into some of the other fields. */
+__define_stab (N_BINCL, 0x82, "BINCL")
+
+/* Name of sub-source file (#include file).
+ Value is starting text address of the compilation. */
+__define_stab (N_SOL, 0x84, "SOL")
+
+/* Parameter variable. Value is offset from argument pointer.
+ (On most machines the argument pointer is the same as the frame pointer. */
+__define_stab (N_PSYM, 0xa0, "PSYM")
+
+/* End of an include file. No name.
+ This and N_BINCL act as brackets around the file's output.
+ In an object file, there is no significant data in this entry.
+ The Sun linker puts data into some of the fields. */
+__define_stab (N_EINCL, 0xa2, "EINCL")
+
+/* Alternate entry point. Value is its address. */
+__define_stab (N_ENTRY, 0xa4, "ENTRY")
+
+/* Beginning of lexical block.
+ The desc is the nesting level in lexical blocks.
+ The value is the address of the start of the text for the block.
+ The variables declared inside the block *precede* the N_LBRAC symbol. */
+__define_stab (N_LBRAC, 0xc0, "LBRAC")
+
+/* Place holder for deleted include file. Replaces a N_BINCL and everything
+ up to the corresponding N_EINCL. The Sun linker generates these when
+ it finds multiple identical copies of the symbols from an include file.
+ This appears only in output from the Sun linker. */
+__define_stab (N_EXCL, 0xc2, "EXCL")
+
+/* Modula-2 scope information. Can someone say what info it contains? */
+__define_stab (N_SCOPE, 0xc4, "SCOPE")
+
+/* End of a lexical block. Desc matches the N_LBRAC's desc.
+ The value is the address of the end of the text for the block. */
+__define_stab (N_RBRAC, 0xe0, "RBRAC")
+
+/* Begin named common block. Only the name is significant. */
+__define_stab (N_BCOMM, 0xe2, "BCOMM")
+
+/* End named common block. Only the name is significant
+ (and it should match the N_BCOMM). */
+__define_stab (N_ECOMM, 0xe4, "ECOMM")
+
+/* End common (local name): value is address.
+ I'm not sure how this is used. */
+__define_stab (N_ECOML, 0xe8, "ECOML")
+
+/* These STAB's are used on Gould systems for Non-Base register symbols
+ or something like that. FIXME. I have assigned the values at random
+ since I don't have a Gould here. Fixups from Gould folk welcome... */
+__define_stab (N_NBTEXT, 0xF0, "NBTEXT")
+__define_stab (N_NBDATA, 0xF2, "NBDATA")
+__define_stab (N_NBBSS, 0xF4, "NBBSS")
+__define_stab (N_NBSTS, 0xF6, "NBSTS")
+__define_stab (N_NBLCS, 0xF8, "NBLCS")
+
+/* Second symbol entry containing a length-value for the preceding entry.
+ The value is the length. */
+__define_stab (N_LENG, 0xfe, "LENG")
+
+/* The above information, in matrix format.
+
+ STAB MATRIX
+ _________________________________________________
+ | 00 - 1F are not dbx stab symbols |
+ | In most cases, the low bit is the EXTernal bit|
+
+ | 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA |
+ | 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT |
+
+ | 08 BSS | 0A INDR | 0C FN_SEQ | 0E |
+ | 09 |EXT | 0B | 0D | 0F |
+
+ | 10 | 12 COMM | 14 SETA | 16 SETT |
+ | 11 | 13 | 15 | 17 |
+
+ | 18 SETD | 1A SETB | 1C SETV | 1E WARNING|
+ | 19 | 1B | 1D | 1F FN |
+
+ |_______________________________________________|
+ | Debug entries with bit 01 set are unused. |
+ | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM |
+ | 28 LCSYM | 2A MAIN | 2C | 2E |
+ | 30 PC | 32 NSYMS | 34 NOMAP | 36 |
+ | 38 OBJ | 3A | 3C OPT | 3E |
+ | 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE |
+ | 48 BSLINE*| 4A DEFD | 4C | 4E |
+ | 50 EHDECL*| 52 | 54 CATCH | 56 |
+ | 58 | 5A | 5C | 5E |
+ | 60 SSYM | 62 | 64 SO | 66 |
+ | 68 | 6A | 6C | 6E |
+ | 70 | 72 | 74 | 76 |
+ | 78 | 7A | 7C | 7E |
+ | 80 LSYM | 82 BINCL | 84 SOL | 86 |
+ | 88 | 8A | 8C | 8E |
+ | 90 | 92 | 94 | 96 |
+ | 98 | 9A | 9C | 9E |
+ | A0 PSYM | A2 EINCL | A4 ENTRY | A6 |
+ | A8 | AA | AC | AE |
+ | B0 | B2 | B4 | B6 |
+ | B8 | BA | BC | BE |
+ | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 |
+ | C8 | CA | CC | CE |
+ | D0 | D2 | D4 | D6 |
+ | D8 | DA | DC | DE |
+ | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 |
+ | E8 ECOML | EA | EC | EE |
+ | F0 | F2 | F4 | F6 |
+ | F8 | FA | FC | FE LENG |
+ +-----------------------------------------------+
+ * 50 EHDECL is also MOD2.
+ * 48 BSLINE is also BROWS.
+ */
diff --git a/REORG.TODO/misc/bits/syslog-ldbl.h b/REORG.TODO/misc/bits/syslog-ldbl.h
new file mode 100644
index 0000000000..2bc38c0998
--- /dev/null
+++ b/REORG.TODO/misc/bits/syslog-ldbl.h
@@ -0,0 +1,35 @@
+/* -mlong-double-64 compatibility mode for syslog functions.
+ Copyright (C) 2006-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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_SYSLOG_H
+# error "Never include <bits/syslog-ldbl.h> directly; use <sys/syslog.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (syslog)
+
+#ifdef __USE_MISC
+__LDBL_REDIR_DECL (vsyslog)
+#endif
+
+#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
+__LDBL_REDIR_DECL (__syslog_chk)
+
+# ifdef __USE_MISC
+__LDBL_REDIR_DECL (__vsyslog_chk)
+# endif
+#endif
diff --git a/REORG.TODO/misc/bits/syslog.h b/REORG.TODO/misc/bits/syslog.h
new file mode 100644
index 0000000000..0b6c913516
--- /dev/null
+++ b/REORG.TODO/misc/bits/syslog.h
@@ -0,0 +1,49 @@
+/* Checking macros for syslog functions.
+ Copyright (C) 2005-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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_SYSLOG_H
+# error "Never include <bits/syslog.h> directly; use <sys/syslog.h> instead."
+#endif
+
+
+extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+
+#ifdef __va_arg_pack
+__fortify_function void
+syslog (int __pri, const char *__fmt, ...)
+{
+ __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
+}
+#elif !defined __cplusplus
+# define syslog(pri, ...) \
+ __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
+#endif
+
+
+#ifdef __USE_MISC
+extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt,
+ __gnuc_va_list __ap)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
+
+__fortify_function void
+vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
+{
+ __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
+}
+#endif
diff --git a/REORG.TODO/misc/bits/types/struct_iovec.h b/REORG.TODO/misc/bits/types/struct_iovec.h
new file mode 100644
index 0000000000..bd625a302f
--- /dev/null
+++ b/REORG.TODO/misc/bits/types/struct_iovec.h
@@ -0,0 +1,32 @@
+/* Define struct iovec.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef __iovec_defined
+#define __iovec_defined 1
+
+#define __need_size_t
+#include <stddef.h>
+
+/* Structure for scatter/gather I/O. */
+struct iovec
+ {
+ void *iov_base; /* Pointer to data. */
+ size_t iov_len; /* Length of data. */
+ };
+
+#endif
diff --git a/REORG.TODO/misc/brk.c b/REORG.TODO/misc/brk.c
new file mode 100644
index 0000000000..45b7bf3dfd
--- /dev/null
+++ b/REORG.TODO/misc/brk.c
@@ -0,0 +1,34 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* sbrk.c expects this. */
+void *__curbrk;
+
+/* Set the end of the process's data space to ADDR.
+ Return 0 if successful, -1 if not. */
+int
+__brk (void *addr)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (brk)
+
+weak_alias (__brk, brk)
diff --git a/REORG.TODO/misc/bug-hsearch1.c b/REORG.TODO/misc/bug-hsearch1.c
new file mode 100644
index 0000000000..6097b5ad04
--- /dev/null
+++ b/REORG.TODO/misc/bug-hsearch1.c
@@ -0,0 +1,31 @@
+#include <search.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ if (hcreate (1) == 0)
+ {
+ puts ("hcreate failed");
+ return 1;
+ }
+ ENTRY e;
+ e.key = (char *) "a";
+ e.data = (char *) "b";
+ if (hsearch (e, ENTER) == NULL)
+ {
+ puts ("ENTER failed");
+ return 1;
+ }
+ ENTRY s;
+ s.key = (char *) "c";
+ if (hsearch (s, FIND) != NULL)
+ {
+ puts ("FIND succeeded");
+ return 1;
+ }
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/bug18240.c b/REORG.TODO/misc/bug18240.c
new file mode 100644
index 0000000000..41d80a0375
--- /dev/null
+++ b/REORG.TODO/misc/bug18240.c
@@ -0,0 +1,97 @@
+/* Test integer wraparound in hcreate.
+ Copyright (C) 2016-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <limits.h>
+#include <search.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/resource.h>
+
+static void
+test_size (size_t size)
+{
+ int res = hcreate (size);
+ if (res == 0)
+ {
+ if (errno == ENOMEM)
+ return;
+ printf ("error: hcreate (%zu): %m\n", size);
+ exit (1);
+ }
+ char *keys[100];
+ for (int i = 0; i < 100; ++i)
+ {
+ if (asprintf (keys + i, "%d", i) < 0)
+ {
+ printf ("error: asprintf: %m\n");
+ exit (1);
+ }
+ ENTRY e = { keys[i], (char *) "value" };
+ if (hsearch (e, ENTER) == NULL)
+ {
+ printf ("error: hsearch (\"%s\"): %m\n", keys[i]);
+ exit (1);
+ }
+ }
+ hdestroy ();
+
+ for (int i = 0; i < 100; ++i)
+ free (keys[i]);
+}
+
+static int
+do_test (void)
+{
+ /* Limit the size of the process, so that memory allocation will
+ fail without impacting the entire system. */
+ {
+ struct rlimit limit;
+ if (getrlimit (RLIMIT_AS, &limit) != 0)
+ {
+ printf ("getrlimit (RLIMIT_AS) failed: %m\n");
+ return 1;
+ }
+ long target = 100 * 1024 * 1024;
+ if (limit.rlim_cur == RLIM_INFINITY || limit.rlim_cur > target)
+ {
+ limit.rlim_cur = target;
+ if (setrlimit (RLIMIT_AS, &limit) != 0)
+ {
+ printf ("setrlimit (RLIMIT_AS) failed: %m\n");
+ return 1;
+ }
+ }
+ }
+
+ test_size (500);
+ test_size (-1);
+ test_size (-3);
+ test_size (INT_MAX - 2);
+ test_size (INT_MAX - 1);
+ test_size (INT_MAX);
+ test_size (((unsigned) INT_MAX) + 1);
+ test_size (UINT_MAX - 2);
+ test_size (UINT_MAX - 1);
+ test_size (UINT_MAX);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/chflags.c b/REORG.TODO/misc/chflags.c
new file mode 100644
index 0000000000..3bf56dec06
--- /dev/null
+++ b/REORG.TODO/misc/chflags.c
@@ -0,0 +1,39 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Change the flags of FILE to FLAGS. */
+
+int chflags (const char *file, unsigned long int flags) __THROW;
+
+int
+chflags (const char *file, unsigned long int flags)
+{
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (chflags)
diff --git a/REORG.TODO/misc/chroot.c b/REORG.TODO/misc/chroot.c
new file mode 100644
index 0000000000..78dc9ed848
--- /dev/null
+++ b/REORG.TODO/misc/chroot.c
@@ -0,0 +1,31 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make PATH be the root directory (the starting point for absolute paths).
+ This call is restricted to the super-user. */
+int
+chroot (const char *path)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (chroot)
diff --git a/REORG.TODO/misc/daemon.c b/REORG.TODO/misc/daemon.c
new file mode 100644
index 0000000000..9d186b24bd
--- /dev/null
+++ b/REORG.TODO/misc/daemon.c
@@ -0,0 +1,93 @@
+/*-
+ * Copyright (c) 1990, 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include <device-nrs.h>
+#include <not-cancel.h>
+
+int
+daemon (int nochdir, int noclose)
+{
+ int fd;
+
+ switch (__fork()) {
+ case -1:
+ return (-1);
+ case 0:
+ break;
+ default:
+ _exit(0);
+ }
+
+ if (__setsid() == -1)
+ return (-1);
+
+ if (!nochdir)
+ (void)__chdir("/");
+
+ if (!noclose) {
+ struct stat64 st;
+
+ if ((fd = open_not_cancel(_PATH_DEVNULL, O_RDWR, 0)) != -1
+ && (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0)
+ == 0)) {
+ if (__builtin_expect (S_ISCHR (st.st_mode), 1) != 0
+#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
+ && (st.st_rdev
+ == makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR))
+#endif
+ ) {
+ (void)__dup2(fd, STDIN_FILENO);
+ (void)__dup2(fd, STDOUT_FILENO);
+ (void)__dup2(fd, STDERR_FILENO);
+ if (fd > 2)
+ (void)__close (fd);
+ } else {
+ /* We must set an errno value since no
+ function call actually failed. */
+ close_not_cancel_no_status (fd);
+ __set_errno (ENODEV);
+ return -1;
+ }
+ } else {
+ close_not_cancel_no_status (fd);
+ return -1;
+ }
+ }
+ return (0);
+}
diff --git a/REORG.TODO/misc/dirname.c b/REORG.TODO/misc/dirname.c
new file mode 100644
index 0000000000..7400354c8e
--- /dev/null
+++ b/REORG.TODO/misc/dirname.c
@@ -0,0 +1,80 @@
+/* dirname - return directory part of PATH.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libgen.h>
+#include <string.h>
+
+
+char *
+dirname (char *path)
+{
+ static const char dot[] = ".";
+ char *last_slash;
+
+ /* Find last '/'. */
+ last_slash = path != NULL ? strrchr (path, '/') : NULL;
+
+ if (last_slash != NULL && last_slash != path && last_slash[1] == '\0')
+ {
+ /* Determine whether all remaining characters are slashes. */
+ char *runp;
+
+ for (runp = last_slash; runp != path; --runp)
+ if (runp[-1] != '/')
+ break;
+
+ /* The '/' is the last character, we have to look further. */
+ if (runp != path)
+ last_slash = __memrchr (path, '/', runp - path);
+ }
+
+ if (last_slash != NULL)
+ {
+ /* Determine whether all remaining characters are slashes. */
+ char *runp;
+
+ for (runp = last_slash; runp != path; --runp)
+ if (runp[-1] != '/')
+ break;
+
+ /* Terminate the path. */
+ if (runp == path)
+ {
+ /* The last slash is the first character in the string. We have to
+ return "/". As a special case we have to return "//" if there
+ are exactly two slashes at the beginning of the string. See
+ XBD 4.10 Path Name Resolution for more information. */
+ if (last_slash == path + 1)
+ ++last_slash;
+ else
+ last_slash = path + 1;
+ }
+ else
+ last_slash = runp;
+
+ last_slash[0] = '\0';
+ }
+ else
+ /* This assignment is ill-designed but the XPG specs require to
+ return a string containing "." in any case no directory part is
+ found and so a static and constant string is required. */
+ path = (char *) dot;
+
+ return path;
+}
diff --git a/REORG.TODO/misc/efgcvt.c b/REORG.TODO/misc/efgcvt.c
new file mode 100644
index 0000000000..3a3665a250
--- /dev/null
+++ b/REORG.TODO/misc/efgcvt.c
@@ -0,0 +1,126 @@
+/* Compatibility functions for floating point formatting.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#include <float.h>
+#include <libc-lock.h>
+#include <math_ldbl_opt.h>
+
+#ifndef FLOAT_TYPE
+# define FLOAT_TYPE double
+# define FUNC_PREFIX
+# define FLOAT_FMT_FLAG
+/* Actually we have to write (DBL_DIG + log10 (DBL_MAX_10_EXP)) but we
+ don't have log10 available in the preprocessor. */
+# define MAXDIG (NDIGIT_MAX + 3)
+# define FCVT_MAXDIG (DBL_MAX_10_EXP + MAXDIG)
+# if DBL_MANT_DIG == 53
+# define NDIGIT_MAX 17
+# elif DBL_MANT_DIG == 24
+# define NDIGIT_MAX 9
+# elif DBL_MANT_DIG == 56
+# define NDIGIT_MAX 18
+# else
+/* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
+ compile time constant here, so we cannot use it. */
+# error "NDIGIT_MAX must be precomputed"
+# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
+# endif
+#else
+# define LONG_DOUBLE_CVT
+#endif
+
+#define APPEND(a, b) APPEND2 (a, b)
+#define APPEND2(a, b) a##b
+#define __APPEND(a, b) __APPEND2 (a, b)
+#define __APPEND2(a, b) __##a##b
+
+
+#define FCVT_BUFFER APPEND (FUNC_PREFIX, fcvt_buffer)
+#define FCVT_BUFPTR APPEND (FUNC_PREFIX, fcvt_bufptr)
+#define ECVT_BUFFER APPEND (FUNC_PREFIX, ecvt_buffer)
+
+
+static char FCVT_BUFFER[MAXDIG];
+static char ECVT_BUFFER[MAXDIG];
+libc_freeres_ptr (static char *FCVT_BUFPTR);
+
+char *
+__APPEND (FUNC_PREFIX, fcvt) (FLOAT_TYPE value, int ndigit, int *decpt,
+ int *sign)
+{
+ if (FCVT_BUFPTR == NULL)
+ {
+ if (__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
+ FCVT_BUFFER, MAXDIG) != -1)
+ return FCVT_BUFFER;
+
+ FCVT_BUFPTR = (char *) malloc (FCVT_MAXDIG);
+ if (FCVT_BUFPTR == NULL)
+ return FCVT_BUFFER;
+ }
+
+ (void) __APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
+ FCVT_BUFPTR, FCVT_MAXDIG);
+
+ return FCVT_BUFPTR;
+}
+
+
+char *
+__APPEND (FUNC_PREFIX, ecvt) (FLOAT_TYPE value, int ndigit, int *decpt,
+ int *sign)
+{
+ (void) __APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign,
+ ECVT_BUFFER, MAXDIG);
+
+ return ECVT_BUFFER;
+}
+
+char *
+__APPEND (FUNC_PREFIX, gcvt) (FLOAT_TYPE value, int ndigit, char *buf)
+{
+ sprintf (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value);
+ return buf;
+}
+
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+# ifdef LONG_DOUBLE_CVT
+# define cvt_symbol(symbol) \
+ cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+ APPEND (FUNC_PREFIX, symbol), GLIBC_2_4)
+# define cvt_symbol_1(lib, local, symbol, version) \
+ versioned_symbol (lib, local, symbol, version)
+# else
+# define cvt_symbol(symbol) \
+ cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+ APPEND (q, symbol), GLIBC_2_0); \
+ strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+# define cvt_symbol_1(lib, local, symbol, version) \
+ compat_symbol (lib, local, symbol, version)
+# endif
+#else
+# define cvt_symbol(symbol) \
+ strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+#endif
+cvt_symbol(fcvt);
+cvt_symbol(ecvt);
+cvt_symbol(gcvt);
diff --git a/REORG.TODO/misc/efgcvt_r.c b/REORG.TODO/misc/efgcvt_r.c
new file mode 100644
index 0000000000..e34c455f0a
--- /dev/null
+++ b/REORG.TODO/misc/efgcvt_r.c
@@ -0,0 +1,257 @@
+/* Compatibility functions for floating point formatting, reentrant versions.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <float.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#include <math_ldbl_opt.h>
+
+#ifndef FLOAT_TYPE
+# define FLOAT_TYPE double
+# define FUNC_PREFIX
+# define FLOAT_FMT_FLAG
+# define FLOAT_NAME_EXT
+# define FLOAT_MIN_10_EXP DBL_MIN_10_EXP
+# if DBL_MANT_DIG == 53
+# define NDIGIT_MAX 17
+# elif DBL_MANT_DIG == 24
+# define NDIGIT_MAX 9
+# elif DBL_MANT_DIG == 56
+# define NDIGIT_MAX 18
+# else
+/* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
+ compile time constant here, so we cannot use it. */
+# error "NDIGIT_MAX must be precomputed"
+# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
+# endif
+# if DBL_MIN_10_EXP == -37
+# define FLOAT_MIN_10_NORM 1.0e-37
+# elif DBL_MIN_10_EXP == -307
+# define FLOAT_MIN_10_NORM 1.0e-307
+# elif DBL_MIN_10_EXP == -4931
+# define FLOAT_MIN_10_NORM 1.0e-4931
+# else
+/* libc can't depend on libm. */
+# error "FLOAT_MIN_10_NORM must be precomputed"
+# define FLOAT_MIN_10_NORM exp10 (DBL_MIN_10_EXP)
+# endif
+#else
+# define LONG_DOUBLE_CVT
+#endif
+
+#define APPEND(a, b) APPEND2 (a, b)
+#define APPEND2(a, b) a##b
+#define __APPEND(a, b) __APPEND2 (a, b)
+#define __APPEND2(a, b) __##a##b
+
+#define FLOOR APPEND(floor, FLOAT_NAME_EXT)
+#define FABS APPEND(fabs, FLOAT_NAME_EXT)
+#define LOG10 APPEND(log10, FLOAT_NAME_EXT)
+#define EXP APPEND(exp, FLOAT_NAME_EXT)
+
+
+int
+__APPEND (FUNC_PREFIX, fcvt_r) (FLOAT_TYPE value, int ndigit, int *decpt,
+ int *sign, char *buf, size_t len)
+{
+ ssize_t n;
+ ssize_t i;
+ int left;
+
+ if (buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ left = 0;
+ if (isfinite (value))
+ {
+ *sign = signbit (value) != 0;
+ if (*sign)
+ value = -value;
+
+ if (ndigit < 0)
+ {
+ /* Rounding to the left of the decimal point. */
+ while (ndigit < 0)
+ {
+ FLOAT_TYPE new_value = value * 0.1;
+
+ if (new_value < 1.0)
+ {
+ ndigit = 0;
+ break;
+ }
+
+ value = new_value;
+ ++left;
+ ++ndigit;
+ }
+ }
+ }
+ else
+ /* Value is Inf or NaN. */
+ *sign = 0;
+
+ n = __snprintf (buf, len, "%.*" FLOAT_FMT_FLAG "f", MIN (ndigit, NDIGIT_MAX),
+ value);
+ /* Check for a too small buffer. */
+ if (n >= (ssize_t) len)
+ return -1;
+
+ i = 0;
+ while (i < n && isdigit (buf[i]))
+ ++i;
+ *decpt = i;
+
+ if (i == 0)
+ /* Value is Inf or NaN. */
+ return 0;
+
+ if (i < n)
+ {
+ do
+ ++i;
+ while (i < n && !isdigit (buf[i]));
+
+ if (*decpt == 1 && buf[0] == '0' && value != 0.0)
+ {
+ /* We must not have leading zeroes. Strip them all out and
+ adjust *DECPT if necessary. */
+ --*decpt;
+ while (i < n && buf[i] == '0')
+ {
+ --*decpt;
+ ++i;
+ }
+ }
+
+ memmove (&buf[MAX (*decpt, 0)], &buf[i], n - i);
+ buf[n - (i - MAX (*decpt, 0))] = '\0';
+ }
+
+ if (left)
+ {
+ *decpt += left;
+ if ((ssize_t) --len > n)
+ {
+ while (left-- > 0 && n < (ssize_t) len)
+ buf[n++] = '0';
+ buf[n] = '\0';
+ }
+ }
+
+ return 0;
+}
+
+int
+__APPEND (FUNC_PREFIX, ecvt_r) (FLOAT_TYPE value, int ndigit, int *decpt,
+ int *sign, char *buf, size_t len)
+{
+ int exponent = 0;
+
+ if (isfinite (value) && value != 0.0)
+ {
+ /* Slow code that doesn't require -lm functions. */
+ FLOAT_TYPE d;
+ FLOAT_TYPE f = 1.0;
+ if (value < 0.0)
+ d = -value;
+ else
+ d = value;
+ /* For denormalized numbers the d < 1.0 case below won't work,
+ as f can overflow to +Inf. */
+ if (d < FLOAT_MIN_10_NORM)
+ {
+ value /= FLOAT_MIN_10_NORM;
+ if (value < 0.0)
+ d = -value;
+ else
+ d = value;
+ exponent += FLOAT_MIN_10_EXP;
+ }
+ if (d < 1.0)
+ {
+ do
+ {
+ f *= 10.0;
+ --exponent;
+ }
+ while (d * f < 1.0);
+
+ value *= f;
+ }
+ else if (d >= 10.0)
+ {
+ do
+ {
+ f *= 10;
+ ++exponent;
+ }
+ while (d >= f * 10.0);
+
+ value /= f;
+ }
+ }
+ else if (value == 0.0)
+ /* SUSv2 leaves it unspecified whether *DECPT is 0 or 1 for 0.0.
+ This could be changed to -1 if we want to return 0. */
+ exponent = 0;
+
+ if (ndigit <= 0 && len > 0)
+ {
+ buf[0] = '\0';
+ *decpt = 1;
+ *sign = isfinite (value) ? signbit (value) != 0 : 0;
+ }
+ else
+ if (__APPEND (FUNC_PREFIX, fcvt_r) (value, MIN (ndigit, NDIGIT_MAX) - 1,
+ decpt, sign, buf, len))
+ return -1;
+
+ *decpt += exponent;
+ return 0;
+}
+
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+# ifdef LONG_DOUBLE_CVT
+# define cvt_symbol(symbol) \
+ cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+ APPEND (FUNC_PREFIX, symbol), GLIBC_2_4)
+# define cvt_symbol_1(lib, local, symbol, version) \
+ versioned_symbol (lib, local, symbol, version)
+# else
+# define cvt_symbol(symbol) \
+ cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+ APPEND (q, symbol), GLIBC_2_0); \
+ weak_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+# define cvt_symbol_1(lib, local, symbol, version) \
+ compat_symbol (lib, local, symbol, version)
+# endif
+#else
+# define cvt_symbol(symbol) \
+ weak_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+#endif
+cvt_symbol(fcvt_r);
+cvt_symbol(ecvt_r);
diff --git a/REORG.TODO/misc/err.c b/REORG.TODO/misc/err.c
new file mode 100644
index 0000000000..3da4e9d6b0
--- /dev/null
+++ b/REORG.TODO/misc/err.c
@@ -0,0 +1,179 @@
+/* 4.4BSD utility functions for error messages.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdarg.h>
+#include <err.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <wchar.h>
+#define flockfile(s) _IO_flockfile (s)
+#define funlockfile(s) _IO_funlockfile (s)
+
+extern char *__progname;
+
+#define VA(call) \
+{ \
+ va_list ap; \
+ va_start (ap, format); \
+ call; \
+ va_end (ap); \
+}
+
+static void
+convert_and_print (const char *format, __gnuc_va_list ap)
+{
+#define ALLOCA_LIMIT 2000
+ size_t len;
+ wchar_t *wformat = NULL;
+ mbstate_t st;
+ size_t res;
+ const char *tmp;
+
+ if (format == NULL)
+ return;
+
+ len = strlen (format) + 1;
+
+ do
+ {
+ if (len < ALLOCA_LIMIT)
+ wformat = (wchar_t *) alloca (len * sizeof (wchar_t));
+ else
+ {
+ if (wformat != NULL && len / 2 < ALLOCA_LIMIT)
+ wformat = NULL;
+
+ wformat = (wchar_t *) realloc (wformat, len * sizeof (wchar_t));
+
+ if (wformat == NULL)
+ {
+ fputws_unlocked (L"out of memory\n", stderr);
+ return;
+ }
+ }
+
+ memset (&st, '\0', sizeof (st));
+ tmp =format;
+ }
+ while ((res = __mbsrtowcs (wformat, &tmp, len, &st)) == len);
+
+ if (res == (size_t) -1)
+ /* The string cannot be converted. */
+ wformat = (wchar_t *) L"???";
+
+ __vfwprintf (stderr, wformat, ap);
+}
+
+void
+vwarnx (const char *format, __gnuc_va_list ap)
+{
+ flockfile (stderr);
+ if (_IO_fwide (stderr, 0) > 0)
+ {
+ __fwprintf (stderr, L"%s: ", __progname);
+ convert_and_print (format, ap);
+ putwc_unlocked (L'\n', stderr);
+ }
+ else
+ {
+ fprintf (stderr, "%s: ", __progname);
+ if (format)
+ vfprintf (stderr, format, ap);
+ putc_unlocked ('\n', stderr);
+ }
+ funlockfile (stderr);
+}
+libc_hidden_def (vwarnx)
+
+void
+vwarn (const char *format, __gnuc_va_list ap)
+{
+ int error = errno;
+
+ flockfile (stderr);
+ if (_IO_fwide (stderr, 0) > 0)
+ {
+ __fwprintf (stderr, L"%s: ", __progname);
+ if (format)
+ {
+ convert_and_print (format, ap);
+ fputws_unlocked (L": ", stderr);
+ }
+ __set_errno (error);
+ __fwprintf (stderr, L"%m\n");
+ }
+ else
+ {
+ fprintf (stderr, "%s: ", __progname);
+ if (format)
+ {
+ vfprintf (stderr, format, ap);
+ fputs_unlocked (": ", stderr);
+ }
+ __set_errno (error);
+ fprintf (stderr, "%m\n");
+ }
+ funlockfile (stderr);
+}
+libc_hidden_def (vwarn)
+
+
+void
+warn (const char *format, ...)
+{
+ VA (vwarn (format, ap))
+}
+libc_hidden_def (warn)
+
+void
+warnx (const char *format, ...)
+{
+ VA (vwarnx (format, ap))
+}
+libc_hidden_def (warnx)
+
+void
+verr (int status, const char *format, __gnuc_va_list ap)
+{
+ vwarn (format, ap);
+ exit (status);
+}
+libc_hidden_def (verr)
+
+void
+verrx (int status, const char *format, __gnuc_va_list ap)
+{
+ vwarnx (format, ap);
+ exit (status);
+}
+libc_hidden_def (verrx)
+
+void
+err (int status, const char *format, ...)
+{
+ VA (verr (status, format, ap))
+}
+
+void
+errx (int status, const char *format, ...)
+{
+ VA (verrx (status, format, ap))
+}
diff --git a/REORG.TODO/misc/err.h b/REORG.TODO/misc/err.h
new file mode 100644
index 0000000000..d893a25eac
--- /dev/null
+++ b/REORG.TODO/misc/err.h
@@ -0,0 +1,57 @@
+/* 4.4BSD utility functions for error messages.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _ERR_H
+#define _ERR_H 1
+
+#include <features.h>
+
+#define __need___va_list
+#include <stdarg.h>
+#ifndef __GNUC_VA_LIST
+# define __gnuc_va_list __ptr_t
+#endif
+
+__BEGIN_DECLS
+
+/* Print "program: ", FORMAT, ": ", the standard error string for errno,
+ and a newline, on stderr. */
+extern void warn (const char *__format, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+extern void vwarn (const char *__format, __gnuc_va_list)
+ __attribute__ ((__format__ (__printf__, 1, 0)));
+
+/* Likewise, but without ": " and the standard error string. */
+extern void warnx (const char *__format, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+extern void vwarnx (const char *__format, __gnuc_va_list)
+ __attribute__ ((__format__ (__printf__, 1, 0)));
+
+/* Likewise, and then exit with STATUS. */
+extern void err (int __status, const char *__format, ...)
+ __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
+extern void verr (int __status, const char *__format, __gnuc_va_list)
+ __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
+extern void errx (int __status, const char *__format, ...)
+ __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
+extern void verrx (int __status, const char *, __gnuc_va_list)
+ __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
+
+__END_DECLS
+
+#endif /* err.h */
diff --git a/REORG.TODO/misc/error.c b/REORG.TODO/misc/error.c
new file mode 100644
index 0000000000..1d960be23f
--- /dev/null
+++ b/REORG.TODO/misc/error.c
@@ -0,0 +1,408 @@
+/* Error handler for noninteractive utilities
+ Copyright (C) 1990-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
+ <http://www.gnu.org/licenses/>. */
+
+/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
+
+#if !_LIBC
+# include <config.h>
+#endif
+
+#include "error.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !_LIBC && ENABLE_NLS
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+# include <stdbool.h>
+# include <stdint.h>
+# include <wchar.h>
+# define mbsrtowcs __mbsrtowcs
+# define USE_UNLOCKED_IO 0
+# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b)
+# define _GL_ARG_NONNULL(a)
+#endif
+
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
+
+#ifndef _
+# define _(String) String
+#endif
+
+/* If NULL, error will flush stdout, then print on stderr the program
+ name, a colon and a space. Otherwise, error will call this
+ function without parameters instead. */
+void (*error_print_progname) (void);
+
+/* This variable is incremented each time 'error' is called. */
+unsigned int error_message_count;
+
+#ifdef _LIBC
+/* In the GNU C library, there is a predefined variable for this. */
+
+# define program_name program_invocation_name
+# include <errno.h>
+# include <limits.h>
+# include <libio/libioP.h>
+
+/* In GNU libc we want do not want to use the common name 'error' directly.
+ Instead make it a weak alias. */
+extern void __error (int status, int errnum, const char *message, ...)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+extern void __error_at_line (int status, int errnum, const char *file_name,
+ unsigned int line_number, const char *message,
+ ...)
+ __attribute__ ((__format__ (__printf__, 5, 6)));;
+# define error __error
+# define error_at_line __error_at_line
+
+# include <libio/iolibio.h>
+# define fflush(s) _IO_fflush (s)
+# undef putc
+# define putc(c, fp) _IO_putc (c, fp)
+
+# include <libc-lock.h>
+
+#else /* not _LIBC */
+
+# include <fcntl.h>
+# include <unistd.h>
+
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions. */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* Get _get_osfhandle. */
+# include "msvc-nothrow.h"
+# endif
+
+/* The gnulib override of fcntl is not needed in this file. */
+# undef fcntl
+
+# if !HAVE_DECL_STRERROR_R
+# ifndef HAVE_DECL_STRERROR_R
+"this configure-time declaration test was not run"
+# endif
+# if STRERROR_R_CHAR_P
+char *strerror_r ();
+# else
+int strerror_r ();
+# endif
+# endif
+
+/* The calling program should define program_name and set it to the
+ name of the executing program. */
+extern char *program_name;
+
+# if HAVE_STRERROR_R || defined strerror_r
+# define __strerror_r strerror_r
+# endif /* HAVE_STRERROR_R || defined strerror_r */
+#endif /* not _LIBC */
+
+#if !_LIBC
+/* Return non-zero if FD is open. */
+static int
+is_open (int fd)
+{
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ /* On native Windows: The initial state of unassigned standard file
+ descriptors is that they are open but point to an INVALID_HANDLE_VALUE.
+ There is no fcntl, and the gnulib replacement fcntl does not support
+ F_GETFL. */
+ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+# else
+# ifndef F_GETFL
+# error Please port fcntl to your platform
+# endif
+ return 0 <= fcntl (fd, F_GETFL);
+# endif
+}
+#endif
+
+static void
+flush_stdout (void)
+{
+#if !_LIBC
+ int stdout_fd;
+
+# if GNULIB_FREOPEN_SAFER
+ /* Use of gnulib's freopen-safer module normally ensures that
+ fileno (stdout) == 1
+ whenever stdout is open. */
+ stdout_fd = STDOUT_FILENO;
+# else
+ /* POSIX states that fileno (stdout) after fclose is unspecified. But in
+ practice it is not a problem, because stdout is statically allocated and
+ the fd of a FILE stream is stored as a field in its allocated memory. */
+ stdout_fd = fileno (stdout);
+# endif
+ /* POSIX states that fflush (stdout) after fclose is unspecified; it
+ is safe in glibc, but not on all other platforms. fflush (NULL)
+ is always defined, but too draconian. */
+ if (0 <= stdout_fd && is_open (stdout_fd))
+#endif
+ fflush (stdout);
+}
+
+static void
+print_errno_message (int errnum)
+{
+ char const *s;
+
+#if defined HAVE_STRERROR_R || _LIBC
+ char errbuf[1024];
+# if _LIBC || STRERROR_R_CHAR_P
+ s = __strerror_r (errnum, errbuf, sizeof errbuf);
+# else
+ if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
+ s = errbuf;
+ else
+ s = 0;
+# endif
+#else
+ s = strerror (errnum);
+#endif
+
+#if !_LIBC
+ if (! s)
+ s = _("Unknown system error");
+#endif
+
+#if _LIBC
+ __fxprintf (NULL, ": %s", s);
+#else
+ fprintf (stderr, ": %s", s);
+#endif
+}
+
+static void _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))
+error_tail (int status, int errnum, const char *message, va_list args)
+{
+#if _LIBC
+ if (_IO_fwide (stderr, 0) > 0)
+ {
+ size_t len = strlen (message) + 1;
+ wchar_t *wmessage = NULL;
+ mbstate_t st;
+ size_t res;
+ const char *tmp;
+ bool use_malloc = false;
+
+ while (1)
+ {
+ if (__libc_use_alloca (len * sizeof (wchar_t)))
+ wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
+ else
+ {
+ if (!use_malloc)
+ wmessage = NULL;
+
+ wchar_t *p = (wchar_t *) realloc (wmessage,
+ len * sizeof (wchar_t));
+ if (p == NULL)
+ {
+ free (wmessage);
+ fputws_unlocked (L"out of memory\n", stderr);
+ return;
+ }
+ wmessage = p;
+ use_malloc = true;
+ }
+
+ memset (&st, '\0', sizeof (st));
+ tmp = message;
+
+ res = mbsrtowcs (wmessage, &tmp, len, &st);
+ if (res != len)
+ break;
+
+ if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0))
+ {
+ /* This really should not happen if everything is fine. */
+ res = (size_t) -1;
+ break;
+ }
+
+ len *= 2;
+ }
+
+ if (res == (size_t) -1)
+ {
+ /* The string cannot be converted. */
+ if (use_malloc)
+ {
+ free (wmessage);
+ use_malloc = false;
+ }
+ wmessage = (wchar_t *) L"???";
+ }
+
+ __vfwprintf (stderr, wmessage, args);
+
+ if (use_malloc)
+ free (wmessage);
+ }
+ else
+#endif
+ vfprintf (stderr, message, args);
+ va_end (args);
+
+ ++error_message_count;
+ if (errnum)
+ print_errno_message (errnum);
+#if _LIBC
+ __fxprintf (NULL, "\n");
+#else
+ putc ('\n', stderr);
+#endif
+ fflush (stderr);
+ if (status)
+ exit (status);
+}
+
+
+/* Print the program name and error message MESSAGE, which is a printf-style
+ format string with optional args.
+ If ERRNUM is nonzero, print its corresponding system error message.
+ Exit with status STATUS if it is nonzero. */
+void
+error (int status, int errnum, const char *message, ...)
+{
+ va_list args;
+
+#if defined _LIBC && defined __libc_ptf_call
+ /* We do not want this call to be cut short by a thread
+ cancellation. Therefore disable cancellation for now. */
+ int state = PTHREAD_CANCEL_ENABLE;
+ __libc_ptf_call (__pthread_setcancelstate,
+ (PTHREAD_CANCEL_DISABLE, &state), 0);
+#endif
+
+ flush_stdout ();
+#ifdef _LIBC
+ _IO_flockfile (stderr);
+#endif
+ if (error_print_progname)
+ (*error_print_progname) ();
+ else
+ {
+#if _LIBC
+ __fxprintf (NULL, "%s: ", program_name);
+#else
+ fprintf (stderr, "%s: ", program_name);
+#endif
+ }
+
+ va_start (args, message);
+ error_tail (status, errnum, message, args);
+
+#ifdef _LIBC
+ _IO_funlockfile (stderr);
+# ifdef __libc_ptf_call
+ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
+# endif
+#endif
+}
+
+/* Sometimes we want to have at most one error per line. This
+ variable controls whether this mode is selected or not. */
+int error_one_per_line;
+
+void
+error_at_line (int status, int errnum, const char *file_name,
+ unsigned int line_number, const char *message, ...)
+{
+ va_list args;
+
+ if (error_one_per_line)
+ {
+ static const char *old_file_name;
+ static unsigned int old_line_number;
+
+ if (old_line_number == line_number
+ && (file_name == old_file_name
+ || (old_file_name != NULL
+ && file_name != NULL
+ && strcmp (old_file_name, file_name) == 0)))
+
+ /* Simply return and print nothing. */
+ return;
+
+ old_file_name = file_name;
+ old_line_number = line_number;
+ }
+
+#if defined _LIBC && defined __libc_ptf_call
+ /* We do not want this call to be cut short by a thread
+ cancellation. Therefore disable cancellation for now. */
+ int state = PTHREAD_CANCEL_ENABLE;
+ __libc_ptf_call (__pthread_setcancelstate,
+ (PTHREAD_CANCEL_DISABLE, &state),
+ 0);
+#endif
+
+ flush_stdout ();
+#ifdef _LIBC
+ _IO_flockfile (stderr);
+#endif
+ if (error_print_progname)
+ (*error_print_progname) ();
+ else
+ {
+#if _LIBC
+ __fxprintf (NULL, "%s:", program_name);
+#else
+ fprintf (stderr, "%s:", program_name);
+#endif
+ }
+
+#if _LIBC
+ __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
+ file_name, line_number);
+#else
+ fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
+ file_name, line_number);
+#endif
+
+ va_start (args, message);
+ error_tail (status, errnum, message, args);
+
+#ifdef _LIBC
+ _IO_funlockfile (stderr);
+# ifdef __libc_ptf_call
+ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
+# endif
+#endif
+}
+
+#ifdef _LIBC
+/* Make the weak alias. */
+# undef error
+# undef error_at_line
+weak_alias (__error, error)
+weak_alias (__error_at_line, error_at_line)
+#endif
diff --git a/REORG.TODO/misc/error.h b/REORG.TODO/misc/error.h
new file mode 100644
index 0000000000..6461d840d8
--- /dev/null
+++ b/REORG.TODO/misc/error.h
@@ -0,0 +1,57 @@
+/* Declaration for error-reporting function
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _ERROR_H
+#define _ERROR_H 1
+
+#include <features.h>
+
+
+__BEGIN_DECLS
+
+/* Print a message with `fprintf (stderr, FORMAT, ...)';
+ if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+ If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
+
+extern void error (int __status, int __errnum, const char *__format, ...)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+
+extern void error_at_line (int __status, int __errnum, const char *__fname,
+ unsigned int __lineno, const char *__format, ...)
+ __attribute__ ((__format__ (__printf__, 5, 6)));
+
+/* If NULL, error will flush stdout, then print on stderr the program
+ name, a colon and a space. Otherwise, error will call this
+ function without parameters instead. */
+extern void (*error_print_progname) (void);
+
+/* This variable is incremented each time `error' is called. */
+extern unsigned int error_message_count;
+
+/* Sometimes we want to have at most one error per line. This
+ variable controls whether this mode is selected or not. */
+extern int error_one_per_line;
+
+
+#if defined __extern_always_inline && defined __va_arg_pack
+# include <bits/error.h>
+#endif
+
+__END_DECLS
+
+#endif /* error.h */
diff --git a/REORG.TODO/misc/fchflags.c b/REORG.TODO/misc/fchflags.c
new file mode 100644
index 0000000000..b127695772
--- /dev/null
+++ b/REORG.TODO/misc/fchflags.c
@@ -0,0 +1,39 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Change the flags of the file referenced by FD to FLAGS. */
+
+int fchflags (int fd, unsigned long int flags) __THROW;
+
+int
+fchflags (int fd, unsigned long int flags)
+{
+ if (fd < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fchflags)
diff --git a/REORG.TODO/misc/fdatasync.c b/REORG.TODO/misc/fdatasync.c
new file mode 100644
index 0000000000..6e4cb17b07
--- /dev/null
+++ b/REORG.TODO/misc/fdatasync.c
@@ -0,0 +1,27 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+
+
+/* Synchronize at least the data part of a file with the underlying
+ media. */
+int
+fdatasync (int fildes)
+{
+ return fsync (fildes);
+}
diff --git a/REORG.TODO/misc/fgetxattr.c b/REORG.TODO/misc/fgetxattr.c
new file mode 100644
index 0000000000..5f43604987
--- /dev/null
+++ b/REORG.TODO/misc/fgetxattr.c
@@ -0,0 +1,29 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+fgetxattr (int __fd, const char *__name,
+ void *__value, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fgetxattr)
diff --git a/REORG.TODO/misc/flistxattr.c b/REORG.TODO/misc/flistxattr.c
new file mode 100644
index 0000000000..9b315e6d96
--- /dev/null
+++ b/REORG.TODO/misc/flistxattr.c
@@ -0,0 +1,28 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+flistxattr (int __fd, char *__list, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (flistxattr)
diff --git a/REORG.TODO/misc/fremovexattr.c b/REORG.TODO/misc/fremovexattr.c
new file mode 100644
index 0000000000..8c1574f903
--- /dev/null
+++ b/REORG.TODO/misc/fremovexattr.c
@@ -0,0 +1,28 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+fremovexattr (int __fd, const char *__name)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fremovexattr)
diff --git a/REORG.TODO/misc/fsetxattr.c b/REORG.TODO/misc/fsetxattr.c
new file mode 100644
index 0000000000..0633eb5b82
--- /dev/null
+++ b/REORG.TODO/misc/fsetxattr.c
@@ -0,0 +1,29 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+fsetxattr (int __fd, const char *__name, const void *__value,
+ size_t __size, int __flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (fsetxattr)
diff --git a/REORG.TODO/misc/fstab.c b/REORG.TODO/misc/fstab.c
new file mode 100644
index 0000000000..7da7e2b62b
--- /dev/null
+++ b/REORG.TODO/misc/fstab.c
@@ -0,0 +1,186 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fstab.h>
+#include <mntent.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libc-lock.h>
+
+#define BUFFER_SIZE 0x1fc0
+
+struct fstab_state
+{
+ FILE *fs_fp;
+ char *fs_buffer;
+ struct mntent fs_mntres;
+ struct fstab fs_ret;
+};
+
+static struct fstab_state *fstab_init (int opt_rewind);
+static struct mntent *fstab_fetch (struct fstab_state *state);
+static struct fstab *fstab_convert (struct fstab_state *state);
+
+static struct fstab_state fstab_state;
+
+
+int
+setfsent (void)
+{
+ return fstab_init (1) != NULL;
+}
+
+
+struct fstab *
+getfsent (void)
+{
+ struct fstab_state *state;
+
+ state = fstab_init (0);
+ if (state == NULL)
+ return NULL;
+ if (fstab_fetch (state) == NULL)
+ return NULL;
+ return fstab_convert (state);
+}
+
+
+struct fstab *
+getfsspec (const char *name)
+{
+ struct fstab_state *state;
+ struct mntent *m;
+
+ state = fstab_init (1);
+ if (state == NULL)
+ return NULL;
+ while ((m = fstab_fetch (state)) != NULL)
+ if (strcmp (m->mnt_fsname, name) == 0)
+ return fstab_convert (state);
+ return NULL;
+}
+
+
+struct fstab *
+getfsfile (const char *name)
+{
+ struct fstab_state *state;
+ struct mntent *m;
+
+ state = fstab_init (1);
+ if (state == NULL)
+ return NULL;
+ while ((m = fstab_fetch (state)) != NULL)
+ if (strcmp (m->mnt_dir, name) == 0)
+ return fstab_convert (state);
+ return NULL;
+}
+
+
+void
+endfsent (void)
+{
+ struct fstab_state *state;
+
+ state = &fstab_state;
+ if (state->fs_fp != NULL)
+ {
+ (void) __endmntent (state->fs_fp);
+ state->fs_fp = NULL;
+ }
+}
+
+
+static struct fstab_state *
+fstab_init (int opt_rewind)
+{
+ struct fstab_state *state;
+ char *buffer;
+ FILE *fp;
+
+ state = &fstab_state;
+
+ buffer = state->fs_buffer;
+ if (buffer == NULL)
+ {
+ buffer = (char *) malloc (BUFFER_SIZE);
+ if (buffer == NULL)
+ return NULL;
+ state->fs_buffer = buffer;
+ }
+
+ fp = state->fs_fp;
+ if (fp != NULL)
+ {
+ if (opt_rewind)
+ rewind (fp);
+ }
+ else
+ {
+ fp = __setmntent (_PATH_FSTAB, "r");
+ if (fp == NULL)
+ return NULL;
+ state->fs_fp = fp;
+ }
+
+ return state;
+}
+
+
+static struct mntent *
+fstab_fetch (struct fstab_state *state)
+{
+ return __getmntent_r (state->fs_fp, &state->fs_mntres,
+ state->fs_buffer, BUFFER_SIZE);
+}
+
+
+static struct fstab *
+fstab_convert (struct fstab_state *state)
+{
+ struct mntent *m;
+ struct fstab *f;
+
+ m = &state->fs_mntres;
+ f = &state->fs_ret;
+
+ f->fs_spec = m->mnt_fsname;
+ f->fs_file = m->mnt_dir;
+ f->fs_vfstype = m->mnt_type;
+ f->fs_mntops = m->mnt_opts;
+ f->fs_type = (__hasmntopt (m, FSTAB_RW) ? FSTAB_RW :
+ __hasmntopt (m, FSTAB_RQ) ? FSTAB_RQ :
+ __hasmntopt (m, FSTAB_RO) ? FSTAB_RO :
+ __hasmntopt (m, FSTAB_SW) ? FSTAB_SW :
+ __hasmntopt (m, FSTAB_XX) ? FSTAB_XX :
+ "??");
+ f->fs_freq = m->mnt_freq;
+ f->fs_passno = m->mnt_passno;
+ return f;
+}
+
+
+/* Make sure the memory is freed if the programs ends while in
+ memory-debugging mode and something actually was allocated. */
+libc_freeres_fn (fstab_free)
+{
+ char *buffer;
+
+ buffer = fstab_state.fs_buffer;
+ free ((void *) buffer);
+}
diff --git a/REORG.TODO/misc/fstab.h b/REORG.TODO/misc/fstab.h
new file mode 100644
index 0000000000..9f17e1b96a
--- /dev/null
+++ b/REORG.TODO/misc/fstab.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1980, 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.
+ *
+ * @(#)fstab.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _FSTAB_H
+#define _FSTAB_H 1
+
+#include <features.h>
+
+/*
+ * File system table, see fstab(5).
+ *
+ * Used by dump, mount, umount, swapon, fsck, df, ...
+ *
+ * For ufs fs_spec field is the block special name. Programs that want to
+ * use the character special name must create that name by prepending a 'r'
+ * after the right most slash. Quota files are always named "quotas", so
+ * if type is "rq", then use concatenation of fs_file and "quotas" to locate
+ * quota file.
+ */
+#define _PATH_FSTAB "/etc/fstab"
+#define FSTAB "/etc/fstab" /* deprecated */
+
+#define FSTAB_RW "rw" /* read/write device */
+#define FSTAB_RQ "rq" /* read/write with quotas */
+#define FSTAB_RO "ro" /* read-only device */
+#define FSTAB_SW "sw" /* swap device */
+#define FSTAB_XX "xx" /* ignore totally */
+
+struct fstab
+ {
+ char *fs_spec; /* block special device name */
+ char *fs_file; /* file system path prefix */
+ char *fs_vfstype; /* File system type, ufs, nfs */
+ char *fs_mntops; /* Mount options ala -o */
+ const char *fs_type; /* FSTAB_* from fs_mntops */
+ int fs_freq; /* dump frequency, in days */
+ int fs_passno; /* pass number on parallel dump */
+ };
+
+
+__BEGIN_DECLS
+
+extern struct fstab *getfsent (void) __THROW;
+extern struct fstab *getfsspec (const char *__name) __THROW;
+extern struct fstab *getfsfile (const char *__name) __THROW;
+extern int setfsent (void) __THROW;
+extern void endfsent (void) __THROW;
+
+__END_DECLS
+
+#endif /* fstab.h */
diff --git a/REORG.TODO/misc/fsync.c b/REORG.TODO/misc/fsync.c
new file mode 100644
index 0000000000..5d425579e0
--- /dev/null
+++ b/REORG.TODO/misc/fsync.c
@@ -0,0 +1,30 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make all changes done to FD actually appear on disk. */
+int
+fsync (int fd)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (fsync)
diff --git a/REORG.TODO/misc/ftruncate.c b/REORG.TODO/misc/ftruncate.c
new file mode 100644
index 0000000000..82b5d5a1f8
--- /dev/null
+++ b/REORG.TODO/misc/ftruncate.c
@@ -0,0 +1,32 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+/* Truncate the file referenced by FD to LENGTH bytes. */
+int
+__ftruncate (int fd, off_t length)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__ftruncate, ftruncate)
+
+stub_warning (ftruncate)
diff --git a/REORG.TODO/misc/ftruncate64.c b/REORG.TODO/misc/ftruncate64.c
new file mode 100644
index 0000000000..4789ad3f21
--- /dev/null
+++ b/REORG.TODO/misc/ftruncate64.c
@@ -0,0 +1,33 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Truncate the file referenced by FD to LENGTH bytes. */
+int
+__ftruncate64 (int fd, off64_t length)
+{
+ if ((off_t) length != length)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+ return __ftruncate (fd, (off_t) length);
+}
+weak_alias (__ftruncate64, ftruncate64)
diff --git a/REORG.TODO/misc/futimes.c b/REORG.TODO/misc/futimes.c
new file mode 100644
index 0000000000..6dad9996fa
--- /dev/null
+++ b/REORG.TODO/misc/futimes.c
@@ -0,0 +1,32 @@
+/* futimes -- change access and modification times of open file. Stub version.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/time.h>
+#include <errno.h>
+
+/* Change the access time of FILE to TVP[0] and
+ the modification time of FILE to TVP[1], but do not follow symlinks. */
+int
+__futimes (int fd, const struct timeval tvp[2])
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__futimes, futimes)
+
+stub_warning (futimes)
diff --git a/REORG.TODO/misc/futimesat.c b/REORG.TODO/misc/futimesat.c
new file mode 100644
index 0000000000..6f2191b0bc
--- /dev/null
+++ b/REORG.TODO/misc/futimesat.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2005-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/time.h>
+
+
+/* Change the access time of FILE relative to FD to TVP[0] and
+ the modification time of FILE to TVP[1]. */
+int
+futimesat (int fd, const char *file, const struct timeval tvp[2])
+{
+ if (fd < 0
+ && (file == NULL
+ || (fd != AT_FDCWD && file[0] != '/')))
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (futimesat)
diff --git a/REORG.TODO/misc/getauxval.c b/REORG.TODO/misc/getauxval.c
new file mode 100644
index 0000000000..c83fbce054
--- /dev/null
+++ b/REORG.TODO/misc/getauxval.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2012-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/auxv.h>
+#include <errno.h>
+#include <ldsodefs.h>
+
+
+unsigned long int
+__getauxval (unsigned long int type)
+{
+#ifdef HAVE_AUX_VECTOR
+ ElfW(auxv_t) *p;
+#endif
+
+ if (type == AT_HWCAP)
+ return GLRO(dl_hwcap);
+ else if (type == AT_HWCAP2)
+ return GLRO(dl_hwcap2);
+
+#ifdef HAVE_AUX_VECTOR
+ for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
+ if (p->a_type == type)
+ return p->a_un.a_val;
+#endif
+
+ __set_errno (ENOENT);
+ return 0;
+}
+
+weak_alias (__getauxval, getauxval)
diff --git a/REORG.TODO/misc/getclktck.c b/REORG.TODO/misc/getclktck.c
new file mode 100644
index 0000000000..b64eb6f121
--- /dev/null
+++ b/REORG.TODO/misc/getclktck.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2000-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <time.h>
+
+/* Return frequency of times(). */
+int
+__getclktck (void)
+{
+#ifdef CLK_TCK
+ return CLK_TCK;
+#else
+ return 60;
+#endif
+}
diff --git a/REORG.TODO/misc/getdomain.c b/REORG.TODO/misc/getdomain.c
new file mode 100644
index 0000000000..c84d769342
--- /dev/null
+++ b/REORG.TODO/misc/getdomain.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 1994-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
+ <http://www.gnu.org/licenses/>. */
+
+/* Put the name of the current YP domain in no more than LEN bytes of NAME.
+ The result is null-terminated if LEN is large enough for the full
+ name and the terminator. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/utsname.h>
+#include <string.h>
+
+#if _UTSNAME_DOMAIN_LENGTH
+/* The `uname' information includes the domain name. */
+
+int
+getdomainname (char *name, size_t len)
+{
+ struct utsname u;
+ size_t u_len;
+
+ if (uname (&u) < 0)
+ return -1;
+
+ u_len = strlen (u.domainname);
+ memcpy (name, u.domainname, MIN (u_len + 1, len));
+ return 0;
+}
+
+#else
+
+int
+getdomainname (char *name, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (getdomainname)
+
+#endif
+
+libc_hidden_def (getdomainname)
diff --git a/REORG.TODO/misc/getdtsz.c b/REORG.TODO/misc/getdtsz.c
new file mode 100644
index 0000000000..3fa95d92a4
--- /dev/null
+++ b/REORG.TODO/misc/getdtsz.c
@@ -0,0 +1,31 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the maximum number of file descriptors
+ the current process could possibly have. */
+int
+__getdtablesize (void)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getdtablesize)
+
+weak_alias (__getdtablesize, getdtablesize)
diff --git a/REORG.TODO/misc/gethostid.c b/REORG.TODO/misc/gethostid.c
new file mode 100644
index 0000000000..3b1b667b0e
--- /dev/null
+++ b/REORG.TODO/misc/gethostid.c
@@ -0,0 +1,30 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the current machine's Internet number. */
+long int
+gethostid (void)
+{
+ __set_errno (ENOSYS);
+ return -1L;
+}
+
+
+stub_warning (gethostid)
diff --git a/REORG.TODO/misc/gethostname.c b/REORG.TODO/misc/gethostname.c
new file mode 100644
index 0000000000..cfdd1c282f
--- /dev/null
+++ b/REORG.TODO/misc/gethostname.c
@@ -0,0 +1,32 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Put the name of the current host in no more than LEN bytes of NAME.
+ The result is null-terminated if LEN is large enough for the full
+ name and the terminator. */
+int
+__gethostname (char *name, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (gethostname)
+
+weak_alias (__gethostname, gethostname)
diff --git a/REORG.TODO/misc/getloadavg.c b/REORG.TODO/misc/getloadavg.c
new file mode 100644
index 0000000000..6dde29dee4
--- /dev/null
+++ b/REORG.TODO/misc/getloadavg.c
@@ -0,0 +1,35 @@
+/* Get system load averages. Stub version.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+
+/* Put the 1 minute, 5 minute and 15 minute load averages
+ into the first NELEM elements of LOADAVG.
+ Return the number written (never more than 3, but may be less than NELEM),
+ or -1 if an error occurred. */
+
+int
+getloadavg (double loadavg[], int nelem)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (getloadavg)
diff --git a/REORG.TODO/misc/getpagesize.c b/REORG.TODO/misc/getpagesize.c
new file mode 100644
index 0000000000..df1b8abbd7
--- /dev/null
+++ b/REORG.TODO/misc/getpagesize.c
@@ -0,0 +1,31 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the system page size. */
+int
+__getpagesize (void)
+{
+ __set_errno (ENOSYS);
+ return 0;
+}
+libc_hidden_def (__getpagesize)
+stub_warning (getpagesize)
+
+weak_alias (__getpagesize, getpagesize)
diff --git a/REORG.TODO/misc/getpass.c b/REORG.TODO/misc/getpass.c
new file mode 100644
index 0000000000..89c783fe20
--- /dev/null
+++ b/REORG.TODO/misc/getpass.c
@@ -0,0 +1,124 @@
+/* Copyright (C) 1992-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <string.h> /* For string function builtin redirect. */
+#include <termios.h>
+#include <unistd.h>
+
+#include <wchar.h>
+#define flockfile(s) _IO_flockfile (s)
+#define funlockfile(s) _IO_funlockfile (s)
+#include <libc-lock.h>
+
+/* It is desirable to use this bit on systems that have it.
+ The only bit of terminal state we want to twiddle is echoing, which is
+ done in software; there is no need to change the state of the terminal
+ hardware. */
+
+#ifndef TCSASOFT
+#define TCSASOFT 0
+#endif
+
+static void
+call_fclose (void *arg)
+{
+ if (arg != NULL)
+ fclose (arg);
+}
+
+char *
+getpass (const char *prompt)
+{
+ FILE *in, *out;
+ struct termios s, t;
+ int tty_changed;
+ static char *buf;
+ static size_t bufsize;
+ ssize_t nread;
+
+ /* Try to write to and read from the terminal if we can.
+ If we can't open the terminal, use stderr and stdin. */
+
+ in = fopen ("/dev/tty", "w+ce");
+ if (in == NULL)
+ {
+ in = stdin;
+ out = stderr;
+ }
+ else
+ {
+ /* We do the locking ourselves. */
+ __fsetlocking (in, FSETLOCKING_BYCALLER);
+
+ out = in;
+ }
+
+ /* Make sure the stream we opened is closed even if the thread is
+ canceled. */
+ __libc_cleanup_push (call_fclose, in == out ? in : NULL);
+
+ flockfile (out);
+
+ /* Turn echoing off if it is on now. */
+
+ if (__tcgetattr (fileno (in), &t) == 0)
+ {
+ /* Save the old one. */
+ s = t;
+ /* Tricky, tricky. */
+ t.c_lflag &= ~(ECHO|ISIG);
+ tty_changed = (tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &t) == 0);
+ }
+ else
+ tty_changed = 0;
+
+ /* Write the prompt. */
+ __fxprintf (out, "%s", prompt);
+ __fflush_unlocked (out);
+
+ /* Read the password. */
+ nread = __getline (&buf, &bufsize, in);
+ if (buf != NULL)
+ {
+ if (nread < 0)
+ buf[0] = '\0';
+ else if (buf[nread - 1] == '\n')
+ {
+ /* Remove the newline. */
+ buf[nread - 1] = '\0';
+ if (tty_changed)
+ /* Write the newline that was not echoed. */
+ __fxprintf (out, "\n");
+ }
+ }
+
+ /* Restore the original setting. */
+ if (tty_changed)
+ (void) tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &s);
+
+ funlockfile (out);
+
+ __libc_cleanup_pop (0);
+
+ if (in != stdin)
+ /* We opened the terminal; now close it. */
+ fclose (in);
+
+ return buf;
+}
diff --git a/REORG.TODO/misc/getsysstats.c b/REORG.TODO/misc/getsysstats.c
new file mode 100644
index 0000000000..d25770ec52
--- /dev/null
+++ b/REORG.TODO/misc/getsysstats.c
@@ -0,0 +1,67 @@
+/* getsysstats - Determine various system internal values, stub version.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/sysinfo.h>
+
+int
+__get_nprocs_conf (void)
+{
+ /* We don't know how to determine the number. Simply return always 1. */
+ return 1;
+}
+weak_alias (__get_nprocs_conf, get_nprocs_conf)
+
+link_warning (get_nprocs_conf, "warning: get_nprocs_conf will always return 1")
+
+
+
+int
+__get_nprocs (void)
+{
+ /* We don't know how to determine the number. Simply return always 1. */
+ return 1;
+}
+weak_alias (__get_nprocs, get_nprocs)
+
+link_warning (get_nprocs, "warning: get_nprocs will always return 1")
+
+
+long int
+__get_phys_pages (void)
+{
+ /* We have no general way to determine this value. */
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__get_phys_pages, get_phys_pages)
+
+stub_warning (get_phys_pages)
+
+
+long int
+__get_avphys_pages (void)
+{
+ /* We have no general way to determine this value. */
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__get_avphys_pages, get_avphys_pages)
+
+stub_warning (get_avphys_pages)
diff --git a/REORG.TODO/misc/getttyent.c b/REORG.TODO/misc/getttyent.c
new file mode 100644
index 0000000000..73002f52d1
--- /dev/null
+++ b/REORG.TODO/misc/getttyent.c
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getttyent.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <ttyent.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <ctype.h>
+#include <string.h>
+
+#define flockfile(s) _IO_flockfile (s)
+#define funlockfile(s) _IO_funlockfile (s)
+
+static char zapchar;
+static FILE *tf;
+
+struct ttyent *
+__getttynam (const char *tty)
+{
+ struct ttyent *t;
+
+ __setttyent();
+ while ((t = __getttyent()))
+ if (!strcmp(tty, t->ty_name))
+ break;
+ __endttyent();
+ return (t);
+}
+weak_alias (__getttynam, getttynam)
+
+static char *skip (char *) __THROW internal_function;
+static char *value (char *) __THROW internal_function;
+
+struct ttyent *
+__getttyent (void)
+{
+ static struct ttyent tty;
+ int c;
+ char *p;
+#define MAXLINELENGTH 100
+ static char line[MAXLINELENGTH];
+
+ if (!tf && !__setttyent())
+ return (NULL);
+ flockfile (tf);
+ for (;;) {
+ if (!__fgets_unlocked(p = line, sizeof(line), tf)) {
+ funlockfile (tf);
+ return (NULL);
+ }
+ /* skip lines that are too big */
+ if (!strchr (p, '\n')) {
+ while ((c = getc_unlocked(tf)) != '\n' && c != EOF)
+ ;
+ continue;
+ }
+ while (isspace(*p))
+ ++p;
+ if (*p && *p != '#')
+ break;
+ }
+
+ zapchar = 0;
+ tty.ty_name = p;
+ p = skip(p);
+ if (!*(tty.ty_getty = p))
+ tty.ty_getty = tty.ty_type = NULL;
+ else {
+ p = skip(p);
+ if (!*(tty.ty_type = p))
+ tty.ty_type = NULL;
+ else
+ p = skip(p);
+ }
+ tty.ty_status = 0;
+ tty.ty_window = NULL;
+
+#define scmp(e) !strncmp(p, e, sizeof(e) - 1) && isspace(p[sizeof(e) - 1])
+#define vcmp(e) !strncmp(p, e, sizeof(e) - 1) && p[sizeof(e) - 1] == '='
+ for (; *p; p = skip(p)) {
+ if (scmp(_TTYS_OFF))
+ tty.ty_status &= ~TTY_ON;
+ else if (scmp(_TTYS_ON))
+ tty.ty_status |= TTY_ON;
+ else if (scmp(_TTYS_SECURE))
+ tty.ty_status |= TTY_SECURE;
+ else if (vcmp(_TTYS_WINDOW))
+ tty.ty_window = value(p);
+ else
+ break;
+ }
+ /* We can release the lock only here since `zapchar' is global. */
+ funlockfile(tf);
+
+ if (zapchar == '#' || *p == '#')
+ while ((c = *++p) == ' ' || c == '\t')
+ ;
+ tty.ty_comment = p;
+ if (*p == 0)
+ tty.ty_comment = 0;
+ if ((p = strchr (p, '\n')))
+ *p = '\0';
+ return (&tty);
+}
+libc_hidden_def (__getttyent)
+weak_alias (__getttyent, getttyent)
+
+#define QUOTED 1
+
+/*
+ * Skip over the current field, removing quotes, and return a pointer to
+ * the next field.
+ */
+static char *
+internal_function
+skip (char *p)
+{
+ char *t;
+ int c, q;
+
+ for (q = 0, t = p; (c = *p) != '\0'; p++) {
+ if (c == '"') {
+ q ^= QUOTED; /* obscure, but nice */
+ continue;
+ }
+ if (q == QUOTED && *p == '\\' && *(p+1) == '"')
+ p++;
+ *t++ = *p;
+ if (q == QUOTED)
+ continue;
+ if (c == '#') {
+ zapchar = c;
+ *p = 0;
+ break;
+ }
+ if (c == '\t' || c == ' ' || c == '\n') {
+ zapchar = c;
+ *p++ = 0;
+ while ((c = *p) == '\t' || c == ' ' || c == '\n')
+ p++;
+ break;
+ }
+ }
+ *--t = '\0';
+ return (p);
+}
+
+static char *
+internal_function
+value (char *p)
+{
+
+ return ((p = strchr (p, '=')) ? ++p : NULL);
+}
+
+int
+__setttyent (void)
+{
+
+ if (tf) {
+ (void)rewind(tf);
+ return (1);
+ } else if ((tf = fopen(_PATH_TTYS, "rce"))) {
+ /* We do the locking ourselves. */
+ __fsetlocking (tf, FSETLOCKING_BYCALLER);
+ return (1);
+ }
+ return (0);
+}
+libc_hidden_def (__setttyent)
+weak_alias (__setttyent, setttyent)
+
+int
+__endttyent (void)
+{
+ int rval;
+
+ if (tf) {
+ rval = !(fclose(tf) == EOF);
+ tf = NULL;
+ return (rval);
+ }
+ return (1);
+}
+libc_hidden_def (__endttyent)
+weak_alias (__endttyent, endttyent)
diff --git a/REORG.TODO/misc/getusershell.c b/REORG.TODO/misc/getusershell.c
new file mode 100644
index 0000000000..fc2c43b771
--- /dev/null
+++ b/REORG.TODO/misc/getusershell.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 1985, 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <paths.h>
+
+/*
+ * Local shells should NOT be added here. They should be added in
+ * /etc/shells.
+ */
+
+/* NB: we do not initialize okshells here. The initialization needs
+ relocations. These interfaces are used so rarely that this is not
+ justified. Instead explicitly initialize the array when it is
+ used. */
+#if 0
+static const char *const okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
+#else
+static const char *okshells[3];
+#endif
+static char **curshell, **shells, *strings;
+static char **initshells (void) __THROW;
+
+/*
+ * Get a list of shells from _PATH_SHELLS, if it exists.
+ */
+char *
+getusershell (void)
+{
+ char *ret;
+
+ if (curshell == NULL)
+ curshell = initshells();
+ ret = *curshell;
+ if (ret != NULL)
+ curshell++;
+ return (ret);
+}
+
+void
+endusershell (void)
+{
+
+ free(shells);
+ shells = NULL;
+ free(strings);
+ strings = NULL;
+ curshell = NULL;
+}
+
+void
+setusershell (void)
+{
+
+ curshell = initshells();
+}
+
+static char **
+initshells (void)
+{
+ char **sp, *cp;
+ FILE *fp;
+ struct stat64 statb;
+ size_t flen;
+
+ free(shells);
+ shells = NULL;
+ free(strings);
+ strings = NULL;
+ if ((fp = fopen(_PATH_SHELLS, "rce")) == NULL)
+ goto init_okshells_noclose;
+ if (fstat64(fileno(fp), &statb) == -1) {
+ init_okshells:
+ (void)fclose(fp);
+ init_okshells_noclose:
+ okshells[0] = _PATH_BSHELL;
+ okshells[1] = _PATH_CSHELL;
+ return (char **) okshells;
+ }
+ if (statb.st_size > ~(size_t)0 / sizeof (char *) * 3)
+ goto init_okshells;
+ flen = statb.st_size + 3;
+ if ((strings = malloc(flen)) == NULL)
+ goto init_okshells;
+ shells = malloc(statb.st_size / 3 * sizeof (char *));
+ if (shells == NULL) {
+ free(strings);
+ strings = NULL;
+ goto init_okshells;
+ }
+ sp = shells;
+ cp = strings;
+ while (fgets_unlocked(cp, flen - (cp - strings), fp) != NULL) {
+ while (*cp != '#' && *cp != '/' && *cp != '\0')
+ cp++;
+ if (*cp == '#' || *cp == '\0' || cp[1] == '\0')
+ continue;
+ *sp++ = cp;
+ while (!isspace(*cp) && *cp != '#' && *cp != '\0')
+ cp++;
+ *cp++ = '\0';
+ }
+ *sp = NULL;
+ (void)fclose(fp);
+ return (shells);
+}
diff --git a/REORG.TODO/misc/getxattr.c b/REORG.TODO/misc/getxattr.c
new file mode 100644
index 0000000000..5f9a50d1ad
--- /dev/null
+++ b/REORG.TODO/misc/getxattr.c
@@ -0,0 +1,29 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+getxattr (const char *__path, const char *__name,
+ void *__value, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (getxattr)
diff --git a/REORG.TODO/misc/gtty.c b/REORG.TODO/misc/gtty.c
new file mode 100644
index 0000000000..48c702743b
--- /dev/null
+++ b/REORG.TODO/misc/gtty.c
@@ -0,0 +1,36 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sgtty.h>
+#include <stddef.h>
+
+/* Fill in *PARAMS with terminal parameters associated with FD. */
+int
+gtty (int fd, struct sgttyb *params)
+{
+ if (params == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (gtty)
diff --git a/REORG.TODO/misc/hsearch.c b/REORG.TODO/misc/hsearch.c
new file mode 100644
index 0000000000..663f1a4ddb
--- /dev/null
+++ b/REORG.TODO/misc/hsearch.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1993-2017 Free Software Foundation, Inc.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <search.h>
+
+/* The non-reentrant version use a global space for storing the table. */
+static struct hsearch_data htab;
+
+
+/* Define the non-reentrant function using the reentrant counterparts. */
+ENTRY *
+hsearch (ENTRY item, ACTION action)
+{
+ ENTRY *result;
+
+ (void) __hsearch_r (item, action, &result, &htab);
+
+ return result;
+}
+
+
+int
+hcreate (size_t nel)
+{
+ return __hcreate_r (nel, &htab);
+}
+
+
+void
+__hdestroy (void)
+{
+ __hdestroy_r (&htab);
+}
+weak_alias (__hdestroy, hdestroy)
+
+/* Make sure the table is freed if we want to free everything before
+ exiting. */
+text_set_element (__libc_subfreeres, __hdestroy);
diff --git a/REORG.TODO/misc/hsearch_r.c b/REORG.TODO/misc/hsearch_r.c
new file mode 100644
index 0000000000..b7441eb987
--- /dev/null
+++ b/REORG.TODO/misc/hsearch_r.c
@@ -0,0 +1,231 @@
+/* Copyright (C) 1993-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <malloc.h>
+#include <string.h>
+#include <stdint.h>
+#include <search.h>
+#include <limits.h>
+
+/* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986
+ [Knuth] The Art of Computer Programming, part 3 (6.4) */
+
+
+/* The reentrant version has no static variables to maintain the state.
+ Instead the interface of all functions is extended to take an argument
+ which describes the current status. */
+typedef struct _ENTRY
+{
+ unsigned int used;
+ ENTRY entry;
+}
+_ENTRY;
+
+
+/* For the used double hash method the table size has to be a prime. To
+ correct the user given table size we need a prime test. This trivial
+ algorithm is adequate because
+ a) the code is (most probably) called a few times per program run and
+ b) the number is small because the table must fit in the core */
+static int
+isprime (unsigned int number)
+{
+ /* no even number will be passed */
+ for (unsigned int div = 3; div <= number / div; div += 2)
+ if (number % div == 0)
+ return 0;
+ return 1;
+}
+
+/* Before using the hash table we must allocate memory for it.
+ Test for an existing table are done. We allocate one element
+ more as the found prime number says. This is done for more effective
+ indexing as explained in the comment for the hsearch function.
+ The contents of the table is zeroed, especially the field used
+ becomes zero. */
+int
+__hcreate_r (size_t nel, struct hsearch_data *htab)
+{
+ /* Test for correct arguments. */
+ if (htab == NULL)
+ {
+ __set_errno (EINVAL);
+ return 0;
+ }
+
+ /* There is still another table active. Return with error. */
+ if (htab->table != NULL)
+ return 0;
+
+ /* We need a size of at least 3. Otherwise the hash functions we
+ use will not work. */
+ if (nel < 3)
+ nel = 3;
+
+ /* Change nel to the first prime number in the range [nel, UINT_MAX - 2],
+ The '- 2' means 'nel += 2' cannot overflow. */
+ for (nel |= 1; ; nel += 2)
+ {
+ if (UINT_MAX - 2 < nel)
+ {
+ __set_errno (ENOMEM);
+ return 0;
+ }
+ if (isprime (nel))
+ break;
+ }
+
+ htab->size = nel;
+ htab->filled = 0;
+
+ /* allocate memory and zero out */
+ htab->table = (_ENTRY *) calloc (htab->size + 1, sizeof (_ENTRY));
+ if (htab->table == NULL)
+ return 0;
+
+ /* everything went alright */
+ return 1;
+}
+libc_hidden_def (__hcreate_r)
+weak_alias (__hcreate_r, hcreate_r)
+
+
+/* After using the hash table it has to be destroyed. The used memory can
+ be freed and the local static variable can be marked as not used. */
+void
+__hdestroy_r (struct hsearch_data *htab)
+{
+ /* Test for correct arguments. */
+ if (htab == NULL)
+ {
+ __set_errno (EINVAL);
+ return;
+ }
+
+ /* Free used memory. */
+ free (htab->table);
+
+ /* the sign for an existing table is an value != NULL in htable */
+ htab->table = NULL;
+}
+libc_hidden_def (__hdestroy_r)
+weak_alias (__hdestroy_r, hdestroy_r)
+
+
+/* This is the search function. It uses double hashing with open addressing.
+ The argument item.key has to be a pointer to an zero terminated, most
+ probably strings of chars. The function for generating a number of the
+ strings is simple but fast. It can be replaced by a more complex function
+ like ajw (see [Aho,Sethi,Ullman]) if the needs are shown.
+
+ We use an trick to speed up the lookup. The table is created by hcreate
+ with one more element available. This enables us to use the index zero
+ special. This index will never be used because we store the first hash
+ index in the field used where zero means not used. Every other value
+ means used. The used field can be used as a first fast comparison for
+ equality of the stored and the parameter value. This helps to prevent
+ unnecessary expensive calls of strcmp. */
+int
+__hsearch_r (ENTRY item, ACTION action, ENTRY **retval,
+ struct hsearch_data *htab)
+{
+ unsigned int hval;
+ unsigned int count;
+ unsigned int len = strlen (item.key);
+ unsigned int idx;
+
+ /* Compute an value for the given string. Perhaps use a better method. */
+ hval = len;
+ count = len;
+ while (count-- > 0)
+ {
+ hval <<= 4;
+ hval += item.key[count];
+ }
+ if (hval == 0)
+ ++hval;
+
+ /* First hash function: simply take the modul but prevent zero. */
+ idx = hval % htab->size + 1;
+
+ if (htab->table[idx].used)
+ {
+ /* Further action might be required according to the action value. */
+ if (htab->table[idx].used == hval
+ && strcmp (item.key, htab->table[idx].entry.key) == 0)
+ {
+ *retval = &htab->table[idx].entry;
+ return 1;
+ }
+
+ /* Second hash function, as suggested in [Knuth] */
+ unsigned int hval2 = 1 + hval % (htab->size - 2);
+ unsigned int first_idx = idx;
+
+ do
+ {
+ /* Because SIZE is prime this guarantees to step through all
+ available indeces. */
+ if (idx <= hval2)
+ idx = htab->size + idx - hval2;
+ else
+ idx -= hval2;
+
+ /* If we visited all entries leave the loop unsuccessfully. */
+ if (idx == first_idx)
+ break;
+
+ /* If entry is found use it. */
+ if (htab->table[idx].used == hval
+ && strcmp (item.key, htab->table[idx].entry.key) == 0)
+ {
+ *retval = &htab->table[idx].entry;
+ return 1;
+ }
+ }
+ while (htab->table[idx].used);
+ }
+
+ /* An empty bucket has been found. */
+ if (action == ENTER)
+ {
+ /* If table is full and another entry should be entered return
+ with error. */
+ if (htab->filled == htab->size)
+ {
+ __set_errno (ENOMEM);
+ *retval = NULL;
+ return 0;
+ }
+
+ htab->table[idx].used = hval;
+ htab->table[idx].entry = item;
+
+ ++htab->filled;
+
+ *retval = &htab->table[idx].entry;
+ return 1;
+ }
+
+ __set_errno (ESRCH);
+ *retval = NULL;
+ return 0;
+}
+libc_hidden_def (__hsearch_r)
+weak_alias (__hsearch_r, hsearch_r)
diff --git a/REORG.TODO/misc/ifunc-impl-list.c b/REORG.TODO/misc/ifunc-impl-list.c
new file mode 100644
index 0000000000..01df87f6df
--- /dev/null
+++ b/REORG.TODO/misc/ifunc-impl-list.c
@@ -0,0 +1,32 @@
+/* Enumerate available IFUNC implementations of a function. Stub version.
+ Copyright (C) 2012-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <ifunc-impl-list.h>
+
+/* Fill ARRAY of MAX elements with IFUNC implementations for function
+ NAME supported on target machine and return the number of valid
+ entries. */
+
+size_t
+__libc_ifunc_impl_list
+ (const char *name __attribute__ ((unused)),
+ struct libc_ifunc_impl *array __attribute__ ((unused)),
+ size_t max __attribute__ ((unused)))
+{
+ return 0;
+}
diff --git a/REORG.TODO/misc/init-misc.c b/REORG.TODO/misc/init-misc.c
new file mode 100644
index 0000000000..02f2b0fa12
--- /dev/null
+++ b/REORG.TODO/misc/init-misc.c
@@ -0,0 +1,40 @@
+/* Define and initialize `__progname' et. al.
+ Copyright (C) 1994-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <string.h>
+#include <libc-internal.h>
+
+char *__progname_full = (char *) "";
+char *__progname = (char *) "";
+weak_alias (__progname_full, program_invocation_name)
+weak_alias (__progname, program_invocation_short_name)
+
+
+void
+__init_misc (int argc, char **argv, char **envp)
+{
+ if (argv && argv[0])
+ {
+ char *p = strrchr (argv[0], '/');
+ if (p == NULL)
+ __progname = argv[0];
+ else
+ __progname = p + 1;
+ __progname_full = argv[0];
+ }
+}
diff --git a/REORG.TODO/misc/insremque.c b/REORG.TODO/misc/insremque.c
new file mode 100644
index 0000000000..e16d22b91d
--- /dev/null
+++ b/REORG.TODO/misc/insremque.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1992-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <stddef.h>
+#include <search.h>
+
+/* Insert ELEM into a doubly-linked list, after PREV. */
+
+void
+insque (void *elem, void *prev)
+{
+ if (prev == NULL)
+ {
+ ((struct qelem *) elem)->q_forw = NULL;
+ ((struct qelem *) elem)->q_back = NULL;
+ }
+ else
+ {
+ struct qelem *next = ((struct qelem *) prev)->q_forw;
+ ((struct qelem *) prev)->q_forw = (struct qelem *) elem;
+ if (next != NULL)
+ next->q_back = (struct qelem *) elem;
+ ((struct qelem *) elem)->q_forw = next;
+ ((struct qelem *) elem)->q_back = (struct qelem *) prev;
+ }
+}
+
+/* Unlink ELEM from the doubly-linked list that it is in. */
+
+void
+remque (void *elem)
+{
+ struct qelem *next = ((struct qelem *) elem)->q_forw;
+ struct qelem *prev = ((struct qelem *) elem)->q_back;
+ if (next != NULL)
+ next->q_back = prev;
+ if (prev != NULL)
+ prev->q_forw = (struct qelem *) next;
+}
diff --git a/REORG.TODO/misc/ioctl.c b/REORG.TODO/misc/ioctl.c
new file mode 100644
index 0000000000..9b90102544
--- /dev/null
+++ b/REORG.TODO/misc/ioctl.c
@@ -0,0 +1,31 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/ioctl.h>
+
+/* Perform the I/O control operation specified by REQUEST on FD.
+ The actual type and use of ARG and the return value depend on REQUEST. */
+int
+__ioctl (int fd, unsigned long int request, ...)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (ioctl)
+
+weak_alias (__ioctl, ioctl)
diff --git a/REORG.TODO/misc/lgetxattr.c b/REORG.TODO/misc/lgetxattr.c
new file mode 100644
index 0000000000..91e92efa7e
--- /dev/null
+++ b/REORG.TODO/misc/lgetxattr.c
@@ -0,0 +1,29 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+lgetxattr (const char *__path, const char *__name,
+ void *__value, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (lgetxattr)
diff --git a/REORG.TODO/misc/libgen.h b/REORG.TODO/misc/libgen.h
new file mode 100644
index 0000000000..0a12a2ddf7
--- /dev/null
+++ b/REORG.TODO/misc/libgen.h
@@ -0,0 +1,39 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _LIBGEN_H
+#define _LIBGEN_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Return directory part of PATH or "." if none is available. */
+extern char *dirname (char *__path) __THROW;
+
+/* Return final component of PATH.
+
+ This is the weird XPG version of this function. It sometimes will
+ modify its argument. Therefore we normally use the GNU version (in
+ <string.h>) and only if this header is included make the XPG
+ version available under the real name. */
+extern char *__xpg_basename (char *__path) __THROW;
+#define basename __xpg_basename
+
+__END_DECLS
+
+#endif /* libgen.h */
diff --git a/REORG.TODO/misc/listxattr.c b/REORG.TODO/misc/listxattr.c
new file mode 100644
index 0000000000..88d5c80176
--- /dev/null
+++ b/REORG.TODO/misc/listxattr.c
@@ -0,0 +1,28 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+listxattr (const char *__path, char *__list, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (listxattr)
diff --git a/REORG.TODO/misc/llistxattr.c b/REORG.TODO/misc/llistxattr.c
new file mode 100644
index 0000000000..ed86f964cb
--- /dev/null
+++ b/REORG.TODO/misc/llistxattr.c
@@ -0,0 +1,28 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+llistxattr (const char *__path, char *__list, size_t __size)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (llistxattr)
diff --git a/REORG.TODO/misc/lremovexattr.c b/REORG.TODO/misc/lremovexattr.c
new file mode 100644
index 0000000000..53cdf3c152
--- /dev/null
+++ b/REORG.TODO/misc/lremovexattr.c
@@ -0,0 +1,28 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+lremovexattr (const char *__path, const char *__name)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (lremovexattr)
diff --git a/REORG.TODO/misc/lsearch.c b/REORG.TODO/misc/lsearch.c
new file mode 100644
index 0000000000..8eb3809ff8
--- /dev/null
+++ b/REORG.TODO/misc/lsearch.c
@@ -0,0 +1,58 @@
+/* Linear search functions.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <search.h>
+#include <string.h>
+
+
+void *
+lsearch (const void *key, void *base, size_t *nmemb, size_t size,
+ __compar_fn_t compar)
+{
+ void *result;
+
+ /* Try to find it. */
+ result = lfind (key, base, nmemb, size, compar);
+ if (result == NULL)
+ {
+ /* Not available. Insert at the end. */
+ result = memcpy (base + (*nmemb) * size, key, size);
+ ++(*nmemb);
+ }
+
+ return result;
+}
+
+
+void *
+lfind (const void *key, const void *base, size_t *nmemb, size_t size,
+ __compar_fn_t compar)
+{
+ const void *result = base;
+ size_t cnt = 0;
+
+ while (cnt < *nmemb && (*compar) (key, result) != 0)
+ {
+ result += size;
+ ++cnt;
+ }
+
+ return cnt < *nmemb ? (void *) result : NULL;
+}
+libc_hidden_def (lfind)
diff --git a/REORG.TODO/misc/lsetxattr.c b/REORG.TODO/misc/lsetxattr.c
new file mode 100644
index 0000000000..09e19cd086
--- /dev/null
+++ b/REORG.TODO/misc/lsetxattr.c
@@ -0,0 +1,29 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+lsetxattr (const char *__path, const char *__name,
+ const void *__value, size_t __size, int __flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (lsetxattr)
diff --git a/REORG.TODO/misc/lutimes.c b/REORG.TODO/misc/lutimes.c
new file mode 100644
index 0000000000..c4cce8f3b6
--- /dev/null
+++ b/REORG.TODO/misc/lutimes.c
@@ -0,0 +1,33 @@
+/* lutimes -- change access and modification times of a symlink. Stub version.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/time.h>
+#include <errno.h>
+#include <stddef.h>
+
+/* Change the access time of FILE to TVP[0] and
+ the modification time of FILE to TVP[1], but do not follow symlinks. */
+int
+__lutimes (const char *file, const struct timeval tvp[2])
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__lutimes, lutimes)
+
+stub_warning (lutimes)
diff --git a/REORG.TODO/misc/madvise.c b/REORG.TODO/misc/madvise.c
new file mode 100644
index 0000000000..3239561c97
--- /dev/null
+++ b/REORG.TODO/misc/madvise.c
@@ -0,0 +1,35 @@
+/* Advise system about intentions for a memory region. Stub version.
+ Copyright (C) 1994-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Advise the system about particular usage patterns the program follows
+ for the region starting at ADDR and extending LEN bytes. */
+
+int
+__madvise (void *addr, size_t len, int advice)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__madvise)
+weak_alias (__madvise, madvise)
+
+stub_warning (madvise)
diff --git a/REORG.TODO/misc/makedev.c b/REORG.TODO/misc/makedev.c
new file mode 100644
index 0000000000..90be690bd0
--- /dev/null
+++ b/REORG.TODO/misc/makedev.c
@@ -0,0 +1,30 @@
+/* Definitions of functions to access `dev_t' values.
+ Copyright (C) 2003-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <features.h>
+
+#undef __USE_EXTERN_INLINES
+#define __SYSMACROS_NEED_IMPLEMENTATION
+#include <sys/sysmacros.h>
+
+#define OUT_OF_LINE_IMPL_TEMPL(rtype, name, proto) \
+ rtype gnu_dev_##name proto
+
+__SYSMACROS_DEFINE_MAJOR(OUT_OF_LINE_IMPL_TEMPL)
+__SYSMACROS_DEFINE_MINOR(OUT_OF_LINE_IMPL_TEMPL)
+__SYSMACROS_DEFINE_MAKEDEV(OUT_OF_LINE_IMPL_TEMPL)
diff --git a/REORG.TODO/misc/mincore.c b/REORG.TODO/misc/mincore.c
new file mode 100644
index 0000000000..cb78a6a274
--- /dev/null
+++ b/REORG.TODO/misc/mincore.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2000-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/mman.h>
+#include <errno.h>
+
+int
+mincore (void *__start, size_t __len, unsigned char *__vec)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (mincore)
diff --git a/REORG.TODO/misc/mkdtemp.c b/REORG.TODO/misc/mkdtemp.c
new file mode 100644
index 0000000000..a55828e4c9
--- /dev/null
+++ b/REORG.TODO/misc/mkdtemp.c
@@ -0,0 +1,33 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Generate a unique temporary directory from TEMPLATE.
+ The last six characters of TEMPLATE must be "XXXXXX";
+ they are replaced with a string that makes the filename unique.
+ The directory is created, mode 700, and its name is returned.
+ (This function comes from OpenBSD.) */
+char *
+mkdtemp (char *template)
+{
+ if (__gen_tempname (template, 0, 0, __GT_DIR))
+ return NULL;
+ else
+ return template;
+}
diff --git a/REORG.TODO/misc/mkostemp.c b/REORG.TODO/misc/mkostemp.c
new file mode 100644
index 0000000000..00854a39c2
--- /dev/null
+++ b/REORG.TODO/misc/mkostemp.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1998-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef __GT_FILE
+# define __GT_FILE 0
+#endif
+
+/* Generate a unique temporary file name from TEMPLATE.
+ The last six characters of TEMPLATE must be "XXXXXX";
+ they are replaced with a string that makes the filename unique.
+ Then open the file and return a fd. */
+int
+mkostemp (char *template, int flags)
+{
+ return __gen_tempname (template, 0, flags, __GT_FILE);
+}
+
+#if !defined O_LARGEFILE || O_LARGEFILE == 0
+weak_alias (mkostemp, mkostemp64)
+#endif
diff --git a/REORG.TODO/misc/mkostemp64.c b/REORG.TODO/misc/mkostemp64.c
new file mode 100644
index 0000000000..2512e7f733
--- /dev/null
+++ b/REORG.TODO/misc/mkostemp64.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2000-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* If O_LARGEFILE is zero, mkostemp.c defines mkostemp64 as an alias. */
+#if defined O_LARGEFILE && O_LARGEFILE != 0
+
+/* Generate a unique temporary file name from TEMPLATE.
+ The last six characters of TEMPLATE must be "XXXXXX";
+ they are replaced with a string that makes the filename unique.
+ Then open the file and return a fd. */
+int
+mkostemp64 (char *template, int flags)
+{
+ return __gen_tempname (template, 0, flags | O_LARGEFILE, __GT_FILE);
+}
+
+#endif
diff --git a/REORG.TODO/misc/mkostemps.c b/REORG.TODO/misc/mkostemps.c
new file mode 100644
index 0000000000..49b9c859b7
--- /dev/null
+++ b/REORG.TODO/misc/mkostemps.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2009-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef __GT_FILE
+# define __GT_FILE 0
+#endif
+
+/* Generate a unique temporary file name from TEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+ "XXXXXX"; they are replaced with a string that makes the filename
+ unique. Then open the file and return a fd. */
+int
+mkostemps (char *template, int suffixlen, int flags)
+{
+ if (suffixlen < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __gen_tempname (template, suffixlen, flags, __GT_FILE);
+}
+
+#if !defined O_LARGEFILE || O_LARGEFILE == 0
+weak_alias (mkostemps, mkostemps64)
+#endif
diff --git a/REORG.TODO/misc/mkostemps64.c b/REORG.TODO/misc/mkostemps64.c
new file mode 100644
index 0000000000..dff8500089
--- /dev/null
+++ b/REORG.TODO/misc/mkostemps64.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2000-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* If O_LARGEFILE is zero, mkostemps.c defines mkostemps64 as an alias. */
+#if defined O_LARGEFILE && O_LARGEFILE != 0
+
+/* Generate a unique temporary file name from TEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+ "XXXXXX"; they are replaced with a string that makes the filename
+ unique. Then open the file and return a fd. */
+int
+mkostemps64 (char *template, int suffixlen, int flags)
+{
+ if (suffixlen < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __gen_tempname (template, suffixlen, flags | O_LARGEFILE, __GT_FILE);
+}
+
+#endif
diff --git a/REORG.TODO/misc/mkstemp.c b/REORG.TODO/misc/mkstemp.c
new file mode 100644
index 0000000000..c63cf119db
--- /dev/null
+++ b/REORG.TODO/misc/mkstemp.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1998-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef __GT_FILE
+# define __GT_FILE 0
+#endif
+
+/* Generate a unique temporary file name from TEMPLATE.
+ The last six characters of TEMPLATE must be "XXXXXX";
+ they are replaced with a string that makes the filename unique.
+ Then open the file and return a fd. */
+int
+mkstemp (char *template)
+{
+ return __gen_tempname (template, 0, 0, __GT_FILE);
+}
+
+#if !defined O_LARGEFILE || O_LARGEFILE == 0
+weak_alias (mkstemp, mkstemp64)
+#endif
diff --git a/REORG.TODO/misc/mkstemp64.c b/REORG.TODO/misc/mkstemp64.c
new file mode 100644
index 0000000000..e1e8d02045
--- /dev/null
+++ b/REORG.TODO/misc/mkstemp64.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2000-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* If O_LARGEFILE is zero, mkstemp.c defines mkstemp64 as an alias. */
+#if defined O_LARGEFILE && O_LARGEFILE != 0
+
+/* Generate a unique temporary file name from TEMPLATE.
+ The last six characters of TEMPLATE must be "XXXXXX";
+ they are replaced with a string that makes the filename unique.
+ Then open the file and return a fd. */
+int
+mkstemp64 (char *template)
+{
+ return __gen_tempname (template, 0, O_LARGEFILE, __GT_FILE);
+}
+
+#endif
diff --git a/REORG.TODO/misc/mkstemps.c b/REORG.TODO/misc/mkstemps.c
new file mode 100644
index 0000000000..41e58ed3e8
--- /dev/null
+++ b/REORG.TODO/misc/mkstemps.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2009-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef __GT_FILE
+# define __GT_FILE 0
+#endif
+
+/* Generate a unique temporary file name from TEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+ "XXXXXX"; they are replaced with a string that makes the filename
+ unique. Then open the file and return a fd. */
+int
+mkstemps (char *template, int suffixlen)
+{
+ if (suffixlen < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __gen_tempname (template, suffixlen, 0, __GT_FILE);
+}
+
+#if !defined O_LARGEFILE || O_LARGEFILE == 0
+weak_alias (mkstemps, mkstemps64)
+#endif
diff --git a/REORG.TODO/misc/mkstemps64.c b/REORG.TODO/misc/mkstemps64.c
new file mode 100644
index 0000000000..18be96f363
--- /dev/null
+++ b/REORG.TODO/misc/mkstemps64.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2000-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* If O_LARGEFILE is zero, mkstemps.c defines mkstemps64 as an alias. */
+#if defined O_LARGEFILE && O_LARGEFILE != 0
+
+/* Generate a unique temporary file name from TEMPLATE. The last six
+ characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+ "XXXXXX"; they are replaced with a string that makes the filename
+ unique. Then open the file and return a fd. */
+int
+mkstemps64 (char *template, int suffixlen)
+{
+ if (suffixlen < 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __gen_tempname (template, suffixlen, O_LARGEFILE, __GT_FILE);
+}
+
+#endif
diff --git a/REORG.TODO/misc/mktemp.c b/REORG.TODO/misc/mktemp.c
new file mode 100644
index 0000000000..fee0e7b227
--- /dev/null
+++ b/REORG.TODO/misc/mktemp.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1998-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Generate a unique temporary file name from TEMPLATE.
+ The last six characters of TEMPLATE must be "XXXXXX";
+ they are replaced with a string that makes the filename unique. */
+char *
+__mktemp (char *template)
+{
+ if (__gen_tempname (template, 0, 0, __GT_NOCREATE) < 0)
+ /* We return the null string if we can't find a unique file name. */
+ template[0] = '\0';
+
+ return template;
+}
+weak_alias (__mktemp, mktemp)
+
+link_warning (mktemp, "the use of `mktemp' is dangerous, "
+ "better use `mkstemp' or `mkdtemp'")
diff --git a/REORG.TODO/misc/mlock.c b/REORG.TODO/misc/mlock.c
new file mode 100644
index 0000000000..364decec22
--- /dev/null
+++ b/REORG.TODO/misc/mlock.c
@@ -0,0 +1,33 @@
+/* mlock -- guarantee pages are resident in memory. Stub version.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
+ be memory resident. */
+
+int
+mlock (const void *addr, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (mlock)
diff --git a/REORG.TODO/misc/mlockall.c b/REORG.TODO/misc/mlockall.c
new file mode 100644
index 0000000000..8375d8e8ca
--- /dev/null
+++ b/REORG.TODO/misc/mlockall.c
@@ -0,0 +1,34 @@
+/* mlockall -- lock in core all the pages in this process. Stub version.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Cause all currently mapped pages of the process to be memory resident
+ until unlocked by a call to the `munlockall', until the process exits,
+ or until the process calls `execve'. */
+
+int
+mlockall (int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (mlockall)
diff --git a/REORG.TODO/misc/mmap.c b/REORG.TODO/misc/mmap.c
new file mode 100644
index 0000000000..576d66a1e8
--- /dev/null
+++ b/REORG.TODO/misc/mmap.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1994-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Map addresses starting near ADDR and extending for LEN bytes. From
+ OFFSET into the file FD describes according to PROT and FLAGS. If ADDR
+ is nonzero, it is the desired mapping address. If the MAP_FIXED bit is
+ set in FLAGS, the mapping will be at ADDR exactly (which must be
+ page-aligned); otherwise the system chooses a convenient nearby address.
+ The return value is the actual mapping address chosen or MAP_FAILED
+ for errors (in which case `errno' is set). A successful `mmap' call
+ deallocates any previous mapping for the affected region. */
+
+__ptr_t
+__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
+{
+ __set_errno (ENOSYS);
+ return MAP_FAILED;
+}
+
+stub_warning (mmap)
+weak_alias (__mmap, mmap)
diff --git a/REORG.TODO/misc/mmap64.c b/REORG.TODO/misc/mmap64.c
new file mode 100644
index 0000000000..6b1ac41c84
--- /dev/null
+++ b/REORG.TODO/misc/mmap64.c
@@ -0,0 +1,47 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+
+/* Map addresses starting near ADDR and extending for LEN bytes. From
+ OFFSET into the file FD describes according to PROT and FLAGS. If ADDR
+ is nonzero, it is the desired mapping address. If the MAP_FIXED bit is
+ set in FLAGS, the mapping will be at ADDR exactly (which must be
+ page-aligned); otherwise the system chooses a convenient nearby address.
+ The return value is the actual mapping address chosen or MAP_FAILED
+ for errors (in which case `errno' is set). A successful `mmap' call
+ deallocates any previous mapping for the affected region. */
+
+__ptr_t
+__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd,
+ __off64_t offset)
+{
+ off_t small_offset = (off_t) offset;
+
+ if (small_offset != offset)
+ {
+ /* We cannot do this since the offset is too large. */
+ __set_errno (EOVERFLOW);
+ return MAP_FAILED;
+ }
+
+ return __mmap (addr, len, prot, flags, fd, small_offset);
+}
+
+weak_alias (__mmap64, mmap64)
diff --git a/REORG.TODO/misc/mntent.c b/REORG.TODO/misc/mntent.c
new file mode 100644
index 0000000000..ae7ee26d1a
--- /dev/null
+++ b/REORG.TODO/misc/mntent.c
@@ -0,0 +1,53 @@
+/* Utilities for reading/writing fstab, mtab, etc.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <mntent.h>
+#include <stdlib.h>
+#include <libc-lock.h>
+
+/* We don't want to allocate the static buffer all the time since it
+ is not always used (in fact, rather infrequently). Accept the
+ extra cost of a `malloc'. */
+libc_freeres_ptr (static char *getmntent_buffer);
+
+/* This is the size of the buffer. This is really big. */
+#define BUFFER_SIZE 4096
+
+
+static void
+allocate (void)
+{
+ getmntent_buffer = (char *) malloc (BUFFER_SIZE);
+}
+
+
+struct mntent *
+getmntent (FILE *stream)
+{
+ static struct mntent m;
+ __libc_once_define (static, once);
+ __libc_once (once, allocate);
+
+ if (getmntent_buffer == NULL)
+ /* If no core is available we don't have a chance to run the
+ program successfully and so returning NULL is an acceptable
+ result. */
+ return NULL;
+
+ return __getmntent_r (stream, &m, getmntent_buffer, BUFFER_SIZE);
+}
diff --git a/REORG.TODO/misc/mntent.h b/REORG.TODO/misc/mntent.h
new file mode 100644
index 0000000000..e54e165637
--- /dev/null
+++ b/REORG.TODO/misc/mntent.h
@@ -0,0 +1,95 @@
+/* Utilities for reading/writing fstab, mtab, etc.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _MNTENT_H
+#define _MNTENT_H 1
+
+#include <features.h>
+#include <paths.h>
+#include <bits/types/FILE.h>
+
+/* File listing canonical interesting mount points. */
+#define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
+
+/* File listing currently active mount points. */
+#define MOUNTED _PATH_MOUNTED /* Deprecated alias. */
+
+
+/* General filesystem types. */
+#define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */
+#define MNTTYPE_NFS "nfs" /* Network file system. */
+#define MNTTYPE_SWAP "swap" /* Swap device. */
+
+
+/* Generic mount options. */
+#define MNTOPT_DEFAULTS "defaults" /* Use all default options. */
+#define MNTOPT_RO "ro" /* Read only. */
+#define MNTOPT_RW "rw" /* Read/write. */
+#define MNTOPT_SUID "suid" /* Set uid allowed. */
+#define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */
+#define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */
+
+
+__BEGIN_DECLS
+
+/* Structure describing a mount table entry. */
+struct mntent
+ {
+ char *mnt_fsname; /* Device or server for filesystem. */
+ char *mnt_dir; /* Directory mounted on. */
+ char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */
+ char *mnt_opts; /* Comma-separated options for fs. */
+ int mnt_freq; /* Dump frequency (in days). */
+ int mnt_passno; /* Pass number for `fsck'. */
+ };
+
+
+/* Prepare to begin reading and/or writing mount table entries from the
+ beginning of FILE. MODE is as for `fopen'. */
+extern FILE *setmntent (const char *__file, const char *__mode) __THROW;
+
+/* Read one mount table entry from STREAM. Returns a pointer to storage
+ reused on the next call, or null for EOF or error (use feof/ferror to
+ check). */
+extern struct mntent *getmntent (FILE *__stream) __THROW;
+
+#ifdef __USE_MISC
+/* Reentrant version of the above function. */
+extern struct mntent *getmntent_r (FILE *__restrict __stream,
+ struct mntent *__restrict __result,
+ char *__restrict __buffer,
+ int __bufsize) __THROW;
+#endif
+
+/* Write the mount table entry described by MNT to STREAM.
+ Return zero on success, nonzero on failure. */
+extern int addmntent (FILE *__restrict __stream,
+ const struct mntent *__restrict __mnt) __THROW;
+
+/* Close a stream opened with `setmntent'. */
+extern int endmntent (FILE *__stream) __THROW;
+
+/* Search MNT->mnt_opts for an option matching OPT.
+ Returns the address of the substring, or null if none found. */
+extern char *hasmntopt (const struct mntent *__mnt,
+ const char *__opt) __THROW;
+
+
+__END_DECLS
+
+#endif /* mntent.h */
diff --git a/REORG.TODO/misc/mntent_r.c b/REORG.TODO/misc/mntent_r.c
new file mode 100644
index 0000000000..30f55212be
--- /dev/null
+++ b/REORG.TODO/misc/mntent_r.c
@@ -0,0 +1,296 @@
+/* Utilities for reading/writing fstab, mtab, etc.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <alloca.h>
+#include <mntent.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <string.h>
+#include <sys/types.h>
+
+#define flockfile(s) _IO_flockfile (s)
+#define funlockfile(s) _IO_funlockfile (s)
+
+#undef __setmntent
+#undef __endmntent
+#undef __getmntent_r
+
+/* Prepare to begin reading and/or writing mount table entries from the
+ beginning of FILE. MODE is as for `fopen'. */
+FILE *
+__setmntent (const char *file, const char *mode)
+{
+ /* Extend the mode parameter with "c" to disable cancellation in the
+ I/O functions and "e" to set FD_CLOEXEC. */
+ size_t modelen = strlen (mode);
+ char newmode[modelen + 3];
+ memcpy (mempcpy (newmode, mode, modelen), "ce", 3);
+ FILE *result = fopen (file, newmode);
+
+ if (result != NULL)
+ /* We do the locking ourselves. */
+ __fsetlocking (result, FSETLOCKING_BYCALLER);
+
+ return result;
+}
+libc_hidden_def (__setmntent)
+weak_alias (__setmntent, setmntent)
+
+
+/* Close a stream opened with `setmntent'. */
+int
+__endmntent (FILE *stream)
+{
+ if (stream) /* SunOS 4.x allows for NULL stream */
+ fclose (stream);
+ return 1; /* SunOS 4.x says to always return 1 */
+}
+libc_hidden_def (__endmntent)
+weak_alias (__endmntent, endmntent)
+
+
+/* Since the values in a line are separated by spaces, a name cannot
+ contain a space. Therefore some programs encode spaces in names
+ by the strings "\040". We undo the encoding when reading an entry.
+ The decoding happens in place. */
+static char *
+decode_name (char *buf)
+{
+ char *rp = buf;
+ char *wp = buf;
+
+ do
+ if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '4' && rp[3] == '0')
+ {
+ /* \040 is a SPACE. */
+ *wp++ = ' ';
+ rp += 3;
+ }
+ else if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '1' && rp[3] == '1')
+ {
+ /* \011 is a TAB. */
+ *wp++ = '\t';
+ rp += 3;
+ }
+ else if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '1' && rp[3] == '2')
+ {
+ /* \012 is a NEWLINE. */
+ *wp++ = '\n';
+ rp += 3;
+ }
+ else if (rp[0] == '\\' && rp[1] == '\\')
+ {
+ /* We have to escape \\ to be able to represent all characters. */
+ *wp++ = '\\';
+ rp += 1;
+ }
+ else if (rp[0] == '\\' && rp[1] == '1' && rp[2] == '3' && rp[3] == '4')
+ {
+ /* \134 is also \\. */
+ *wp++ = '\\';
+ rp += 3;
+ }
+ else
+ *wp++ = *rp;
+ while (*rp++ != '\0');
+
+ return buf;
+}
+
+
+/* Read one mount table entry from STREAM. Returns a pointer to storage
+ reused on the next call, or null for EOF or error (use feof/ferror to
+ check). */
+struct mntent *
+__getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
+{
+ char *cp;
+ char *head;
+
+ flockfile (stream);
+ do
+ {
+ char *end_ptr;
+
+ if (__fgets_unlocked (buffer, bufsiz, stream) == NULL)
+ {
+ funlockfile (stream);
+ return NULL;
+ }
+
+ end_ptr = strchr (buffer, '\n');
+ if (end_ptr != NULL) /* chop newline */
+ {
+ /* Do not walk past the start of buffer if it's all whitespace. */
+ while (end_ptr != buffer
+ && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
+ end_ptr--;
+ *end_ptr = '\0';
+ }
+ else
+ {
+ /* Not the whole line was read. Do it now but forget it. */
+ char tmp[1024];
+ while (__fgets_unlocked (tmp, sizeof tmp, stream) != NULL)
+ if (strchr (tmp, '\n') != NULL)
+ break;
+ }
+
+ head = buffer + strspn (buffer, " \t");
+ /* skip empty lines and comment lines: */
+ }
+ while (head[0] == '\0' || head[0] == '#');
+
+ cp = __strsep (&head, " \t");
+ mp->mnt_fsname = cp != NULL ? decode_name (cp) : (char *) "";
+ if (head)
+ head += strspn (head, " \t");
+ cp = __strsep (&head, " \t");
+ mp->mnt_dir = cp != NULL ? decode_name (cp) : (char *) "";
+ if (head)
+ head += strspn (head, " \t");
+ cp = __strsep (&head, " \t");
+ mp->mnt_type = cp != NULL ? decode_name (cp) : (char *) "";
+ if (head)
+ head += strspn (head, " \t");
+ cp = __strsep (&head, " \t");
+ mp->mnt_opts = cp != NULL ? decode_name (cp) : (char *) "";
+ switch (head ? sscanf (head, " %d %d ", &mp->mnt_freq, &mp->mnt_passno) : 0)
+ {
+ case 0:
+ mp->mnt_freq = 0;
+ case 1:
+ mp->mnt_passno = 0;
+ case 2:
+ break;
+ }
+ funlockfile (stream);
+
+ return mp;
+}
+libc_hidden_def (__getmntent_r)
+weak_alias (__getmntent_r, getmntent_r)
+
+
+/* We have to use an encoding for names if they contain spaces or tabs.
+ To be able to represent all characters we also have to escape the
+ backslash itself. This "function" must be a macro since we use
+ `alloca'. */
+#define encode_name(name) \
+ do { \
+ const char *rp = name; \
+ \
+ while (*rp != '\0') \
+ if (*rp == ' ' || *rp == '\t' || *rp == '\n' || *rp == '\\') \
+ break; \
+ else \
+ ++rp; \
+ \
+ if (*rp != '\0') \
+ { \
+ /* In the worst case the length of the string can increase to \
+ four times the current length. */ \
+ char *wp; \
+ \
+ rp = name; \
+ name = wp = (char *) alloca (strlen (name) * 4 + 1); \
+ \
+ do \
+ if (*rp == ' ') \
+ { \
+ *wp++ = '\\'; \
+ *wp++ = '0'; \
+ *wp++ = '4'; \
+ *wp++ = '0'; \
+ } \
+ else if (*rp == '\t') \
+ { \
+ *wp++ = '\\'; \
+ *wp++ = '0'; \
+ *wp++ = '1'; \
+ *wp++ = '1'; \
+ } \
+ else if (*rp == '\n') \
+ { \
+ *wp++ = '\\'; \
+ *wp++ = '0'; \
+ *wp++ = '1'; \
+ *wp++ = '2'; \
+ } \
+ else if (*rp == '\\') \
+ { \
+ *wp++ = '\\'; \
+ *wp++ = '\\'; \
+ } \
+ else \
+ *wp++ = *rp; \
+ while (*rp++ != '\0'); \
+ } \
+ } while (0)
+
+
+/* Write the mount table entry described by MNT to STREAM.
+ Return zero on success, nonzero on failure. */
+int
+__addmntent (FILE *stream, const struct mntent *mnt)
+{
+ struct mntent mntcopy = *mnt;
+ if (fseek (stream, 0, SEEK_END))
+ return 1;
+
+ /* Encode spaces and tabs in the names. */
+ encode_name (mntcopy.mnt_fsname);
+ encode_name (mntcopy.mnt_dir);
+ encode_name (mntcopy.mnt_type);
+ encode_name (mntcopy.mnt_opts);
+
+ return (fprintf (stream, "%s %s %s %s %d %d\n",
+ mntcopy.mnt_fsname,
+ mntcopy.mnt_dir,
+ mntcopy.mnt_type,
+ mntcopy.mnt_opts,
+ mntcopy.mnt_freq,
+ mntcopy.mnt_passno) < 0
+ || fflush (stream) != 0);
+}
+weak_alias (__addmntent, addmntent)
+
+
+/* Search MNT->mnt_opts for an option matching OPT.
+ Returns the address of the substring, or null if none found. */
+char *
+__hasmntopt (const struct mntent *mnt, const char *opt)
+{
+ const size_t optlen = strlen (opt);
+ char *rest = mnt->mnt_opts, *p;
+
+ while ((p = strstr (rest, opt)) != NULL)
+ {
+ if ((p == rest || p[-1] == ',')
+ && (p[optlen] == '\0' || p[optlen] == '=' || p[optlen] == ','))
+ return p;
+
+ rest = strchr (p, ',');
+ if (rest == NULL)
+ break;
+ ++rest;
+ }
+
+ return NULL;
+}
+weak_alias (__hasmntopt, hasmntopt)
diff --git a/REORG.TODO/misc/mprotect.c b/REORG.TODO/misc/mprotect.c
new file mode 100644
index 0000000000..271106426c
--- /dev/null
+++ b/REORG.TODO/misc/mprotect.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1994-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Change the memory protection of the region starting at ADDR and
+ extending LEN bytes to PROT. Returns 0 if successful, -1 for errors
+ (and sets errno). */
+
+int
+__mprotect (__ptr_t addr, size_t len, int prot)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__mprotect, mprotect)
+
+stub_warning (mprotect)
diff --git a/REORG.TODO/misc/msync.c b/REORG.TODO/misc/msync.c
new file mode 100644
index 0000000000..361185e83d
--- /dev/null
+++ b/REORG.TODO/misc/msync.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1994-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Synchronize the region starting at ADDR and extending LEN bytes with the
+ file it maps. Filesystem operations on a file being mapped are
+ unpredictable before this is done. */
+
+int
+msync (__ptr_t addr, size_t len, int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (msync)
diff --git a/REORG.TODO/misc/munlock.c b/REORG.TODO/misc/munlock.c
new file mode 100644
index 0000000000..89e9b96814
--- /dev/null
+++ b/REORG.TODO/misc/munlock.c
@@ -0,0 +1,32 @@
+/* munlock -- undo the effects of prior mlock calls. Stub version.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Undo the effects on these whole pages of any prior mlock calls. */
+
+int
+munlock (const void *addr, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (munlock)
diff --git a/REORG.TODO/misc/munlockall.c b/REORG.TODO/misc/munlockall.c
new file mode 100644
index 0000000000..fa787203f5
--- /dev/null
+++ b/REORG.TODO/misc/munlockall.c
@@ -0,0 +1,32 @@
+/* munlockall -- undo the effects of all prior mlock calls. Stub version.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Undo the effects of all prior mlock calls in this process. */
+
+int
+munlockall (void)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (munlockall)
diff --git a/REORG.TODO/misc/munmap.c b/REORG.TODO/misc/munmap.c
new file mode 100644
index 0000000000..b3ba789d3b
--- /dev/null
+++ b/REORG.TODO/misc/munmap.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1994-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Deallocate any mapping for the region starting at ADDR and extending LEN
+ bytes. Returns 0 if successful, -1 for errors (and sets errno). */
+
+int
+__munmap (__ptr_t addr, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (munmap)
+weak_alias (__munmap, munmap)
diff --git a/REORG.TODO/misc/preadv.c b/REORG.TODO/misc/preadv.c
new file mode 100644
index 0000000000..cf45f9c3d0
--- /dev/null
+++ b/REORG.TODO/misc/preadv.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2009-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Read data from file descriptor FD at the given position OFFSET
+ without change the file pointer, and put the result in the buffers
+ described by VECTOR, which is a vector of COUNT 'struct iovec's.
+ The buffers are filled in the order specified. Operates just like
+ 'pread' (see <unistd.h>) except that data are put in VECTOR instead
+ of a contiguous buffer. */
+ssize_t
+preadv (int fd, const struct iovec *vector, int count, off_t offset)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (preadv)
diff --git a/REORG.TODO/misc/preadv2.c b/REORG.TODO/misc/preadv2.c
new file mode 100644
index 0000000000..a62dcaa699
--- /dev/null
+++ b/REORG.TODO/misc/preadv2.c
@@ -0,0 +1,30 @@
+/* Default implementation of preadv2.
+ Copyright (C) 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+
+/* Same as preadv but with an additional flags argument. */
+ssize_t
+preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (preadv2)
diff --git a/REORG.TODO/misc/preadv64.c b/REORG.TODO/misc/preadv64.c
new file mode 100644
index 0000000000..ce048bea90
--- /dev/null
+++ b/REORG.TODO/misc/preadv64.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2009-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Read data from file descriptor FD at the given position OFFSET
+ without change the file pointer, and put the result in the buffers
+ described by VECTOR, which is a vector of COUNT 'struct iovec's.
+ The buffers are filled in the order specified. Operates just like
+ 'pread' (see <unistd.h>) except that data are put in VECTOR instead
+ of a contiguous buffer. */
+ssize_t
+preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (preadv64)
diff --git a/REORG.TODO/misc/preadv64v2.c b/REORG.TODO/misc/preadv64v2.c
new file mode 100644
index 0000000000..a802c2f1ab
--- /dev/null
+++ b/REORG.TODO/misc/preadv64v2.c
@@ -0,0 +1,30 @@
+/* Default implementation of preadv2 (LFS version).
+ Copyright (C) 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+
+/* Same as preadv64 but with an addional flag argument. */
+ssize_t
+preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (preadv64v2)
diff --git a/REORG.TODO/misc/pselect.c b/REORG.TODO/misc/pselect.c
new file mode 100644
index 0000000000..2292219d3d
--- /dev/null
+++ b/REORG.TODO/misc/pselect.c
@@ -0,0 +1,78 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <signal.h>
+#include <stddef.h> /* For NULL. */
+#include <sys/time.h>
+#include <sys/select.h>
+#include <sysdep-cancel.h>
+
+
+/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
+ readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
+ (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
+ after waiting the interval specified therein. Additionally set the sigmask
+ SIGMASK for this call. Returns the number of ready descriptors, or -1 for
+ errors. */
+int
+__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ const struct timespec *timeout, const sigset_t *sigmask)
+{
+ struct timeval tval;
+ int retval;
+ sigset_t savemask;
+
+ /* Change nanosecond number to microseconds. This might mean losing
+ precision and therefore the `pselect` should be available. But
+ for now it is hardly found. */
+ if (timeout != NULL)
+ {
+ /* Catch bugs which would be hidden by the TIMESPEC_TO_TIMEVAL
+ computations. The division by 1000 truncates values. */
+ if (__glibc_unlikely (timeout->tv_nsec < 0))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ TIMESPEC_TO_TIMEVAL (&tval, timeout);
+ }
+
+ /* The setting and restoring of the signal mask and the select call
+ should be an atomic operation. This can't be done without kernel
+ help. */
+ if (sigmask != NULL)
+ __sigprocmask (SIG_SETMASK, sigmask, &savemask);
+
+ /* Note the pselect() is a cancellation point. But since we call
+ select() which itself is a cancellation point we do not have
+ to do anything here. */
+ retval = __select (nfds, readfds, writefds, exceptfds,
+ timeout != NULL ? &tval : NULL);
+
+ if (sigmask != NULL)
+ __sigprocmask (SIG_SETMASK, &savemask, NULL);
+
+ return retval;
+}
+#ifndef __pselect
+weak_alias (__pselect, pselect)
+/* __select handles cancellation. */
+LIBC_CANCEL_HANDLED ();
+#endif
diff --git a/REORG.TODO/misc/ptrace.c b/REORG.TODO/misc/ptrace.c
new file mode 100644
index 0000000000..aace1b5a34
--- /dev/null
+++ b/REORG.TODO/misc/ptrace.c
@@ -0,0 +1,108 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/ptrace.h>
+#include <sys/types.h>
+#include <stdarg.h>
+
+/* Perform process tracing functions. REQUEST is one of the values
+ in <sys/ptrace.h>, and determines the action to be taken.
+ For all requests except PTRACE_TRACEME, PID specifies the process to be
+ traced.
+
+ PID and the other arguments described above for the various requests should
+ appear (those that are used for the particular request) as:
+ pid_t PID, void *ADDR, int DATA, void *ADDR2
+ after PID. */
+int
+ptrace (enum __ptrace_request request, ...)
+{
+ pid_t pid;
+ void *addr;
+ void *addr2;
+ int data;
+ va_list ap;
+
+ switch (request)
+ {
+ case PTRACE_TRACEME:
+ case PTRACE_CONT:
+ case PTRACE_KILL:
+ case PTRACE_SINGLESTEP:
+ case PTRACE_ATTACH:
+ case PTRACE_DETACH:
+ break;
+
+ case PTRACE_PEEKTEXT:
+ case PTRACE_PEEKDATA:
+ case PTRACE_PEEKUSER:
+ case PTRACE_GETREGS:
+ case PTRACE_SETREGS:
+#ifdef PTRACE_GETFPREGS
+ case PTRACE_GETFPGEGS:
+#endif
+ case PTRACE_SETFPREGS:
+ case PTRACE_GETFPAREGS:
+ case PTRACE_SETFPAREGS:
+ va_start (ap, request);
+ pid = va_arg (ap, pid_t);
+ addr = va_arg (ap, void *);
+ va_end (ap);
+ ignore_value (pid);
+ ignore_value (addr);
+ break;
+
+ case PTRACE_POKETEXT:
+ case PTRACE_POKEDATA:
+ case PTRACE_POKEUSER:
+ va_start (ap, request);
+ pid = va_arg (ap, pid_t);
+ addr = va_arg (ap, void *);
+ data = va_arg (ap, int);
+ va_end (ap);
+ ignore_value (pid);
+ ignore_value (addr);
+ ignore_value (data);
+ break;
+
+ case PTRACE_READDATA:
+ case PTRACE_WRITEDATA:
+ case PTRACE_READTEXT:
+ case PTRACE_WRITETEXT:
+ va_start (ap, request);
+ pid = va_arg (ap, pid_t);
+ addr = va_arg (ap, void *);
+ data = va_arg (ap, int);
+ addr2 = va_arg (ap, void *);
+ va_end (ap);
+ ignore_value (pid);
+ ignore_value (addr);
+ ignore_value (data);
+ ignore_value (addr2);
+ break;
+
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (ptrace)
diff --git a/REORG.TODO/misc/pwritev.c b/REORG.TODO/misc/pwritev.c
new file mode 100644
index 0000000000..f825ae4208
--- /dev/null
+++ b/REORG.TODO/misc/pwritev.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2009-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Write data pointed by the buffers described by VECTOR, which is a
+ vector of COUNT 'struct iovec's, to file descriptor FD at the given
+ position OFFSET without change the file pointer. The data is
+ written in the order specified. Operates just like 'pwrite' (see
+ <unistd.h>) except that the data are taken from VECTOR instead of a
+ contiguous buffer. */
+ssize_t
+pwritev (int fd, const struct iovec *vector, int count, off_t offset)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (pwritev)
diff --git a/REORG.TODO/misc/pwritev2.c b/REORG.TODO/misc/pwritev2.c
new file mode 100644
index 0000000000..b9e07272da
--- /dev/null
+++ b/REORG.TODO/misc/pwritev2.c
@@ -0,0 +1,30 @@
+/* Default implementation of pwritev2.
+ Copyright (C) 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+
+/* Same as pwritev but with an additional flags argument. */
+ssize_t
+pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (pwritev2)
diff --git a/REORG.TODO/misc/pwritev64.c b/REORG.TODO/misc/pwritev64.c
new file mode 100644
index 0000000000..380d4d32aa
--- /dev/null
+++ b/REORG.TODO/misc/pwritev64.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2009-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Write data pointed by the buffers described by VECTOR, which is a
+ vector of COUNT 'struct iovec's, to file descriptor FD at the given
+ position OFFSET without change the file pointer. The data is
+ written in the order specified. Operates just like 'pwrite' (see
+ <unistd.h>) except that the data are taken from VECTOR instead of a
+ contiguous buffer. */
+ssize_t
+pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (pwritev64)
diff --git a/REORG.TODO/misc/pwritev64v2.c b/REORG.TODO/misc/pwritev64v2.c
new file mode 100644
index 0000000000..1f874f054c
--- /dev/null
+++ b/REORG.TODO/misc/pwritev64v2.c
@@ -0,0 +1,30 @@
+/* Default implementation of pwritev2 (LFS version).
+ Copyright (C) 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+
+/* Same as preadv64 but with an addional flag argument. */
+ssize_t
+pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (pwritev64v2)
diff --git a/REORG.TODO/misc/qefgcvt.c b/REORG.TODO/misc/qefgcvt.c
new file mode 100644
index 0000000000..d003bb905b
--- /dev/null
+++ b/REORG.TODO/misc/qefgcvt.c
@@ -0,0 +1,46 @@
+/* Compatibility functions for floating point formatting, long double version.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <float.h>
+
+#define FLOAT_TYPE long double
+#define FUNC_PREFIX q
+#define FLOAT_FMT_FLAG "L"
+/* Actually we have to write (LDBL_DIG + log10 (LDBL_MAX_10_EXP)) but
+ we don't have log10 available in the preprocessor. Since we cannot
+ assume anything on the used `long double' format be generous. */
+#define MAXDIG (NDIGIT_MAX + 12)
+#define FCVT_MAXDIG (LDBL_MAX_10_EXP + MAXDIG)
+#if LDBL_MANT_DIG == 64
+# define NDIGIT_MAX 21
+#elif LDBL_MANT_DIG == 53
+# define NDIGIT_MAX 17
+#elif LDBL_MANT_DIG == 113
+# define NDIGIT_MAX 36
+#elif LDBL_MANT_DIG == 106
+# define NDIGIT_MAX 34
+#elif LDBL_MANT_DIG == 56
+# define NDIGIT_MAX 18
+#else
+/* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
+ compile time constant here, so we cannot use it. */
+# error "NDIGIT_MAX must be precomputed"
+# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
+#endif
+
+#include "efgcvt.c"
diff --git a/REORG.TODO/misc/qefgcvt_r.c b/REORG.TODO/misc/qefgcvt_r.c
new file mode 100644
index 0000000000..7725274916
--- /dev/null
+++ b/REORG.TODO/misc/qefgcvt_r.c
@@ -0,0 +1,57 @@
+/* Compatibility functions for floating point formatting, reentrant,
+ long double versions.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <float.h>
+
+#define FLOAT_TYPE long double
+#define FUNC_PREFIX q
+#define FLOAT_FMT_FLAG "L"
+#define FLOAT_NAME_EXT l
+#define FLOAT_MIN_10_EXP LDBL_MIN_10_EXP
+#if LDBL_MANT_DIG == 64
+# define NDIGIT_MAX 21
+#elif LDBL_MANT_DIG == 53
+# define NDIGIT_MAX 17
+#elif LDBL_MANT_DIG == 113
+# define NDIGIT_MAX 36
+#elif LDBL_MANT_DIG == 106
+# define NDIGIT_MAX 34
+#elif LDBL_MANT_DIG == 56
+# define NDIGIT_MAX 18
+#else
+/* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
+ compile time constant here, so we cannot use it. */
+# error "NDIGIT_MAX must be precomputed"
+# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
+#endif
+#if LDBL_MIN_10_EXP == -37
+# define FLOAT_MIN_10_NORM 1.0e-37L
+#elif LDBL_MIN_10_EXP == -291
+# define FLOAT_MIN_10_NORM 1.0e-291L
+#elif LDBL_MIN_10_EXP == -307
+# define FLOAT_MIN_10_NORM 1.0e-307L
+#elif LDBL_MIN_10_EXP == -4931
+# define FLOAT_MIN_10_NORM 1.0e-4931L
+#else
+/* libc can't depend on libm. */
+# error "FLOAT_MIN_10_NORM must be precomputed"
+# define FLOAT_MIN_10_NORM exp10l (LDBL_MIN_10_EXP)
+#endif
+
+#include "efgcvt_r.c"
diff --git a/REORG.TODO/misc/readv.c b/REORG.TODO/misc/readv.c
new file mode 100644
index 0000000000..064f88523c
--- /dev/null
+++ b/REORG.TODO/misc/readv.c
@@ -0,0 +1,35 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Read data from file descriptor FD, and put the result in the
+ buffers described by VECTOR, which is a vector of COUNT `struct iovec's.
+ The buffers are filled in the order specified.
+ Operates just like `read' (see <unistd.h>) except that data are
+ put in VECTOR instead of a contiguous buffer. */
+ssize_t
+__readv (int fd, const struct iovec *vector, int count)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__readv, readv)
+
+stub_warning (readv)
diff --git a/REORG.TODO/misc/reboot.c b/REORG.TODO/misc/reboot.c
new file mode 100644
index 0000000000..70549c41b7
--- /dev/null
+++ b/REORG.TODO/misc/reboot.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1992-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/reboot.h>
+#include <libc-diag.h>
+
+/* Reboot the system. */
+int
+reboot (int howto)
+{
+ ignore_value (howto);
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (reboot)
diff --git a/REORG.TODO/misc/regexp.c b/REORG.TODO/misc/regexp.c
new file mode 100644
index 0000000000..19d76c0c37
--- /dev/null
+++ b/REORG.TODO/misc/regexp.c
@@ -0,0 +1,92 @@
+/* Compatibility symbols for the obsolete <regexp.h> interface.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* regexp.h now contains only an #error directive, so it cannot be
+ used in this file.
+
+ The function that would produce an 'expbuf' to use as the second
+ argument to 'step' and 'advance' was defined only in regexp.h,
+ as its definition depended on macros defined by the user. */
+
+#include <regex.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
+
+/* Define the variables used for the interface. */
+char *loc1;
+char *loc2;
+compat_symbol (libc, loc1, loc1, GLIBC_2_0);
+compat_symbol (libc, loc2, loc2, GLIBC_2_0);
+
+/* Although we do not support the use we define this variable as well. */
+char *locs;
+compat_symbol (libc, locs, locs, GLIBC_2_0);
+
+
+/* Find the next match in STRING. The compiled regular expression is
+ found in the buffer starting at EXPBUF. `loc1' will return the
+ first character matched and `loc2' points to the next unmatched
+ character. */
+int
+weak_function attribute_compat_text_section
+step (const char *string, const char *expbuf)
+{
+ regmatch_t match; /* We only need info about the full match. */
+
+ expbuf += __alignof (regex_t *);
+ expbuf -= (expbuf - ((const char *) 0)) % __alignof__ (regex_t *);
+
+ if (__regexec ((const regex_t *) expbuf, string, 1, &match, REG_NOTEOL)
+ == REG_NOMATCH)
+ return 0;
+
+ loc1 = (char *) string + match.rm_so;
+ loc2 = (char *) string + match.rm_eo;
+ return 1;
+}
+compat_symbol (libc, step, step, GLIBC_2_0);
+
+
+/* Match the beginning of STRING with the compiled regular expression
+ in EXPBUF. If the match is successful `loc2' will contain the
+ position of the first unmatched character. */
+int
+weak_function attribute_compat_text_section
+advance (const char *string, const char *expbuf)
+{
+ regmatch_t match; /* We only need info about the full match. */
+
+ expbuf += __alignof__ (regex_t *);
+ expbuf -= (expbuf - ((const char *) 0)) % __alignof__ (regex_t *);
+
+ if (__regexec ((const regex_t *) expbuf, string, 1, &match, REG_NOTEOL)
+ == REG_NOMATCH
+ /* We have to check whether the check is at the beginning of the
+ buffer. */
+ || match.rm_so != 0)
+ return 0;
+
+ loc2 = (char *) string + match.rm_eo;
+ return 1;
+}
+compat_symbol (libc, advance, advance, GLIBC_2_0);
+
+
+#endif /* SHLIB_COMPAT (2.0, 2.23) */
diff --git a/REORG.TODO/misc/regexp.h b/REORG.TODO/misc/regexp.h
new file mode 100644
index 0000000000..f9451f50db
--- /dev/null
+++ b/REORG.TODO/misc/regexp.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _REGEXP_H
+#define _REGEXP_H 1
+
+/* The contents of this header file were originally standardized in
+ the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994)
+ the header was marked as TO BE WITHDRAWN, and new applications
+ were encouraged to use <regex.h> instead. It was officially
+ withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
+
+ The GNU C Library provided this header through version 2.22. */
+
+#error "The GNU C Library no longer implements <regexp.h>."
+#error "Please update your code to use <regex.h> instead (no trailing 'p')."
+
+#endif /* regexp.h */
diff --git a/REORG.TODO/misc/remap_file_pages.c b/REORG.TODO/misc/remap_file_pages.c
new file mode 100644
index 0000000000..478ed72c5f
--- /dev/null
+++ b/REORG.TODO/misc/remap_file_pages.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2003-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Remap arbitrary pages of a shared backing store within an existing
+ VMA. */
+
+int
+__remap_file_pages (void *start, size_t size, int prot, size_t pgoff,
+ int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (remap_file_pages)
+weak_alias (__remap_file_pages, remap_file_pages)
diff --git a/REORG.TODO/misc/removexattr.c b/REORG.TODO/misc/removexattr.c
new file mode 100644
index 0000000000..a73840fa7f
--- /dev/null
+++ b/REORG.TODO/misc/removexattr.c
@@ -0,0 +1,28 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+removexattr (const char *__path, const char *__name)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (removexattr)
diff --git a/REORG.TODO/misc/revoke.c b/REORG.TODO/misc/revoke.c
new file mode 100644
index 0000000000..d953216246
--- /dev/null
+++ b/REORG.TODO/misc/revoke.c
@@ -0,0 +1,28 @@
+/* Revoke the access of all descriptors currently open on a file.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+#include <errno.h>
+
+int
+revoke (const char *file)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (revoke)
diff --git a/REORG.TODO/misc/sbrk.c b/REORG.TODO/misc/sbrk.c
new file mode 100644
index 0000000000..965c0ef879
--- /dev/null
+++ b/REORG.TODO/misc/sbrk.c
@@ -0,0 +1,64 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <stdint.h>
+#include <unistd.h>
+
+/* Defined in brk.c. */
+extern void *__curbrk;
+extern int __brk (void *addr);
+
+/* Defined in init-first.c. */
+extern int __libc_multiple_libcs attribute_hidden;
+
+/* Extend the process's data space by INCREMENT.
+ If INCREMENT is negative, shrink data space by - INCREMENT.
+ Return start of new space allocated, or -1 for errors. */
+void *
+__sbrk (intptr_t increment)
+{
+ void *oldbrk;
+
+ /* If this is not part of the dynamic library or the library is used
+ via dynamic loading in a statically linked program update
+ __curbrk from the kernel's brk value. That way two separate
+ instances of __brk and __sbrk can share the heap, returning
+ interleaved pieces of it. */
+ if (__curbrk == NULL || __libc_multiple_libcs)
+ if (__brk (0) < 0) /* Initialize the break. */
+ return (void *) -1;
+
+ if (increment == 0)
+ return __curbrk;
+
+ oldbrk = __curbrk;
+ if (increment > 0
+ ? ((uintptr_t) oldbrk + (uintptr_t) increment < (uintptr_t) oldbrk)
+ : ((uintptr_t) oldbrk < (uintptr_t) -increment))
+ {
+ __set_errno (ENOMEM);
+ return (void *) -1;
+ }
+
+ if (__brk (oldbrk + increment) < 0)
+ return (void *) -1;
+
+ return oldbrk;
+}
+libc_hidden_def (__sbrk)
+weak_alias (__sbrk, sbrk)
diff --git a/REORG.TODO/misc/search.h b/REORG.TODO/misc/search.h
new file mode 100644
index 0000000000..ae122eec69
--- /dev/null
+++ b/REORG.TODO/misc/search.h
@@ -0,0 +1,174 @@
+/* Declarations for System V style searching functions.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SEARCH_H
+#define _SEARCH_H 1
+
+#include <features.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+__BEGIN_DECLS
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+/* Prototype structure for a linked-list data structure.
+ This is the type used by the `insque' and `remque' functions. */
+
+# ifdef __USE_GNU
+struct qelem
+ {
+ struct qelem *q_forw;
+ struct qelem *q_back;
+ char q_data[1];
+ };
+# endif
+
+
+/* Insert ELEM into a doubly-linked list, after PREV. */
+extern void insque (void *__elem, void *__prev) __THROW;
+
+/* Unlink ELEM from the doubly-linked list that it is in. */
+extern void remque (void *__elem) __THROW;
+#endif
+
+
+/* For use with hsearch(3). */
+#ifndef __COMPAR_FN_T
+# define __COMPAR_FN_T
+typedef int (*__compar_fn_t) (const void *, const void *);
+
+# ifdef __USE_GNU
+typedef __compar_fn_t comparison_fn_t;
+# endif
+#endif
+
+/* Action which shall be performed in the call the hsearch. */
+typedef enum
+ {
+ FIND,
+ ENTER
+ }
+ACTION;
+
+typedef struct entry
+ {
+ char *key;
+ void *data;
+ }
+ENTRY;
+
+/* Opaque type for internal use. */
+struct _ENTRY;
+
+/* Family of hash table handling functions. The functions also
+ have reentrant counterparts ending with _r. The non-reentrant
+ functions all work on a signle internal hashing table. */
+
+/* Search for entry matching ITEM.key in internal hash table. If
+ ACTION is `FIND' return found entry or signal error by returning
+ NULL. If ACTION is `ENTER' replace existing data (if any) with
+ ITEM.data. */
+extern ENTRY *hsearch (ENTRY __item, ACTION __action) __THROW;
+
+/* Create a new hashing table which will at most contain NEL elements. */
+extern int hcreate (size_t __nel) __THROW;
+
+/* Destroy current internal hashing table. */
+extern void hdestroy (void) __THROW;
+
+#ifdef __USE_GNU
+/* Data type for reentrant functions. */
+struct hsearch_data
+ {
+ struct _ENTRY *table;
+ unsigned int size;
+ unsigned int filled;
+ };
+
+/* Reentrant versions which can handle multiple hashing tables at the
+ same time. */
+extern int hsearch_r (ENTRY __item, ACTION __action, ENTRY **__retval,
+ struct hsearch_data *__htab) __THROW;
+extern int hcreate_r (size_t __nel, struct hsearch_data *__htab) __THROW;
+extern void hdestroy_r (struct hsearch_data *__htab) __THROW;
+#endif
+
+
+/* The tsearch routines are very interesting. They make many
+ assumptions about the compiler. It assumes that the first field
+ in node must be the "key" field, which points to the datum.
+ Everything depends on that. */
+/* For tsearch */
+typedef enum
+{
+ preorder,
+ postorder,
+ endorder,
+ leaf
+}
+VISIT;
+
+/* Search for an entry matching the given KEY in the tree pointed to
+ by *ROOTP and insert a new element if not found. */
+extern void *tsearch (const void *__key, void **__rootp,
+ __compar_fn_t __compar);
+
+/* Search for an entry matching the given KEY in the tree pointed to
+ by *ROOTP. If no matching entry is available return NULL. */
+extern void *tfind (const void *__key, void *const *__rootp,
+ __compar_fn_t __compar);
+
+/* Remove the element matching KEY from the tree pointed to by *ROOTP. */
+extern void *tdelete (const void *__restrict __key,
+ void **__restrict __rootp,
+ __compar_fn_t __compar);
+
+#ifndef __ACTION_FN_T
+# define __ACTION_FN_T
+typedef void (*__action_fn_t) (const void *__nodep, VISIT __value,
+ int __level);
+#endif
+
+/* Walk through the whole tree and call the ACTION callback for every node
+ or leaf. */
+extern void twalk (const void *__root, __action_fn_t __action);
+
+#ifdef __USE_GNU
+/* Callback type for function to free a tree node. If the keys are atomic
+ data this function should do nothing. */
+typedef void (*__free_fn_t) (void *__nodep);
+
+/* Destroy the whole tree, call FREEFCT for each node or leaf. */
+extern void tdestroy (void *__root, __free_fn_t __freefct);
+#endif
+
+
+/* Perform linear search for KEY by comparing by COMPAR in an array
+ [BASE,BASE+NMEMB*SIZE). */
+extern void *lfind (const void *__key, const void *__base,
+ size_t *__nmemb, size_t __size, __compar_fn_t __compar);
+
+/* Perform linear search for KEY by comparing by COMPAR function in
+ array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */
+extern void *lsearch (const void *__key, void *__base,
+ size_t *__nmemb, size_t __size, __compar_fn_t __compar);
+
+__END_DECLS
+
+#endif /* search.h */
diff --git a/REORG.TODO/misc/select.c b/REORG.TODO/misc/select.c
new file mode 100644
index 0000000000..711683a96f
--- /dev/null
+++ b/REORG.TODO/misc/select.c
@@ -0,0 +1,37 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <errno.h>
+
+/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
+ readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
+ (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
+ after waiting the interval specified therein. Returns the number of ready
+ descriptors, or -1 for errors. */
+int
+__select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ struct timeval *timeout)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__select)
+stub_warning (select)
+
+weak_alias (__select, select)
diff --git a/REORG.TODO/misc/setdomain.c b/REORG.TODO/misc/setdomain.c
new file mode 100644
index 0000000000..e0fdf1da47
--- /dev/null
+++ b/REORG.TODO/misc/setdomain.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1994-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the name of the current YP domain to NAME, which is LEN bytes long.
+ This call is restricted to the super-user. */
+int
+setdomainname (const char *name, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (setdomainname)
diff --git a/REORG.TODO/misc/setegid.c b/REORG.TODO/misc/setegid.c
new file mode 100644
index 0000000000..0343691ab8
--- /dev/null
+++ b/REORG.TODO/misc/setegid.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1992-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the effective group ID of the calling process to GID. */
+int
+setegid (__gid_t gid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (setegid)
+stub_warning (setegid)
diff --git a/REORG.TODO/misc/seteuid.c b/REORG.TODO/misc/seteuid.c
new file mode 100644
index 0000000000..f0f2df1c58
--- /dev/null
+++ b/REORG.TODO/misc/seteuid.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1992-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the effective user ID of the calling process to UID. */
+int
+seteuid (__uid_t uid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (seteuid)
+stub_warning (seteuid)
diff --git a/REORG.TODO/misc/sethostid.c b/REORG.TODO/misc/sethostid.c
new file mode 100644
index 0000000000..19dd30e53f
--- /dev/null
+++ b/REORG.TODO/misc/sethostid.c
@@ -0,0 +1,31 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the current machine's Internet number to ID.
+ This call is restricted to the super-user. */
+int
+sethostid (long int id)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (sethostid)
diff --git a/REORG.TODO/misc/sethostname.c b/REORG.TODO/misc/sethostname.c
new file mode 100644
index 0000000000..00527d85e2
--- /dev/null
+++ b/REORG.TODO/misc/sethostname.c
@@ -0,0 +1,31 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the name of the current host to NAME, which is LEN bytes long.
+ This call is restricted to the super-user. */
+int
+sethostname (const char *name, size_t len)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (sethostname)
diff --git a/REORG.TODO/misc/setregid.c b/REORG.TODO/misc/setregid.c
new file mode 100644
index 0000000000..e5c4808ad9
--- /dev/null
+++ b/REORG.TODO/misc/setregid.c
@@ -0,0 +1,32 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the real group ID of the calling process to RGID,
+ and the effective group ID of the calling process to EGID. */
+int
+__setregid (gid_t effective_gid, gid_t real_gid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setregid)
+
+weak_alias (__setregid, setregid)
diff --git a/REORG.TODO/misc/setreuid.c b/REORG.TODO/misc/setreuid.c
new file mode 100644
index 0000000000..173e076197
--- /dev/null
+++ b/REORG.TODO/misc/setreuid.c
@@ -0,0 +1,32 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the real user ID of the calling process to RUID,
+ and the effective user ID of the calling process to EUID. */
+int
+__setreuid (uid_t effective_uid, uid_t real_uid)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (setreuid)
+
+weak_alias (__setreuid, setreuid)
diff --git a/REORG.TODO/misc/setxattr.c b/REORG.TODO/misc/setxattr.c
new file mode 100644
index 0000000000..eb78d05f16
--- /dev/null
+++ b/REORG.TODO/misc/setxattr.c
@@ -0,0 +1,29 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+setxattr (const char *__path, const char *__name,
+ const void *__value, size_t __size, int __flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (setxattr)
diff --git a/REORG.TODO/misc/sgtty.h b/REORG.TODO/misc/sgtty.h
new file mode 100644
index 0000000000..ac8980dcfa
--- /dev/null
+++ b/REORG.TODO/misc/sgtty.h
@@ -0,0 +1,40 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SGTTY_H
+#define _SGTTY_H 1
+
+#include <features.h>
+
+#include <sys/ioctl.h>
+
+/* On some systems this type is not defined by <bits/ioctl-types.h>;
+ in that case, the functions are just stubs that return ENOSYS. */
+struct sgttyb;
+
+__BEGIN_DECLS
+
+/* Fill in *PARAMS with terminal parameters associated with FD. */
+extern int gtty (int __fd, struct sgttyb *__params) __THROW;
+
+/* Set the terminal parameters associated with FD to *PARAMS. */
+extern int stty (int __fd, const struct sgttyb *__params) __THROW;
+
+
+__END_DECLS
+
+#endif /* sgtty.h */
diff --git a/REORG.TODO/misc/sstk.c b/REORG.TODO/misc/sstk.c
new file mode 100644
index 0000000000..7e8a38287c
--- /dev/null
+++ b/REORG.TODO/misc/sstk.c
@@ -0,0 +1,32 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+
+/* Increase the size of the stack by INCREMENT,
+ and return the address of the bottom of the stack. */
+
+void *sstk (int increment) __THROW;
+
+void *
+sstk (int increment)
+{
+ __set_errno (ENOSYS);
+ return (void *) -1;
+}
+
+stub_warning (sstk)
diff --git a/REORG.TODO/misc/stab.h b/REORG.TODO/misc/stab.h
new file mode 100644
index 0000000000..9dc3c32ecb
--- /dev/null
+++ b/REORG.TODO/misc/stab.h
@@ -0,0 +1,17 @@
+#ifndef __GNU_STAB__
+
+/* Indicate the GNU stab.h is in use. */
+
+#define __GNU_STAB__
+
+#define __define_stab(NAME, CODE, STRING) NAME=CODE,
+
+enum __stab_debug_code
+{
+#include <bits/stab.def>
+LAST_UNUSED_STAB_CODE
+};
+
+#undef __define_stab
+
+#endif /* __GNU_STAB_ */
diff --git a/REORG.TODO/misc/stty.c b/REORG.TODO/misc/stty.c
new file mode 100644
index 0000000000..1e4ee993f8
--- /dev/null
+++ b/REORG.TODO/misc/stty.c
@@ -0,0 +1,36 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sgtty.h>
+#include <stddef.h>
+
+/* Set the terminal parameters associated with FD to *PARAMS. */
+int
+stty (int fd, const struct sgttyb *params)
+{
+ if (params == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (stty)
diff --git a/REORG.TODO/misc/swapoff.c b/REORG.TODO/misc/swapoff.c
new file mode 100644
index 0000000000..6c1f388a17
--- /dev/null
+++ b/REORG.TODO/misc/swapoff.c
@@ -0,0 +1,29 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Stop using block special device PATH for swapping. */
+int
+swapoff (const char *path)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (swapoff)
diff --git a/REORG.TODO/misc/swapon.c b/REORG.TODO/misc/swapon.c
new file mode 100644
index 0000000000..07a2c30386
--- /dev/null
+++ b/REORG.TODO/misc/swapon.c
@@ -0,0 +1,31 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/swap.h>
+
+/* Make the block special device PATH available to the system for swapping.
+ This call is restricted to the super-user. */
+int
+swapon (const char *path, int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (swapon)
diff --git a/REORG.TODO/misc/sync.c b/REORG.TODO/misc/sync.c
new file mode 100644
index 0000000000..ec9cb1706f
--- /dev/null
+++ b/REORG.TODO/misc/sync.c
@@ -0,0 +1,29 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make all changes done to all files actually appear on disk. */
+void
+sync (void)
+{
+ __set_errno (ENOSYS);
+}
+
+
+stub_warning (sync)
diff --git a/REORG.TODO/misc/syncfs.c b/REORG.TODO/misc/syncfs.c
new file mode 100644
index 0000000000..2f505977be
--- /dev/null
+++ b/REORG.TODO/misc/syncfs.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2011-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make all changes done to all files on the file system associated
+ with FD actually appear on disk. */
+int
+syncfs (int fd)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (syncfs)
diff --git a/REORG.TODO/misc/sys/auxv.h b/REORG.TODO/misc/sys/auxv.h
new file mode 100644
index 0000000000..9ec84e50a5
--- /dev/null
+++ b/REORG.TODO/misc/sys/auxv.h
@@ -0,0 +1,36 @@
+/* Access to the auxiliary vector.
+ Copyright (C) 2012-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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_AUXV_H
+#define _SYS_AUXV_H 1
+
+#include <elf.h>
+#include <sys/cdefs.h>
+#include <bits/hwcap.h>
+
+__BEGIN_DECLS
+
+/* Return the value associated with an Elf*_auxv_t type from the auxv list
+ passed to the program on startup. If TYPE was not present in the auxv
+ list, returns zero and sets errno to ENOENT. */
+extern unsigned long int getauxval (unsigned long int __type)
+ __THROW;
+
+__END_DECLS
+
+#endif /* sys/auxv.h */
diff --git a/REORG.TODO/misc/sys/cdefs.h b/REORG.TODO/misc/sys/cdefs.h
new file mode 100644
index 0000000000..06523bfe9c
--- /dev/null
+++ b/REORG.TODO/misc/sys/cdefs.h
@@ -0,0 +1,483 @@
+/* Copyright (C) 1992-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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_CDEFS_H
+#define _SYS_CDEFS_H 1
+
+/* We are almost always included from features.h. */
+#ifndef _FEATURES_H
+# include <features.h>
+#endif
+
+/* The GNU libc does not support any K&R compilers or the traditional mode
+ of ISO C compilers anymore. Check for some of the combinations not
+ anymore supported. */
+#if defined __GNUC__ && !defined __STDC__
+# error "You need a ISO C conforming compiler to use the glibc headers"
+#endif
+
+/* Some user header file might have defined this before. */
+#undef __P
+#undef __PMT
+
+#ifdef __GNUC__
+
+/* All functions, except those with callbacks or those that
+ synchronize memory, are leaf functions. */
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+# define __LEAF , __leaf__
+# define __LEAF_ATTR __attribute__ ((__leaf__))
+# else
+# define __LEAF
+# define __LEAF_ATTR
+# endif
+
+/* GCC can always grok prototypes. For C++ programs we add throw()
+ to help it optimize the function calls. But this works only with
+ gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
+ as non-throwing using a function attribute since programs can use
+ the -fexceptions options for C code as well. */
+# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
+# define __THROW __attribute__ ((__nothrow__ __LEAF))
+# define __THROWNL __attribute__ ((__nothrow__))
+# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
+# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
+# else
+# if defined __cplusplus && __GNUC_PREREQ (2,8)
+# define __THROW throw ()
+# define __THROWNL throw ()
+# define __NTH(fct) __LEAF_ATTR fct throw ()
+# define __NTHNL(fct) fct throw ()
+# else
+# define __THROW
+# define __THROWNL
+# define __NTH(fct) fct
+# define __NTHNL(fct) fct
+# endif
+# endif
+
+#else /* Not GCC. */
+
+# define __inline /* No inline functions. */
+
+# define __THROW
+# define __THROWNL
+# define __NTH(fct) fct
+
+#endif /* GCC. */
+
+/* Compilers that are not clang may object to
+ #if defined __clang__ && __has_extension(...)
+ even though they do not need to evaluate the right-hand side of the &&. */
+#if defined __clang__ && defined __has_extension
+# define __glibc_clang_has_extension(ext) __has_extension (ext)
+#else
+# define __glibc_clang_has_extension(ext) 0
+#endif
+
+/* These two macros are not used in glibc anymore. They are kept here
+ only because some other projects expect the macros to be defined. */
+#define __P(args) args
+#define __PMT(args) args
+
+/* For these things, GCC behaves the ANSI way normally,
+ and the non-ANSI way under -traditional. */
+
+#define __CONCAT(x,y) x ## y
+#define __STRING(x) #x
+
+/* This is not a typedef so `const __ptr_t' does the right thing. */
+#define __ptr_t void *
+#define __long_double_t long double
+
+
+/* C++ needs to know that types and declarations are C, not C++. */
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+
+
+/* Fortify support. */
+#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
+#define __bos0(ptr) __builtin_object_size (ptr, 0)
+
+#if __GNUC_PREREQ (4,3)
+# define __warndecl(name, msg) \
+ extern void name (void) __attribute__((__warning__ (msg)))
+# define __warnattr(msg) __attribute__((__warning__ (msg)))
+# define __errordecl(name, msg) \
+ extern void name (void) __attribute__((__error__ (msg)))
+#else
+# define __warndecl(name, msg) extern void name (void)
+# define __warnattr(msg)
+# define __errordecl(name, msg) extern void name (void)
+#endif
+
+/* Support for flexible arrays.
+ Headers that should use flexible arrays only if they're "real"
+ (e.g. only if they won't affect sizeof()) should test
+ #if __glibc_c99_flexarr_available. */
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+# define __flexarr []
+# define __glibc_c99_flexarr_available 1
+#elif __GNUC_PREREQ (2,97)
+/* GCC 2.97 supports C99 flexible array members as an extension,
+ even when in C89 mode or compiling C++ (any version). */
+# define __flexarr []
+# define __glibc_c99_flexarr_available 1
+#elif defined __GNUC__
+/* Pre-2.97 GCC did not support C99 flexible arrays but did have
+ an equivalent extension with slightly different notation. */
+# define __flexarr [0]
+# define __glibc_c99_flexarr_available 1
+#else
+/* Some other non-C99 compiler. Approximate with [1]. */
+# define __flexarr [1]
+# define __glibc_c99_flexarr_available 0
+#endif
+
+
+/* __asm__ ("xyz") is used throughout the headers to rename functions
+ at the assembly language level. This is wrapped by the __REDIRECT
+ macro, in order to support compilers that can do this some other
+ way. When compilers don't support asm-names at all, we have to do
+ preprocessor tricks instead (which don't have exactly the right
+ semantics, but it's the best we can do).
+
+ Example:
+ int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
+
+#if defined __GNUC__ && __GNUC__ >= 2
+
+# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
+# ifdef __cplusplus
+# define __REDIRECT_NTH(name, proto, alias) \
+ name proto __THROW __asm__ (__ASMNAME (#alias))
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __THROWNL __asm__ (__ASMNAME (#alias))
+# else
+# define __REDIRECT_NTH(name, proto, alias) \
+ name proto __asm__ (__ASMNAME (#alias)) __THROW
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __asm__ (__ASMNAME (#alias)) __THROWNL
+# endif
+# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
+
+/*
+#elif __SOME_OTHER_COMPILER__
+
+# define __REDIRECT(name, proto, alias) name proto; \
+ _Pragma("let " #name " = " #alias)
+*/
+#endif
+
+/* GCC has various useful declarations that can be made with the
+ `__attribute__' syntax. All of the ways we use this do fine if
+ they are omitted for compilers that don't understand it. */
+#if !defined __GNUC__ || __GNUC__ < 2
+# define __attribute__(xyz) /* Ignore */
+#endif
+
+/* At some point during the gcc 2.96 development the `malloc' attribute
+ for functions was introduced. We don't want to use it unconditionally
+ (although this would be possible) since it generates warnings. */
+#if __GNUC_PREREQ (2,96)
+# define __attribute_malloc__ __attribute__ ((__malloc__))
+#else
+# define __attribute_malloc__ /* Ignore */
+#endif
+
+/* Tell the compiler which arguments to an allocation function
+ indicate the size of the allocation. */
+#if __GNUC_PREREQ (4, 3)
+# define __attribute_alloc_size__(params) \
+ __attribute__ ((__alloc_size__ params))
+#else
+# define __attribute_alloc_size__(params) /* Ignore. */
+#endif
+
+/* At some point during the gcc 2.96 development the `pure' attribute
+ for functions was introduced. We don't want to use it unconditionally
+ (although this would be possible) since it generates warnings. */
+#if __GNUC_PREREQ (2,96)
+# define __attribute_pure__ __attribute__ ((__pure__))
+#else
+# define __attribute_pure__ /* Ignore */
+#endif
+
+/* This declaration tells the compiler that the value is constant. */
+#if __GNUC_PREREQ (2,5)
+# define __attribute_const__ __attribute__ ((__const__))
+#else
+# define __attribute_const__ /* Ignore */
+#endif
+
+/* At some point during the gcc 3.1 development the `used' attribute
+ for functions was introduced. We don't want to use it unconditionally
+ (although this would be possible) since it generates warnings. */
+#if __GNUC_PREREQ (3,1)
+# define __attribute_used__ __attribute__ ((__used__))
+# define __attribute_noinline__ __attribute__ ((__noinline__))
+#else
+# define __attribute_used__ __attribute__ ((__unused__))
+# define __attribute_noinline__ /* Ignore */
+#endif
+
+/* Since version 3.2, gcc allows marking deprecated functions. */
+#if __GNUC_PREREQ (3,2)
+# define __attribute_deprecated__ __attribute__ ((__deprecated__))
+#else
+# define __attribute_deprecated__ /* Ignore */
+#endif
+
+/* Since version 4.5, gcc also allows one to specify the message printed
+ when a deprecated function is used. clang claims to be gcc 4.2, but
+ may also support this feature. */
+#if __GNUC_PREREQ (4,5) || \
+ __glibc_clang_has_extension (__attribute_deprecated_with_message__)
+# define __attribute_deprecated_msg__(msg) \
+ __attribute__ ((__deprecated__ (msg)))
+#else
+# define __attribute_deprecated_msg__(msg) __attribute_deprecated__
+#endif
+
+/* At some point during the gcc 2.8 development the `format_arg' attribute
+ for functions was introduced. We don't want to use it unconditionally
+ (although this would be possible) since it generates warnings.
+ If several `format_arg' attributes are given for the same function, in
+ gcc-3.0 and older, all but the last one are ignored. In newer gccs,
+ all designated arguments are considered. */
+#if __GNUC_PREREQ (2,8)
+# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
+#else
+# define __attribute_format_arg__(x) /* Ignore */
+#endif
+
+/* At some point during the gcc 2.97 development the `strfmon' format
+ attribute for functions was introduced. We don't want to use it
+ unconditionally (although this would be possible) since it
+ generates warnings. */
+#if __GNUC_PREREQ (2,97)
+# define __attribute_format_strfmon__(a,b) \
+ __attribute__ ((__format__ (__strfmon__, a, b)))
+#else
+# define __attribute_format_strfmon__(a,b) /* Ignore */
+#endif
+
+/* The nonull function attribute allows to mark pointer parameters which
+ must not be NULL. */
+#if __GNUC_PREREQ (3,3)
+# define __nonnull(params) __attribute__ ((__nonnull__ params))
+#else
+# define __nonnull(params)
+#endif
+
+/* If fortification mode, we warn about unused results of certain
+ function calls which can lead to problems. */
+#if __GNUC_PREREQ (3,4)
+# define __attribute_warn_unused_result__ \
+ __attribute__ ((__warn_unused_result__))
+# if __USE_FORTIFY_LEVEL > 0
+# define __wur __attribute_warn_unused_result__
+# endif
+#else
+# define __attribute_warn_unused_result__ /* empty */
+#endif
+#ifndef __wur
+# define __wur /* Ignore */
+#endif
+
+/* Forces a function to be always inlined. */
+#if __GNUC_PREREQ (3,2)
+/* The Linux kernel defines __always_inline in stddef.h (283d7573), and
+ it conflicts with this definition. Therefore undefine it first to
+ allow either header to be included first. */
+# undef __always_inline
+# define __always_inline __inline __attribute__ ((__always_inline__))
+#else
+# undef __always_inline
+# define __always_inline __inline
+#endif
+
+/* Associate error messages with the source location of the call site rather
+ than with the source location inside the function. */
+#if __GNUC_PREREQ (4,3)
+# define __attribute_artificial__ __attribute__ ((__artificial__))
+#else
+# define __attribute_artificial__ /* Ignore */
+#endif
+
+/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+ inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
+ or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
+ older than 4.3 may define these macros and still not guarantee GNU inlining
+ semantics.
+
+ clang++ identifies itself as gcc-4.2, but has support for GNU inlining
+ semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and
+ __GNUC_GNU_INLINE__ macro definitions. */
+#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
+ || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
+ || defined __GNUC_GNU_INLINE__)))
+# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
+# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
+# define __extern_always_inline \
+ extern __always_inline __attribute__ ((__gnu_inline__))
+# else
+# define __extern_inline extern __inline
+# define __extern_always_inline extern __always_inline
+# endif
+#endif
+
+#ifdef __extern_always_inline
+# define __fortify_function __extern_always_inline __attribute_artificial__
+#endif
+
+/* GCC 4.3 and above allow passing all anonymous arguments of an
+ __extern_always_inline function to some other vararg function. */
+#if __GNUC_PREREQ (4,3)
+# define __va_arg_pack() __builtin_va_arg_pack ()
+# define __va_arg_pack_len() __builtin_va_arg_pack_len ()
+#endif
+
+/* It is possible to compile containing GCC extensions even if GCC is
+ run in pedantic mode if the uses are carefully marked using the
+ `__extension__' keyword. But this is not generally available before
+ version 2.8. */
+#if !__GNUC_PREREQ (2,8)
+# define __extension__ /* Ignore */
+#endif
+
+/* __restrict is known in EGCS 1.2 and above. */
+#if !__GNUC_PREREQ (2,92)
+# define __restrict /* Ignore */
+#endif
+
+/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
+ array_name[restrict]
+ GCC 3.1 supports this. */
+#if __GNUC_PREREQ (3,1) && !defined __GNUG__
+# define __restrict_arr __restrict
+#else
+# ifdef __GNUC__
+# define __restrict_arr /* Not supported in old GCC. */
+# else
+# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+# define __restrict_arr restrict
+# else
+/* Some other non-C99 compiler. */
+# define __restrict_arr /* Not supported. */
+# endif
+# endif
+#endif
+
+#if __GNUC__ >= 3
+# define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
+# define __glibc_likely(cond) __builtin_expect ((cond), 1)
+#else
+# define __glibc_unlikely(cond) (cond)
+# define __glibc_likely(cond) (cond)
+#endif
+
+#if (!defined _Noreturn \
+ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
+ && !__GNUC_PREREQ (4,7))
+# if __GNUC_PREREQ (2,8)
+# define _Noreturn __attribute__ ((__noreturn__))
+# else
+# define _Noreturn
+# endif
+#endif
+
+#if (!defined _Static_assert && !defined __cplusplus \
+ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
+ && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
+# define _Static_assert(expr, diagnostic) \
+ extern int (*__Static_assert_function (void)) \
+ [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
+#endif
+
+#include <bits/wordsize.h>
+#include <bits/long-double.h>
+
+#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# define __LDBL_COMPAT 1
+# ifdef __REDIRECT
+# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
+# define __LDBL_REDIR(name, proto) \
+ __LDBL_REDIR1 (name, proto, __nldbl_##name)
+# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
+# define __LDBL_REDIR_NTH(name, proto) \
+ __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
+# define __LDBL_REDIR1_DECL(name, alias) \
+ extern __typeof (name) name __asm (__ASMNAME (#alias));
+# define __LDBL_REDIR_DECL(name) \
+ extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
+# define __REDIRECT_LDBL(name, proto, alias) \
+ __LDBL_REDIR1 (name, proto, __nldbl_##alias)
+# define __REDIRECT_NTH_LDBL(name, proto, alias) \
+ __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
+# endif
+#endif
+#if !defined __LDBL_COMPAT || !defined __REDIRECT
+# define __LDBL_REDIR1(name, proto, alias) name proto
+# define __LDBL_REDIR(name, proto) name proto
+# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
+# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
+# define __LDBL_REDIR_DECL(name)
+# ifdef __REDIRECT
+# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
+# define __REDIRECT_NTH_LDBL(name, proto, alias) \
+ __REDIRECT_NTH (name, proto, alias)
+# endif
+#endif
+
+/* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
+ intended for use in preprocessor macros.
+
+ Note: MESSAGE must be a _single_ string; concatenation of string
+ literals is not supported. */
+#if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
+# define __glibc_macro_warning1(message) _Pragma (#message)
+# define __glibc_macro_warning(message) \
+ __glibc_macro_warning1 (GCC warning message)
+#else
+# define __glibc_macro_warning(msg)
+#endif
+
+/* Support for generic selection (ISO C11) is available in GCC since
+ version 4.9. Previous versions do not provide generic selection,
+ even though they might set __STDC_VERSION__ to 201112L, when in
+ -std=c11 mode. Thus, we must check for !defined __GNUC__ when
+ testing __STDC_VERSION__ for generic selection support.
+ On the other hand, Clang also defines __GNUC__, so a clang-specific
+ check is required to enable the use of generic selection. */
+#if __GNUC_PREREQ (4, 9) \
+ || __glibc_clang_has_extension (c_generic_selections) \
+ || (!defined __GNUC__ && defined __STDC_VERSION__ \
+ && __STDC_VERSION__ >= 201112L)
+# define __HAVE_GENERIC_SELECTION 1
+#else
+# define __HAVE_GENERIC_SELECTION 0
+#endif
+
+#endif /* sys/cdefs.h */
diff --git a/REORG.TODO/misc/sys/dir.h b/REORG.TODO/misc/sys/dir.h
new file mode 100644
index 0000000000..51b704475b
--- /dev/null
+++ b/REORG.TODO/misc/sys/dir.h
@@ -0,0 +1,27 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_DIR_H
+#define _SYS_DIR_H 1
+
+#include <features.h>
+
+#include <dirent.h>
+
+#define direct dirent
+
+#endif /* sys/dir.h */
diff --git a/REORG.TODO/misc/sys/file.h b/REORG.TODO/misc/sys/file.h
new file mode 100644
index 0000000000..3ee0c445f2
--- /dev/null
+++ b/REORG.TODO/misc/sys/file.h
@@ -0,0 +1,55 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_FILE_H
+#define _SYS_FILE_H 1
+
+#include <features.h>
+
+#ifndef _FCNTL_H
+# include <fcntl.h>
+#endif
+
+__BEGIN_DECLS
+
+
+/* Alternate names for values for the WHENCE argument to `lseek'.
+ These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively. */
+#ifndef L_SET
+# define L_SET 0 /* Seek from beginning of file. */
+# define L_INCR 1 /* Seek from current position. */
+# define L_XTND 2 /* Seek from end of file. */
+#endif
+
+
+/* Operations for the `flock' call. */
+#define LOCK_SH 1 /* Shared lock. */
+#define LOCK_EX 2 /* Exclusive lock. */
+#define LOCK_UN 8 /* Unlock. */
+
+/* Can be OR'd in to one of the above. */
+#define LOCK_NB 4 /* Don't block when locking. */
+
+
+/* Apply or remove an advisory lock, according to OPERATION,
+ on the file FD refers to. */
+extern int flock (int __fd, int __operation) __THROW;
+
+
+__END_DECLS
+
+#endif /* sys/file.h */
diff --git a/REORG.TODO/misc/sys/ioctl.h b/REORG.TODO/misc/sys/ioctl.h
new file mode 100644
index 0000000000..6780e5b560
--- /dev/null
+++ b/REORG.TODO/misc/sys/ioctl.h
@@ -0,0 +1,45 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_IOCTL_H
+#define _SYS_IOCTL_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Get the list of `ioctl' requests and related constants. */
+#include <bits/ioctls.h>
+
+/* Define some types used by `ioctl' requests. */
+#include <bits/ioctl-types.h>
+
+/* On a Unix system, the system <sys/ioctl.h> probably defines some of
+ the symbols we define in <sys/ttydefaults.h> (usually with the same
+ values). The code to generate <bits/ioctls.h> has omitted these
+ symbols to avoid the conflict, but a Unix program expects <sys/ioctl.h>
+ to define them, so we must include <sys/ttydefaults.h> here. */
+#include <sys/ttydefaults.h>
+
+/* Perform the I/O control operation specified by REQUEST on FD.
+ One argument may follow; its presence and type depend on REQUEST.
+ Return value depends on REQUEST. Usually -1 indicates error. */
+extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
+
+__END_DECLS
+
+#endif /* sys/ioctl.h */
diff --git a/REORG.TODO/misc/sys/mman.h b/REORG.TODO/misc/sys/mman.h
new file mode 100644
index 0000000000..d6bc842ca7
--- /dev/null
+++ b/REORG.TODO/misc/sys/mman.h
@@ -0,0 +1,151 @@
+/* Definitions for BSD-style memory management.
+ Copyright (C) 1994-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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_MMAN_H
+#define _SYS_MMAN_H 1
+
+#include <features.h>
+#include <bits/types.h>
+#define __need_size_t
+#include <stddef.h>
+
+#ifndef __off_t_defined
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+# define __off_t_defined
+#endif
+
+#ifndef __mode_t_defined
+typedef __mode_t mode_t;
+# define __mode_t_defined
+#endif
+
+#include <bits/mman.h>
+
+/* Return value of `mmap' in case of an error. */
+#define MAP_FAILED ((void *) -1)
+
+__BEGIN_DECLS
+/* Map addresses starting near ADDR and extending for LEN bytes. from
+ OFFSET into the file FD describes according to PROT and FLAGS. If ADDR
+ is nonzero, it is the desired mapping address. If the MAP_FIXED bit is
+ set in FLAGS, the mapping will be at ADDR exactly (which must be
+ page-aligned); otherwise the system chooses a convenient nearby address.
+ The return value is the actual mapping address chosen or MAP_FAILED
+ for errors (in which case `errno' is set). A successful `mmap' call
+ deallocates any previous mapping for the affected region. */
+
+#ifndef __USE_FILE_OFFSET64
+extern void *mmap (void *__addr, size_t __len, int __prot,
+ int __flags, int __fd, __off_t __offset) __THROW;
+#else
+# ifdef __REDIRECT_NTH
+extern void * __REDIRECT_NTH (mmap,
+ (void *__addr, size_t __len, int __prot,
+ int __flags, int __fd, __off64_t __offset),
+ mmap64);
+# else
+# define mmap mmap64
+# endif
+#endif
+#ifdef __USE_LARGEFILE64
+extern void *mmap64 (void *__addr, size_t __len, int __prot,
+ int __flags, int __fd, __off64_t __offset) __THROW;
+#endif
+
+/* Deallocate any mapping for the region starting at ADDR and extending LEN
+ bytes. Returns 0 if successful, -1 for errors (and sets errno). */
+extern int munmap (void *__addr, size_t __len) __THROW;
+
+/* Change the memory protection of the region starting at ADDR and
+ extending LEN bytes to PROT. Returns 0 if successful, -1 for errors
+ (and sets errno). */
+extern int mprotect (void *__addr, size_t __len, int __prot) __THROW;
+
+/* Synchronize the region starting at ADDR and extending LEN bytes with the
+ file it maps. Filesystem operations on a file being mapped are
+ unpredictable before this is done. Flags are from the MS_* set.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int msync (void *__addr, size_t __len, int __flags);
+
+#ifdef __USE_MISC
+/* Advise the system about particular usage patterns the program follows
+ for the region starting at ADDR and extending LEN bytes. */
+extern int madvise (void *__addr, size_t __len, int __advice) __THROW;
+#endif
+#ifdef __USE_XOPEN2K
+/* This is the POSIX name for this function. */
+extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW;
+#endif
+
+/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
+ be memory resident. */
+extern int mlock (const void *__addr, size_t __len) __THROW;
+
+/* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */
+extern int munlock (const void *__addr, size_t __len) __THROW;
+
+/* Cause all currently mapped pages of the process to be memory resident
+ until unlocked by a call to the `munlockall', until the process exits,
+ or until the process calls `execve'. */
+extern int mlockall (int __flags) __THROW;
+
+/* All currently mapped pages of the process' address space become
+ unlocked. */
+extern int munlockall (void) __THROW;
+
+#ifdef __USE_MISC
+/* mincore returns the memory residency status of the pages in the
+ current process's address space specified by [start, start + len).
+ The status is returned in a vector of bytes. The least significant
+ bit of each byte is 1 if the referenced page is in memory, otherwise
+ it is zero. */
+extern int mincore (void *__start, size_t __len, unsigned char *__vec)
+ __THROW;
+#endif
+
+#ifdef __USE_GNU
+/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length
+ NEW_LEN. If MREMAP_MAYMOVE is set in FLAGS the returned address
+ may differ from ADDR. If MREMAP_FIXED is set in FLAGS the function
+ takes another parameter which is a fixed address at which the block
+ resides after a successful call. */
+extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
+ int __flags, ...) __THROW;
+
+/* Remap arbitrary pages of a shared backing store within an existing
+ VMA. */
+extern int remap_file_pages (void *__start, size_t __size, int __prot,
+ size_t __pgoff, int __flags) __THROW;
+#endif
+
+
+/* Open shared memory segment. */
+extern int shm_open (const char *__name, int __oflag, mode_t __mode);
+
+/* Remove shared memory segment. */
+extern int shm_unlink (const char *__name);
+
+__END_DECLS
+
+#endif /* sys/mman.h */
diff --git a/REORG.TODO/misc/sys/param.h b/REORG.TODO/misc/sys/param.h
new file mode 100644
index 0000000000..97216135f2
--- /dev/null
+++ b/REORG.TODO/misc/sys/param.h
@@ -0,0 +1,106 @@
+/* Compatibility header for old-style Unix parameters and limits.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_PARAM_H
+#define _SYS_PARAM_H 1
+
+#define __need_NULL
+#include <stddef.h>
+
+#include <sys/types.h>
+#include <limits.h>
+#include <endian.h> /* Define BYTE_ORDER et al. */
+#include <signal.h> /* Define NSIG. */
+
+/* This file defines some things in system-specific ways. */
+#include <bits/param.h>
+
+
+/* BSD names for some <limits.h> values. */
+
+#define NBBY CHAR_BIT
+
+#if !defined NGROUPS && defined NGROUPS_MAX
+# define NGROUPS NGROUPS_MAX
+#endif
+#if !defined MAXSYMLINKS && defined SYMLOOP_MAX
+# define MAXSYMLINKS SYMLOOP_MAX
+#endif
+#if !defined CANBSIZ && defined MAX_CANON
+# define CANBSIZ MAX_CANON
+#endif
+#if !defined MAXPATHLEN && defined PATH_MAX
+# define MAXPATHLEN PATH_MAX
+#endif
+#if !defined NOFILE && defined OPEN_MAX
+# define NOFILE OPEN_MAX
+#endif
+#if !defined MAXHOSTNAMELEN && defined HOST_NAME_MAX
+# define MAXHOSTNAMELEN HOST_NAME_MAX
+#endif
+#ifndef NCARGS
+# ifdef ARG_MAX
+# define NCARGS ARG_MAX
+# else
+/* ARG_MAX is unlimited, but we define NCARGS for BSD programs that want to
+ compare against some fixed limit. */
+# define NCARGS INT_MAX
+# endif
+#endif
+
+
+/* Magical constants. */
+#ifndef NOGROUP
+# define NOGROUP 65535 /* Marker for empty group set member. */
+#endif
+#ifndef NODEV
+# define NODEV ((dev_t) -1) /* Non-existent device. */
+#endif
+
+
+/* Unit of `st_blocks'. */
+#ifndef DEV_BSIZE
+# define DEV_BSIZE 512
+#endif
+
+
+/* Bit map related macros. */
+#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
+#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
+#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
+#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
+
+/* Macros for counting and rounding. */
+#ifndef howmany
+# define howmany(x, y) (((x) + ((y) - 1)) / (y))
+#endif
+#ifdef __GNUC__
+# define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \
+ ? (((x) + (y) - 1) & ~((y) - 1)) \
+ : ((((x) + ((y) - 1)) / (y)) * (y)))
+#else
+# define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+#endif
+#define powerof2(x) ((((x) - 1) & (x)) == 0)
+
+/* Macros for min/max. */
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
+
+#endif /* sys/param.h */
diff --git a/REORG.TODO/misc/sys/queue.h b/REORG.TODO/misc/sys/queue.h
new file mode 100644
index 0000000000..daf4553d33
--- /dev/null
+++ b/REORG.TODO/misc/sys/queue.h
@@ -0,0 +1,574 @@
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. 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.
+ *
+ * @(#)queue.h 8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define _SYS_QUEUE_H_
+
+/*
+ * This file defines five types of data structures: singly-linked lists,
+ * lists, simple queues, tail queues, and circular queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The
+ * elements are singly linked for minimum space and pointer manipulation
+ * overhead at the expense of O(n) removal for arbitrary elements. New
+ * elements can be added to the list after an existing element or at the
+ * head of the list. Elements being removed from the head of the list
+ * should use the explicit macro for this purpose for optimum
+ * efficiency. A singly-linked list may only be traversed in the forward
+ * direction. Singly-linked lists are ideal for applications with large
+ * datasets and few or no removals or for implementing a LIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ */
+
+/*
+ * List definitions.
+ */
+#define LIST_HEAD(name, type) \
+struct name { \
+ struct type *lh_first; /* first element */ \
+}
+
+#define LIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define LIST_ENTRY(type) \
+struct { \
+ struct type *le_next; /* next element */ \
+ struct type **le_prev; /* address of previous next element */ \
+}
+
+/*
+ * List functions.
+ */
+#define LIST_INIT(head) do { \
+ (head)->lh_first = NULL; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_INSERT_AFTER(listelm, elm, field) do { \
+ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
+ (listelm)->field.le_next->field.le_prev = \
+ &(elm)->field.le_next; \
+ (listelm)->field.le_next = (elm); \
+ (elm)->field.le_prev = &(listelm)->field.le_next; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
+ (elm)->field.le_prev = (listelm)->field.le_prev; \
+ (elm)->field.le_next = (listelm); \
+ *(listelm)->field.le_prev = (elm); \
+ (listelm)->field.le_prev = &(elm)->field.le_next; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.le_next = (head)->lh_first) != NULL) \
+ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+ (head)->lh_first = (elm); \
+ (elm)->field.le_prev = &(head)->lh_first; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_REMOVE(elm, field) do { \
+ if ((elm)->field.le_next != NULL) \
+ (elm)->field.le_next->field.le_prev = \
+ (elm)->field.le_prev; \
+ *(elm)->field.le_prev = (elm)->field.le_next; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_FOREACH(var, head, field) \
+ for ((var) = ((head)->lh_first); \
+ (var); \
+ (var) = ((var)->field.le_next))
+
+/*
+ * List access methods.
+ */
+#define LIST_EMPTY(head) ((head)->lh_first == NULL)
+#define LIST_FIRST(head) ((head)->lh_first)
+#define LIST_NEXT(elm, field) ((elm)->field.le_next)
+
+
+/*
+ * Singly-linked List definitions.
+ */
+#define SLIST_HEAD(name, type) \
+struct name { \
+ struct type *slh_first; /* first element */ \
+}
+
+#define SLIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define SLIST_ENTRY(type) \
+struct { \
+ struct type *sle_next; /* next element */ \
+}
+
+/*
+ * Singly-linked List functions.
+ */
+#define SLIST_INIT(head) do { \
+ (head)->slh_first = NULL; \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
+ (elm)->field.sle_next = (slistelm)->field.sle_next; \
+ (slistelm)->field.sle_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.sle_next = (head)->slh_first; \
+ (head)->slh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_REMOVE_HEAD(head, field) do { \
+ (head)->slh_first = (head)->slh_first->field.sle_next; \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_REMOVE(head, elm, type, field) do { \
+ if ((head)->slh_first == (elm)) { \
+ SLIST_REMOVE_HEAD((head), field); \
+ } \
+ else { \
+ struct type *curelm = (head)->slh_first; \
+ while(curelm->field.sle_next != (elm)) \
+ curelm = curelm->field.sle_next; \
+ curelm->field.sle_next = \
+ curelm->field.sle_next->field.sle_next; \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
+/*
+ * Singly-linked List access methods.
+ */
+#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
+#define SLIST_FIRST(head) ((head)->slh_first)
+#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
+
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define STAILQ_HEAD(name, type) \
+struct name { \
+ struct type *stqh_first; /* first element */ \
+ struct type **stqh_last; /* addr of last next element */ \
+}
+
+#define STAILQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).stqh_first }
+
+#define STAILQ_ENTRY(type) \
+struct { \
+ struct type *stqe_next; /* next element */ \
+}
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define STAILQ_INIT(head) do { \
+ (head)->stqh_first = NULL; \
+ (head)->stqh_last = &(head)->stqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ (head)->stqh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.stqe_next = NULL; \
+ *(head)->stqh_last = (elm); \
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ (listelm)->field.stqe_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_REMOVE_HEAD(head, field) do { \
+ if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
+ (head)->stqh_last = &(head)->stqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_REMOVE(head, elm, type, field) do { \
+ if ((head)->stqh_first == (elm)) { \
+ STAILQ_REMOVE_HEAD((head), field); \
+ } else { \
+ struct type *curelm = (head)->stqh_first; \
+ while (curelm->field.stqe_next != (elm)) \
+ curelm = curelm->field.stqe_next; \
+ if ((curelm->field.stqe_next = \
+ curelm->field.stqe_next->field.stqe_next) == NULL) \
+ (head)->stqh_last = &(curelm)->field.stqe_next; \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->stqh_first); \
+ (var); \
+ (var) = ((var)->field.stqe_next))
+
+#define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+ (head1)->stqh_last = (head2)->stqh_last; \
+ STAILQ_INIT((head2)); \
+ } \
+} while (/*CONSTCOND*/0)
+
+/*
+ * Singly-linked Tail queue access methods.
+ */
+#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
+#define STAILQ_FIRST(head) ((head)->stqh_first)
+#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
+
+
+/*
+ * Simple queue definitions.
+ */
+#define SIMPLEQ_HEAD(name, type) \
+struct name { \
+ struct type *sqh_first; /* first element */ \
+ struct type **sqh_last; /* addr of last next element */ \
+}
+
+#define SIMPLEQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).sqh_first }
+
+#define SIMPLEQ_ENTRY(type) \
+struct { \
+ struct type *sqe_next; /* next element */ \
+}
+
+/*
+ * Simple queue functions.
+ */
+#define SIMPLEQ_INIT(head) do { \
+ (head)->sqh_first = NULL; \
+ (head)->sqh_last = &(head)->sqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+ (head)->sqh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.sqe_next = NULL; \
+ *(head)->sqh_last = (elm); \
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+ (listelm)->field.sqe_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
+ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
+ (head)->sqh_last = &(head)->sqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE(head, elm, type, field) do { \
+ if ((head)->sqh_first == (elm)) { \
+ SIMPLEQ_REMOVE_HEAD((head), field); \
+ } else { \
+ struct type *curelm = (head)->sqh_first; \
+ while (curelm->field.sqe_next != (elm)) \
+ curelm = curelm->field.sqe_next; \
+ if ((curelm->field.sqe_next = \
+ curelm->field.sqe_next->field.sqe_next) == NULL) \
+ (head)->sqh_last = &(curelm)->field.sqe_next; \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->sqh_first); \
+ (var); \
+ (var) = ((var)->field.sqe_next))
+
+/*
+ * Simple queue access methods.
+ */
+#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL)
+#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
+#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
+
+
+/*
+ * Tail queue definitions.
+ */
+#define _TAILQ_HEAD(name, type, qual) \
+struct name { \
+ qual type *tqh_first; /* first element */ \
+ qual type *qual *tqh_last; /* addr of last next element */ \
+}
+#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
+
+#define TAILQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).tqh_first }
+
+#define _TAILQ_ENTRY(type, qual) \
+struct { \
+ qual type *tqe_next; /* next element */ \
+ qual type *qual *tqe_prev; /* address of previous next element */\
+}
+#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
+
+/*
+ * Tail queue functions.
+ */
+#define TAILQ_INIT(head) do { \
+ (head)->tqh_first = NULL; \
+ (head)->tqh_last = &(head)->tqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
+ (head)->tqh_first->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (head)->tqh_first = (elm); \
+ (elm)->field.tqe_prev = &(head)->tqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.tqe_next = NULL; \
+ (elm)->field.tqe_prev = (head)->tqh_last; \
+ *(head)->tqh_last = (elm); \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
+ (elm)->field.tqe_next->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (listelm)->field.tqe_next = (elm); \
+ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
+ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
+ (elm)->field.tqe_next = (listelm); \
+ *(listelm)->field.tqe_prev = (elm); \
+ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_REMOVE(head, elm, field) do { \
+ if (((elm)->field.tqe_next) != NULL) \
+ (elm)->field.tqe_next->field.tqe_prev = \
+ (elm)->field.tqe_prev; \
+ else \
+ (head)->tqh_last = (elm)->field.tqe_prev; \
+ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->tqh_first); \
+ (var); \
+ (var) = ((var)->field.tqe_next))
+
+#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
+#define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
+ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ TAILQ_INIT((head2)); \
+ } \
+} while (/*CONSTCOND*/0)
+
+/*
+ * Tail queue access methods.
+ */
+#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
+#define TAILQ_FIRST(head) ((head)->tqh_first)
+#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#define TAILQ_LAST(head, headname) \
+ (*(((struct headname *)((head)->tqh_last))->tqh_last))
+#define TAILQ_PREV(elm, headname, field) \
+ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+
+/*
+ * Circular queue definitions.
+ */
+#define CIRCLEQ_HEAD(name, type) \
+struct name { \
+ struct type *cqh_first; /* first element */ \
+ struct type *cqh_last; /* last element */ \
+}
+
+#define CIRCLEQ_HEAD_INITIALIZER(head) \
+ { (void *)&head, (void *)&head }
+
+#define CIRCLEQ_ENTRY(type) \
+struct { \
+ struct type *cqe_next; /* next element */ \
+ struct type *cqe_prev; /* previous element */ \
+}
+
+/*
+ * Circular queue functions.
+ */
+#define CIRCLEQ_INIT(head) do { \
+ (head)->cqh_first = (void *)(head); \
+ (head)->cqh_last = (void *)(head); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ (elm)->field.cqe_next = (listelm)->field.cqe_next; \
+ (elm)->field.cqe_prev = (listelm); \
+ if ((listelm)->field.cqe_next == (void *)(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (listelm)->field.cqe_next->field.cqe_prev = (elm); \
+ (listelm)->field.cqe_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
+ (elm)->field.cqe_next = (listelm); \
+ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
+ if ((listelm)->field.cqe_prev == (void *)(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (listelm)->field.cqe_prev->field.cqe_next = (elm); \
+ (listelm)->field.cqe_prev = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.cqe_next = (head)->cqh_first; \
+ (elm)->field.cqe_prev = (void *)(head); \
+ if ((head)->cqh_last == (void *)(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (head)->cqh_first->field.cqe_prev = (elm); \
+ (head)->cqh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.cqe_next = (void *)(head); \
+ (elm)->field.cqe_prev = (head)->cqh_last; \
+ if ((head)->cqh_first == (void *)(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (head)->cqh_last->field.cqe_next = (elm); \
+ (head)->cqh_last = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_REMOVE(head, elm, field) do { \
+ if ((elm)->field.cqe_next == (void *)(head)) \
+ (head)->cqh_last = (elm)->field.cqe_prev; \
+ else \
+ (elm)->field.cqe_next->field.cqe_prev = \
+ (elm)->field.cqe_prev; \
+ if ((elm)->field.cqe_prev == (void *)(head)) \
+ (head)->cqh_first = (elm)->field.cqe_next; \
+ else \
+ (elm)->field.cqe_prev->field.cqe_next = \
+ (elm)->field.cqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->cqh_first); \
+ (var) != (const void *)(head); \
+ (var) = ((var)->field.cqe_next))
+
+#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
+ for ((var) = ((head)->cqh_last); \
+ (var) != (const void *)(head); \
+ (var) = ((var)->field.cqe_prev))
+
+/*
+ * Circular queue access methods.
+ */
+#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
+#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
+#define CIRCLEQ_LAST(head) ((head)->cqh_last)
+#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
+#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
+
+#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
+ (((elm)->field.cqe_next == (void *)(head)) \
+ ? ((head)->cqh_first) \
+ : (elm->field.cqe_next))
+#define CIRCLEQ_LOOP_PREV(head, elm, field) \
+ (((elm)->field.cqe_prev == (void *)(head)) \
+ ? ((head)->cqh_last) \
+ : (elm->field.cqe_prev))
+
+#endif /* sys/queue.h */
diff --git a/REORG.TODO/misc/sys/select.h b/REORG.TODO/misc/sys/select.h
new file mode 100644
index 0000000000..06dd31b476
--- /dev/null
+++ b/REORG.TODO/misc/sys/select.h
@@ -0,0 +1,128 @@
+/* `fd_set' type and related macros, and `select'/`pselect' declarations.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+/* POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h> */
+
+#ifndef _SYS_SELECT_H
+#define _SYS_SELECT_H 1
+
+#include <features.h>
+
+/* Get definition of needed basic types. */
+#include <bits/types.h>
+
+/* Get __FD_* definitions. */
+#include <bits/select.h>
+
+/* Get sigset_t. */
+#include <bits/types/sigset_t.h>
+
+/* Get definition of timer specification structures. */
+#include <bits/types/time_t.h>
+#include <bits/types/struct_timeval.h>
+#ifdef __USE_XOPEN2K
+# include <bits/types/struct_timespec.h>
+#endif
+
+#ifndef __suseconds_t_defined
+typedef __suseconds_t suseconds_t;
+# define __suseconds_t_defined
+#endif
+
+
+/* The fd_set member is required to be an array of longs. */
+typedef long int __fd_mask;
+
+/* Some versions of <linux/posix_types.h> define this macros. */
+#undef __NFDBITS
+/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
+#define __NFDBITS (8 * (int) sizeof (__fd_mask))
+#define __FD_ELT(d) ((d) / __NFDBITS)
+#define __FD_MASK(d) ((__fd_mask) (1UL << ((d) % __NFDBITS)))
+
+/* fd_set for select and pselect. */
+typedef struct
+ {
+ /* XPG4.2 requires this member name. Otherwise avoid the name
+ from the global namespace. */
+#ifdef __USE_XOPEN
+ __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
+# define __FDS_BITS(set) ((set)->fds_bits)
+#else
+ __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
+# define __FDS_BITS(set) ((set)->__fds_bits)
+#endif
+ } fd_set;
+
+/* Maximum number of file descriptors in `fd_set'. */
+#define FD_SETSIZE __FD_SETSIZE
+
+#ifdef __USE_MISC
+/* Sometimes the fd_set member is assumed to have this type. */
+typedef __fd_mask fd_mask;
+
+/* Number of bits per word of `fd_set' (some code assumes this is 32). */
+# define NFDBITS __NFDBITS
+#endif
+
+
+/* Access macros for `fd_set'. */
+#define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp)
+#define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp)
+#define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp)
+#define FD_ZERO(fdsetp) __FD_ZERO (fdsetp)
+
+
+__BEGIN_DECLS
+
+/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
+ readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
+ (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
+ after waiting the interval specified therein. Returns the number of ready
+ descriptors, or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int select (int __nfds, fd_set *__restrict __readfds,
+ fd_set *__restrict __writefds,
+ fd_set *__restrict __exceptfds,
+ struct timeval *__restrict __timeout);
+
+#ifdef __USE_XOPEN2K
+/* Same as above only that the TIMEOUT value is given with higher
+ resolution and a sigmask which is been set temporarily. This version
+ should be used.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int pselect (int __nfds, fd_set *__restrict __readfds,
+ fd_set *__restrict __writefds,
+ fd_set *__restrict __exceptfds,
+ const struct timespec *__restrict __timeout,
+ const __sigset_t *__restrict __sigmask);
+#endif
+
+
+/* Define some inlines helping to catch common problems. */
+#if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__
+# include <bits/select2.h>
+#endif
+
+__END_DECLS
+
+#endif /* sys/select.h */
diff --git a/REORG.TODO/misc/sys/syslog.h b/REORG.TODO/misc/sys/syslog.h
new file mode 100644
index 0000000000..ee01478c4b
--- /dev/null
+++ b/REORG.TODO/misc/sys/syslog.h
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 1982, 1986, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 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.
+ *
+ * @(#)syslog.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_SYSLOG_H
+#define _SYS_SYSLOG_H 1
+
+#include <features.h>
+#define __need___va_list
+#include <stdarg.h>
+
+/* This file defines _PATH_LOG. */
+#include <bits/syslog-path.h>
+
+/*
+ * priorities/facilities are encoded into a single 32-bit quantity, where the
+ * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
+ * (0-big number). Both the priorities and the facilities map roughly
+ * one-to-one to strings in the syslogd(8) source code. This mapping is
+ * included in this file.
+ *
+ * priorities (these are ordered)
+ */
+#define LOG_EMERG 0 /* system is unusable */
+#define LOG_ALERT 1 /* action must be taken immediately */
+#define LOG_CRIT 2 /* critical conditions */
+#define LOG_ERR 3 /* error conditions */
+#define LOG_WARNING 4 /* warning conditions */
+#define LOG_NOTICE 5 /* normal but significant condition */
+#define LOG_INFO 6 /* informational */
+#define LOG_DEBUG 7 /* debug-level messages */
+
+#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
+ /* extract priority */
+#define LOG_PRI(p) ((p) & LOG_PRIMASK)
+#define LOG_MAKEPRI(fac, pri) ((fac) | (pri))
+
+#ifdef SYSLOG_NAMES
+#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
+ /* mark "facility" */
+#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES << 3, 0)
+typedef struct _code {
+ char *c_name;
+ int c_val;
+} CODE;
+
+CODE prioritynames[] =
+ {
+ { "alert", LOG_ALERT },
+ { "crit", LOG_CRIT },
+ { "debug", LOG_DEBUG },
+ { "emerg", LOG_EMERG },
+ { "err", LOG_ERR },
+ { "error", LOG_ERR }, /* DEPRECATED */
+ { "info", LOG_INFO },
+ { "none", INTERNAL_NOPRI }, /* INTERNAL */
+ { "notice", LOG_NOTICE },
+ { "panic", LOG_EMERG }, /* DEPRECATED */
+ { "warn", LOG_WARNING }, /* DEPRECATED */
+ { "warning", LOG_WARNING },
+ { NULL, -1 }
+ };
+#endif
+
+/* facility codes */
+#define LOG_KERN (0<<3) /* kernel messages */
+#define LOG_USER (1<<3) /* random user-level messages */
+#define LOG_MAIL (2<<3) /* mail system */
+#define LOG_DAEMON (3<<3) /* system daemons */
+#define LOG_AUTH (4<<3) /* security/authorization messages */
+#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
+#define LOG_LPR (6<<3) /* line printer subsystem */
+#define LOG_NEWS (7<<3) /* network news subsystem */
+#define LOG_UUCP (8<<3) /* UUCP subsystem */
+#define LOG_CRON (9<<3) /* clock daemon */
+#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
+#define LOG_FTP (11<<3) /* ftp daemon */
+
+ /* other codes through 15 reserved for system use */
+#define LOG_LOCAL0 (16<<3) /* reserved for local use */
+#define LOG_LOCAL1 (17<<3) /* reserved for local use */
+#define LOG_LOCAL2 (18<<3) /* reserved for local use */
+#define LOG_LOCAL3 (19<<3) /* reserved for local use */
+#define LOG_LOCAL4 (20<<3) /* reserved for local use */
+#define LOG_LOCAL5 (21<<3) /* reserved for local use */
+#define LOG_LOCAL6 (22<<3) /* reserved for local use */
+#define LOG_LOCAL7 (23<<3) /* reserved for local use */
+
+#define LOG_NFACILITIES 24 /* current number of facilities */
+#define LOG_FACMASK 0x03f8 /* mask to extract facility part */
+ /* facility of pri */
+#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
+
+#ifdef SYSLOG_NAMES
+CODE facilitynames[] =
+ {
+ { "auth", LOG_AUTH },
+ { "authpriv", LOG_AUTHPRIV },
+ { "cron", LOG_CRON },
+ { "daemon", LOG_DAEMON },
+ { "ftp", LOG_FTP },
+ { "kern", LOG_KERN },
+ { "lpr", LOG_LPR },
+ { "mail", LOG_MAIL },
+ { "mark", INTERNAL_MARK }, /* INTERNAL */
+ { "news", LOG_NEWS },
+ { "security", LOG_AUTH }, /* DEPRECATED */
+ { "syslog", LOG_SYSLOG },
+ { "user", LOG_USER },
+ { "uucp", LOG_UUCP },
+ { "local0", LOG_LOCAL0 },
+ { "local1", LOG_LOCAL1 },
+ { "local2", LOG_LOCAL2 },
+ { "local3", LOG_LOCAL3 },
+ { "local4", LOG_LOCAL4 },
+ { "local5", LOG_LOCAL5 },
+ { "local6", LOG_LOCAL6 },
+ { "local7", LOG_LOCAL7 },
+ { NULL, -1 }
+ };
+#endif
+
+/*
+ * arguments to setlogmask.
+ */
+#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
+#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
+
+/*
+ * Option flags for openlog.
+ *
+ * LOG_ODELAY no longer does anything.
+ * LOG_NDELAY is the inverse of what it used to be.
+ */
+#define LOG_PID 0x01 /* log the pid with each message */
+#define LOG_CONS 0x02 /* log on the console if errors in sending */
+#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
+#define LOG_NDELAY 0x08 /* don't delay open */
+#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
+#define LOG_PERROR 0x20 /* log to stderr as well */
+
+__BEGIN_DECLS
+
+/* Close descriptor used to write to system logger.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern void closelog (void);
+
+/* Open connection to system logger.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern void openlog (const char *__ident, int __option, int __facility);
+
+/* Set the log mask level. */
+extern int setlogmask (int __mask) __THROW;
+
+/* Generate a log message using FMT string and option arguments.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern void syslog (int __pri, const char *__fmt, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+
+#ifdef __USE_MISC
+/* Generate a log message using FMT and using arguments pointed to by AP.
+
+ 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 vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
+#endif
+
+
+/* Define some macros helping to catch buffer overflows. */
+#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
+# include <bits/syslog.h>
+#endif
+#ifdef __LDBL_COMPAT
+# include <bits/syslog-ldbl.h>
+#endif
+
+__END_DECLS
+
+#endif /* sys/syslog.h */
diff --git a/REORG.TODO/misc/sys/sysmacros.h b/REORG.TODO/misc/sys/sysmacros.h
new file mode 100644
index 0000000000..8cacc595e7
--- /dev/null
+++ b/REORG.TODO/misc/sys/sysmacros.h
@@ -0,0 +1,110 @@
+/* Definitions of macros to access `dev_t' values.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_SYSMACROS_H_OUTER
+
+#ifndef __SYSMACROS_DEPRECATED_INCLUSION
+# define _SYS_SYSMACROS_H_OUTER 1
+#endif
+
+/* If <sys/sysmacros.h> is included after <sys/types.h>, these macros
+ will already be defined, and we need to redefine them without the
+ deprecation warnings. (If they are included in the opposite order,
+ the outer #ifndef will suppress this entire file and the macros
+ will be usable without warnings.) */
+#undef major
+#undef minor
+#undef makedev
+
+/* This is the macro that must be defined to satisfy the misuse check
+ in bits/sysmacros.h. */
+#ifndef _SYS_SYSMACROS_H
+#define _SYS_SYSMACROS_H 1
+
+#include <features.h>
+#include <bits/types.h>
+#include <bits/sysmacros.h>
+
+/* Caution: The text of this deprecation message is unquoted, so that
+ #symbol can be substituted. (It is converted to a string by
+ __SYSMACROS_DM1.) This means the message must be a sequence of
+ complete pp-tokens; in particular, English contractions (it's,
+ can't) cannot be used.
+
+ The message has been manually word-wrapped to fit in 80 columns
+ when output by GCC 5 and 6. The first line is shorter to leave
+ some room for the "foo.c:23: warning:" annotation. */
+#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
+ (In the GNU C Library, #symbol is defined\n\
+ by <sys/sysmacros.h>. For historical compatibility, it is\n\
+ currently defined by <sys/types.h> as well, but we plan to\n\
+ remove this soon. To use #symbol, include <sys/sysmacros.h>\n\
+ directly. If you did not intend to use a system-defined macro\n\
+ #symbol, you should undefine it after including <sys/types.h>.)
+
+/* This macro is variadic because the deprecation message above
+ contains commas. */
+#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
+
+#define __SYSMACROS_DECL_TEMPL(rtype, name, proto) \
+ extern rtype gnu_dev_##name proto __THROW __attribute_const__;
+
+#define __SYSMACROS_IMPL_TEMPL(rtype, name, proto) \
+ __extension__ __extern_inline __attribute_const__ rtype \
+ __NTH (gnu_dev_##name proto)
+
+__BEGIN_DECLS
+
+__SYSMACROS_DECLARE_MAJOR (__SYSMACROS_DECL_TEMPL)
+__SYSMACROS_DECLARE_MINOR (__SYSMACROS_DECL_TEMPL)
+__SYSMACROS_DECLARE_MAKEDEV (__SYSMACROS_DECL_TEMPL)
+
+#ifdef __USE_EXTERN_INLINES
+
+__SYSMACROS_DEFINE_MAJOR (__SYSMACROS_IMPL_TEMPL)
+__SYSMACROS_DEFINE_MINOR (__SYSMACROS_IMPL_TEMPL)
+__SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_IMPL_TEMPL)
+
+#endif
+
+__END_DECLS
+
+#endif /* _SYS_SYSMACROS_H */
+
+#ifndef __SYSMACROS_NEED_IMPLEMENTATION
+# undef __SYSMACROS_DECL_TEMPL
+# undef __SYSMACROS_IMPL_TEMPL
+# undef __SYSMACROS_DECLARE_MAJOR
+# undef __SYSMACROS_DECLARE_MINOR
+# undef __SYSMACROS_DECLARE_MAKEDEV
+# undef __SYSMACROS_DEFINE_MAJOR
+# undef __SYSMACROS_DEFINE_MINOR
+# undef __SYSMACROS_DEFINE_MAKEDEV
+#endif
+
+#ifdef __SYSMACROS_DEPRECATED_INCLUSION
+# define major(dev) __SYSMACROS_DM (major) gnu_dev_major (dev)
+# define minor(dev) __SYSMACROS_DM (minor) gnu_dev_minor (dev)
+# define makedev(maj, min) __SYSMACROS_DM (makedev) gnu_dev_makedev (maj, min)
+#else
+# define major(dev) gnu_dev_major (dev)
+# define minor(dev) gnu_dev_minor (dev)
+# define makedev(maj, min) gnu_dev_makedev (maj, min)
+#endif
+
+#endif /* sys/sysmacros.h */
diff --git a/REORG.TODO/misc/sys/uio.h b/REORG.TODO/misc/sys/uio.h
new file mode 100644
index 0000000000..66c22f04f6
--- /dev/null
+++ b/REORG.TODO/misc/sys/uio.h
@@ -0,0 +1,163 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_UIO_H
+#define _SYS_UIO_H 1
+
+#include <features.h>
+
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+/* This file defines `struct iovec'. */
+#include <bits/uio.h>
+
+
+/* Read data from file descriptor FD, and put the result in the
+ buffers described by IOVEC, which is a vector of COUNT 'struct iovec's.
+ The buffers are filled in the order specified.
+ Operates just like 'read' (see <unistd.h>) except that data are
+ put in IOVEC instead of a contiguous buffer.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count)
+ __wur;
+
+/* Write data pointed by the buffers described by IOVEC, which
+ is a vector of COUNT 'struct iovec's, to file descriptor FD.
+ The data is written in the order specified.
+ Operates just like 'write' (see <unistd.h>) except that the data
+ are taken from IOVEC instead of a contiguous buffer.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count)
+ __wur;
+
+
+#ifdef __USE_MISC
+# ifndef __USE_FILE_OFFSET64
+/* Read data from file descriptor FD at the given position OFFSET
+ without change the file pointer, and put the result in the buffers
+ described by IOVEC, which is a vector of COUNT 'struct iovec's.
+ The buffers are filled in the order specified. Operates just like
+ 'pread' (see <unistd.h>) except that data are put in IOVEC instead
+ of a contiguous buffer.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
+ __off_t __offset) __wur;
+
+/* Write data pointed by the buffers described by IOVEC, which is a
+ vector of COUNT 'struct iovec's, to file descriptor FD at the given
+ position OFFSET without change the file pointer. The data is
+ written in the order specified. Operates just like 'pwrite' (see
+ <unistd.h>) except that the data are taken from IOVEC instead of a
+ contiguous buffer.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
+ __off_t __offset) __wur;
+
+# else
+# ifdef __REDIRECT
+extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec,
+ int __count, __off64_t __offset),
+ preadv64) __wur;
+extern ssize_t __REDIRECT (pwritev, (int __fd, const struct iovec *__iovec,
+ int __count, __off64_t __offset),
+ pwritev64) __wur;
+# else
+# define preadv preadv64
+# define pwritev pwritev64
+# endif
+# endif
+
+# ifdef __USE_LARGEFILE64
+/* Read data from file descriptor FD at the given position OFFSET
+ without change the file pointer, and put the result in the buffers
+ described by IOVEC, which is a vector of COUNT 'struct iovec's.
+ The buffers are filled in the order specified. Operates just like
+ 'pread' (see <unistd.h>) except that data are put in IOVEC instead
+ of a contiguous buffer.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count,
+ __off64_t __offset) __wur;
+
+/* Write data pointed by the buffers described by IOVEC, which is a
+ vector of COUNT 'struct iovec's, to file descriptor FD at the given
+ position OFFSET without change the file pointer. The data is
+ written in the order specified. Operates just like 'pwrite' (see
+ <unistd.h>) except that the data are taken from IOVEC instead of a
+ contiguous buffer.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count,
+ __off64_t __offset) __wur;
+# endif
+#endif /* Use misc. */
+
+
+#ifdef __USE_GNU
+# ifndef __USE_FILE_OFFSET64
+/* Same as preadv but with an additional flag argumenti defined at uio.h. */
+extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count,
+ __off_t __offset, int ___flags) __wur;
+
+/* Same as preadv but with an additional flag argument defined at uio.h. */
+extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count,
+ __off_t __offset, int __flags) __wur;
+
+# else
+# ifdef __REDIRECT
+extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec,
+ int __count, __off64_t __offset,
+ int __flags),
+ pwritev64v2) __wur;
+extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec,
+ int __count, __off64_t __offset,
+ int __flags),
+ preadv64v2) __wur;
+# else
+# define preadv2 preadv64v2
+# define pwritev2 pwritev64v2
+# endif
+# endif
+
+# ifdef __USE_LARGEFILE64
+/* Same as preadv but with an additional flag argumenti defined at uio.h. */
+extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec,
+ int __count, __off64_t __offset,
+ int ___flags) __wur;
+
+/* Same as preadv but with an additional flag argument defined at uio.h. */
+extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev,
+ int __count, __off64_t __offset,
+ int __flags) __wur;
+# endif
+#endif /* Use GNU. */
+
+__END_DECLS
+
+#endif /* sys/uio.h */
diff --git a/REORG.TODO/misc/sys/ustat.h b/REORG.TODO/misc/sys/ustat.h
new file mode 100644
index 0000000000..8aef9aeddb
--- /dev/null
+++ b/REORG.TODO/misc/sys/ustat.h
@@ -0,0 +1,37 @@
+/* Header describing obsolete `ustat' interface.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+/*
+ * This interface is obsolete. Use <sys/statfs.h> instead.
+ */
+
+#ifndef _SYS_USTAT_H
+#define _SYS_USTAT_H 1
+
+#include <features.h>
+
+#include <sys/types.h>
+#include <bits/ustat.h>
+
+__BEGIN_DECLS
+
+extern int ustat (__dev_t __dev, struct ustat *__ubuf) __THROW;
+
+__END_DECLS
+
+#endif /* sys/ustat.h */
diff --git a/REORG.TODO/misc/sys/xattr.h b/REORG.TODO/misc/sys/xattr.h
new file mode 100644
index 0000000000..f5d639833a
--- /dev/null
+++ b/REORG.TODO/misc/sys/xattr.h
@@ -0,0 +1,105 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_XATTR_H
+#define _SYS_XATTR_H 1
+
+#include <features.h>
+#include <sys/types.h>
+
+
+__BEGIN_DECLS
+
+/* The following constants should be used for the fifth parameter of
+ `*setxattr'. */
+#ifndef __USE_KERNEL_XATTR_DEFS
+enum
+{
+ XATTR_CREATE = 1, /* set value, fail if attr already exists. */
+#define XATTR_CREATE XATTR_CREATE
+ XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */
+#define XATTR_REPLACE XATTR_REPLACE
+};
+#endif
+
+/* Set the attribute NAME of the file pointed to by PATH to VALUE (which
+ is SIZE bytes long). Return 0 on success, -1 for errors. */
+extern int setxattr (const char *__path, const char *__name,
+ const void *__value, size_t __size, int __flags)
+ __THROW;
+
+/* Set the attribute NAME of the file pointed to by PATH to VALUE (which is
+ SIZE bytes long), not following symlinks for the last pathname component.
+ Return 0 on success, -1 for errors. */
+extern int lsetxattr (const char *__path, const char *__name,
+ const void *__value, size_t __size, int __flags)
+ __THROW;
+
+/* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE
+ bytes long). Return 0 on success, -1 for errors. */
+extern int fsetxattr (int __fd, const char *__name, const void *__value,
+ size_t __size, int __flags) __THROW;
+
+/* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
+ SIZE bytes long). Return 0 on success, -1 for errors. */
+extern ssize_t getxattr (const char *__path, const char *__name,
+ void *__value, size_t __size) __THROW;
+
+/* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
+ SIZE bytes long), not following symlinks for the last pathname component.
+ Return 0 on success, -1 for errors. */
+extern ssize_t lgetxattr (const char *__path, const char *__name,
+ void *__value, size_t __size) __THROW;
+
+/* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE
+ bytes long). Return 0 on success, -1 for errors. */
+extern ssize_t fgetxattr (int __fd, const char *__name, void *__value,
+ size_t __size) __THROW;
+
+/* List attributes of the file pointed to by PATH into the user-supplied
+ buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for
+ errors. */
+extern ssize_t listxattr (const char *__path, char *__list, size_t __size)
+ __THROW;
+
+/* List attributes of the file pointed to by PATH into the user-supplied
+ buffer LIST (which is SIZE bytes big), not following symlinks for the
+ last pathname component. Return 0 on success, -1 for errors. */
+extern ssize_t llistxattr (const char *__path, char *__list, size_t __size)
+ __THROW;
+
+/* List attributes of the file descriptor FD into the user-supplied buffer
+ LIST (which is SIZE bytes big). Return 0 on success, -1 for errors. */
+extern ssize_t flistxattr (int __fd, char *__list, size_t __size)
+ __THROW;
+
+/* Remove the attribute NAME from the file pointed to by PATH. Return 0
+ on success, -1 for errors. */
+extern int removexattr (const char *__path, const char *__name) __THROW;
+
+/* Remove the attribute NAME from the file pointed to by PATH, not
+ following symlinks for the last pathname component. Return 0 on
+ success, -1 for errors. */
+extern int lremovexattr (const char *__path, const char *__name) __THROW;
+
+/* Remove the attribute NAME from the file descriptor FD. Return 0 on
+ success, -1 for errors. */
+extern int fremovexattr (int __fd, const char *__name) __THROW;
+
+__END_DECLS
+
+#endif /* sys/xattr.h */
diff --git a/REORG.TODO/misc/syscall.c b/REORG.TODO/misc/syscall.c
new file mode 100644
index 0000000000..bce222ea66
--- /dev/null
+++ b/REORG.TODO/misc/syscall.c
@@ -0,0 +1,32 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Do system call CALLNO, passing it the remaining arguments.
+ This only makes sense in certain operating systems. */
+
+long int
+syscall (long int callno, ...)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (syscall)
diff --git a/REORG.TODO/misc/syscall.h b/REORG.TODO/misc/syscall.h
new file mode 100644
index 0000000000..4c30578447
--- /dev/null
+++ b/REORG.TODO/misc/syscall.h
@@ -0,0 +1 @@
+#include <sys/syscall.h>
diff --git a/REORG.TODO/misc/sysexits.h b/REORG.TODO/misc/sysexits.h
new file mode 100644
index 0000000000..37246b6e75
--- /dev/null
+++ b/REORG.TODO/misc/sysexits.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1987, 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.
+ *
+ * @(#)sysexits.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYSEXITS_H
+#define _SYSEXITS_H 1
+
+/*
+ * SYSEXITS.H -- Exit status codes for system programs.
+ *
+ * This include file attempts to categorize possible error
+ * exit statuses for system programs, notably delivermail
+ * and the Berkeley network.
+ *
+ * Error numbers begin at EX__BASE to reduce the possibility of
+ * clashing with other exit statuses that random programs may
+ * already return. The meaning of the codes is approximately
+ * as follows:
+ *
+ * EX_USAGE -- The command was used incorrectly, e.g., with
+ * the wrong number of arguments, a bad flag, a bad
+ * syntax in a parameter, or whatever.
+ * EX_DATAERR -- The input data was incorrect in some way.
+ * This should only be used for user's data & not
+ * system files.
+ * EX_NOINPUT -- An input file (not a system file) did not
+ * exist or was not readable. This could also include
+ * errors like "No message" to a mailer (if it cared
+ * to catch it).
+ * EX_NOUSER -- The user specified did not exist. This might
+ * be used for mail addresses or remote logins.
+ * EX_NOHOST -- The host specified did not exist. This is used
+ * in mail addresses or network requests.
+ * EX_UNAVAILABLE -- A service is unavailable. This can occur
+ * if a support program or file does not exist. This
+ * can also be used as a catchall message when something
+ * you wanted to do doesn't work, but you don't know
+ * why.
+ * EX_SOFTWARE -- An internal software error has been detected.
+ * This should be limited to non-operating system related
+ * errors as possible.
+ * EX_OSERR -- An operating system error has been detected.
+ * This is intended to be used for such things as "cannot
+ * fork", "cannot create pipe", or the like. It includes
+ * things like getuid returning a user that does not
+ * exist in the passwd file.
+ * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
+ * etc.) does not exist, cannot be opened, or has some
+ * sort of error (e.g., syntax error).
+ * EX_CANTCREAT -- A (user specified) output file cannot be
+ * created.
+ * EX_IOERR -- An error occurred while doing I/O on some file.
+ * EX_TEMPFAIL -- temporary failure, indicating something that
+ * is not really an error. In sendmail, this means
+ * that a mailer (e.g.) could not create a connection,
+ * and the request should be reattempted later.
+ * EX_PROTOCOL -- the remote system returned something that
+ * was "not possible" during a protocol exchange.
+ * EX_NOPERM -- You did not have sufficient permission to
+ * perform the operation. This is not intended for
+ * file system problems, which should use NOINPUT or
+ * CANTCREAT, but rather for higher level permissions.
+ */
+
+#define EX_OK 0 /* successful termination */
+
+#define EX__BASE 64 /* base value for error messages */
+
+#define EX_USAGE 64 /* command line usage error */
+#define EX_DATAERR 65 /* data format error */
+#define EX_NOINPUT 66 /* cannot open input */
+#define EX_NOUSER 67 /* addressee unknown */
+#define EX_NOHOST 68 /* host name unknown */
+#define EX_UNAVAILABLE 69 /* service unavailable */
+#define EX_SOFTWARE 70 /* internal software error */
+#define EX_OSERR 71 /* system error (e.g., can't fork) */
+#define EX_OSFILE 72 /* critical OS file missing */
+#define EX_CANTCREAT 73 /* can't create (user) output file */
+#define EX_IOERR 74 /* input/output error */
+#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
+#define EX_PROTOCOL 76 /* remote error in protocol */
+#define EX_NOPERM 77 /* permission denied */
+#define EX_CONFIG 78 /* configuration error */
+
+#define EX__MAX 78 /* maximum listed value */
+
+#endif /* sysexits.h */
diff --git a/REORG.TODO/misc/syslog.c b/REORG.TODO/misc/syslog.c
new file mode 100644
index 0000000000..6922ad685c
--- /dev/null
+++ b/REORG.TODO/misc/syslog.c
@@ -0,0 +1,436 @@
+/*
+ * Copyright (c) 1983, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/syslog.h>
+#include <sys/uio.h>
+#include <sys/un.h>
+#include <netdb.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <libc-lock.h>
+#include <signal.h>
+#include <locale.h>
+
+#include <stdarg.h>
+
+#include <libio/iolibio.h>
+#include <math_ldbl_opt.h>
+
+#include <kernel-features.h>
+
+#define ftell(s) _IO_ftell (s)
+
+static int LogType = SOCK_DGRAM; /* type of socket connection */
+static int LogFile = -1; /* fd for log */
+static int connected; /* have done connect */
+static int LogStat; /* status bits, set by openlog() */
+static const char *LogTag; /* string to tag the entry with */
+static int LogFacility = LOG_USER; /* default facility code */
+static int LogMask = 0xff; /* mask of priorities to be logged */
+extern char *__progname; /* Program name, from crt0. */
+
+/* Define the lock. */
+__libc_lock_define_initialized (static, syslog_lock)
+
+static void openlog_internal(const char *, int, int) internal_function;
+static void closelog_internal(void);
+#ifndef NO_SIGPIPE
+static void sigpipe_handler (int);
+#endif
+
+#ifndef send_flags
+# define send_flags 0
+#endif
+
+struct cleanup_arg
+{
+ void *buf;
+ struct sigaction *oldaction;
+};
+
+static void
+cancel_handler (void *ptr)
+{
+#ifndef NO_SIGPIPE
+ /* Restore the old signal handler. */
+ struct cleanup_arg *clarg = (struct cleanup_arg *) ptr;
+
+ if (clarg != NULL && clarg->oldaction != NULL)
+ __sigaction (SIGPIPE, clarg->oldaction, NULL);
+#endif
+
+ /* Free the lock. */
+ __libc_lock_unlock (syslog_lock);
+}
+
+
+/*
+ * syslog, vsyslog --
+ * print message on log file; output is intended for syslogd(8).
+ */
+void
+__syslog(int pri, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ __vsyslog_chk(pri, -1, fmt, ap);
+ va_end(ap);
+}
+ldbl_hidden_def (__syslog, syslog)
+ldbl_strong_alias (__syslog, syslog)
+
+void
+__syslog_chk(int pri, int flag, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ __vsyslog_chk(pri, flag, fmt, ap);
+ va_end(ap);
+}
+
+void
+__vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
+{
+ struct tm now_tm;
+ time_t now;
+ int fd;
+ FILE *f;
+ char *buf = 0;
+ size_t bufsize = 0;
+ size_t msgoff;
+#ifndef NO_SIGPIPE
+ struct sigaction action, oldaction;
+ int sigpipe;
+#endif
+ int saved_errno = errno;
+ char failbuf[3 * sizeof (pid_t) + sizeof "out of memory []"];
+
+#define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
+ /* Check for invalid bits. */
+ if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
+ syslog(INTERNALLOG,
+ "syslog: unknown facility/priority: %x", pri);
+ pri &= LOG_PRIMASK|LOG_FACMASK;
+ }
+
+ /* Check priority against setlogmask values. */
+ if ((LOG_MASK (LOG_PRI (pri)) & LogMask) == 0)
+ return;
+
+ /* Set default facility if none specified. */
+ if ((pri & LOG_FACMASK) == 0)
+ pri |= LogFacility;
+
+ /* Build the message in a memory-buffer stream. */
+ f = __open_memstream (&buf, &bufsize);
+ if (f == NULL)
+ {
+ /* We cannot get a stream. There is not much we can do but
+ emitting an error messages. */
+ char numbuf[3 * sizeof (pid_t)];
+ char *nump;
+ char *endp = __stpcpy (failbuf, "out of memory [");
+ pid_t pid = __getpid ();
+
+ nump = numbuf + sizeof (numbuf);
+ /* The PID can never be zero. */
+ do
+ *--nump = '0' + pid % 10;
+ while ((pid /= 10) != 0);
+
+ endp = __mempcpy (endp, nump, (numbuf + sizeof (numbuf)) - nump);
+ *endp++ = ']';
+ *endp = '\0';
+ buf = failbuf;
+ bufsize = endp - failbuf;
+ msgoff = 0;
+ }
+ else
+ {
+ __fsetlocking (f, FSETLOCKING_BYCALLER);
+ fprintf (f, "<%d>", pri);
+ (void) time (&now);
+ f->_IO_write_ptr += __strftime_l (f->_IO_write_ptr,
+ f->_IO_write_end
+ - f->_IO_write_ptr,
+ "%h %e %T ",
+ __localtime_r (&now, &now_tm),
+ _nl_C_locobj_ptr);
+ msgoff = ftell (f);
+ if (LogTag == NULL)
+ LogTag = __progname;
+ if (LogTag != NULL)
+ __fputs_unlocked (LogTag, f);
+ if (LogStat & LOG_PID)
+ fprintf (f, "[%d]", (int) __getpid ());
+ if (LogTag != NULL)
+ {
+ putc_unlocked (':', f);
+ putc_unlocked (' ', f);
+ }
+
+ /* Restore errno for %m format. */
+ __set_errno (saved_errno);
+
+ /* We have the header. Print the user's format into the
+ buffer. */
+ if (flag == -1)
+ vfprintf (f, fmt, ap);
+ else
+ __vfprintf_chk (f, flag, fmt, ap);
+
+ /* Close the memory stream; this will finalize the data
+ into a malloc'd buffer in BUF. */
+ fclose (f);
+ }
+
+ /* Output to stderr if requested. */
+ if (LogStat & LOG_PERROR) {
+ struct iovec iov[2];
+ struct iovec *v = iov;
+
+ v->iov_base = buf + msgoff;
+ v->iov_len = bufsize - msgoff;
+ /* Append a newline if necessary. */
+ if (buf[bufsize - 1] != '\n')
+ {
+ ++v;
+ v->iov_base = (char *) "\n";
+ v->iov_len = 1;
+ }
+
+ __libc_cleanup_push (free, buf == failbuf ? NULL : buf);
+
+ /* writev is a cancellation point. */
+ (void)__writev(STDERR_FILENO, iov, v - iov + 1);
+
+ __libc_cleanup_pop (0);
+ }
+
+ /* Prepare for multiple users. We have to take care: open and
+ write are cancellation points. */
+ struct cleanup_arg clarg;
+ clarg.buf = buf;
+ clarg.oldaction = NULL;
+ __libc_cleanup_push (cancel_handler, &clarg);
+ __libc_lock_lock (syslog_lock);
+
+#ifndef NO_SIGPIPE
+ /* Prepare for a broken connection. */
+ memset (&action, 0, sizeof (action));
+ action.sa_handler = sigpipe_handler;
+ sigemptyset (&action.sa_mask);
+ sigpipe = __sigaction (SIGPIPE, &action, &oldaction);
+ if (sigpipe == 0)
+ clarg.oldaction = &oldaction;
+#endif
+
+ /* Get connected, output the message to the local logger. */
+ if (!connected)
+ openlog_internal(LogTag, LogStat | LOG_NDELAY, 0);
+
+ /* If we have a SOCK_STREAM connection, also send ASCII NUL as
+ a record terminator. */
+ if (LogType == SOCK_STREAM)
+ ++bufsize;
+
+ if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0)
+ {
+ if (connected)
+ {
+ /* Try to reopen the syslog connection. Maybe it went
+ down. */
+ closelog_internal ();
+ openlog_internal(LogTag, LogStat | LOG_NDELAY, 0);
+ }
+
+ if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0)
+ {
+ closelog_internal (); /* attempt re-open next time */
+ /*
+ * Output the message to the console; don't worry
+ * about blocking, if console blocks everything will.
+ * Make sure the error reported is the one from the
+ * syslogd failure.
+ */
+ if (LogStat & LOG_CONS &&
+ (fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
+ {
+ __dprintf (fd, "%s\r\n", buf + msgoff);
+ (void)__close(fd);
+ }
+ }
+ }
+
+#ifndef NO_SIGPIPE
+ if (sigpipe == 0)
+ __sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
+#endif
+
+ /* End of critical section. */
+ __libc_cleanup_pop (0);
+ __libc_lock_unlock (syslog_lock);
+
+ if (buf != failbuf)
+ free (buf);
+}
+libc_hidden_def (__vsyslog_chk)
+
+void
+__vsyslog(int pri, const char *fmt, va_list ap)
+{
+ __vsyslog_chk (pri, -1, fmt, ap);
+}
+ldbl_hidden_def (__vsyslog, vsyslog)
+ldbl_weak_alias (__vsyslog, vsyslog)
+
+static struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
+
+
+static void
+internal_function
+openlog_internal(const char *ident, int logstat, int logfac)
+{
+ if (ident != NULL)
+ LogTag = ident;
+ LogStat = logstat;
+ if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
+ LogFacility = logfac;
+
+ int retry = 0;
+ while (retry < 2) {
+ if (LogFile == -1) {
+ SyslogAddr.sun_family = AF_UNIX;
+ (void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
+ sizeof(SyslogAddr.sun_path));
+ if (LogStat & LOG_NDELAY) {
+ LogFile = __socket(AF_UNIX, LogType | SOCK_CLOEXEC, 0);
+ if (LogFile == -1)
+ return;
+ }
+ }
+ if (LogFile != -1 && !connected)
+ {
+ int old_errno = errno;
+ if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr))
+ == -1)
+ {
+ int saved_errno = errno;
+ int fd = LogFile;
+ LogFile = -1;
+ (void)__close(fd);
+ __set_errno (old_errno);
+ if (saved_errno == EPROTOTYPE)
+ {
+ /* retry with the other type: */
+ LogType = (LogType == SOCK_DGRAM
+ ? SOCK_STREAM : SOCK_DGRAM);
+ ++retry;
+ continue;
+ }
+ } else
+ connected = 1;
+ }
+ break;
+ }
+}
+
+void
+openlog (const char *ident, int logstat, int logfac)
+{
+ /* Protect against multiple users and cancellation. */
+ __libc_cleanup_push (cancel_handler, NULL);
+ __libc_lock_lock (syslog_lock);
+
+ openlog_internal (ident, logstat, logfac);
+
+ __libc_cleanup_pop (1);
+}
+
+#ifndef NO_SIGPIPE
+static void
+sigpipe_handler (int signo)
+{
+ closelog_internal ();
+}
+#endif
+
+static void
+closelog_internal (void)
+{
+ if (!connected)
+ return;
+
+ __close (LogFile);
+ LogFile = -1;
+ connected = 0;
+}
+
+void
+closelog (void)
+{
+ /* Protect against multiple users and cancellation. */
+ __libc_cleanup_push (cancel_handler, NULL);
+ __libc_lock_lock (syslog_lock);
+
+ closelog_internal ();
+ LogTag = NULL;
+ LogType = SOCK_DGRAM; /* this is the default */
+
+ /* Free the lock. */
+ __libc_cleanup_pop (1);
+}
+
+/* setlogmask -- set the log mask level */
+int
+setlogmask (int pmask)
+{
+ int omask;
+
+ omask = LogMask;
+ if (pmask != 0)
+ LogMask = pmask;
+ return (omask);
+}
diff --git a/REORG.TODO/misc/syslog.h b/REORG.TODO/misc/syslog.h
new file mode 100644
index 0000000000..830b4928ad
--- /dev/null
+++ b/REORG.TODO/misc/syslog.h
@@ -0,0 +1 @@
+#include <sys/syslog.h>
diff --git a/REORG.TODO/misc/truncate.c b/REORG.TODO/misc/truncate.c
new file mode 100644
index 0000000000..e5df1dbbd3
--- /dev/null
+++ b/REORG.TODO/misc/truncate.c
@@ -0,0 +1,30 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <errno.h>
+
+/* Truncate PATH to LENGTH bytes. */
+int
+__truncate (const char *path, off_t length)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__truncate, truncate)
+
+stub_warning (truncate)
diff --git a/REORG.TODO/misc/truncate64.c b/REORG.TODO/misc/truncate64.c
new file mode 100644
index 0000000000..220f89a6e7
--- /dev/null
+++ b/REORG.TODO/misc/truncate64.c
@@ -0,0 +1,32 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Truncate PATH to LENGTH bytes. */
+int
+truncate64 (const char *path, off64_t length)
+{
+ if ((off_t) length != length)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+ return __truncate (path, (off_t) length);
+}
diff --git a/REORG.TODO/misc/tsearch.c b/REORG.TODO/misc/tsearch.c
new file mode 100644
index 0000000000..5e2e7986d3
--- /dev/null
+++ b/REORG.TODO/misc/tsearch.c
@@ -0,0 +1,750 @@
+/* Copyright (C) 1995-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Tree search for red/black trees.
+ The algorithm for adding nodes is taken from one of the many "Algorithms"
+ books by Robert Sedgewick, although the implementation differs.
+ The algorithm for deleting nodes can probably be found in a book named
+ "Introduction to Algorithms" by Cormen/Leiserson/Rivest. At least that's
+ the book that my professor took most algorithms from during the "Data
+ Structures" course...
+
+ Totally public domain. */
+
+/* Red/black trees are binary trees in which the edges are colored either red
+ or black. They have the following properties:
+ 1. The number of black edges on every path from the root to a leaf is
+ constant.
+ 2. No two red edges are adjacent.
+ Therefore there is an upper bound on the length of every path, it's
+ O(log n) where n is the number of nodes in the tree. No path can be longer
+ than 1+2*P where P is the length of the shortest path in the tree.
+ Useful for the implementation:
+ 3. If one of the children of a node is NULL, then the other one is red
+ (if it exists).
+
+ In the implementation, not the edges are colored, but the nodes. The color
+ interpreted as the color of the edge leading to this node. The color is
+ meaningless for the root node, but we color the root node black for
+ convenience. All added nodes are red initially.
+
+ Adding to a red/black tree is rather easy. The right place is searched
+ with a usual binary tree search. Additionally, whenever a node N is
+ reached that has two red successors, the successors are colored black and
+ the node itself colored red. This moves red edges up the tree where they
+ pose less of a problem once we get to really insert the new node. Changing
+ N's color to red may violate rule 2, however, so rotations may become
+ necessary to restore the invariants. Adding a new red leaf may violate
+ the same rule, so afterwards an additional check is run and the tree
+ possibly rotated.
+
+ Deleting is hairy. There are mainly two nodes involved: the node to be
+ deleted (n1), and another node that is to be unchained from the tree (n2).
+ If n1 has a successor (the node with a smallest key that is larger than
+ n1), then the successor becomes n2 and its contents are copied into n1,
+ otherwise n1 becomes n2.
+ Unchaining a node may violate rule 1: if n2 is black, one subtree is
+ missing one black edge afterwards. The algorithm must try to move this
+ error upwards towards the root, so that the subtree that does not have
+ enough black edges becomes the whole tree. Once that happens, the error
+ has disappeared. It may not be necessary to go all the way up, since it
+ is possible that rotations and recoloring can fix the error before that.
+
+ Although the deletion algorithm must walk upwards through the tree, we
+ do not store parent pointers in the nodes. Instead, delete allocates a
+ small array of parent pointers and fills it while descending the tree.
+ Since we know that the length of a path is O(log n), where n is the number
+ of nodes, this is likely to use less memory. */
+
+/* Tree rotations look like this:
+ A C
+ / \ / \
+ B C A G
+ / \ / \ --> / \
+ D E F G B F
+ / \
+ D E
+
+ In this case, A has been rotated left. This preserves the ordering of the
+ binary tree. */
+
+#include <assert.h>
+#include <stdalign.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <search.h>
+
+/* Assume malloc returns naturally aligned (alignof (max_align_t))
+ pointers so we can use the low bits to store some extra info. This
+ works for the left/right node pointers since they are not user
+ visible and always allocated by malloc. The user provides the key
+ pointer and so that can point anywhere and doesn't have to be
+ aligned. */
+#define USE_MALLOC_LOW_BIT 1
+
+#ifndef USE_MALLOC_LOW_BIT
+typedef struct node_t
+{
+ /* Callers expect this to be the first element in the structure - do not
+ move! */
+ const void *key;
+ struct node_t *left_node;
+ struct node_t *right_node;
+ unsigned int is_red:1;
+} *node;
+
+#define RED(N) (N)->is_red
+#define SETRED(N) (N)->is_red = 1
+#define SETBLACK(N) (N)->is_red = 0
+#define SETNODEPTR(NP,P) (*NP) = (P)
+#define LEFT(N) (N)->left_node
+#define LEFTPTR(N) (&(N)->left_node)
+#define SETLEFT(N,L) (N)->left_node = (L)
+#define RIGHT(N) (N)->right_node
+#define RIGHTPTR(N) (&(N)->right_node)
+#define SETRIGHT(N,R) (N)->right_node = (R)
+#define DEREFNODEPTR(NP) (*(NP))
+
+#else /* USE_MALLOC_LOW_BIT */
+
+typedef struct node_t
+{
+ /* Callers expect this to be the first element in the structure - do not
+ move! */
+ const void *key;
+ uintptr_t left_node; /* Includes whether the node is red in low-bit. */
+ uintptr_t right_node;
+} *node;
+
+#define RED(N) (node)((N)->left_node & ((uintptr_t) 0x1))
+#define SETRED(N) (N)->left_node |= ((uintptr_t) 0x1)
+#define SETBLACK(N) (N)->left_node &= ~((uintptr_t) 0x1)
+#define SETNODEPTR(NP,P) (*NP) = (node)((((uintptr_t)(*NP)) \
+ & (uintptr_t) 0x1) | (uintptr_t)(P))
+#define LEFT(N) (node)((N)->left_node & ~((uintptr_t) 0x1))
+#define LEFTPTR(N) (node *)(&(N)->left_node)
+#define SETLEFT(N,L) (N)->left_node = (((N)->left_node & (uintptr_t) 0x1) \
+ | (uintptr_t)(L))
+#define RIGHT(N) (node)((N)->right_node)
+#define RIGHTPTR(N) (node *)(&(N)->right_node)
+#define SETRIGHT(N,R) (N)->right_node = (uintptr_t)(R)
+#define DEREFNODEPTR(NP) (node)((uintptr_t)(*(NP)) & ~((uintptr_t) 0x1))
+
+#endif /* USE_MALLOC_LOW_BIT */
+typedef const struct node_t *const_node;
+
+#undef DEBUGGING
+
+#ifdef DEBUGGING
+
+/* Routines to check tree invariants. */
+
+#define CHECK_TREE(a) check_tree(a)
+
+static void
+check_tree_recurse (node p, int d_sofar, int d_total)
+{
+ if (p == NULL)
+ {
+ assert (d_sofar == d_total);
+ return;
+ }
+
+ check_tree_recurse (LEFT(p), d_sofar + (LEFT(p) && !RED(LEFT(p))),
+ d_total);
+ check_tree_recurse (RIGHT(p), d_sofar + (RIGHT(p) && !RED(RIGHT(p))),
+ d_total);
+ if (LEFT(p))
+ assert (!(RED(LEFT(p)) && RED(p)));
+ if (RIGHT(p))
+ assert (!(RED(RIGHT(p)) && RED(p)));
+}
+
+static void
+check_tree (node root)
+{
+ int cnt = 0;
+ node p;
+ if (root == NULL)
+ return;
+ SETBLACK(root);
+ for(p = LEFT(root); p; p = LEFT(p))
+ cnt += !RED(p);
+ check_tree_recurse (root, 0, cnt);
+}
+
+#else
+
+#define CHECK_TREE(a)
+
+#endif
+
+/* Possibly "split" a node with two red successors, and/or fix up two red
+ edges in a row. ROOTP is a pointer to the lowest node we visited, PARENTP
+ and GPARENTP pointers to its parent/grandparent. P_R and GP_R contain the
+ comparison values that determined which way was taken in the tree to reach
+ ROOTP. MODE is 1 if we need not do the split, but must check for two red
+ edges between GPARENTP and ROOTP. */
+static void
+maybe_split_for_insert (node *rootp, node *parentp, node *gparentp,
+ int p_r, int gp_r, int mode)
+{
+ node root = DEREFNODEPTR(rootp);
+ node *rp, *lp;
+ node rpn, lpn;
+ rp = RIGHTPTR(root);
+ rpn = RIGHT(root);
+ lp = LEFTPTR(root);
+ lpn = LEFT(root);
+
+ /* See if we have to split this node (both successors red). */
+ if (mode == 1
+ || ((rpn) != NULL && (lpn) != NULL && RED(rpn) && RED(lpn)))
+ {
+ /* This node becomes red, its successors black. */
+ SETRED(root);
+ if (rpn)
+ SETBLACK(rpn);
+ if (lpn)
+ SETBLACK(lpn);
+
+ /* If the parent of this node is also red, we have to do
+ rotations. */
+ if (parentp != NULL && RED(DEREFNODEPTR(parentp)))
+ {
+ node gp = DEREFNODEPTR(gparentp);
+ node p = DEREFNODEPTR(parentp);
+ /* There are two main cases:
+ 1. The edge types (left or right) of the two red edges differ.
+ 2. Both red edges are of the same type.
+ There exist two symmetries of each case, so there is a total of
+ 4 cases. */
+ if ((p_r > 0) != (gp_r > 0))
+ {
+ /* Put the child at the top of the tree, with its parent
+ and grandparent as successors. */
+ SETRED(p);
+ SETRED(gp);
+ SETBLACK(root);
+ if (p_r < 0)
+ {
+ /* Child is left of parent. */
+ SETLEFT(p,rpn);
+ SETNODEPTR(rp,p);
+ SETRIGHT(gp,lpn);
+ SETNODEPTR(lp,gp);
+ }
+ else
+ {
+ /* Child is right of parent. */
+ SETRIGHT(p,lpn);
+ SETNODEPTR(lp,p);
+ SETLEFT(gp,rpn);
+ SETNODEPTR(rp,gp);
+ }
+ SETNODEPTR(gparentp,root);
+ }
+ else
+ {
+ SETNODEPTR(gparentp,p);
+ /* Parent becomes the top of the tree, grandparent and
+ child are its successors. */
+ SETBLACK(p);
+ SETRED(gp);
+ if (p_r < 0)
+ {
+ /* Left edges. */
+ SETLEFT(gp,RIGHT(p));
+ SETRIGHT(p,gp);
+ }
+ else
+ {
+ /* Right edges. */
+ SETRIGHT(gp,LEFT(p));
+ SETLEFT(p,gp);
+ }
+ }
+ }
+ }
+}
+
+/* Find or insert datum into search tree.
+ KEY is the key to be located, ROOTP is the address of tree root,
+ COMPAR the ordering function. */
+void *
+__tsearch (const void *key, void **vrootp, __compar_fn_t compar)
+{
+ node q, root;
+ node *parentp = NULL, *gparentp = NULL;
+ node *rootp = (node *) vrootp;
+ node *nextp;
+ int r = 0, p_r = 0, gp_r = 0; /* No they might not, Mr Compiler. */
+
+#ifdef USE_MALLOC_LOW_BIT
+ static_assert (alignof (max_align_t) > 1, "malloc must return aligned ptrs");
+#endif
+
+ if (rootp == NULL)
+ return NULL;
+
+ /* This saves some additional tests below. */
+ root = DEREFNODEPTR(rootp);
+ if (root != NULL)
+ SETBLACK(root);
+
+ CHECK_TREE (root);
+
+ nextp = rootp;
+ while (DEREFNODEPTR(nextp) != NULL)
+ {
+ root = DEREFNODEPTR(rootp);
+ r = (*compar) (key, root->key);
+ if (r == 0)
+ return root;
+
+ maybe_split_for_insert (rootp, parentp, gparentp, p_r, gp_r, 0);
+ /* If that did any rotations, parentp and gparentp are now garbage.
+ That doesn't matter, because the values they contain are never
+ used again in that case. */
+
+ nextp = r < 0 ? LEFTPTR(root) : RIGHTPTR(root);
+ if (DEREFNODEPTR(nextp) == NULL)
+ break;
+
+ gparentp = parentp;
+ parentp = rootp;
+ rootp = nextp;
+
+ gp_r = p_r;
+ p_r = r;
+ }
+
+ q = (struct node_t *) malloc (sizeof (struct node_t));
+ if (q != NULL)
+ {
+ /* Make sure the malloc implementation returns naturally aligned
+ memory blocks when expected. Or at least even pointers, so we
+ can use the low bit as red/black flag. Even though we have a
+ static_assert to make sure alignof (max_align_t) > 1 there could
+ be an interposed malloc implementation that might cause havoc by
+ not obeying the malloc contract. */
+#ifdef USE_MALLOC_LOW_BIT
+ assert (((uintptr_t) q & (uintptr_t) 0x1) == 0);
+#endif
+ SETNODEPTR(nextp,q); /* link new node to old */
+ q->key = key; /* initialize new node */
+ SETRED(q);
+ SETLEFT(q,NULL);
+ SETRIGHT(q,NULL);
+
+ if (nextp != rootp)
+ /* There may be two red edges in a row now, which we must avoid by
+ rotating the tree. */
+ maybe_split_for_insert (nextp, rootp, parentp, r, p_r, 1);
+ }
+
+ return q;
+}
+libc_hidden_def (__tsearch)
+weak_alias (__tsearch, tsearch)
+
+
+/* Find datum in search tree.
+ KEY is the key to be located, ROOTP is the address of tree root,
+ COMPAR the ordering function. */
+void *
+__tfind (const void *key, void *const *vrootp, __compar_fn_t compar)
+{
+ node root;
+ node *rootp = (node *) vrootp;
+
+ if (rootp == NULL)
+ return NULL;
+
+ root = DEREFNODEPTR(rootp);
+ CHECK_TREE (root);
+
+ while (DEREFNODEPTR(rootp) != NULL)
+ {
+ root = DEREFNODEPTR(rootp);
+ int r;
+
+ r = (*compar) (key, root->key);
+ if (r == 0)
+ return root;
+
+ rootp = r < 0 ? LEFTPTR(root) : RIGHTPTR(root);
+ }
+ return NULL;
+}
+libc_hidden_def (__tfind)
+weak_alias (__tfind, tfind)
+
+
+/* Delete node with given key.
+ KEY is the key to be deleted, ROOTP is the address of the root of tree,
+ COMPAR the comparison function. */
+void *
+__tdelete (const void *key, void **vrootp, __compar_fn_t compar)
+{
+ node p, q, r, retval;
+ int cmp;
+ node *rootp = (node *) vrootp;
+ node root, unchained;
+ /* Stack of nodes so we remember the parents without recursion. It's
+ _very_ unlikely that there are paths longer than 40 nodes. The tree
+ would need to have around 250.000 nodes. */
+ int stacksize = 40;
+ int sp = 0;
+ node **nodestack = alloca (sizeof (node *) * stacksize);
+
+ if (rootp == NULL)
+ return NULL;
+ p = DEREFNODEPTR(rootp);
+ if (p == NULL)
+ return NULL;
+
+ CHECK_TREE (p);
+
+ root = DEREFNODEPTR(rootp);
+ while ((cmp = (*compar) (key, root->key)) != 0)
+ {
+ if (sp == stacksize)
+ {
+ node **newstack;
+ stacksize += 20;
+ newstack = alloca (sizeof (node *) * stacksize);
+ nodestack = memcpy (newstack, nodestack, sp * sizeof (node *));
+ }
+
+ nodestack[sp++] = rootp;
+ p = DEREFNODEPTR(rootp);
+ if (cmp < 0)
+ {
+ rootp = LEFTPTR(p);
+ root = LEFT(p);
+ }
+ else
+ {
+ rootp = RIGHTPTR(p);
+ root = RIGHT(p);
+ }
+ if (root == NULL)
+ return NULL;
+ }
+
+ /* This is bogus if the node to be deleted is the root... this routine
+ really should return an integer with 0 for success, -1 for failure
+ and errno = ESRCH or something. */
+ retval = p;
+
+ /* We don't unchain the node we want to delete. Instead, we overwrite
+ it with its successor and unchain the successor. If there is no
+ successor, we really unchain the node to be deleted. */
+
+ root = DEREFNODEPTR(rootp);
+
+ r = RIGHT(root);
+ q = LEFT(root);
+
+ if (q == NULL || r == NULL)
+ unchained = root;
+ else
+ {
+ node *parentp = rootp, *up = RIGHTPTR(root);
+ node upn;
+ for (;;)
+ {
+ if (sp == stacksize)
+ {
+ node **newstack;
+ stacksize += 20;
+ newstack = alloca (sizeof (node *) * stacksize);
+ nodestack = memcpy (newstack, nodestack, sp * sizeof (node *));
+ }
+ nodestack[sp++] = parentp;
+ parentp = up;
+ upn = DEREFNODEPTR(up);
+ if (LEFT(upn) == NULL)
+ break;
+ up = LEFTPTR(upn);
+ }
+ unchained = DEREFNODEPTR(up);
+ }
+
+ /* We know that either the left or right successor of UNCHAINED is NULL.
+ R becomes the other one, it is chained into the parent of UNCHAINED. */
+ r = LEFT(unchained);
+ if (r == NULL)
+ r = RIGHT(unchained);
+ if (sp == 0)
+ SETNODEPTR(rootp,r);
+ else
+ {
+ q = DEREFNODEPTR(nodestack[sp-1]);
+ if (unchained == RIGHT(q))
+ SETRIGHT(q,r);
+ else
+ SETLEFT(q,r);
+ }
+
+ if (unchained != root)
+ root->key = unchained->key;
+ if (!RED(unchained))
+ {
+ /* Now we lost a black edge, which means that the number of black
+ edges on every path is no longer constant. We must balance the
+ tree. */
+ /* NODESTACK now contains all parents of R. R is likely to be NULL
+ in the first iteration. */
+ /* NULL nodes are considered black throughout - this is necessary for
+ correctness. */
+ while (sp > 0 && (r == NULL || !RED(r)))
+ {
+ node *pp = nodestack[sp - 1];
+ p = DEREFNODEPTR(pp);
+ /* Two symmetric cases. */
+ if (r == LEFT(p))
+ {
+ /* Q is R's brother, P is R's parent. The subtree with root
+ R has one black edge less than the subtree with root Q. */
+ q = RIGHT(p);
+ if (RED(q))
+ {
+ /* If Q is red, we know that P is black. We rotate P left
+ so that Q becomes the top node in the tree, with P below
+ it. P is colored red, Q is colored black.
+ This action does not change the black edge count for any
+ leaf in the tree, but we will be able to recognize one
+ of the following situations, which all require that Q
+ is black. */
+ SETBLACK(q);
+ SETRED(p);
+ /* Left rotate p. */
+ SETRIGHT(p,LEFT(q));
+ SETLEFT(q,p);
+ SETNODEPTR(pp,q);
+ /* Make sure pp is right if the case below tries to use
+ it. */
+ nodestack[sp++] = pp = LEFTPTR(q);
+ q = RIGHT(p);
+ }
+ /* We know that Q can't be NULL here. We also know that Q is
+ black. */
+ if ((LEFT(q) == NULL || !RED(LEFT(q)))
+ && (RIGHT(q) == NULL || !RED(RIGHT(q))))
+ {
+ /* Q has two black successors. We can simply color Q red.
+ The whole subtree with root P is now missing one black
+ edge. Note that this action can temporarily make the
+ tree invalid (if P is red). But we will exit the loop
+ in that case and set P black, which both makes the tree
+ valid and also makes the black edge count come out
+ right. If P is black, we are at least one step closer
+ to the root and we'll try again the next iteration. */
+ SETRED(q);
+ r = p;
+ }
+ else
+ {
+ /* Q is black, one of Q's successors is red. We can
+ repair the tree with one operation and will exit the
+ loop afterwards. */
+ if (RIGHT(q) == NULL || !RED(RIGHT(q)))
+ {
+ /* The left one is red. We perform the same action as
+ in maybe_split_for_insert where two red edges are
+ adjacent but point in different directions:
+ Q's left successor (let's call it Q2) becomes the
+ top of the subtree we are looking at, its parent (Q)
+ and grandparent (P) become its successors. The former
+ successors of Q2 are placed below P and Q.
+ P becomes black, and Q2 gets the color that P had.
+ This changes the black edge count only for node R and
+ its successors. */
+ node q2 = LEFT(q);
+ if (RED(p))
+ SETRED(q2);
+ else
+ SETBLACK(q2);
+ SETRIGHT(p,LEFT(q2));
+ SETLEFT(q,RIGHT(q2));
+ SETRIGHT(q2,q);
+ SETLEFT(q2,p);
+ SETNODEPTR(pp,q2);
+ SETBLACK(p);
+ }
+ else
+ {
+ /* It's the right one. Rotate P left. P becomes black,
+ and Q gets the color that P had. Q's right successor
+ also becomes black. This changes the black edge
+ count only for node R and its successors. */
+ if (RED(p))
+ SETRED(q);
+ else
+ SETBLACK(q);
+ SETBLACK(p);
+
+ SETBLACK(RIGHT(q));
+
+ /* left rotate p */
+ SETRIGHT(p,LEFT(q));
+ SETLEFT(q,p);
+ SETNODEPTR(pp,q);
+ }
+
+ /* We're done. */
+ sp = 1;
+ r = NULL;
+ }
+ }
+ else
+ {
+ /* Comments: see above. */
+ q = LEFT(p);
+ if (RED(q))
+ {
+ SETBLACK(q);
+ SETRED(p);
+ SETLEFT(p,RIGHT(q));
+ SETRIGHT(q,p);
+ SETNODEPTR(pp,q);
+ nodestack[sp++] = pp = RIGHTPTR(q);
+ q = LEFT(p);
+ }
+ if ((RIGHT(q) == NULL || !RED(RIGHT(q)))
+ && (LEFT(q) == NULL || !RED(LEFT(q))))
+ {
+ SETRED(q);
+ r = p;
+ }
+ else
+ {
+ if (LEFT(q) == NULL || !RED(LEFT(q)))
+ {
+ node q2 = RIGHT(q);
+ if (RED(p))
+ SETRED(q2);
+ else
+ SETBLACK(q2);
+ SETLEFT(p,RIGHT(q2));
+ SETRIGHT(q,LEFT(q2));
+ SETLEFT(q2,q);
+ SETRIGHT(q2,p);
+ SETNODEPTR(pp,q2);
+ SETBLACK(p);
+ }
+ else
+ {
+ if (RED(p))
+ SETRED(q);
+ else
+ SETBLACK(q);
+ SETBLACK(p);
+ SETBLACK(LEFT(q));
+ SETLEFT(p,RIGHT(q));
+ SETRIGHT(q,p);
+ SETNODEPTR(pp,q);
+ }
+ sp = 1;
+ r = NULL;
+ }
+ }
+ --sp;
+ }
+ if (r != NULL)
+ SETBLACK(r);
+ }
+
+ free (unchained);
+ return retval;
+}
+libc_hidden_def (__tdelete)
+weak_alias (__tdelete, tdelete)
+
+
+/* Walk the nodes of a tree.
+ ROOT is the root of the tree to be walked, ACTION the function to be
+ called at each node. LEVEL is the level of ROOT in the whole tree. */
+static void
+internal_function
+trecurse (const void *vroot, __action_fn_t action, int level)
+{
+ const_node root = (const_node) vroot;
+
+ if (LEFT(root) == NULL && RIGHT(root) == NULL)
+ (*action) (root, leaf, level);
+ else
+ {
+ (*action) (root, preorder, level);
+ if (LEFT(root) != NULL)
+ trecurse (LEFT(root), action, level + 1);
+ (*action) (root, postorder, level);
+ if (RIGHT(root) != NULL)
+ trecurse (RIGHT(root), action, level + 1);
+ (*action) (root, endorder, level);
+ }
+}
+
+
+/* Walk the nodes of a tree.
+ ROOT is the root of the tree to be walked, ACTION the function to be
+ called at each node. */
+void
+__twalk (const void *vroot, __action_fn_t action)
+{
+ const_node root = (const_node) vroot;
+
+ CHECK_TREE ((node) root);
+
+ if (root != NULL && action != NULL)
+ trecurse (root, action, 0);
+}
+libc_hidden_def (__twalk)
+weak_alias (__twalk, twalk)
+
+
+
+/* The standardized functions miss an important functionality: the
+ tree cannot be removed easily. We provide a function to do this. */
+static void
+internal_function
+tdestroy_recurse (node root, __free_fn_t freefct)
+{
+ if (LEFT(root) != NULL)
+ tdestroy_recurse (LEFT(root), freefct);
+ if (RIGHT(root) != NULL)
+ tdestroy_recurse (RIGHT(root), freefct);
+ (*freefct) ((void *) root->key);
+ /* Free the node itself. */
+ free (root);
+}
+
+void
+__tdestroy (void *vroot, __free_fn_t freefct)
+{
+ node root = (node) vroot;
+
+ CHECK_TREE (root);
+
+ if (root != NULL)
+ tdestroy_recurse (root, freefct);
+}
+weak_alias (__tdestroy, tdestroy)
diff --git a/REORG.TODO/misc/tst-atomic-long.c b/REORG.TODO/misc/tst-atomic-long.c
new file mode 100644
index 0000000000..f64d0638b1
--- /dev/null
+++ b/REORG.TODO/misc/tst-atomic-long.c
@@ -0,0 +1,27 @@
+/* Tests for atomic.h macros.
+ Copyright (C) 2003-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <bits/wordsize.h>
+
+#define atomic_t long
+#if __WORDSIZE == 64
+# define TEST_ATOMIC64 1
+#endif
+
+#include "tst-atomic.c"
diff --git a/REORG.TODO/misc/tst-atomic.c b/REORG.TODO/misc/tst-atomic.c
new file mode 100644
index 0000000000..8c730f9923
--- /dev/null
+++ b/REORG.TODO/misc/tst-atomic.c
@@ -0,0 +1,639 @@
+/* Tests for atomic.h macros.
+ Copyright (C) 2003-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <atomic.h>
+
+#ifndef atomic_t
+# define atomic_t int
+#endif
+
+/* Test various atomic.h macros. */
+static int
+do_test (void)
+{
+ atomic_t mem, expected;
+ int ret = 0;
+
+#ifdef atomic_compare_and_exchange_val_acq
+ mem = 24;
+ if (atomic_compare_and_exchange_val_acq (&mem, 35, 24) != 24
+ || mem != 35)
+ {
+ puts ("atomic_compare_and_exchange_val_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (atomic_compare_and_exchange_val_acq (&mem, 10, 15) != 12
+ || mem != 12)
+ {
+ puts ("atomic_compare_and_exchange_val_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (atomic_compare_and_exchange_val_acq (&mem, -56, -15) != -15
+ || mem != -56)
+ {
+ puts ("atomic_compare_and_exchange_val_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (atomic_compare_and_exchange_val_acq (&mem, 17, 0) != -1
+ || mem != -1)
+ {
+ puts ("atomic_compare_and_exchange_val_acq test 4 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 24;
+ if (atomic_compare_and_exchange_bool_acq (&mem, 35, 24)
+ || mem != 35)
+ {
+ puts ("atomic_compare_and_exchange_bool_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (! atomic_compare_and_exchange_bool_acq (&mem, 10, 15)
+ || mem != 12)
+ {
+ puts ("atomic_compare_and_exchange_bool_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (atomic_compare_and_exchange_bool_acq (&mem, -56, -15)
+ || mem != -56)
+ {
+ puts ("atomic_compare_and_exchange_bool_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (! atomic_compare_and_exchange_bool_acq (&mem, 17, 0)
+ || mem != -1)
+ {
+ puts ("atomic_compare_and_exchange_bool_acq test 4 failed");
+ ret = 1;
+ }
+
+ mem = 64;
+ if (atomic_exchange_acq (&mem, 31) != 64
+ || mem != 31)
+ {
+ puts ("atomic_exchange_acq test failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (atomic_exchange_and_add (&mem, 11) != 2
+ || mem != 13)
+ {
+ puts ("atomic_exchange_and_add test failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (atomic_exchange_and_add_acq (&mem, 11) != 2
+ || mem != 13)
+ {
+ puts ("atomic_exchange_and_add test failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (atomic_exchange_and_add_rel (&mem, 11) != 2
+ || mem != 13)
+ {
+ puts ("atomic_exchange_and_add test failed");
+ ret = 1;
+ }
+
+ mem = -21;
+ atomic_add (&mem, 22);
+ if (mem != 1)
+ {
+ puts ("atomic_add test failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ atomic_increment (&mem);
+ if (mem != 0)
+ {
+ puts ("atomic_increment test failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (atomic_increment_val (&mem) != 3)
+ {
+ puts ("atomic_increment_val test failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_increment_and_test (&mem)
+ || mem != 1)
+ {
+ puts ("atomic_increment_and_test test 1 failed");
+ ret = 1;
+ }
+
+ mem = 35;
+ if (atomic_increment_and_test (&mem)
+ || mem != 36)
+ {
+ puts ("atomic_increment_and_test test 2 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (! atomic_increment_and_test (&mem)
+ || mem != 0)
+ {
+ puts ("atomic_increment_and_test test 3 failed");
+ ret = 1;
+ }
+
+ mem = 17;
+ atomic_decrement (&mem);
+ if (mem != 16)
+ {
+ puts ("atomic_decrement test failed");
+ ret = 1;
+ }
+
+ if (atomic_decrement_val (&mem) != 15)
+ {
+ puts ("atomic_decrement_val test failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_decrement_and_test (&mem)
+ || mem != -1)
+ {
+ puts ("atomic_decrement_and_test test 1 failed");
+ ret = 1;
+ }
+
+ mem = 15;
+ if (atomic_decrement_and_test (&mem)
+ || mem != 14)
+ {
+ puts ("atomic_decrement_and_test test 2 failed");
+ ret = 1;
+ }
+
+ mem = 1;
+ if (! atomic_decrement_and_test (&mem)
+ || mem != 0)
+ {
+ puts ("atomic_decrement_and_test test 3 failed");
+ ret = 1;
+ }
+
+ mem = 1;
+ if (atomic_decrement_if_positive (&mem) != 1
+ || mem != 0)
+ {
+ puts ("atomic_decrement_if_positive test 1 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_decrement_if_positive (&mem) != 0
+ || mem != 0)
+ {
+ puts ("atomic_decrement_if_positive test 2 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (atomic_decrement_if_positive (&mem) != -1
+ || mem != -1)
+ {
+ puts ("atomic_decrement_if_positive test 3 failed");
+ ret = 1;
+ }
+
+ mem = -12;
+ if (! atomic_add_negative (&mem, 10)
+ || mem != -2)
+ {
+ puts ("atomic_add_negative test 1 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_add_negative (&mem, 100)
+ || mem != 100)
+ {
+ puts ("atomic_add_negative test 2 failed");
+ ret = 1;
+ }
+
+ mem = 15;
+ if (atomic_add_negative (&mem, -10)
+ || mem != 5)
+ {
+ puts ("atomic_add_negative test 3 failed");
+ ret = 1;
+ }
+
+ mem = -12;
+ if (atomic_add_negative (&mem, 14)
+ || mem != 2)
+ {
+ puts ("atomic_add_negative test 4 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (! atomic_add_negative (&mem, -1)
+ || mem != -1)
+ {
+ puts ("atomic_add_negative test 5 failed");
+ ret = 1;
+ }
+
+ mem = -31;
+ if (atomic_add_negative (&mem, 31)
+ || mem != 0)
+ {
+ puts ("atomic_add_negative test 6 failed");
+ ret = 1;
+ }
+
+ mem = -34;
+ if (atomic_add_zero (&mem, 31)
+ || mem != -3)
+ {
+ puts ("atomic_add_zero test 1 failed");
+ ret = 1;
+ }
+
+ mem = -36;
+ if (! atomic_add_zero (&mem, 36)
+ || mem != 0)
+ {
+ puts ("atomic_add_zero test 2 failed");
+ ret = 1;
+ }
+
+ mem = 113;
+ if (atomic_add_zero (&mem, -13)
+ || mem != 100)
+ {
+ puts ("atomic_add_zero test 3 failed");
+ ret = 1;
+ }
+
+ mem = -18;
+ if (atomic_add_zero (&mem, 20)
+ || mem != 2)
+ {
+ puts ("atomic_add_zero test 4 failed");
+ ret = 1;
+ }
+
+ mem = 10;
+ if (atomic_add_zero (&mem, -20)
+ || mem != -10)
+ {
+ puts ("atomic_add_zero test 5 failed");
+ ret = 1;
+ }
+
+ mem = 10;
+ if (! atomic_add_zero (&mem, -10)
+ || mem != 0)
+ {
+ puts ("atomic_add_zero test 6 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ atomic_bit_set (&mem, 1);
+ if (mem != 2)
+ {
+ puts ("atomic_bit_set test 1 failed");
+ ret = 1;
+ }
+
+ mem = 8;
+ atomic_bit_set (&mem, 3);
+ if (mem != 8)
+ {
+ puts ("atomic_bit_set test 2 failed");
+ ret = 1;
+ }
+
+#ifdef TEST_ATOMIC64
+ mem = 16;
+ atomic_bit_set (&mem, 35);
+ if (mem != 0x800000010LL)
+ {
+ puts ("atomic_bit_set test 3 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 0;
+ if (atomic_bit_test_set (&mem, 1)
+ || mem != 2)
+ {
+ puts ("atomic_bit_test_set test 1 failed");
+ ret = 1;
+ }
+
+ mem = 8;
+ if (! atomic_bit_test_set (&mem, 3)
+ || mem != 8)
+ {
+ puts ("atomic_bit_test_set test 2 failed");
+ ret = 1;
+ }
+
+#ifdef TEST_ATOMIC64
+ mem = 16;
+ if (atomic_bit_test_set (&mem, 35)
+ || mem != 0x800000010LL)
+ {
+ puts ("atomic_bit_test_set test 3 failed");
+ ret = 1;
+ }
+
+ mem = 0x100000000LL;
+ if (! atomic_bit_test_set (&mem, 32)
+ || mem != 0x100000000LL)
+ {
+ puts ("atomic_bit_test_set test 4 failed");
+ ret = 1;
+ }
+#endif
+
+#ifdef catomic_compare_and_exchange_val_acq
+ mem = 24;
+ if (catomic_compare_and_exchange_val_acq (&mem, 35, 24) != 24
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (catomic_compare_and_exchange_val_acq (&mem, 10, 15) != 12
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_val_acq (&mem, -56, -15) != -15
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (catomic_compare_and_exchange_val_acq (&mem, 17, 0) != -1
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 4 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 24;
+ if (catomic_compare_and_exchange_bool_acq (&mem, 35, 24)
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 10, 15)
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_bool_acq (&mem, -56, -15)
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 17, 0)
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 4 failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_exchange_and_add (&mem, 11) != 2
+ || mem != 13)
+ {
+ puts ("catomic_exchange_and_add test failed");
+ ret = 1;
+ }
+
+ mem = -21;
+ catomic_add (&mem, 22);
+ if (mem != 1)
+ {
+ puts ("catomic_add test failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ catomic_increment (&mem);
+ if (mem != 0)
+ {
+ puts ("catomic_increment test failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_increment_val (&mem) != 3)
+ {
+ puts ("catomic_increment_val test failed");
+ ret = 1;
+ }
+
+ mem = 17;
+ catomic_decrement (&mem);
+ if (mem != 16)
+ {
+ puts ("catomic_decrement test failed");
+ ret = 1;
+ }
+
+ if (catomic_decrement_val (&mem) != 15)
+ {
+ puts ("catomic_decrement_val test failed");
+ ret = 1;
+ }
+
+ /* Tests for C11-like atomics. */
+ mem = 11;
+ if (atomic_load_relaxed (&mem) != 11 || atomic_load_acquire (&mem) != 11)
+ {
+ puts ("atomic_load_{relaxed,acquire} test failed");
+ ret = 1;
+ }
+
+ atomic_store_relaxed (&mem, 12);
+ if (mem != 12)
+ {
+ puts ("atomic_store_relaxed test failed");
+ ret = 1;
+ }
+ atomic_store_release (&mem, 13);
+ if (mem != 13)
+ {
+ puts ("atomic_store_release test failed");
+ ret = 1;
+ }
+
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_relaxed (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_relaxed test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_relaxed (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_relaxed test 2 failed");
+ ret = 1;
+ }
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_acquire (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_acquire test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_acquire (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_acquire test 2 failed");
+ ret = 1;
+ }
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_release (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_release test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_release (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_release test 2 failed");
+ ret = 1;
+ }
+
+ mem = 23;
+ if (atomic_exchange_acquire (&mem, 42) != 23 || mem != 42)
+ {
+ puts ("atomic_exchange_acquire test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_exchange_release (&mem, 42) != 23 || mem != 42)
+ {
+ puts ("atomic_exchange_release test failed");
+ ret = 1;
+ }
+
+ mem = 23;
+ if (atomic_fetch_add_relaxed (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_relaxed test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_acquire (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_acquire test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_release (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_release test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_acq_rel (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_acq_rel test failed");
+ ret = 1;
+ }
+
+ mem = 3;
+ if (atomic_fetch_and_acquire (&mem, 2) != 3 || mem != 2)
+ {
+ puts ("atomic_fetch_and_acquire test failed");
+ ret = 1;
+ }
+
+ mem = 4;
+ if (atomic_fetch_or_relaxed (&mem, 2) != 4 || mem != 6)
+ {
+ puts ("atomic_fetch_or_relaxed test failed");
+ ret = 1;
+ }
+ mem = 4;
+ if (atomic_fetch_or_acquire (&mem, 2) != 4 || mem != 6)
+ {
+ puts ("atomic_fetch_or_acquire test failed");
+ ret = 1;
+ }
+
+ /* This is a single-threaded test, so we can't test the effects of the
+ fences. */
+ atomic_thread_fence_acquire ();
+ atomic_thread_fence_release ();
+ atomic_thread_fence_seq_cst ();
+
+ return ret;
+}
+
+#include <support/test-driver.c>
diff --git a/REORG.TODO/misc/tst-dirname.c b/REORG.TODO/misc/tst-dirname.c
new file mode 100644
index 0000000000..41c2a9ba75
--- /dev/null
+++ b/REORG.TODO/misc/tst-dirname.c
@@ -0,0 +1,72 @@
+/* Test program for dirname function a la XPG.
+ Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#define _GNU_SOURCE 1
+#include <libgen.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static int
+test (const char *input, const char *result)
+{
+ int retval;
+ char *cp;
+ cp = strdupa (input);
+ cp = dirname (cp);
+ retval = strcmp (cp, result);
+ if (retval)
+ printf ("dirname(\"%s\") should be \"%s\", but is \"%s\"\n",
+ input, result, cp);
+ return retval;
+}
+
+static int
+do_test (void)
+{
+ int result = 0;
+
+ /* These are the examples given in XPG4.2. */
+ result |= test ("/usr/lib", "/usr");
+ result |= test ("/usr/", "/");
+ result |= test ("usr", ".");
+ result |= test ("/", "/");
+ result |= test (".", ".");
+ result |= test ("..", ".");
+
+ /* Some more tests. */
+ result |= test ("/usr/lib/", "/usr");
+ result |= test ("/usr", "/");
+ result |= test ("a//", ".");
+ result |= test ("a////", ".");
+ result |= test ("////usr", "/");
+ result |= test ("////usr//", "/");
+ result |= test ("//usr", "//");
+ result |= test ("//usr//", "//");
+ result |= test ("//", "//");
+
+ /* Other Unix implementations behave like this. */
+ result |= test ("x///y", "x");
+ result |= test ("x/////y", "x");
+
+ return result != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-efgcvt.c b/REORG.TODO/misc/tst-efgcvt.c
new file mode 100644
index 0000000000..4459f6248a
--- /dev/null
+++ b/REORG.TODO/misc/tst-efgcvt.c
@@ -0,0 +1,216 @@
+/* Copyright (C) 1998-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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+
+#include <float.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int error_count;
+
+typedef struct
+{
+ double value;
+ int ndigit;
+ int decpt;
+ char result[30];
+} testcase;
+
+typedef char * ((*efcvt_func) (double, int, int *, int *));
+
+typedef int ((*efcvt_r_func) (double, int, int *, int *, char *, size_t));
+
+
+static testcase ecvt_tests[] =
+{
+ { 0.0, 0, 1, "" },
+ { 10.0, 0, 2, "" },
+ { 10.0, 1, 2, "1" },
+ { 10.0, 5, 2, "10000" },
+ { -12.0, 5, 2, "12000" },
+ { 0.2, 4, 0, "2000" },
+ { 0.02, 4, -1, "2000" },
+ { 5.5, 1, 1, "6" },
+ { 1.0, -1, 1, "" },
+ { 0.01, 2, -1, "10" },
+ { 100.0, -2, 3, "" },
+ { 100.0, -5, 3, "" },
+ { 100.0, -4, 3, "" },
+ { 100.01, -4, 3, "" },
+ { 123.01, -4, 3, "" },
+ { 126.71, -4, 3, "" },
+ { 0.0, 4, 1, "0000" },
+#if DBL_MANT_DIG == 53
+ { 0x1p-1074, 3, -323, "494" },
+ { -0x1p-1074, 3, -323, "494" },
+#endif
+ /* -1.0 is end marker. */
+ { -1.0, 0, 0, "" }
+};
+
+static testcase fcvt_tests[] =
+{
+ { 0.0, 0, 1, "0" },
+ { 10.0, 0, 2, "10" },
+ { 10.0, 1, 2, "100" },
+ { 10.0, 4, 2, "100000" },
+ { -12.0, 5, 2, "1200000" },
+ { 0.2, 4, 0, "2000" },
+ { 0.02, 4, -1, "200" },
+ { 5.5, 1, 1, "55" },
+ { 5.5, 0, 1, "6" },
+ { 0.01, 2, -1, "1" },
+ { 100.0, -2, 3, "100" },
+ { 100.0, -5, 3, "100" },
+ { 100.0, -4, 3, "100" },
+ { 100.01, -4, 3, "100" },
+ { 123.01, -4, 3, "100" },
+ { 126.71, -4, 3, "100" },
+ { 322.5, 16, 3, "3225000000000000000" },
+ /* -1.0 is end marker. */
+ { -1.0, 0, 0, "" }
+};
+
+static void
+output_error (const char *name, double value, int ndigit,
+ const char *exp_p, int exp_decpt, int exp_sign,
+ char *res_p, int res_decpt, int res_sign)
+{
+ printf ("%s returned wrong result for value: %f, ndigits: %d\n",
+ name, value, ndigit);
+ printf ("Result was p: \"%s\", decpt: %d, sign: %d\n",
+ res_p, res_decpt, res_sign);
+ printf ("Should be p: \"%s\", decpt: %d, sign: %d\n",
+ exp_p, exp_decpt, exp_sign);
+ ++error_count;
+}
+
+
+static void
+output_r_error (const char *name, double value, int ndigit,
+ const char *exp_p, int exp_decpt, int exp_sign, int exp_return,
+ char *res_p, int res_decpt, int res_sign, int res_return)
+{
+ printf ("%s returned wrong result for value: %f, ndigits: %d\n",
+ name, value, ndigit);
+ printf ("Result was buf: \"%s\", decpt: %d, sign: %d return value: %d\n",
+ res_p, res_decpt, res_sign, res_return);
+ printf ("Should be buf: \"%s\", decpt: %d, sign: %d\n",
+ exp_p, exp_decpt, exp_sign);
+ ++error_count;
+}
+
+static void
+test (testcase tests[], efcvt_func efcvt, const char *name)
+{
+ int no = 0;
+ int decpt, sign;
+ char *p;
+
+ while (tests[no].value != -1.0)
+ {
+ p = efcvt (tests[no].value, tests[no].ndigit, &decpt, &sign);
+ if (decpt != tests[no].decpt
+ || sign != (tests[no].value < 0)
+ || strcmp (p, tests[no].result) != 0)
+ output_error (name, tests[no].value, tests[no].ndigit,
+ tests[no].result, tests[no].decpt,
+ (tests[no].value < 0),
+ p, decpt, sign);
+ ++no;
+ }
+}
+
+static void
+test_r (testcase tests[], efcvt_r_func efcvt_r, const char *name)
+{
+ int no = 0;
+ int decpt, sign, res;
+ char buf [1024];
+
+
+ while (tests[no].value != -1.0)
+ {
+ res = efcvt_r (tests[no].value, tests[no].ndigit, &decpt, &sign,
+ buf, sizeof (buf));
+ if (res != 0
+ || decpt != tests[no].decpt
+ || sign != (tests[no].value < 0)
+ || strcmp (buf, tests[no].result) != 0)
+ output_r_error (name, tests[no].value, tests[no].ndigit,
+ tests[no].result, tests[no].decpt, 0,
+ (tests[no].value < 0),
+ buf, decpt, sign, res);
+ ++no;
+ }
+}
+
+static void
+special (void)
+{
+ int decpt, sign, res;
+ char *p;
+ char buf [1024];
+
+ p = ecvt (NAN, 10, &decpt, &sign);
+ if (sign != 0 || strcmp (p, "nan") != 0)
+ output_error ("ecvt", NAN, 10, "nan", 0, 0, p, decpt, sign);
+
+ p = ecvt (INFINITY, 10, &decpt, &sign);
+ if (sign != 0 || strcmp (p, "inf") != 0)
+ output_error ("ecvt", INFINITY, 10, "inf", 0, 0, p, decpt, sign);
+
+ /* Simply make sure these calls with large NDIGITs don't crash. */
+ (void) ecvt (123.456, 10000, &decpt, &sign);
+ (void) fcvt (123.456, 10000, &decpt, &sign);
+
+ /* Some tests for the reentrant functions. */
+ /* Use a too small buffer. */
+ res = ecvt_r (123.456, 10, &decpt, &sign, buf, 1);
+ if (res == 0)
+ {
+ printf ("ecvt_r with a too small buffer was succesful.\n");
+ ++error_count;
+ }
+ res = fcvt_r (123.456, 10, &decpt, &sign, buf, 1);
+ if (res == 0)
+ {
+ printf ("fcvt_r with a too small buffer was succesful.\n");
+ ++error_count;
+ }
+}
+
+
+static int
+do_test (void)
+{
+ test (ecvt_tests, ecvt, "ecvt");
+ test (fcvt_tests, fcvt, "fcvt");
+ test_r (ecvt_tests, ecvt_r, "ecvt_r");
+ test_r (fcvt_tests, fcvt_r, "fcvt_r");
+ special ();
+
+ return error_count;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-empty.c b/REORG.TODO/misc/tst-empty.c
new file mode 100644
index 0000000000..31860b06b3
--- /dev/null
+++ b/REORG.TODO/misc/tst-empty.c
@@ -0,0 +1,8 @@
+/* The most useful C program known to man. */
+static int
+do_test (void)
+{
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/REORG.TODO/misc/tst-error1.c b/REORG.TODO/misc/tst-error1.c
new file mode 100644
index 0000000000..9c4a62fbd0
--- /dev/null
+++ b/REORG.TODO/misc/tst-error1.c
@@ -0,0 +1,37 @@
+#include <error.h>
+#include <mcheck.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#include <libc-diag.h>
+
+static int
+do_test (int argc, char *argv[])
+{
+ mtrace ();
+ (void) freopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr);
+ /* Orient the stream. */
+ fwprintf (stderr, L"hello world\n");
+ char buf[20000];
+ static const char str[] = "hello world! ";
+ for (int i = 0; i < 1000; ++i)
+ memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str));
+ error (0, 0, str);
+
+ /* We're testing a large format string here and need to generate it
+ to avoid this source file being ridiculous. So disable the warning
+ about a generated format string. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat-security");
+
+ error (0, 0, buf);
+ error (0, 0, buf);
+
+ DIAG_POP_NEEDS_COMMENT;
+
+ error (0, 0, str);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test (argc, argv)
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-fdset.c b/REORG.TODO/misc/tst-fdset.c
new file mode 100644
index 0000000000..f0944bdbd3
--- /dev/null
+++ b/REORG.TODO/misc/tst-fdset.c
@@ -0,0 +1,67 @@
+/* Test FD* macros.
+ Copyright (C) 1997-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Robert Bihlmeyer <robbe@orcus.priv.at>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <sys/types.h>
+
+static int
+do_test (void)
+{
+ int retval = 0;
+ int i;
+ fd_set set;
+
+ FD_ZERO (&set);
+ for (i=0; i < FD_SETSIZE; ++i)
+ {
+ printf ("%d => check:", i);
+ if (FD_ISSET (i, &set) == 0)
+ fputs ("ok", stdout);
+ else
+ {
+ fputs ("nok", stdout);
+ retval = 1;
+ }
+ fputs (", set", stdout);
+ FD_SET (i, &set);
+ fputs (", check:", stdout);
+ if (FD_ISSET (i, &set))
+ fputs ("ok", stdout);
+ else
+ {
+ fputs ("nok", stdout);
+ retval = 1;
+ }
+ fputs (", clear", stdout);
+ FD_CLR (i, &set);
+ fputs (", check:", stdout);
+ if (FD_ISSET (i, &set) == 0)
+ puts ("ok");
+ else
+ {
+ puts ("nok");
+ retval = 1;
+ }
+ }
+
+ return retval;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-hsearch.c b/REORG.TODO/misc/tst-hsearch.c
new file mode 100644
index 0000000000..d390f1dcf3
--- /dev/null
+++ b/REORG.TODO/misc/tst-hsearch.c
@@ -0,0 +1,34 @@
+#include <search.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ int a = 1;
+ int b = 2;
+ ENTRY i;
+ ENTRY *e;
+
+ if (hcreate (20) == 0)
+ {
+ puts ("hcreate failed");
+ return 1;
+ }
+
+ i.key = (char *) "one";
+ i.data = &a;
+ if (hsearch (i, ENTER) == NULL)
+ return 1;
+
+ i.key = (char *) "one";
+ i.data = &b;
+ e = hsearch (i, ENTER);
+ printf ("e.data = %d\n", *(int *) e->data);
+ if (*(int *) e->data != 1)
+ return 1;
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-insremque.c b/REORG.TODO/misc/tst-insremque.c
new file mode 100644
index 0000000000..9f17055ef5
--- /dev/null
+++ b/REORG.TODO/misc/tst-insremque.c
@@ -0,0 +1,61 @@
+#include <search.h>
+#include <stdio.h>
+#include <string.h>
+
+#define CHECK(cond) \
+ do \
+ if (! (cond)) \
+ { \
+ printf ("Condition " #cond " not true on line %d\n", __LINE__); \
+ ret = 1; \
+ } \
+ while (0)
+
+static int
+do_test (void)
+{
+ struct qelem elements[4];
+ int ret = 0;
+
+ /* Linear list. */
+ memset (elements, 0xff, sizeof (elements));
+ insque (&elements[0], NULL);
+ remque (&elements[0]);
+ insque (&elements[0], NULL);
+ insque (&elements[2], &elements[0]);
+ insque (&elements[1], &elements[0]);
+ insque (&elements[3], &elements[2]);
+ remque (&elements[2]);
+ insque (&elements[2], &elements[0]);
+ CHECK (elements[0].q_back == NULL);
+ CHECK (elements[0].q_forw == &elements[2]);
+ CHECK (elements[1].q_back == &elements[2]);
+ CHECK (elements[1].q_forw == &elements[3]);
+ CHECK (elements[2].q_back == &elements[0]);
+ CHECK (elements[2].q_forw == &elements[1]);
+ CHECK (elements[3].q_back == &elements[1]);
+ CHECK (elements[3].q_forw == NULL);
+
+ /* Circular list. */
+ memset (elements, 0xff, sizeof (elements));
+ elements[0].q_back = &elements[0];
+ elements[0].q_forw = &elements[0];
+ insque (&elements[2], &elements[0]);
+ insque (&elements[1], &elements[0]);
+ insque (&elements[3], &elements[2]);
+ remque (&elements[2]);
+ insque (&elements[2], &elements[0]);
+ CHECK (elements[0].q_back == &elements[3]);
+ CHECK (elements[0].q_forw == &elements[2]);
+ CHECK (elements[1].q_back == &elements[2]);
+ CHECK (elements[1].q_forw == &elements[3]);
+ CHECK (elements[2].q_back == &elements[0]);
+ CHECK (elements[2].q_forw == &elements[1]);
+ CHECK (elements[3].q_back == &elements[1]);
+ CHECK (elements[3].q_forw == &elements[0]);
+
+ return ret;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-makedev.c b/REORG.TODO/misc/tst-makedev.c
new file mode 100644
index 0000000000..173896849a
--- /dev/null
+++ b/REORG.TODO/misc/tst-makedev.c
@@ -0,0 +1,104 @@
+/* Tests of functions to access `dev_t' values.
+ Copyright (C) 2016-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/sysmacros.h>
+#include <stdio.h>
+#include <inttypes.h>
+
+/* Confirm that makedev (major (d), minor (d)) == d. */
+static int
+do_test_split_combine (dev_t d1)
+{
+ unsigned int maj = major (d1);
+ unsigned int min = minor (d1);
+ dev_t d2 = makedev (maj, min);
+ if (d1 != d2)
+ {
+ printf ("FAIL: %016" PRIx64 " != %016" PRIx64 " (maj %08x min %08x)\n",
+ (uint64_t)d2, (uint64_t)d1, maj, min);
+ return 1;
+ }
+ else
+ return 0;
+}
+
+/* Confirm that major (makedev (maj, min)) == maj and
+ minor (makedev (maj, min)) == min. */
+static int
+do_test_combine_split (unsigned int maj1, unsigned int min1)
+{
+ dev_t d = makedev (maj1, min1);
+ unsigned int maj2 = major (d);
+ unsigned int min2 = minor (d);
+ if (maj1 != maj2 && min1 != min2)
+ {
+ printf ("FAIL: %08x != %08x, %08x != %08x (dev %016" PRIx64 ")\n",
+ maj2, maj1, min2, min1, (uint64_t)d);
+ return 1;
+ }
+ else if (maj1 != maj2)
+ {
+ printf ("FAIL: %08x != %08x, %08x == %08x (dev %016" PRIx64 ")\n",
+ maj2, maj1, min2, min1, (uint64_t)d);
+ return 1;
+ }
+ else if (min1 != min2)
+ {
+ printf ("FAIL: %08x == %08x, %08x != %08x (dev %016" PRIx64 ")\n",
+ maj2, maj1, min2, min1, (uint64_t)d);
+ return 1;
+ }
+ else
+ return 0;
+}
+
+static int
+do_test (void)
+{
+ dev_t d;
+ unsigned int maj, min;
+ int status = 0;
+
+ /* Test the traditional range (16-bit dev_t, 8-bit each maj/min)
+ exhaustively. */
+ for (d = 0; d <= 0xFFFF; d++)
+ status |= do_test_split_combine (d);
+
+ for (maj = 0; maj <= 0xFF; maj++)
+ for (min = 0; min <= 0xFF; min++)
+ status |= do_test_combine_split (maj, min);
+
+ /* Test glibc's expanded range (64-bit dev_t, 32-bit each maj/min).
+ Exhaustive testing would take much too long, instead we shift a
+ pair of 1-bits over each range. */
+ {
+ unsigned int a, b;
+ for (a = 0; a <= 63; a++)
+ do_test_split_combine (((dev_t) 0x03) << a);
+
+ for (a = 0; a < 31; a++)
+ for (b = 0; b <= 31; b++)
+ do_test_combine_split (0x03u << a, 0x03u << b);
+ }
+
+ return status;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-mntent-blank-corrupt.c b/REORG.TODO/misc/tst-mntent-blank-corrupt.c
new file mode 100644
index 0000000000..cff3d6de3f
--- /dev/null
+++ b/REORG.TODO/misc/tst-mntent-blank-corrupt.c
@@ -0,0 +1,45 @@
+/* Make sure blank lines does not cause memory corruption BZ #18887.
+
+ Copyright (C) 2009-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <mntent.h>
+#include <stdio.h>
+#include <string.h>
+
+/* Make sure blank lines don't trigger memory corruption. This doesn't happen
+ for all targets though, so it's a best effort test BZ #18887. */
+static int
+do_test (void)
+{
+ FILE *fp;
+
+ fp = tmpfile ();
+ fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp);
+ rewind (fp);
+
+ /* The corruption happens here ... */
+ getmntent (fp);
+ /* ... but trigers here. */
+ endmntent (fp);
+
+ /* If the test failed, we would crash, and not hit this point. */
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-mntent-blank-passno.c b/REORG.TODO/misc/tst-mntent-blank-passno.c
new file mode 100644
index 0000000000..b8c826db37
--- /dev/null
+++ b/REORG.TODO/misc/tst-mntent-blank-passno.c
@@ -0,0 +1,53 @@
+/* Make sure trailing whitespace is handled properly BZ #17273.
+
+ Copyright (C) 2009-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <mntent.h>
+#include <stdio.h>
+#include <string.h>
+
+/* Check entries to make sure trailing whitespace is ignored and we return the
+ correct passno value BZ #17273. */
+static int
+do_test (void)
+{
+ int result = 0;
+ FILE *fp;
+ struct mntent *mnt;
+
+ fp = tmpfile ();
+ fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
+ rewind (fp);
+
+ mnt = getmntent (fp);
+ if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
+ || strcmp (mnt->mnt_dir, "/bar dir") != 0
+ || strcmp (mnt->mnt_type, "auto") != 0
+ || strcmp (mnt->mnt_opts, "bind") != 0
+ || mnt->mnt_freq != 0
+ || mnt->mnt_passno != 0)
+ {
+ puts ("Error while reading entry with trailing whitespaces");
+ result = 1;
+ }
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-mntent.c b/REORG.TODO/misc/tst-mntent.c
new file mode 100644
index 0000000000..b6ad8afcc6
--- /dev/null
+++ b/REORG.TODO/misc/tst-mntent.c
@@ -0,0 +1,82 @@
+/* Test case by Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
+ and Ulrich Drepper <drepper@cygnus.com>. */
+#include <mntent.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+ int result = 0;
+ struct mntent mef;
+ struct mntent *mnt = &mef;
+ FILE *fp;
+
+ mef.mnt_fsname = strdupa ("/dev/hda1");
+ mef.mnt_dir = strdupa ("/some dir");
+ mef.mnt_type = strdupa ("ext2");
+ mef.mnt_opts = strdupa ("defaults");
+ mef.mnt_freq = 1;
+ mef.mnt_passno = 2;
+
+ if (hasmntopt (mnt, "defaults"))
+ printf ("Found!\n");
+ else
+ {
+ printf ("Didn't find it\n");
+ result = 1;
+ }
+
+ fp = tmpfile ();
+ if (fp == NULL)
+ {
+ printf ("Cannot open temporary file: %m\n");
+ result = 1;
+ }
+ else
+ {
+ char buf[1024];
+
+ /* Write the name entry. */
+ addmntent (fp, &mef);
+
+ /* Prepare for reading. */
+ rewind (fp);
+
+ /* First, read it raw. */
+ if (fgets (buf, sizeof (buf), fp) == NULL)
+ {
+ printf ("Cannot read temporary file: %m");
+ result = 1;
+ }
+ else
+ if (strcmp (buf, "/dev/hda1 /some\\040dir ext2 defaults 1 2\n") != 0)
+ {
+ puts ("Raw file data not correct");
+ result = 1;
+ }
+
+ /* Prepare for reading, part II. */
+ rewind (fp);
+
+ /* Now read it cooked. */
+ mnt = getmntent (fp);
+
+ if (strcmp (mnt->mnt_fsname, "/dev/hda1") != 0
+ || strcmp (mnt->mnt_dir, "/some dir") != 0
+ || strcmp (mnt->mnt_type, "ext2") != 0
+ || strcmp (mnt->mnt_opts, "defaults") != 0
+ || mnt->mnt_freq != 1
+ || mnt->mnt_passno != 2)
+ {
+ puts ("Error while reading written entry back in");
+ result = 1;
+ }
+ }
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-mntent2.c b/REORG.TODO/misc/tst-mntent2.c
new file mode 100644
index 0000000000..ba1ee0ae19
--- /dev/null
+++ b/REORG.TODO/misc/tst-mntent2.c
@@ -0,0 +1,44 @@
+#include <mntent.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+ int result = 0;
+ struct mntent mef;
+
+ mef.mnt_fsname = strdupa ("/dev/sdf6");
+ mef.mnt_dir = strdupa ("/some dir");
+ mef.mnt_type = strdupa ("ext3");
+ mef.mnt_opts = strdupa ("opt1,opt2,noopt=6,rw,norw,brw");
+ mef.mnt_freq = 1;
+ mef.mnt_passno = 2;
+
+#define TEST(opt, found) \
+ if ((!!hasmntopt (&mef, (opt))) != (found)) \
+ { \
+ printf ("Option %s was %sfound\n", (opt), (found) ? "not " : ""); \
+ result = 1; \
+ }
+
+ TEST ("opt1", 1)
+ TEST ("opt2", 1)
+ TEST ("noopt", 1)
+ TEST ("rw", 1)
+ TEST ("norw", 1)
+ TEST ("brw", 1)
+ TEST ("opt", 0)
+ TEST ("oopt", 0)
+ TEST ("w", 0)
+ TEST ("r", 0)
+ TEST ("br", 0)
+ TEST ("nor", 0)
+ TEST ("or", 0)
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-preadvwritev-common.c b/REORG.TODO/misc/tst-preadvwritev-common.c
new file mode 100644
index 0000000000..676d4953ac
--- /dev/null
+++ b/REORG.TODO/misc/tst-preadvwritev-common.c
@@ -0,0 +1,122 @@
+/* Common definitions for preadv and pwritev.
+ Copyright (C) 2016-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
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/uio.h>
+#include <sys/stat.h>
+
+#include <support/check.h>
+#include <support/temp_file.h>
+
+static char *temp_filename;
+static int temp_fd;
+
+static int do_test (void);
+
+static void
+do_prepare (int argc, char **argv)
+{
+ temp_fd = create_temp_file ("tst-preadvwritev.", &temp_filename);
+ if (temp_fd == -1)
+ FAIL_EXIT1 ("cannot create temporary file");
+}
+#define PREPARE do_prepare
+
+#ifndef PREADV
+# define PREADV(__fd, __iov, __iovcnt, __offset) \
+ preadv (__fd, __iov, __iovcnt, __offset)
+#endif
+
+#ifndef PWRITEV
+# define PWRITEV(__fd, __iov, __iovcnt, __offset) \
+ pwritev (__fd, __iov, __iovcnt, __offset)
+#endif
+
+static int
+do_test_with_offset (off_t offset)
+{
+ struct iovec iov[2];
+ ssize_t ret;
+
+ char buf1[32];
+ char buf2[64];
+
+ memset (buf1, 0xf0, sizeof buf1);
+ memset (buf2, 0x0f, sizeof buf2);
+
+ /* Write two buffer with 32 and 64 bytes respectively. */
+ memset (iov, 0, sizeof iov);
+ iov[0].iov_base = buf1;
+ iov[0].iov_len = sizeof buf1;
+ iov[1].iov_base = buf2;
+ iov[1].iov_len = sizeof buf2;
+
+ ret = PWRITEV (temp_fd, iov, 2, offset);
+ if (ret == -1)
+ FAIL_RET ("first pwritev returned -1");
+ if (ret != (sizeof buf1 + sizeof buf2))
+ FAIL_RET ("first pwritev returned an unexpected value");
+
+ ret = PWRITEV (temp_fd, iov, 2, sizeof buf1 + sizeof buf2 + offset);
+ if (ret == -1)
+ FAIL_RET ("second pwritev returned -1");
+ if (ret != (sizeof buf1 + sizeof buf2))
+ FAIL_RET ("second pwritev returned an unexpected value");
+
+ char buf3[32];
+ char buf4[64];
+
+ memset (buf3, 0x0f, sizeof buf3);
+ memset (buf4, 0xf0, sizeof buf4);
+
+ iov[0].iov_base = buf3;
+ iov[0].iov_len = sizeof buf3;
+ iov[1].iov_base = buf4;
+ iov[1].iov_len = sizeof buf4;
+
+ /* Now read two buffer with 32 and 64 bytes respectively. */
+ ret = PREADV (temp_fd, iov, 2, offset);
+ if (ret == -1)
+ FAIL_RET ("first preadv returned -1");
+ if (ret != (sizeof buf3 + sizeof buf4))
+ FAIL_RET ("first preadv returned an unexpected value");
+
+ if (memcmp (buf1, buf3, sizeof buf1) != 0)
+ FAIL_RET ("first buffer from first preadv different than expected");
+ if (memcmp (buf2, buf4, sizeof buf2) != 0)
+ FAIL_RET ("second buffer from first preadv different than expected");
+
+ ret = PREADV (temp_fd, iov, 2, sizeof buf3 + sizeof buf4 + offset);
+ if (ret == -1)
+ FAIL_RET ("second preadv returned -1");
+ if (ret != (sizeof buf3 + sizeof buf4))
+ FAIL_RET ("second preadv returned an unexpected value");
+
+ /* And compare the buffers read and written to check if there are equal. */
+ if (memcmp (buf1, buf3, sizeof buf1) != 0)
+ FAIL_RET ("first buffer from second preadv different than expected");
+ if (memcmp (buf2, buf4, sizeof buf2) != 0)
+ FAIL_RET ("second buffer from second preadv different than expected");
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/REORG.TODO/misc/tst-preadvwritev.c b/REORG.TODO/misc/tst-preadvwritev.c
new file mode 100644
index 0000000000..72742bfa54
--- /dev/null
+++ b/REORG.TODO/misc/tst-preadvwritev.c
@@ -0,0 +1,25 @@
+/* Tests for preadv and pwritev.
+ Copyright (C) 2016-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
+ <http://www.gnu.org/licenses/>. */
+
+#include "tst-preadvwritev-common.c"
+
+static int
+do_test (void)
+{
+ return do_test_with_offset (0);
+}
diff --git a/REORG.TODO/misc/tst-preadvwritev2.c b/REORG.TODO/misc/tst-preadvwritev2.c
new file mode 100644
index 0000000000..cf36272dd3
--- /dev/null
+++ b/REORG.TODO/misc/tst-preadvwritev2.c
@@ -0,0 +1,31 @@
+/* Tests for preadv2 and pwritev2.
+ Copyright (C) 2016-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
+ <http://www.gnu.org/licenses/>. */
+
+#define PREADV(__fd, __iov, __iovcnt, __offset) \
+ preadv2 (__fd, __iov, __iovcnt, __offset, 0)
+
+#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
+ pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
+
+#include "tst-preadvwritev-common.c"
+
+static int
+do_test (void)
+{
+ return do_test_with_offset (0);
+}
diff --git a/REORG.TODO/misc/tst-preadvwritev64.c b/REORG.TODO/misc/tst-preadvwritev64.c
new file mode 100644
index 0000000000..b115041b90
--- /dev/null
+++ b/REORG.TODO/misc/tst-preadvwritev64.c
@@ -0,0 +1,51 @@
+/* Tests for pread64 and pwrite64.
+ Copyright (C) 2016-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
+ <http://www.gnu.org/licenses/>. */
+
+#define _FILE_OFFSET_BITS 64
+#include "tst-preadvwritev-common.c"
+
+static int
+do_test (void)
+{
+ int ret;
+
+ ret = do_test_with_offset (0);
+
+ /* Create a sparse file larger than 4GB to check if offset is handled
+ correctly in p{write,read}v64. */
+ off_t base_offset = UINT32_MAX + 2048LL;
+ ret += do_test_with_offset (base_offset);
+
+ struct stat st;
+ if (fstat (temp_fd, &st) == -1)
+ {
+ printf ("error: fstat on temporary file failed: %m");
+ return 1;
+ }
+
+ /* The total size should base_offset plus 2 * 96. */
+ off_t expected_value = base_offset + (2 * (96LL));
+ if (st.st_size != expected_value)
+ {
+ printf ("error: file size different than expected (%jd != %jd)\n",
+ (intmax_t) expected_value, (intmax_t) st.st_size);
+ return 1;
+ }
+
+ return ret;
+}
diff --git a/REORG.TODO/misc/tst-preadvwritev64v2.c b/REORG.TODO/misc/tst-preadvwritev64v2.c
new file mode 100644
index 0000000000..8d0c48ea78
--- /dev/null
+++ b/REORG.TODO/misc/tst-preadvwritev64v2.c
@@ -0,0 +1,33 @@
+/* Tests for preadv2 and pwritev2 (LFS version).
+ Copyright (C) 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
+ <http://www.gnu.org/licenses/>. */
+
+#define _FILE_OFFSET_BITS 64
+
+#define PREADV(__fd, __iov, __iovcnt, __offset) \
+ preadv2 (__fd, __iov, __iovcnt, __offset, 0)
+
+#define PWRITEV(__fd, __iov, __iovcnt, __offset) \
+ pwritev2 (__fd, __iov, __iovcnt, __offset, 0)
+
+#include "tst-preadvwritev-common.c"
+
+static int
+do_test (void)
+{
+ return do_test_with_offset (0);
+}
diff --git a/REORG.TODO/misc/tst-pselect.c b/REORG.TODO/misc/tst-pselect.c
new file mode 100644
index 0000000000..0d11a809a0
--- /dev/null
+++ b/REORG.TODO/misc/tst-pselect.c
@@ -0,0 +1,130 @@
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/select.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+
+
+static volatile int handler_called;
+
+static void
+handler (int sig)
+{
+ handler_called = 1;
+}
+
+
+static int
+do_test (void)
+{
+ struct sigaction sa;
+ sa.sa_handler = handler;
+ sa.sa_flags = 0;
+ sigemptyset (&sa.sa_mask);
+
+ if (sigaction (SIGUSR1, &sa, NULL) != 0)
+ {
+ puts ("sigaction failed");
+ return 1;
+ }
+
+ sa.sa_handler = SIG_IGN;
+ if (sigaction (SIGCHLD, &sa, NULL) != 0)
+ {
+ puts ("2nd sigaction failed");
+ return 1;
+ }
+
+ sigset_t ss_usr1;
+ sigemptyset (&ss_usr1);
+ sigaddset (&ss_usr1, SIGUSR1);
+ if (sigprocmask (SIG_BLOCK, &ss_usr1, NULL) != 0)
+ {
+ puts ("sigprocmask failed");
+ return 1;
+ }
+
+ int fds[2][2];
+
+ if (pipe (fds[0]) != 0 || pipe (fds[1]) != 0)
+ {
+ puts ("pipe failed");
+ return 1;
+ }
+
+ fd_set rfds;
+ FD_ZERO (&rfds);
+
+ sigset_t ss;
+ sigprocmask (SIG_SETMASK, NULL, &ss);
+ sigdelset (&ss, SIGUSR1);
+
+ struct timespec to = { .tv_sec = 0, .tv_nsec = 500000000 };
+
+ pid_t parent = getpid ();
+ pid_t p = fork ();
+ if (p == 0)
+ {
+ close (fds[0][1]);
+ close (fds[1][0]);
+
+ FD_SET (fds[0][0], &rfds);
+
+ int e;
+ do
+ {
+ if (getppid () != parent)
+ exit (2);
+
+ errno = 0;
+ e = pselect (fds[0][0] + 1, &rfds, NULL, NULL, &to, &ss);
+ }
+ while (e == 0);
+
+ if (e != -1)
+ {
+ puts ("child: pselect did not fail");
+ return 0;
+ }
+ if (errno != EINTR)
+ {
+ puts ("child: pselect did not set errno to EINTR");
+ return 0;
+ }
+
+ TEMP_FAILURE_RETRY (write (fds[1][1], "foo", 3));
+
+ exit (0);
+ }
+
+ close (fds[0][0]);
+ close (fds[1][1]);
+
+ FD_SET (fds[1][0], &rfds);
+
+ kill (p, SIGUSR1);
+
+ int e = pselect (fds[1][0] + 1, &rfds, NULL, NULL, NULL, &ss);
+ if (e == -1)
+ {
+ puts ("parent: pselect failed");
+ return 1;
+ }
+ if (e != 1)
+ {
+ puts ("parent: pselect did not report readable fd");
+ return 1;
+ }
+ if (!FD_ISSET (fds[1][0], &rfds))
+ {
+ puts ("parent: pselect reports wrong fd");
+ return 1;
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/tst-tsearch.c b/REORG.TODO/misc/tst-tsearch.c
new file mode 100644
index 0000000000..6c8fff0e3f
--- /dev/null
+++ b/REORG.TODO/misc/tst-tsearch.c
@@ -0,0 +1,356 @@
+/* Test program for tsearch et al.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <search.h>
+#include <tst-stack-align.h>
+
+#define SEED 0
+#define BALANCED 1
+#define PASSES 100
+
+#if BALANCED
+#include <math.h>
+#define SIZE 1000
+#else
+#define SIZE 100
+#endif
+
+enum order
+{
+ ascending,
+ descending,
+ randomorder
+};
+
+enum action
+{
+ build,
+ build_and_del,
+ delete,
+ find
+};
+
+/* Set to 1 if a test is flunked. */
+static int error = 0;
+
+/* The keys we add to the tree. */
+static int x[SIZE];
+
+/* Pointers into the key array, possibly permutated, to define an order
+ for insertion/removal. */
+static int y[SIZE];
+
+/* Flags set for each element visited during a tree walk. */
+static int z[SIZE];
+
+/* Depths for all the elements, to check that the depth is constant for
+ all three visits. */
+static int depths[SIZE];
+
+/* Maximum depth during a tree walk. */
+static int max_depth;
+
+static int stack_align_check[2];
+
+/* Compare two keys. */
+static int
+cmp_fn (const void *a, const void *b)
+{
+ if (!stack_align_check[0])
+ stack_align_check[0] = TEST_STACK_ALIGN () ? -1 : 1;
+ return *(const int *) a - *(const int *) b;
+}
+
+/* Permute an array of integers. */
+static void
+memfry (int *string)
+{
+ int i;
+
+ for (i = 0; i < SIZE; ++i)
+ {
+ int32_t j;
+ int c;
+
+ j = random () % SIZE;
+
+ c = string[i];
+ string[i] = string[j];
+ string[j] = c;
+ }
+}
+
+static void
+walk_action (const void *nodep, const VISIT which, const int depth)
+{
+ int key = **(int **) nodep;
+
+ if (!stack_align_check[1])
+ stack_align_check[1] = TEST_STACK_ALIGN () ? -1 : 1;
+
+ if (depth > max_depth)
+ max_depth = depth;
+ if (which == leaf || which == preorder)
+ {
+ ++z[key];
+ depths[key] = depth;
+ }
+ else
+ {
+ if (depths[key] != depth)
+ {
+ fputs ("Depth for one element is not constant during tree walk.\n",
+ stdout);
+ }
+ }
+}
+
+static void
+walk_tree (void *root, int expected_count)
+{
+ int i;
+
+ memset (z, 0, sizeof z);
+ max_depth = 0;
+
+ twalk (root, walk_action);
+ for (i = 0; i < expected_count; ++i)
+ if (z[i] != 1)
+ {
+ fputs ("Node was not visited.\n", stdout);
+ error = 1;
+ }
+
+#if BALANCED
+ if (max_depth > log (expected_count) * 2 + 2)
+#else
+ if (max_depth > expected_count)
+#endif
+ {
+ fputs ("Depth too large during tree walk.\n", stdout);
+ error = 1;
+ }
+}
+
+/* Perform an operation on a tree. */
+static void
+mangle_tree (enum order how, enum action what, void **root, int lag)
+{
+ int i;
+
+ if (how == randomorder)
+ {
+ for (i = 0; i < SIZE; ++i)
+ y[i] = i;
+ memfry (y);
+ }
+
+ for (i = 0; i < SIZE + lag; ++i)
+ {
+ void *elem;
+ int j, k;
+
+ switch (how)
+ {
+ case randomorder:
+ if (i >= lag)
+ k = y[i - lag];
+ else
+ /* Ensure that the array index is within bounds. */
+ k = y[(SIZE - i - 1 + lag) % SIZE];
+ j = y[i % SIZE];
+ break;
+
+ case ascending:
+ k = i - lag;
+ j = i;
+ break;
+
+ case descending:
+ k = SIZE - i - 1 + lag;
+ j = SIZE - i - 1;
+ break;
+
+ default:
+ /* This never should happen, but gcc isn't smart enough to
+ recognize it. */
+ abort ();
+ }
+
+ switch (what)
+ {
+ case build_and_del:
+ case build:
+ if (i < SIZE)
+ {
+ if (tfind (x + j, (void *const *) root, cmp_fn) != NULL)
+ {
+ fputs ("Found element which is not in tree yet.\n", stdout);
+ error = 1;
+ }
+ elem = tsearch (x + j, root, cmp_fn);
+ if (elem == 0
+ || tfind (x + j, (void *const *) root, cmp_fn) == NULL)
+ {
+ fputs ("Couldn't find element after it was added.\n",
+ stdout);
+ error = 1;
+ }
+ }
+
+ if (what == build || i < lag)
+ break;
+
+ j = k;
+ /* fall through */
+
+ case delete:
+ elem = tfind (x + j, (void *const *) root, cmp_fn);
+ if (elem == NULL || tdelete (x + j, root, cmp_fn) == NULL)
+ {
+ fputs ("Error deleting element.\n", stdout);
+ error = 1;
+ }
+ break;
+
+ case find:
+ if (tfind (x + j, (void *const *) root, cmp_fn) == NULL)
+ {
+ fputs ("Couldn't find element after it was added.\n", stdout);
+ error = 1;
+ }
+ break;
+
+ }
+ }
+}
+
+
+static int
+do_test (void)
+{
+ int total_error = 0;
+ static char state[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+ void *root = NULL;
+ int i, j;
+
+ initstate (SEED, state, 8);
+
+ for (i = 0; i < SIZE; ++i)
+ x[i] = i;
+
+ /* Do this loop several times to get different permutations for the
+ random case. */
+ fputs ("Series I\n", stdout);
+ for (i = 0; i < PASSES; ++i)
+ {
+ fprintf (stdout, "Pass %d... ", i + 1);
+ fflush (stdout);
+ error = 0;
+
+ mangle_tree (ascending, build, &root, 0);
+ mangle_tree (ascending, find, &root, 0);
+ mangle_tree (descending, find, &root, 0);
+ mangle_tree (randomorder, find, &root, 0);
+ walk_tree (root, SIZE);
+ mangle_tree (ascending, delete, &root, 0);
+
+ mangle_tree (ascending, build, &root, 0);
+ walk_tree (root, SIZE);
+ mangle_tree (descending, delete, &root, 0);
+
+ mangle_tree (ascending, build, &root, 0);
+ walk_tree (root, SIZE);
+ mangle_tree (randomorder, delete, &root, 0);
+
+ mangle_tree (descending, build, &root, 0);
+ mangle_tree (ascending, find, &root, 0);
+ mangle_tree (descending, find, &root, 0);
+ mangle_tree (randomorder, find, &root, 0);
+ walk_tree (root, SIZE);
+ mangle_tree (descending, delete, &root, 0);
+
+ mangle_tree (descending, build, &root, 0);
+ walk_tree (root, SIZE);
+ mangle_tree (descending, delete, &root, 0);
+
+ mangle_tree (descending, build, &root, 0);
+ walk_tree (root, SIZE);
+ mangle_tree (randomorder, delete, &root, 0);
+
+ mangle_tree (randomorder, build, &root, 0);
+ mangle_tree (ascending, find, &root, 0);
+ mangle_tree (descending, find, &root, 0);
+ mangle_tree (randomorder, find, &root, 0);
+ walk_tree (root, SIZE);
+ mangle_tree (randomorder, delete, &root, 0);
+
+ for (j = 1; j < SIZE; j *= 2)
+ {
+ mangle_tree (randomorder, build_and_del, &root, j);
+ }
+
+ fputs (error ? " failed!\n" : " ok.\n", stdout);
+ total_error |= error;
+ }
+
+ fputs ("Series II\n", stdout);
+ for (i = 1; i < SIZE; i *= 2)
+ {
+ fprintf (stdout, "For size %d... ", i);
+ fflush (stdout);
+ error = 0;
+
+ mangle_tree (ascending, build_and_del, &root, i);
+ mangle_tree (descending, build_and_del, &root, i);
+ mangle_tree (ascending, build_and_del, &root, i);
+ mangle_tree (descending, build_and_del, &root, i);
+ mangle_tree (ascending, build_and_del, &root, i);
+ mangle_tree (descending, build_and_del, &root, i);
+ mangle_tree (ascending, build_and_del, &root, i);
+ mangle_tree (descending, build_and_del, &root, i);
+
+ fputs (error ? " failed!\n" : " ok.\n", stdout);
+ total_error |= error;
+ }
+
+ for (i = 0; i < 2; ++i)
+ if (stack_align_check[i] == 0)
+ {
+ printf ("stack alignment check %d not run\n", i);
+ total_error |= 1;
+ }
+ else if (stack_align_check[i] != 1)
+ {
+ printf ("stack insufficiently aligned in check %d\n", i);
+ total_error |= 1;
+ }
+
+ return total_error;
+}
+
+#define TIMEOUT 10
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/REORG.TODO/misc/ttyent.h b/REORG.TODO/misc/ttyent.h
new file mode 100644
index 0000000000..fe418a5377
--- /dev/null
+++ b/REORG.TODO/misc/ttyent.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ttyent.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _TTYENT_H
+#define _TTYENT_H 1
+
+#include <features.h>
+
+#define _PATH_TTYS "/etc/ttys"
+
+#define _TTYS_OFF "off"
+#define _TTYS_ON "on"
+#define _TTYS_SECURE "secure"
+#define _TTYS_WINDOW "window"
+
+struct ttyent {
+ char *ty_name; /* terminal device name */
+ char *ty_getty; /* command to execute, usually getty */
+ char *ty_type; /* terminal type for termcap */
+#define TTY_ON 0x01 /* enable logins (start ty_getty program) */
+#define TTY_SECURE 0x02 /* allow uid of 0 to login */
+ int ty_status; /* status flags */
+ char *ty_window; /* command to start up window manager */
+ char *ty_comment; /* comment field */
+};
+
+
+__BEGIN_DECLS
+
+extern struct ttyent *getttyent (void) __THROW;
+extern struct ttyent *getttynam (const char *__tty) __THROW;
+extern int setttyent (void) __THROW;
+extern int endttyent (void) __THROW;
+
+__END_DECLS
+
+#endif /* ttyent.h */
diff --git a/REORG.TODO/misc/ttyslot.c b/REORG.TODO/misc/ttyslot.c
new file mode 100644
index 0000000000..2f3c7953d7
--- /dev/null
+++ b/REORG.TODO/misc/ttyslot.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)ttyslot.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
+#include <ttyent.h>
+#include <alloca.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+ttyslot (void)
+{
+ struct ttyent *ttyp;
+ int slot;
+ char *p;
+ int cnt;
+ size_t buflen = __sysconf (_SC_TTY_NAME_MAX) + 1;
+ char *name;
+
+ if (buflen == 0)
+ /* This should be enough if no fixed value is given. */
+ buflen = 32;
+
+ name = __alloca (buflen);
+
+ __setttyent();
+ for (cnt = 0; cnt < 3; ++cnt)
+ if (__ttyname_r (cnt, name, buflen) == 0) {
+ if ((p = strrchr (name, '/')))
+ ++p;
+ else
+ p = name;
+ for (slot = 1; (ttyp = __getttyent()); ++slot)
+ if (!strcmp(ttyp->ty_name, p)) {
+ __endttyent();
+ return(slot);
+ }
+ break;
+ }
+ __endttyent();
+ return(0);
+}
diff --git a/REORG.TODO/misc/ualarm.c b/REORG.TODO/misc/ualarm.c
new file mode 100644
index 0000000000..cf6ef7914c
--- /dev/null
+++ b/REORG.TODO/misc/ualarm.c
@@ -0,0 +1,33 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set an alarm to go off (generating a SIGALRM signal) in VALUE microseconds.
+ If INTERVAL is nonzero, when the alarm goes off, the timer is reset to go
+ off every INTERVAL microseconds thereafter.
+
+ Returns the number of microseconds remaining before the alarm. */
+useconds_t
+ualarm (useconds_t value, useconds_t interval)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (ualarm)
diff --git a/REORG.TODO/misc/usleep.c b/REORG.TODO/misc/usleep.c
new file mode 100644
index 0000000000..6f96f55652
--- /dev/null
+++ b/REORG.TODO/misc/usleep.c
@@ -0,0 +1,29 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Sleep USECONDS microseconds, or until a previously set timer goes off. */
+int
+usleep (useconds_t useconds)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (usleep)
diff --git a/REORG.TODO/misc/ustat.c b/REORG.TODO/misc/ustat.c
new file mode 100644
index 0000000000..10450ef5af
--- /dev/null
+++ b/REORG.TODO/misc/ustat.c
@@ -0,0 +1,29 @@
+/* Return info on filesystem.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <unistd.h>
+#include <errno.h>
+#include <sys/ustat.h>
+
+int
+ustat (dev_t dev, struct ustat *ust)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (ustat)
diff --git a/REORG.TODO/misc/ustat.h b/REORG.TODO/misc/ustat.h
new file mode 100644
index 0000000000..cba150e446
--- /dev/null
+++ b/REORG.TODO/misc/ustat.h
@@ -0,0 +1 @@
+#include <sys/ustat.h>
diff --git a/REORG.TODO/misc/utimes.c b/REORG.TODO/misc/utimes.c
new file mode 100644
index 0000000000..73d91ace1c
--- /dev/null
+++ b/REORG.TODO/misc/utimes.c
@@ -0,0 +1,39 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/time.h>
+#include <errno.h>
+#include <stddef.h>
+
+/* Change the access time of FILE to TVP[0] and
+ the modification time of FILE to TVP[1]. */
+int
+__utimes (const char *file, const struct timeval tvp[2])
+{
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__utimes, utimes)
+
+stub_warning (utimes)
diff --git a/REORG.TODO/misc/vhangup.c b/REORG.TODO/misc/vhangup.c
new file mode 100644
index 0000000000..20baffe7c9
--- /dev/null
+++ b/REORG.TODO/misc/vhangup.c
@@ -0,0 +1,31 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Revoke access permissions to all processes currently communicating
+ with the control terminal, and then send a SIGHUP signal to the process
+ group of the control terminal. */
+int
+vhangup (void)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (vhangup)
diff --git a/REORG.TODO/misc/writev.c b/REORG.TODO/misc/writev.c
new file mode 100644
index 0000000000..c8d222e04f
--- /dev/null
+++ b/REORG.TODO/misc/writev.c
@@ -0,0 +1,35 @@
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Write data pointed by the buffers described by VECTOR, which
+ is a vector of COUNT `struct iovec's, to file descriptor FD.
+ The data is written in the order specified.
+ Operates just like `write' (see <unistd.h>) except that the data
+ are taken from VECTOR instead of a contiguous buffer. */
+ssize_t
+__writev (int fd, const struct iovec *vector, int count)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__writev, writev)
+
+stub_warning (writev)