[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r14017 - in /fsf/trunk/libc: ./ sysdeps/unix/sysv/linux/ sysdeps/unix/sysv/linux/bits/ sysdeps/unix/sysv/linux/x86_64/
- To: commits@xxxxxxxxxx
- Subject: [commits] r14017 - in /fsf/trunk/libc: ./ sysdeps/unix/sysv/linux/ sysdeps/unix/sysv/linux/bits/ sysdeps/unix/sysv/linux/x86_64/
- From: eglibc@xxxxxxxxxx
- Date: Sat, 28 May 2011 07:03:29 -0000
Author: eglibc
Date: Sat May 28 00:03:26 2011
New Revision: 14017
Log:
Import glibc-mainline for 2011-05-28
Added:
fsf/trunk/libc/sysdeps/unix/sysv/linux/internal_sendmmsg.S
fsf/trunk/libc/sysdeps/unix/sysv/linux/sendmmsg.c
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/sysdeps/unix/sysv/linux/Makefile
fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions
fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h
fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/socket.h
fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list
fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c
fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/time.S
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat May 28 00:03:26 2011
@@ -1,4 +1,31 @@
+2011-05-28 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12813]
+ * sysdeps/unix/sysv/linux/x86_64/init-first.c (__vdso_time): Retrieve
+ time symbol from vDSO. Substitute with vsyscall if not available.
+ * sysdeps/unix/sysv/linux/x86_64/time.S [SHARED]: Use
+ __vdso_time.
+
+ * sysdeps/unix/sysv/linux/internal_sendmmsg.S: New file.
+ * sysdeps/unix/sysv/linux/sendmmsg.c: New file.
+ * sysdeps/unix/sysv/linux/Makefile [subdir=socket] (sysdep_routines):
+ Add sendmmsg and internal_sendmmsg.
+ * sysdeps/unix/sysv/linux/Versions [GLIBC_2.14]: Add sendmmsg.
+ * sysdeps/unix/sysv/linux/bits/socket.h: Declare sendmmsg.
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_SENDMMSG.
+
+ * sysdeps/unix/sysv/linux/syscalls.list: Add setns entry.
+ * sysdeps/unix/sysv/linux/bits/sched.h: Declare setns.
+ * sysdeps/unix/sysv/linux/Versions [GLIBC_2.14]: Add setns.
+
2011-05-27 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12813]
+ * sysdeps/unix/sysv/linux/x86_64/init-first.c (__vdso_getcpu):
+ Retrieve getcpu symbol from vDSO. Substitute with vsyscall if not
+ available.
+ * sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S [SHARED]: Use
+ __vdso_getcpu.
[BZ #12814]
* iconvdata/Makefile (tests): Add bug-iconv9.
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sat May 28 00:03:26 2011
@@ -17,7 +17,7 @@
12545, 12551, 12582, 12583, 12587, 12597, 12601, 12611, 12625, 12626,
12631, 12650, 12653, 12655, 12660, 12671, 12681, 12685, 12711, 12713,
12714, 12717, 12723, 12724, 12734, 12738, 12746, 12766, 12775, 12777,
- 12782, 12788, 12792, 12795, 12814
+ 12782, 12788, 12792, 12795, 12813, 12814
* The RPC implementation in libc is obsoleted. Old programs keep working
but new programs cannot be linked with the routines in libc anymore.
@@ -30,7 +30,7 @@
Implemented by Ulrich Drepper.
* New Linux interfaces: clock_adjtime, name_to_handle_at, open_by_handle_at,
- syncfs
+ syncfs, setns, sendmmsg
* New locales: os_RU, bem_ZA, en_ZA, ff_SN, sw_KE, sw_TZ, lb_LU, wae_CH,
yue_HK, lij_IT, mhr_RU
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/Makefile (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/Makefile Sat May 28 00:03:26 2011
@@ -12,7 +12,8 @@
endif
ifeq ($(subdir),socket)
-sysdep_routines += internal_accept4 recvmmsg internal_recvmmsg
+sysdep_routines += internal_accept4 recvmmsg internal_recvmmsg sendmmsg \
+ internal_sendmmsg
endif
ifeq ($(subdir),misc)
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions Sat May 28 00:03:26 2011
@@ -158,6 +158,10 @@
clock_adjtime;
name_to_handle_at; open_by_handle_at;
+
+ setns;
+
+ sendmmsg;
}
GLIBC_PRIVATE {
# functions used in other libraries
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h Sat May 28 00:03:26 2011
@@ -1,6 +1,6 @@
/* Definitions of constants and data structure for POSIX 1003.1b-1993
scheduling interface.
- Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008,2009
+ Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008,2009,2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -37,7 +37,7 @@
# define SCHED_RESET_ON_FORK 0x40000000
#endif
-#ifdef __USE_MISC
+#ifdef __USE_GNU
/* Cloning flags. */
# define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */
# define CLONE_VM 0x00000100 /* Set if VM shared between processes. */
@@ -78,7 +78,7 @@
__BEGIN_DECLS
-#ifdef __USE_MISC
+#ifdef __USE_GNU
/* Clone current process. */
extern int clone (int (*__fn) (void *__arg), void *__child_stack,
int __flags, void *__arg, ...) __THROW;
@@ -88,7 +88,11 @@
/* Get index of currently used CPU. */
extern int sched_getcpu (void) __THROW;
-#endif
+
+/* Switch process to namespace of type NSTYPE indicated by FD. */
+extern int setns (int __fd, int __nstype) __THROW;
+#endif
+
__END_DECLS
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/socket.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/socket.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/socket.h Sat May 28 00:03:26 2011
@@ -421,7 +421,7 @@
__BEGIN_DECLS
-/* Receive a message as described by MESSAGE from socket FD.
+/* Receive up to VLEN messages as described by VMESSAGES from socket FD.
Returns the number of bytes read or -1 for errors.
This function is a cancellation point and therefore not marked with
@@ -430,6 +430,13 @@
unsigned int __vlen, int __flags,
__const struct timespec *__tmo);
+/* Send a VLEN messages as described by VMESSAGES to socket FD.
+ Return the number of datagrams successfully written or -1 for errors.
+This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int sendmmsg (int __fd, struct mmsghdr *__vmessages,
+ unsigned int __vlen, int __flags);
+
__END_DECLS
#endif /* bits/socket.h */
Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/internal_sendmmsg.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/internal_sendmmsg.S (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/internal_sendmmsg.S Sat May 28 00:03:26 2011
@@ -1,0 +1,14 @@
+#include <kernel-features.h>
+#include <sys/syscall.h>
+#if !defined __NR_sendmmsg && defined __NR_socketcall
+# define socket sendmmsg
+# ifdef __ASSUME_SENDMMSG
+# define __socket sendmmsg
+# else
+# define __socket __internal_sendmmsg
+# endif
+# define NARGS 4
+# define NEED_CANCELLATION
+# define NO_WEAK_ALIAS
+# include <socket.S>
+#endif
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h Sat May 28 00:03:26 2011
@@ -541,3 +541,8 @@
#if __LINUX_KERNEL_VERSION >= 0x020624
# define __ASSUME_PRLIMIT64 1
#endif
+
+/* sendmmsg is available in 2.6.39. */
+#if __LINUX_KERNEL_VERSION >= 0x020627
+# define __ASSUME_SENDMMSG 1
+#endif
Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/sendmmsg.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sendmmsg.c (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sendmmsg.c Sat May 28 00:03:26 2011
@@ -1,0 +1,96 @@
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@xxxxxxxxx>, 2011.
+
+ 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 <errno.h>
+#include <sys/socket.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <kernel-features.h>
+
+
+#ifdef __NR_sendmmsg
+int
+sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
+{
+ if (SINGLE_THREAD_P)
+ return INLINE_SYSCALL (sendmmsg, 4, fd, vmessages, vlen, flags);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = INLINE_SYSCALL (sendmmsg, 4, fd, vmessages, vlen, flags);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+#elif defined __NR_socketcall
+# ifndef __ASSUME_SENDMMSG
+extern int __internal_sendmmsg (int fd, struct mmsghdr *vmessages,
+ unsigned int vlen, int flags)
+ attribute_hidden;
+
+static int have_sendmmsg;
+
+int
+sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
+{
+ if (__builtin_expect (have_sendmmsg >= 0, 1))
+ {
+ int ret = __internal_sendmmsg (fd, vmessages, vlen, flags);
+ /* The kernel returns -EINVAL for unknown socket operations.
+ We need to convert that error to an ENOSYS error. */
+ if (__builtin_expect (ret < 0, 0)
+ && have_sendmmsg == 0
+ && errno == EINVAL)
+ {
+ /* Try another call, this time with an invalid file
+ descriptor and all other parameters cleared. This call
+ will not cause any harm and it will return
+ immediately. */
+ ret = __internal_sendmmsg (-1, 0, 0, 0);
+ if (errno == EINVAL)
+ {
+ have_sendmmsg = -1;
+ __set_errno (ENOSYS);
+ }
+ else
+ {
+ have_sendmmsg = 1;
+ __set_errno (EINVAL);
+ }
+ return -1;
+ }
+ return ret;
+ }
+ __set_errno (ENOSYS);
+ return -1;
+}
+# else
+/* When __ASSUME_SENDMMSG sendmmsg is defined in internal_sendmmsg.S. */
+# endif
+#else
+int
+sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sendmmsg)
+#endif
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/syscalls.list Sat May 28 00:03:26 2011
@@ -107,3 +107,5 @@
name_to_handle_at EXTRA name_to_handle_at i:isppi name_to_handle_at
open_by_handle_at EXTRA open_by_handle_at Ci:ipi open_by_handle_at
+
+setns EXTRA setns i:ii setns
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/init-first.c Sat May 28 00:03:26 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2011 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
@@ -26,6 +26,10 @@
__attribute__ ((nocommon));
strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden)
+long int (*__vdso_getcpu) (unsigned *, unsigned *, void *);
+
+long int (*__vdso_time) (time_t *) attribute_hidden;
+
static inline void
_libc_vdso_platform_setup (void)
@@ -43,6 +47,22 @@
p = _dl_vdso_vsym ("clock_gettime", &linux26);
PTR_MANGLE (p);
__GI___vdso_clock_gettime = p;
+
+ p = _dl_vdso_vsym ("getcpu", &linux26);
+ /* If the vDSO is not available we fall back on the old vsyscall. */
+#define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800
+ if (p == NULL)
+ p = (void *) VSYSCALL_ADDR_vgetcpu;
+ PTR_MANGLE (p);
+ __vdso_getcpu = p;
+
+ p = _dl_vdso_vsym ("time", &linux26);
+ /* If the vDSO is not available we fall back on the old vsyscall. */
+#define VSYSCALL_ADDR_vtime 0xffffffffff600400
+ if (p == NULL)
+ p = (void *) VSYSCALL_ADDR_vtime;
+ PTR_MANGLE (p);
+ __vdso_time = p;
}
# define VDSO_SETUP _libc_vdso_platform_setup
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S Sat May 28 00:03:26 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2011 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
@@ -35,7 +35,12 @@
movl $VGETCPU_CACHE_OFFSET, %edx
addq %fs:0, %rdx
+#ifdef SHARED
+ movq __vdso_getcpu(%rip), %rax
+ PTR_DEMANGLE (%rax)
+#else
movq $VSYSCALL_ADDR_vgetcpu, %rax
+#endif
callq *%rax
cmpq $-4095, %rax
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/time.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/time.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/time.S Sat May 28 00:03:26 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,02, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001,02, 2003, 2011 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,7 +32,12 @@
sub $0x8, %rsp
cfi_adjust_cfa_offset(8)
+#ifdef SHARED
+ movq __vdso_time(%rip), %rax
+ PTR_DEMANGLE (%rax)
+#else
movq $VSYSCALL_ADDR_vtime, %rax
+#endif
callq *%rax
add $0x8, %rsp