diff options
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/dl-auxv.h | 36 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/dl-support.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/dl-sysdep.c | 59 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/fpu/Implies | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/sigsuspend.S | 13 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/sysconf.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/bits/sigset.h | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/bits/socket.h | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/check_pf.c | 42 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ifaddrs.c | 75 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/posix_madvise.c | 38 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sh/Makefile | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sys/sysmacros.h | 15 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/syscalls.list | 1 |
16 files changed, 163 insertions, 140 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies b/sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies new file mode 100644 index 0000000000..0d7000dc2d --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies @@ -0,0 +1,2 @@ +# Override ldbl-opt with alpha specific routines. +alpha/alphaev6/fpu diff --git a/sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies b/sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies new file mode 100644 index 0000000000..617c388d2d --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies @@ -0,0 +1,2 @@ +# Override ldbl-opt with alpha specific routines. +alpha/alphaev67/fpu diff --git a/sysdeps/unix/sysv/linux/alpha/dl-auxv.h b/sysdeps/unix/sysv/linux/alpha/dl-auxv.h new file mode 100644 index 0000000000..8afc4dba3b --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/dl-auxv.h @@ -0,0 +1,36 @@ +/* Auxiliary vector processing for Linux/Alpha. + 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. */ + +/* Scan the Aux Vector for the cache shape entries. */ + +long __libc_alpha_cache_shape[4] = { -2, -2, -2, -2 }; + +#define DL_PLATFORM_AUXV \ + case AT_L1I_CACHESHAPE: \ + __libc_alpha_cache_shape[0] = av->a_un.a_val; \ + break; \ + case AT_L1D_CACHESHAPE: \ + __libc_alpha_cache_shape[1] = av->a_un.a_val; \ + break; \ + case AT_L2_CACHESHAPE: \ + __libc_alpha_cache_shape[2] = av->a_un.a_val; \ + break; \ + case AT_L3_CACHESHAPE: \ + __libc_alpha_cache_shape[3] = av->a_un.a_val; \ + break; diff --git a/sysdeps/unix/sysv/linux/alpha/dl-support.c b/sysdeps/unix/sysv/linux/alpha/dl-support.c new file mode 100644 index 0000000000..290217671c --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/dl-support.c @@ -0,0 +1,2 @@ +#include "dl-auxv.h" +#include <elf/dl-support.c> diff --git a/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c b/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c index d95e46f6f1..4034820f4d 100644 --- a/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c @@ -1,59 +1,2 @@ -/* Operating system support for run-time dynamic linker. Linux/Alpha version. - Copyright (C) 1997, 1998, 2001, 2003, 2006 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 <config.h> -#include <kernel-features.h> -#include <ldsodefs.h> - -extern long __libc_alpha_cache_shape[4]; -weak_extern (__libc_alpha_cache_shape); - - -/* Scan the Aux Vector for the cache shape entries. */ -#define DL_PLATFORM_AUXV \ - case AT_L1I_CACHESHAPE: \ - { \ - long *cls = __libc_alpha_cache_shape; \ - if (cls != NULL) \ - cls[0] = av->a_un.a_val; \ - break; \ - } \ - case AT_L1D_CACHESHAPE: \ - { \ - long *cls = __libc_alpha_cache_shape; \ - if (cls != NULL) \ - cls[1] = av->a_un.a_val; \ - break; \ - } \ - case AT_L2_CACHESHAPE: \ - { \ - long *cls = __libc_alpha_cache_shape; \ - if (cls != NULL) \ - cls[2] = av->a_un.a_val; \ - break; \ - } \ - case AT_L3_CACHESHAPE: \ - { \ - long *cls = __libc_alpha_cache_shape; \ - if (cls != NULL) \ - cls[3] = av->a_un.a_val; \ - break; \ - } - +#include "dl-auxv.h" #include <sysdeps/unix/sysv/linux/dl-sysdep.c> diff --git a/sysdeps/unix/sysv/linux/alpha/fpu/Implies b/sysdeps/unix/sysv/linux/alpha/fpu/Implies new file mode 100644 index 0000000000..d76f511c2e --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/fpu/Implies @@ -0,0 +1,2 @@ +# Override ldbl-opt with alpha specific routines. +alpha/fpu diff --git a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S index 48c3f271c7..6863c07ec1 100644 --- a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S +++ b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S @@ -20,6 +20,19 @@ /* sigsuspend is a special syscall since it needs to dereference the sigset. This will have to change when we have more than 64 signals. */ +#ifndef NO_CANCELLATION +#include <sysdep.h> + +#undef PSEUDO_PREPARE_ARGS +#define PSEUDO_PREPARE_ARGS ldq a0, 0(a0); + +PSEUDO(__sigsuspend_nocancel, sigsuspend, 1) + ret +/* Use END, not PSEUDO_END, so that we don't issue two $syscall_error + symbols; we'll jump into __sigsuspend for the error case. */ +END(__sigsuspend_nocancel) +#endif /* NO_CANCELLATION */ + #include <sysdep-cancel.h> #undef PSEUDO_PREPARE_ARGS diff --git a/sysdeps/unix/sysv/linux/alpha/sysconf.c b/sysdeps/unix/sysv/linux/alpha/sysconf.c index 2bbaf1f364..3e5b4ee85f 100644 --- a/sysdeps/unix/sysv/linux/alpha/sysconf.c +++ b/sysdeps/unix/sysv/linux/alpha/sysconf.c @@ -27,7 +27,7 @@ static long int linux_sysconf (int name); #define CSHAPE(totalsize, linesize, assoc) \ ((totalsize & ~0xff) | (linesize << 4) | assoc) -long __libc_alpha_cache_shape[4] = { -2, -2, -2, -2 }; +extern long __libc_alpha_cache_shape[4]; static inline unsigned long implver (void) diff --git a/sysdeps/unix/sysv/linux/bits/sigset.h b/sysdeps/unix/sysv/linux/bits/sigset.h index 7ccadda456..daec8ac494 100644 --- a/sysdeps/unix/sysv/linux/bits/sigset.h +++ b/sysdeps/unix/sysv/linux/bits/sigset.h @@ -1,5 +1,6 @@ /* __sig_atomic_t, __sigset_t, and related definitions. Linux version. - Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1994, 1996, 1997, 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 @@ -43,7 +44,7 @@ typedef struct # define _SIGSET_H_fns 1 # ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline +# define _EXTERN_INLINE __extern_inline # endif /* Return a mask that includes the bit for SIG only. */ diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 356a2ece74..377f589bbd 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -1,5 +1,6 @@ /* System-specific socket constants and types. Linux version. - Copyright (C) 1991,1992,1994-2001,2004,2006 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1994-2001, 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 @@ -264,7 +265,7 @@ extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW; #ifdef __USE_EXTERN_INLINES # ifndef _EXTERN_INLINE -# define _EXTERN_INLINE extern __inline +# define _EXTERN_INLINE __extern_inline # endif _EXTERN_INLINE struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c index ebe4d699b1..2b6c158226 100644 --- a/sysdeps/unix/sysv/linux/check_pf.c +++ b/sysdeps/unix/sysv/linux/check_pf.c @@ -1,5 +1,5 @@ /* Determine protocol families for which interfaces exist. Linux version. - Copyright (C) 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 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 @@ -68,17 +68,38 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6, memset (&nladdr, '\0', sizeof (nladdr)); nladdr.nl_family = AF_NETLINK; +#ifdef PAGE_SIZE + /* Help the compiler optimize out the malloc call if PAGE_SIZE + is constant and smaller or equal to PTHREAD_STACK_MIN/4. */ + const size_t buf_size = PAGE_SIZE; +#else + const size_t buf_size = __getpagesize (); +#endif + bool use_malloc = false; + char *buf; + + if (__libc_use_alloca (buf_size)) + buf = alloca (buf_size); + else + { + buf = malloc (buf_size); + if (buf != NULL) + use_malloc = true; + else + goto out_fail; + } + + struct iovec iov = { buf, buf_size }; + if (TEMP_FAILURE_RETRY (__sendto (fd, (void *) &req, sizeof (req), 0, (struct sockaddr *) &nladdr, sizeof (nladdr))) < 0) - return -1; + goto out_fail; *seen_ipv4 = false; *seen_ipv6 = false; bool done = false; - char buf[4096]; - struct iovec iov = { buf, sizeof (buf) }; struct in6ailist { struct in6addrinfo info; @@ -98,10 +119,10 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6, ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0)); if (read_len < 0) - return -1; + goto out_fail; if (msg.msg_flags & MSG_TRUNC) - return -1; + goto out_fail; struct nlmsghdr *nlmh; for (nlmh = (struct nlmsghdr *) buf; @@ -183,7 +204,7 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6, { *in6ai = malloc (in6ailistlen * sizeof (**in6ai)); if (*in6ai == NULL) - return -1; + goto out_fail; *in6ailen = in6ailistlen; @@ -195,6 +216,13 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6, while (in6ailist != NULL); } + if (use_malloc) + free (buf); + return 0; + +out_fail: + if (use_malloc) + free (buf); return 0; } diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c index 82495de03e..02e6935538 100644 --- a/sysdeps/unix/sysv/linux/ifaddrs.c +++ b/sysdeps/unix/sysv/linux/ifaddrs.c @@ -1,5 +1,5 @@ /* getifaddrs -- get names and addresses of all network interfaces - Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 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 @@ -122,36 +122,36 @@ int __netlink_request (struct netlink_handle *h, int type) { struct netlink_res *nlm_next; - struct netlink_res **new_nlm_list; - static volatile size_t buf_size = 4096; - char *buf; struct sockaddr_nl nladdr; struct nlmsghdr *nlmh; ssize_t read_len; bool done = false; - bool use_malloc = false; - if (__netlink_sendreq (h, type) < 0) - return -1; +#ifdef PAGE_SIZE + /* Help the compiler optimize out the malloc call if PAGE_SIZE + is constant and smaller or equal to PTHREAD_STACK_MIN/4. */ + const size_t buf_size = PAGE_SIZE; +#else + const size_t buf_size = __getpagesize (); +#endif + bool use_malloc = false; + char *buf; - size_t this_buf_size = buf_size; - if (__libc_use_alloca (this_buf_size)) - buf = alloca (this_buf_size); + if (__libc_use_alloca (buf_size)) + buf = alloca (buf_size); else { - buf = malloc (this_buf_size); + buf = malloc (buf_size); if (buf != NULL) use_malloc = true; else goto out_fail; } - struct iovec iov = { buf, this_buf_size }; + struct iovec iov = { buf, buf_size }; - if (h->nlm_list != NULL) - new_nlm_list = &h->end_ptr->next; - else - new_nlm_list = &h->nlm_list; + if (__netlink_sendreq (h, type) < 0) + goto out_fail; while (! done) { @@ -171,48 +171,7 @@ __netlink_request (struct netlink_handle *h, int type) continue; if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0)) - { - if (this_buf_size >= SIZE_MAX / 2) - goto out_fail; - - nlm_next = *new_nlm_list; - while (nlm_next != NULL) - { - struct netlink_res *tmpptr; - - tmpptr = nlm_next->next; - free (nlm_next); - nlm_next = tmpptr; - } - *new_nlm_list = NULL; - - if (__libc_use_alloca (2 * this_buf_size)) - buf = extend_alloca (buf, this_buf_size, 2 * this_buf_size); - else - { - this_buf_size *= 2; - - char *new_buf = realloc (use_malloc ? buf : NULL, this_buf_size); - if (new_buf == NULL) - goto out_fail; - new_buf = buf; - - use_malloc = true; - } - buf_size = this_buf_size; - - iov.iov_base = buf; - iov.iov_len = this_buf_size; - - /* Increase sequence number, so that we can distinguish - between old and new request messages. */ - h->seq++; - - if (__netlink_sendreq (h, type) < 0) - goto out_fail; - - continue; - } + goto out_fail; size_t count = 0; size_t remaining_len = read_len; diff --git a/sysdeps/unix/sysv/linux/posix_madvise.c b/sysdeps/unix/sysv/linux/posix_madvise.c new file mode 100644 index 0000000000..880b17ef31 --- /dev/null +++ b/sysdeps/unix/sysv/linux/posix_madvise.c @@ -0,0 +1,38 @@ +/* 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 <sysdep.h> +#include <sys/mman.h> + + +int +posix_madvise (void *addr, size_t len, int advice) +{ + /* We have one problem: the kernel's MADV_DONTNEED does not + correspond to POSIX's POSIX_MADV_DONTNEED. The former simply + discards changes made to the memory without writing it back to + disk, if this would be necessary. The POSIX behavior does not + allow this. There is no functionality mapping the POSIX behavior + so far so we ignore that advice for now. */ + if (advice == POSIX_MADV_DONTNEED) + return 0; + + INTERNAL_SYSCALL_DECL (err); + int result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice); + return INTERNAL_SYSCALL_ERRNO (result, err); +} diff --git a/sysdeps/unix/sysv/linux/sh/Makefile b/sysdeps/unix/sysv/linux/sh/Makefile index 6d72cb0294..c1b436a6fb 100644 --- a/sysdeps/unix/sysv/linux/sh/Makefile +++ b/sysdeps/unix/sysv/linux/sh/Makefile @@ -2,10 +2,6 @@ ifeq ($(subdir),io) sysdep_routines += pipe endif -ifeq ($(subdir),misc) -sysdep_headers += sys/io.h -endif - ifeq ($(subdir),stdlib) gen-as-const-headers += ucontext_i.sym endif diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h index 179642ff40..e59672980e 100644 --- a/sysdeps/unix/sysv/linux/sys/sysmacros.h +++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h @@ -1,5 +1,6 @@ /* Definitions of macros to access `dev_t' values. - Copyright (C) 1996, 1997, 1999, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 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 @@ -27,30 +28,30 @@ they need. */ #ifdef __GLIBC_HAVE_LONG_LONG __extension__ -extern __inline unsigned int gnu_dev_major (unsigned long long int __dev) +__extern_inline unsigned int gnu_dev_major (unsigned long long int __dev) __THROW; __extension__ -extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev) +__extern_inline unsigned int gnu_dev_minor (unsigned long long int __dev) __THROW; __extension__ -extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major, +__extern_inline unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) __THROW; # if defined __GNUC__ && __GNUC__ >= 2 -__extension__ extern __inline unsigned int +__extension__ __extern_inline unsigned int __NTH (gnu_dev_major (unsigned long long int __dev)) { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); } -__extension__ extern __inline unsigned int +__extension__ __extern_inline unsigned int __NTH (gnu_dev_minor (unsigned long long int __dev)) { return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); } -__extension__ extern __inline unsigned long long int +__extension__ __extern_inline unsigned long long int __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor)) { return ((__minor & 0xff) | ((__major & 0xfff) << 8) diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 5776673733..38103f0c68 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -32,7 +32,6 @@ ioperm - ioperm i:iii ioperm iopl - iopl i:i iopl klogctl EXTRA syslog i:isi klogctl lchown - lchown i:sii __lchown lchown -posix_madvise - madvise Vi:pii posix_madvise madvise - madvise i:pii madvise mincore - mincore i:anV mincore mlock - mlock i:bn mlock |