diff options
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/fchmodat.c | 87 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/kernel-features.h | 16 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/brk.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S | 8 |
5 files changed, 104 insertions, 17 deletions
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c new file mode 100644 index 0000000000..de35e4376f --- /dev/null +++ b/sysdeps/unix/sysv/linux/fchmodat.c @@ -0,0 +1,87 @@ +/* Change the protections of file relative to open directory. Linux version. + Copyright (C) 2006 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 <stddef.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <alloca.h> +#include <sysdep.h> + +int +fchmodat (fd, file, mode, flag) + int fd; + const char *file; + mode_t mode; + int flag; +{ + if (flag & ~AT_SYMLINK_NOFOLLOW) + { + __set_errno (EINVAL); + return -1; + } +#ifndef __NR_lchmod /* Linux so far has no lchmod syscall. */ + if (flag & AT_SYMLINK_NOFOLLOW) + { + __set_errno (ENOTSUP); + return -1; + } +#endif + + char *buf = NULL; + + if (fd != AT_FDCWD && file[0] != '/') + { + size_t filelen = strlen (file); + static const char procfd[] = "/proc/self/fd/%d/%s"; + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number + - the file name provided. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen; + buf = alloca (buflen); + + __snprintf (buf, buflen, procfd, fd, file); + file = buf; + } + + int result; + INTERNAL_SYSCALL_DECL (err); + +#ifdef __NR_lchmod + if (flag & AT_SYMLINK_NOFOLLOW) + result = INTERNAL_SYSCALL (lchmod, err, 2, file, mode); + else +#endif + result = INTERNAL_SYSCALL (chmod, err, 2, file, mode); + + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0)) + { + __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf); + result = -1; + } + + return result; +} diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 9bbd97e6d2..3bc5dc03c2 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-2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1999-2003, 2004, 2005, 2006 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 @@ -423,8 +423,10 @@ #endif /* Starting with version 2.6.4-rc1 the getdents syscall returns d_type - information as well. */ -#if __LINUX_KERNEL_VERSION >= 132612 + information as well and in between 2.6.5 and 2.6.8 most compat wrappers + were fixed too. Except s390{,x} which was fixed in 2.6.11. */ +#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \ + || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__) # define __ASSUME_GETDENTS32_D_TYPE 1 #endif @@ -435,9 +437,11 @@ #endif /* Starting with version 2.6.9, the waitid system call is available. - Except for powerpc and powerpc64, where it is available in 2.6.12. */ -#if (__LINUX_KERNEL_VERSION >= 0x020609 && !defined __powerpc__) \ - || (__LINUX_KERNEL_VERSION >= 0x02060c && defined __powerpc__) + Except for powerpc{,64} and s390{,x}, where it is available in 2.6.12. */ +#if (__LINUX_KERNEL_VERSION >= 0x020609 \ + && !defined __powerpc__ && !defined __s390__) \ + || (__LINUX_KERNEL_VERSION >= 0x02060c \ + && (defined __powerpc__ || defined __s390__)) # define __ASSUME_WAITID_SYSCALL 1 #endif diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c index 33e51a22b2..00056bee7a 100644 --- a/sysdeps/unix/sysv/linux/mips/brk.c +++ b/sysdeps/unix/sysv/linux/mips/brk.c @@ -41,7 +41,7 @@ __brk (void *addr) "syscall" /* Perform the system call. */ : "=r" (res) : "I" (SYS_ify (brk)), "r" (addr) -+ : "$4", "$7", __SYSCALL_CLOBBERS); + : "$4", "$7", __SYSCALL_CLOBBERS); newbrk = (void *) res; } __curbrk = newbrk; diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S index 3e4a188a20..0bb5bef78b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 1999, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995,96,97,99, 2003, 2006 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 @@ -13,8 +13,8 @@ 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. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep-cancel.h> #include <socketcall.h> @@ -53,7 +53,6 @@ .text ENTRY(__socket) - cfi_startproc stwu r1,-48(r1) cfi_adjust_cfa_offset(48) #if NARGS >= 1 @@ -114,7 +113,6 @@ ENTRY(__socket) addi r1,r1,48 PSEUDO_RET #endif - cfi_endproc PSEUDO_END (__socket) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S index a73f7be666..15d8e84c1f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 1999, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995,96,97,99, 2003, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + write to the Free Software Foundation, Inc., 51 Franklin Street, + Fifth Floor, Boston MA 02110-1301, USA. */ #include <sysdep-cancel.h> #include <socketcall.h> @@ -52,7 +52,6 @@ .text ENTRY(__socket) CALL_MCOUNT NARGS - cfi_startproc stdu r1,-144(r1) cfi_adjust_cfa_offset(144) #if NARGS >= 1 @@ -117,7 +116,6 @@ ENTRY(__socket) addi r1,r1,144 PSEUDO_RET #endif - cfi_endproc PSEUDO_END (__socket) #ifndef NO_WEAK_ALIAS |