diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-31 17:46:17 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-31 17:46:17 +0000 |
commit | 8833066b122427710a9e14a888ce6cfa862332d3 (patch) | |
tree | 29591019d695919417b3698618d6a342e97381d6 /sysdeps/unix/sysv | |
parent | fedca46896bdb702cb988837a0c2c5447e72ba2b (diff) |
Updated to fedora-glibc-20070731T1624cvs/fedora-glibc-2_6_90-1
Diffstat (limited to 'sysdeps/unix/sysv')
42 files changed, 625 insertions, 69 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index f59e340f8e..119e37b345 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -137,7 +137,7 @@ endif ifeq ($(subdir),io) sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \ - sync_file_range + sync_file_range open_2 endif ifeq ($(subdir),elf) diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h index 31db66f8ac..5eaa2fe528 100644 --- a/sysdeps/unix/sysv/linux/bits/sched.h +++ b/sysdeps/unix/sysv/linux/bits/sched.h @@ -104,7 +104,7 @@ struct __sched_param # define __CPU_SETSIZE 1024 # define __NCPUBITS (8 * sizeof (__cpu_mask)) -/* Type for array elements in 'cpu_set'. */ +/* Type for array elements in 'cpu_set_t'. */ typedef unsigned long int __cpu_mask; /* Basic access functions. */ @@ -118,20 +118,72 @@ typedef struct } cpu_set_t; /* Access functions for CPU masks. */ -# define __CPU_ZERO(cpusetp) \ +# if __GNUC_PREREQ (2, 91) +# define __CPU_ZERO_S(setsize, cpusetp) \ + do __builtin_memset (cpusetp, '\0', setsize); while (0) +# else +# define __CPU_ZERO_S(setsize, cpusetp) \ do { \ - unsigned int __i; \ + size_t __i; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ cpu_set_t *__arr = (cpusetp); \ - for (__i = 0; __i < sizeof (cpu_set_t) / sizeof (__cpu_mask); ++__i) \ + for (__i = 0; __i < __imax; ++__i) \ __arr->__bits[__i] = 0; \ } while (0) -# define __CPU_SET(cpu, cpusetp) \ - ((cpusetp)->__bits[__CPUELT (cpu)] |= __CPUMASK (cpu)) -# define __CPU_CLR(cpu, cpusetp) \ - ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu)) -# define __CPU_ISSET(cpu, cpusetp) \ - (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0) -extern int __sched_cpucount (size_t __setsize, cpu_set_t *__setp) __THROW; -# define __CPU_COUNT(cpusetp) \ - __sched_cpucount (sizeof (cpu_set_t), cpusetp) +# endif +# define __CPU_SET_S(cpu, setsize, cpusetp) \ + ({ size_t __cpu = (cpu); \ + __cpu < 8 * (setsize) \ + ? ((cpusetp)->__bits[__CPUELT (__cpu)] |= __CPUMASK (__cpu)) : 0; }) +# define __CPU_CLR_S(cpu, setsize, cpusetp) \ + ({ size_t __cpu = (cpu); \ + __cpu < 8 * (setsize) \ + ? ((cpusetp)->__bits[__CPUELT (__cpu)] &= ~__CPUMASK (__cpu)) : 0; }) +# define __CPU_ISSET_S(cpu, setsize, cpusetp) \ + ({ size_t __cpu = (cpu); \ + __cpu < 8 * (setsize) \ + ? (((cpusetp)->__bits[__CPUELT (__cpu)] & __CPUMASK (__cpu))) != 0 : 0; }) + +# define __CPU_COUNT_S(setsize, cpusetp) \ + __sched_cpucount (setsize, cpusetp) + +# if __GNUC_PREREQ (2, 91) +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ + (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0) +# else +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ + ({ cpu_set_t *__arr1 = (cpusetp1); \ + cpu_set_t *__arr2 = (cpusetp2); \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + size_t __i; \ + for (__i = 0; __i < __imax; ++__i) \ + if (__arr1->__bits[__i] != __arr2->__bits[__i]) \ + break; \ + __i == __imax; }) +# endif + +# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ + ({ cpu_set_t *__dest = (destset); \ + cpu_set_t *__arr1 = (srcset1); \ + cpu_set_t *__arr2 = (srcset2); \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + size_t __i; \ + for (__i = 0; __i < __imax; ++__i) \ + __dest->__bits[__i] = __arr1->__bits[__i] op __arr2->__bits[__i]; \ + __dest; }) + +# define __CPU_ALLOC_SIZE(count) \ + ((((count) + __NCPUBITS - 1) / __NCPUBITS) * 8) +# define __CPU_ALLOC(count) __sched_cpualloc (count) +# define __CPU_FREE(cpuset) __sched_cpufree (cpuset) + +__BEGIN_DECLS + +extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp) + __THROW; +extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur; +extern void __sched_cpufree (cpu_set_t *__set) __THROW; + +__END_DECLS + #endif diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 377f589bbd..89a9106b2e 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -63,7 +63,7 @@ enum __socket_type /* Protocol families. */ #define PF_UNSPEC 0 /* Unspecified. */ #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ -#define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ +#define PF_UNIX PF_LOCAL /* POSIX name for PF_LOCAL. */ #define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */ #define PF_INET 2 /* IP protocol family. */ #define PF_AX25 3 /* Amateur Radio AX.25. */ @@ -90,7 +90,9 @@ enum __socket_type #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_MAX 32 /* For now.. */ +#define PF_IUCV 32 /* IUCV sockets. */ +#define PF_RXRPC 33 /* RxRPC sockets. */ +#define PF_MAX 34 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -122,6 +124,8 @@ enum __socket_type #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE #define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. @@ -206,8 +210,13 @@ enum #define MSG_ERRQUEUE MSG_ERRQUEUE MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */ #define MSG_NOSIGNAL MSG_NOSIGNAL - MSG_MORE = 0x8000 /* Sender will send more. */ + MSG_MORE = 0x8000, /* Sender will send more. */ #define MSG_MORE MSG_MORE + + MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file + descriptor received through + SCM_RIGHTS. */ +#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC }; diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c index 3312da3af8..fbe805bf3b 100644 --- a/sysdeps/unix/sysv/linux/check_pf.c +++ b/sysdeps/unix/sysv/linux/check_pf.c @@ -136,40 +136,72 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6, if (nlmh->nlmsg_type == RTM_NEWADDR) { struct ifaddrmsg *ifam = (struct ifaddrmsg *) NLMSG_DATA (nlmh); + struct rtattr *rta = IFA_RTA (ifam); + size_t len = nlmh->nlmsg_len - NLMSG_LENGTH (sizeof (*ifam)); switch (ifam->ifa_family) { + const void *local; + const void *address; + case AF_INET: - *seen_ipv4 = true; + local = NULL; + address = NULL; + while (RTA_OK (rta, len)) + { + switch (rta->rta_type) + { + case IFA_LOCAL: + local = RTA_DATA (rta); + break; + + case IFA_ADDRESS: + address = RTA_DATA (rta); + goto out_v4; + } + + rta = RTA_NEXT (rta, len); + } + + if (local != NULL) + { + out_v4: + if (*(const in_addr_t *) (address ?: local) + != htonl (INADDR_LOOPBACK)) + *seen_ipv4 = true; + } break; + case AF_INET6: - *seen_ipv6 = true; + local = NULL; + address = NULL; + while (RTA_OK (rta, len)) + { + switch (rta->rta_type) + { + case IFA_LOCAL: + local = RTA_DATA (rta); + break; + + case IFA_ADDRESS: + address = RTA_DATA (rta); + goto out_v6; + } + + rta = RTA_NEXT (rta, len); + } + + if (local != NULL) + { + out_v6: + if (!IN6_IS_ADDR_LOOPBACK (address ?: local)) + *seen_ipv6 = true; + } if (ifam->ifa_flags & (IFA_F_DEPRECATED | IFA_F_TEMPORARY | IFA_F_HOMEADDRESS)) { - struct rtattr *rta = IFA_RTA (ifam); - size_t len = (nlmh->nlmsg_len - - NLMSG_LENGTH (sizeof (*ifam))); - void *local = NULL; - void *address = NULL; - while (RTA_OK (rta, len)) - { - switch (rta->rta_type) - { - case IFA_LOCAL: - local = RTA_DATA (rta); - break; - - case IFA_ADDRESS: - address = RTA_DATA (rta); - break; - } - - rta = RTA_NEXT (rta, len); - } - struct in6ailist *newp = alloca (sizeof (*newp)); newp->info.flags = (((ifam->ifa_flags & IFA_F_DEPRECATED) ? in6ai_deprecated : 0) @@ -200,7 +232,7 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6, close_not_cancel_no_status (fd); - if (in6ailist != NULL) + if (*seen_ipv6 && in6ailist != NULL) { *in6ai = malloc (in6ailistlen * sizeof (**in6ai)); if (*in6ai == NULL) diff --git a/sysdeps/unix/sysv/linux/futimes.c b/sysdeps/unix/sysv/linux/futimes.c index 610f1deb29..272b83eb05 100644 --- a/sysdeps/unix/sysv/linux/futimes.c +++ b/sysdeps/unix/sysv/linux/futimes.c @@ -1,5 +1,5 @@ /* futimes -- change access and modification times of open file. Linux version. - Copyright (C) 2002,2003,2005,2006 Free Software Foundation, Inc. + Copyright (C) 2002,2003,2005,2006,2007 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 @@ -29,7 +29,7 @@ #include <kernel-features.h> -#ifndef __ASSUME_UTIMENSAT +#if defined __NR_utimensat && !defined __ASSUME_UTIMENSAT static int miss_utimensat; #endif diff --git a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h index 6de33302ee..83ca3c2861 100644 --- a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006 + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -50,6 +50,7 @@ # define O_DIRECTORY 0200000 /* Must be a directory. */ # define O_NOFOLLOW 0400000 /* Do not follow links. */ # define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* Set close_on_exec. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/sysdeps/unix/sysv/linux/i386/sysconf.c b/sysdeps/unix/sysv/linux/i386/sysconf.c index 2ffbd5227b..78877fb2a1 100644 --- a/sysdeps/unix/sysv/linux/i386/sysconf.c +++ b/sysdeps/unix/sysv/linux/i386/sysconf.c @@ -1,5 +1,5 @@ /* Get file-specific information about a file. Linux version. - Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2006, 2007 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 @@ -97,11 +97,13 @@ static const struct intel_02_cache_info { 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 }, { 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 }, { 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 }, + { 0x48, _SC_LEVEL2_CACHE_SIZE, 3145728, 12, 64 }, { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 }, { 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 }, { 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 }, { 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 }, { 0x4d, _SC_LEVEL3_CACHE_SIZE, 16777216, 16, 64 }, + { 0x4e, _SC_LEVEL2_CACHE_SIZE, 6291456, 24, 64 }, { 0x60, _SC_LEVEL1_DCACHE_SIZE, 16384, 8, 64 }, { 0x66, _SC_LEVEL1_DCACHE_SIZE, 8192, 4, 64 }, { 0x67, _SC_LEVEL1_DCACHE_SIZE, 16384, 4, 64 }, diff --git a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h index ed8c2da9e2..8fa96e4e26 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/IA64. - Copyright (C) 1999, 2000, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2004, 2006, 2007 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 @@ -49,6 +49,7 @@ # define O_DIRECTORY 0200000 /* must be a directory */ # define O_NOFOLLOW 0400000 /* don't follow links */ # define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* Set close_on_exec. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h index ff77627a83..c824be2da7 100644 --- a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/ia64 version. - Copyright (C) 2001, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2006, 2007 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 @@ -127,6 +127,28 @@ struct pt_all_user_regs struct ia64_fpreg fr[128]; }; +/* Options set using PTRACE_SETOPTIONS. */ +enum __ptrace_setoptions { + PTRACE_O_TRACESYSGOOD = 0x00000001, + PTRACE_O_TRACEFORK = 0x00000002, + PTRACE_O_TRACEVFORK = 0x00000004, + PTRACE_O_TRACECLONE = 0x00000008, + PTRACE_O_TRACEEXEC = 0x00000010, + PTRACE_O_TRACEVFORKDONE = 0x00000020, + PTRACE_O_TRACEEXIT = 0x00000040, + PTRACE_O_MASK = 0x0000007f +}; + +/* Wait extended result codes for the above trace options. */ +enum __ptrace_eventcodes { + PTRACE_EVENT_FORK = 1, + PTRACE_EVENT_VFORK = 2, + PTRACE_EVENT_CLONE = 3, + PTRACE_EVENT_EXEC = 4, + PTRACE_EVENT_VFORK_DONE = 5, + PTRACE_EVENT_EXIT = 6 +}; + /* Perform process tracing functions. REQUEST is one of the values above, and determines the action to be taken. For all requests except PTRACE_TRACEME, PID specifies the process to be diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index ed32001544..f8116d8885 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 1999-2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1999-2006, 2007 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 @@ -463,3 +463,13 @@ #if __LINUX_KERNEL_VERSION >= 0x020616 # define __ASSUME_UTIMENSAT 1 #endif + +/* Support for private futexes was added in 2.6.22. */ +#if __LINUX_KERNEL_VERSION >= 0x020616 +# define __ASSUME_PRIVATE_FUTEX 1 +#endif + +/* Support for fallocate was added in 2.6.23. */ +#if __LINUX_KERNEL_VERSION >= 0x020617 +# define __ASSUME_FALLOCATE 1 +#endif diff --git a/sysdeps/unix/sysv/linux/nscd_setup_thread.c b/sysdeps/unix/sysv/linux/nscd_setup_thread.c index 1589c24ea9..56e23dc831 100644 --- a/sysdeps/unix/sysv/linux/nscd_setup_thread.c +++ b/sysdeps/unix/sysv/linux/nscd_setup_thread.c @@ -4,8 +4,9 @@ Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. + it under the terms of the GNU General Public License as published + by the Free Software Foundation; version 2 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/sysdeps/unix/sysv/linux/open64.c b/sysdeps/unix/sysv/linux/open64.c index 5fb5363e1e..c52ce39db1 100644 --- a/sysdeps/unix/sysv/linux/open64.c +++ b/sysdeps/unix/sysv/linux/open64.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,1995-1997,1999,2000,2002 Free Software Foundation, Inc. +/* Copyright (C) 1991,1995-1997,1999,2000,2002,2007 + 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 @@ -19,7 +20,7 @@ #include <errno.h> #include <fcntl.h> #include <stdarg.h> -#include <bp-sym.h> +#include <stdio.h> #include <sysdep-cancel.h> /* Open FILE with access OFLAG. If OFLAG includes O_CREAT, @@ -48,6 +49,29 @@ __libc_open64 (const char *file, int oflag, ...) return result; } -weak_alias (__libc_open64, BP_SYM (__open64)) -libc_hidden_weak (BP_SYM (__open64)) -weak_alias (__libc_open64, BP_SYM (open64)) +weak_alias (__libc_open64, __open64) +libc_hidden_weak (__open64) +weak_alias (__libc_open64, open64) + + +#ifndef PTW +int +__open64_2 (file, oflag) + const char *file; + int oflag; +{ + if (oflag & O_CREAT) + __fortify_fail ("invalid open64 call: O_CREAT without mode"); + + if (SINGLE_THREAD_P) + return INLINE_SYSCALL (open, 2, file, oflag | O_LARGEFILE); + + int oldtype = LIBC_CANCEL_ASYNC (); + + int result = INLINE_SYSCALL (open, 2, file, oflag | O_LARGEFILE); + + LIBC_CANCEL_RESET (oldtype); + + return result; +} +#endif diff --git a/sysdeps/unix/sysv/linux/open_2.c b/sysdeps/unix/sysv/linux/open_2.c new file mode 100644 index 0000000000..0a6dc28b43 --- /dev/null +++ b/sysdeps/unix/sysv/linux/open_2.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2007 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#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/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c index df53b6cf2c..45b566f2d0 100644 --- a/sysdeps/unix/sysv/linux/openat.c +++ b/sysdeps/unix/sysv/linux/openat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2006, 2007 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 @@ -30,6 +30,7 @@ #ifndef OPENAT # define OPENAT openat +# define __OPENAT_2 __openat_2 # ifndef __ASSUME_ATFCTS /* Set errno after a failed call. If BUF is not null, @@ -173,3 +174,18 @@ __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/sysdeps/unix/sysv/linux/openat64.c b/sysdeps/unix/sysv/linux/openat64.c index 9e7a2b3737..013a13effa 100644 --- a/sysdeps/unix/sysv/linux/openat64.c +++ b/sysdeps/unix/sysv/linux/openat64.c @@ -1,4 +1,5 @@ #define OPENAT openat64 +#define __OPENAT_2 __openat64_2 #define MORE_OFLAGS O_LARGEFILE #include "openat.c" diff --git a/sysdeps/unix/sysv/linux/posix_fallocate.c b/sysdeps/unix/sysv/linux/posix_fallocate.c new file mode 100644 index 0000000000..9cfade60ca --- /dev/null +++ b/sysdeps/unix/sysv/linux/posix_fallocate.c @@ -0,0 +1,60 @@ +/* Copyright (C) 2007 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fcntl.h> +#include <kernel-features.h> +#include <sysdep.h> + +#define posix_fallocate static internal_fallocate +#include <sysdeps/posix/posix_fallocate.c> +#undef posix_fallocate + +#if !defined __ASSUME_FALLOCATE && defined __NR_fallocate +int __have_fallocate attribute_hidden; +#endif + + +/* Reserve storage for the data of the file associated with FD. */ +int +posix_fallocate (int fd, __off_t offset, __off_t len) +{ +#ifdef __NR_fallocate +# ifndef __ASSUME_FALLOCATE + if (__builtin_expect (__have_fallocate >= 0, 1)) +# endif + { + INTERNAL_SYSCALL_DECL (err); + int res = INTERNAL_SYSCALL (fallocate, err, 4, fd, 0, + __LONG_LONG_PAIR (offset >> 31, offset), + __LONG_LONG_PAIR (len >> 31, len)); + + if (! INTERNAL_SYSCALL_ERROR_P (res, err)) + return 0; + +# ifndef __ASSUME_FALLOCATE + if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS, 0)) + __have_fallocate = -1; + else +# endif + if (INTERNAL_SYSCALL_ERRNO (res, err) != EOPNOTSUPP) + return INTERNAL_SYSCALL_ERRNO (res, err); + } +#endif + + return internal_fallocate (fd, offset, len); +} diff --git a/sysdeps/unix/sysv/linux/posix_fallocate64.c b/sysdeps/unix/sysv/linux/posix_fallocate64.c new file mode 100644 index 0000000000..c5b8a34494 --- /dev/null +++ b/sysdeps/unix/sysv/linux/posix_fallocate64.c @@ -0,0 +1,64 @@ +/* Copyright (C) 2007 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fcntl.h> +#include <kernel-features.h> +#include <sysdep.h> + +extern int __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len); +#define __posix_fallocate64_l64 static internal_fallocate64 +#include <sysdeps/posix/posix_fallocate64.c> +#undef __posix_fallocate64_l64 + +#if !defined __ASSUME_FALLOCATE && defined __NR_fallocate +/* Defined in posix_fallocate.c. */ +extern int __have_fallocate attribute_hidden; +#endif + + +/* Reserve storage for the data of the file associated with FD. */ +int +__posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len) +{ +#ifdef __NR_fallocate +# ifndef __ASSUME_FALLOCATE + if (__builtin_expect (__have_fallocate >= 0, 1)) +# endif + { + INTERNAL_SYSCALL_DECL (err); + int res = INTERNAL_SYSCALL (fallocate, err, 6, fd, 0, + __LONG_LONG_PAIR ((long int) (offset >> 32), + (long int) offset), + __LONG_LONG_PAIR ((long int) (len >> 32), + (long int) len)); + + if (! INTERNAL_SYSCALL_ERROR_P (res, err)) + return 0; + +# ifndef __ASSUME_FALLOCATE + if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS, 0)) + __have_fallocate = -1; + else +# endif + if (INTERNAL_SYSCALL_ERRNO (res, err) != EOPNOTSUPP) + return INTERNAL_SYSCALL_ERRNO (res, err); + } +#endif + + return internal_fallocate64 (fd, offset, len); +} diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h index c4964e0fd8..68015dbca3 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/PowerPC. - Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006 + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -50,6 +50,7 @@ # define O_DIRECTORY 040000 /* Must be a directory. */ # define O_NOFOLLOW 0100000 /* Do not follow links. */ # define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* Set close_on_exec. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c index 923eab99ef..a71cfa5b06 100644 --- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c +++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c @@ -20,6 +20,7 @@ #include <stdlib.h> #include <unistd.h> #include <ldsodefs.h> +#include <sysdep.h> #include <bp-start.h> #include <bp-sym.h> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/970/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/970/fpu/Implies new file mode 100644 index 0000000000..52993ae71b --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/970/fpu/Implies @@ -0,0 +1,3 @@ +# Make sure this comes before the powerpc/powerpc32/fpu that's +# listed in unix/sysv/linux/powerpc/powerpc32/fpu/Implies. +powerpc/powerpc32/970/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/power4/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power4/fpu/Implies new file mode 100644 index 0000000000..3c0690e2fe --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power4/fpu/Implies @@ -0,0 +1,3 @@ +# Make sure this comes before the powerpc/powerpc32/fpu that's +# listed in unix/sysv/linux/powerpc/powerpc32/fpu/Implies. +powerpc/powerpc32/power4/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/power5+/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power5+/fpu/Implies new file mode 100644 index 0000000000..37d43bb6fc --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power5+/fpu/Implies @@ -0,0 +1,3 @@ +# Make sure this comes before the powerpc/powerpc32/fpu that's +# listed in unix/sysv/linux/powerpc/powerpc32/fpu/Implies. +powerpc/powerpc32/power5+/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/power5/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power5/fpu/Implies new file mode 100644 index 0000000000..d379a2dd12 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power5/fpu/Implies @@ -0,0 +1,3 @@ +# Make sure this comes before the powerpc/powerpc32/fpu that's +# listed in unix/sysv/linux/powerpc/powerpc32/fpu/Implies. +powerpc/powerpc32/power5/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/power6/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power6/fpu/Implies new file mode 100644 index 0000000000..9fb457db93 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power6/fpu/Implies @@ -0,0 +1,3 @@ +# Make sure this comes before the powerpc/powerpc32/fpu that's +# listed in unix/sysv/linux/powerpc/powerpc32/fpu/Implies. +powerpc/powerpc32/power6/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/power6x/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power6x/fpu/Implies new file mode 100644 index 0000000000..ffca13c0ef --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/power6x/fpu/Implies @@ -0,0 +1,4 @@ +# Make sure this comes before the powerpc/powerpc32/fpu that's +# listed in unix/sysv/linux/powerpc/powerpc32/fpu/Implies. +powerpc/powerpc32/power6x/fpu +powerpc/powerpc32/power6/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/970/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/970/fpu/Implies new file mode 100644 index 0000000000..558a5fb174 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/970/fpu/Implies @@ -0,0 +1 @@ +powerpc/powerpc64/power4/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/power4/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power4/fpu/Implies new file mode 100644 index 0000000000..558a5fb174 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power4/fpu/Implies @@ -0,0 +1 @@ +powerpc/powerpc64/power4/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/power5+/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power5+/fpu/Implies new file mode 100644 index 0000000000..cf5913dec3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power5+/fpu/Implies @@ -0,0 +1,3 @@ +# Make sure this comes before the powerpc/powerpc64/fpu that's +# listed in unix/sysv/linux/powerpc/powerpc64/fpu/Implies. +powerpc/powerpc64/power5+/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/power5/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power5/fpu/Implies new file mode 100644 index 0000000000..558a5fb174 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power5/fpu/Implies @@ -0,0 +1 @@ +powerpc/powerpc64/power4/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/power6/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power6/fpu/Implies new file mode 100644 index 0000000000..9451147267 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power6/fpu/Implies @@ -0,0 +1,3 @@ +# Make sure this comes before the powerpc/powerpc64/fpu that's +# listed in unix/sysv/linux/powerpc/powerpc64/fpu/Implies. +powerpc/powerpc64/power6/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/power6x/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power6x/fpu/Implies new file mode 100644 index 0000000000..fd74b8341c --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/power6x/fpu/Implies @@ -0,0 +1,4 @@ +# Make sure this comes before the powerpc/powerpc64/fpu that's +# listed in unix/sysv/linux/powerpc/powerpc64/fpu/Implies. +powerpc/powerpc64/power6x/fpu +powerpc/powerpc64/power6/fpu diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h b/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h index 5d055f67fe..23e75fbcff 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux version. - Copyright (C) 2001, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2006, 2007 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 @@ -99,6 +99,28 @@ enum __ptrace_request #define PT_SETSIGINFO PTRACE_SETSIGINFO }; +/* Options set using PTRACE_SETOPTIONS. */ +enum __ptrace_setoptions { + PTRACE_O_TRACESYSGOOD = 0x00000001, + PTRACE_O_TRACEFORK = 0x00000002, + PTRACE_O_TRACEVFORK = 0x00000004, + PTRACE_O_TRACECLONE = 0x00000008, + PTRACE_O_TRACEEXEC = 0x00000010, + PTRACE_O_TRACEVFORKDONE = 0x00000020, + PTRACE_O_TRACEEXIT = 0x00000040, + PTRACE_O_MASK = 0x0000007f +}; + +/* Wait extended result codes for the above trace options. */ +enum __ptrace_eventcodes { + PTRACE_EVENT_FORK = 1, + PTRACE_EVENT_VFORK = 2, + PTRACE_EVENT_CLONE = 3, + PTRACE_EVENT_EXEC = 4, + PTRACE_EVENT_VFORK_DONE = 5, + PTRACE_EVENT_EXIT = 6 +}; + /* Perform process tracing functions. REQUEST is one of the values above, and determines the action to be taken. For all requests except PTRACE_TRACEME, PID specifies the process to be diff --git a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h index c611028f29..848568532f 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 2000, 2001, 2002, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2000,2001,2002,2004,2006,2007 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 @@ -50,6 +50,7 @@ # define O_DIRECTORY 0200000 /* Must be a directory. */ # define O_NOFOLLOW 0400000 /* Do not follow links. */ # define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* Set close_on_exec. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/sysdeps/unix/sysv/linux/s390/dl-procinfo.h b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h new file mode 100644 index 0000000000..3eeb529053 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h @@ -0,0 +1,43 @@ +/* Linux/s390 version of processor capability information handling macros. + Copyright (C) 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2006. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdeps/s390/dl-procinfo.h> +#include <ldsodefs.h> + + +#undef _dl_procinfo +static inline int +__attribute__ ((unused)) +_dl_procinfo (int word) +{ + /* This table should match the information from arch/s390/kernel/setup.c + in the kernel sources. */ + int i; + + _dl_printf ("AT_HWCAP: "); + + for (i = 0; i < _DL_HWCAP_COUNT; ++i) + if (word & (1UL << i)) + _dl_printf (" %s", GLRO(dl_s390_cap_flags)[i]); + + _dl_printf ("\n"); + + return 0; +} diff --git a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h index 70eb4f8222..ac186387fc 100644 --- a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux version. - Copyright (C) 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 2000, 2006, 2007 Free Software Foundation, Inc. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). This file is part of the GNU C Library. @@ -138,6 +138,28 @@ enum __ptrace_request #define PT_SETSIGINFO PTRACE_SETSIGINFO }; +/* Options set using PTRACE_SETOPTIONS. */ +enum __ptrace_setoptions { + PTRACE_O_TRACESYSGOOD = 0x00000001, + PTRACE_O_TRACEFORK = 0x00000002, + PTRACE_O_TRACEVFORK = 0x00000004, + PTRACE_O_TRACECLONE = 0x00000008, + PTRACE_O_TRACEEXEC = 0x00000010, + PTRACE_O_TRACEVFORKDONE = 0x00000020, + PTRACE_O_TRACEEXIT = 0x00000040, + PTRACE_O_MASK = 0x0000007f +}; + +/* Wait extended result codes for the above trace options. */ +enum __ptrace_eventcodes { + PTRACE_EVENT_FORK = 1, + PTRACE_EVENT_VFORK = 2, + PTRACE_EVENT_CLONE = 3, + PTRACE_EVENT_EXEC = 4, + PTRACE_EVENT_VFORK_DONE = 5, + PTRACE_EVENT_EXIT = 6 +}; + /* Perform process tracing functions. REQUEST is one of the values above, and determines the action to be taken. For all requests except PTRACE_TRACEME, PID specifies the process to be diff --git a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h index 6de33302ee..83ca3c2861 100644 --- a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006 + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -50,6 +50,7 @@ # define O_DIRECTORY 0200000 /* Must be a directory. */ # define O_NOFOLLOW 0400000 /* Do not follow links. */ # define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* Set close_on_exec. */ #endif /* For now Linux has synchronisity options for data and read operations. diff --git a/sysdeps/unix/sysv/linux/sh/clone.S b/sysdeps/unix/sysv/linux/sh/clone.S index 7941c6b3ad..f892c475dd 100644 --- a/sysdeps/unix/sysv/linux/sh/clone.S +++ b/sysdeps/unix/sysv/linux/sh/clone.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2003, 2004, 2007 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 @@ -32,12 +32,12 @@ ENTRY(__clone) /* sanity check arguments. */ tst r4, r4 - bf/s 1f + bt/s 0f tst r5, r5 - bf/s 1f - mov #-EINVAL,r0 + bf 1f +0: bra .Lsyscall_error - nop + mov #-EINVAL,r0 1: /* insert the args onto the new stack */ mov.l r7, @-r5 diff --git a/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h b/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h index 17907c4a38..a7b204b33a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux/SPARC version. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006 + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -183,6 +183,28 @@ enum __ptrace_request #define PT_SETSIGINFO PTRACE_SETSIGINFO }; +/* Options set using PTRACE_SETOPTIONS. */ +enum __ptrace_setoptions { + PTRACE_O_TRACESYSGOOD = 0x00000001, + PTRACE_O_TRACEFORK = 0x00000002, + PTRACE_O_TRACEVFORK = 0x00000004, + PTRACE_O_TRACECLONE = 0x00000008, + PTRACE_O_TRACEEXEC = 0x00000010, + PTRACE_O_TRACEVFORKDONE = 0x00000020, + PTRACE_O_TRACEEXIT = 0x00000040, + PTRACE_O_MASK = 0x0000007f +}; + +/* Wait extended result codes for the above trace options. */ +enum __ptrace_eventcodes { + PTRACE_EVENT_FORK = 1, + PTRACE_EVENT_VFORK = 2, + PTRACE_EVENT_CLONE = 3, + PTRACE_EVENT_EXEC = 4, + PTRACE_EVENT_VFORK_DONE = 5, + PTRACE_EVENT_EXIT = 6 +}; + /* Perform process tracing functions. REQUEST is one of the values above, and determines the action to be taken. For all requests except PTRACE_TRACEME, PID specifies the process to be diff --git a/sysdeps/unix/sysv/linux/sys/ptrace.h b/sysdeps/unix/sysv/linux/sys/ptrace.h index 44284cb307..08658f9764 100644 --- a/sysdeps/unix/sysv/linux/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux version. - Copyright (C) 1996-1999,2000,2006 Free Software Foundation, Inc. + Copyright (C) 1996-1999,2000,2006,2007 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 @@ -129,6 +129,29 @@ enum __ptrace_request #define PT_SETSIGINFO PTRACE_SETSIGINFO }; + +/* Options set using PTRACE_SETOPTIONS. */ +enum __ptrace_setoptions { + PTRACE_O_TRACESYSGOOD = 0x00000001, + PTRACE_O_TRACEFORK = 0x00000002, + PTRACE_O_TRACEVFORK = 0x00000004, + PTRACE_O_TRACECLONE = 0x00000008, + PTRACE_O_TRACEEXEC = 0x00000010, + PTRACE_O_TRACEVFORKDONE = 0x00000020, + PTRACE_O_TRACEEXIT = 0x00000040, + PTRACE_O_MASK = 0x0000007f +}; + +/* Wait extended result codes for the above trace options. */ +enum __ptrace_eventcodes { + PTRACE_EVENT_FORK = 1, + PTRACE_EVENT_VFORK = 2, + PTRACE_EVENT_CLONE = 3, + PTRACE_EVENT_EXEC = 4, + PTRACE_EVENT_VFORK_DONE = 5, + PTRACE_EVENT_EXIT = 6 +}; + /* Perform process tracing functions. REQUEST is one of the values above, and determines the action to be taken. For all requests except PTRACE_TRACEME, PID specifies the process to be diff --git a/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c new file mode 100644 index 0000000000..151174b472 --- /dev/null +++ b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c @@ -0,0 +1,59 @@ +/* Copyright (C) 2007 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fcntl.h> +#include <kernel-features.h> +#include <sysdep.h> + +#define posix_fallocate static internal_fallocate +#include <sysdeps/posix/posix_fallocate.c> +#undef posix_fallocate + +#if !defined __ASSUME_FALLOCATE && defined __NR_fallocate +static int __have_fallocate; +#endif + + +/* Reserve storage for the data of the file associated with FD. */ +int +posix_fallocate (int fd, __off_t offset, __off_t len) +{ +#ifdef __NR_fallocate +# ifndef __ASSUME_FALLOCATE + if (__builtin_expect (__have_fallocate >= 0, 1)) +# endif + { + INTERNAL_SYSCALL_DECL (err); + int res = INTERNAL_SYSCALL (fallocate, err, 4, fd, 0, offset, len); + + if (! INTERNAL_SYSCALL_ERROR_P (res, err)) + return 0; + +# ifndef __ASSUME_FALLOCATE + if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS, 0)) + __have_fallocate = -1; + else +# endif + if (INTERNAL_SYSCALL_ERRNO (res, err) != EOPNOTSUPP) + return INTERNAL_SYSCALL_ERRNO (res, err); + } +#endif + + return internal_fallocate (fd, offset, len); +} +strong_alias (posix_fallocate, posix_fallocate64) diff --git a/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate64.c b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate64.c new file mode 100644 index 0000000000..f466f13e45 --- /dev/null +++ b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate64.c @@ -0,0 +1 @@ +/* posix_fallocate64 is in posix_fallocate.c */ diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h index fa1d02bc1f..a918a0725b 100644 --- a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/x86-64. - Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2004, 2006, 2007 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 @@ -50,6 +50,7 @@ # define O_DIRECTORY 0200000 /* Must be a directory. */ # define O_NOFOLLOW 0400000 /* Do not follow links. */ # define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* Set close_on_exec. */ #endif /* For now Linux has synchronisity options for data and read operations. |