diff options
author | Andreas Schwab <aschwab@redhat.com> | 2009-06-26 13:14:24 +0200 |
---|---|---|
committer | Andreas Schwab <aschwab@redhat.com> | 2009-06-26 13:14:24 +0200 |
commit | a879c2cb1753c3aa868aa1e9d2107e9f0deb0dc2 (patch) | |
tree | a919978ad8a178a0e6013f1ee43ab54f60a13493 /sysdeps/unix | |
parent | 5f9df8e7b478cafd4528a133201f4611a963292e (diff) | |
parent | 44d20bca52ace85850012b0ead37b360e3ecd96e (diff) |
Merge commit 'origin/master' into fedora/master
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/grantpt.c | 28 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/bits/socket.h | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/grantpt.c | 88 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/lddlibc4.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/net/if_arp.h | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/bits/socket.h | 16 |
6 files changed, 47 insertions, 99 deletions
diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c index bdedbacec8..8c299e9147 100644 --- a/sysdeps/unix/grantpt.c +++ b/sysdeps/unix/grantpt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2001, 2002, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998. @@ -19,6 +19,7 @@ #include <assert.h> #include <errno.h> +#include <fcntl.h> #include <grp.h> #include <limits.h> #include <stdlib.h> @@ -115,8 +116,24 @@ grantpt (int fd) gid_t gid; pid_t pid; - if (pts_name (fd, &buf, sizeof (_buf))) - return -1; + if (__builtin_expect (pts_name (fd, &buf, sizeof (_buf)), 0)) + { + int save_errno = errno; + + /* Check, if the file descriptor is valid. pts_name returns the + wrong errno number, so we cannot use that. */ + if (__libc_fcntl (fd, F_GETFD) == -1 && errno == EBADF) + return -1; + + /* If the filedescriptor is no TTY, grantpt has to set errno + to EINVAL. */ + if (save_errno == ENOTTY) + __set_errno (EINVAL); + else + __set_errno (save_errno); + + return -1; + } if (__xstat64 (_STAT_VER, buf, &st) < 0) goto cleanup; @@ -185,7 +202,7 @@ grantpt (int fd) if (!WIFEXITED (w)) __set_errno (ENOEXEC); else - switch (WEXITSTATUS(w)) + switch (WEXITSTATUS (w)) { case 0: retval = 0; @@ -202,6 +219,9 @@ grantpt (int fd) case FAIL_EXEC: __set_errno (ENOEXEC); break; + case FAIL_ENOMEM: + __set_errno (ENOMEM); + break; default: assert(! "getpt: internal error: invalid exit code from pt_chown"); diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 88062e59ad..f23b338a35 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -1,5 +1,5 @@ /* System-specific socket constants and types. Linux version. - Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008 + Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -108,7 +108,8 @@ enum __socket_type #define PF_RXRPC 33 /* RxRPC sockets. */ #define PF_ISDN 34 /* mISDN sockets. */ #define PF_PHONET 35 /* Phonet sockets. */ -#define PF_MAX 36 /* For now.. */ +#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ +#define PF_MAX 37 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -148,6 +149,7 @@ enum __socket_type #define AF_RXRPC PF_RXRPC #define AF_ISDN PF_ISDN #define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. diff --git a/sysdeps/unix/sysv/linux/grantpt.c b/sysdeps/unix/sysv/linux/grantpt.c deleted file mode 100644 index c858f89c8b..0000000000 --- a/sysdeps/unix/sysv/linux/grantpt.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright (C) 1998, 1999, 2001, 2002, 2009 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <fcntl.h> -#include <limits.h> -#include <stdlib.h> -#include <sys/statfs.h> - -#include "linux_fsinfo.h" - -/* Prototype for function that changes ownership and access permission - for slave pseudo terminals that do not live on a `devpts' - filesystem. */ -static int __unix_grantpt (int fd); - -/* Prototype for private function that gets the name of the slave - pseudo terminal in a safe way. */ -static int pts_name (int fd, char **pts, size_t buf_len); - -/* Change the ownership and access permission of the slave pseudo - terminal associated with the master pseudo terminal specified - by FD. */ -int -grantpt (int fd) -{ - struct statfs fsbuf; -#ifdef PATH_MAX - char _buf[PATH_MAX]; -#else - char _buf[512]; -#endif - char *buf = _buf; - - if (__builtin_expect (pts_name (fd, &buf, sizeof (_buf)), 0)) - { - int save_errno = errno; - - /* Check, if the file descriptor is valid. pts_name returns the - wrong errno number, so we cannot use that. */ - if (__libc_fcntl (fd, F_GETFD) == -1 && errno == EBADF) - return -1; - - /* If the filedescriptor is no TTY, grantpt has to set errno - to EINVAL. */ - if (save_errno == ENOTTY) - __set_errno (EINVAL); - else - __set_errno (save_errno); - - return -1; - } - - if (__statfs (buf, &fsbuf) < 0) - return -1; - - /* If the slave pseudo terminal lives on a `devpts' filesystem, the - ownership is already set and the access permission might already - be set. */ - if (fsbuf.f_type == DEVPTS_SUPER_MAGIC || fsbuf.f_type == DEVFS_SUPER_MAGIC) - { - struct stat64 st; - - if (fstat (fd, &st) == 0 - && (st.st_mode & ACCESSPERMS) == (S_IRUSR|S_IWUSR|S_IWGRP)) - return 0; - } - - return __unix_grantpt (fd); -} - -#define grantpt static __unix_grantpt -#include <sysdeps/unix/grantpt.c> diff --git a/sysdeps/unix/sysv/linux/lddlibc4.c b/sysdeps/unix/sysv/linux/lddlibc4.c index 694d1291cd..6d57190508 100644 --- a/sysdeps/unix/sysv/linux/lddlibc4.c +++ b/sysdeps/unix/sysv/linux/lddlibc4.c @@ -59,8 +59,8 @@ main (int argc, char *argv[]) if (strcmp (argv[1], "--help") == 0) { printf (gettext ("Usage: lddlibc4 FILE\n\n")); - printf (gettext ("For bug reporting instructions, please see:\n\ -<http://www.gnu.org/software/libc/bugs.html>.\n")); + fputs (gettext ("For bug reporting instructions, please see:\n\ +<http://www.gnu.org/software/libc/bugs.html>.\n"), stdout); return 0; } else if (strcmp (argv[1], "--version") == 0) diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h index 9608652ee4..97cb61f62b 100644 --- a/sysdeps/unix/sysv/linux/net/if_arp.h +++ b/sysdeps/unix/sysv/linux/net/if_arp.h @@ -1,5 +1,5 @@ /* Definitions for Address Resolution Protocol. - Copyright (C) 1997,1999,2001,2006 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2001,2006,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -128,6 +128,8 @@ struct arphdr #define ARPHRD_IEEE80211 801 /* IEEE 802.11. */ #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header. */ #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header. */ +#define ARPHRD_IEEE802154 804 /* IEEE 802.15.4 header. */ +#define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */ #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known. */ #define ARPHRD_NONE 0xFFFE /* Zero header length. */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/socket.h b/sysdeps/unix/sysv/linux/sparc/bits/socket.h index d43a3cdf79..a148072095 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/socket.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/socket.h @@ -1,5 +1,5 @@ /* System-specific socket constants and types. Linux/SPARC version. - Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008 + Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -94,15 +94,21 @@ enum __socket_type #define PF_ASH 18 /* Ash. */ #define PF_ECONET 19 /* Acorn Econet. */ #define PF_ATMSVC 20 /* ATM SVCs. */ +#define PF_RDS 21 /* RDS sockets. */ #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_LLC 26 /* Linux LLC. */ +#define PF_CAN 29 /* Controller Area Network. */ +#define PF_TIPC 30 /* TIPC 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.. */ +#define PF_PHONET 35 /* Phonet sockets. */ +#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ +#define PF_MAX 37 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -129,14 +135,20 @@ enum __socket_type #define AF_ASH PF_ASH #define AF_ECONET PF_ECONET #define AF_ATMSVC PF_ATMSVC +#define AF_RDS PF_RDS #define AF_SNA PF_SNA #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH #define AF_IUCV PF_IUCV #define AF_RXRPC PF_RXRPC #define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. |