summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/alpha/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getrusage.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sigsuspend.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscall.S2
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/hppa/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/makecontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h26
-rw-r--r--sysdeps/unix/sysv/linux/ia64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c12
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c168
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/mips/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/mips/vfork.S2
-rw-r--r--sysdeps/unix/sysv/linux/netinet/if_tr.h78
-rw-r--r--sysdeps/unix/sysv/linux/netlinkaccess.h5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S10
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S14
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c10
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/readdir64.c2
-rw-r--r--sysdeps/unix/sysv/linux/readdir64_r.c2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sleep.c3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S6
-rw-r--r--sysdeps/unix/sysv/linux/sys/quota.h89
-rw-r--r--sysdeps/unix/sysv/linux/sysctl.c3
-rw-r--r--sysdeps/unix/sysv/linux/system.c3
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/getdents.c2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/makecontext.c2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/swapcontext.S2
55 files changed, 426 insertions, 161 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index ce4a5da37f..c4a9b77e2e 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-1999, 2000, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1995-1999, 2000, 2004, 2005 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
@@ -44,9 +44,9 @@
#define O_ASYNC 020000 /* fcntl, for BSD compatibility */
#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
# define O_DIRECTORY 0100000 /* Must be a directory. */
# define O_NOFOLLOW 0200000 /* Do not follow links. */
+# define O_DIRECT 02000000 /* Direct disk access. */
# define O_NOATIME 04000000 /* Do not set atime. */
#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
index 54d6819412..8bbd301dd9 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
@@ -1,5 +1,5 @@
/* Bit values & structures for resource limits. Alpha/Linux version.
- Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+ Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -89,7 +89,18 @@ enum __rlimit_resource
__RLIMIT_MSGQUEUE = 12,
#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
- __RLIMIT_NLIMITS = 13,
+ /* Maximum nice priority allowed to raise to.
+ Nice levels 19 .. -20 correspond to 0 .. 39
+ values of this resource limit. */
+ __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+ /* Maximum realtime priority allowed for non-priviledged
+ processes. */
+ __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO _RLIMIT_RTPRIO
+
+ __RLIMIT_NLIMITS = 15,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S
index 1c450d1737..5e0b21ea15 100644
--- a/sysdeps/unix/sysv/linux/alpha/clone.S
+++ b/sysdeps/unix/sysv/linux/alpha/clone.S
@@ -146,4 +146,4 @@ thread_start:
.end thread_start
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/alpha/getcontext.S b/sysdeps/unix/sysv/linux/alpha/getcontext.S
index 3566890cf9..bf9820ac73 100644
--- a/sysdeps/unix/sysv/linux/alpha/getcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/getcontext.S
@@ -41,7 +41,7 @@ ENTRY (__getcontext)
ret
END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
/* An internal routine used by getcontext and setcontext.
diff --git a/sysdeps/unix/sysv/linux/alpha/getrusage.S b/sysdeps/unix/sysv/linux/alpha/getrusage.S
index 2c34e98ce6..46797aa83b 100644
--- a/sysdeps/unix/sysv/linux/alpha/getrusage.S
+++ b/sysdeps/unix/sysv/linux/alpha/getrusage.S
@@ -145,5 +145,5 @@ strong_alias(__getrusage_tv64, ____getrusage_tv64)
default_symbol_version (____getrusage_tv64, __getrusage, GLIBC_2.1)
default_symbol_version (__getrusage_tv64, getrusage, GLIBC_2.1)
#else
-weak_alias(__getrusage, getrusage)
+weak_alias (__getrusage, getrusage)
#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/setcontext.S b/sysdeps/unix/sysv/linux/alpha/setcontext.S
index 7d443d41c7..27abfd0c12 100644
--- a/sysdeps/unix/sysv/linux/alpha/setcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/setcontext.S
@@ -32,4 +32,4 @@
PSEUDO(__setcontext, sigreturn, 1)
ret
PSEUDO_END(__setcontext)
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
index e5de55faeb..48c3f271c7 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
+++ b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
@@ -29,5 +29,5 @@ PSEUDO(__sigsuspend, sigsuspend, 1)
ret
PSEUDO_END(__sigsuspend)
libc_hidden_def (__sigsuspend)
-weak_alias(__sigsuspend, sigsuspend)
+weak_alias (__sigsuspend, sigsuspend)
strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/alpha/swapcontext.S b/sysdeps/unix/sysv/linux/alpha/swapcontext.S
index 5f6615e0b6..1221f67f78 100644
--- a/sysdeps/unix/sysv/linux/alpha/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/swapcontext.S
@@ -48,4 +48,4 @@ ENTRY(__swapcontext)
#endif
END(__swapcontext)
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscall.S b/sysdeps/unix/sysv/linux/alpha/syscall.S
index 10a32d5dc8..0c4081363a 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscall.S
+++ b/sysdeps/unix/sysv/linux/alpha/syscall.S
@@ -74,4 +74,4 @@ $error:
END(__syscall)
-weak_alias(__syscall, syscall)
+weak_alias (__syscall, syscall)
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index c186a3a5d0..115739d439 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,5 +1,5 @@
/* Bit values & structures for resource limits. Linux version.
- Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+ Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -89,7 +89,18 @@ enum __rlimit_resource
__RLIMIT_MSGQUEUE = 12,
#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
- __RLIMIT_NLIMITS = 13,
+ /* Maximum nice priority allowed to raise to.
+ Nice levels 19 .. -20 correspond to 0 .. 39
+ values of this resource limit. */
+ __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+ /* Maximum realtime priority allowed for non-priviledged
+ processes. */
+ __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO _RLIMIT_RTPRIO
+
+ __RLIMIT_NLIMITS = 15,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S
index 4f3bb9e206..f497bca13d 100644
--- a/sysdeps/unix/sysv/linux/hppa/clone.S
+++ b/sysdeps/unix/sysv/linux/hppa/clone.S
@@ -96,4 +96,4 @@ thread_start:
PSEUDO_END(__clone)
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/i386/getcontext.S b/sysdeps/unix/sysv/linux/i386/getcontext.S
index 76ba6047c1..fe28f1e0e1 100644
--- a/sysdeps/unix/sysv/linux/i386/getcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/getcontext.S
@@ -82,4 +82,4 @@ L(pseudo_end):
ret
PSEUDO_END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S
index 03dc648c59..12ba4e2d67 100644
--- a/sysdeps/unix/sysv/linux/i386/makecontext.S
+++ b/sysdeps/unix/sysv/linux/i386/makecontext.S
@@ -114,4 +114,4 @@ L(exitcode):
cfi_startproc
END(__makecontext)
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/i386/setcontext.S b/sysdeps/unix/sysv/linux/i386/setcontext.S
index c493cf9798..bf2d7d2bad 100644
--- a/sysdeps/unix/sysv/linux/i386/setcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/setcontext.S
@@ -94,4 +94,4 @@ L(pseudo_end):
ret
PSEUDO_END(__setcontext)
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/swapcontext.S b/sysdeps/unix/sysv/linux/i386/swapcontext.S
index d909e659e4..27c16200b2 100644
--- a/sysdeps/unix/sysv/linux/i386/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/swapcontext.S
@@ -109,4 +109,4 @@ L(pseudo_end):
ret
PSEUDO_END(__swapcontext)
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index a9637be33d..99f9bf1edf 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -109,32 +109,6 @@
# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
#else
-# ifndef HAVE_HIDDEN
-# define SETUP_PIC_REG(reg) \
- call 1f; \
- .subsection 1; \
-1:movl (%esp), %e##reg; \
- ret; \
- .previous
-# else
-# define SETUP_PIC_REG(reg) \
- .ifndef __i686.get_pc_thunk.reg; \
- .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits; \
- .globl __i686.get_pc_thunk.reg; \
- .hidden __i686.get_pc_thunk.reg; \
- .type __i686.get_pc_thunk.reg,@function; \
-__i686.get_pc_thunk.reg: \
- movl (%esp), %e##reg; \
- ret; \
- .size __i686.get_pc_thunk.reg, . - __i686.get_pc_thunk.reg; \
- .previous; \
- .endif; \
- call __i686.get_pc_thunk.reg
-# endif
-
-# define LOAD_PIC_REG(reg) \
- SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg
-
# if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER \
0:SETUP_PIC_REG(cx); \
diff --git a/sysdeps/unix/sysv/linux/ia64/getcontext.S b/sysdeps/unix/sysv/linux/ia64/getcontext.S
index 0f9cc5db19..4e18bace2d 100644
--- a/sysdeps/unix/sysv/linux/ia64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/ia64/getcontext.S
@@ -155,4 +155,4 @@ ENTRY(__getcontext)
ret
END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/ia64/setcontext.S b/sysdeps/unix/sysv/linux/ia64/setcontext.S
index e18c40fa4c..ef0a93c0c0 100644
--- a/sysdeps/unix/sysv/linux/ia64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/ia64/setcontext.S
@@ -150,4 +150,4 @@ ENTRY(__setcontext)
ret
END(__setcontext)
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 377ccf5199..66f0ac1317 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,98,99,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005
+ 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
@@ -188,12 +189,8 @@ if_nameindex_netlink (void)
/* Tell the kernel that we wish to get a list of all
- active interfaces. */
- if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
- goto exit_close;
-
- /* Collect all data for every interface. */
- if (__netlink_receive (&nh) < 0)
+ active interfaces. Collect all data for every interface. */
+ if (__netlink_request (&nh, RTM_GETLINK) < 0)
goto exit_free;
/* Count the interfaces. */
@@ -290,7 +287,6 @@ if_nameindex_netlink (void)
exit_free:
__netlink_free_handle (&nh);
- exit_close:
__netlink_close (&nh);
return idx;
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 8a052e212d..f743f702f0 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 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 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
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <alloca.h>
#include <assert.h>
#include <errno.h>
#include <ifaddrs.h>
@@ -24,6 +25,7 @@
#include <netinet/in.h>
#include <netpacket/packet.h>
#include <stdbool.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
@@ -84,7 +86,7 @@ __netlink_free_handle (struct netlink_handle *h)
}
-int
+static int
__netlink_sendreq (struct netlink_handle *h, int type)
{
struct
@@ -114,15 +116,39 @@ __netlink_sendreq (struct netlink_handle *h, int type)
int
-__netlink_receive (struct netlink_handle *h)
+__netlink_request (struct netlink_handle *h, int type)
{
struct netlink_res *nlm_next;
- char buf[4096];
- struct iovec iov = { buf, sizeof (buf) };
+ struct netlink_res **new_nlm_list;
+ static volatile size_t buf_size = 4096;
+ char *buf;
struct sockaddr_nl nladdr;
struct nlmsghdr *nlmh;
- int read_len;
+ ssize_t read_len;
bool done = false;
+ bool use_malloc = false;
+
+ if (__netlink_sendreq (h, type) < 0)
+ return -1;
+
+ size_t this_buf_size = buf_size;
+ if (__libc_use_alloca (this_buf_size))
+ buf = alloca (this_buf_size);
+ else
+ {
+ buf = malloc (this_buf_size);
+ if (buf != NULL)
+ use_malloc = true;
+ else
+ goto out_fail;
+ }
+
+ struct iovec iov = { buf, this_buf_size };
+
+ if (h->nlm_list != NULL)
+ new_nlm_list = &h->end_ptr->next;
+ else
+ new_nlm_list = &h->nlm_list;
while (! done)
{
@@ -136,33 +162,66 @@ __netlink_receive (struct netlink_handle *h)
read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0));
if (read_len < 0)
- return -1;
+ goto out_fail;
- if (msg.msg_flags & MSG_TRUNC)
- return -1;
+ if (nladdr.nl_pid != 0)
+ continue;
- nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
- + read_len);
- if (nlm_next == NULL)
- return -1;
- nlm_next->next = NULL;
- nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
- nlm_next->size = read_len;
- nlm_next->seq = h->seq;
- if (h->nlm_list == NULL)
- h->nlm_list = nlm_next;
- else
- h->end_ptr->next = nlm_next;
- h->end_ptr = nlm_next;
+ 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;
+ }
+
+ size_t count = 0;
+ size_t remaining_len = read_len;
for (nlmh = (struct nlmsghdr *) buf;
- NLMSG_OK (nlmh, (size_t) read_len);
- nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len))
+ NLMSG_OK (nlmh, remaining_len);
+ nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, remaining_len))
{
- if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != h->pid
+ if ((pid_t) nlmh->nlmsg_pid != h->pid
|| nlmh->nlmsg_seq != h->seq)
continue;
+ ++count;
if (nlmh->nlmsg_type == NLMSG_DONE)
{
/* We found the end, leave the loop. */
@@ -176,11 +235,38 @@ __netlink_receive (struct netlink_handle *h)
errno = EIO;
else
errno = -nlerr->error;
- return -1;
+ goto out_fail;
}
}
+
+ /* If there was nothing with the expected nlmsg_pid and nlmsg_seq,
+ there is no point to record it. */
+ if (count == 0)
+ continue;
+
+ nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
+ + read_len);
+ if (nlm_next == NULL)
+ goto out_fail;
+ nlm_next->next = NULL;
+ nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
+ nlm_next->size = read_len;
+ nlm_next->seq = h->seq;
+ if (h->nlm_list == NULL)
+ h->nlm_list = nlm_next;
+ else
+ h->end_ptr->next = nlm_next;
+ h->end_ptr = nlm_next;
}
+
+ if (use_malloc)
+ free (buf);
return 0;
+
+out_fail:
+ if (use_malloc)
+ free (buf);
+ return -1;
}
@@ -268,7 +354,7 @@ getifaddrs (struct ifaddrs **ifap)
unsigned int i, newlink, newaddr, newaddr_idx;
int *map_newlink_data;
size_t ifa_data_size = 0; /* Size to allocate for all ifa_data. */
- char *ifa_data_ptr; /* Pointer to the unused part of memory for
+ char *ifa_data_ptr; /* Pointer to the unused part of memory for
ifa_data. */
int result = 0;
@@ -288,28 +374,20 @@ getifaddrs (struct ifaddrs **ifap)
#endif
/* Tell the kernel that we wish to get a list of all
- active interfaces. */
- if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
- {
- result = -1;
- goto exit_close;
- }
- /* Collect all data for every interface. */
- if (__netlink_receive (&nh) < 0)
+ active interfaces, collect all data for every interface. */
+ if (__netlink_request (&nh, RTM_GETLINK) < 0)
{
result = -1;
goto exit_free;
}
-
/* Now ask the kernel for all addresses which are assigned
- to an interface. Since we store the addresses after the
- interfaces in the list, we will later always find the
- interface before the corresponding addresses. */
+ to an interface and collect all data for every interface.
+ Since we store the addresses after the interfaces in the
+ list, we will later always find the interface before the
+ corresponding addresses. */
++nh.seq;
- if (__netlink_sendreq (&nh, RTM_GETADDR) < 0
- /* Collect all data for every interface. */
- || __netlink_receive (&nh) < 0)
+ if (__netlink_request (&nh, RTM_GETADDR) < 0)
{
result = -1;
goto exit_free;
@@ -327,7 +405,7 @@ getifaddrs (struct ifaddrs **ifap)
continue;
/* Walk through all entries we got from the kernel and look, which
- message type they contain. */
+ message type they contain. */
for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size))
{
/* Check if the message is what we want. */
@@ -423,7 +501,7 @@ getifaddrs (struct ifaddrs **ifap)
/* Interfaces are stored in the first "newlink" entries
of our list, starting in the order as we got from the
kernel. */
- ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
+ ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
map_newlink_data, newlink);
ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags;
@@ -767,8 +845,6 @@ getifaddrs (struct ifaddrs **ifap)
exit_free:
__netlink_free_handle (&nh);
-
- exit_close:
__netlink_close (&nh);
return result;
diff --git a/sysdeps/unix/sysv/linux/mips/bits/resource.h b/sysdeps/unix/sysv/linux/mips/bits/resource.h
index 2b6c887fd0..7e7152935b 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/resource.h
@@ -1,5 +1,5 @@
/* Bit values & structures for resource limits. Linux/MIPS version.
- Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+ Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -89,7 +89,18 @@ enum __rlimit_resource
__RLIMIT_MSGQUEUE = 12,
#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
- __RLIMIT_NLIMITS = 13,
+ /* Maximum nice priority allowed to raise to.
+ Nice levels 19 .. -20 correspond to 0 .. 39
+ values of this resource limit. */
+ __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+ /* Maximum realtime priority allowed for non-priviledged
+ processes. */
+ __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO _RLIMIT_RTPRIO
+
+ __RLIMIT_NLIMITS = 15,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S
index 8b8e0072f5..f521df1771 100644
--- a/sysdeps/unix/sysv/linux/mips/clone.S
+++ b/sysdeps/unix/sysv/linux/mips/clone.S
@@ -163,4 +163,4 @@ L(gotpid):
END(__thread_start)
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/mips/vfork.S b/sysdeps/unix/sysv/linux/mips/vfork.S
index 1383ddc6a7..38b6195282 100644
--- a/sysdeps/unix/sysv/linux/mips/vfork.S
+++ b/sysdeps/unix/sysv/linux/mips/vfork.S
@@ -95,4 +95,4 @@ L(error):
END(__vfork)
libc_hidden_def(__vfork)
-weak_alias(__vfork, vfork)
+weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h
index 1a7bc68c98..45c39115f3 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_tr.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2005 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
@@ -21,13 +21,83 @@
#include <sys/cdefs.h>
#include <sys/types.h>
-#include <asm/types.h>
-#include <linux/if_tr.h>
+/* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble
+ and FCS/CRC (frame check sequence). */
+#define TR_ALEN 6 /* Octets in one token-ring addr */
+#define TR_HLEN (sizeof (struct trh_hdr) + sizeof (struct trllc))
+#define AC 0x10
+#define LLC_FRAME 0x40
+
+/* LLC and SNAP constants */
+#define EXTENDED_SAP 0xAA
+#define UI_CMD 0x03
+
+/* This is an Token-Ring frame header. */
+struct trh_hdr
+{
+ u_int8_t ac; /* access control field */
+ u_int8_t fc; /* frame control field */
+ u_int8_t daddr[TR_ALEN]; /* destination address */
+ u_int8_t saddr[TR_ALEN]; /* source address */
+ u_int16_t rcf; /* route control field */
+ u_int16_t rseg[8]; /* routing registers */
+};
+
+/* This is an Token-Ring LLC structure */
+struct trllc
+{
+ u_int8_t dsap; /* destination SAP */
+ u_int8_t ssap; /* source SAP */
+ u_int8_t llc; /* LLC control field */
+ u_int8_t protid[3]; /* protocol id */
+ u_int16_t ethertype; /* ether type field */
+};
+
+/* Token-Ring statistics collection data. */
+struct tr_statistics
+{
+ unsigned long rx_packets; /* total packets received */
+ unsigned long tx_packets; /* total packets transmitted */
+ unsigned long rx_bytes; /* total bytes received */
+ unsigned long tx_bytes; /* total bytes transmitted */
+ unsigned long rx_errors; /* bad packets received */
+ unsigned long tx_errors; /* packet transmit problems */
+ unsigned long rx_dropped; /* no space in linux buffers */
+ unsigned long tx_dropped; /* no space available in linux */
+ unsigned long multicast; /* multicast packets received */
+ unsigned long transmit_collision;
+
+ /* detailed Token-Ring errors. See IBM Token-Ring Network
+ Architecture for more info */
+
+ unsigned long line_errors;
+ unsigned long internal_errors;
+ unsigned long burst_errors;
+ unsigned long A_C_errors;
+ unsigned long abort_delimiters;
+ unsigned long lost_frames;
+ unsigned long recv_congest_count;
+ unsigned long frame_copied_errors;
+ unsigned long frequency_errors;
+ unsigned long token_errors;
+ unsigned long dummy1;
+};
+
+/* source routing stuff */
+#define TR_RII 0x80
+#define TR_RCF_DIR_BIT 0x80
+#define TR_RCF_LEN_MASK 0x1f00
+#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */
+#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */
+#define TR_RCF_FRAME2K 0x20
+#define TR_RCF_BROADCAST_MASK 0xC000
+#define TR_MAXRIFLEN 18
#ifdef __USE_BSD
-struct trn_hdr {
+struct trn_hdr
+{
u_int8_t trn_ac; /* access control field */
u_int8_t trn_fc; /* field control field */
u_int8_t trn_dhost[TR_ALEN]; /* destination host */
diff --git a/sysdeps/unix/sysv/linux/netlinkaccess.h b/sysdeps/unix/sysv/linux/netlinkaccess.h
index 6672e714ff..6b2d858c9d 100644
--- a/sysdeps/unix/sysv/linux/netlinkaccess.h
+++ b/sysdeps/unix/sysv/linux/netlinkaccess.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -55,8 +55,7 @@ extern int __no_netlink_support attribute_hidden;
extern int __netlink_open (struct netlink_handle *h);
extern void __netlink_close (struct netlink_handle *h);
extern void __netlink_free_handle (struct netlink_handle *h);
-extern int __netlink_sendreq (struct netlink_handle *h, int type);
-extern int __netlink_receive (struct netlink_handle *h);
+extern int __netlink_request (struct netlink_handle *h, int type);
#endif /* netlinkaccess.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
index a737322e2a..21ad98e501 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
@@ -34,11 +34,19 @@ ENTRY (BP_SYM (__brk))
lwz r6,8(r1)
#ifdef PIC
mflr r4
+# ifdef HAVE_ASM_PPC_REL16
+ bcl 20,31,1f
+1: mflr r5
+ addis r5,r5,__curbrk-1b@ha
+ mtlr r4
+ stw r3,__curbrk-1b@l(r5)
+# else
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr r5
lwz r5,__curbrk@got(r5)
mtlr r4
stw r3,0(r5)
+# endif
#else
lis r4,__curbrk@ha
stw r3,__curbrk@l(r4)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
index e79d74cb75..069f94bd9d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2005 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
@@ -28,7 +28,7 @@
#ifdef __NR_ftruncate64
#ifndef __ASSUME_TRUNCATE64_SYSCALL
/* The variable is shared between all wrappers around *truncate64 calls. */
-extern int have_no_truncate64;
+extern int __have_no_truncate64;
#endif
@@ -39,7 +39,7 @@ __ftruncate64 (fd, length)
off64_t length;
{
#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (! have_no_truncate64)
+ if (! __have_no_truncate64)
#endif
{
#ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -57,7 +57,7 @@ __ftruncate64 (fd, length)
#ifndef __ASSUME_TRUNCATE64_SYSCALL
__set_errno (saved_errno);
- have_no_truncate64 = 1;
+ __have_no_truncate64 = 1;
#endif
}
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
index 4e6cf4b352..10211458d5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
@@ -129,8 +129,15 @@ ENTRY(__getcontext)
#ifdef PIC
mflr r8
+# ifdef HAVE_ASM_PPC_REL16
+ bcl 20,31,1f
+1: mflr r7
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+# else
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr r7
+# endif
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
index b7a82a0182..eff60f9bbf 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
@@ -58,8 +58,15 @@ ENTRY(__setcontext)
#ifdef PIC
mflr r8
+# ifdef HAVE_ASM_PPC_REL16
+ bcl 20,31,1f
+1: mflr r7
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+# else
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr r7
+# endif
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
index c52ad9babf..72170c95c0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
@@ -39,6 +39,8 @@
#define NARGS 3
#endif
+/* 0(r1) and 4(r1) are reserved by the ABI, 8(r1), 12(r1), 16(r1) are used
+ for temp saves. 44(r1) is used to save r30. */
#define stackblock 20
#ifndef __socket
@@ -69,12 +71,6 @@ ENTRY(__socket)
stw r8,20+stackblock(r1)
#endif
#if NARGS >= 7
- stw r9,24+stackblock(r1)
-#endif
-#if NARGS >= 8
- stw r10,28+stackblock(r1)
-#endif
-#if NARGS >= 9
#error too many arguments!
#endif
@@ -94,6 +90,7 @@ ENTRY(__socket)
mflr r9
stw r9,52(r1)
cfi_offset (lr, 4)
+ CGOTSETUP
CENABLE
stw r3,16(r1)
li r3,P(SOCKOP_,socket)
@@ -107,6 +104,7 @@ ENTRY(__socket)
lwz r4,52(r1)
lwz r0,12(r1)
lwz r3,8(r1)
+ CGOTRESTORE
mtlr r4
mtcr r0
addi r1,r1,48
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
index 0c84d48d10..6e46abadb0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
@@ -130,8 +130,15 @@ ENTRY(__swapcontext)
stfd fp0,_UC_FREGS+(32*8)(r3)
#ifdef PIC
mflr r8
+# ifdef HAVE_ASM_PPC_REL16
+ bcl 20,31,1f
+1: mflr r7
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+# else
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr r7
+# endif
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
@@ -272,8 +279,15 @@ L(no_vec):
#ifdef PIC
mflr r8
+# ifdef HAVE_ASM_PPC_REL16
+ bcl 20,31,1f
+1: mflr r7
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+# else
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr r7
+# endif
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
index ce8ebc2a97..ee1b50c04b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2005 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 @@
#ifdef __NR_truncate64
#ifndef __ASSUME_TRUNCATE64_SYSCALL
/* The variable is shared between all wrappers around *truncate64 calls. */
-int have_no_truncate64;
+int __have_no_truncate64;
#endif
@@ -40,7 +40,7 @@ truncate64 (path, length)
off64_t length;
{
#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (! have_no_truncate64)
+ if (! __have_no_truncate64)
#endif
{
#ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -58,7 +58,7 @@ truncate64 (path, length)
#ifndef __ASSUME_TRUNCATE64_SYSCALL
__set_errno (saved_errno);
- have_no_truncate64 = 1;
+ __have_no_truncate64 = 1;
#endif
}
@@ -68,7 +68,7 @@ truncate64 (path, length)
__set_errno (EINVAL);
return -1;
}
- return truncate (path, (off_t) length);
+ return __truncate (path, (off_t) length);
#endif
}
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
index 8034559200..cf71a6df19 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
@@ -180,4 +180,4 @@ L(gotexitcodeaddr):
#endif
END(__makecontext)
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
index fa815e9581..e2c5002390 100644
--- a/sysdeps/unix/sysv/linux/readdir64.c
+++ b/sysdeps/unix/sysv/linux/readdir64.c
@@ -4,4 +4,4 @@
#include <sysdeps/unix/readdir.c>
-weak_alias(__readdir64, readdir64)
+weak_alias (__readdir64, readdir64)
diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c
index d63680bf9a..bce56124ef 100644
--- a/sysdeps/unix/sysv/linux/readdir64_r.c
+++ b/sysdeps/unix/sysv/linux/readdir64_r.c
@@ -4,4 +4,4 @@
#include <sysdeps/unix/readdir_r.c>
-weak_alias(__readdir64_r, readdir64_r)
+weak_alias (__readdir64_r, readdir64_r)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
index 2578b3ddc0..3b38d19488 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
@@ -72,4 +72,4 @@ ENTRY(__getcontext)
br %r14
END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
index 7ad360a3a0..cce8d29735 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
@@ -69,4 +69,4 @@ ENTRY(__setcontext)
br %r14
END(__setcontext)
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
index d9abb62c0b..bf70f11cc7 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
@@ -105,4 +105,4 @@ ENTRY(__swapcontext)
/* Return. */
br %r14
END(__swapcontext)
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
index 5a0d7eca5d..8889b5359e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
@@ -72,4 +72,4 @@ ENTRY(__getcontext)
br %r14
END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
index 268f36e713..7beca847c2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
@@ -69,4 +69,4 @@ ENTRY(__setcontext)
br %r14
END(__setcontext)
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
index ef2a862c55..cb96fd3b6a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
@@ -105,4 +105,4 @@ ENTRY(__swapcontext)
/* Return. */
br %r14
END(__swapcontext)
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c
index d94e4f62fd..0e41a11338 100644
--- a/sysdeps/unix/sysv/linux/sleep.c
+++ b/sysdeps/unix/sysv/linux/sleep.c
@@ -1,5 +1,5 @@
/* Implementation of the POSIX sleep function using nanosleep.
- Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996,1997,1998,1999,2003,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -21,6 +21,7 @@
#include <errno.h>
#include <time.h>
#include <signal.h>
+#include <string.h> /* For the real memset prototype. */
#include <unistd.h>
#include <sys/param.h>
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index ed31b0e89c..8e7b64f996 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -1,5 +1,5 @@
/* Bit values & structures for resource limits. Linux/SPARC version.
- Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+ Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -89,7 +89,18 @@ enum __rlimit_resource
__RLIMIT_MSGQUEUE = 12,
#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
- __RLIMIT_NLIMITS = 13,
+ /* Maximum nice priority allowed to raise to.
+ Nice levels 19 .. -20 correspond to 0 .. 39
+ values of this resource limit. */
+ __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+ /* Maximum realtime priority allowed for non-priviledged
+ processes. */
+ __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO _RLIMIT_RTPRIO
+
+ __RLIMIT_NLIMITS = 15,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
index 4d8fdb8200..95106d149f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
@@ -104,4 +104,4 @@ __thread_start:
.size __thread_start, .-__thread_start
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
index f6134599e2..0e1025ff6a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
@@ -114,4 +114,4 @@ __thread_start:
nop
.size __thread_start, .-__thread_start
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
index ea18a9ae4e..e6f5b55d6f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
@@ -62,4 +62,4 @@ ENTRY(__getcontext)
END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
index 435bf99acb..88dc54e852 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
@@ -47,6 +47,6 @@ END(__libc_siglongjmp)
strong_alias(__libc_siglongjmp, __longjmp)
strong_alias(__libc_siglongjmp, __libc_longjmp)
libc_hidden_def (__libc_longjmp)
-weak_alias(__libc_siglongjmp, longjmp)
-weak_alias(__libc_siglongjmp, _longjmp)
-weak_alias(__libc_siglongjmp, siglongjmp)
+weak_alias (__libc_siglongjmp, longjmp)
+weak_alias (__libc_siglongjmp, _longjmp)
+weak_alias (__libc_siglongjmp, siglongjmp)
diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h
index a8baf40a91..be2810e0c7 100644
--- a/sysdeps/unix/sysv/linux/sys/quota.h
+++ b/sysdeps/unix/sysv/linux/sys/quota.h
@@ -41,6 +41,14 @@
#include <sys/types.h>
/*
+ * Select between different incompatible quota versions.
+ * Default to the version used by Linux kernel version 2.4.22
+ * or later. */
+#ifndef _LINUX_QUOTA_VERSION
+# define _LINUX_QUOTA_VERSION 2
+#endif
+
+/*
* Convert diskblocks to blocks and the other way around.
* currently only to fool the BSD source. :-)
*/
@@ -94,21 +102,33 @@
#define SUBCMDSHIFT 8
#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
-#define Q_QUOTAON 0x0100 /* enable quotas */
-#define Q_QUOTAOFF 0x0200 /* disable quotas */
-#define Q_GETQUOTA 0x0300 /* get limits and usage */
-#define Q_SETQUOTA 0x0400 /* set limits and usage */
-#define Q_SETUSE 0x0500 /* set usage */
-#define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
-#define Q_SETQLIM 0x0700 /* set limits */
-#define Q_GETSTATS 0x0800 /* get collected stats */
-#define Q_RSQUASH 0x1000 /* set root_squash option */
+#if _LINUX_QUOTA_VERSION < 2
+# define Q_QUOTAON 0x0100 /* enable quotas */
+# define Q_QUOTAOFF 0x0200 /* disable quotas */
+# define Q_GETQUOTA 0x0300 /* get limits and usage */
+# define Q_SETQUOTA 0x0400 /* set limits and usage */
+# define Q_SETUSE 0x0500 /* set usage */
+# define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
+# define Q_SETQLIM 0x0700 /* set limits */
+# define Q_GETSTATS 0x0800 /* get collected stats */
+# define Q_RSQUASH 0x1000 /* set root_squash option */
+#else
+# define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */
+# define Q_QUOTAON 0x800002 /* turn quotas on */
+# define Q_QUOTAOFF 0x800003 /* turn quotas off */
+# define Q_GETFMT 0x800004 /* get quota format used on given filesystem */
+# define Q_GETINFO 0x800005 /* get information about quota files */
+# define Q_SETINFO 0x800006 /* set information about quota files */
+# define Q_GETQUOTA 0x800007 /* get user quota structure */
+# define Q_SETQUOTA 0x800008 /* set user quota structure */
+#endif
/*
* The following structure defines the format of the disk quota file
* (as it appears on disk) - the file is an array of these structures
* indexed by user or group number.
*/
+#if _LINUX_QUOTA_VERSION < 2
struct dqblk
{
u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
@@ -120,13 +140,45 @@ struct dqblk
time_t dqb_btime; /* time limit for excessive disk use */
time_t dqb_itime; /* time limit for excessive files */
};
+#else
+
+/* Flags that indicate which fields in dqblk structure are valid. */
+#define QIF_BLIMITS 1
+#define QIF_SPACE 2
+#define QIF_ILIMITS 4
+#define QIF_INODES 8
+#define QIF_BTIME 16
+#define QIF_ITIME 32
+#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE (QIF_SPACE | QIF_INODES)
+#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
+#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk
+ {
+ u_int64_t dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */
+ u_int64_t dqb_bsoftlimit; /* preferred limit on disk quota blocks */
+ u_int64_t dqb_curspace; /* current quota block count */
+ u_int64_t dqb_ihardlimit; /* maximum # allocated inodes */
+ u_int64_t dqb_isoftlimit; /* preferred inode limit */
+ u_int64_t dqb_curinodes; /* current # allocated inodes */
+ u_int64_t dqb_btime; /* time limit for excessive disk use */
+ u_int64_t dqb_itime; /* time limit for excessive files */
+ u_int32_t dqb_valid; /* bitmask of QIF_* constants */
+ };
+#endif
/*
* Shorthand notation.
*/
#define dq_bhardlimit dq_dqb.dqb_bhardlimit
#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
-#define dq_curblocks dq_dqb.dqb_curblocks
+#if _LINUX_QUOTA_VERSION < 2
+# define dq_curblocks dq_dqb.dqb_curblocks
+#else
+# define dq_curspace dq_dqb.dqb_curspace
+# define dq_valid dq_dqb.dqb_valid
+#endif
#define dq_ihardlimit dq_dqb.dqb_ihardlimit
#define dq_isoftlimit dq_dqb.dqb_isoftlimit
#define dq_curinodes dq_dqb.dqb_curinodes
@@ -135,6 +187,7 @@ struct dqblk
#define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk)))
+#if _LINUX_QUOTA_VERSION < 2
struct dqstats
{
u_int32_t lookups;
@@ -147,6 +200,22 @@ struct dqstats
u_int32_t free_dquots;
u_int32_t syncs;
};
+#else
+
+/* Flags that indicate which fields in dqinfo structure are valid. */
+# define IIF_BGRACE 1
+# define IIF_IGRACE 2
+# define IIF_FLAGS 4
+# define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo
+ {
+ u_int64_t dqi_bgrace;
+ u_int64_t dqi_igrace;
+ u_int32_t dqi_flags;
+ u_int32_t dqi_valid;
+ };
+#endif
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c
index 7e601acf2c..637fca5968 100644
--- a/sysdeps/unix/sysv/linux/sysctl.c
+++ b/sysdeps/unix/sysv/linux/sysctl.c
@@ -1,5 +1,5 @@
/* Read or write system information. Linux version.
- Copyright (C) 1996-1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2000,2002,2003,2005 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
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <errno.h>
+#include <string.h> /* For the real memset prototype. */
#include <sys/sysctl.h>
#include <sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/system.c b/sysdeps/unix/sysv/linux/system.c
index 3fdff04c22..c5b389ea29 100644
--- a/sysdeps/unix/sysv/linux/system.c
+++ b/sysdeps/unix/sysv/linux/system.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 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
@@ -18,6 +18,7 @@
#include <sched.h>
#include <signal.h>
+#include <string.h> /* For the real memset prototype. */
#include <sysdep.h>
#include <unistd.h>
#include <sys/wait.h>
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
index 491fa9dfb2..5ea4c572a3 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
@@ -1,4 +1,4 @@
#define __getdents64 __no___getdents64_decl
#include <sysdeps/unix/sysv/linux/getdents.c>
#undef __getdents64
-weak_alias(__getdents, __getdents64);
+weak_alias (__getdents, __getdents64);
diff --git a/sysdeps/unix/sysv/linux/x86_64/getcontext.S b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
index d19c9f0d09..4bbc7a4d2e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
@@ -85,4 +85,4 @@ L(pseudo_end):
ret
PSEUDO_END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
index 6597d8980b..5deea7d1b2 100644
--- a/sysdeps/unix/sysv/linux/x86_64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
@@ -110,4 +110,4 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
}
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/setcontext.S b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
index 51e4a50712..61fc07f44f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
@@ -102,4 +102,4 @@ L(pseudo_end):
ret
PSEUDO_END(__setcontext)
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
index 8d48d3bd5e..fc7996ccdc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
@@ -120,4 +120,4 @@ L(pseudo_end):
ret
PSEUDO_END(__swapcontext)
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)