summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-07-28 23:34:19 +0000
committerJakub Jelinek <jakub@redhat.com>2008-07-28 23:34:19 +0000
commitc7045198ca8f4ff5b97205340d51127f8503c2bd (patch)
tree387ee7a78760f683df6035af28d665e3972aa30b
parentc83494a925f4b4b716f9ba3abcb5e695d3e2a8a9 (diff)
Updated to fedora-glibc-20080728T2320cvs/fedora-glibc-2_8_90-10
-rw-r--r--ChangeLog264
-rw-r--r--Makeconfig4
-rw-r--r--NEWS12
-rw-r--r--Versions.def2
-rw-r--r--elf/Makefile2
-rw-r--r--elf/dl-load.c11
-rw-r--r--elf/dl-object.c10
-rw-r--r--elf/dl-support.c9
-rw-r--r--elf/dl-sysdep.c3
-rw-r--r--elf/elf.h2
-rw-r--r--elf/rtld.c2
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in10
-rw-r--r--hurd/fd-read.c7
-rw-r--r--include/resolv.h6
-rw-r--r--include/rpc/clnt.h12
-rw-r--r--include/sys/socket.h8
-rw-r--r--include/unistd.h7
-rw-r--r--io/Makefile4
-rw-r--r--io/Versions3
-rw-r--r--io/dup3.c48
-rw-r--r--io/pipe2.c44
-rw-r--r--libio/Makefile4
-rw-r--r--libio/fileops.c4
-rw-r--r--libio/iopopen.c120
-rw-r--r--libio/tst-popen1.c49
-rw-r--r--locale/setlocale.c43
-rw-r--r--localedata/ChangeLog3
-rw-r--r--localedata/locales/fr_FR59
-rwxr-xr-xlocaledata/tst-langinfo.sh40
-rw-r--r--login/utmp_file.c9
-rw-r--r--malloc/mtrace.c40
-rw-r--r--misc/syslog.c31
-rw-r--r--nis/ypclnt.c17
-rw-r--r--nptl/ChangeLog19
-rw-r--r--nptl/sysdeps/powerpc/tcb-offsets.sym2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/mq_notify.c29
-rw-r--r--nscd/Makefile2
-rw-r--r--nscd/connections.c99
-rw-r--r--nscd/nscd_helper.c31
-rw-r--r--posix/unistd.h14
-rw-r--r--posix/wordexp.c58
-rw-r--r--resolv/gethnamaddr.c6
-rw-r--r--resolv/nss_dns/dns-canon.c3
-rw-r--r--resolv/nss_dns/dns-host.c65
-rw-r--r--resolv/nss_dns/dns-network.c4
-rw-r--r--resolv/res_query.c32
-rw-r--r--resolv/res_send.c53
-rw-r--r--scripts/gen-as-const.awk8
-rw-r--r--socket/Makefile6
-rw-r--r--socket/Versions3
-rw-r--r--socket/have_sock_cloexec.c24
-rw-r--r--socket/paccept.c43
-rw-r--r--socket/sys/socket.h18
-rw-r--r--stdio-common/_i18n_number.h24
-rw-r--r--stdio-common/printf_fp.c27
-rw-r--r--stdio-common/vfprintf.c4
-rw-r--r--sunrpc/Versions3
-rw-r--r--sunrpc/clnt_udp.c60
-rw-r--r--sunrpc/key_call.c2
-rw-r--r--sysdeps/generic/ldsodefs.h6
-rw-r--r--sysdeps/i386/i686/memcmp.S5
-rw-r--r--sysdeps/sparc/Makefile2
-rw-r--r--sysdeps/unix/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/Versions3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/epoll.h143
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/eventfd.h52
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/inotify.h105
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/signalfd.h66
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/timerfd.h60
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h20
-rw-r--r--sysdeps/unix/sysv/linux/dl-origin.c53
-rw-r--r--sysdeps/unix/sysv/linux/dl-sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/eventfd.c12
-rw-r--r--sysdeps/unix/sysv/linux/i386/paccept.S135
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h17
-rw-r--r--sysdeps/unix/sysv/linux/opensock.c41
-rw-r--r--sysdeps/unix/sysv/linux/paccept.c54
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/utmp.h125
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/utmpx.h104
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/Makefile5
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/Versions23
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutent.c29
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c35
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutid.c29
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c32
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutline.c29
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c31
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c38
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c31
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c31
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c31
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/login.c36
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/login32.c37
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c31
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c29
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c31
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h22
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h17
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c185
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h53
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h86
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c140
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h52
-rw-r--r--sysdeps/unix/sysv/linux/signalfd.c12
-rw-r--r--sysdeps/unix/sysv/linux/socketcall.h6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/socket.h393
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sys/epoll.h143
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sys/eventfd.h52
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sys/inotify.h105
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sys/signalfd.h66
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sys/timerfd.h60
-rw-r--r--sysdeps/unix/sysv/linux/sys/epoll.h21
-rw-r--r--sysdeps/unix/sysv/linux/sys/eventfd.h11
-rw-r--r--sysdeps/unix/sysv/linux/sys/inotify.h15
-rw-r--r--sysdeps/unix/sysv/linux/sys/signalfd.h8
-rw-r--r--sysdeps/unix/sysv/linux/sys/timerfd.h10
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list3
118 files changed, 4170 insertions, 338 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f4f0f3a6b..5e759a21a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,267 @@
+2008-07-28 Ulrich Drepper <drepper@redhat.com>
+
+ * resolv/res_send.c (__libc_res_nsend): Take additional parameter.
+ Use it instead of locally defined resplen2 variable.
+ (res_nsend): Adjust for __libc_res_nsend interface change.
+ (send_vc): Initialize *resplen2 if necessary. Read length of
+ package into an appropriately aligned variable. Store converted length
+ in new variable and use it appropriately.
+ Add branch prediction help.
+ * resolv/res_query.c (__libc_res_nquery): Take additional parameter
+ and pass it on to __libc_res_nsend. Adjust all callers.
+ (__libc_res_nsearch): Likewise.
+ (__libc_res_nqeurydomain): Likewise.
+ * resolv/nss_dns/dns-host.c: Adjust for __libc_res_nsearch interface
+ change.
+ (_nss_dns_gethostbyname4): Don't unconditionally allocate tmp array.
+ Define resplen2 variable and pass it to __libc_res_nsearch and then
+ to gaih_getanswer.
+ (getanswer_r): In case of incorrect DNS data don't overread buffer.
+ Add branch prediction.
+ (gaih_getanswer_slice): Likewise. Check for invalid data types.
+ (gaih_getanswer): Don't decode second slice if first one failed due
+ to a too small buffer. Don't let not found status of second
+ decoder shadow results of the first.
+ * resolv/gethnamaddr.c (gethostbyname2): Adjust for __libc_res_nsearch
+ and __libc_res_nquery interface changes
+ (gethostbyaddr): Adjust for __libc_res_nquery interface change.
+ * include/resolv.h: Adjust prototypes for __libc_res_nquery,
+ __libc_res_nsearch, and __libc_res_nsend.
+ * resolv/nss_dns/dns-canon.c: Adjust for __libc_res_nquery interface
+ change.
+ * resolv/nss_dns/dns-network.c: Adjust for __libc_res_nquery and
+ __libc_res_nsearch interface changes.
+
+2008-07-27 Ulrich Drepper <drepper@redhat.com>
+
+ * libio/iopopen.c (_IO_new_proc_open): Remove unnecessary volatile.
+
+ * posix/wordexp.c (exec_comm): Use pipe2 if possible to create
+ file descriptors with close-on-exec set.
+ (exec_comm_child): Fix the case where the write end of the pipe is
+ STDOUT_FILENO already. In case it is, clear close-on-exec.
+
+ * sysdeps/unix/sysv/linux/syscalls.list: Add __pipe2 alias.
+ * io/pipe2.c: Likewise.
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_PIPE2
+ instead of __ASSUME_PACCEPT.
+ * include/unistd.h: Declare __have_pipe2.
+ * libio/iopopen.c: Implement "e" flag.
+ * libio/Makefile (tests): Add tst-popen1.
+ * libio/tst-popen1.c: New file.
+
+ * sysdeps/unix/sysv/linux/bits/socket.h: Define PF_ISDN and AF_ISDN.
+ * sysdeps/unix/sysv/linux/sparc/bits/socket.h: Likewise.
+
+2008-07-26 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #6771]
+ * libio/fileops.c (_IO_new_file_attach): Preserve errno around
+ success call of _IO_SEEKOFF or calls which failed because the
+ descriptor is for a pipe.
+
+ * sunrpc/key_call.c (getkeyserv_handle): Use FD_CLOEXEC instead of
+ magic number.
+
+ * misc/syslog.c (openlog_internal): Use SOCK_CLOEXEC if possible.
+
+ * malloc/mtrace.c (mtrace): Use 'e' flag in fopen call. Drop
+ F_SETFD use if we know fopen set the flag.
+
+ * login/utmp_file.c (setutent_file): Minor optimization in case
+ O_CLOEXEC is available.
+
+2008-07-24 Tom "spot" Callaway <tcallawa@redhat.com>
+
+ * Makeconfig: Define pie-ccflag and PIE-ccflag variables.
+ * elf/Makefile: Use pie-ccflag variable.
+ * nscd/Makefile: Likewise.
+ * sysdeps/sparc/Makefile: Set $(pie-ccflag) to -fPIE.
+
+2008-07-21 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ [BZ #6724]
+ * Versions.def: Add GLIBC_2.9 version tag for libutil.
+ * sysdeps/unix/sysv/linux/s390/bits/utmp.h: Copy of
+ gnu/bits/utmp.h. Check for __WORDSIZE_COMPAT32 removed.
+ * sysdeps/unix/sysv/linux/s390/bits/utmpx.h: Copy of
+ gnu/bits/utmpx.h. Check for __WORDSIZE_COMPAT32 removed.
+ * sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Add new files
+ utmp32, utmpx32 and login32.
+ * sysdeps/unix/sysv/linux/s390/s390-32/Versions: Add 2.9
+ versions of struct utmp functions to libc and libutil.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutent.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutid.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutline.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/login.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/login32.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c: New file.
+ * sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h: New file.
+
+2008-07-26 Ulrich Drepper <drepper@redhat.com>
+
+ * scripts/gen-as-const.awk: Generate more widely usable code by
+ using 64-bit arithmetic.
+
+ * stdio-common/printf_fp.c (___printf_fp): Give wide outout code
+ the same treatment as narrow output code in last patch.
+
+ * sunrpc/clnt_udp.c (__libc_clntudp_bufcreate): Namespace cleanup.
+
+ [BZ #6763]
+ * elf/dl-load.c (local_strdup): Remove inline.
+ (_dl_map_object_from_fd): Don't allocate l_symbolic_searchlist.r_list.
+ * elf/dl-object.c (_dl_new_object): Allocate symbolic searchlist as
+ part of the object.
+
+ * sysdeps/unix/sysv/linux/dl-origin.c: Add const to avoid warning.
+
+2008-07-25 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: IA-64 and SPARC have
+ the new syscalls, too.
+
+ * sysdeps/i386/i686/memcmp.S: Fix unwind information.
+ Reported by Paul Pluzhnikov <ppluzhnikov@google.com>.
+
+ [BZ #6698]
+ * stdio-common/_i18n_number.h (_i18n_number_rewrite): Take additional
+ parameter for end of buffer. If temporary copy is too large use
+ malloc.
+ * stdio-common/vfprintf.c: Adjust for _i18n_number_rewrite
+ interface change.
+ * stdio-common/printf_fp.c (__printf_fp): Likewise.. Account for
+ string rewrite when allocating buffer.
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: PPC has the new
+ syscalls, too.
+
+ * nscd/connections.c (nscd_init): Clean up fcntl call.
+
+ * nscd/nscd_helper.c (open_socket): Use SOCK_CLOEXEC and
+ SOCK_NONBLOCK if possible.
+
+ * sysdeps/unix/sysv/linux/opensock.c (__opensock): Use
+ SOCK_CLOEXEC if available.
+
+ * include/rpc/clnt.h: Declare __libc_clntudp_bufcreate and
+ __libc_clntudp_bufcreate_internal.
+ * include/sys/socket.h: Declare __have_sock_cloexec.
+ * socket/Makefile (aux): Add have_sock_cloexec.
+ * socket/have_sock_cloexec.c: New file.
+ * sunrpc/clnt_udp.h (clntudp_bufcreate): Now a wrapper around
+ __libc_clntudp_bufcreate.
+ (__libc_clntudp_bufcreate): Former implementation of clntudp_bufcreate
+ which takes an additional parameter. Create socket with non-blocking
+ mode and close-on-exec flag set, if wanted.
+ * sunrpc/Versions: Export __libc_clntudp_bufcreate@GLIBC_PRIVATE.
+ * nis/ypclnt.c (yp_bind_client_create): Use __libc_clntpudp_bufcreate
+ instead of clntudp_create. The socket has already the close-on-exec
+ flag set if SOCK_CLOEXEC is defined.
+
+2008-07-24 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define
+ __ASSUME_PACCEPT, __ASSUME_IN_NONBLOCK, and __ASSUME_PACCEPT if
+ appropriate.
+ * nscd/connections.c: Avoid fcntl calls to set close-on-exec flag and
+ non-blocking mode by using socket, paccept, and inotify_init1.
+
+ * Versions.def (glibc): Add GLIBC_2.9.
+ * io/Makefile (routines): Add dup3 and pipe2.
+ * io/Versions [glibc] (GLIBC_2.9): Add dup3 and pipe2.
+ * io/dup3.c: New file.
+ * io/pipe2.c: New file.
+ * posix/unistd.h: Declare dup3 and pipe2.
+ * socket/Makefile (routines): Add paccept.
+ * socket/Versions [glibc] (GLIBC_2.9): Add paccept.
+ * socket/paccept.c: New file.
+ * socket/sys/socket.h: Declare paccept.
+ * sysdeps/unix/syscalls.list: Add entry for dup3.
+ * sysdeps/unix/sysv/linux/Versions [glibc] (GLIBC_2.9): Add
+ epoll_create2 and inotify_init1.
+ * sysdeps/unix/sysv/linux/eventfd.c: Use eventfd1 syscall if possible.
+ * sysdeps/unix/sysv/linux/paccept.c: New file.
+ * sysdeps/unix/sysv/linux/signalfd.c: Use signalfd4 syscall if
+ possible.
+ * sysdeps/unix/sysv/linux/socketcall.h: Add SOCKOP_paccept.
+ * sysdeps/unix/sysv/linux/syscalls.list: Add epoll_create2,
+ inotify_init1, and pipe2 entries.
+ * sysdeps/unix/sysv/linux/alpha/sys/epoll.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/sys/eventfd.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/sys/inotify.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/sys/signalfd.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/sys/timerfd.h: New file.
+ * sysdeps/unix/sysv/linux/bits/socket.h: Define SOCK_CLOEXEC and
+ SOCK_NONBLOCK.
+ * sysdeps/unix/sysv/linux/i386/paccept.S: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/epoll.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/eventfd.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/inotify.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/signalfd.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/sys/timerfd.h: New file.
+ * sysdeps/unix/sysv/linux/sparc/bits/socket.h: New file.
+ * sysdeps/unix/sysv/linux/sys/epoll.h: Define EPOLL_CLOEXEC and
+ EPOLL_NONBLOCK. Declare epoll_create2.
+ * sysdeps/unix/sysv/linux/sys/eventfd.h: Define EFD_CLOEXEC and
+ EFD_NONBLOCK.
+ * sysdeps/unix/sysv/linux/sys/inotify.h: Define IN_CLOEXEC and
+ IN_NONBLOCK. Declare inotify_init1.
+ * sysdeps/unix/sysv/linux/sys/signalfd.h: Define SFD_CLOEXEC and
+ SFD_NONBLOCK.
+ * sysdeps/unix/sysv/linux/sys/timerfd.h: Define TFD_CLOEXEC and
+ TFD_NONBLOCK.
+
+ * elf/elf.h: Define AT_EXECFN.
+ * elf/rtld.c [!__ASSUME_AT_EXECFN] (process_envvars): Don't handle
+ LD_ORIGIN_PATH.
+ * elf/dl-sysdep.c (_dl_sysdep_start): Handle AT_EXECFN.
+ * elf/dl-support.c: Define _dl_execfn. Don't define _dl_origin_path
+ if __ASSUME_AT_EXECFN is defined.
+ (_dl_aux_init): Handle AT_EXECFN.
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_AT_EXECFN
+ for 2.6.27 and up.
+ * sysdeps/generic/ldsodefs.h (rtld_global_ro): Add _dl_execfn.
+ Don't define _dl_origin_path if __ASSUME_AT_EXECFN is defined.
+ * sysdeps/unix/sysv/linux/dl-origin.c (_dl_get_origin): Use
+ _dl_execfn if available and avoid compatibility code if
+ __ASSUME_AT_EXECFN is defined.
+
+ * sysdeps/unix/sysv/linux/dl-sysdep.h: Don't declare
+ _dl_discover_osversion only for older kernels.
+
+2008-07-22 Roland McGrath <roland@frob.com>
+
+ * hurd/fd-read.c (_hurd_fd_read): Fix last change.
+
+2008-07-21 Roland McGrath <roland@frob.com>
+
+ * hurd/fd-read.c (_hurd_fd_read): Return EGRATUITOUS if the server
+ returned too much data out of line.
+
+2008-07-20 Ulrich Drepper <drepper@redhat.com>
+
+ * locale/setlocale.c (setname): Remove inline to avoid compiler
+ warning.
+
+ [BZ #6712]
+ * locale/setlocale.c (setlocale): Take the setlocale lock earlier.
+
2008-07-15 Ulrich Drepper <drepper@redhat.com>
* stdio-common/vfprintf.c (_IO_helper_overflow): In case _IO_sputn
diff --git a/Makeconfig b/Makeconfig
index 7de7621f56..a78615eb6a 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -712,6 +712,10 @@ pic-ccflag = -fPIC
# This one should always stay like this unless there is a very good reason.
PIC-ccflag = -fPIC
endif
+# This can be changed by a sysdep makefile
+pie-ccflag = -fpie
+# This one should always stay like this unless there is a very good reason.
+PIE-ccflag = -fPIE
ifeq (yes,$(build-profile))
# Under --enable-profile, we will build a static library of profiled objects.
# The profiled object files are named foo.op.
diff --git a/NEWS b/NEWS
index eebc6b8349..9873ddea70 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2008-5-14
+GNU C Library NEWS -- history of user-visible changes. 2008-7-27
Copyright (C) 1992-2007, 2008 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -22,10 +22,18 @@ Version 2.9
* New implementation of memmem, strstr, and strcasestr which is O(n).
Implemented by Eric Blake.
+
+* New Linux interfaces: inotify_init1, paccept, dup3, epoll_create2, pipe2
+
+* Implement "e" option for popen to open file descriptor with the
+ close-on-exec flag set
+
+* Many functions, exported and internal, now atomically set the close-on-exec
+ flag when run on a sufficiently new kernel. Implemented by Ulrich Drepper.
Version 2.8
-* New locales: bo_CN, bo_IN.
+* New locales: bo_CN, bo_IN, shs_CA.
* New encoding: HP-ROMAN9, HP-GREEK8, HP-THAI8, HP-TURKISH8.
diff --git a/Versions.def b/Versions.def
index 0de15f8f7f..5d98ad1933 100644
--- a/Versions.def
+++ b/Versions.def
@@ -25,6 +25,7 @@ libc {
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
+ GLIBC_2.9
%ifdef USE_IN_LIBIO
HURD_CTHREADS_0.3
%endif
@@ -105,6 +106,7 @@ librt {
}
libutil {
GLIBC_2.0
+ GLIBC_2.9
}
ld {
GLIBC_2.0
diff --git a/elf/Makefile b/elf/Makefile
index e509153547..abb9572166 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -800,7 +800,7 @@ $(objpfx)tst-array5-static.out: $(objpfx)tst-array5-static
cmp $@ tst-array5-static.exp > /dev/null
ifeq (yesyes,$(have-fpie)$(build-shared))
-CFLAGS-tst-pie1.c += -fpie
+CFLAGS-tst-pie1.c += $(pie-ccflag)
$(objpfx)tst-pie1.out: $(objpfx)tst-pie1
$(elf-objpfx)$(rtld-installed-name) \
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 94531b271f..8a8936f7bd 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -163,7 +163,7 @@ static const size_t system_dirs_len[] =
/* Local version of `strdup' function. */
-static inline char *
+static char *
local_strdup (const char *s)
{
size_t len = strlen (s) + 1;
@@ -1470,15 +1470,6 @@ cannot enable executable stack as shared object requires");
{
/* Create an appropriate searchlist. It contains only this map.
This is the definition of DT_SYMBOLIC in SysVr4. */
- l->l_symbolic_searchlist.r_list =
- (struct link_map **) malloc (sizeof (struct link_map *));
-
- if (l->l_symbolic_searchlist.r_list == NULL)
- {
- errstring = N_("cannot create searchlist");
- goto call_lose_errno;
- }
-
l->l_symbolic_searchlist.r_list[0] = l;
l->l_symbolic_searchlist.r_nlist = 1;
diff --git a/elf/dl-object.c b/elf/dl-object.c
index 0e45aea39b..be4ea38f9f 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -1,5 +1,5 @@
/* Storage management for the chain of loaded shared objects.
- Copyright (C) 1995-2002, 2004, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002,2004,2006,2007,2008 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,13 +50,17 @@ _dl_new_object (char *realname, const char *libname, int type,
#endif
new = (struct link_map *) calloc (sizeof (*new) + audit_space
+ + sizeof (struct link_map *)
+ sizeof (*newname) + libname_len, 1);
if (new == NULL)
return NULL;
new->l_real = new;
- new->l_libname = newname = (struct libname_list *) ((char *) (new + 1)
- + audit_space);
+ new->l_symbolic_searchlist.r_list = (struct link_map **) ((char *) (new + 1)
+ + audit_space);
+
+ new->l_libname = newname
+ = (struct libname_list *) (new->l_symbolic_searchlist.r_list + 1);
newname->name = (char *) memcpy (newname + 1, libname, libname_len);
/* newname->next = NULL; We use calloc therefore not necessary. */
newname->dont_free = 1;
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 2c11ac6881..e5b74fb4d6 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -1,5 +1,5 @@
/* Support for dynamic linking code in static libc.
- Copyright (C) 1996-2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1996-2005, 2006, 2007, 2008 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
@@ -62,8 +62,12 @@ struct link_map *_dl_profile_map;
/* This is the address of the last stack address ever used. */
void *__libc_stack_end;
+#ifndef __ASSUME_AT_EXECFN
/* Path where the binary is found. */
const char *_dl_origin_path;
+#endif
+/* File Name of the executable. */
+const char *_dl_execfn;
/* Nonzero if runtime lookup should not update the .got/.plt. */
int _dl_bind_not;
@@ -216,6 +220,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
__libc_enable_secure = av->a_un.a_val;
__libc_enable_secure_decided = 1;
break;
+ case AT_EXECFN:
+ GLRO(dl_execfn) = (void *) av->a_un.a_val;
+ break;
# ifdef DL_PLATFORM_AUXV
DL_PLATFORM_AUXV
# endif
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index dd55905e14..1ff7a350be 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -173,6 +173,9 @@ _dl_sysdep_start (void **start_argptr,
GLRO(dl_sysinfo_dso) = (void *) av->a_un.a_val;
break;
#endif
+ case AT_EXECFN:
+ GLRO(dl_execfn) = (void *) av->a_un.a_val;
+ break;
#ifdef DL_PLATFORM_AUXV
DL_PLATFORM_AUXV
#endif
diff --git a/elf/elf.h b/elf/elf.h
index 269de527e6..a4134462ac 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -970,6 +970,8 @@ typedef struct
#define AT_SECURE 23 /* Boolean, was exec setuid-like? */
+#define AT_EXECFN 31 /* Filename of executable. */
+
/* Pointer to the global system page used for system calls and other
nice things. */
#define AT_SYSINFO 32
diff --git a/elf/rtld.c b/elf/rtld.c
index 46bece7fa3..3f2267af0e 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2579,10 +2579,12 @@ process_envvars (enum mode *modep)
break;
case 11:
+#ifndef __ASSUME_AT_EXECFN
/* Path where the binary is found. */
if (!INTUSE(__libc_enable_secure)
&& memcmp (envline, "ORIGIN_PATH", 11) == 0)
GLRO(dl_origin_path) = &envline[12];
+#endif
break;
case 12:
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 1b14d1b8f4..c95578eef2 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
glibc-base := HEAD
DIST_BRANCH := devel
COLLECTION := dist-f8
-fedora-sync-date := 2008-07-16 09:44 UTC
-fedora-sync-tag := fedora-glibc-20080716T0944
+fedora-sync-date := 2008-07-28 23:20 UTC
+fedora-sync-tag := fedora-glibc-20080728T2320
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 1c13bea7a8..9fd582000f 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -19,7 +19,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: @glibcversion@
-Release: 9
+Release: 10
# GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
# Things that are linked directly into dynamically linked programs
# and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@@ -976,6 +976,14 @@ rm -f *.filelist*
%endif
%changelog
+* Tue Jul 29 2008 Jakub Jelinek <jakub@redhat.com> 2.8.90-10
+- update from trunk
+ - resolver fixes
+ - misc fixes (BZ#6771, BZ#6763, BZ#6698, BZ#6712)
+ - s390{,x} utmp/utmpx bi-arch support (BZ#6724)
+ - popen "e" flag
+- fr_FR locale changes reenabled
+
* Wed Jul 16 2008 Jakub Jelinek <jakub@redhat.com> 2.8.90-9
- update from trunk
- fix unbuffered vfprintf if writing to the stream fails (#455360)
diff --git a/hurd/fd-read.c b/hurd/fd-read.c
index 388a4dbaf9..38706524f0 100644
--- a/hurd/fd-read.c
+++ b/hurd/fd-read.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,94,95,97,99,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993,94,95,97,99,2002,2008 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
@@ -41,6 +41,11 @@ _hurd_fd_read (struct hurd_fd *fd, void *buf, size_t *nbytes, loff_t offset)
if (data != buf)
{
+ if (nread > *nbytes) /* Sanity check for bogus server. */
+ {
+ __vm_deallocate (__mach_task_self (), (vm_address_t) data, nread);
+ return EGRATUITOUS;
+ }
memcpy (buf, data, nread);
__vm_deallocate (__mach_task_self (), (vm_address_t) data, nread);
}
diff --git a/include/resolv.h b/include/resolv.h
index 925746f685..6dae0495b2 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -58,11 +58,11 @@ libc_hidden_proto (__res_randomid)
libc_hidden_proto (__res_state)
int __libc_res_nquery (res_state, const char *, int, int, u_char *, int,
- u_char **, u_char **, int *);
+ u_char **, u_char **, int *, int *);
int __libc_res_nsearch (res_state, const char *, int, int, u_char *, int,
- u_char **, u_char **, int *);
+ u_char **, u_char **, int *, int *);
int __libc_res_nsend (res_state, const u_char *, int, const u_char *, int,
- u_char *, int, u_char **, u_char **, int *)
+ u_char *, int, u_char **, u_char **, int *, int *)
attribute_hidden;
libresolv_hidden_proto (_sethtent)
diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h
index 1e72e22bcb..75d88a65ca 100644
--- a/include/rpc/clnt.h
+++ b/include/rpc/clnt.h
@@ -21,6 +21,18 @@ extern CLIENT *clntudp_bufcreate_internal (struct sockaddr_in *__raddr,
struct timeval __wait_resend,
int *__sockp, u_int __sendsz,
u_int __recvsz) attribute_hidden;
+extern CLIENT *__libc_clntudp_bufcreate (struct sockaddr_in *__raddr,
+ u_long __program, u_long __version,
+ struct timeval __wait_resend,
+ int *__sockp, u_int __sendsz,
+ u_int __recvsz, int __flags);
+extern CLIENT *__libc_clntudp_bufcreate_internal (struct sockaddr_in *__raddr,
+ u_long __program,
+ u_long __version,
+ struct timeval __wait_resend,
+ int *__sockp, u_int __sendsz,
+ u_int __recvsz, int __flags)
+ attribute_hidden;
extern CLIENT *clntunix_create_internal (struct sockaddr_un *__raddr,
u_long __program, u_long __version,
int *__sockp, u_int __sendsz,
diff --git a/include/sys/socket.h b/include/sys/socket.h
index 0a226726aa..df892783a0 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -153,4 +153,12 @@ extern int __libc_sa_len_internal (sa_family_t __af) attribute_hidden;
# define __connect(fd, addr, len) INTUSE(__connect) (fd, addr, len)
#endif
+#ifdef SOCK_CLOEXEC
+extern int __have_sock_cloexec;
+/* At lot of other functionality became available at the same time as
+ SOCK_CLOEXEC. Avoid defining separate variables for all of them
+ unless it is really necessary. */
+# define __have_paccept __have_sock_cloexec
+#endif
+
#endif
diff --git a/include/unistd.h b/include/unistd.h
index f34d53f223..34d7477f9e 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -48,6 +48,7 @@ extern ssize_t __libc_write (int __fd, __const void *__buf, size_t __n);
libc_hidden_proto (__libc_write)
extern int __pipe (int __pipedes[2]);
libc_hidden_proto (__pipe)
+extern int __pipe2 (int __pipedes[2], int __flags);
extern unsigned int __sleep (unsigned int __seconds);
extern int __chown (__const char *__file,
__uid_t __owner, __gid_t __group);
@@ -165,4 +166,10 @@ extern int __libc_pause (void);
/* Not cancelable variant. */
extern int __pause_nocancel (void) attribute_hidden;
+extern int __have_sock_cloexec;
+/* At lot of other functionality became available at the same time as
+ SOCK_CLOEXEC. Avoid defining separate variables for all of them
+ unless it is really necessary. */
+#define __have_pipe2 __have_sock_cloexec
+
#endif
diff --git a/io/Makefile b/io/Makefile
index 1acda4c8b6..caaa51b351 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2002,2003,2005,2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1992-2003,2005,2006,2007,2008 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
@@ -40,7 +40,7 @@ routines := \
open open64 openat openat64 close \
read write lseek lseek64 access euidaccess faccessat \
fcntl flock lockf lockf64 \
- dup dup2 pipe \
+ dup dup2 dup3 pipe pipe2 \
creat creat64 \
chdir fchdir \
getcwd getwd getdirname \
diff --git a/io/Versions b/io/Versions
index d603668f4f..6c0a23b465 100644
--- a/io/Versions
+++ b/io/Versions
@@ -119,4 +119,7 @@ libc {
GLIBC_2.7 {
__open_2; __open64_2; __openat_2; __openat64_2;
}
+ GLIBC_2.9 {
+ dup3; pipe2;
+ }
}
diff --git a/io/dup3.c b/io/dup3.c
new file mode 100644
index 0000000000..162ab4e68b
--- /dev/null
+++ b/io/dup3.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2008 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 <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+
+/* Duplicate FD to FD2, closing the old FD2 and making FD2 be
+ open the same file as FD is which setting flags according to
+ FLAGS. Return FD2 or -1. */
+int
+dup3 (fd, fd2, flags)
+ int fd;
+ int fd2;
+ int flags;
+{
+ if (fd < 0 || fd2 < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ if (fd == fd2)
+ /* No way to check that they are valid. */
+ return fd2;
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (dup3)
+
+#include <stub-tag.h>
diff --git a/io/pipe2.c b/io/pipe2.c
new file mode 100644
index 0000000000..aa54d17ae6
--- /dev/null
+++ b/io/pipe2.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991, 1995, 1996, 2002, 2008 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 <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+
+/* Create a one-way communication channel (__pipe). If successful,
+ two file descriptors are stored in PIPEDES; bytes written on
+ PIPEDES[1] can be read from PIPEDES[0]. Apply FLAGS to the new
+ file descriptors. Returns 0 if successful, -1 if not. */
+int
+__pipe2 (pipedes, flags)
+ int pipedes[2];
+ int flags;
+{
+ if (pipedes == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__pipe2, pipe2)
+stub_warning (pipe2)
+
+#include <stub-tag.h>
diff --git a/libio/Makefile b/libio/Makefile
index 31fac70cfd..385040fb96 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2002,2003,2004,2006,2007 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004,2006,2007,2008 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
@@ -58,7 +58,7 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
tst-memstream1 tst-memstream2 \
tst-wmemstream1 tst-wmemstream2 \
bug-memstream1 bug-wmemstream1 \
- tst-setvbuf1
+ tst-setvbuf1 tst-popen1
test-srcs = test-freopen
all: # Make this the default target; it will be defined in Rules.
diff --git a/libio/fileops.c b/libio/fileops.c
index 95cd2d64c9..cf47c915a7 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007
+/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -428,9 +428,11 @@ _IO_new_file_attach (fp, fd)
/* Get the current position of the file. */
/* We have to do that since that may be junk. */
fp->_offset = _IO_pos_BAD;
+ int save_errno = errno;
if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD && errno != ESPIPE)
return NULL;
+ __set_errno (save_errno);
return fp;
}
INTDEF2(_IO_new_file_attach, _IO_file_attach)
diff --git a/libio/iopopen.c b/libio/iopopen.c
index d5c6305b09..1a5cc0f592 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997-2002, 2003, 2004, 2007
+/* Copyright (C) 1993, 1997-2002, 2003, 2004, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Per Bothner <bothner@cygnus.com>.
@@ -44,6 +44,7 @@
#endif
#include <sys/types.h>
#include <sys/wait.h>
+#include <kernel-features.h>
#ifndef _IO_fork
#ifdef _LIBC
@@ -56,15 +57,6 @@ extern _IO_pid_t _IO_fork (void) __THROW;
#endif /* _IO_HAVE_SYS_WAIT */
-#ifndef _IO_pipe
-#ifdef _LIBC
-#define _IO_pipe __pipe
-#else
-#define _IO_pipe pipe
-#endif
-extern int _IO_pipe (int des[2]) __THROW;
-#endif
-
#ifndef _IO_dup2
#ifdef _LIBC
#define _IO_dup2 __dup2
@@ -127,45 +119,103 @@ _IO_new_proc_open (fp, command, mode)
const char *mode;
{
#if _IO_HAVE_SYS_WAIT
- volatile int read_or_write;
- volatile int parent_end, child_end;
+ int read_or_write;
+ int parent_end, child_end;
int pipe_fds[2];
_IO_pid_t child_pid;
+
+ int do_read = 0;
+ int do_write = 0;
+ int do_cloexec = 0;
+ while (*mode != '\0')
+ switch (*mode++)
+ {
+ case 'r':
+ do_read = 1;
+ break;
+ case 'w':
+ do_write = 1;
+ break;
+ case 'e':
+ do_cloexec = 1;
+ break;
+ default:
+ errout:
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ if ((do_read ^ do_write) == 0)
+ goto errout;
+
if (_IO_file_is_open (fp))
return NULL;
- if (_IO_pipe (pipe_fds) < 0)
- return NULL;
- if (mode[0] == 'r' && mode[1] == '\0')
+
+#ifdef O_CLOEXEC
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 >= 0)
+# endif
+ {
+ int r = __pipe2 (pipe_fds, O_CLOEXEC);
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 == 0)
+ __have_pipe2 = r != -1 || errno != ENOSYS ? 1 : -1;
+
+ if (__have_pipe2 > 0)
+# endif
+ if (r < 0)
+ return NULL;
+ }
+#endif
+#ifndef __ASSUME_PIPE2
+# ifdef O_CLOEXEC
+ if (__have_pipe2 < 0)
+# endif
+ if (__pipe (pipe_fds) < 0)
+ return NULL;
+#endif
+
+ if (do_read)
{
parent_end = pipe_fds[0];
child_end = pipe_fds[1];
read_or_write = _IO_NO_WRITES;
}
- else if (mode[0] == 'w' && mode[1] == '\0')
+ else
{
parent_end = pipe_fds[1];
child_end = pipe_fds[0];
read_or_write = _IO_NO_READS;
}
- else
- {
- _IO_close (pipe_fds[0]);
- _IO_close (pipe_fds[1]);
- __set_errno (EINVAL);
- return NULL;
- }
+
((_IO_proc_file *) fp)->pid = child_pid = _IO_fork ();
if (child_pid == 0)
{
- int child_std_end = mode[0] == 'r' ? 1 : 0;
+ int child_std_end = do_read ? 1 : 0;
struct _IO_proc_file *p;
+#ifndef __ASSUME_PIPE2
+ /* If we have pipe2 the descriptor is marked for close-on-exec. */
_IO_close (parent_end);
+#endif
if (child_end != child_std_end)
{
_IO_dup2 (child_end, child_std_end);
+#ifndef __ASSUME_PIPE2
_IO_close (child_end);
+#endif
+ }
+#ifdef O_CLOEXEC
+ else
+ {
+ /* The descriptor is already the one we will use. But it must
+ not be marked close-on-exec. Undo the effects. */
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 > 0)
+# endif
+ __fcntl (child_end, F_SETFD, 0);
}
+#endif
/* POSIX.2: "popen() shall ensure that any streams from previous
popen() calls that remain open in the parent process are closed
in the new child process." */
@@ -189,6 +239,28 @@ _IO_new_proc_open (fp, command, mode)
_IO_close (parent_end);
return NULL;
}
+
+ if (do_cloexec)
+ {
+#ifndef __ASSUME_PIPE2
+# ifdef O_CLOEXEC
+ if (__have_pipe2 < 0)
+# endif
+ __fcntl (parent_end, F_SETFD, FD_CLOEXEC);
+#endif
+ }
+ else
+ {
+#ifdef O_CLOEXEC
+ /* Undo the effects of the pipe2 call which set the
+ close-on-exec flag. */
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 > 0)
+# endif
+ __fcntl (parent_end, F_SETFD, 0);
+#endif
+ }
+
_IO_fileno (fp) = parent_end;
/* Link into proc_file_chain. */
diff --git a/libio/tst-popen1.c b/libio/tst-popen1.c
new file mode 100644
index 0000000000..bae6615b9b
--- /dev/null
+++ b/libio/tst-popen1.c
@@ -0,0 +1,49 @@
+#include <fcntl.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ int res = 0;
+
+ FILE *fp = popen ("echo hello", "r");
+ if (fp == NULL)
+ {
+ puts ("first popen failed");
+ res = 1;
+ }
+ else
+ {
+ int fd = fileno (fp);
+ if (fcntl (fd, F_GETFD) == FD_CLOEXEC)
+ {
+ puts ("first popen(\"r\") set FD_CLOEXEC");
+ res = 1;
+ }
+
+ fclose (fp);
+ }
+
+ fp = popen ("echo hello", "re");
+ if (fp == NULL)
+ {
+ puts ("second popen failed");
+ res = 1;
+ }
+ else
+ {
+ int fd = fileno (fp);
+ if (fcntl (fd, F_GETFD) != FD_CLOEXEC)
+ {
+ puts ("second popen(\"r\") did not set FD_CLOEXEC");
+ res = 1;
+ }
+
+ fclose (fp);
+ }
+
+ return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/locale/setlocale.c b/locale/setlocale.c
index 767a5aab6b..05a55a96ed 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -193,7 +193,7 @@ new_composite_name (int category, const char *newnames[__LC_LAST])
/* Put NAME in _nl_global_locale.__names. */
-static inline void
+static void
setname (int category, const char *name)
{
if (_nl_global_locale.__names[category] == name)
@@ -234,9 +234,16 @@ setlocale (int category, const char *locale)
if (locale == NULL)
return (char *) _nl_global_locale.__names[category];
+ /* Protect global data. */
+ __libc_rwlock_wrlock (__libc_setlocale_lock);
+
if (strcmp (locale, _nl_global_locale.__names[category]) == 0)
- /* Changing to the same thing. */
- return (char *) _nl_global_locale.__names[category];
+ {
+ /* Changing to the same thing. */
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+
+ return (char *) _nl_global_locale.__names[category];
+ }
/* We perhaps really have to load some data. So we determine the
path in which to look for the data now. The environment variable
@@ -250,12 +257,13 @@ setlocale (int category, const char *locale)
if (locpath_var != NULL && locpath_var[0] != '\0')
{
if (__argz_create_sep (locpath_var, ':',
- &locale_path, &locale_path_len) != 0)
- return NULL;
-
- if (__argz_add_sep (&locale_path, &locale_path_len,
- _nl_default_locale_path, ':') != 0)
- return NULL;
+ &locale_path, &locale_path_len) != 0
+ || __argz_add_sep (&locale_path, &locale_path_len,
+ _nl_default_locale_path, ':') != 0)
+ {
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+ return NULL;
+ }
}
if (category == LC_ALL)
@@ -290,8 +298,13 @@ setlocale (int category, const char *locale)
break;
if (cnt == __LC_LAST)
- /* Bogus category name. */
- ERROR_RETURN;
+ {
+ error_return:
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+
+ /* Bogus category name. */
+ ERROR_RETURN;
+ }
/* Found the category this clause sets. */
newnames[cnt] = ++cp;
@@ -310,12 +323,9 @@ setlocale (int category, const char *locale)
for (cnt = 0; cnt < __LC_LAST; ++cnt)
if (cnt != LC_ALL && newnames[cnt] == locale)
/* The composite name did not specify all categories. */
- ERROR_RETURN;
+ goto error_return;
}
- /* Protect global data. */
- __libc_rwlock_wrlock (__libc_setlocale_lock);
-
/* Load the new data for each category. */
while (category-- > 0)
if (category != LC_ALL)
@@ -393,9 +403,6 @@ setlocale (int category, const char *locale)
struct locale_data *newdata = NULL;
const char *newname[1] = { locale };
- /* Protect global data. */
- __libc_rwlock_wrlock (__libc_setlocale_lock);
-
if (CATEGORY_USED (category))
{
/* Only actually load the data if anything will use it. */
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 7c3f41d21b..2bc9e89975 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -62,6 +62,9 @@
* locales/es_ES: Fix p_cs_precedes and n_cs_precedes.
Use common collation definition.
+ [BZ #6040]
+ * locales/fr_FR: Fix abmon, abday, d_ftm, grouping.
+
[BZ #6004]
* locales/iso14651_t1_common: Fix first weight for U+1E60, U+1E62,
U+1E64, U+1E66, and U+1E68.
diff --git a/localedata/locales/fr_FR b/localedata/locales/fr_FR
index 8bae005657..92c3bde1b7 100644
--- a/localedata/locales/fr_FR
+++ b/localedata/locales/fr_FR
@@ -3,33 +3,35 @@ escape_char /
%
% French Language Locale for France
% Source: RAP
-% Address: Sankt Jo//rgens Alle 8
-% DK-1615 Ko//benhavn V, Danmark
-% Contact: Keld Simonsen
-% Email: Keld.Simonsen@dkuug.dk
-% Tel: +45 - 31226543
-% Fax: +45 - 33256543
% Language: fr
+% Contact: Traduc.org
+% Address: 18, rue Cavendish
+% 75019 Paris
+% Email: traduc@traduc.org
% Territory: FR
-% Revision: 4.3
-% Date: 1996-10-15
+% Revision: 4.4
+% Date: 2008-03-02
% Users: general
% Charset: ISO-8859-1
+% Authors:
+% 2000-06-28, keld.simonsen@dkuug.dk
+% 2008-03-02, stephane.raimbault@gmail.com
+%
% Distribution and use is free, also
% for commercial purposes.
LC_IDENTIFICATION
title "French locale for France"
source "RAP"
-address "Sankt J<U00F8>rgens Alle 8, DK-1615 K<U00F8>benhavn V, Danmark"
-contact "Keld Simonsen"
+address ""
+contact "Traduc.org"
email "bug-glibc-locales@gnu.org"
tel ""
fax ""
language "French"
territory "France"
revision "1.0"
-date "2000-06-28"
+date "2008-03-15"
%
category "fr_FR:2000";LC_IDENTIFICATION
category "fr_FR:2000";LC_CTYPE
@@ -72,7 +74,7 @@ int_curr_symbol "<U0045><U0055><U0052><U0020>"
currency_symbol "<U20AC>"
mon_decimal_point "<U002C>"
mon_thousands_sep "<U0020>"
-mon_grouping 3;3
+mon_grouping 3
positive_sign ""
negative_sign "<U002D>"
int_frac_digits 2
@@ -88,14 +90,17 @@ END LC_MONETARY
LC_NUMERIC
decimal_point "<U002C>"
thousands_sep "<U0020>"
-grouping 0;0
+grouping 3
END LC_NUMERIC
LC_TIME
-abday "<U0064><U0069><U006D>";"<U006C><U0075><U006E>";/
- "<U006D><U0061><U0072>";"<U006D><U0065><U0072>";/
- "<U006A><U0065><U0075>";"<U0076><U0065><U006E>";/
- "<U0073><U0061><U006D>"
+abday "<U0064><U0069><U006D><U002E>";/
+ "<U006C><U0075><U006E><U002E>";/
+ "<U006D><U0061><U0072><U002E>";/
+ "<U006D><U0065><U0072><U002E>";/
+ "<U006A><U0065><U0075><U002E>";/
+ "<U0076><U0065><U006E><U002E>";/
+ "<U0073><U0061><U006D><U002E>"
day "<U0064><U0069><U006D><U0061><U006E><U0063><U0068><U0065>";/
"<U006C><U0075><U006E><U0064><U0069>";/
"<U006D><U0061><U0072><U0064><U0069>";/
@@ -103,12 +108,18 @@ day "<U0064><U0069><U006D><U0061><U006E><U0063><U0068><U0065>";/
"<U006A><U0065><U0075><U0064><U0069>";/
"<U0076><U0065><U006E><U0064><U0072><U0065><U0064><U0069>";/
"<U0073><U0061><U006D><U0065><U0064><U0069>"
-abmon "<U006A><U0061><U006E>";"<U0066><U00E9><U0076>";/
- "<U006D><U0061><U0072>";"<U0061><U0076><U0072>";/
- "<U006D><U0061><U0069>";"<U006A><U0075><U006E>";/
- "<U006A><U0075><U0069>";"<U0061><U006F><U00FB>";/
- "<U0073><U0065><U0070>";"<U006F><U0063><U0074>";/
- "<U006E><U006F><U0076>";"<U0064><U00E9><U0063>"
+abmon "<U006A><U0061><U006E><U0076><U002E>";/
+ "<U0066><U00E9><U0076><U0072><U002E>";/
+ "<U006D><U0061><U0072><U0073>";/
+ "<U0061><U0076><U0072><U0069><U006C>";/
+ "<U006D><U0061><U0069>";/
+ "<U006A><U0075><U0069><U006E>";/
+ "<U006A><U0075><U0069><U006C><U002E>";/
+ "<U0061><U006F><U00FB><U0074>";/
+ "<U0073><U0065><U0070><U0074><U002E>";/
+ "<U006F><U0063><U0074><U002E>";/
+ "<U006E><U006F><U0076><U002E>";/
+ "<U0064><U00E9><U0063><U002E>"
mon "<U006A><U0061><U006E><U0076><U0069><U0065><U0072>";/
"<U0066><U00E9><U0076><U0072><U0069><U0065><U0072>";/
"<U006D><U0061><U0072><U0073>";/
@@ -122,7 +133,7 @@ mon "<U006A><U0061><U006E><U0076><U0069><U0065><U0072>";/
"<U006E><U006F><U0076><U0065><U006D><U0062><U0072><U0065>";/
"<U0064><U00E9><U0063><U0065><U006D><U0062><U0072><U0065>"
d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
-d_fmt "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
+d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0059>"
t_fmt "<U0025><U0054>"
am_pm "";""
t_fmt_ampm ""
diff --git a/localedata/tst-langinfo.sh b/localedata/tst-langinfo.sh
index 375352d339..b169adedb1 100755
--- a/localedata/tst-langinfo.sh
+++ b/localedata/tst-langinfo.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# Test nl_langinfo.
-# Copyright (C) 2000, 2001, 2003, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2007, 2008 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
#
@@ -245,13 +245,13 @@ de_DE.UTF-8 RADIXCHAR ,
de_DE.UTF-8 THOUSEP .
de_DE.UTF-8 YESEXPR ^[jJyY].*
de_DE.UTF-8 NOEXPR ^[nN].*
-fr_FR.ISO-8859-1 ABDAY_1 dim
-fr_FR.ISO-8859-1 ABDAY_2 lun
-fr_FR.ISO-8859-1 ABDAY_3 mar
-fr_FR.ISO-8859-1 ABDAY_4 mer
-fr_FR.ISO-8859-1 ABDAY_5 jeu
-fr_FR.ISO-8859-1 ABDAY_6 ven
-fr_FR.ISO-8859-1 ABDAY_7 sam
+fr_FR.ISO-8859-1 ABDAY_1 dim.
+fr_FR.ISO-8859-1 ABDAY_2 lun.
+fr_FR.ISO-8859-1 ABDAY_3 mar.
+fr_FR.ISO-8859-1 ABDAY_4 mer.
+fr_FR.ISO-8859-1 ABDAY_5 jeu.
+fr_FR.ISO-8859-1 ABDAY_6 ven.
+fr_FR.ISO-8859-1 ABDAY_7 sam.
fr_FR.ISO-8859-1 DAY_1 dimanche
fr_FR.ISO-8859-1 DAY_2 lundi
fr_FR.ISO-8859-1 DAY_3 mardi
@@ -259,18 +259,18 @@ fr_FR.ISO-8859-1 DAY_4 mercredi
fr_FR.ISO-8859-1 DAY_5 jeudi
fr_FR.ISO-8859-1 DAY_6 vendredi
fr_FR.ISO-8859-1 DAY_7 samedi
-fr_FR.ISO-8859-1 ABMON_1 jan
-fr_FR.ISO-8859-1 ABMON_2 fév
-fr_FR.ISO-8859-1 ABMON_3 mar
-fr_FR.ISO-8859-1 ABMON_4 avr
+fr_FR.ISO-8859-1 ABMON_1 janv.
+fr_FR.ISO-8859-1 ABMON_2 févr.
+fr_FR.ISO-8859-1 ABMON_3 mars
+fr_FR.ISO-8859-1 ABMON_4 avril
fr_FR.ISO-8859-1 ABMON_5 mai
-fr_FR.ISO-8859-1 ABMON_6 jun
-fr_FR.ISO-8859-1 ABMON_7 jui
-fr_FR.ISO-8859-1 ABMON_8 aoû
-fr_FR.ISO-8859-1 ABMON_9 sep
-fr_FR.ISO-8859-1 ABMON_10 oct
-fr_FR.ISO-8859-1 ABMON_11 nov
-fr_FR.ISO-8859-1 ABMON_12 déc
+fr_FR.ISO-8859-1 ABMON_6 juin
+fr_FR.ISO-8859-1 ABMON_7 juil.
+fr_FR.ISO-8859-1 ABMON_8 août
+fr_FR.ISO-8859-1 ABMON_9 sept.
+fr_FR.ISO-8859-1 ABMON_10 oct.
+fr_FR.ISO-8859-1 ABMON_11 nov.
+fr_FR.ISO-8859-1 ABMON_12 déc.
fr_FR.ISO-8859-1 MON_1 janvier
fr_FR.ISO-8859-1 MON_2 février
fr_FR.ISO-8859-1 MON_3 mars
@@ -284,7 +284,7 @@ fr_FR.ISO-8859-1 MON_10 octobre
fr_FR.ISO-8859-1 MON_11 novembre
fr_FR.ISO-8859-1 MON_12 décembre
fr_FR.ISO-8859-1 D_T_FMT "%a %d %b %Y %T %Z"
-fr_FR.ISO-8859-1 D_FMT "%d.%m.%Y"
+fr_FR.ISO-8859-1 D_FMT "%d/%m/%Y"
fr_FR.ISO-8859-1 T_FMT "%T"
fr_FR.ISO-8859-1 RADIXCHAR ,
fr_FR.ISO-8859-1 THOUSEP " "
diff --git a/login/utmp_file.c b/login/utmp_file.c
index a1c6a25716..c0bd229952 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>
and Paul Janzen <pcj@primenet.com>, 1996.
@@ -167,10 +167,11 @@ setutent_file (void)
# ifdef O_CLOEXEC
if (__have_o_cloexec == 0)
__have_o_cloexec = (result & FD_CLOEXEC) ? 1 : -1;
-# endif
- result = fcntl_not_cancel (file_fd, F_SETFD,
- result | FD_CLOEXEC);
+ if (__have_o_cloexec < 0)
+# endif
+ result = fcntl_not_cancel (file_fd, F_SETFD,
+ result | FD_CLOEXEC);
}
if (result == -1)
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 139ebc8153..fafa52e916 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -1,5 +1,5 @@
/* More debugging hooks for `malloc'.
- Copyright (C) 1991-1994,1996-2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1991-1994,1996-2004, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written April 2, 1991 by John Gilmore of Cygnus Support.
Based on mcheck.c by Mike Haertel.
@@ -34,25 +34,13 @@
#include <stdio-common/_itoa.h>
-#ifdef _LIBC
-# include <libc-internal.h>
-
-# include <libio/iolibio.h>
-# define setvbuf(s, b, f, l) INTUSE(_IO_setvbuf) (s, b, f, l)
-# define fwrite(buf, size, count, fp) _IO_fwrite (buf, size, count, fp)
-extern __typeof (malloc) __libc_malloc;
-extern __typeof (free) __libc_free;
-extern __typeof (realloc) __libc_realloc;
-libc_hidden_proto (__libc_malloc)
-libc_hidden_proto (__libc_realloc)
-libc_hidden_proto (__libc_free)
-libc_hidden_proto (__libc_memalign)
-#else
-# define __libc_malloc(sz) malloc (sz)
-# define __libc_free(ptr) free (ptr)
-# define __libc_realloc(ptr, sz) realloc (ptr, sz)
-# define __libc_memalign(al, sz) memalign (al, sz)
-#endif
+#include <libc-internal.h>
+
+#include <libio/iolibio.h>
+#define setvbuf(s, b, f, l) INTUSE(_IO_setvbuf) (s, b, f, l)
+#define fwrite(buf, size, count, fp) _IO_fwrite (buf, size, count, fp)
+
+#include <kernel-features.h>
#ifndef attribute_hidden
# define attribute_hidden
@@ -166,7 +154,7 @@ tr_freehook (ptr, caller)
if (tr_old_free_hook != NULL)
(*tr_old_free_hook) (ptr, caller);
else
- __libc_free (ptr);
+ free (ptr);
__free_hook = tr_freehook;
__libc_lock_unlock (lock);
}
@@ -185,7 +173,7 @@ tr_mallochook (size, caller)
if (tr_old_malloc_hook != NULL)
hdr = (__ptr_t) (*tr_old_malloc_hook) (size, caller);
else
- hdr = (__ptr_t) __libc_malloc (size);
+ hdr = (__ptr_t) malloc (size);
__malloc_hook = tr_mallochook;
tr_where (caller);
@@ -221,7 +209,7 @@ tr_reallochook (ptr, size, caller)
if (tr_old_realloc_hook != NULL)
hdr = (__ptr_t) (*tr_old_realloc_hook) (ptr, size, caller);
else
- hdr = (__ptr_t) __libc_realloc (ptr, size);
+ hdr = (__ptr_t) realloc (ptr, size);
__free_hook = tr_freehook;
__malloc_hook = tr_mallochook;
__realloc_hook = tr_reallochook;
@@ -263,7 +251,7 @@ tr_memalignhook (alignment, size, caller)
if (tr_old_memalign_hook != NULL)
hdr = (__ptr_t) (*tr_old_memalign_hook) (alignment, size, caller);
else
- hdr = (__ptr_t) __libc_memalign (alignment, size);
+ hdr = (__ptr_t) memalign (alignment, size);
__memalign_hook = tr_memalignhook;
__malloc_hook = tr_mallochook;
@@ -327,9 +315,10 @@ mtrace ()
if (mtb == NULL)
return;
- mallstream = fopen (mallfile != NULL ? mallfile : "/dev/null", "wc");
+ mallstream = fopen (mallfile != NULL ? mallfile : "/dev/null", "wce");
if (mallstream != NULL)
{
+#ifndef __ASSUME_O_CLOEXEC
/* Make sure we close the file descriptor on exec. */
int flags = __fcntl (fileno (mallstream), F_GETFD, 0);
if (flags >= 0)
@@ -337,6 +326,7 @@ mtrace ()
flags |= FD_CLOEXEC;
__fcntl (fileno (mallstream), F_SETFD, flags);
}
+#endif
/* Be sure it doesn't malloc its buffer! */
malloc_trace_buffer = mtb;
setvbuf (mallstream, malloc_trace_buffer, _IOFBF, TRACE_BUFFER_SIZE);
diff --git a/misc/syslog.c b/misc/syslog.c
index 5781b4a964..baa180bb7b 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -348,10 +348,35 @@ openlog_internal(const char *ident, int logstat, int logfac)
(void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
sizeof(SyslogAddr.sun_path));
if (LogStat & LOG_NDELAY) {
- if ((LogFile = __socket(AF_UNIX, LogType, 0))
- == -1)
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0) {
+# endif
+ LogFile = __socket(AF_UNIX,
+ LogType
+ | SOCK_CLOEXEC, 0);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec
+ = (LogFile != -1
+ || errno != EINVAL);
+#endif
+ }
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ LogFile = __socket(AF_UNIX, LogType, 0);
+#endif
+ if (LogFile == -1)
return;
- (void)__fcntl(LogFile, F_SETFD, 1);
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ __fcntl(LogFile, F_SETFD, FD_CLOEXEC);
+#endif
}
}
if (LogFile != -1 && !connected)
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 7d0091bd26..aaf4eb6e59 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006
+/* Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -28,6 +28,7 @@
#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
#include <rpcsvc/ypupd.h>
+#include <sys/socket.h>
#include <sys/uio.h>
#include <bits/libc-lock.h>
@@ -69,14 +70,24 @@ yp_bind_client_create (const char *domain, dom_binding *ysd,
ysd->dom_domain[YPMAXDOMAIN] = '\0';
ysd->dom_socket = RPC_ANYSOCK;
- ysd->dom_client = clntudp_create (&ysd->dom_server_addr, YPPROG, YPVERS,
- UDPTIMEOUT, &ysd->dom_socket);
+#ifdef SOCK_CLOEXEC
+# define xflags SOCK_CLOEXEC
+#else
+# define xflags 0
+#endif
+ ysd->dom_client = __libc_clntudp_bufcreate (&ysd->dom_server_addr, YPPROG,
+ YPVERS, UDPTIMEOUT,
+ &ysd->dom_socket,
+ UDPMSGSIZE, UDPMSGSIZE,
+ xflags);
if (ysd->dom_client != NULL)
{
+#ifndef SOCK_CLOEXEC
/* If the program exits, close the socket */
if (fcntl (ysd->dom_socket, F_SETFD, FD_CLOEXEC) == -1)
perror ("fcntl: F_SETFD");
+#endif
}
}
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index f74463b6f1..c21ff3f7d9 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,20 @@
+2008-04-28 Hiroki Kaminaga <kaminaga@sm.sony.co.jp>
+
+ [BZ #6740]
+ * sysdeps/powerpc/tcb-offsets.sym (PRIVATE_FUTEX_OFFSET): Guard symbol
+ definition with #ifndef __ASSUME_PRIVATE_FUTEX.
+
+2008-07-25 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/mq_notify.c (init_mq_netlink): Use
+ SOCK_CLOEXEC if possible.
+
+2008-05-29 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile (tests): Add tst-rwlock2a.
+ * tst-rwlock2.c: Use TYPE macro to decide what rwlock type to use.
+ * tst-rwlock2a.c: New file.
+
2008-06-12 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/pthread.h: Remove inadvertant checkin.
@@ -76,7 +93,7 @@
2008-03-27 Ulrich Drepper <drepper@redhat.com>
- * sysdeps/unix/sysv/linux/bits/local_lim.h: Undefined ARG_MAX if
+ * sysdeps/unix/sysv/linux/bits/local_lim.h: Undefine ARG_MAX if
<linux/limits.h> has defined it.
* sysdeps/unix/sysv/linux/alpha/bits/local_lim.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/local_lim.h: Likewise.
diff --git a/nptl/sysdeps/powerpc/tcb-offsets.sym b/nptl/sysdeps/powerpc/tcb-offsets.sym
index eda43dce8e..8ac133dfd0 100644
--- a/nptl/sysdeps/powerpc/tcb-offsets.sym
+++ b/nptl/sysdeps/powerpc/tcb-offsets.sym
@@ -15,4 +15,6 @@ MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
PID thread_offsetof (pid)
TID thread_offsetof (tid)
POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t))
+#ifndef __ASSUME_PRIVATE_FUTEX
PRIVATE_FUTEX_OFFSET thread_offsetof (header.private_futex)
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/mq_notify.c b/nptl/sysdeps/unix/sysv/linux/mq_notify.c
index 2ec11bf686..49ddeae052 100644
--- a/nptl/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/nptl/sysdeps/unix/sysv/linux/mq_notify.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contribute by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <sys/socket.h>
#include <not-cancel.h>
+#include <kernel-features.h>
#ifdef __NR_mq_notify
@@ -152,18 +153,40 @@ reset_once (void)
static void
init_mq_netlink (void)
{
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ static int have_sock_cloexec;
+# else
+# define have_sock_cloexec 1
+# endif
+#else
+# define have_sock_cloexec -1
+# define SOCK_CLOEXEC 0
+#endif
+
/* This code might be called a second time after fork(). The file
descriptor is inherited from the parent. */
if (netlink_socket == -1)
{
/* Just a normal netlink socket, not bound. */
- netlink_socket = socket (AF_NETLINK, SOCK_RAW, 0);
+ if (have_sock_cloexec >= 0)
+ {
+ netlink_socket = socket (AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, 0);
+#if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec == 0)
+ have_sock_cloexec = (netlink_socket != -1 || errno != EINVAL
+ ? 1 : -1);
+#endif
+ }
+ if (have_sock_cloexec < 0)
+ netlink_socket = socket (AF_NETLINK, SOCK_RAW, 0);
/* No need to do more if we have no socket. */
if (netlink_socket == -1)
return;
/* Make sure the descriptor is closed on exec. */
- if (fcntl (netlink_socket, F_SETFD, FD_CLOEXEC) != 0)
+ if (have_sock_cloexec < 0
+ && fcntl (netlink_socket, F_SETFD, FD_CLOEXEC) != 0)
goto errout;
}
diff --git a/nscd/Makefile b/nscd/Makefile
index 51badea201..364ddfe8dd 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -90,7 +90,7 @@ CFLAGS-nscd_initgroups.c = -fexceptions
nscd-cflags = -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2
ifeq (yesyes,$(have-fpie)$(build-shared))
-nscd-cflags += -fpie
+nscd-cflags += $(pie-ccflag)
endif
ifeq (yes,$(have-ssp))
nscd-cflags += -fstack-protector
diff --git a/nscd/connections.c b/nscd/connections.c
index e4d32b27de..a1b92f466b 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -234,6 +234,14 @@ static int inotify_fd = -1;
static int resolv_conf_descr = -1;
#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+/* Negative if SOCK_CLOEXEC is not supported, positive if it is, zero
+ before be know the result. */
+static int have_sock_cloexec;
+/* The paccept syscall was introduced at the same time as SOCK_CLOEXEC. */
+# define have_paccept have_sock_cloexec
+#endif
+
/* Number of times clients had to wait. */
unsigned long int client_queued;
@@ -517,9 +525,15 @@ nscd_init (void)
#ifdef HAVE_INOTIFY
/* Use inotify to recognize changed files. */
- inotify_fd = inotify_init ();
- if (inotify_fd != -1)
- fcntl (inotify_fd, F_SETFL, O_NONBLOCK);
+ inotify_fd = inotify_init1 (IN_NONBLOCK);
+# ifndef __ASSUME_IN_NONBLOCK
+ if (inotify_fd == -1 && errno == ENOSYS)
+ {
+ inotify_fd = inotify_init ();
+ if (inotify_fd != -1)
+ fcntl (inotify_fd, F_SETFL, O_RDONLY | O_NONBLOCK);
+ }
+# endif
#endif
for (size_t cnt = 0; cnt < lastdb; ++cnt)
@@ -860,7 +874,21 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
}
/* Create the socket. */
- sock = socket (AF_UNIX, SOCK_STREAM, 0);
+#ifndef __ASSUME_SOCK_CLOEXEC
+ sock = -1;
+ if (have_sock_cloexec >= 0)
+#endif
+ {
+ sock = socket (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
+#ifdef __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec == 0)
+ have_sock_cloexec = sock != -1 || errno != EINVAL ? 1 : -1;
+#endif
+ }
+#ifndef __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec < 0)
+ sock = socket (AF_UNIX, SOCK_STREAM, 0);
+#endif
if (sock < 0)
{
dbg_log (_("cannot open socket: %s"), strerror (errno));
@@ -876,22 +904,27 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
exit (errno == EACCES ? 4 : 1);
}
- /* We don't want to get stuck on accept. */
- int fl = fcntl (sock, F_GETFL);
- if (fl == -1 || fcntl (sock, F_SETFL, fl | O_NONBLOCK) == -1)
+#ifndef __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec < 0)
{
- dbg_log (_("cannot change socket to nonblocking mode: %s"),
- strerror (errno));
- exit (1);
- }
+ /* We don't want to get stuck on accept. */
+ int fl = fcntl (sock, F_GETFL);
+ if (fl == -1 || fcntl (sock, F_SETFL, fl | O_NONBLOCK) == -1)
+ {
+ dbg_log (_("cannot change socket to nonblocking mode: %s"),
+ strerror (errno));
+ exit (1);
+ }
- /* The descriptor needs to be closed on exec. */
- if (paranoia && fcntl (sock, F_SETFD, FD_CLOEXEC) == -1)
- {
- dbg_log (_("cannot set socket to close on exec: %s"),
- strerror (errno));
- exit (1);
+ /* The descriptor needs to be closed on exec. */
+ if (paranoia && fcntl (sock, F_SETFD, FD_CLOEXEC) == -1)
+ {
+ dbg_log (_("cannot set socket to close on exec: %s"),
+ strerror (errno));
+ exit (1);
+ }
}
+#endif
/* Set permissions for the socket. */
chmod (_PATH_NSCDSOCKET, DEFFILEMODE);
@@ -1576,10 +1609,15 @@ nscd_run_worker (void *p)
/* We are done with the list. */
pthread_mutex_unlock (&readylist_lock);
- /* We do not want to block on a short read or so. */
- int fl = fcntl (fd, F_GETFL);
- if (fl == -1 || fcntl (fd, F_SETFL, fl | O_NONBLOCK) == -1)
- goto close_and_out;
+#ifndef __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec < 0)
+ {
+ /* We do not want to block on a short read or so. */
+ int fl = fcntl (fd, F_GETFL);
+ if (fl == -1 || fcntl (fd, F_SETFL, fl | O_NONBLOCK) == -1)
+ goto close_and_out;
+ }
+#endif
/* Now read the request. */
request_header req;
@@ -1779,7 +1817,24 @@ main_loop_poll (void)
if (conns[0].revents != 0)
{
/* We have a new incoming connection. Accept the connection. */
- int fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL));
+ int fd;
+
+#ifndef __ASSUME_PACCEPT
+ fd = -1;
+ if (have_paccept >= 0)
+#endif
+ {
+ fd = TEMP_FAILURE_RETRY (paccept (sock, NULL, NULL, NULL,
+ SOCK_NONBLOCK));
+#ifndef __ASSUME_PACCEPT
+ if (have_paccept == 0)
+ have_paccept = fd != -1 || errno != ENOSYS ? 1 : -1;
+#endif
+ }
+#ifndef __ASSUME_PACCEPT
+ if (have_paccept < 0)
+ fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL));
+#endif
/* Use the descriptor if we have not reached the limit. */
if (fd >= 0)
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 9828a46df0..7db5d09845 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -33,6 +33,7 @@
#include <sys/un.h>
#include <not-cancel.h>
#include <nis/rpcsvc/nis.h>
+#include <kernel-features.h>
#include "nscd-client.h"
@@ -161,7 +162,26 @@ __readvall (int fd, const struct iovec *iov, int iovcnt)
static int
open_socket (request_type type, const char *key, size_t keylen)
{
- int sock = __socket (PF_UNIX, SOCK_STREAM, 0);
+ int sock;
+
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0)
+# endif
+ {
+ sock = __socket (PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec = sock != -1 || errno != EINVAL ? 1 : -1;
+# endif
+ }
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ sock = __socket (PF_UNIX, SOCK_STREAM, 0);
+#endif
if (sock < 0)
return -1;
@@ -172,8 +192,13 @@ open_socket (request_type type, const char *key, size_t keylen)
} reqdata;
size_t real_sizeof_reqdata = sizeof (request_header) + keylen;
- /* Make socket non-blocking. */
- __fcntl (sock, F_SETFL, O_RDWR | O_NONBLOCK);
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_NONBLOCK
+ if (__have_sock_cloexec < 0)
+# endif
+ /* Make socket non-blocking. */
+ __fcntl (sock, F_SETFL, O_RDWR | O_NONBLOCK);
+#endif
struct sockaddr_un sun;
sun.sun_family = AF_UNIX;
diff --git a/posix/unistd.h b/posix/unistd.h
index 01ac3f8b41..96bb02dff4 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2006, 2007, 2008 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
@@ -383,6 +383,12 @@ extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n,
Returns 0 if successful, -1 if not. */
extern int pipe (int __pipedes[2]) __THROW __wur;
+#ifdef __USE_GNU
+/* Same as pipe but apply flags passed in FLAGS to the new file
+ descriptors. */
+extern int pipe2 (int __pipedes[2], int __flags) __THROW __wur;
+#endif
+
/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM.
If SECONDS is zero, any currently scheduled alarm will be cancelled.
The function returns the number of seconds remaining until the last
@@ -492,6 +498,12 @@ extern int dup (int __fd) __THROW __wur;
/* Duplicate FD to FD2, closing FD2 and making it open on the same file. */
extern int dup2 (int __fd, int __fd2) __THROW;
+#ifdef __USE_GNU
+/* Duplicate FD to FD2, closing FD2 and making it open on the same
+ file while setting flags according to FLAGS. */
+extern int dup3 (int __fd, int __fd2, int __flags) __THROW;
+#endif
+
/* NULL-terminated array of "NAME=VALUE" environment variables. */
extern char **__environ;
#ifdef __USE_GNU
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 765d14d81f..058a7cfbe8 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1,5 +1,5 @@
/* POSIX.2 wordexp implementation.
- Copyright (C) 1997-2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997-2003, 2005, 2006, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
@@ -42,6 +42,7 @@
# include <wchar.h>
#endif
#include <wordexp.h>
+#include <kernel-features.h>
#include <bits/libc-lock.h>
#include <stdio-common/_itoa.h>
@@ -824,17 +825,30 @@ exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
args[1] = "-nc";
/* Redirect output. */
- __dup2 (fildes[1], STDOUT_FILENO);
- __close (fildes[1]);
+ if (__builtin_expect (fildes[1] != STDOUT_FILENO, 1))
+ {
+ __dup2 (fildes[1], STDOUT_FILENO);
+ __close (fildes[1]);
+ }
+ else
+ {
+#ifdef O_CLOEXEC
+ /* Reset the close-on-exec flag (if necessary). */
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 > 0)
+# endif
+ __fcntl (fildes[1], F_SETFD, 0);
+#endif
+ }
/* Redirect stderr to /dev/null if we have to. */
if (showerr == 0)
{
struct stat64 st;
int fd;
- __close (2);
+ __close (STDERR_FILENO);
fd = __open (_PATH_DEVNULL, O_WRONLY);
- if (fd >= 0 && fd != 2)
+ if (fd >= 0 && fd != STDERR_FILENO)
{
__dup2 (fd, STDERR_FILENO);
__close (fd);
@@ -885,18 +899,38 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
if (!comm || !*comm)
return 0;
- if (__pipe (fildes))
- /* Bad */
- return WRDE_NOSPACE;
+#ifdef O_CLOEXEC
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 >= 0)
+# endif
+ {
+ int r = __pipe2 (fildes, O_CLOEXEC);
+# ifndef __ASSUME_PIPE2
+ if (__have_pipe2 == 0)
+ __have_pipe2 = r != -1 || errno != ENOSYS ? 1 : -1;
+
+ if (__have_pipe2 > 0)
+# endif
+ if (r < 0)
+ /* Bad */
+ return WRDE_NOSPACE;
+ }
+#endif
+#ifndef __ASSUME_PIPE2
+# ifdef O_CLOEXEC
+ if (__have_pipe2 < 0)
+# endif
+ if (__pipe (fildes) < 0)
+ /* Bad */
+ return WRDE_NOSPACE;
+#endif
again:
if ((pid = __fork ()) < 0)
{
/* Bad */
- if (fildes[0] != -1)
- __close (fildes[0]);
- if (fildes[1] != -1)
- __close (fildes[1]);
+ __close (fildes[0]);
+ __close (fildes[1]);
return WRDE_NOSPACE;
}
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 2a9bd0b3c2..5cf660a8d4 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -621,7 +621,7 @@ gethostbyname2(name, af)
buf.buf = origbuf = (querybuf *) alloca (1024);
if ((n = __libc_res_nsearch(&_res, name, C_IN, type, buf.buf->buf, 1024,
- &buf.ptr, NULL, NULL)) < 0) {
+ &buf.ptr, NULL, NULL, NULL)) < 0) {
if (buf.buf != origbuf)
free (buf.buf);
Dprintf("res_nsearch failed (%d)\n", n);
@@ -716,12 +716,12 @@ gethostbyaddr(addr, len, af)
buf.buf = orig_buf = (querybuf *) alloca (1024);
n = __libc_res_nquery(&_res, qbuf, C_IN, T_PTR, buf.buf->buf, 1024,
- &buf.ptr, NULL, NULL);
+ &buf.ptr, NULL, NULL, NULL);
if (n < 0 && af == AF_INET6 && (_res.options & RES_NOIP6DOTINT) == 0) {
strcpy(qp, "ip6.int");
n = __libc_res_nquery(&_res, qbuf, C_IN, T_PTR, buf.buf->buf,
buf.buf != orig_buf ? MAXPACKET : 1024,
- &buf.ptr, NULL, NULL);
+ &buf.ptr, NULL, NULL, NULL);
}
if (n < 0) {
if (buf.buf != orig_buf)
diff --git a/resolv/nss_dns/dns-canon.c b/resolv/nss_dns/dns-canon.c
index 47949b862f..cee3d57bc1 100644
--- a/resolv/nss_dns/dns-canon.c
+++ b/resolv/nss_dns/dns-canon.c
@@ -61,7 +61,8 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen,
for (int i = 0; i < nqtypes; ++i)
{
int r = __libc_res_nquery (&_res, name, ns_c_in, qtypes[i],
- buf, sizeof (buf), &ansp.ptr, NULL, NULL);
+ buf, sizeof (buf), &ansp.ptr, NULL, NULL,
+ NULL);
if (r > 0)
{
/* We need to decode the response. Just one question record.
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index cae077445f..80c0bd9fa8 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -195,7 +195,7 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
host_buffer.buf = orig_host_buffer = (querybuf *) alloca (1024);
n = __libc_res_nsearch (&_res, name, C_IN, type, host_buffer.buf->buf,
- 1024, &host_buffer.ptr, NULL, NULL);
+ 1024, &host_buffer.ptr, NULL, NULL, NULL);
if (n < 0)
{
status = (errno == ECONNREFUSED
@@ -213,7 +213,7 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
n = __libc_res_nsearch (&_res, name, C_IN, T_A, host_buffer.buf->buf,
host_buffer.buf != orig_host_buffer
? MAXPACKET : 1024, &host_buffer.ptr,
- NULL, NULL);
+ NULL, NULL, NULL);
if (n < 0)
{
@@ -273,8 +273,6 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
if (__res_maybe_init (&_res, 0) == -1)
return NSS_STATUS_UNAVAIL;
- char tmp[NS_MAXDNAME];
-
/*
* if there aren't any dots, it could be a user-level alias.
* this is also done in res_query() since we are not the only
@@ -282,7 +280,8 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
*/
if (strchr (name, '.') == NULL)
{
- const char *cp = res_hostalias (&_res, name, tmp, sizeof (tmp));
+ char *tmp = alloca (NS_MAXDNAME);
+ const char *cp = res_hostalias (&_res, name, tmp, NS_MAXDNAME);
if (cp != NULL)
name = cp;
}
@@ -296,12 +295,13 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
host_buffer.buf = orig_host_buffer = (querybuf *) alloca (2048);
u_char *ans2p = NULL;
int nans2p = 0;
+ int resplen2 = 0;
int olderr = errno;
enum nss_status status;
int n = __libc_res_nsearch (&_res, name, C_IN, T_UNSPEC,
host_buffer.buf->buf, 2048, &host_buffer.ptr,
- &ans2p, &nans2p);
+ &ans2p, &nans2p, &resplen2);
if (n < 0)
{
status = (errno == ECONNREFUSED
@@ -319,7 +319,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
}
status = gaih_getanswer(host_buffer.buf, n, (const querybuf *) ans2p,
- nans2p, name, pat, buffer, buflen,
+ resplen2, name, pat, buffer, buflen,
errnop, herrnop, ttlp);
if (host_buffer.buf != orig_host_buffer)
@@ -417,7 +417,7 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
strcpy (qp, "].ip6.arpa");
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR,
host_buffer.buf->buf, 1024, &host_buffer.ptr,
- NULL, NULL);
+ NULL, NULL, NULL);
if (n >= 0)
goto got_it_already;
}
@@ -438,14 +438,14 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
}
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer.buf->buf,
- 1024, &host_buffer.ptr, NULL, NULL);
+ 1024, &host_buffer.ptr, NULL, NULL, NULL);
if (n < 0 && af == AF_INET6 && (_res.options & RES_NOIP6DOTINT) == 0)
{
strcpy (qp, "ip6.int");
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer.buf->buf,
host_buffer.buf != orig_host_buffer
? MAXPACKET : 1024, &host_buffer.ptr,
- NULL, NULL);
+ NULL, NULL, NULL);
}
if (n < 0)
{
@@ -685,12 +685,19 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
n = -1;
}
- if (n < 0 || (*name_ok) (bp) == 0)
+ if (__builtin_expect (n < 0 || (*name_ok) (bp) == 0, 0))
{
++had_error;
continue;
}
cp += n; /* name */
+
+ if (__builtin_expect (cp + 10 > end_of_message, 0))
+ {
+ ++had_error;
+ continue;
+ }
+
type = ns_get16 (cp);
cp += INT16SZ; /* type */
class = ns_get16 (cp);
@@ -699,7 +706,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
cp += INT32SZ; /* TTL */
n = ns_get16 (cp);
cp += INT16SZ; /* len */
- if (class != C_IN)
+ if (__builtin_expect (class != C_IN, 0))
{
/* XXX - debug? syslog? */
cp += n;
@@ -711,7 +718,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (ap >= &host_data->aliases[MAX_NR_ALIASES - 1])
continue;
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (n < 0 || (*name_ok) (tbuf) == 0)
+ if (__builtin_expect (n < 0 || (*name_ok) (tbuf) == 0, 0))
{
++had_error;
continue;
@@ -745,7 +752,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (qtype == T_PTR && type == T_CNAME)
{
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (n < 0 || res_dnok (tbuf) == 0)
+ if (__builtin_expect (n < 0 || res_dnok (tbuf) == 0, 0))
{
++had_error;
continue;
@@ -792,7 +799,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
switch (type)
{
case T_PTR:
- if (__strcasecmp (tname, bp) != 0)
+ if (__builtin_expect (__strcasecmp (tname, bp) != 0, 0))
{
syslog (LOG_NOTICE | LOG_AUTH, AskedForGot, qname, bp);
cp += n;
@@ -809,7 +816,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
n = -1;
}
- if (n < 0 || res_hnok (bp) == 0)
+ if (__builtin_expect (n < 0 || res_hnok (bp) == 0, 0))
{
++had_error;
break;
@@ -839,7 +846,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (have_to_map)
{
n = strlen (bp) + 1; /* for the \0 */
- if (n >= MAXHOSTNAMELEN)
+ if (__builtin_expect (n >= MAXHOSTNAMELEN, 0))
{
++had_error;
break;
@@ -957,7 +964,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
return NSS_STATUS_UNAVAIL;
}
- u_char packtmp[NS_MAXCDNAME];
+ u_char packtmp[NS_MAXCDNAME];
int n = __ns_name_unpack (answer->buf, end_of_message, cp,
packtmp, sizeof packtmp);
/* We unpack the name to check it for validity. But we do not need
@@ -1005,7 +1012,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
n = -1;
}
- if (n < 0 || res_hnok (buffer) == 0)
+ if (__builtin_expect (n < 0 || res_hnok (buffer) == 0, 0))
{
++had_error;
continue;
@@ -1018,6 +1025,13 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
}
cp += n; /* name */
+
+ if (__builtin_expect (cp + 10 > end_of_message, 0))
+ {
+ ++had_error;
+ continue;
+ }
+
int type = ns_get16 (cp);
cp += INT16SZ; /* type */
int class = ns_get16 (cp);
@@ -1037,7 +1051,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
{
char tbuf[MAXDNAME];
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
- if (n < 0 || res_hnok (tbuf) == 0)
+ if (__builtin_expect (n < 0 || res_hnok (tbuf) == 0, 0))
{
++had_error;
continue;
@@ -1130,6 +1144,12 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
}
(*pat)->family = type == T_A ? AF_INET : AF_INET6;
+ if (__builtin_expect ((type == T_A && n != INADDRSZ)
+ || (type == T_AAAA && n != IN6ADDRSZ), 0))
+ {
+ ++had_error;
+ continue;
+ }
memcpy ((*pat)->addr, cp, n);
cp += n;
(*pat)->scopeid = 0;
@@ -1172,14 +1192,15 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
errnop, h_errnop, ttlp,
&first);
if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
- || status == NSS_STATUS_TRYAGAIN)
+ || (status == NSS_STATUS_TRYAGAIN
+ && (errno != ERANGE || *h_errnop != NO_RECOVERY)))
&& answer2 != NULL && anslen2 > 0)
{
enum nss_status status2 = gaih_getanswer_slice(answer2, anslen2, qname,
&pat, &buffer, &buflen,
errnop, h_errnop, ttlp,
&first);
- if (status != NSS_STATUS_SUCCESS)
+ if (status != NSS_STATUS_SUCCESS && status2 != NSS_STATUS_NOTFOUND)
status = status2;
}
diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
index 40736fbe94..c9969e08dc 100644
--- a/resolv/nss_dns/dns-network.c
+++ b/resolv/nss_dns/dns-network.c
@@ -130,7 +130,7 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
anslen = __libc_res_nsearch (&_res, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
- 1024, &net_buffer.ptr, NULL, NULL);
+ 1024, &net_buffer.ptr, NULL, NULL, NULL);
if (anslen < 0)
{
/* Nothing found. */
@@ -206,7 +206,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
anslen = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
- 1024, &net_buffer.ptr, NULL, NULL);
+ 1024, &net_buffer.ptr, NULL, NULL, NULL);
if (anslen < 0)
{
/* Nothing found. */
diff --git a/resolv/res_query.c b/resolv/res_query.c
index b2b45acde7..7102ba948e 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -97,7 +97,8 @@ static const char rcsid[] = "$BINDId: res_query.c,v 8.20 2000/02/29 05:39:12 vix
static int
__libc_res_nquerydomain(res_state statp, const char *name, const char *domain,
int class, int type, u_char *answer, int anslen,
- u_char **answerp, u_char **answerp2, int *nanswerp2);
+ u_char **answerp, u_char **answerp2, int *nanswerp2,
+ int *resplen2);
/*
* Formulate a normal query, send, and await answer.
@@ -117,7 +118,8 @@ __libc_res_nquery(res_state statp,
int anslen, /* size of answer buffer */
u_char **answerp, /* if buffer needs to be enlarged */
u_char **answerp2,
- int *nanswerp2)
+ int *nanswerp2,
+ int *resplen2)
{
HEADER *hp = (HEADER *) answer;
int n, use_malloc = 0;
@@ -221,7 +223,7 @@ __libc_res_nquery(res_state statp,
}
assert (answerp == NULL || (void *) *answerp == (void *) answer);
n = __libc_res_nsend(statp, query1, nquery1, query2, nquery2, answer,
- anslen, answerp, answerp2, nanswerp2);
+ anslen, answerp, answerp2, nanswerp2, resplen2);
if (use_malloc)
free (buf);
if (n < 0) {
@@ -307,7 +309,7 @@ res_nquery(res_state statp,
int anslen) /* size of answer buffer */
{
return __libc_res_nquery(statp, name, class, type, answer, anslen,
- NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nquery)
@@ -325,7 +327,8 @@ __libc_res_nsearch(res_state statp,
int anslen, /* size of answer */
u_char **answerp,
u_char **answerp2,
- int *nanswerp2)
+ int *nanswerp2,
+ int *resplen2)
{
const char *cp, * const *domain;
HEADER *hp = (HEADER *) answer;
@@ -349,7 +352,7 @@ __libc_res_nsearch(res_state statp,
if (!dots && (cp = res_hostalias(statp, name, tmp, sizeof tmp))!= NULL)
return (__libc_res_nquery(statp, cp, class, type, answer,
anslen, answerp, answerp2,
- nanswerp2));
+ nanswerp2, resplen2));
#ifdef DEBUG
if (statp->options & RES_DEBUG)
@@ -366,7 +369,7 @@ __libc_res_nsearch(res_state statp,
if (dots >= statp->ndots || trailing_dot) {
ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
answer, anslen, answerp,
- answerp2, nanswerp2);
+ answerp2, nanswerp2, resplen2);
if (ret > 0 || trailing_dot)
return (ret);
saved_herrno = h_errno;
@@ -404,7 +407,8 @@ __libc_res_nsearch(res_state statp,
ret = __libc_res_nquerydomain(statp, name, *domain,
class, type,
answer, anslen, answerp,
- answerp2, nanswerp2);
+ answerp2, nanswerp2,
+ resplen2);
if (ret > 0)
return (ret);
@@ -473,7 +477,7 @@ __libc_res_nsearch(res_state statp,
if (dots && !(tried_as_is || root_on_list)) {
ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
answer, anslen, answerp,
- answerp2, nanswerp2);
+ answerp2, nanswerp2, resplen2);
if (ret > 0)
return (ret);
}
@@ -508,7 +512,7 @@ res_nsearch(res_state statp,
int anslen) /* size of answer */
{
return __libc_res_nsearch(statp, name, class, type, answer,
- anslen, NULL, NULL, NULL);
+ anslen, NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nsearch)
@@ -525,7 +529,8 @@ __libc_res_nquerydomain(res_state statp,
int anslen, /* size of answer */
u_char **answerp,
u_char **answerp2,
- int *nanswerp2)
+ int *nanswerp2,
+ int *resplen2)
{
char nbuf[MAXDNAME];
const char *longname = nbuf;
@@ -562,7 +567,8 @@ __libc_res_nquerydomain(res_state statp,
sprintf(nbuf, "%s.%s", name, domain);
}
return (__libc_res_nquery(statp, longname, class, type, answer,
- anslen, answerp, answerp2, nanswerp2));
+ anslen, answerp, answerp2, nanswerp2,
+ resplen2));
}
int
@@ -574,7 +580,7 @@ res_nquerydomain(res_state statp,
int anslen) /* size of answer */
{
return __libc_res_nquerydomain(statp, name, domain, class, type,
- answer, anslen, NULL, NULL, NULL);
+ answer, anslen, NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nquerydomain)
diff --git a/resolv/res_send.c b/resolv/res_send.c
index dec3ac7a3f..3130f64281 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -339,9 +339,9 @@ int
__libc_res_nsend(res_state statp, const u_char *buf, int buflen,
const u_char *buf2, int buflen2,
u_char *ans, int anssiz, u_char **ansp, u_char **ansp2,
- int *nansp2)
+ int *nansp2, int *resplen2)
{
- int gotsomewhere, terrno, try, v_circuit, resplen, resplen2, ns, n;
+ int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
if (statp->nscount == 0) {
__set_errno (ESRCH);
@@ -539,7 +539,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
try = statp->retry;
n = send_vc(statp, buf, buflen, buf2, buflen2,
&ans, &anssiz, &terrno,
- ns, ansp, ansp2, nansp2, &resplen2);
+ ns, ansp, ansp2, nansp2, resplen2);
if (n < 0)
return (-1);
if (n == 0)
@@ -549,14 +549,14 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
n = send_dg(statp, buf, buflen, buf2, buflen2,
&ans, &anssiz, &terrno,
ns, &v_circuit, &gotsomewhere, ansp,
- ansp2, nansp2, &resplen2);
+ ansp2, nansp2, resplen2);
if (n < 0)
return (-1);
if (n == 0)
goto next_ns;
if (v_circuit)
// XXX Check whether both requests failed or
- // XXX whether one have been answered successfully
+ // XXX whether one has been answered successfully
goto same_ns;
}
@@ -575,7 +575,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
DprintQ((statp->options & RES_DEBUG) ||
(statp->pfcode & RES_PRF_REPLY),
(stdout, "%s", ""),
- *ansp2, (resplen2 > *nansp2) ? *nansp2 : resplen2);
+ *ansp2, (*resplen2 > *nansp2) ? *nansp2 : *resplen2);
/*
* If we have temporarily opened a virtual circuit,
@@ -638,7 +638,7 @@ res_nsend(res_state statp,
const u_char *buf, int buflen, u_char *ans, int anssiz)
{
return __libc_res_nsend(statp, buf, buflen, NULL, 0, ans, anssiz,
- NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nsend)
@@ -665,6 +665,8 @@ send_vc(res_state statp,
u_short len2;
u_char *cp;
+ if (resplen2 != NULL)
+ *resplen2 = 0;
connreset = 0;
same_ns:
truncating = 0;
@@ -734,8 +736,9 @@ send_vc(res_state statp,
int recvresp2 = buf2 == NULL;
read_len:
cp = ans;
- len = INT16SZ;
- while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, (char *)cp,
+ uint16_t rlen16;
+ len = sizeof(rlen16);
+ while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, &rlen16,
(int)len))) > 0) {
cp += n;
if ((len -= n) <= 0)
@@ -760,11 +763,7 @@ send_vc(res_state statp,
}
return (0);
}
-#ifdef _STRING_ARCH_unaligned
- resplen = ntohs (*(uint16_t *) ans);
-#else
- resplen = ns_get16(ans);
-#endif
+ int rlen = ntohs (rlen16);
int *thisanssizp;
u_char **thisansp;
@@ -795,11 +794,11 @@ send_vc(res_state statp,
}
anhp = (HEADER *) *thisansp;
- *thisresplenp = resplen;
- if (resplen > *thisanssizp) {
+ *thisresplenp = rlen;
+ if (rlen > *thisanssizp) {
/* Yes, we test ANSCP here. If we have two buffers
both will be allocatable. */
- if (anscp) {
+ if (__builtin_expect (anscp != NULL, 1)) {
u_char *newp = malloc (MAXPACKET);
if (newp == NULL) {
*terrno = ENOMEM;
@@ -809,7 +808,7 @@ send_vc(res_state statp,
*thisanssizp = MAXPACKET;
*thisansp = newp;
anhp = (HEADER *) newp;
- len = resplen;
+ len = rlen;
} else {
Dprint(statp->options & RES_DEBUG,
(stdout, ";; response truncated\n")
@@ -818,9 +817,9 @@ send_vc(res_state statp,
len = *thisanssizp;
}
} else
- len = resplen;
+ len = rlen;
- if (len < HFIXEDSZ) {
+ if (__builtin_expect (len < HFIXEDSZ, 0)) {
/*
* Undersized message.
*/
@@ -836,18 +835,18 @@ send_vc(res_state statp,
cp += n;
len -= n;
}
- if (n <= 0) {
+ if (__builtin_expect (n <= 0, 0)) {
*terrno = errno;
Perror(statp, stderr, "read(vc)", errno);
__res_iclose(statp, false);
return (0);
}
- if (truncating) {
+ if (__builtin_expect (truncating, 0)) {
/*
* Flush rest of answer so connection stays in synch.
*/
anhp->tc = 1;
- len = resplen - *thisanssizp;
+ len = rlen - *thisanssizp;
while (len != 0) {
char junk[PACKETSZ];
@@ -872,7 +871,7 @@ send_vc(res_state statp,
(statp->pfcode & RES_PRF_REPLY),
(stdout, ";; old answer (unexpected):\n"),
*thisansp,
- (resplen > *thisanssiz) ? *thisanssiz: resplen);
+ (rlen > *thisanssiz) ? *thisanssiz: rlen);
goto read_len;
}
@@ -889,7 +888,7 @@ send_vc(res_state statp,
* All is well, or the error is fatal. Signal that the
* next nameserver ought not be tried.
*/
- return (resplen);
+ return resplen;
}
static int
@@ -1084,7 +1083,7 @@ send_dg(res_state statp,
*thisresplenp = recvfrom(pfd[0].fd, (char*)*thisansp,
*thisanssizp, 0,
(struct sockaddr *)&from, &fromlen);
- if (*thisresplenp <= 0) {
+ if (__builtin_expect (*thisresplenp <= 0, 0)) {
if (errno == EINTR || errno == EAGAIN) {
need_recompute = 1;
goto wait;
@@ -1093,7 +1092,7 @@ send_dg(res_state statp,
goto err_out;
}
*gotsomewhere = 1;
- if (*thisresplenp < HFIXEDSZ) {
+ if (__builtin_expect (*thisresplenp < HFIXEDSZ, 0)) {
/*
* Undersized message.
*/
diff --git a/scripts/gen-as-const.awk b/scripts/gen-as-const.awk
index bc3c47fb73..23f2f2bc9b 100644
--- a/scripts/gen-as-const.awk
+++ b/scripts/gen-as-const.awk
@@ -14,12 +14,14 @@ BEGIN { started = 0 }
NF >= 1 && !started {
if (test) {
+ print "\n#include <inttypes.h>";
print "\n#include <stdio.h>";
+ print "\n#define U(n) UINT64_C (n)";
print "\nstatic int do_test (void)\n{\n int bad = 0, good = 0;\n";
print "#define TEST(name, source, expr) \\\n" \
- " if (asconst_##name != (expr)) { ++bad;" \
- " fprintf (stderr, \"%s: %s is %ld but %s is %ld\\n\"," \
- " source, #name, (long int) asconst_##name, #expr, (long int) (expr));" \
+ " if (U (asconst_##name) != (uint64_t) (expr)) { ++bad;" \
+ " fprintf (stderr, \"%s: %s is %\" PRId64 \" but %s is %\"PRId64 \"\\n\"," \
+ " source, #name, U (asconst_##name), #expr, (uint64_t) (expr));" \
" } else ++good;\n";
}
else
diff --git a/socket/Makefile b/socket/Makefile
index aa0776e5bf..e7fa589e65 100644
--- a/socket/Makefile
+++ b/socket/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,1995-2001,2005 Free Software Foundation, Inc.
+# Copyright (C) 1991,1995-2001,2005,2008 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,7 +27,9 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
routines := accept bind connect getpeername getsockname getsockopt \
listen recv recvfrom recvmsg send sendmsg sendto \
setsockopt shutdown socket socketpair isfdtype opensock \
- sockatmark
+ sockatmark paccept
+
+aux := have_sock_cloexec
distribute := ifreq.h
diff --git a/socket/Versions b/socket/Versions
index d282eff79e..9764227c36 100644
--- a/socket/Versions
+++ b/socket/Versions
@@ -31,4 +31,7 @@ libc {
# Addition from P1003.1-200x
sockatmark;
}
+ GLIBC_2.9 {
+ paccept;
+ }
}
diff --git a/socket/have_sock_cloexec.c b/socket/have_sock_cloexec.c
new file mode 100644
index 0000000000..22dccdf722
--- /dev/null
+++ b/socket/have_sock_cloexec.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2008 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 <sys/socket.h>
+#include <kernel-features.h>
+
+#if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+int __have_sock_cloexec;
+#endif
diff --git a/socket/paccept.c b/socket/paccept.c
new file mode 100644
index 0000000000..777dd8c300
--- /dev/null
+++ b/socket/paccept.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2008 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 <errno.h>
+#include <sys/socket.h>
+
+/* Await a connection on socket FD.
+ When a connection arrives, open a new socket to communicate with it,
+ set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
+ peer and *ADDR_LEN to the address's actual length, and return the
+ new socket's descriptor, or -1 for errors. SS is installed as
+ the thread's signal mask and FLAGS are additional flags. */
+int
+paccept (fd, addr, addr_len, ss, flags)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *addr_len;
+ const __sigset_t *ss;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (paccept)
+
+
+stub_warning (paccept)
+#include <stub-tag.h>
diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index 6d9eab7f94..ea4123d287 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -1,5 +1,5 @@
/* Declarations of socket constants, types, and functions.
- Copyright (C) 1991,92,1994-2001,2003,2005,2007
+ Copyright (C) 1991,92,1994-2001,2003,2005,2007,2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -28,6 +28,10 @@ __BEGIN_DECLS
#include <sys/uio.h>
#define __need_size_t
#include <stddef.h>
+#ifdef __USE_GNU
+/* Get the __sigset_t definition. */
+# include <bits/sigset.h>
+#endif
/* This operating system-specific header file defines the SOCK_*, PF_*,
@@ -210,6 +214,18 @@ extern int listen (int __fd, int __n) __THROW;
extern int accept (int __fd, __SOCKADDR_ARG __addr,
socklen_t *__restrict __addr_len);
+#ifdef __USE_GNU
+/* Variant of the accept function which takes additional parameters. The
+ MASK parameter allows to change the thread signal mask for the duration
+ of the call. The FLAGS parameter allows to pass additional flags.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int paccept (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len,
+ __const __sigset_t *__restrict __ss, int __flags);
+#endif
+
/* Shut down all or part of the connection open on socket FD.
HOW determines what to shut down:
SHUT_RD = No more receptions;
diff --git a/stdio-common/_i18n_number.h b/stdio-common/_i18n_number.h
index 04d6619b4c..8bb56190c6 100644
--- a/stdio-common/_i18n_number.h
+++ b/stdio-common/_i18n_number.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2004, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
@@ -24,7 +24,7 @@
#include "../locale/outdigitswc.h"
static CHAR_T *
-_i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr)
+_i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
{
#ifdef COMPILE_WPRINTF
# define decimal NULL
@@ -58,10 +58,23 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr)
#endif
/* Copy existing string so that nothing gets overwritten. */
- CHAR_T *src = (CHAR_T *) alloca ((rear_ptr - w) * sizeof (CHAR_T));
+ CHAR_T *src;
+ bool use_alloca = __libc_use_alloca ((rear_ptr - w) * sizeof (CHAR_T));
+ if (__builtin_expect (use_alloca, true))
+ src = (CHAR_T *) alloca ((rear_ptr - w) * sizeof (CHAR_T));
+ else
+ {
+ src = (CHAR_T *) malloc ((rear_ptr - w) * sizeof (CHAR_T));
+ if (src == NULL)
+ /* If we cannot allocate the memory don't rewrite the string.
+ It is better than nothing. */
+ return w;
+ }
+
CHAR_T *s = (CHAR_T *) __mempcpy (src, w,
(rear_ptr - w) * sizeof (CHAR_T));
- w = rear_ptr;
+
+ w = end;
/* Process all characters in the string. */
while (--s >= src)
@@ -91,5 +104,8 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr)
}
}
+ if (! use_alloca)
+ free (src);
+
return w;
}
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index c65cfa9faa..43c43c2039 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -1,5 +1,5 @@
/* Floating point output for `printf'.
- Copyright (C) 1995-2003, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@@ -1148,6 +1148,7 @@ ___printf_fp (FILE *fp,
{
char *buffer = NULL;
+ char *buffer_end = NULL;
char *cp = NULL;
char *tmpptr;
@@ -1157,6 +1158,9 @@ ___printf_fp (FILE *fp,
size_t decimal_len;
size_t thousands_sep_len;
wchar_t *copywc;
+ size_t factor = (info->i18n
+ ? _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX)
+ : 1);
decimal_len = strlen (decimal);
@@ -1165,10 +1169,11 @@ ___printf_fp (FILE *fp,
else
thousands_sep_len = strlen (thousands_sep);
+ size_t nbuffer = (2 + chars_needed * factor + decimal_len
+ + ngroups * thousands_sep_len);
if (__builtin_expect (buffer_malloced, 0))
{
- buffer = (char *) malloc (2 + chars_needed + decimal_len
- + ngroups * thousands_sep_len);
+ buffer = (char *) malloc (nbuffer);
if (buffer == NULL)
{
/* Signal an error to the caller. */
@@ -1177,8 +1182,8 @@ ___printf_fp (FILE *fp,
}
}
else
- buffer = (char *) alloca (2 + chars_needed + decimal_len
- + ngroups * thousands_sep_len);
+ buffer = (char *) alloca (nbuffer);
+ buffer_end = buffer + nbuffer;
/* Now copy the wide character string. Since the character
(except for the decimal point and thousands separator) must
@@ -1197,9 +1202,17 @@ ___printf_fp (FILE *fp,
if (__builtin_expect (info->i18n, 0))
{
#ifdef COMPILE_WPRINTF
- wstartp = _i18n_number_rewrite (wstartp, wcp);
+ wstartp = _i18n_number_rewrite (wstartp, wcp,
+ wbuffer + wbuffer_to_alloc);
+ wcp = wbuffer + wbuffer_to_alloc;
+ assert ((uintptr_t) wbuffer <= (uintptr_t) wstartp);
+ assert ((uintptr_t) wstartp
+ < (uintptr_t) wbuffer + wbuffer_to_alloc);
#else
- tmpptr = _i18n_number_rewrite (tmpptr, cp);
+ tmpptr = _i18n_number_rewrite (tmpptr, cp, buffer_end);
+ cp = buffer_end;
+ assert ((uintptr_t) buffer <= (uintptr_t) tmpptr);
+ assert ((uintptr_t) tmpptr < (uintptr_t) buffer_end);
#endif
}
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 714c76c3d4..5d5bb5e578 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -625,7 +625,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
thousands_sep); \
\
if (use_outdigits && base == 10) \
- string = _i18n_number_rewrite (string, workend); \
+ string = _i18n_number_rewrite (string, workend, workend); \
} \
/* Simplify further test for num != 0. */ \
number.word = number.longlong != 0; \
@@ -683,7 +683,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
thousands_sep); \
\
if (use_outdigits && base == 10) \
- string = _i18n_number_rewrite (string, workend); \
+ string = _i18n_number_rewrite (string, workend, workend); \
} \
} \
\
diff --git a/sunrpc/Versions b/sunrpc/Versions
index cddf188766..d2d8e81ac0 100644
--- a/sunrpc/Versions
+++ b/sunrpc/Versions
@@ -116,4 +116,7 @@ libc {
GLIBC_2.3.4 {
xdr_quad_t; xdr_u_quad_t;
}
+ GLIBC_PRIVATE {
+ __libc_clntudp_bufcreate;
+ }
}
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index 634313211d..548c987e69 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -54,12 +54,15 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
#ifdef USE_IN_LIBIO
# include <wchar.h>
#endif
+#include <fcntl.h>
#ifdef IP_RECVERR
#include <errqueue.h>
#include <sys/uio.h>
#endif
+#include <kernel-features.h>
+
extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *);
extern u_long _create_xid (void);
@@ -121,9 +124,9 @@ struct cu_data
* sent and received.
*/
CLIENT *
-clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
- struct timeval wait, int *sockp, u_int sendsz,
- u_int recvsz)
+__libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program,
+ u_long version, struct timeval wait, int *sockp,
+ u_int sendsz, u_int recvsz, int flags)
{
CLIENT *cl;
struct cu_data *cu = NULL;
@@ -178,8 +181,32 @@ clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
{
int dontblock = 1;
- *sockp = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- if (*sockp < 0)
+#ifdef SOCK_NONBLOCK
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0)
+# endif
+ {
+ *sockp = __socket (AF_INET, SOCK_DGRAM|SOCK_NONBLOCK|flags,
+ IPPROTO_UDP);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec = *sockp >= 0 || errno != EINVAL ? 1 : -1;
+# endif
+ }
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ {
+ *sockp = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+# ifdef SOCK_CLOEXEC
+ if (flags & SOCK_CLOEXEC)
+ __fcntl (*sockp, F_SETFD, FD_CLOEXEC);
+# endif
+ }
+#endif
+ if (__builtin_expect (*sockp < 0, 0))
{
struct rpc_createerr *ce = &get_rpc_createerr ();
ce->cf_stat = RPC_SYSTEMERROR;
@@ -188,8 +215,13 @@ clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
}
/* attempt to bind to prov port */
(void) bindresvport (*sockp, (struct sockaddr_in *) 0);
- /* the sockets rpc controls are non-blocking */
- (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock);
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ /* the sockets rpc controls are non-blocking */
+ (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock);
+#endif
#ifdef IP_RECVERR
{
int on = 1;
@@ -212,6 +244,16 @@ fooy:
mem_free ((caddr_t) cl, sizeof (CLIENT));
return (CLIENT *) NULL;
}
+INTDEF (__libc_clntudp_bufcreate)
+
+CLIENT *
+clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
+ struct timeval wait, int *sockp, u_int sendsz,
+ u_int recvsz)
+{
+ return INTUSE(__libc_clntudp_bufcreate) (raddr, program, version, wait,
+ sockp, sendsz, recvsz, 0);
+}
INTDEF (clntudp_bufcreate)
CLIENT *
@@ -222,8 +264,8 @@ clntudp_create (raddr, program, version, wait, sockp)
struct timeval wait;
int *sockp;
{
- return INTUSE(clntudp_bufcreate) (raddr, program, version, wait, sockp,
- UDPMSGSIZE, UDPMSGSIZE);
+ return INTUSE(__libc_clntudp_bufcreate) (raddr, program, version, wait,
+ sockp, UDPMSGSIZE, UDPMSGSIZE, 0);
}
INTDEF (clntudp_create)
diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c
index 611c37256c..319d8017e8 100644
--- a/sunrpc/key_call.c
+++ b/sunrpc/key_call.c
@@ -462,7 +462,7 @@ getkeyserv_handle (int vers)
clnt_control (kcp->client, CLSET_RETRY_TIMEOUT,
(char *)&wait_time);
if (clnt_control (kcp->client, CLGET_FD, (char *)&fd))
- __fcntl (fd, F_SETFD, 1); /* make it "close on exec" */
+ __fcntl (fd, F_SETFD, FD_CLOEXEC); /* make it "close on exec" */
return kcp->client;
}
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 9d1ebdf615..27c8fb620d 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -38,6 +38,7 @@
#include <bits/libc-lock.h>
#include <hp-timing.h>
#include <tls.h>
+#include <kernel-features.h>
__BEGIN_DECLS
@@ -592,8 +593,13 @@ struct rtld_global_ro
/* Names of shared object for which the RPATH should be ignored. */
EXTERN const char *_dl_inhibit_rpath;
+#ifndef __ASSUME_AT_EXECFN
/* Location of the binary. */
EXTERN const char *_dl_origin_path;
+#endif
+
+ /* If set, points to the file name of the executable. */
+ EXTERN const char *_dl_execfn;
/* -1 if the dynamic linker should honor library load bias,
0 if not, -2 use the default (honor biases for normal
diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S
index 4fa6adea98..24f6804b0c 100644
--- a/sysdeps/i386/i686/memcmp.S
+++ b/sysdeps/i386/i686/memcmp.S
@@ -29,8 +29,7 @@
#define ENTRANCE pushl %ebx; cfi_adjust_cfa_offset (4); \
cfi_rel_offset (ebx, 0); ENTER
#define RETURN popl %ebx; cfi_adjust_cfa_offset (-4); \
- cfi_restore (ebx); LEAVE; ret; \
- cfi_adjust_cfa_offset (4); cfi_rel_offset (ebx, 0);
+ cfi_restore (ebx); LEAVE; ret
/* Load an entry in a jump table into EBX. TABLE is a jump table
with relative offsets. INDEX is a register contains the index
@@ -71,6 +70,8 @@ L(bye):
xorl %eax, %eax
RETURN
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
L(neq):
sbbl %eax, %eax
sbbl $-1, %eax
diff --git a/sysdeps/sparc/Makefile b/sysdeps/sparc/Makefile
index 9fa5324b41..73b926554e 100644
--- a/sysdeps/sparc/Makefile
+++ b/sysdeps/sparc/Makefile
@@ -1,6 +1,8 @@
# The Sparc `long double' is a distinct type we support.
long-double-fcts = yes
+pie-ccflag = -fPIE
+
ifeq ($(subdir),gmon)
sysdep_routines += sparc-mcount
endif
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index 4c963abe58..04ed63c4d7 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -9,6 +9,7 @@ chroot - chroot i:s chroot
close - close Ci:i __libc_close __close close
dup - dup i:i __dup dup
dup2 - dup2 i:ii __dup2 dup2
+dup3 - dup3 i:iii dup3
fchdir - fchdir i:i __fchdir fchdir
fcntl - fcntl Ci:iiF __libc_fcntl __fcntl __fcntl_internal fcntl
fstatfs - fstatfs i:ip __fstatfs fstatfs
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index af4c293c26..5a76028c6c 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -135,6 +135,9 @@ libc {
GLIBC_2.8 {
timerfd_create; timerfd_settime; timerfd_gettime;
}
+ GLIBC_2.9 {
+ epoll_create2; inotify_init1;
+ }
GLIBC_PRIVATE {
# functions used in other libraries
__syscall_rt_sigqueueinfo;
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/epoll.h b/sysdeps/unix/sysv/linux/alpha/sys/epoll.h
new file mode 100644
index 0000000000..9f983a5156
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/sys/epoll.h
@@ -0,0 +1,143 @@
+/* Copyright (C) 2002-2006, 2007, 2008 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. */
+
+#ifndef _SYS_EPOLL_H
+#define _SYS_EPOLL_H 1
+
+#include <stdint.h>
+#include <sys/types.h>
+
+/* Get __sigset_t. */
+#include <bits/sigset.h>
+
+#ifndef __sigset_t_defined
+# define __sigset_t_defined
+typedef __sigset_t sigset_t;
+#endif
+
+
+/* Flags to be passed to epoll_create2. */
+enum
+ {
+ EPOLL_CLOEXEC = 010000000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+ EPOLL_NONBLOCK = 04
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+ };
+
+
+enum EPOLL_EVENTS
+ {
+ EPOLLIN = 0x001,
+#define EPOLLIN EPOLLIN
+ EPOLLPRI = 0x002,
+#define EPOLLPRI EPOLLPRI
+ EPOLLOUT = 0x004,
+#define EPOLLOUT EPOLLOUT
+ EPOLLRDNORM = 0x040,
+#define EPOLLRDNORM EPOLLRDNORM
+ EPOLLRDBAND = 0x080,
+#define EPOLLRDBAND EPOLLRDBAND
+ EPOLLWRNORM = 0x100,
+#define EPOLLWRNORM EPOLLWRNORM
+ EPOLLWRBAND = 0x200,
+#define EPOLLWRBAND EPOLLWRBAND
+ EPOLLMSG = 0x400,
+#define EPOLLMSG EPOLLMSG
+ EPOLLERR = 0x008,
+#define EPOLLERR EPOLLERR
+ EPOLLHUP = 0x010,
+#define EPOLLHUP EPOLLHUP
+ EPOLLRDHUP = 0x2000,
+#define EPOLLRDHUP EPOLLRDHUP
+ EPOLLONESHOT = (1 << 30),
+#define EPOLLONESHOT EPOLLONESHOT
+ EPOLLET = (1 << 31)
+#define EPOLLET EPOLLET
+ };
+
+
+/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
+#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */
+#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
+#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
+
+
+typedef union epoll_data
+{
+ void *ptr;
+ int fd;
+ uint32_t u32;
+ uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event
+{
+ uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+};
+
+
+__BEGIN_DECLS
+
+/* Creates an epoll instance. Returns an fd for the new instance.
+ The "size" parameter is a hint specifying the number of file
+ descriptors to be associated with the new instance. The fd
+ returned by epoll_create() should be closed with close(). */
+extern int epoll_create (int __size) __THROW;
+
+/* Same as epoll_create but with an additional FLAGS parameter. */
+extern int epoll_create2 (int __size, int __flags) __THROW;
+
+
+/* Manipulate an epoll instance "epfd". Returns 0 in case of success,
+ -1 in case of error ( the "errno" variable will contain the
+ specific error code ) The "op" parameter is one of the EPOLL_CTL_*
+ constants defined above. The "fd" parameter is the target of the
+ operation. The "event" parameter describes which events the caller
+ is interested in and any associated user data. */
+extern int epoll_ctl (int __epfd, int __op, int __fd,
+ struct epoll_event *__event) __THROW;
+
+
+/* Wait for events on an epoll instance "epfd". Returns the number of
+ triggered events returned in "events" buffer. Or -1 in case of
+ error with the "errno" variable set to the specific error code. The
+ "events" parameter is a buffer that will contain triggered
+ events. The "maxevents" is the maximum number of events to be
+ returned ( usually size of "events" ). The "timeout" parameter
+ specifies the maximum wait time in milliseconds (-1 == infinite).
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int epoll_wait (int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout);
+
+
+/* Same as epoll_wait, but the thread's signal mask is temporarily
+ and atomically replaced with the one provided as parameter.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int epoll_pwait (int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout,
+ __const __sigset_t *__ss);
+
+__END_DECLS
+
+#endif /* sys/epoll.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h b/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h
new file mode 100644
index 0000000000..c8ce554625
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h
@@ -0,0 +1,52 @@
+/* Copyright (C) 2007, 2008 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. */
+
+#ifndef _SYS_EVENTFD_H
+#define _SYS_EVENTFD_H 1
+
+#include <stdint.h>
+
+
+/* Type for event counter. */
+typedef uint64_t eventfd_t;
+
+/* Flags for signalfd. */
+enum
+ {
+ EFD_CLOEXEC = 010000000,
+#define EFD_CLOEXEC EFD_CLOEXEC
+ EFD_NONBLOCK = 04
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
+
+
+__BEGIN_DECLS
+
+/* Return file descriptor for generic event channel. Set initial
+ value to COUNT. */
+extern int eventfd (int __count, int __flags) __THROW;
+
+/* Read event counter and possibly wait for events. */
+extern int eventfd_read (int __fd, eventfd_t *__value);
+
+/* Increment event counter. */
+extern int eventfd_write (int __fd, eventfd_t value);
+
+__END_DECLS
+
+#endif /* sys/eventfd.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/inotify.h b/sysdeps/unix/sysv/linux/alpha/sys/inotify.h
new file mode 100644
index 0000000000..d61c700d5d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/sys/inotify.h
@@ -0,0 +1,105 @@
+/* Copyright (C) 2005, 2006, 2008 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. */
+
+#ifndef _SYS_INOTIFY_H
+#define _SYS_INOTIFY_H 1
+
+#include <stdint.h>
+
+
+/* Flags for the parameter of inotify_init1. */
+enum
+ {
+ IN_CLOEXEC = 010000000,
+#define IN_CLOEXEC IN_CLOEXEC
+ IN_NONBLOCK = 04
+#define IN_NONBLOCK IN_NONBLOCK
+ };
+
+
+/* Structure describing an inotify event. */
+struct inotify_event
+{
+ int wd; /* Watch descriptor. */
+ uint32_t mask; /* Watch mask. */
+ uint32_t cookie; /* Cookie to synchronize two events. */
+ uint32_t len; /* Length (including NULs) of name. */
+ char name __flexarr; /* Name. */
+};
+
+
+/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */
+#define IN_ACCESS 0x00000001 /* File was accessed. */
+#define IN_MODIFY 0x00000002 /* File was modified. */
+#define IN_ATTRIB 0x00000004 /* Metadata changed. */
+#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */
+#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */
+#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
+#define IN_OPEN 0x00000020 /* File was opened. */
+#define IN_MOVED_FROM 0x00000040 /* File was moved from X. */
+#define IN_MOVED_TO 0x00000080 /* File was moved to Y. */
+#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
+#define IN_CREATE 0x00000100 /* Subfile was created. */
+#define IN_DELETE 0x00000200 /* Subfile was deleted. */
+#define IN_DELETE_SELF 0x00000400 /* Self was deleted. */
+#define IN_MOVE_SELF 0x00000800 /* Self was moved. */
+
+/* Events sent by the kernel. */
+#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */
+#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */
+#define IN_IGNORED 0x00008000 /* File was ignored. */
+
+/* Helper events. */
+#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
+#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
+
+/* Special flags. */
+#define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a
+ directory. */
+#define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */
+#define IN_MASK_ADD 0x20000000 /* Add to the mask of an already
+ existing watch. */
+#define IN_ISDIR 0x40000000 /* Event occurred against dir. */
+#define IN_ONESHOT 0x80000000 /* Only send event once. */
+
+/* All events which a program can wait on. */
+#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \
+ | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \
+ | IN_MOVED_TO | IN_CREATE | IN_DELETE \
+ | IN_DELETE_SELF | IN_MOVE_SELF)
+
+
+__BEGIN_DECLS
+
+/* Create and initialize inotify instance. */
+extern int inotify_init (void) __THROW;
+
+/* Create and initialize inotify instance. */
+extern int inotify_init1 (int __flags) __THROW;
+
+/* Add watch of object NAME to inotify instance FD. Notify about
+ events specified by MASK. */
+extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask)
+ __THROW;
+
+/* Remove the watch specified by WD from the inotify instance FD. */
+extern int inotify_rm_watch (int __fd, uint32_t __wd) __THROW;
+
+__END_DECLS
+
+#endif /* sys/inotify.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h b/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h
new file mode 100644
index 0000000000..a820eafe79
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h
@@ -0,0 +1,66 @@
+/* Copyright (C) 2007, 2008 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. */
+
+#ifndef _SYS_SIGNALFD_H
+#define _SYS_SIGNALFD_H 1
+
+#define __need_sigset_t
+#include <signal.h>
+#include <stdint.h>
+
+
+struct signalfd_siginfo
+{
+ uint32_t ssi_signo;
+ int32_t ssi_errno;
+ int32_t ssi_code;
+ uint32_t ssi_pid;
+ uint32_t ssi_uid;
+ int32_t ssi_fd;
+ uint32_t ssi_tid;
+ uint32_t ssi_band;
+ uint32_t ssi_overrun;
+ uint32_t ssi_trapno;
+ int32_t ssi_status;
+ int32_t ssi_int;
+ uint64_t ssi_ptr;
+ uint64_t ssi_utime;
+ uint64_t ssi_stime;
+ uint64_t ssi_addr;
+ uint8_t __pad[48];
+};
+
+/* Flags for signalfd. */
+enum
+ {
+ SFD_CLOEXEC = 010000000,
+#define SFD_CLOEXEC SFD_CLOEXEC
+ SFD_NONBLOCK = 04
+#define SFD_NONBLOCK SFD_NONBLOCK
+ };
+
+__BEGIN_DECLS
+
+/* Request notification for delivery of signals in MASK to be
+ performed using descriptor FD.*/
+extern int signalfd (int __fd, const sigset_t *__mask, int __flags)
+ __nonnull ((2)) __THROW;
+
+__END_DECLS
+
+#endif /* sys/signalfd.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h b/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h
new file mode 100644
index 0000000000..09d6ccf6cc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h
@@ -0,0 +1,60 @@
+/* Copyright (C) 2008 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. */
+
+#ifndef _SYS_TIMERFD_H
+#define _SYS_TIMERFD_H 1
+
+#include <time.h>
+
+
+/* Bits to be set in the FLAGS parameter of `timerfd_create'. */
+enum
+ {
+ TFD_CLOEXEC = 010000000,
+#define TFD_CLOEXEC TFD_CLOEXEC
+ TFD_NONBLOCK = 04
+#define TFD_NONBLOCK TFD_NONBLOCK
+ };
+
+
+/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
+enum
+ {
+ TFD_TIMER_ABSTIME = 1 << 0
+#define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME
+ };
+
+
+__BEGIN_DECLS
+
+/* Return file descriptor for new interval timer source. */
+extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW;
+
+/* Set next expiration time of interval timer source UFD to UTMR. If
+ FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
+ absolute. Optionally return the old expiration time in OTMR. */
+extern int timerfd_settime (int __ufd, int __flags,
+ __const struct itimerspec *__utmr,
+ struct itimerspec *__otmr) __THROW;
+
+/* Return the next expiration time of UFD. */
+extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW;
+
+__END_DECLS
+
+#endif /* sys/timerfd.h */
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 3dda3d1c29..87c3b91802 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -52,12 +52,22 @@ enum __socket_type
SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based,
datagrams of fixed maximum length. */
#define SOCK_SEQPACKET SOCK_SEQPACKET
- SOCK_DCCP = 6,
-#define SOCK_DCCP SOCK_DCCP /* Datagram Congestion Control Protocol. */
- SOCK_PACKET = 10 /* Linux specific way of getting packets
+ SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */
+#define SOCK_DCCP SOCK_DCCP
+ SOCK_PACKET = 10, /* Linux specific way of getting packets
at the dev level. For writing rarp and
other similar things on the user level. */
#define SOCK_PACKET SOCK_PACKET
+
+ /* Flags to be ORed into the type parameter of socket and socketpair and
+ used for the flags parameter of paccept. */
+
+ SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the
+ new descriptor(s). */
+#define SOCK_CLOEXEC SOCK_CLOEXEC
+ SOCK_NONBLOCK = 04000 /* Atomically mark descriptor(s) as
+ non-blocking. */
+#define SOCK_NONBLOCK SOCK_NONBLOCK
};
/* Protocol families. */
@@ -92,7 +102,8 @@ enum __socket_type
#define PF_BLUETOOTH 31 /* Bluetooth sockets. */
#define PF_IUCV 32 /* IUCV sockets. */
#define PF_RXRPC 33 /* RxRPC sockets. */
-#define PF_MAX 34 /* For now.. */
+#define PF_ISDN 34 /* mISDN sockets. */
+#define PF_MAX 35 /* For now.. */
/* Address families. */
#define AF_UNSPEC PF_UNSPEC
@@ -126,6 +137,7 @@ enum __socket_type
#define AF_BLUETOOTH PF_BLUETOOTH
#define AF_IUCV PF_IUCV
#define AF_RXRPC PF_RXRPC
+#define AF_ISDN PF_ISDN
#define AF_MAX PF_MAX
/* Socket level values. Others are defined in the appropriate headers.
diff --git a/sysdeps/unix/sysv/linux/dl-origin.c b/sysdeps/unix/sysv/linux/dl-origin.c
index a7fa53ea1d..fdb6372f09 100644
--- a/sysdeps/unix/sysv/linux/dl-origin.c
+++ b/sysdeps/unix/sysv/linux/dl-origin.c
@@ -1,5 +1,5 @@
/* Find path of executable.
- Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998-2000, 2002, 2004, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -35,30 +35,32 @@
const char *
_dl_get_origin (void)
{
+#ifndef __ASSUME_AT_EXECFN
char linkval[PATH_MAX];
- char *result;
+#endif
+ const char *str;
+ char *result = (char *) -1l;
int len;
- INTERNAL_SYSCALL_DECL (err);
- len = INTERNAL_SYSCALL (readlink, err, 3, "/proc/self/exe", linkval,
- sizeof (linkval));
- if (! INTERNAL_SYSCALL_ERROR_P (len, err) && len > 0 && linkval[0] != '[')
+ str = GLRO(dl_execfn);
+#ifndef __ASSUME_AT_EXECFN
+ if (str == NULL)
{
- /* We can use this value. */
- assert (linkval[0] == '/');
- while (len > 1 && linkval[len - 1] != '/')
- --len;
- result = (char *) malloc (len + 1);
- if (result == NULL)
- result = (char *) -1;
- else if (len == 1)
- memcpy (result, "/", 2);
- else
- *((char *) __mempcpy (result, linkval, len - 1)) = '\0';
+ INTERNAL_SYSCALL_DECL (err);
+
+ len = INTERNAL_SYSCALL (readlink, err, 3, "/proc/self/exe", linkval,
+ sizeof (linkval));
+ if (! INTERNAL_SYSCALL_ERROR_P (len, err)
+ && len > 0 && linkval[0] != '[')
+ str = linkval;
}
else
+#endif
+ len = strlen (str);
+
+#ifndef __ASSUME_AT_EXECFN
+ if (str == NULL)
{
- result = (char *) -1;
/* We use the environment variable LD_ORIGIN_PATH. If it is set make
a copy and strip out trailing slashes. */
if (GLRO(dl_origin_path) != NULL)
@@ -76,6 +78,21 @@ _dl_get_origin (void)
}
}
}
+ else
+#endif
+ {
+ /* We can use this value. */
+ assert (str[0] == '/');
+ while (len > 1 && str[len - 1] != '/')
+ --len;
+ result = (char *) malloc (len + 1);
+ if (result == NULL)
+ result = (char *) -1;
+ else if (len == 1)
+ memcpy (result, "/", 2);
+ else
+ *((char *) __mempcpy (result, str, len - 1)) = '\0';
+ }
return result;
}
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.h b/sysdeps/unix/sysv/linux/dl-sysdep.h
index f44fa9814e..a3c2cb8e77 100644
--- a/sysdeps/unix/sysv/linux/dl-sysdep.h
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.h
@@ -27,9 +27,7 @@
#define NEED_DL_SYSINFO_DSO 1
-/* The _dl_discover_osversion function is so far only needed in sysconf
- to check for kernels later than 2.6.23. */
-#if !defined __ASSEMBLER__ && __LINUX_KERNEL_VERSION < 0x020617
+#ifndef __ASSEMBLER__
/* Get version of the OS. */
extern int _dl_discover_osversion (void) attribute_hidden;
# define HAVE_DL_DISCOVER_OSVERSION 1
diff --git a/sysdeps/unix/sysv/linux/eventfd.c b/sysdeps/unix/sysv/linux/eventfd.c
index 180861aad2..6ebfed86f1 100644
--- a/sysdeps/unix/sysv/linux/eventfd.c
+++ b/sysdeps/unix/sysv/linux/eventfd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2008 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
@@ -24,7 +24,10 @@
int
eventfd (int count, int flags)
{
- /* The system call has no flag parameter which is bad. So we have
+#ifdef __NR_eventfd1
+ return INLINE_SYSCALL (eventfd1, 1, flags);
+#else
+ /* The old system call has no flag parameter which is bad. So we have
to wait until we have to support to pass additional values to the
kernel (sys_indirect) before implementing setting flags like
O_NONBLOCK etc. */
@@ -34,10 +37,11 @@ eventfd (int count, int flags)
return -1;
}
-#ifdef __NR_eventfd
+# ifdef __NR_eventfd
return INLINE_SYSCALL (eventfd, 1, count);
-#else
+# else
__set_errno (ENOSYS);
return -1;
+# endif
#endif
}
diff --git a/sysdeps/unix/sysv/linux/i386/paccept.S b/sysdeps/unix/sysv/linux/i386/paccept.S
new file mode 100644
index 0000000000..02ad78dd47
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/paccept.S
@@ -0,0 +1,135 @@
+/* Copyright (C) 1995-1998,2002,2003,2005,2008 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-cancel.h>
+#include <socketcall.h>
+#include <tls.h>
+
+#define _NSIG 64
+
+#define P(a, b) P2(a, b)
+#define P2(a, b) a##b
+
+ .text
+/* The socket-oriented system calls are handled unusally in Linux.
+ They are all gated through the single `socketcall' system call number.
+ `socketcall' takes two arguments: the first is the subcode, specifying
+ which socket function is being called; and the second is a pointer to
+ the arguments to the specific function. */
+
+ENTRY(do_paccept)
+#ifdef SOCKOP_paccept
+ subl $6*4, %esp
+ cfi_adjust_cfa_offset(6*4)
+
+ movl (%eax), %ecx
+ movl %ecx, (%esp)
+ movl 4(%eax), %ecx
+ movl %ecx, 4(%esp)
+ movl 8(%eax), %ecx
+ movl %ecx, 8(%esp)
+ movl 12(%eax), %ecx
+ movl %ecx, 12(%esp)
+ movl $(_NSIG / 8), 16(%esp)
+ movl 16(%eax), %ecx
+ movl %ecx, 20(%esp)
+
+ movl $SYS_ify(socketcall), %eax /* System call number in %eax. */
+
+ movl $SOCKOP_paccept, %ebx /* Subcode is first arg to syscall. */
+ movl %esp, %ecx /* Address of args is 2nd arg. */
+
+ /* Do the system call trap. */
+ ENTER_KERNEL
+
+ addl $6*4, %esp
+ cfi_adjust_cfa_offset(-6*4)
+
+ /* %eax is < 0 if there was an error. */
+ cmpl $-125, %eax
+ jae SYSCALL_ERROR_LABEL
+#else
+ movl $-ENOSYS, %eax
+ jmp SYSCALL_ERROR_LABEL
+
+ .section .gnu.glibc-stub.paccept
+ .previous
+ .section .gnu.warning.paccept
+ .string "warning: paccept is not implemented and will always fail"
+ .previous
+#endif
+L(pseudo_end):
+ ret
+PSEUDO_END(do_paccept)
+
+
+ .globl paccept
+ENTRY (paccept)
+#ifdef CENABLE
+ SINGLE_THREAD_P
+ jne 1f
+#endif
+
+ /* Save registers. */
+ movl %ebx, %edx
+ cfi_register (3, 2)
+
+ lea 4(%esp), %eax
+ call do_paccept
+
+ /* Restore registers. */
+ movl %edx, %ebx
+ cfi_restore (3)
+
+ ret
+
+#ifdef CENABLE
+ /* We need one more register. */
+1: pushl %esi
+ cfi_adjust_cfa_offset(4)
+
+ /* Enable asynchronous cancellation. */
+ CENABLE
+ movl %eax, %esi
+ cfi_offset(6, -8) /* %esi */
+
+ /* Save registers. */
+ movl %ebx, %edx
+ cfi_register (3, 2)
+
+ lea 8(%esp), %eax
+ call do_paccept
+
+ /* Restore registers. */
+ movl %edx, %ebx
+ cfi_restore (3)
+
+ /* Restore the cancellation. */
+ xchgl %esi, %eax
+ CDISABLE
+
+ /* Restore registers. */
+ movl %esi, %eax
+ popl %esi
+ cfi_restore (6)
+ cfi_adjust_cfa_offset(-4)
+
+ /* Successful; return the syscall's value. */
+ ret
+#endif
+PSEUDO_END (paccept)
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 01baab0903..df87ae7c48 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-2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1999-2006, 2007, 2008 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
@@ -492,3 +492,18 @@
#if __LINUX_KERNEL_VERSION >= 0x020618
# define __ASSUME_ADJ_OFFSET_SS_READ 1
#endif
+
+/* Support for AT_EXECFN was added in 2.6.27. */
+#if __LINUX_KERNEL_VERSION >= 0x02061b
+# define __ASSUME_AT_EXECFN 1
+#endif
+
+/* Support for various CLOEXEC and NONBLOCK flags was added for x86,
+ x86-64, PPC, IA-64, and SPARC in 2.6.27. */
+#if __LINUX_KERNEL_VERSION >= 0x02061b \
+ && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
+ || defined __ia64__ || defined __sparc__)
+# define __ASSUME_SOCK_CLOEXEC 1
+# define __ASSUME_IN_NONBLOCK 1
+# define __ASSUME_PIPE2 1
+#endif
diff --git a/sysdeps/unix/sysv/linux/opensock.c b/sysdeps/unix/sysv/linux/opensock.c
index 95559eb799..191d72011d 100644
--- a/sysdeps/unix/sysv/linux/opensock.c
+++ b/sysdeps/unix/sysv/linux/opensock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001, 2002, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 2002, 2007, 2008 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
@@ -22,6 +22,7 @@
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
+#include <kernel-features.h>
/* Return a socket of any type. The socket can be used in subsequent
ioctl calls to talk to the kernel. */
@@ -70,7 +71,24 @@ __opensock (void)
{
assert (last_type != 0);
- result = __socket (last_family, last_type, 0);
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0)
+# endif
+ {
+ result = __socket (last_family, last_type | SOCK_CLOEXEC, 0);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec = result != -1 || errno != EINVAL ? 1 : -1;
+# endif
+ }
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ result = __socket (last_family, last_type, 0);
+#endif
if (result != -1 || errno != EAFNOSUPPORT)
/* Maybe the socket type isn't supported anymore (module is
unloaded). In this case again try to find the type. */
@@ -105,7 +123,24 @@ __opensock (void)
if (afs[cnt].family == AF_NETROM || afs[cnt].family == AF_X25)
type = SOCK_SEQPACKET;
- result = __socket (afs[cnt].family, type, 0);
+#ifdef SOCK_CLOEXEC
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec >= 0)
+# endif
+ {
+ result = __socket (afs[cnt].family, type | SOCK_CLOEXEC, 0);
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (__have_sock_cloexec == 0)
+ __have_sock_cloexec = result != -1 || errno != EINVAL ? 1 : -1;
+# endif
+ }
+#endif
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ result = __socket (afs[cnt].family, type, 0);
+#endif
if (result != -1)
{
/* Found an available family. */
diff --git a/sysdeps/unix/sysv/linux/paccept.c b/sysdeps/unix/sysv/linux/paccept.c
new file mode 100644
index 0000000000..1817d381d9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/paccept.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2008.
+
+ 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 <signal.h>
+#include <sys/socket.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+
+#ifdef __NR_paccept
+int
+paccept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len,
+ const __sigset_t *ss, int flags)
+{
+ if (SINGLE_THREAD_P)
+ return INLINE_SYSCALL (paccept, 6, fd, addr, addr_len, ss,
+ _NSIG / 8, flags);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = INLINE_SYSCALL (paccept, 6, fd, addr, addr_len, ss,
+ _NSIG / 8, flags);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+#else
+int
+paccept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len,
+ const __sigset_t *ss, int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+stub_warning (epoll_pwait)
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/s390/bits/utmp.h b/sysdeps/unix/sysv/linux/s390/bits/utmp.h
new file mode 100644
index 0000000000..acb82b0ac7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/bits/utmp.h
@@ -0,0 +1,125 @@
+/* The `struct utmp' type, describing entries in the utmp file. GNU version.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2008
+ 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. */
+
+#ifndef _UTMP_H
+# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
+#endif
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+
+
+#define UT_LINESIZE 32
+#define UT_NAMESIZE 32
+#define UT_HOSTSIZE 256
+
+
+/* The structure describing an entry in the database of
+ previous logins. */
+struct lastlog
+ {
+#if __WORDSIZE == 32
+ int64_t ll_time;
+#else
+ __time_t ll_time;
+#endif
+ char ll_line[UT_LINESIZE];
+ char ll_host[UT_HOSTSIZE];
+ };
+
+
+/* The structure describing the status of a terminated process. This
+ type is used in `struct utmp' below. */
+struct exit_status
+ {
+ short int e_termination; /* Process termination status. */
+ short int e_exit; /* Process exit status. */
+ };
+
+
+/* The structure describing an entry in the user accounting database. */
+struct utmp
+{
+ short int ut_type; /* Type of login. */
+ pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[UT_NAMESIZE]; /* Username. */
+ char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+/* The ut_session and ut_tv fields must be the same size when compiled
+ 32- and 64-bit. This allows data files and shared memory to be
+ shared between 32- and 64-bit applications. */
+#if __WORDSIZE == 32
+ int64_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ int64_t tv_sec; /* Seconds. */
+ int64_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+#else
+ long int ut_session; /* Session ID, used for windowing. */
+ struct timeval ut_tv; /* Time entry was made. */
+#endif
+
+ int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+/* Backwards compatibility hacks. */
+#define ut_name ut_user
+#ifndef _NO_UT_TIME
+/* We have a problem here: `ut_time' is also used otherwise. Define
+ _NO_UT_TIME if the compiler complains. */
+# define ut_time ut_tv.tv_sec
+#endif
+#define ut_xtime ut_tv.tv_sec
+#define ut_addr ut_addr_v6[0]
+
+
+/* Values for the `ut_type' field of a `struct utmp'. */
+#define EMPTY 0 /* No valid user accounting information. */
+
+#define RUN_LVL 1 /* The system's runlevel. */
+#define BOOT_TIME 2 /* Time of system boot. */
+#define NEW_TIME 3 /* Time after system clock changed. */
+#define OLD_TIME 4 /* Time when system clock changed. */
+
+#define INIT_PROCESS 5 /* Process spawned by the init process. */
+#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
+#define USER_PROCESS 7 /* Normal process. */
+#define DEAD_PROCESS 8 /* Terminated process. */
+
+#define ACCOUNTING 9
+
+/* Old Linux name for the EMPTY type. */
+#define UT_UNKNOWN EMPTY
+
+
+/* Tell the user that we have a modern system with UT_HOST, UT_PID,
+ UT_TYPE, UT_ID and UT_TV fields. */
+#define _HAVE_UT_TYPE 1
+#define _HAVE_UT_PID 1
+#define _HAVE_UT_ID 1
+#define _HAVE_UT_TV 1
+#define _HAVE_UT_HOST 1
diff --git a/sysdeps/unix/sysv/linux/s390/bits/utmpx.h b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
new file mode 100644
index 0000000000..718e29039e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
@@ -0,0 +1,104 @@
+/* Structures and definitions for the user accounting database. GNU version.
+ Copyright (C) 1997, 1998, 2000, 2001, 2002, 2008
+ 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. */
+
+#ifndef _UTMPX_H
+# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <sys/time.h>
+#include <bits/wordsize.h>
+
+
+#ifdef __USE_GNU
+# include <paths.h>
+# define _PATH_UTMPX _PATH_UTMP
+# define _PATH_WTMPX _PATH_WTMP
+#endif
+
+
+#define __UT_LINESIZE 32
+#define __UT_NAMESIZE 32
+#define __UT_HOSTSIZE 256
+
+
+/* The structure describing the status of a terminated process. This
+ type is used in `struct utmpx' below. */
+struct __exit_status
+ {
+#ifdef __USE_GNU
+ short int e_termination; /* Process termination status. */
+ short int e_exit; /* Process exit status. */
+#else
+ short int __e_termination; /* Process termination status. */
+ short int __e_exit; /* Process exit status. */
+#endif
+ };
+
+
+/* The structure describing an entry in the user accounting database. */
+struct utmpx
+{
+ short int ut_type; /* Type of login. */
+ __pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[__UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[__UT_NAMESIZE]; /* Username. */
+ char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct __exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+
+/* The fields ut_session and ut_tv must be the same size when compiled
+ 32- and 64-bit. This allows files and shared memory to be shared
+ between 32- and 64-bit applications. */
+#if __WORDSIZE == 32
+ __int64_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ __int64_t tv_sec; /* Seconds. */
+ __int64_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+#else
+ long int ut_session; /* Session ID, used for windowing. */
+ struct timeval ut_tv; /* Time entry was made. */
+#endif
+ __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+
+/* Values for the `ut_type' field of a `struct utmpx'. */
+#define EMPTY 0 /* No valid user accounting information. */
+
+#ifdef __USE_GNU
+# define RUN_LVL 1 /* The system's runlevel. */
+#endif
+#define BOOT_TIME 2 /* Time of system boot. */
+#define NEW_TIME 3 /* Time after system clock changed. */
+#define OLD_TIME 4 /* Time when system clock changed. */
+
+#define INIT_PROCESS 5 /* Process spawned by the init process. */
+#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
+#define USER_PROCESS 7 /* Normal process. */
+#define DEAD_PROCESS 8 /* Terminated process. */
+
+#ifdef __USE_GNU
+# define ACCOUNTING 9 /* System accounting. */
+#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
index 359c863c0e..a509c9312b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
@@ -1,3 +1,8 @@
+ifeq ($(subdir),login)
+sysdep_routines += utmp32 utmpx32
+libutil-routines += login32
+endif
+
ifeq ($(subdir),misc)
sysdep_headers += sys/elf.h
endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
index 8d6a660cb5..b6d608d0ae 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/Versions
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
@@ -26,4 +26,27 @@ libc {
GLIBC_2.3.3 {
posix_fadvise64; posix_fallocate64;
}
+ GLIBC_2.9 {
+ getutent;
+ getutid;
+ getutline;
+ pututline;
+ updwtmp;
+ getutent_r;
+ getutid_r;
+ getutline_r;
+ getutxent;
+ getutxid;
+ getutxline;
+ pututxline;
+ updwtmpx;
+ getutmp;
+ getutmpx;
+ }
+}
+
+libutil {
+ GLIBC_2.9 {
+ login;
+ }
}
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c
new file mode 100644
index 0000000000..de3aa3f5b3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutent.c"
+
+default_symbol_version (__getutent, getutent, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c
new file mode 100644
index 0000000000..8c4be200cd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <bits/libc-lock.h>
+#include <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+#include "utmp-private.h"
+
+weak_alias (__setutent, setutent)
+weak_alias (__endutent, endutent)
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutent_r.c"
+
+default_symbol_version (__getutent_r, getutent_r, UTMP_COMPAT_BASE);
+default_symbol_version (__pututline, pututline, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c
new file mode 100644
index 0000000000..5285481bb0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutid.c"
+
+default_symbol_version (__getutid, getutid, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c
new file mode 100644
index 0000000000..5989726db0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <bits/libc-lock.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+#include "utmp-private.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutid_r.c"
+
+default_symbol_version (__getutid_r, getutid_r, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c
new file mode 100644
index 0000000000..86b1add58f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutline.c"
+
+default_symbol_version (__getutline, getutline, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c
new file mode 100644
index 0000000000..6d40adbb95
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <errno.h>
+#include <bits/libc-lock.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+#include "utmp-private.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "login/getutline_r.c"
+
+default_symbol_version (__getutline_r, getutline_r, UTMP_COMPAT_BASE);;
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c
new file mode 100644
index 0000000000..2a14e12383
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <string.h>
+#include <utmp.h>
+/* This is an ugly hack but we must not see the getutmpx declaration. */
+#define getutmpx XXXgetutmpx
+#include <utmpx.h>
+#undef getutmpx
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define getutmp __getutmp
+#define getutmpx __getutmpx
+#include "sysdeps/gnu/getutmp.c"
+#undef getutmp
+#undef getutmpx
+
+default_symbol_version (__getutmp, getutmp, UTMP_COMPAT_BASE);
+default_symbol_version (__getutmpx, getutmpx, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c
new file mode 100644
index 0000000000..38179a2161
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define getutxent __getutxent
+#include "login/getutxent.c"
+#undef getutxent
+
+default_symbol_version (__getutxent, getutxent, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c
new file mode 100644
index 0000000000..da19501851
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define getutxid __getutxid
+#include "login/getutxid.c"
+#undef getutxid
+
+default_symbol_version (__getutxid, getutxid, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c
new file mode 100644
index 0000000000..9336150cf4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define getutxline __getutxline
+#include "login/getutxline.c"
+#undef getutxline
+
+default_symbol_version (__getutxline, getutxline, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/login.c b/sysdeps/unix/sysv/linux/s390/s390-32/login.c
new file mode 100644
index 0000000000..17a21c8d8d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/login.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <utmp.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define login __login
+#include "login/login.c"
+#undef login
+
+default_symbol_version (__login, login, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/login32.c b/sysdeps/unix/sysv/linux/s390/s390-32/login32.c
new file mode 100644
index 0000000000..c9af995f17
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/login32.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <sys/types.h>
+#include <utmp.h>
+#include <libc-symbols.h>
+
+#include "utmp32.h"
+#include "utmp-convert.h"
+
+/* Write the given entry into utmp and wtmp. */
+void
+login32 (const struct utmp32 *entry)
+{
+ struct utmp in64;
+
+ utmp_convert32to64 (entry, &in64);
+ login (&in64);
+}
+
+symbol_version (login32, login, GLIBC_2.0);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c b/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c
new file mode 100644
index 0000000000..41f93d332a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define pututxline __pututxline
+#include "login/pututxline.c"
+#undef pututxline
+
+default_symbol_version (__pututxline, pututxline, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c b/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c
new file mode 100644
index 0000000000..72e06576a3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+
+#include "utmp-compat.h"
+#include "utmp-private.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#include "sysdeps/gnu/updwtmp.c"
+
+default_symbol_version (__updwtmp, updwtmp, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c b/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c
new file mode 100644
index 0000000000..0f0b87d8ac
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <utmp.h>
+#include <utmpx.h>
+
+#include "utmp-compat.h"
+
+#undef weak_alias
+#define weak_alias(n,a)
+#define updwtmpx __updwtmpx
+#include "login/updwtmpx.c"
+#undef updwtmpx
+
+default_symbol_version (__updwtmpx, updwtmpx, UTMP_COMPAT_BASE);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h b/sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h
new file mode 100644
index 0000000000..064da54235
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/utmp-compat.h
@@ -0,0 +1,22 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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. */
+
+/* This macro defines the glibc version tag at which the 64 bit struct
+ utmp functions have been added to the 32 bit glibc. */
+#define UTMP_COMPAT_BASE GLIBC_2.9
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h b/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h
new file mode 100644
index 0000000000..177da80f00
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h
@@ -0,0 +1,17 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c b/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c
new file mode 100644
index 0000000000..32a5d71376
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c
@@ -0,0 +1,185 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <sys/types.h>
+#include <utmp.h>
+#include <errno.h>
+#include <libc-symbols.h>
+
+#include "utmp32.h"
+#include "utmp-convert.h"
+
+/* Allocate a static buffer to be returned to the caller. As well as
+ with the existing version of these functions the caller has to be
+ aware that the contents of this buffer will change with subsequent
+ calls. */
+#define ALLOCATE_UTMP32_OUT(OUT) \
+ static struct utmp32 *OUT = NULL; \
+ \
+ if (OUT == NULL) \
+ { \
+ OUT = malloc (sizeof (struct utmp32)); \
+ if (OUT == NULL) \
+ return NULL; \
+ }
+
+/* Perform a lookup for a utmp entry matching FIELD using function
+ FUNC. FIELD is converted to a 64 bit utmp and the result is
+ converted back to 32 bit utmp. */
+#define ACCESS_UTMP_ENTRY(FUNC, FIELD) \
+ struct utmp in64; \
+ struct utmp *out64; \
+ ALLOCATE_UTMP32_OUT (out32); \
+ \
+ utmp_convert32to64 (FIELD, &in64); \
+ out64 = FUNC (&in64); \
+ \
+ if (out64 == NULL) \
+ return NULL; \
+ \
+ utmp_convert64to32 (out64, out32); \
+ \
+ return out32;
+
+/* Search forward from the current point in the utmp file until the
+ next entry with a ut_type matching ID->ut_type. */
+struct utmp32 *
+getutid32 (const struct utmp32 *id)
+{
+ ACCESS_UTMP_ENTRY (getutid, id)
+}
+symbol_version (getutid32, getutid, GLIBC_2.0);
+
+/* Search forward from the current point in the utmp file until the
+ next entry with a ut_line matching LINE->ut_line. */
+struct utmp32 *
+getutline32 (const struct utmp32 *line)
+{
+ ACCESS_UTMP_ENTRY (getutline, line)
+}
+symbol_version (getutline32, getutline, GLIBC_2.0);
+
+/* Write out entry pointed to by UTMP_PTR into the utmp file. */
+struct utmp32 *
+pututline32 (const struct utmp32 *utmp_ptr)
+{
+ ACCESS_UTMP_ENTRY (pututline, utmp_ptr)
+}
+symbol_version (pututline32, pututline, GLIBC_2.0);
+
+/* Read next entry from a utmp-like file. */
+struct utmp32 *
+getutent32 (void)
+{
+ struct utmp *out64;
+ ALLOCATE_UTMP32_OUT (out32);
+
+ out64 = getutent ();
+ if (!out64)
+ return NULL;
+
+ utmp_convert64to32 (out64, out32);
+ return out32;
+}
+symbol_version (getutent32, getutent, GLIBC_2.0);
+
+/* Reentrant versions of the file for handling utmp files. */
+
+int
+getutent32_r (struct utmp32 *buffer, struct utmp32 **result)
+{
+ struct utmp out64;
+ struct utmp *out64p;
+ int ret;
+
+ ret = getutent_r (&out64, &out64p);
+ if (ret == -1)
+ {
+ *result = NULL;
+ return -1;
+ }
+
+ utmp_convert64to32 (out64p, buffer);
+ *result = buffer;
+
+ return 0;
+}
+symbol_version (getutent32_r, getutent_r, GLIBC_2.0);
+
+int
+getutid32_r (const struct utmp32 *id, struct utmp32 *buffer,
+ struct utmp32 **result)
+{
+ struct utmp in64;
+ struct utmp out64;
+ struct utmp *out64p;
+ int ret;
+
+ utmp_convert32to64 (id, &in64);
+
+ ret = getutid_r (&in64, &out64, &out64p);
+ if (ret == -1)
+ {
+ *result = NULL;
+ return -1;
+ }
+
+ utmp_convert64to32 (out64p, buffer);
+ *result = buffer;
+
+ return 0;
+}
+symbol_version (getutid32_r, getutid_r, GLIBC_2.0);
+
+int
+getutline32_r (const struct utmp32 *line,
+ struct utmp32 *buffer, struct utmp32 **result)
+{
+ struct utmp in64;
+ struct utmp out64;
+ struct utmp *out64p;
+ int ret;
+
+ utmp_convert32to64 (line, &in64);
+
+ ret = getutline_r (&in64, &out64, &out64p);
+ if (ret == -1)
+ {
+ *result = NULL;
+ return -1;
+ }
+
+ utmp_convert64to32 (out64p, buffer);
+ *result = buffer;
+
+ return 0;
+
+}
+symbol_version (getutline32_r, getutline_r, GLIBC_2.0);
+
+/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
+void
+updwtmp32 (const char *wtmp_file, const struct utmp32 *utmp)
+{
+ struct utmp in32;
+
+ utmp_convert32to64 (utmp, &in32);
+ updwtmp (wtmp_file, &in32);
+}
+symbol_version (updwtmp32, updwtmp, GLIBC_2.0);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h b/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h
new file mode 100644
index 0000000000..335bc7fbda
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h
@@ -0,0 +1,53 @@
+/* The `struct utmp' type, describing entries in the utmp file. GNU version.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2008
+ 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. */
+
+#ifndef _UTMP32_H
+#define _UTMP32_H 1
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+#include <utmp.h>
+
+/* The structure describing an entry in the user accounting database. */
+struct utmp32
+{
+ short int ut_type; /* Type of login. */
+ pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[UT_NAMESIZE]; /* Username. */
+ char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+ int32_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ int32_t tv_sec; /* Seconds. */
+ int32_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+
+ int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+
+#endif /* utmp32.h */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h b/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h
new file mode 100644
index 0000000000..a59989c27c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h
@@ -0,0 +1,86 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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. */
+
+
+/* This file provides functions converting between the 32 and 64 bit
+ struct utmp variants. */
+
+#ifndef _UTMPX_CONVERT_H
+#define _UTMPX_CONVERT_H 1
+
+#include <string.h>
+#include "utmpx32.h"
+
+/* Convert the 64 bit struct utmpx value in FROM to the 32 bit version
+ returned in TO. */
+static inline void
+utmpx_convert64to32 (const struct utmpx *from, struct utmpx32 *to)
+{
+#if _HAVE_UT_TYPE - 0
+ to->ut_type = from->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ to->ut_pid = from->ut_pid;
+#endif
+ memcpy (to->ut_line, from->ut_line, __UT_LINESIZE);
+ memcpy (to->ut_user, from->ut_user, __UT_NAMESIZE);
+#if _HAVE_UT_ID - 0
+ memcpy (to->ut_id, from->ut_id, 4);
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (to->ut_host, from->ut_host, __UT_HOSTSIZE);
+#endif
+ to->ut_exit = from->ut_exit;
+ to->ut_session = (int32_t) from->ut_session;
+#if _HAVE_UT_TV - 0
+ to->ut_tv.tv_sec = (int32_t) from->ut_tv.tv_sec;
+ to->ut_tv.tv_usec = (int32_t) from->ut_tv.tv_usec;
+#endif
+ memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
+}
+
+/* Convert the 32 bit struct utmpx value in FROM to the 64 bit version
+ returned in TO. */
+static inline void
+utmpx_convert32to64 (const struct utmpx32 *from, struct utmpx *to)
+{
+#if _HAVE_UT_TYPE - 0
+ to->ut_type = from->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ to->ut_pid = from->ut_pid;
+#endif
+ memcpy (to->ut_line, from->ut_line, __UT_LINESIZE);
+ memcpy (to->ut_user, from->ut_user, __UT_NAMESIZE);
+#if _HAVE_UT_ID - 0
+ memcpy (to->ut_id, from->ut_id, 4);
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (to->ut_host, from->ut_host, __UT_HOSTSIZE);
+#endif
+ to->ut_exit = from->ut_exit;
+ to->ut_session = (int64_t) from->ut_session;
+#if _HAVE_UT_TV - 0
+ to->ut_tv.tv_sec = (int64_t) from->ut_tv.tv_sec;
+ to->ut_tv.tv_usec = (int64_t) from->ut_tv.tv_usec;
+#endif
+ memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
+}
+
+#endif /* utmpx-convert.h */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c b/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c
new file mode 100644
index 0000000000..69a1384db6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c
@@ -0,0 +1,140 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <Andreas.Krebbel@de.ibm.com>.
+ 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 <sys/types.h>
+#include <utmp.h>
+#include <errno.h>
+#include <libc-symbols.h>
+
+#include "utmp32.h"
+#include "utmp-convert.h"
+
+#include "utmpx32.h"
+#include "utmpx-convert.h"
+
+/* Allocate a static buffer to be returned to the caller. As well as
+ with the existing version of these functions the caller has to be
+ aware that the contents of this buffer will change with subsequent
+ calls. */
+#define ALLOCATE_UTMPX32_OUT(OUT) \
+ static struct utmpx32 *OUT = NULL; \
+ \
+ if (OUT == NULL) \
+ { \
+ OUT = malloc (sizeof (struct utmpx32)); \
+ if (OUT == NULL) \
+ return NULL; \
+ }
+
+/* Perform a lookup for a utmpx entry matching FIELD using function
+ FUNC. FIELD is converted to a 64 bit utmpx and the result is
+ converted back to 32 bit utmpx. */
+#define ACCESS_UTMPX_ENTRY(FUNC, FIELD) \
+ struct utmpx in64; \
+ struct utmpx *out64; \
+ ALLOCATE_UTMPX32_OUT (out32); \
+ \
+ utmpx_convert32to64 (FIELD, &in64); \
+ out64 = FUNC (&in64); \
+ \
+ if (out64 == NULL) \
+ return NULL; \
+ \
+ utmpx_convert64to32 (out64, out32); \
+ \
+ return out32;
+
+
+/* Get the next entry from the user accounting database. */
+struct utmpx32 *
+getutxent32 (void)
+{
+ struct utmpx *out64;
+ ALLOCATE_UTMPX32_OUT (out32);
+
+ out64 = getutxent ();
+ if (!out64)
+ return NULL;
+
+ utmpx_convert64to32 (out64, out32);
+ return out32;
+
+}
+symbol_version (getutxent32, getutxent, GLIBC_2.1);
+
+/* Get the user accounting database entry corresponding to ID. */
+struct utmpx32 *
+getutxid32 (const struct utmpx32 *id)
+{
+ ACCESS_UTMPX_ENTRY (getutxid, id);
+}
+symbol_version (getutxid32, getutxid, GLIBC_2.1);
+
+/* Get the user accounting database entry corresponding to LINE. */
+struct utmpx32 *
+getutxline32 (const struct utmpx32 *line)
+{
+ ACCESS_UTMPX_ENTRY (getutxline, line);
+}
+symbol_version (getutxline32, getutxline, GLIBC_2.1);
+
+/* Write the entry UTMPX into the user accounting database. */
+struct utmpx32 *
+pututxline32 (const struct utmpx32 *utmpx)
+{
+ ACCESS_UTMPX_ENTRY (pututxline, utmpx);
+}
+symbol_version (pututxline32, pututxline, GLIBC_2.1);
+
+/* Append entry UTMP to the wtmpx-like file WTMPX_FILE. */
+void
+updwtmpx32 (const char *wtmpx_file, const struct utmpx32 *utmpx)
+{
+ struct utmpx in64;
+
+ utmpx_convert32to64 (utmpx, &in64);
+ updwtmpx (wtmpx_file, &in64);
+}
+symbol_version (updwtmpx32, updwtmpx, GLIBC_2.1);
+
+/* Copy the information in UTMPX to UTMP. */
+void
+getutmp32 (const struct utmpx32 *utmpx, struct utmp32 *utmp)
+{
+ struct utmpx in64;
+ struct utmp out64;
+
+ utmpx_convert32to64 (utmpx, &in64);
+ getutmp (&in64, &out64);
+ utmp_convert64to32 (&out64, utmp);
+}
+symbol_version (getutmp32, getutmp, GLIBC_2.1.1);
+
+/* Copy the information in UTMP to UTMPX. */
+void
+getutmpx32 (const struct utmp32 *utmp, struct utmpx32 *utmpx)
+{
+ struct utmp in64;
+ struct utmpx out64;
+
+ utmp_convert32to64 (utmp, &in64);
+ getutmpx (&in64, &out64);
+ utmpx_convert64to32 (&out64, utmpx);
+}
+symbol_version (getutmpx32, getutmpx, GLIBC_2.1.1);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h b/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h
new file mode 100644
index 0000000000..5f468ed68d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h
@@ -0,0 +1,52 @@
+/* The `struct utmp' type, describing entries in the utmp file. GNU version.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2008
+ 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. */
+
+#ifndef _UTMPX32_H
+#define _UTMPX32_H 1
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+#include <utmpx.h>
+
+/* The structure describing an entry in the user accounting database. */
+struct utmpx32
+{
+ short int ut_type; /* Type of login. */
+ __pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[__UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[__UT_NAMESIZE]; /* Username. */
+ char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct __exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+ __int64_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ __int64_t tv_sec; /* Seconds. */
+ __int64_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+
+ __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+#endif /* utmpx32.h */
diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/signalfd.c
index 09355ecd1d..9898f29231 100644
--- a/sysdeps/unix/sysv/linux/signalfd.c
+++ b/sysdeps/unix/sysv/linux/signalfd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2008 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
@@ -25,7 +25,10 @@
int
signalfd (int fd, const sigset_t *mask, int flags)
{
- /* The system call has no flag parameter which is bad. So we have
+#ifdef __NR_signalfd4
+ return INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags);
+#else
+ /* The old system call has no flag parameter which is bad. So we have
to wait until we have to support to pass additional values to the
kernel (sys_indirect) before implementing setting flags like
O_NONBLOCK etc. */
@@ -35,10 +38,11 @@ signalfd (int fd, const sigset_t *mask, int flags)
return -1;
}
-#ifdef __NR_signalfd
+# ifdef __NR_signalfd
return INLINE_SYSCALL (signalfd, 3, fd, mask, _NSIG / 8);
-#else
+# else
__set_errno (ENOSYS);
return -1;
+# endif
#endif
}
diff --git a/sysdeps/unix/sysv/linux/socketcall.h b/sysdeps/unix/sysv/linux/socketcall.h
index d836534f3a..24ec9ee2ac 100644
--- a/sysdeps/unix/sysv/linux/socketcall.h
+++ b/sysdeps/unix/sysv/linux/socketcall.h
@@ -1,5 +1,5 @@
/* ID for functions called via socketcall system call.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2008 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,7 +18,6 @@
02111-1307 USA. */
#ifndef _SYS_SOCKETCALL_H
-
#define _SYS_SOCKETCALL_H 1
/* Define unique numbers for the operations permitted on socket. Linux
@@ -44,5 +43,6 @@
#define SOCKOP_getsockopt 15
#define SOCKOP_sendmsg 16
#define SOCKOP_recvmsg 17
+#define SOCKOP_paccept 18
-#endif /* _SYS_SOCKETCALL_H */
+#endif /* sys/socketcall.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/socket.h b/sysdeps/unix/sysv/linux/sparc/bits/socket.h
new file mode 100644
index 0000000000..d43a3cdf79
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/socket.h
@@ -0,0 +1,393 @@
+/* System-specific socket constants and types. Linux/SPARC version.
+ Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008
+ 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. */
+
+#ifndef __BITS_SOCKET_H
+#define __BITS_SOCKET_H
+
+#ifndef _SYS_SOCKET_H
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
+#define __need_size_t
+#include <stddef.h>
+
+#include <sys/types.h>
+
+/* Type for length arguments in socket calls. */
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
+
+/* Types of sockets. */
+enum __socket_type
+{
+ SOCK_STREAM = 1, /* Sequenced, reliable, connection-based
+ byte streams. */
+#define SOCK_STREAM SOCK_STREAM
+ SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams
+ of fixed maximum length. */
+#define SOCK_DGRAM SOCK_DGRAM
+ SOCK_RAW = 3, /* Raw protocol interface. */
+#define SOCK_RAW SOCK_RAW
+ SOCK_RDM = 4, /* Reliably-delivered messages. */
+#define SOCK_RDM SOCK_RDM
+ SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based,
+ datagrams of fixed maximum length. */
+#define SOCK_SEQPACKET SOCK_SEQPACKET
+ SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */
+#define SOCK_DCCP SOCK_DCCP
+ SOCK_PACKET = 10, /* Linux specific way of getting packets
+ at the dev level. For writing rarp and
+ other similar things on the user level. */
+#define SOCK_PACKET SOCK_PACKET
+
+ /* Flags to be ORed into the type parameter of socket and socketpair. */
+
+ SOCK_CLOEXEC = 0x400000, /* Atomically set close-on-exec flag for the
+ new descriptor(s). */
+#define SOCK_CLOEXEC SOCK_CLOEXEC
+ SOCK_NONBLOCK = 0x4000 /* Atomically mark descriptor(s) as
+ non-blocking. */
+#define SOCK_NONBLOCK SOCK_NONBLOCK
+};
+
+/* Protocol families. */
+#define PF_UNSPEC 0 /* Unspecified. */
+#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */
+#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. */
+#define PF_IPX 4 /* Novell Internet Protocol. */
+#define PF_APPLETALK 5 /* Appletalk DDP. */
+#define PF_NETROM 6 /* Amateur radio NetROM. */
+#define PF_BRIDGE 7 /* Multiprotocol bridge. */
+#define PF_ATMPVC 8 /* ATM PVCs. */
+#define PF_X25 9 /* Reserved for X.25 project. */
+#define PF_INET6 10 /* IP version 6. */
+#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */
+#define PF_DECnet 12 /* Reserved for DECnet project. */
+#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */
+#define PF_SECURITY 14 /* Security callback pseudo AF. */
+#define PF_KEY 15 /* PF_KEY key management API. */
+#define PF_NETLINK 16
+#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */
+#define PF_PACKET 17 /* Packet family. */
+#define PF_ASH 18 /* Ash. */
+#define PF_ECONET 19 /* Acorn Econet. */
+#define PF_ATMSVC 20 /* ATM SVCs. */
+#define PF_SNA 22 /* Linux SNA Project */
+#define PF_IRDA 23 /* IRDA sockets. */
+#define PF_PPPOX 24 /* PPPoX sockets. */
+#define PF_WANPIPE 25 /* Wanpipe API sockets. */
+#define PF_BLUETOOTH 31 /* Bluetooth sockets. */
+#define PF_IUCV 32 /* IUCV sockets. */
+#define PF_RXRPC 33 /* RxRPC sockets. */
+#define PF_ISDN 34 /* mISDN sockets. */
+#define PF_MAX 35 /* For now.. */
+
+/* Address families. */
+#define AF_UNSPEC PF_UNSPEC
+#define AF_LOCAL PF_LOCAL
+#define AF_UNIX PF_UNIX
+#define AF_FILE PF_FILE
+#define AF_INET PF_INET
+#define AF_AX25 PF_AX25
+#define AF_IPX PF_IPX
+#define AF_APPLETALK PF_APPLETALK
+#define AF_NETROM PF_NETROM
+#define AF_BRIDGE PF_BRIDGE
+#define AF_ATMPVC PF_ATMPVC
+#define AF_X25 PF_X25
+#define AF_INET6 PF_INET6
+#define AF_ROSE PF_ROSE
+#define AF_DECnet PF_DECnet
+#define AF_NETBEUI PF_NETBEUI
+#define AF_SECURITY PF_SECURITY
+#define AF_KEY PF_KEY
+#define AF_NETLINK PF_NETLINK
+#define AF_ROUTE PF_ROUTE
+#define AF_PACKET PF_PACKET
+#define AF_ASH PF_ASH
+#define AF_ECONET PF_ECONET
+#define AF_ATMSVC PF_ATMSVC
+#define AF_SNA PF_SNA
+#define AF_IRDA PF_IRDA
+#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_ISDN PF_ISDN
+#define AF_MAX PF_MAX
+
+/* Socket level values. Others are defined in the appropriate headers.
+
+ XXX These definitions also should go into the appropriate headers as
+ far as they are available. */
+#define SOL_RAW 255
+#define SOL_DECNET 261
+#define SOL_X25 262
+#define SOL_PACKET 263
+#define SOL_ATM 264 /* ATM layer (cell level). */
+#define SOL_AAL 265 /* ATM Adaption Layer (packet level). */
+#define SOL_IRDA 266
+
+/* Maximum queue length specifiable by listen. */
+#define SOMAXCONN 128
+
+/* Get the definition of the macro to define the common sockaddr members. */
+#include <bits/sockaddr.h>
+
+/* Structure describing a generic socket address. */
+struct sockaddr
+ {
+ __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
+ char sa_data[14]; /* Address data. */
+ };
+
+
+/* Structure large enough to hold any socket address (with the historical
+ exception of AF_UNIX). We reserve 128 bytes. */
+#define __ss_aligntype unsigned long int
+#define _SS_SIZE 128
+#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype)))
+
+struct sockaddr_storage
+ {
+ __SOCKADDR_COMMON (ss_); /* Address family, etc. */
+ __ss_aligntype __ss_align; /* Force desired alignment. */
+ char __ss_padding[_SS_PADSIZE];
+ };
+
+
+/* Bits in the FLAGS argument to `send', `recv', et al. */
+enum
+ {
+ MSG_OOB = 0x01, /* Process out-of-band data. */
+#define MSG_OOB MSG_OOB
+ MSG_PEEK = 0x02, /* Peek at incoming messages. */
+#define MSG_PEEK MSG_PEEK
+ MSG_DONTROUTE = 0x04, /* Don't use local routing. */
+#define MSG_DONTROUTE MSG_DONTROUTE
+#ifdef __USE_GNU
+ /* DECnet uses a different name. */
+ MSG_TRYHARD = MSG_DONTROUTE,
+# define MSG_TRYHARD MSG_DONTROUTE
+#endif
+ MSG_CTRUNC = 0x08, /* Control data lost before delivery. */
+#define MSG_CTRUNC MSG_CTRUNC
+ MSG_PROXY = 0x10, /* Supply or ask second address. */
+#define MSG_PROXY MSG_PROXY
+ MSG_TRUNC = 0x20,
+#define MSG_TRUNC MSG_TRUNC
+ MSG_DONTWAIT = 0x40, /* Nonblocking IO. */
+#define MSG_DONTWAIT MSG_DONTWAIT
+ MSG_EOR = 0x80, /* End of record. */
+#define MSG_EOR MSG_EOR
+ MSG_WAITALL = 0x100, /* Wait for a full request. */
+#define MSG_WAITALL MSG_WAITALL
+ MSG_FIN = 0x200,
+#define MSG_FIN MSG_FIN
+ MSG_SYN = 0x400,
+#define MSG_SYN MSG_SYN
+ MSG_CONFIRM = 0x800, /* Confirm path validity. */
+#define MSG_CONFIRM MSG_CONFIRM
+ MSG_RST = 0x1000,
+#define MSG_RST MSG_RST
+ MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */
+#define MSG_ERRQUEUE MSG_ERRQUEUE
+ MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */
+#define MSG_NOSIGNAL MSG_NOSIGNAL
+ 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
+ };
+
+
+/* Structure describing messages sent by
+ `sendmsg' and received by `recvmsg'. */
+struct msghdr
+ {
+ void *msg_name; /* Address to send to/receive from. */
+ socklen_t msg_namelen; /* Length of address data. */
+
+ struct iovec *msg_iov; /* Vector of data to send/receive into. */
+ size_t msg_iovlen; /* Number of elements in the vector. */
+
+ void *msg_control; /* Ancillary data (eg BSD filedesc passing). */
+ size_t msg_controllen; /* Ancillary data buffer length.
+ !! The type should be socklen_t but the
+ definition of the kernel is incompatible
+ with this. */
+
+ int msg_flags; /* Flags on received message. */
+ };
+
+/* Structure used for storage of ancillary data object information. */
+struct cmsghdr
+ {
+ size_t cmsg_len; /* Length of data in cmsg_data plus length
+ of cmsghdr structure.
+ !! The type should be socklen_t but the
+ definition of the kernel is incompatible
+ with this. */
+ int cmsg_level; /* Originating protocol. */
+ int cmsg_type; /* Protocol specific type. */
+#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+ __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
+#endif
+ };
+
+/* Ancillary data object manipulation macros. */
+#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+#else
+# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
+#endif
+#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+#define CMSG_FIRSTHDR(mhdr) \
+ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
+ ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
+ & (size_t) ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+ + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
+ struct cmsghdr *__cmsg) __THROW;
+#ifdef __USE_EXTERN_INLINES
+# ifndef _EXTERN_INLINE
+# define _EXTERN_INLINE __extern_inline
+# endif
+_EXTERN_INLINE struct cmsghdr *
+__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
+{
+ if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+ /* The kernel header does this so there may be a reason. */
+ return 0;
+
+ __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ + CMSG_ALIGN (__cmsg->cmsg_len));
+ if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
+ + __mhdr->msg_controllen)
+ || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
+ > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
+ /* No more entries. */
+ return 0;
+ return __cmsg;
+}
+#endif /* Use `extern inline'. */
+
+/* Socket level message types. This must match the definitions in
+ <linux/socket.h>. */
+enum
+ {
+ SCM_RIGHTS = 0x01 /* Transfer file descriptors. */
+#define SCM_RIGHTS SCM_RIGHTS
+#ifdef __USE_BSD
+ , SCM_CREDENTIALS = 0x02 /* Credentials passing. */
+# define SCM_CREDENTIALS SCM_CREDENTIALS
+#endif
+ };
+
+#ifdef __USE_GNU
+/* User visible structure for SCM_CREDENTIALS message */
+struct ucred
+{
+ pid_t pid; /* PID of sending process. */
+ uid_t uid; /* UID of sending process. */
+ gid_t gid; /* GID of sending process. */
+};
+#endif
+
+/* Ugly workaround for unclean kernel headers. */
+#if !defined __USE_MISC && !defined __USE_GNU
+# ifndef FIOGETOWN
+# define __SYS_SOCKET_H_undef_FIOGETOWN
+# endif
+# ifndef FIOSETOWN
+# define __SYS_SOCKET_H_undef_FIOSETOWN
+# endif
+# ifndef SIOCATMARK
+# define __SYS_SOCKET_H_undef_SIOCATMARK
+# endif
+# ifndef SIOCGPGRP
+# define __SYS_SOCKET_H_undef_SIOCGPGRP
+# endif
+# ifndef SIOCGSTAMP
+# define __SYS_SOCKET_H_undef_SIOCGSTAMP
+# endif
+# ifndef SIOCGSTAMPNS
+# define __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+# endif
+# ifndef SIOCSPGRP
+# define __SYS_SOCKET_H_undef_SIOCSPGRP
+# endif
+#endif
+
+/* Get socket manipulation related informations from kernel headers. */
+#include <asm/socket.h>
+
+#if !defined __USE_MISC && !defined __USE_GNU
+# ifdef __SYS_SOCKET_H_undef_FIOGETOWN
+# undef __SYS_SOCKET_H_undef_FIOGETOWN
+# undef FIOGETOWN
+# endif
+# ifdef __SYS_SOCKET_H_undef_FIOSETOWN
+# undef __SYS_SOCKET_H_undef_FIOSETOWN
+# undef FIOSETOWN
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCATMARK
+# undef __SYS_SOCKET_H_undef_SIOCATMARK
+# undef SIOCATMARK
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCGPGRP
+# undef __SYS_SOCKET_H_undef_SIOCGPGRP
+# undef SIOCGPGRP
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP
+# undef __SYS_SOCKET_H_undef_SIOCGSTAMP
+# undef SIOCGSTAMP
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+# undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+# undef SIOCGSTAMPNS
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCSPGRP
+# undef __SYS_SOCKET_H_undef_SIOCSPGRP
+# undef SIOCSPGRP
+# endif
+#endif
+
+/* Structure used to manipulate the SO_LINGER option. */
+struct linger
+ {
+ int l_onoff; /* Nonzero to linger on close. */
+ int l_linger; /* Time to linger. */
+ };
+
+#endif /* bits/socket.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/epoll.h b/sysdeps/unix/sysv/linux/sparc/sys/epoll.h
new file mode 100644
index 0000000000..cc0ddef69e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sys/epoll.h
@@ -0,0 +1,143 @@
+/* Copyright (C) 2002-2006, 2007, 2008 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. */
+
+#ifndef _SYS_EPOLL_H
+#define _SYS_EPOLL_H 1
+
+#include <stdint.h>
+#include <sys/types.h>
+
+/* Get __sigset_t. */
+#include <bits/sigset.h>
+
+#ifndef __sigset_t_defined
+# define __sigset_t_defined
+typedef __sigset_t sigset_t;
+#endif
+
+
+/* Flags to be passed to epoll_create2. */
+enum
+ {
+ EPOLL_CLOEXEC = 0x400000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+ EPOLL_NONBLOCK = 0x4000
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+ };
+
+
+enum EPOLL_EVENTS
+ {
+ EPOLLIN = 0x001,
+#define EPOLLIN EPOLLIN
+ EPOLLPRI = 0x002,
+#define EPOLLPRI EPOLLPRI
+ EPOLLOUT = 0x004,
+#define EPOLLOUT EPOLLOUT
+ EPOLLRDNORM = 0x040,
+#define EPOLLRDNORM EPOLLRDNORM
+ EPOLLRDBAND = 0x080,
+#define EPOLLRDBAND EPOLLRDBAND
+ EPOLLWRNORM = 0x100,
+#define EPOLLWRNORM EPOLLWRNORM
+ EPOLLWRBAND = 0x200,
+#define EPOLLWRBAND EPOLLWRBAND
+ EPOLLMSG = 0x400,
+#define EPOLLMSG EPOLLMSG
+ EPOLLERR = 0x008,
+#define EPOLLERR EPOLLERR
+ EPOLLHUP = 0x010,
+#define EPOLLHUP EPOLLHUP
+ EPOLLRDHUP = 0x2000,
+#define EPOLLRDHUP EPOLLRDHUP
+ EPOLLONESHOT = (1 << 30),
+#define EPOLLONESHOT EPOLLONESHOT
+ EPOLLET = (1 << 31)
+#define EPOLLET EPOLLET
+ };
+
+
+/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
+#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */
+#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
+#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
+
+
+typedef union epoll_data
+{
+ void *ptr;
+ int fd;
+ uint32_t u32;
+ uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event
+{
+ uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+};
+
+
+__BEGIN_DECLS
+
+/* Creates an epoll instance. Returns an fd for the new instance.
+ The "size" parameter is a hint specifying the number of file
+ descriptors to be associated with the new instance. The fd
+ returned by epoll_create() should be closed with close(). */
+extern int epoll_create (int __size) __THROW;
+
+/* Same as epoll_create but with an additional FLAGS parameter. */
+extern int epoll_create2 (int __size, int __flags) __THROW;
+
+
+/* Manipulate an epoll instance "epfd". Returns 0 in case of success,
+ -1 in case of error ( the "errno" variable will contain the
+ specific error code ) The "op" parameter is one of the EPOLL_CTL_*
+ constants defined above. The "fd" parameter is the target of the
+ operation. The "event" parameter describes which events the caller
+ is interested in and any associated user data. */
+extern int epoll_ctl (int __epfd, int __op, int __fd,
+ struct epoll_event *__event) __THROW;
+
+
+/* Wait for events on an epoll instance "epfd". Returns the number of
+ triggered events returned in "events" buffer. Or -1 in case of
+ error with the "errno" variable set to the specific error code. The
+ "events" parameter is a buffer that will contain triggered
+ events. The "maxevents" is the maximum number of events to be
+ returned ( usually size of "events" ). The "timeout" parameter
+ specifies the maximum wait time in milliseconds (-1 == infinite).
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int epoll_wait (int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout);
+
+
+/* Same as epoll_wait, but the thread's signal mask is temporarily
+ and atomically replaced with the one provided as parameter.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int epoll_pwait (int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout,
+ __const __sigset_t *__ss);
+
+__END_DECLS
+
+#endif /* sys/epoll.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/eventfd.h b/sysdeps/unix/sysv/linux/sparc/sys/eventfd.h
new file mode 100644
index 0000000000..aff4f3592e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sys/eventfd.h
@@ -0,0 +1,52 @@
+/* Copyright (C) 2007, 2008 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. */
+
+#ifndef _SYS_EVENTFD_H
+#define _SYS_EVENTFD_H 1
+
+#include <stdint.h>
+
+
+/* Type for event counter. */
+typedef uint64_t eventfd_t;
+
+/* Flags for signalfd. */
+enum
+ {
+ EFD_CLOEXEC = 0x400000,
+#define EFD_CLOEXEC EFD_CLOEXEC
+ EFD_NONBLOCK = 0x4000
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
+
+
+__BEGIN_DECLS
+
+/* Return file descriptor for generic event channel. Set initial
+ value to COUNT. */
+extern int eventfd (int __count, int __flags) __THROW;
+
+/* Read event counter and possibly wait for events. */
+extern int eventfd_read (int __fd, eventfd_t *__value);
+
+/* Increment event counter. */
+extern int eventfd_write (int __fd, eventfd_t value);
+
+__END_DECLS
+
+#endif /* sys/eventfd.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/inotify.h b/sysdeps/unix/sysv/linux/sparc/sys/inotify.h
new file mode 100644
index 0000000000..b1fccc42c6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sys/inotify.h
@@ -0,0 +1,105 @@
+/* Copyright (C) 2005, 2006, 2008 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. */
+
+#ifndef _SYS_INOTIFY_H
+#define _SYS_INOTIFY_H 1
+
+#include <stdint.h>
+
+
+/* Flags for the parameter of inotify_init1. */
+enum
+ {
+ IN_CLOEXEC = 0x400000,
+#define IN_CLOEXEC IN_CLOEXEC
+ IN_NONBLOCK = 0x4000
+#define IN_NONBLOCK IN_NONBLOCK
+ };
+
+
+/* Structure describing an inotify event. */
+struct inotify_event
+{
+ int wd; /* Watch descriptor. */
+ uint32_t mask; /* Watch mask. */
+ uint32_t cookie; /* Cookie to synchronize two events. */
+ uint32_t len; /* Length (including NULs) of name. */
+ char name __flexarr; /* Name. */
+};
+
+
+/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */
+#define IN_ACCESS 0x00000001 /* File was accessed. */
+#define IN_MODIFY 0x00000002 /* File was modified. */
+#define IN_ATTRIB 0x00000004 /* Metadata changed. */
+#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */
+#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */
+#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
+#define IN_OPEN 0x00000020 /* File was opened. */
+#define IN_MOVED_FROM 0x00000040 /* File was moved from X. */
+#define IN_MOVED_TO 0x00000080 /* File was moved to Y. */
+#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
+#define IN_CREATE 0x00000100 /* Subfile was created. */
+#define IN_DELETE 0x00000200 /* Subfile was deleted. */
+#define IN_DELETE_SELF 0x00000400 /* Self was deleted. */
+#define IN_MOVE_SELF 0x00000800 /* Self was moved. */
+
+/* Events sent by the kernel. */
+#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */
+#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */
+#define IN_IGNORED 0x00008000 /* File was ignored. */
+
+/* Helper events. */
+#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
+#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
+
+/* Special flags. */
+#define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a
+ directory. */
+#define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */
+#define IN_MASK_ADD 0x20000000 /* Add to the mask of an already
+ existing watch. */
+#define IN_ISDIR 0x40000000 /* Event occurred against dir. */
+#define IN_ONESHOT 0x80000000 /* Only send event once. */
+
+/* All events which a program can wait on. */
+#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \
+ | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \
+ | IN_MOVED_TO | IN_CREATE | IN_DELETE \
+ | IN_DELETE_SELF | IN_MOVE_SELF)
+
+
+__BEGIN_DECLS
+
+/* Create and initialize inotify instance. */
+extern int inotify_init (void) __THROW;
+
+/* Create and initialize inotify instance. */
+extern int inotify_init1 (int __flags) __THROW;
+
+/* Add watch of object NAME to inotify instance FD. Notify about
+ events specified by MASK. */
+extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask)
+ __THROW;
+
+/* Remove the watch specified by WD from the inotify instance FD. */
+extern int inotify_rm_watch (int __fd, uint32_t __wd) __THROW;
+
+__END_DECLS
+
+#endif /* sys/inotify.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h b/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h
new file mode 100644
index 0000000000..a134cc7bab
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h
@@ -0,0 +1,66 @@
+/* Copyright (C) 2007, 2008 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. */
+
+#ifndef _SYS_SIGNALFD_H
+#define _SYS_SIGNALFD_H 1
+
+#define __need_sigset_t
+#include <signal.h>
+#include <stdint.h>
+
+
+struct signalfd_siginfo
+{
+ uint32_t ssi_signo;
+ int32_t ssi_errno;
+ int32_t ssi_code;
+ uint32_t ssi_pid;
+ uint32_t ssi_uid;
+ int32_t ssi_fd;
+ uint32_t ssi_tid;
+ uint32_t ssi_band;
+ uint32_t ssi_overrun;
+ uint32_t ssi_trapno;
+ int32_t ssi_status;
+ int32_t ssi_int;
+ uint64_t ssi_ptr;
+ uint64_t ssi_utime;
+ uint64_t ssi_stime;
+ uint64_t ssi_addr;
+ uint8_t __pad[48];
+};
+
+/* Flags for signalfd. */
+enum
+ {
+ SFD_CLOEXEC = 0x400000,
+#define SFD_CLOEXEC SFD_CLOEXEC
+ SFD_NONBLOCK = 0x4000
+#define SFD_NONBLOCK SFD_NONBLOCK
+ };
+
+__BEGIN_DECLS
+
+/* Request notification for delivery of signals in MASK to be
+ performed using descriptor FD.*/
+extern int signalfd (int __fd, const sigset_t *__mask, int __flags)
+ __nonnull ((2)) __THROW;
+
+__END_DECLS
+
+#endif /* sys/signalfd.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h b/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h
new file mode 100644
index 0000000000..833d050fb8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h
@@ -0,0 +1,60 @@
+/* Copyright (C) 2008 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. */
+
+#ifndef _SYS_TIMERFD_H
+#define _SYS_TIMERFD_H 1
+
+#include <time.h>
+
+
+/* Bits to be set in the FLAGS parameter of `timerfd_create'. */
+enum
+ {
+ TFD_CLOEXEC = 0x400000,
+#define TFD_CLOEXEC TFD_CLOEXEC
+ TFD_NONBLOCK = 0x4000
+#define TFD_NONBLOCK TFD_NONBLOCK
+ };
+
+
+/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
+enum
+ {
+ TFD_TIMER_ABSTIME = 1 << 0
+#define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME
+ };
+
+
+__BEGIN_DECLS
+
+/* Return file descriptor for new interval timer source. */
+extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW;
+
+/* Set next expiration time of interval timer source UFD to UTMR. If
+ FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
+ absolute. Optionally return the old expiration time in OTMR. */
+extern int timerfd_settime (int __ufd, int __flags,
+ __const struct itimerspec *__utmr,
+ struct itimerspec *__otmr) __THROW;
+
+/* Return the next expiration time of UFD. */
+extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW;
+
+__END_DECLS
+
+#endif /* sys/timerfd.h */
diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h
index f4e8bda99a..aa8784b1ee 100644
--- a/sysdeps/unix/sysv/linux/sys/epoll.h
+++ b/sysdeps/unix/sysv/linux/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007, 2008 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
@@ -31,6 +31,16 @@ typedef __sigset_t sigset_t;
#endif
+/* Flags to be passed to epoll_create2. */
+enum
+ {
+ EPOLL_CLOEXEC = 02000000,
+#define EPOLL_CLOEXEC EPOLL_CLOEXEC
+ EPOLL_NONBLOCK = 04000
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+ };
+
+
enum EPOLL_EVENTS
{
EPOLLIN = 0x001,
@@ -63,9 +73,9 @@ enum EPOLL_EVENTS
/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
-#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */
-#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */
-#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */
+#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */
+#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
+#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
typedef union epoll_data
@@ -91,6 +101,9 @@ __BEGIN_DECLS
returned by epoll_create() should be closed with close(). */
extern int epoll_create (int __size) __THROW;
+/* Same as epoll_create but with an additional FLAGS parameter. */
+extern int epoll_create2 (int __size, int __flags) __THROW;
+
/* Manipulate an epoll instance "epfd". Returns 0 in case of success,
-1 in case of error ( the "errno" variable will contain the
diff --git a/sysdeps/unix/sysv/linux/sys/eventfd.h b/sysdeps/unix/sysv/linux/sys/eventfd.h
index 1ebaea7b30..205824b669 100644
--- a/sysdeps/unix/sysv/linux/sys/eventfd.h
+++ b/sysdeps/unix/sysv/linux/sys/eventfd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2008 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
@@ -25,6 +25,15 @@
/* Type for event counter. */
typedef uint64_t eventfd_t;
+/* Flags for signalfd. */
+enum
+ {
+ EFD_CLOEXEC = 02000000,
+#define EFD_CLOEXEC EFD_CLOEXEC
+ EFD_NONBLOCK = 04000
+#define EFD_NONBLOCK EFD_NONBLOCK
+ };
+
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/sys/inotify.h b/sysdeps/unix/sysv/linux/sys/inotify.h
index 0131db9d3e..81e31fb646 100644
--- a/sysdeps/unix/sysv/linux/sys/inotify.h
+++ b/sysdeps/unix/sysv/linux/sys/inotify.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2008 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
@@ -22,6 +22,16 @@
#include <stdint.h>
+/* Flags for the parameter of inotify_init1. */
+enum
+ {
+ IN_CLOEXEC = 02000000,
+#define IN_CLOEXEC IN_CLOEXEC
+ IN_NONBLOCK = 04000
+#define IN_NONBLOCK IN_NONBLOCK
+ };
+
+
/* Structure describing an inotify event. */
struct inotify_event
{
@@ -79,6 +89,9 @@ __BEGIN_DECLS
/* Create and initialize inotify instance. */
extern int inotify_init (void) __THROW;
+/* Create and initialize inotify instance. */
+extern int inotify_init1 (int __flags) __THROW;
+
/* Add watch of object NAME to inotify instance FD. Notify about
events specified by MASK. */
extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask)
diff --git a/sysdeps/unix/sysv/linux/sys/signalfd.h b/sysdeps/unix/sysv/linux/sys/signalfd.h
index 7a7f53ba32..dae71a400e 100644
--- a/sysdeps/unix/sysv/linux/sys/signalfd.h
+++ b/sysdeps/unix/sysv/linux/sys/signalfd.h
@@ -45,6 +45,14 @@ struct signalfd_siginfo
uint8_t __pad[48];
};
+/* Flags for signalfd. */
+enum
+ {
+ SFD_CLOEXEC = 02000000,
+#define SFD_CLOEXEC SFD_CLOEXEC
+ SFD_NONBLOCK = 04000
+#define SFD_NONBLOCK SFD_NONBLOCK
+ };
__BEGIN_DECLS
diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h
index 0a4b81c9b7..c1bb06f5ff 100644
--- a/sysdeps/unix/sysv/linux/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/sys/timerfd.h
@@ -22,6 +22,16 @@
#include <time.h>
+/* Bits to be set in the FLAGS parameter of `timerfd_create'. */
+enum
+ {
+ TFD_CLOEXEC = 02000000,
+#define TFD_CLOEXEC TFD_CLOEXEC
+ TFD_NONBLOCK = 04000
+#define TFD_NONBLOCK TFD_NONBLOCK
+ };
+
+
/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
enum
{
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index b3ecf9f478..f654d5ee00 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -8,6 +8,7 @@ creat - creat Ci:si __libc_creat creat
create_module EXTRA create_module 3 create_module
delete_module EXTRA delete_module 3 delete_module
epoll_create EXTRA epoll_create i:i epoll_create
+epoll_create2 EXTRA epoll_create2 i:ii epoll_create2
epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
fdatasync - fdatasync Ci:i fdatasync
@@ -26,6 +27,7 @@ getsid - getsid i:i getsid
init_module EXTRA init_module 5 init_module
inotify_add_watch EXTRA inotify_add_watch i:isi inotify_add_watch
inotify_init EXTRA inotify_init i: inotify_init
+inotify_init1 EXTRA inotify_init1 i:I inotify_init1
inotify_rm_watch EXTRA inotify_rm_watch i:ii inotify_rm_watch
ioperm - ioperm i:iii ioperm
iopl - iopl i:i iopl
@@ -45,6 +47,7 @@ nfsservctl EXTRA nfsservctl i:ipp nfsservctl
pause - pause Ci: __libc_pause pause
personality EXTRA personality i:i __personality personality
pipe - pipe i:f __pipe pipe
+pipe2 - pipe2 i:fi __pipe2 pipe2
pivot_root EXTRA pivot_root i:ss pivot_root
prctl EXTRA prctl i:iiiii __prctl prctl
putpmsg - putpmsg i:ippii putpmsg