diff options
Diffstat (limited to 'libc/sysdeps/unix/sysv')
26 files changed, 138 insertions, 96 deletions
diff --git a/libc/sysdeps/unix/sysv/linux/Makefile b/libc/sysdeps/unix/sysv/linux/Makefile index f82c94982..f580635c8 100644 --- a/libc/sysdeps/unix/sysv/linux/Makefile +++ b/libc/sysdeps/unix/sysv/linux/Makefile @@ -152,7 +152,7 @@ endif ifeq ($(subdir),io) sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \ - sync_file_range open_2 open64_2 fallocate fallocate64 + sync_file_range fallocate fallocate64 sysdep_headers += bits/fcntl-linux.h endif diff --git a/libc/sysdeps/unix/sysv/linux/bits/sched.h b/libc/sysdeps/unix/sysv/linux/bits/sched.h index 5e8057b62..e42dee8e6 100644 --- a/libc/sysdeps/unix/sysv/linux/bits/sched.h +++ b/libc/sysdeps/unix/sysv/linux/bits/sched.h @@ -144,21 +144,21 @@ typedef struct # define __CPU_SET_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ - __cpu < 8 * (setsize) \ + __cpu / 8 < (setsize) \ ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ |= __CPUMASK (__cpu)) \ : 0; })) # define __CPU_CLR_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ - __cpu < 8 * (setsize) \ + __cpu / 8 < (setsize) \ ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ &= ~__CPUMASK (__cpu)) \ : 0; })) # define __CPU_ISSET_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ - __cpu < 8 * (setsize) \ + __cpu / 8 < (setsize) \ ? ((((const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ & __CPUMASK (__cpu))) != 0 \ : 0; })) diff --git a/libc/sysdeps/unix/sysv/linux/bits/socket.h b/libc/sysdeps/unix/sysv/linux/bits/socket.h index eadd7d932..9312849d0 100644 --- a/libc/sysdeps/unix/sysv/linux/bits/socket.h +++ b/libc/sysdeps/unix/sysv/linux/bits/socket.h @@ -79,7 +79,8 @@ typedef __socklen_t socklen_t; #define PF_CAIF 37 /* CAIF sockets. */ #define PF_ALG 38 /* Algorithm sockets. */ #define PF_NFC 39 /* NFC sockets. */ -#define PF_MAX 40 /* For now.. */ +#define PF_VSOCK 40 /* vSockets. */ +#define PF_MAX 41 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -123,6 +124,7 @@ typedef __socklen_t socklen_t; #define AF_CAIF PF_CAIF #define AF_ALG PF_ALG #define AF_NFC PF_NFC +#define AF_VSOCK PF_VSOCK #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. diff --git a/libc/sysdeps/unix/sysv/linux/check_pf.c b/libc/sysdeps/unix/sysv/linux/check_pf.c index 8bc025b04..34c21461b 100644 --- a/libc/sysdeps/unix/sysv/linux/check_pf.c +++ b/libc/sysdeps/unix/sysv/linux/check_pf.c @@ -24,6 +24,7 @@ #include <string.h> #include <time.h> #include <unistd.h> +#include <stdint.h> #include <sys/socket.h> #include <asm/types.h> diff --git a/libc/sysdeps/unix/sysv/linux/dl-writev.h b/libc/sysdeps/unix/sysv/linux/dl-writev.h new file mode 100644 index 000000000..b682e0c4b --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/dl-writev.h @@ -0,0 +1,38 @@ +/* Message-writing for the dynamic linker. Linux version. + Copyright (C) 2013 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> +#include <sysdep.h> + +/* This is used from only one place: dl-misc.c:_dl_debug_vdprintf. + Hence it's in a header with the expectation it will be inlined. + + This is writev, but with a constraint added and others loosened: + + 1. Under RTLD_PRIVATE_ERRNO, it must not clobber the private errno + when another thread holds the dl_load_lock. + 2. It is not obliged to detect and report errors at all. + 3. It's not really obliged to deliver a single atomic write + (though it may be preferable). */ + +static inline void +_dl_writev (int fd, const struct iovec *iov, size_t niov) +{ + INTERNAL_SYSCALL_DECL (err); + INTERNAL_SYSCALL (writev, err, 3, fd, iov, niov); +} diff --git a/libc/sysdeps/unix/sysv/linux/getipv4sourcefilter.c b/libc/sysdeps/unix/sysv/linux/getipv4sourcefilter.c index 5c90caa8a..99082483b 100644 --- a/libc/sysdeps/unix/sysv/linux/getipv4sourcefilter.c +++ b/libc/sysdeps/unix/sysv/linux/getipv4sourcefilter.c @@ -21,6 +21,7 @@ #include <errno.h> #include <stdlib.h> #include <string.h> +#include <stdint.h> #include <netinet/in.h> #include <sys/param.h> #include <sys/socket.h> diff --git a/libc/sysdeps/unix/sysv/linux/getsourcefilter.c b/libc/sysdeps/unix/sysv/linux/getsourcefilter.c index 063d6c650..682f42489 100644 --- a/libc/sysdeps/unix/sysv/linux/getsourcefilter.c +++ b/libc/sysdeps/unix/sysv/linux/getsourcefilter.c @@ -22,6 +22,7 @@ #include <errno.h> #include <stdlib.h> #include <string.h> +#include <stdint.h> #include <netatalk/at.h> #include <netax25/ax25.h> #include <netinet/in.h> diff --git a/libc/sysdeps/unix/sysv/linux/netlinkaccess.h b/libc/sysdeps/unix/sysv/linux/netlinkaccess.h index 7c1deb9b7..e0da57a0c 100644 --- a/libc/sysdeps/unix/sysv/linux/netlinkaccess.h +++ b/libc/sysdeps/unix/sysv/linux/netlinkaccess.h @@ -18,6 +18,7 @@ #ifndef _NETLINKACCESS_H #define _NETLINKACCESS_H 1 +#include <stdint.h> #include <asm/types.h> #include <linux/netlink.h> #include <linux/rtnetlink.h> diff --git a/libc/sysdeps/unix/sysv/linux/open64_2.c b/libc/sysdeps/unix/sysv/linux/open64_2.c deleted file mode 100644 index bff222271..000000000 --- a/libc/sysdeps/unix/sysv/linux/open64_2.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2007-2013 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> - - -int -__open64_2 (file, oflag) - const char *file; - int oflag; -{ - if (oflag & O_CREAT) - __fortify_fail ("invalid open64 call: O_CREAT without mode"); - - return __open64 (file, oflag); -} diff --git a/libc/sysdeps/unix/sysv/linux/open_2.c b/libc/sysdeps/unix/sysv/linux/open_2.c deleted file mode 100644 index 572615770..000000000 --- a/libc/sysdeps/unix/sysv/linux/open_2.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2007-2013 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> - - -int -__open_2 (file, oflag) - const char *file; - int oflag; -{ - if (oflag & O_CREAT) - __fortify_fail ("invalid open call: O_CREAT without mode"); - - return __open (file, oflag); -} diff --git a/libc/sysdeps/unix/sysv/linux/openat.c b/libc/sysdeps/unix/sysv/linux/openat.c index d2ef42973..6e838dfd0 100644 --- a/libc/sysdeps/unix/sysv/linux/openat.c +++ b/libc/sysdeps/unix/sysv/linux/openat.c @@ -29,7 +29,6 @@ #ifndef OPENAT # define OPENAT openat -# define __OPENAT_2 __openat_2 # ifndef __ASSUME_ATFCTS /* Set errno after a failed call. If BUF is not null, @@ -179,18 +178,3 @@ __OPENAT (fd, file, oflag) } libc_hidden_def (__OPENAT) weak_alias (__OPENAT, OPENAT) - - -int -__OPENAT_2 (fd, file, oflag) - int fd; - const char *file; - int oflag; -{ - if (oflag & O_CREAT) -#define MSG(s) MSG2 (s) -#define MSG2(s) "invalid " #s " call: O_CREAT without mode" - __fortify_fail (MSG (OPENAT)); - - return __OPENAT (fd, file, oflag); -} diff --git a/libc/sysdeps/unix/sysv/linux/openat64.c b/libc/sysdeps/unix/sysv/linux/openat64.c index 013a13eff..9e7a2b373 100644 --- a/libc/sysdeps/unix/sysv/linux/openat64.c +++ b/libc/sysdeps/unix/sysv/linux/openat64.c @@ -1,5 +1,4 @@ #define OPENAT openat64 -#define __OPENAT_2 __openat64_2 #define MORE_OFLAGS O_LARGEFILE #include "openat.c" diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/Versions b/libc/sysdeps/unix/sysv/linux/powerpc/Versions index 396a4236c..289c4fe9b 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/Versions +++ b/libc/sysdeps/unix/sysv/linux/powerpc/Versions @@ -4,5 +4,6 @@ libc { __vdso_clock_gettime; __vdso_clock_getres; __vdso_getcpu; + __vdso_time; } } diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h b/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h index 5f5fc1eb3..8b195db1b 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h +++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h @@ -32,14 +32,16 @@ extern void *__vdso_get_tbfreq; extern void *__vdso_getcpu; +extern void *__vdso_time; + /* This macro is needed for PPC64 to return a skeleton OPD entry of a vDSO symbol. This works because _dl_vdso_vsym always return the function address, and no vDSO symbols use the TOC or chain pointers from the OPD so we can allow them to be garbage. */ #if defined(__PPC64__) || defined(__powerpc64__) -#define VDSO_IFUNC_RET(value) &value +#define VDSO_IFUNC_RET(value) ((void *) &(value)) #else -#define VDSO_IFUNC_RET(value) value +#define VDSO_IFUNC_RET(value) ((void *) (value)) #endif #endif diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c b/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c index 204c0c60a..f6f05f0ba 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c +++ b/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c @@ -28,7 +28,7 @@ void *__vdso_clock_gettime; void *__vdso_clock_getres; void *__vdso_get_tbfreq; void *__vdso_getcpu; - +void *__vdso_time; static inline void _libc_vdso_platform_setup (void) @@ -44,6 +44,8 @@ _libc_vdso_platform_setup (void) __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_get_tbfreq", &linux2615); __vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux2615); + + __vdso_time = _dl_vdso_vsym ("__kernel_time", &linux2615); } # define VDSO_SETUP _libc_vdso_platform_setup diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq.c b/libc/sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq.c index 779ea49c8..344496b7e 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq.c +++ b/libc/sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq.c @@ -22,6 +22,7 @@ #include <inttypes.h> #include <stdio.h> +#include <stdint.h> #include <sys/platform/ppc.h> diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/time.c b/libc/sysdeps/unix/sysv/linux/powerpc/time.c new file mode 100644 index 000000000..66b4eb304 --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/powerpc/time.c @@ -0,0 +1,62 @@ +/* time system call for Linux/PowerPC. + Copyright (C) 2013 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/>. */ + +#ifdef SHARED + +# include <time.h> +# include <sysdep.h> +# include <bits/libc-vdso.h> + +void *time_ifunc (void) asm ("time"); + +static time_t +time_syscall (time_t *t) +{ + struct timeval tv; + time_t result; + + if (INLINE_VSYSCALL (gettimeofday, 2, &tv, NULL) < 0) + result = (time_t) -1; + else + result = (time_t) tv.tv_sec; + + if (t != NULL) + *t = result; + return result; +} + +void * +time_ifunc (void) +{ + /* If the vDSO is not available we fall back to the syscall. */ + return (__vdso_time ? VDSO_IFUNC_RET (__vdso_time) + : time_syscall); +} +asm (".type time, %gnu_indirect_function"); + +/* This is doing "libc_hidden_def (time)" but the compiler won't + * let us do it in C because it doesn't know we're defining time + * here in this file. */ +asm (".globl __GI_time\n" + "__GI_time = time"); + +#else + +#include <sysdeps/posix/time.c> + +#endif diff --git a/libc/sysdeps/unix/sysv/linux/preadv.c b/libc/sysdeps/unix/sysv/linux/preadv.c index 219c6632a..e92af92eb 100644 --- a/libc/sysdeps/unix/sysv/linux/preadv.c +++ b/libc/sysdeps/unix/sysv/linux/preadv.c @@ -18,6 +18,7 @@ #include <errno.h> #include <stddef.h> #include <sys/param.h> +#include <stdint.h> #if __WORDSIZE == 64 /* Hide the preadv64 declaration. */ # define preadv64 __redirect_preadv64 diff --git a/libc/sysdeps/unix/sysv/linux/pwritev.c b/libc/sysdeps/unix/sysv/linux/pwritev.c index 51b46d66b..8dcd21675 100644 --- a/libc/sysdeps/unix/sysv/linux/pwritev.c +++ b/libc/sysdeps/unix/sysv/linux/pwritev.c @@ -17,6 +17,7 @@ #include <errno.h> #include <stddef.h> +#include <stdint.h> #include <sys/param.h> #if __WORDSIZE == 64 && !defined PWRITEV /* Hide the pwritev64 declaration. */ diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/siginfo.h b/libc/sysdeps/unix/sysv/linux/s390/bits/siginfo.h index ad122084c..19c94e77b 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/bits/siginfo.h +++ b/libc/sysdeps/unix/sysv/linux/s390/bits/siginfo.h @@ -95,7 +95,7 @@ typedef struct struct { void *si_addr; /* Faulting insn/memory ref. */ - int si_trapno; + short si_addr_lsb; /* Valid LSB of the reported address. */ } _sigfault; /* SIGPOLL. */ @@ -128,7 +128,7 @@ typedef struct # define si_int _sifields._rt.si_sigval.sival_int # define si_ptr _sifields._rt.si_sigval.sival_ptr # define si_addr _sifields._sigfault.si_addr -# define si_trapno _sifields._sigfault.si_trapno +# define si_addr_lsb _sifields._sigfault.si_addr_lsb # define si_band _sifields._sigpoll.si_band # define si_fd _sifields._sigpoll.si_fd # define si_call_addr _sifields._sigsys._call_addr @@ -219,8 +219,12 @@ enum # define BUS_ADRALN BUS_ADRALN BUS_ADRERR, /* Non-existant physical address. */ # define BUS_ADRERR BUS_ADRERR - BUS_OBJERR /* Object specific hardware error. */ + BUS_OBJERR, /* Object specific hardware error. */ # define BUS_OBJERR BUS_OBJERR + BUS_MCEERR_AR, /* Hardware memory error: action required. */ +# define BUS_MCEERR_AR BUS_MCEERR_AR + BUS_MCEERR_AO /* Hardware memory error: action optional. */ +# define BUS_MCEERR_AO BUS_MCEERR_AO }; /* `si_code' values for SIGTRAP signal. */ diff --git a/libc/sysdeps/unix/sysv/linux/setipv4sourcefilter.c b/libc/sysdeps/unix/sysv/linux/setipv4sourcefilter.c index ff3286310..a9b4d3b4b 100644 --- a/libc/sysdeps/unix/sysv/linux/setipv4sourcefilter.c +++ b/libc/sysdeps/unix/sysv/linux/setipv4sourcefilter.c @@ -21,6 +21,7 @@ #include <errno.h> #include <stdlib.h> #include <string.h> +#include <stdint.h> #include <netinet/in.h> #include <sys/socket.h> diff --git a/libc/sysdeps/unix/sysv/linux/setsourcefilter.c b/libc/sysdeps/unix/sysv/linux/setsourcefilter.c index 5ae37314b..f50f293cf 100644 --- a/libc/sysdeps/unix/sysv/linux/setsourcefilter.c +++ b/libc/sysdeps/unix/sysv/linux/setsourcefilter.c @@ -21,6 +21,7 @@ #include <errno.h> #include <stdlib.h> #include <string.h> +#include <stdint.h> #include <netinet/in.h> #include <sys/socket.h> diff --git a/libc/sysdeps/unix/sysv/linux/sh/getgid.c b/libc/sysdeps/unix/sysv/linux/sh/getgid.c new file mode 100644 index 000000000..0a4d6061f --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/sh/getgid.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/i386/getgid.c> diff --git a/libc/sysdeps/unix/sysv/linux/wordsize-64/glob64.c b/libc/sysdeps/unix/sysv/linux/wordsize-64/glob64.c index 33918ea6a..eab7703d5 100644 --- a/libc/sysdeps/unix/sysv/linux/wordsize-64/glob64.c +++ b/libc/sysdeps/unix/sysv/linux/wordsize-64/glob64.c @@ -1 +1,2 @@ -/* glob64 is in glob.c */ +/* This file is here so sysdeps/gnu/glob64.c doesn't take precedence. */ +#include <sysdeps/wordsize-64/glob64.c> diff --git a/libc/sysdeps/unix/sysv/linux/wordsize-64/openat.c b/libc/sysdeps/unix/sysv/linux/wordsize-64/openat.c index 4921fca33..12e027158 100644 --- a/libc/sysdeps/unix/sysv/linux/wordsize-64/openat.c +++ b/libc/sysdeps/unix/sysv/linux/wordsize-64/openat.c @@ -1,16 +1,14 @@ #define __openat64 __rename___openat64 -#define __openat64_2 __rename___openat64_2 #define __openat64_nocancel __rename___openat64_nocancel #define openat64 __rename_openat64 #include "../openat.c" #undef __openat64 -#undef __openat64_2 #undef __openat64_nocancel #undef openat64 -weak_alias (__openat, __openat64) -weak_alias (__openat_2, __openat64_2) -weak_alias (__openat_nocancel, __openat64_nocancel) +strong_alias (__openat, __openat64) +hidden_ver (__openat, __openat64) +strong_alias (__openat_nocancel, __openat64_nocancel) weak_alias (openat, openat64) diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c b/libc/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c index 7f6dee309..32cb0aa07 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c +++ b/libc/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c @@ -20,6 +20,7 @@ #include <sys/prctl.h> #include <sys/syscall.h> #include <sysdep.h> +#include <stdint.h> /* Since x32 arch_prctl stores 32-bit base address of segment registers %fs and %gs as unsigned 64-bit value via ARCH_GET_FS and ARCH_GET_GS, |