summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-05-05 20:07:29 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-05-05 20:07:29 +0000
commitc29b18b38ccefba22c13b33dd801acba0ae92523 (patch)
tree9d3620ac17ff5fe7f6af8fb342fc0235e3c0245d /libc/sysdeps
parenta19eeb99758498e918043d50b57ba75b2d938e50 (diff)
Merge changes between r18362 and r18392 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@18393 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/i386/fpu/e_expl.S109
-rw-r--r--libc/sysdeps/i386/fpu/e_expl.c78
-rw-r--r--libc/sysdeps/ieee754/dbl-64/w_exp.c21
-rw-r--r--libc/sysdeps/ieee754/flt-32/w_expf.c21
-rw-r--r--libc/sysdeps/ieee754/ldbl-96/w_expl.c23
-rw-r--r--libc/sysdeps/unix/bsd/Implies3
-rw-r--r--libc/sysdeps/unix/bsd/bits/dirent.h32
-rw-r--r--libc/sysdeps/unix/bsd/bits/fcntl.h138
-rw-r--r--libc/sysdeps/unix/bsd/bsd4.4/isatty.c3
-rw-r--r--libc/sysdeps/unix/bsd/isatty.c31
-rw-r--r--libc/sysdeps/unix/bsd/tcdrain.c37
-rw-r--r--libc/sysdeps/unix/bsd/tcgetattr.c129
-rw-r--r--libc/sysdeps/unix/bsd/tcsetattr.c187
-rw-r--r--libc/sysdeps/unix/common/bits/dirent.h32
-rw-r--r--libc/sysdeps/unix/common/bits/fcntl.h119
-rw-r--r--libc/sysdeps/unix/common/syscalls.list15
-rw-r--r--libc/sysdeps/unix/syscalls.list12
-rw-r--r--libc/sysdeps/unix/sysv/linux/Implies3
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/ld.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/ld.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libBrokenLocale.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libBrokenLocale.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libanl.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libanl.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libc.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libcrypt.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libcrypt.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libdl.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libdl.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libm.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libm.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libnsl.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libnsl.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libpthread.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libpthread.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libresolv.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libresolv.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/librt.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/librt.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libthread_db.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libthread_db.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libutil.abilist (renamed from libc/sysdeps/unix/sysv/linux/x86_64/nptl/libutil.abilist)0
-rw-r--r--libc/sysdeps/unix/sysv/syscalls.list6
-rw-r--r--libc/sysdeps/x86_64/fpu/e_expl.S106
-rw-r--r--libc/sysdeps/x86_64/fpu/e_expl.c1
34 files changed, 242 insertions, 864 deletions
diff --git a/libc/sysdeps/i386/fpu/e_expl.S b/libc/sysdeps/i386/fpu/e_expl.S
new file mode 100644
index 000000000..45c4d0753
--- /dev/null
+++ b/libc/sysdeps/i386/fpu/e_expl.S
@@ -0,0 +1,109 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+/*
+ * The 8087 method for the exponential function is to calculate
+ * exp(x) = 2^(x log2(e))
+ * after separating integer and fractional parts
+ * x log2(e) = i + f, |f| <= .5
+ * 2^i is immediate but f needs to be precise for long double accuracy.
+ * Suppress range reduction error in computing f by the following.
+ * Separate x into integer and fractional parts
+ * x = xi + xf, |xf| <= .5
+ * Separate log2(e) into the sum of an exact number c0 and small part c1.
+ * c0 + c1 = log2(e) to extra precision
+ * Then
+ * f = (c0 xi - i) + c0 xf + c1 x
+ * where c0 xi is exact and so also is (c0 xi - i).
+ * -- moshier@na-net.ornl.gov
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst16,"aM",@progbits,16
+
+ .p2align 4
+ ASM_TYPE_DIRECTIVE(c0,@object)
+c0: .byte 0, 0, 0, 0, 0, 0, 0xaa, 0xb8, 0xff, 0x3f
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(c0)
+ ASM_TYPE_DIRECTIVE(c1,@object)
+c1: .byte 0x20, 0xfa, 0xee, 0xc2, 0x5f, 0x70, 0xa5, 0xec, 0xed, 0x3f
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(c1)
+ ASM_TYPE_DIRECTIVE(csat,@object)
+csat: .byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x0e, 0x40
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(csat)
+
+#ifdef PIC
+# define MO(op) op##@GOTOFF(%ecx)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_expl)
+ fldt 4(%esp)
+/* I added the following ugly construct because expl(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
+ movzwl 4+8(%esp), %eax
+ andl $0x7fff, %eax
+ cmpl $0x400d, %eax
+ jle 3f
+ /* Overflow, underflow or infinity or NaN as argument. */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ cmpb $0x01, %dh
+ je 2f /* Is +-NaN, jump. */
+ /* Overflow or underflow; saturate. */
+ fstp %st
+ fldt MO(csat)
+ andb $2, %ah
+ jz 3f
+ fchs
+3: fldl2e /* 1 log2(e) */
+ fmul %st(1), %st /* 1 x log2(e) */
+ frndint /* 1 i */
+ fld %st(1) /* 2 x */
+ frndint /* 2 xi */
+ fld %st(1) /* 3 i */
+ fldt MO(c0) /* 4 c0 */
+ fld %st(2) /* 5 xi */
+ fmul %st(1), %st /* 5 c0 xi */
+ fsubp %st, %st(2) /* 4 f = c0 xi - i */
+ fld %st(4) /* 5 x */
+ fsub %st(3), %st /* 5 xf = x - xi */
+ fmulp %st, %st(1) /* 4 c0 xf */
+ faddp %st, %st(1) /* 3 f = f + c0 xf */
+ fldt MO(c1) /* 4 */
+ fmul %st(4), %st /* 4 c1 * x */
+ faddp %st, %st(1) /* 3 f = f + c1 * x */
+ f2xm1 /* 3 2^(fract(x * log2(e))) - 1 */
+ fld1 /* 4 1.0 */
+ faddp /* 3 2^(fract(x * log2(e))) */
+ fstp %st(1) /* 2 */
+ fscale /* 2 scale factor is st(1); e^x */
+ fstp %st(1) /* 1 */
+ fstp %st(1) /* 0 */
+ jmp 2f
+1: testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+2: ret
+END(__ieee754_expl)
+strong_alias (__ieee754_expl, __expl_finite)
diff --git a/libc/sysdeps/i386/fpu/e_expl.c b/libc/sysdeps/i386/fpu/e_expl.c
deleted file mode 100644
index 8dc9581f7..000000000
--- a/libc/sysdeps/i386/fpu/e_expl.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- *
- * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
- */
-
-/*
- * The 8087 method for the exponential function is to calculate
- * exp(x) = 2^(x log2(e))
- * after separating integer and fractional parts
- * x log2(e) = i + f, |f| <= .5
- * 2^i is immediate but f needs to be precise for long double accuracy.
- * Suppress range reduction error in computing f by the following.
- * Separate x into integer and fractional parts
- * x = xi + xf, |xf| <= .5
- * Separate log2(e) into the sum of an exact number c0 and small part c1.
- * c0 + c1 = log2(e) to extra precision
- * Then
- * f = (c0 xi - i) + c0 xf + c1 x
- * where c0 xi is exact and so also is (c0 xi - i).
- * -- moshier@na-net.ornl.gov
- */
-
-#include <math_private.h>
-
-static const long double c0 = 1.44268798828125L;
-static const long double c1 = 7.05260771340735992468e-6L;
-
-long double
-__ieee754_expl (long double x)
-{
- long double res;
-
-/* I added the following ugly construct because expl(+-Inf) resulted
- in NaN. The ugliness results from the bright minds at Intel.
- For the i686 the code can be written better.
- -- drepper@cygnus.com. */
- asm ("fxam\n\t" /* Is NaN or +-Inf? */
- "fstsw %%ax\n\t"
- "movb $0x45, %%dh\n\t"
- "andb %%ah, %%dh\n\t"
- "cmpb $0x05, %%dh\n\t"
- "je 1f\n\t" /* Is +-Inf, jump. */
- "fldl2e\n\t" /* 1 log2(e) */
- "fmul %%st(1),%%st\n\t" /* 1 x log2(e) */
- "frndint\n\t" /* 1 i */
- "fld %%st(1)\n\t" /* 2 x */
- "frndint\n\t" /* 2 xi */
- "fld %%st(1)\n\t" /* 3 i */
- "fldt %2\n\t" /* 4 c0 */
- "fld %%st(2)\n\t" /* 5 xi */
- "fmul %%st(1),%%st\n\t" /* 5 c0 xi */
- "fsubp %%st,%%st(2)\n\t" /* 4 f = c0 xi - i */
- "fld %%st(4)\n\t" /* 5 x */
- "fsub %%st(3),%%st\n\t" /* 5 xf = x - xi */
- "fmulp %%st,%%st(1)\n\t" /* 4 c0 xf */
- "faddp %%st,%%st(1)\n\t" /* 3 f = f + c0 xf */
- "fldt %3\n\t" /* 4 */
- "fmul %%st(4),%%st\n\t" /* 4 c1 * x */
- "faddp %%st,%%st(1)\n\t" /* 3 f = f + c1 * x */
- "f2xm1\n\t" /* 3 2^(fract(x * log2(e))) - 1 */
- "fld1\n\t" /* 4 1.0 */
- "faddp\n\t" /* 3 2^(fract(x * log2(e))) */
- "fstp %%st(1)\n\t" /* 2 */
- "fscale\n\t" /* 2 scale factor is st(1); e^x */
- "fstp %%st(1)\n\t" /* 1 */
- "fstp %%st(1)\n\t" /* 0 */
- "jmp 2f\n\t"
- "1:\ttestl $0x200, %%eax\n\t" /* Test sign. */
- "jz 2f\n\t" /* If positive, jump. */
- "fstp %%st\n\t"
- "fldz\n\t" /* Set result to 0. */
- "2:\t\n"
- : "=t" (res) : "0" (x), "m" (c0), "m" (c1) : "ax", "dx");
- return res;
-}
-strong_alias (__ieee754_expl, __expl_finite)
diff --git a/libc/sysdeps/ieee754/dbl-64/w_exp.c b/libc/sysdeps/ieee754/dbl-64/w_exp.c
index aa8ff7689..14328a7b4 100644
--- a/libc/sysdeps/ieee754/dbl-64/w_exp.c
+++ b/libc/sysdeps/ieee754/dbl-64/w_exp.c
@@ -19,27 +19,16 @@
#include <math.h>
#include <math_private.h>
-static const double
-o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
-u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
-
-
/* wrapper exp */
double
__exp (double x)
{
- if (__builtin_expect (isgreater (x, o_threshold), 0))
- {
- if (_LIB_VERSION != _IEEE_)
- return __kernel_standard (x, x, 6);
- }
- else if (__builtin_expect (isless (x, u_threshold), 0))
- {
- if (_LIB_VERSION != _IEEE_)
- return __kernel_standard (x, x, 7);
- }
+ double z = __ieee754_exp (x);
+ if (__builtin_expect (!__finite (z) || z == 0, 0)
+ && __finite (x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard (x, x, 6 + !!__signbit (x));
- return __ieee754_exp (x);
+ return z;
}
hidden_def (__exp)
weak_alias (__exp, exp)
diff --git a/libc/sysdeps/ieee754/flt-32/w_expf.c b/libc/sysdeps/ieee754/flt-32/w_expf.c
index bc3b2f679..bfef9e4d2 100644
--- a/libc/sysdeps/ieee754/flt-32/w_expf.c
+++ b/libc/sysdeps/ieee754/flt-32/w_expf.c
@@ -19,27 +19,16 @@
#include <math.h>
#include <math_private.h>
-static const float
-o_threshold= 8.8722831726e+01, /* 0x42b17217 */
-u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */
-
-
/* wrapper expf */
float
__expf (float x)
{
- if (__builtin_expect (isgreater (x, o_threshold), 0))
- {
- if (_LIB_VERSION != _IEEE_)
- return __kernel_standard_f (x, x, 106);
- }
- else if (__builtin_expect (isless (x, u_threshold), 0))
- {
- if (_LIB_VERSION != _IEEE_)
- return __kernel_standard_f (x, x, 107);
- }
+ float z = __ieee754_expf (x);
+ if (__builtin_expect (!__finitef (z) || z == 0, 0)
+ && __finitef (x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_f (x, x, 106 + !!__signbitf (x));
- return __ieee754_expf (x);
+ return z;
}
hidden_def (__expf)
weak_alias (__expf, expf)
diff --git a/libc/sysdeps/ieee754/ldbl-96/w_expl.c b/libc/sysdeps/ieee754/ldbl-96/w_expl.c
index 55c68462b..79b10c575 100644
--- a/libc/sysdeps/ieee754/ldbl-96/w_expl.c
+++ b/libc/sysdeps/ieee754/ldbl-96/w_expl.c
@@ -19,29 +19,16 @@
#include <math.h>
#include <math_private.h>
-static const long double
-o_threshold= 1.135652340629414394949193107797076489134e4,
- /* 0x400C, 0xB17217F7, 0xD1CF79AC */
-u_threshold= -1.140019167866942050398521670162263001513e4;
- /* 0x400C, 0xB220C447, 0x69C201E8 */
-
-
/* wrapper expl */
long double
__expl (long double x)
{
- if (__builtin_expect (isgreater (x, o_threshold), 0))
- {
- if (_LIB_VERSION != _IEEE_)
- return __kernel_standard_l (x, x, 206);
- }
- else if (__builtin_expect (isless (x, u_threshold), 0))
- {
- if (_LIB_VERSION != _IEEE_)
- return __kernel_standard_l (x, x, 207);
- }
+ long double z = __ieee754_expl (x);
+ if (__builtin_expect (!__finitel (z) || z == 0, 0)
+ && __finitel (x) && _LIB_VERSION != _IEEE_)
+ return __kernel_standard_l (x, x, 206 + !!__signbitl (x));
- return __ieee754_expl (x);
+ return z;
}
hidden_def (__expl)
weak_alias (__expl, expl)
diff --git a/libc/sysdeps/unix/bsd/Implies b/libc/sysdeps/unix/bsd/Implies
index cfc44915d..c30979e17 100644
--- a/libc/sysdeps/unix/bsd/Implies
+++ b/libc/sysdeps/unix/bsd/Implies
@@ -1,5 +1,2 @@
-# The directory unix/common contains things which are common to both BSD
-# and SVR4.
-unix/common
# The directory unix/inet implements sockets and networking in the usual way.
unix/inet
diff --git a/libc/sysdeps/unix/bsd/bits/dirent.h b/libc/sysdeps/unix/bsd/bits/dirent.h
deleted file mode 100644
index e56efc43b..000000000
--- a/libc/sysdeps/unix/bsd/bits/dirent.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Directory entry structure `struct dirent'. 4.2BSD version.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _DIRENT_H
-# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
-#endif
-
-struct dirent
- {
- unsigned int d_fileno; /* 32 bits. */
- unsigned short int d_reclen; /* 16 bits. */
- unsigned short int d_namlen; /* 16 bits. */
- char d_name[1]; /* Variable length. */
- };
-
-#define _DIRENT_HAVE_D_RECLEN 1
-#define _DIRENT_HAVE_D_NAMLEN 1
diff --git a/libc/sysdeps/unix/bsd/bits/fcntl.h b/libc/sysdeps/unix/bsd/bits/fcntl.h
deleted file mode 100644
index df93999e7..000000000
--- a/libc/sysdeps/unix/bsd/bits/fcntl.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* O_*, F_*, FD_* bit values for 4.3 BSD.
- Copyright (C) 1991, 1992, 1997, 2004 Free Software Foundation, Inc.
- This file is part of the 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 _FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-/* File access modes for `open' and `fcntl'. */
-#define O_RDONLY 0 /* Open read-only. */
-#define O_WRONLY 1 /* Open write-only. */
-#define O_RDWR 2 /* Open read/write. */
-
-
-/* Bits OR'd into the second argument to open. */
-#define O_CREAT 0x0200 /* Create file if it doesn't exist. */
-#define O_EXCL 0x0800 /* Fail if file already exists. */
-#define O_TRUNC 0x0400 /* Truncate file to zero length. */
-/* Apparently not assigning a controlling terminal is the default
- behavior in BSD, so no bit is required to request that behavior. */
-#define O_NOCTTY 0 /* Don't assign a controlling terminal. */
-#if defined __USE_BSD || defined __USE_SVID
-# define O_ASYNC 0x0040 /* Send SIGIO to owner when data is ready. */
-# define O_FSYNC 0x2000 /* Synchronous writes. */
-# define O_SYNC O_FSYNC
-#endif
-
-/* File status flags for `open' and `fcntl'. */
-#define O_APPEND 0x0008 /* Writes append to the file. */
-#define O_NONBLOCK 0x0004 /* Non-blocking I/O. */
-
-#ifdef __USE_BSD
-/* BSD before 4.4 doesn't support POSIX.1 O_NONBLOCK,
- but O_NDELAY is close. */
-# define O_NDELAY O_NONBLOCK
-#endif
-
-#ifdef __USE_BSD
-/* Bits in the file status flags returned by F_GETFL.
- These are all the O_* flags, plus FREAD and FWRITE, which are
- independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
- given to `open'. */
-# define FREAD 1
-# define FWRITE 2
-
-/* Traditional BSD names the O_* bits. */
-# define FASYNC O_ASYNC
-# define FCREAT O_CREAT
-# define FEXCL O_EXCL
-# define FTRUNC O_TRUNC
-# define FNOCTTY O_NOCTTY
-# define FFSYNC O_FSYNC
-# define FSYNC O_SYNC
-# define FAPPEND O_APPEND
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif
-
-/* Mask for file access modes. This is system-dependent in case
- some system ever wants to define some other flavor of access. */
-#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-
-/* XXX missing */
-#define O_LARGEFILE 0
-
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
-# define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
-#endif
-#define F_GETLK 7 /* Get record locking info. */
-#define F_SETLK 8 /* Set record locking info (non-blocking). */
-#define F_SETLKW 9 /* Set record locking info (blocking). */
-
-/* XXX missing */
-#define F_GETLK64 7 /* Get record locking info. */
-#define F_SETLK64 8 /* Set record locking info (non-blocking). */
-#define F_SETLKW64 9 /* Set record locking info (blocking). */
-
-/* File descriptor flags used with F_GETFD and F_SETFD. */
-#define FD_CLOEXEC 1 /* Close on exec. */
-
-
-#include <bits/types.h>
-
-/* The structure describing an advisory lock. This is the type of the third
- argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */
-struct flock
- {
- short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
- short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
-#ifndef __USE_FILE_OFFSET64
- __off_t l_start; /* Offset where the lock begins. */
- __off_t l_len; /* Size of the locked area; zero means until EOF. */
-#else
- __off64_t l_start; /* Offset where the lock begins. */
- __off64_t l_len; /* Size of the locked area; zero means until EOF. */
-#endif
- short int l_pid; /* Process holding the lock. */
- short int l_xxx; /* Reserved for future use. */
- };
-
-#ifdef __USE_LARGEFILE64
-struct flock64
- {
- short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
- short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
- __off64_t l_start; /* Offset where the lock begins. */
- __off64_t l_len; /* Size of the locked area; zero means until EOF. */
- short int l_pid; /* Process holding the lock. */
- short int l_xxx; /* Reserved for future use. */
- };
-#endif
-
-/* Values for the `l_type' field of a `struct flock'. */
-#define F_RDLCK 1 /* Read lock. */
-#define F_WRLCK 2 /* Write lock. */
-#define F_UNLCK 3 /* Remove lock. */
diff --git a/libc/sysdeps/unix/bsd/bsd4.4/isatty.c b/libc/sysdeps/unix/bsd/bsd4.4/isatty.c
deleted file mode 100644
index 473368c93..000000000
--- a/libc/sysdeps/unix/bsd/bsd4.4/isatty.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* In a 4.4-derived world, tcgetattr is just one ioctl. */
-
-#include <sysdeps/posix/isatty.c>
diff --git a/libc/sysdeps/unix/bsd/isatty.c b/libc/sysdeps/unix/bsd/isatty.c
deleted file mode 100644
index e20b62f71..000000000
--- a/libc/sysdeps/unix/bsd/isatty.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1991,95,96,97,2002 Free Software Foundation, Inc.
- This file is part of the 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/ioctl.h>
-
-/* Return 1 if FD is a terminal, 0 if not. */
-int
-__isatty (fd)
- int fd;
-{
- struct sgttyb term;
-
- return __ioctl (fd, TIOCGETP, &term) == 0;
-}
-weak_alias (__isatty, isatty)
diff --git a/libc/sysdeps/unix/bsd/tcdrain.c b/libc/sysdeps/unix/bsd/tcdrain.c
deleted file mode 100644
index 5dc03cc30..000000000
--- a/libc/sysdeps/unix/bsd/tcdrain.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <stddef.h>
-#include <termios.h>
-#include <unistd.h>
-
-#include "bsdtty.h"
-
-/* Wait for pending output to be written on FD. */
-int
-__libc_tcdrain (int fd)
-{
- /* The TIOCSETP control waits for pending output to be written before
- affecting its changes, so we use that without changing anything. */
- struct sgttyb b;
- if (__ioctl (fd, TIOCGETP, (void *) &b) < 0 ||
- __ioctl (fd, TIOCSETP, (void *) &b) < 0)
- return -1;
- return 0;
-}
-weak_alias (__libc_tcdrain, tcdrain)
diff --git a/libc/sysdeps/unix/bsd/tcgetattr.c b/libc/sysdeps/unix/bsd/tcgetattr.c
deleted file mode 100644
index b3a54e390..000000000
--- a/libc/sysdeps/unix/bsd/tcgetattr.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <stddef.h>
-#include <termios.h>
-
-#include "bsdtty.h"
-
-extern const speed_t __bsd_speeds[]; /* Defined in tcsetattr.c. */
-
-/* Put the state of FD into *TERMIOS_P. */
-int
-__tcgetattr (fd, termios_p)
- int fd;
- struct termios *termios_p;
-{
- struct sgttyb buf;
- struct tchars tchars;
- struct ltchars ltchars;
- int local;
-#ifdef TIOCGETX
- int extra;
-#endif
-
- if (termios_p == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- if (__ioctl(fd, TIOCGETP, &buf) < 0 ||
- __ioctl(fd, TIOCGETC, &tchars) < 0 ||
- __ioctl(fd, TIOCGLTC, &ltchars) < 0 ||
-#ifdef TIOCGETX
- __ioctl(fd, TIOCGETX, &extra) < 0 ||
-#endif
- __ioctl(fd, TIOCLGET, &local) < 0)
- return -1;
-
- termios_p->__ispeed = __bsd_speeds[(unsigned char) buf.sg_ispeed];
- termios_p->__ospeed = __bsd_speeds[(unsigned char) buf.sg_ospeed];
-
- termios_p->c_iflag = 0;
- termios_p->c_oflag = 0;
- termios_p->c_cflag = 0;
- termios_p->c_lflag = 0;
- termios_p->c_oflag |= CREAD | HUPCL;
-#ifdef LPASS8
- if (local & LPASS8)
- termios_p->c_oflag |= CS8;
- else
-#endif
- termios_p->c_oflag |= CS7;
- if (!(buf.sg_flags & RAW))
- {
- termios_p->c_iflag |= IXON;
- termios_p->c_cflag |= OPOST;
-#ifndef NOISIG
- termios_p->c_lflag |= ISIG;
-#endif
- }
- if ((buf.sg_flags & (CBREAK|RAW)) == 0)
- termios_p->c_lflag |= ICANON;
- if (!(buf.sg_flags & RAW) && !(local & LLITOUT))
- termios_p->c_oflag |= OPOST;
- if (buf.sg_flags & CRMOD)
- termios_p->c_iflag |= ICRNL;
- if (buf.sg_flags & TANDEM)
- termios_p->c_iflag |= IXOFF;
-#ifdef TIOCGETX
- if (!(extra & NOISIG))
- termios_p->c_lflag |= ISIG;
- if (extra & STOPB)
- termios_p->c_cflag |= CSTOPB;
-#endif
-
- switch (buf.sg_flags & (EVENP|ODDP))
- {
- case EVENP|ODDP:
- break;
- case ODDP:
- termios_p->c_cflag |= PARODD;
- default:
- termios_p->c_cflag |= PARENB;
- termios_p->c_iflag |= IGNPAR | INPCK;
- break;
- }
- if (buf.sg_flags & ECHO)
- termios_p->c_lflag |= _ECHO;
- if (local & LCRTERA)
- termios_p->c_lflag |= ECHOE;
- if (local & LCRTKIL)
- termios_p->c_lflag |= ECHOK;
- if (local & LTOSTOP)
- termios_p->c_lflag |= _TOSTOP;
- if (local & LNOFLSH)
- termios_p->c_lflag |= _NOFLSH;
-
- termios_p->c_cc[VEOF] = tchars.t_eofc;
- termios_p->c_cc[VEOL] = '\n';
- termios_p->c_cc[VERASE] = buf.sg_erase;
- termios_p->c_cc[VKILL] = buf.sg_kill;
- termios_p->c_cc[VINTR] = tchars.t_intrc;
- termios_p->c_cc[VQUIT] = tchars.t_quitc;
- termios_p->c_cc[VSTART] = tchars.t_startc;
- termios_p->c_cc[VSTOP] = tchars.t_stopc;
- termios_p->c_cc[VSUSP] = ltchars.t_suspc;
- termios_p->c_cc[VMIN] = -1;
- termios_p->c_cc[VTIME] = -1;
-
- return 0;
-}
-
-weak_alias (__tcgetattr, tcgetattr)
diff --git a/libc/sysdeps/unix/bsd/tcsetattr.c b/libc/sysdeps/unix/bsd/tcsetattr.c
deleted file mode 100644
index 0741c475e..000000000
--- a/libc/sysdeps/unix/bsd/tcsetattr.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* Copyright (C) 1991, 1993, 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the 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 <termios.h>
-
-#include "bsdtty.h"
-
-
-const speed_t __bsd_speeds[] =
- {
- 0,
- 50,
- 75,
- 110,
- 134,
- 150,
- 200,
- 300,
- 600,
- 1200,
- 1800,
- 2400,
- 4800,
- 9600,
- 19200,
- 38400,
- };
-
-
-/* Set the state of FD to *TERMIOS_P. */
-int
-tcsetattr (fd, optional_actions, termios_p)
- int fd;
- int optional_actions;
- const struct termios *termios_p;
-{
- struct sgttyb buf;
- struct tchars tchars;
- struct ltchars ltchars;
- int local;
-#ifdef TIOCGETX
- int extra;
-#endif
- size_t i;
-
- if (__ioctl (fd, TIOCGETP, &buf) < 0 ||
- __ioctl (fd, TIOCGETC, &tchars) < 0 ||
- __ioctl (fd, TIOCGLTC, &ltchars) < 0 ||
-#ifdef TIOCGETX
- __ioctl (fd, TIOCGETX, &extra) < 0 ||
-#endif
- __ioctl (fd, TIOCLGET, &local) < 0)
- return -1;
-
- if (termios_p == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
- switch (optional_actions)
- {
- case TCSANOW:
- break;
- case TCSADRAIN:
- if (tcdrain (fd) < 0)
- return -1;
- break;
- case TCSAFLUSH:
- if (tcflush (fd, TCIFLUSH) < 0)
- return -1;
- break;
- default:
- __set_errno (EINVAL);
- return -1;
- }
-
- buf.sg_ispeed = buf.sg_ospeed = -1;
- for (i = 0; i <= sizeof (__bsd_speeds) / sizeof (__bsd_speeds[0]); ++i)
- {
- if (__bsd_speeds[i] == termios_p->__ispeed)
- buf.sg_ispeed = i;
- if (__bsd_speeds[i] == termios_p->__ospeed)
- buf.sg_ospeed = i;
- }
- if (buf.sg_ispeed == -1 || buf.sg_ospeed == -1)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- buf.sg_flags &= ~(CBREAK|RAW);
- if (!(termios_p->c_lflag & ICANON))
- buf.sg_flags |= (termios_p->c_cflag & ISIG) ? CBREAK : RAW;
-#ifdef LPASS8
- if (termios_p->c_oflag & CS8)
- local |= LPASS8;
- else
- local &= ~LPASS8;
-#endif
- if (termios_p->c_lflag & _NOFLSH)
- local |= LNOFLSH;
- else
- local &= ~LNOFLSH;
- if (termios_p->c_oflag & OPOST)
- local &= ~LLITOUT;
- else
- local |= LLITOUT;
-#ifdef TIOCGETX
- if (termios_p->c_lflag & ISIG)
- extra &= ~NOISIG;
- else
- extra |= NOISIG;
- if (termios_p->c_cflag & CSTOPB)
- extra |= STOPB;
- else
- extra &= ~STOPB;
-#endif
- if (termios_p->c_iflag & ICRNL)
- buf.sg_flags |= CRMOD;
- else
- buf.sg_flags &= ~CRMOD;
- if (termios_p->c_iflag & IXOFF)
- buf.sg_flags |= TANDEM;
- else
- buf.sg_flags &= ~TANDEM;
-
- buf.sg_flags &= ~(ODDP|EVENP);
- if (!(termios_p->c_cflag & PARENB))
- buf.sg_flags |= ODDP | EVENP;
- else if (termios_p->c_cflag & PARODD)
- buf.sg_flags |= ODDP;
- else
- buf.sg_flags |= EVENP;
-
- if (termios_p->c_lflag & _ECHO)
- buf.sg_flags |= ECHO;
- else
- buf.sg_flags &= ~ECHO;
- if (termios_p->c_lflag & ECHOE)
- local |= LCRTERA;
- else
- local &= ~LCRTERA;
- if (termios_p->c_lflag & ECHOK)
- local |= LCRTKIL;
- else
- local &= ~LCRTKIL;
- if (termios_p->c_lflag & _TOSTOP)
- local |= LTOSTOP;
- else
- local &= ~LTOSTOP;
-
- buf.sg_erase = termios_p->c_cc[VERASE];
- buf.sg_kill = termios_p->c_cc[VKILL];
- tchars.t_eofc = termios_p->c_cc[VEOF];
- tchars.t_intrc = termios_p->c_cc[VINTR];
- tchars.t_quitc = termios_p->c_cc[VQUIT];
- ltchars.t_suspc = termios_p->c_cc[VSUSP];
- tchars.t_startc = termios_p->c_cc[VSTART];
- tchars.t_stopc = termios_p->c_cc[VSTOP];
-
- if (__ioctl (fd, TIOCSETP, &buf) < 0 ||
- __ioctl (fd, TIOCSETC, &tchars) < 0 ||
- __ioctl (fd, TIOCSLTC, &ltchars) < 0 ||
-#ifdef TIOCGETX
- __ioctl (fd, TIOCSETX, &extra) < 0 ||
-#endif
- __ioctl (fd, TIOCLSET, &local) < 0)
- return -1;
- return 0;
-}
-libc_hidden_def (tcsetattr)
diff --git a/libc/sysdeps/unix/common/bits/dirent.h b/libc/sysdeps/unix/common/bits/dirent.h
deleted file mode 100644
index 8be701d3d..000000000
--- a/libc/sysdeps/unix/common/bits/dirent.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Directory entry structure `struct dirent'. SVR4 version.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _DIRENT_H
-# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
-#endif
-
-struct dirent
- {
- unsigned int d_fileno;
- int d_off; /* Position in directory of following entry. */
- unsigned short int d_reclen;
- char d_name[1]; /* Variable length. */
- };
-
-#define _DIRENT_HAVE_D_RECLEN 1
-#define _DIRENT_HAVE_D_OFF 1
diff --git a/libc/sysdeps/unix/common/bits/fcntl.h b/libc/sysdeps/unix/common/bits/fcntl.h
deleted file mode 100644
index 8b77444c0..000000000
--- a/libc/sysdeps/unix/common/bits/fcntl.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* O_*, F_*, FD_* bit values for general Unix system.
- Copyright (C) 1991, 1992, 1995, 1997, 2000, 2004
- Free Software Foundation, Inc.
- This file is part of the 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 _FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-/* File access modes for `open' and `fcntl'. */
-#define O_RDONLY 0 /* Open read-only. */
-#define O_WRONLY 1 /* Open write-only. */
-#define O_RDWR 2 /* Open read/write. */
-
-
-/* Bits OR'd into the second argument to open. */
-#define O_CREAT 0x0100 /* Create file if it doesn't exist. */
-#define O_EXCL 0x0400 /* Fail if file already exists. */
-#define O_TRUNC 0x0200 /* Truncate file to zero length. */
-#define O_NOCTTY 0x0800 /* Don't assign a controlling terminal. */
-#ifdef __USE_MISC
-# define O_ASYNC 0x0040 /* Send SIGIO to owner when data is ready. */
-# define O_FSYNC 0x0010 /* Synchronous writes. */
-# define O_SYNC O_FSYNC
-#endif
-
-/* File status flags for `open' and `fcntl'. */
-#define O_APPEND 0x0008 /* Writes append to the file. */
-#define O_NONBLOCK 0x0080 /* Non-blocking I/O. */
-
-#ifdef __USE_MISC
-# define O_NDELAY 0x0004
-#endif
-
-#ifdef __USE_MISC
-/* Bits in the file status flags returned by F_GETFL.
- These are all the O_* flags, plus FREAD and FWRITE, which are
- independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
- given to `open'. */
-# define FREAD 1
-# define FWRITE 2
-
-/* Traditional Unix names the O_* bits. */
-# define FASYNC O_ASYNC
-# define FCREAT O_CREAT
-# define FEXCL O_EXCL
-# define FTRUNC O_TRUNC
-# define FNOCTTY O_NOCTTY
-# define FFSYNC O_FSYNC
-# define FSYNC O_SYNC
-# define FAPPEND O_APPEND
-# define FNONBLOCK O_NONBLOCK
-# define FNONBIO O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif
-
-/* Mask for file access modes. This is system-dependent in case
- some system ever wants to define some other flavor of access. */
-#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_GETOWN 23 /* Get owner (receiver of SIGIO). */
-# define F_SETOWN 24 /* Set owner (receiver of SIGIO). */
-#endif
-#define F_GETLK 14 /* Get record locking info. */
-#define F_SETLK 6 /* Set record locking info (non-blocking). */
-#define F_SETLKW 7 /* Set record locking info (blocking). */
-#ifdef __USE_SVID
-# define F_ALLOCSP 10 /* Allocate space in the file. */
-# define F_FREESP 11 /* Free space in the file. */
-# define F_RGETLK 20 /* Get remote record locking info. */
-# define F_RSETLK 21 /* Set remote locking info (non-blocking). */
-# define F_RSETLKW 22 /* Set remote locking info (blocking). */
-#endif
-
-/* File descriptor flags used with F_GETFD and F_SETFD. */
-#define FD_CLOEXEC 1 /* Close on exec. */
-
-
-#include <bits/types.h>
-
-/* The structure describing an advisory lock. This is the type of the third
- argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */
-struct flock
- {
- short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
- short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
- __off_t l_start; /* Offset where the lock begins. */
- __off_t l_len; /* Size of the locked area; zero means until EOF. */
- long int l_sysid; /* System ID where locking process resides. */
- __pid_t l_pid; /* Process holding the lock. */
- long int pad[4]; /* Reserved for future use. */
- };
-
-/* Values for the `l_type' field of a `struct flock'. */
-#define F_RDLCK 1 /* Read lock. */
-#define F_WRLCK 2 /* Write lock. */
-#define F_UNLCK 3 /* Remove lock. */
diff --git a/libc/sysdeps/unix/common/syscalls.list b/libc/sysdeps/unix/common/syscalls.list
deleted file mode 100644
index f0a5ea0a6..000000000
--- a/libc/sysdeps/unix/common/syscalls.list
+++ /dev/null
@@ -1,15 +0,0 @@
-# File name Caller Syscall name # args Strong name Weak names
-
-adjtime - adjtime i:pp __adjtime adjtime
-fchmod - fchmod i:ii __fchmod fchmod
-fchown - fchown i:iii __fchown fchown
-ftruncate - ftruncate i:ii __ftruncate ftruncate
-getrusage - getrusage i:ip __getrusage getrusage
-gettimeofday - gettimeofday i:PP __gettimeofday gettimeofday __gettimeofday_internal
-settimeofday - settimeofday i:PP __settimeofday settimeofday
-setpgid - setpgrp i:ii __setpgid setpgid
-setregid - setregid i:ii __setregid setregid
-setreuid - setreuid i:ii __setreuid setreuid
-sigaction - sigaction i:ipp __sigaction sigaction
-truncate - truncate i:si __truncate truncate
-vhangup - vhangup i:i vhangup
diff --git a/libc/sysdeps/unix/syscalls.list b/libc/sysdeps/unix/syscalls.list
index 6f423bf44..5c696b31c 100644
--- a/libc/sysdeps/unix/syscalls.list
+++ b/libc/sysdeps/unix/syscalls.list
@@ -2,6 +2,7 @@
access - access i:si __access access
acct - acct i:S acct
+adjtime - adjtime i:pp __adjtime adjtime
chdir - chdir i:s __chdir chdir
chmod - chmod i:si __chmod chmod
chown - chown i:sii __chown __chown_internal chown
@@ -11,9 +12,12 @@ dup - dup i:i __dup dup
dup2 - dup2 i:ii __dup2 dup2
dup3 - dup3 i:iii dup3
fchdir - fchdir i:i __fchdir fchdir
+fchmod - fchmod i:ii __fchmod fchmod
+fchown - fchown i:iii __fchown fchown
fcntl - fcntl Ci:iiF __libc_fcntl __fcntl __fcntl_internal fcntl
fstatfs - fstatfs i:ip __fstatfs fstatfs
fsync - fsync Ci:i __libc_fsync fsync
+ftruncate - ftruncate i:ii __ftruncate ftruncate
getdomain - getdomainname i:si getdomainname
getgid - getgid Ei: __getgid getgid
getgroups - getgroups i:ip __getgroups getgroups
@@ -21,6 +25,8 @@ getitimer - getitimer i:ip __getitimer getitimer
getpid - getpid Ei: __getpid getpid
getpriority - getpriority i:ii getpriority
getrlimit - getrlimit i:ip __getrlimit getrlimit
+getrusage - getrusage i:ip __getrusage getrusage
+gettimeofday - gettimeofday i:PP __gettimeofday gettimeofday __gettimeofday_internal
getuid - getuid Ei: __getuid getuid
ioctl - ioctl i:iiI __ioctl ioctl
kill - kill i:ii __kill kill
@@ -48,11 +54,15 @@ seteuid - seteuid i:i __seteuid seteuid
setgid - setgid i:i __setgid setgid
setgroups - setgroups i:ip setgroups
setitimer - setitimer i:ipp __setitimer setitimer
+setpgid - setpgrp i:ii __setpgid setpgid
setpriority - setpriority i:iii setpriority
+setregid - setregid i:ii __setregid setregid
+setreuid - setreuid i:ii __setreuid setreuid
setrlimit - setrlimit i:ip __setrlimit setrlimit
setsid - setsid i: __setsid setsid
settimeofday - settimeofday i:PP __settimeofday settimeofday
setuid - setuid i:i __setuid setuid
+sigaction - sigaction i:ipp __sigaction sigaction
sigsuspend - sigsuspend Ci:p sigsuspend
sstk - sstk b:i sstk
statfs - statfs i:sp __statfs statfs
@@ -61,9 +71,11 @@ swapon - swapon i:s swapon
symlink - symlink i:ss __symlink symlink
sync - sync i: sync
syncfs - syncfs i:i syncfs
+truncate - truncate i:si __truncate truncate
umask - umask Ei:i __umask umask
uname - uname i:p __uname uname
unlink - unlink i:s __unlink unlink
utimes - utimes i:sp __utimes utimes
+vhangup - vhangup i:i vhangup
write - write Ci:ibn __libc_write __write write
writev - writev Ci:ipi __writev writev
diff --git a/libc/sysdeps/unix/sysv/linux/Implies b/libc/sysdeps/unix/sysv/linux/Implies
index ab04990ad..b04bb6b33 100644
--- a/libc/sysdeps/unix/sysv/linux/Implies
+++ b/libc/sysdeps/unix/sysv/linux/Implies
@@ -2,8 +2,5 @@
# Hurd-based GNU systems.
gnu
-# Linux shares most of the syscalls which are also common to BSD and SVR4.
-unix/common
-
# Linux has network support in the kernel.
unix/inet
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/ld.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/ld.abilist
index fb1e8d481..fb1e8d481 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/ld.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/ld.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libBrokenLocale.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libBrokenLocale.abilist
index be74b4bf0..be74b4bf0 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libBrokenLocale.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libBrokenLocale.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libanl.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libanl.abilist
index a525e60f6..a525e60f6 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libanl.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libanl.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libc.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
index 6f15f00e1..6f15f00e1 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libc.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libcrypt.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libcrypt.abilist
index 23d4ce006..23d4ce006 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libcrypt.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libcrypt.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libdl.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libdl.abilist
index 61c587b0b..61c587b0b 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libdl.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libdl.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libm.abilist
index 7bf568c51..7bf568c51 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libm.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libm.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libnsl.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libnsl.abilist
index a6aa9125b..a6aa9125b 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libnsl.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libnsl.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libpthread.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libpthread.abilist
index 7c33f350d..7c33f350d 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libpthread.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libpthread.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libresolv.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libresolv.abilist
index 330393617..330393617 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libresolv.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libresolv.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/librt.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/librt.abilist
index 2bd7ff403..2bd7ff403 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/librt.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/librt.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libthread_db.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libthread_db.abilist
index eed6765bc..eed6765bc 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libthread_db.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libthread_db.abilist
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libutil.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libutil.abilist
index 78e6cf526..78e6cf526 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/nptl/libutil.abilist
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libutil.abilist
diff --git a/libc/sysdeps/unix/sysv/syscalls.list b/libc/sysdeps/unix/sysv/syscalls.list
index dc6a4311f..c508dd0ec 100644
--- a/libc/sysdeps/unix/sysv/syscalls.list
+++ b/libc/sysdeps/unix/sysv/syscalls.list
@@ -1,15 +1,9 @@
# File name Caller Syscall name # args Strong name Weak names
alarm - alarm i:i alarm
-ftime - ftime i:p ftime
-nice - nice i:i nice
pause - pause Ci: pause
-poll - poll Ci:pii poll
setrlimit - setrlimit i:ip __setrlimit setrlimit
settimeofday - settimeofday i:PP __settimeofday settimeofday
-signal - signal i:ii signal
stime - stime i:p stime
-time - time Ei:P time
-times - times Ei:p __times times
ulimit - ulimit i:ii ulimit
utime - utime i:sP utime
diff --git a/libc/sysdeps/x86_64/fpu/e_expl.S b/libc/sysdeps/x86_64/fpu/e_expl.S
new file mode 100644
index 000000000..d497b2897
--- /dev/null
+++ b/libc/sysdeps/x86_64/fpu/e_expl.S
@@ -0,0 +1,106 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+/*
+ * The 8087 method for the exponential function is to calculate
+ * exp(x) = 2^(x log2(e))
+ * after separating integer and fractional parts
+ * x log2(e) = i + f, |f| <= .5
+ * 2^i is immediate but f needs to be precise for long double accuracy.
+ * Suppress range reduction error in computing f by the following.
+ * Separate x into integer and fractional parts
+ * x = xi + xf, |xf| <= .5
+ * Separate log2(e) into the sum of an exact number c0 and small part c1.
+ * c0 + c1 = log2(e) to extra precision
+ * Then
+ * f = (c0 xi - i) + c0 xf + c1 x
+ * where c0 xi is exact and so also is (c0 xi - i).
+ * -- moshier@na-net.ornl.gov
+ */
+
+#include <machine/asm.h>
+
+ .section .rodata.cst16,"aM",@progbits,16
+
+ .p2align 4
+ ASM_TYPE_DIRECTIVE(c0,@object)
+c0: .byte 0, 0, 0, 0, 0, 0, 0xaa, 0xb8, 0xff, 0x3f
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(c0)
+ ASM_TYPE_DIRECTIVE(c1,@object)
+c1: .byte 0x20, 0xfa, 0xee, 0xc2, 0x5f, 0x70, 0xa5, 0xec, 0xed, 0x3f
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(c1)
+ ASM_TYPE_DIRECTIVE(csat,@object)
+csat: .byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x0e, 0x40
+ .byte 0, 0, 0, 0, 0, 0
+ ASM_SIZE_DIRECTIVE(csat)
+
+#ifdef PIC
+# define MO(op) op##(%rip)
+#else
+# define MO(op) op
+#endif
+
+ .text
+ENTRY(__ieee754_expl)
+ fldt 8(%rsp)
+/* I added the following ugly construct because expl(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ For the i686 the code can be written better.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+ movzwl 8+8(%rsp), %eax
+ andl $0x7fff, %eax
+ cmpl $0x400d, %eax
+ jle 3f
+ /* Overflow, underflow or infinity or NaN as argument. */
+ fstsw %ax
+ movb $0x45, %dh
+ andb %ah, %dh
+ cmpb $0x05, %dh
+ je 1f /* Is +-Inf, jump. */
+ cmpb $0x01, %dh
+ je 2f /* Is +-NaN, jump. */
+ /* Overflow or underflow; saturate. */
+ fstp %st
+ fldt MO(csat)
+ andb $2, %ah
+ jz 3f
+ fchs
+3: fldl2e /* 1 log2(e) */
+ fmul %st(1), %st /* 1 x log2(e) */
+ frndint /* 1 i */
+ fld %st(1) /* 2 x */
+ frndint /* 2 xi */
+ fld %st(1) /* 3 i */
+ fldt MO(c0) /* 4 c0 */
+ fld %st(2) /* 5 xi */
+ fmul %st(1), %st /* 5 c0 xi */
+ fsubp %st, %st(2) /* 4 f = c0 xi - i */
+ fld %st(4) /* 5 x */
+ fsub %st(3), %st /* 5 xf = x - xi */
+ fmulp %st, %st(1) /* 4 c0 xf */
+ faddp %st, %st(1) /* 3 f = f + c0 xf */
+ fldt MO(c1) /* 4 */
+ fmul %st(4), %st /* 4 c1 * x */
+ faddp %st, %st(1) /* 3 f = f + c1 * x */
+ f2xm1 /* 3 2^(fract(x * log2(e))) - 1 */
+ fld1 /* 4 1.0 */
+ faddp /* 3 2^(fract(x * log2(e))) */
+ fstp %st(1) /* 2 */
+ fscale /* 2 scale factor is st(1); e^x */
+ fstp %st(1) /* 1 */
+ fstp %st(1) /* 0 */
+ jmp 2f
+1: testl $0x200, %eax /* Test sign. */
+ jz 2f /* If positive, jump. */
+ fstp %st
+ fldz /* Set result to 0. */
+2: ret
+END(__ieee754_expl)
+strong_alias (__ieee754_expl, __expl_finite)
diff --git a/libc/sysdeps/x86_64/fpu/e_expl.c b/libc/sysdeps/x86_64/fpu/e_expl.c
deleted file mode 100644
index 5042e02db..000000000
--- a/libc/sysdeps/x86_64/fpu/e_expl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "sysdeps/i386/fpu/e_expl.c"