diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-07-28 23:34:19 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2008-07-28 23:34:19 +0000 |
commit | c7045198ca8f4ff5b97205340d51127f8503c2bd (patch) | |
tree | 387ee7a78760f683df6035af28d665e3972aa30b /sysdeps | |
parent | c83494a925f4b4b716f9ba3abcb5e695d3e2a8a9 (diff) | |
download | glibc-c7045198ca8f4ff5b97205340d51127f8503c2bd.tar glibc-c7045198ca8f4ff5b97205340d51127f8503c2bd.tar.gz glibc-c7045198ca8f4ff5b97205340d51127f8503c2bd.tar.bz2 glibc-c7045198ca8f4ff5b97205340d51127f8503c2bd.zip |
Updated to fedora-glibc-20080728T2320cvs/fedora-glibc-2_8_90-10
Diffstat (limited to 'sysdeps')
58 files changed, 2928 insertions, 48 deletions
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 |