diff options
Diffstat (limited to 'libc/sysdeps/unix')
17 files changed, 112 insertions, 51 deletions
diff --git a/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h index a8bb09075..b5929bd29 100644 --- a/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h +++ b/libc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h @@ -296,6 +296,13 @@ struct f_owner_ex # define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ +/* Flags for fallocate. */ +# define FALLOC_FL_KEEP_SIZE 1 /* Don't extend size of file + even if offset + len is + greater than file size. */ +# define FALLOC_FL_PUNCH_HOLE 2 /* Create a hole in the file. */ + + /* File handle structure. */ struct file_handle { diff --git a/libc/sysdeps/unix/sysv/linux/bits/socket.h b/libc/sysdeps/unix/sysv/linux/bits/socket.h index 25b115e50..eadd7d932 100644 --- a/libc/sysdeps/unix/sysv/linux/bits/socket.h +++ b/libc/sysdeps/unix/sysv/linux/bits/socket.h @@ -207,6 +207,8 @@ enum #define MSG_MORE MSG_MORE MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/ #define MSG_WAITFORONE MSG_WAITFORONE + MSG_FASTOPEN = 0x20000000, /* Send data in TCP SYN. */ +#define MSG_FASTOPEN MSG_FASTOPEN MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file descriptor received through diff --git a/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h b/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h index 0a876dfa6..737ca0e65 100644 --- a/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h +++ b/libc/sysdeps/unix/sysv/linux/malloc-sysdep.h @@ -55,3 +55,5 @@ check_may_shrink_heap (void) return may_shrink_heap; } + +#define HAVE_MREMAP 1 diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/Versions b/libc/sysdeps/unix/sysv/linux/powerpc/Versions index 1ef53b9e9..396a4236c 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/Versions +++ b/libc/sysdeps/unix/sysv/linux/powerpc/Versions @@ -3,5 +3,6 @@ libc { __vdso_get_tbfreq; __vdso_clock_gettime; __vdso_clock_getres; + __vdso_getcpu; } } 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 6f79841ce..545fda462 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h +++ b/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h @@ -30,6 +30,8 @@ extern void *__vdso_clock_getres; extern void *__vdso_get_tbfreq; +extern void *__vdso_getcpu; + #endif #endif /* _LIBC_VDSO_H */ diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c b/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c index 616342aec..5e88b83b5 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c +++ b/libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c @@ -41,7 +41,8 @@ __get_clockfreq (void) /* If we can use the vDSO to obtain the timebase even better. */ #ifdef SHARED INTERNAL_SYSCALL_DECL (err); - timebase_freq = INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, 0); + timebase_freq = + INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, hp_timing_t, 0); if (INTERNAL_SYSCALL_ERROR_P (timebase_freq, err) && INTERNAL_SYSCALL_ERRNO (timebase_freq, err) == ENOSYS) #endif diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c b/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c index 5202e7d2f..204c0c60a 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c +++ b/libc/sysdeps/unix/sysv/linux/powerpc/init-first.c @@ -27,6 +27,7 @@ void *__vdso_gettimeofday attribute_hidden; void *__vdso_clock_gettime; void *__vdso_clock_getres; void *__vdso_get_tbfreq; +void *__vdso_getcpu; static inline void @@ -40,7 +41,9 @@ _libc_vdso_platform_setup (void) __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615); - __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_vdso_get_tbfreq", &linux2615); + __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_get_tbfreq", &linux2615); + + __vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux2615); } # define VDSO_SETUP _libc_vdso_platform_setup diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h index e047bf7bd..250f4fc8c 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -60,7 +60,8 @@ \ if (__vdso_##name != NULL) \ { \ - sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \ + sc_ret = \ + INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\ if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ goto out; \ if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ @@ -90,7 +91,8 @@ \ if (__vdso_##name != NULL) \ { \ - v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + v_ret = \ + INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args); \ if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \ || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \ goto out; \ @@ -104,12 +106,12 @@ INTERNAL_SYSCALL (name, err, nr, ##args) # endif -# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \ +# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \ ({ \ - long int sc_ret = ENOSYS; \ + type sc_ret = ENOSYS; \ \ if (__vdso_##name != NULL) \ - sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args); \ else \ err = 1 << 28; \ sc_ret; \ @@ -126,7 +128,7 @@ function call, with the exception of LR (which is needed for the "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal an error return status). */ -# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \ +# define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \ ({ \ register void *r0 __asm__ ("r0"); \ register long int r3 __asm__ ("r3"); \ @@ -139,18 +141,18 @@ register long int r10 __asm__ ("r10"); \ register long int r11 __asm__ ("r11"); \ register long int r12 __asm__ ("r12"); \ + register type rval __asm__ ("r3"); \ LOADARGS_##nr (funcptr, args); \ __asm__ __volatile__ \ ("mtctr %0\n\t" \ "bctrl\n\t" \ "mfcr %0" \ - : "=&r" (r0), \ - "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \ - "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \ - : ASM_INPUT_##nr \ - : "cr0", "ctr", "lr", "memory"); \ + : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), \ + "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12) \ + : : "cr0", "ctr", "lr", "memory"); \ err = (long int) r0; \ - (int) r3; \ + __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4)); \ + rval; \ }) # undef INLINE_SYSCALL @@ -191,7 +193,7 @@ register long int r10 __asm__ ("r10"); \ register long int r11 __asm__ ("r11"); \ register long int r12 __asm__ ("r12"); \ - LOADARGS_##nr(name, args); \ + LOADARGS_##nr(name, args); \ __asm__ __volatile__ \ ("sc \n\t" \ "mfcr %0" \ diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index 1f0c3a225..6ebab742c 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -75,7 +75,8 @@ \ if (__vdso_##name != NULL) \ { \ - sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \ + sc_ret = \ + INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\ if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ goto out; \ if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ @@ -105,7 +106,8 @@ \ if (__vdso_##name != NULL) \ { \ - v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + v_ret = \ + INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args); \ if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \ || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \ goto out; \ @@ -121,12 +123,12 @@ /* This version is for internal uses when there is no desire to set errno */ -#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \ +#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \ ({ \ - long int sc_ret = ENOSYS; \ + type sc_ret = ENOSYS; \ \ if (__vdso_##name != NULL) \ - sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args); \ else \ err = 1 << 28; \ sc_ret; \ @@ -142,7 +144,7 @@ gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) the negation of the return value in the kernel gets reverted. */ -#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \ +#define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \ ({ \ register void *r0 __asm__ ("r0"); \ register long int r3 __asm__ ("r3"); \ @@ -151,20 +153,19 @@ register long int r6 __asm__ ("r6"); \ register long int r7 __asm__ ("r7"); \ register long int r8 __asm__ ("r8"); \ + register type rval __asm__ ("r3"); \ LOADARGS_##nr (funcptr, args); \ __asm__ __volatile__ \ ("mtctr %0\n\t" \ "bctrl\n\t" \ "mfcr %0\n\t" \ "0:" \ - : "=&r" (r0), \ - "=&r" (r3), "=&r" (r4), "=&r" (r5), \ - "=&r" (r6), "=&r" (r7), "=&r" (r8) \ - : ASM_INPUT_##nr \ - : "r9", "r10", "r11", "r12", \ - "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ - r3; \ + : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ + "+r" (r7), "+r" (r8) \ + : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ + err = (long int) r0; \ + __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ + rval; \ }) #undef INLINE_SYSCALL diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c b/libc/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c new file mode 100644 index 000000000..617e6f121 --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c @@ -0,0 +1,30 @@ +/* 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 <sched.h> +#include <sysdep.h> +#include <bits/libc-vdso.h> + + +int +sched_getcpu (void) +{ + unsigned int cpu; + int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL); + + return r == -1 ? r : cpu; +} diff --git a/libc/sysdeps/unix/sysv/linux/scsi/sg.h b/libc/sysdeps/unix/sysv/linux/scsi/sg.h index 9cad76ebf..68f57f29f 100644 --- a/libc/sysdeps/unix/sysv/linux/scsi/sg.h +++ b/libc/sysdeps/unix/sysv/linux/scsi/sg.h @@ -26,6 +26,8 @@ #define _SCSI_SG_H 1 #include <features.h> +#define __need_size_t +#include <stddef.h> /* New interface introduced in the 3.x SG drivers follows */ diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/ipc.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/ipc.h index 757d0472b..e59f96abc 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/bits/ipc.h +++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/ipc.h @@ -56,6 +56,6 @@ struct ipc_perm unsigned short int __pad1; #endif unsigned short int __seq; /* Sequence number. */ - unsigned long long int __unused1; - unsigned long long int __unused2; + __extension__ unsigned long long int __unused1; + __extension__ unsigned long long int __unused2; }; diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/fpu/multiarch/Implies b/libc/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/fpu/multiarch/Implies new file mode 100644 index 000000000..a380d8a73 --- /dev/null +++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/fpu/multiarch/Implies @@ -0,0 +1,4 @@ +# We must list this here to move it ahead of the ldbl-opt code. +sparc/sparc32/sparcv9/fpu/multiarch +sparc/sparc32/sparcv9/fpu +sparc/sparc32/fpu diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h b/libc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h index 74c729166..1a3d4b54a 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h +++ b/libc/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h @@ -217,7 +217,7 @@ typedef struct fpu typedef struct fpu { union { /* FPU floating point regs */ - unsigned long long fpu_regs[32]; /* 32 singles */ + __extension__ unsigned long long fpu_regs[32]; /* 32 singles */ double fpu_dregs[16]; /* 16 doubles */ } fpu_fr; struct fq *fpu_q; /* ptr to array of FQ entries */ diff --git a/libc/sysdeps/unix/sysv/linux/sys/sysmacros.h b/libc/sysdeps/unix/sysv/linux/sys/sysmacros.h index 76eaf9f9d..a1f1b2697 100644 --- a/libc/sysdeps/unix/sysv/linux/sys/sysmacros.h +++ b/libc/sysdeps/unix/sysv/linux/sys/sysmacros.h @@ -21,10 +21,6 @@ #include <features.h> -/* If the compiler does not know long long it is out of luck. We are - not going to hack weird hacks to support the dev_t representation - they need. */ -#ifdef __GLIBC_HAVE_LONG_LONG __BEGIN_DECLS __extension__ @@ -38,7 +34,7 @@ extern unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) __THROW __attribute_const__; -# ifdef __USE_EXTERN_INLINES +#ifdef __USE_EXTERN_INLINES __extension__ __extern_inline __attribute_const__ unsigned int __NTH (gnu_dev_major (unsigned long long int __dev)) { @@ -58,13 +54,12 @@ __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor)) | (((unsigned long long int) (__minor & ~0xff)) << 12) | (((unsigned long long int) (__major & ~0xfff)) << 32)); } -# endif +#endif __END_DECLS /* Access the functions with their traditional names. */ -# define major(dev) gnu_dev_major (dev) -# define minor(dev) gnu_dev_minor (dev) -# define makedev(maj, min) gnu_dev_makedev (maj, min) -#endif +#define major(dev) gnu_dev_major (dev) +#define minor(dev) gnu_dev_minor (dev) +#define makedev(maj, min) gnu_dev_makedev (maj, min) #endif /* sys/sysmacros.h */ diff --git a/libc/sysdeps/unix/sysv/linux/x86/bits/environments.h b/libc/sysdeps/unix/sysv/linux/x86/bits/environments.h index 0fe1e3f5f..27b37b30e 100644 --- a/libc/sysdeps/unix/sysv/linux/x86/bits/environments.h +++ b/libc/sysdeps/unix/sysv/linux/x86/bits/environments.h @@ -64,15 +64,19 @@ #else /* __WORDSIZE == 32 */ -/* By default we have 32-bit wide `int', `long int', pointers and `off_t' - and all platforms support LFS. */ -# define _POSIX_V7_ILP32_OFF32 1 +/* We have 32-bit wide `int', `long int' and pointers and all platforms + support LFS. -mx32 has 64-bit wide `off_t'. */ # define _POSIX_V7_ILP32_OFFBIG 1 -# define _POSIX_V6_ILP32_OFF32 1 -# define _POSIX_V6_ILP32_OFFBIG 1 -# define _XBS5_ILP32_OFF32 1 +# define _POSIX_V6_ILP32_OFFBIG 1 # define _XBS5_ILP32_OFFBIG 1 +# ifndef __x86_64__ +/* -m32 has 32-bit wide `off_t'. */ +# define _POSIX_V7_ILP32_OFF32 1 +# define _POSIX_V6_ILP32_OFF32 1 +# define _XBS5_ILP32_OFF32 1 +# endif + /* We optionally provide an environment with the above size but an 64-bit side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */ @@ -89,8 +93,13 @@ #endif /* __WORDSIZE == 32 */ #define __ILP32_OFF32_CFLAGS "-m32" -#define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" #define __ILP32_OFF32_LDFLAGS "-m32" -#define __ILP32_OFFBIG_LDFLAGS "-m32" +#if defined __x86_64__ && defined __ILP32__ +# define __ILP32_OFFBIG_CFLAGS "-mx32" +# define __ILP32_OFFBIG_LDFLAGS "-mx32" +#else +# define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +# define __ILP32_OFFBIG_LDFLAGS "-m32" +#endif #define __LP64_OFF64_CFLAGS "-m64" #define __LP64_OFF64_LDFLAGS "-m64" diff --git a/libc/sysdeps/unix/sysv/linux/x86/sys/procfs.h b/libc/sysdeps/unix/sysv/linux/x86/sys/procfs.h index dddbced57..ec318ad93 100644 --- a/libc/sysdeps/unix/sysv/linux/x86/sys/procfs.h +++ b/libc/sysdeps/unix/sysv/linux/x86/sys/procfs.h @@ -36,7 +36,7 @@ __BEGIN_DECLS /* Type for a general-purpose register. */ #ifdef __x86_64__ -typedef unsigned long long elf_greg_t; +__extension__ typedef unsigned long long elf_greg_t; #else typedef unsigned long elf_greg_t; #endif |