diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/Makefile | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/chown.c | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/getgroups.c | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/pread.c | 55 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/pread64.c | 60 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/pwrite.c | 55 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/pwrite64.c | 57 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/s_pread64.S | 55 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/s_pwrite64.S | 55 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setfsgid.c | 15 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setfsuid.c | 15 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setgid.c | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setgroups.c | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setregid.c | 42 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setresgid.c | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setresuid.c | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setreuid.c | 42 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setuid.c | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/syscalls.list | 9 |
19 files changed, 357 insertions, 162 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile index 29011fd22e..38987e4202 100644 --- a/sysdeps/unix/sysv/linux/i386/Makefile +++ b/sysdeps/unix/sysv/linux/i386/Makefile @@ -1,6 +1,5 @@ ifeq ($(subdir),misc) -sysdep_routines += ioperm iopl vm86 s_pread64 s_pwrite64 setfsgid setfsuid \ - setresgid setresuid +sysdep_routines += ioperm iopl vm86 setfsgid setfsuid setresgid setresuid sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h endif diff --git a/sysdeps/unix/sysv/linux/i386/chown.c b/sysdeps/unix/sysv/linux/i386/chown.c index 9d864d0697..3776a4490c 100644 --- a/sysdeps/unix/sysv/linux/i386/chown.c +++ b/sysdeps/unix/sysv/linux/i386/chown.c @@ -18,6 +18,8 @@ #include <errno.h> #include <unistd.h> + +#include <sysdep.h> #include <sys/syscall.h> /* @@ -45,7 +47,7 @@ __real_chown (const char *file, uid_t owner, gid_t group) if (!__libc_old_chown) { int saved_errno = errno; - result = __syscall_chown (file, owner, group); + result = INLINE_SYSCALL (chown, 3, file, owner, group); if (result >= 0 || errno != ENOSYS) return result; @@ -64,7 +66,7 @@ __real_chown (const char *file, uid_t owner, gid_t group) int __chown_is_lchown (const char *file, uid_t owner, gid_t group) { - return __syscall_chown (file, owner, group); + return INLINE_SYSCALL (chown, 3, file, owner, group); } #elif defined HAVE_ELF && defined PIC && defined DO_VERSIONING /* Compiling for compatibiity. */ diff --git a/sysdeps/unix/sysv/linux/i386/getgroups.c b/sysdeps/unix/sysv/linux/i386/getgroups.c index 2b8f9575fb..c306dd1268 100644 --- a/sysdeps/unix/sysv/linux/i386/getgroups.c +++ b/sysdeps/unix/sysv/linux/i386/getgroups.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 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 @@ -16,9 +16,11 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <errno.h> #include <sys/types.h> #include <unistd.h> +#include <sysdep.h> #include <linux/posix_types.h> extern int __syscall_getgroups __P ((int, __kernel_gid_t *)); @@ -33,7 +35,7 @@ __getgroups (n, groups) int i, ngids; __kernel_gid_t kernel_groups[n]; - ngids = __syscall_getgroups (n, kernel_groups); + ngids = INLINE_SYSCALL (getgroups, 2, n, kernel_groups); if (n != 0 && ngids > 0) for (i = 0; i < ngids; i++) groups[i] = kernel_groups[i]; diff --git a/sysdeps/unix/sysv/linux/i386/pread.c b/sysdeps/unix/sysv/linux/i386/pread.c new file mode 100644 index 0000000000..4c2f18d3f2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/pread.c @@ -0,0 +1,55 @@ +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + 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. */ + +#include <errno.h> +#include <unistd.h> + +#include <sysdep.h> +#include <sys/syscall.h> + +#ifdef __NR_pread + +static ssize_t __emulate_pread (int fd, void *buf, size_t count, + off_t offset) internal_function; + + +ssize_t +__pread (fd, buf, count, offset) + int fd; + void *buf; + size_t count; + off_t offset; +{ + ssize_t result; + + /* First try the syscall. */ + result = INLINE_SYSCALL (pread, 5, fd, buf, count, offset, 0); + if (result == -1 && errno == ENOSYS) + /* No system call available. Use the emulation. */ + result = __emulate_pread (fd, buf, count, offset); + + return result; +} + +weak_alias (__pread, pread) + +#define __pread(fd, buf, count, offset) \ + static internal_function __emulate_pread (fd, buf, count, offset) +#endif +#include <sysdeps/posix/pread.c> diff --git a/sysdeps/unix/sysv/linux/i386/pread64.c b/sysdeps/unix/sysv/linux/i386/pread64.c new file mode 100644 index 0000000000..8cfb3c0a43 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/pread64.c @@ -0,0 +1,60 @@ +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + 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. */ + +#include <errno.h> +#include <unistd.h> + +#include <sysdep.h> +#include <sys/syscall.h> + +#ifdef __NR_pread + +extern ssize_t __syscall_pread64 (int fd, void *buf, size_t count, + off_t offset_hi, off_t offset_lo); + +static ssize_t __emulate_pread64 (int fd, void *buf, size_t count, + off64_t offset) internal_function; + + +ssize_t +__pread64 (fd, buf, count, offset) + int fd; + void *buf; + size_t count; + off64_t offset; +{ + ssize_t result; + + /* First try the syscall. */ + result = INLINE_SYSCALL (pread, 5, fd, buf, count, + (off_t) (offset & 0xffffffff), + (off_t) (offset >> 32)); + if (result == -1 && errno == ENOSYS) + /* No system call available. Use the emulation. */ + result = __emulate_pread64 (fd, buf, count, offset); + + return result; +} + +weak_alias (__pread64, pread64) + +#define __pread64(fd, buf, count, offset) \ + static internal_function __emulate_pread64 (fd, buf, count, offset) +#endif +#include <sysdeps/posix/pread64.c> diff --git a/sysdeps/unix/sysv/linux/i386/pwrite.c b/sysdeps/unix/sysv/linux/i386/pwrite.c new file mode 100644 index 0000000000..a1fc99f156 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/pwrite.c @@ -0,0 +1,55 @@ +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + 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. */ + +#include <errno.h> +#include <unistd.h> + +#include <sysdep.h> +#include <sys/syscall.h> + +#ifdef __NR_pwrite + +static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count, + off_t offset) internal_function; + + +ssize_t +__pwrite (fd, buf, count, offset) + int fd; + const void *buf; + size_t count; + off_t offset; +{ + ssize_t result; + + /* First try the syscall. */ + result = INLINE_SYSCALL (pwrite, 5, fd, buf, count, offset, 0); + if (result == -1 && errno == ENOSYS) + /* No system call available. Use the emulation. */ + result = __emulate_pwrite (fd, buf, count, offset); + + return result; +} + +weak_alias (__pwrite, pwrite) + +#define __pwrite(fd, buf, count, offset) \ + static internal_function __emulate_pwrite (fd, buf, count, offset) +#endif +#include <sysdeps/posix/pwrite.c> diff --git a/sysdeps/unix/sysv/linux/i386/pwrite64.c b/sysdeps/unix/sysv/linux/i386/pwrite64.c new file mode 100644 index 0000000000..7a5d665de3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/pwrite64.c @@ -0,0 +1,57 @@ +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + 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. */ + +#include <errno.h> +#include <unistd.h> + +#include <sysdep.h> +#include <sys/syscall.h> + +#ifdef __NR_pwrite + +static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count, + off64_t offset) internal_function; + + +ssize_t +__pwrite64 (fd, buf, count, offset) + int fd; + const void *buf; + size_t count; + off64_t offset; +{ + ssize_t result; + + /* First try the syscall. */ + result = INLINE_SYSCALL (pwrite, 5, fd, buf, count, + (off_t) (offset & 0xffffffff), + (off_t) (offset >> 32)); + if (result == -1 && errno == ENOSYS) + /* No system call available. Use the emulation. */ + result = __emulate_pwrite64 (fd, buf, count, offset); + + return result; +} + +weak_alias (__pwrite64, pwrite64) + +#define __pwrite64(fd, buf, count, offset) \ + static internal_function __emulate_pwrite64 (fd, buf, count, offset) +#endif +#include <sysdeps/posix/pwrite64.c> diff --git a/sysdeps/unix/sysv/linux/i386/s_pread64.S b/sysdeps/unix/sysv/linux/i386/s_pread64.S deleted file mode 100644 index 7817cf7980..0000000000 --- a/sysdeps/unix/sysv/linux/i386/s_pread64.S +++ /dev/null @@ -1,55 +0,0 @@ -/* pread64 syscall for Linux/ix86. - Copyright (C) 1997, 1998 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - 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. */ - -#include <sysdep.h> -#include <asm/errno.h> - -/* Please consult the file sysdeps/unix/sysv/linux/i386/sysdep.h for - more information about the value -4095 used below.*/ - - .text -ENTRY (__syscall_pread64) - -#ifndef __NR_pread - movl $-ENOSYS,%eax -# ifndef PIC - jmp syscall_error -# endif -#else - - PUSHARGS_5 /* Save register contents. */ - - /* Load arguments. This is unfortunately a little bit of a problem - since the kernel expects the arguments in a different order. */ - movl 0x20(%esp,1),%esi - movl 0x1c(%esp,1),%edi - movl 0x18(%esp,1),%edx - movl 0x14(%esp,1),%ecx - movl 0x10(%esp,1),%ebx - /* Load syscall number into %eax. */ - movl $SYS_ify(pread), %eax - int $0x80 /* Do the system call. */ - POPARGS_5 /* Restore register contents. */ - cmpl $-4095, %eax /* Check %eax for error. */ - jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */ -#endif -L(pseudo_end): - ret /* Return to caller. */ - -PSEUDO_END (__syscall_pread64) diff --git a/sysdeps/unix/sysv/linux/i386/s_pwrite64.S b/sysdeps/unix/sysv/linux/i386/s_pwrite64.S deleted file mode 100644 index 89449b6fb5..0000000000 --- a/sysdeps/unix/sysv/linux/i386/s_pwrite64.S +++ /dev/null @@ -1,55 +0,0 @@ -/* pwrite64 syscall for Linux/ix86. - Copyright (C) 1997, 1998 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - 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. */ - -#include <sysdep.h> -#include <asm/errno.h> - -/* Please consult the file sysdeps/unix/sysv/linux/i386/sysdep.h for - more information about the value -4095 used below.*/ - - .text -ENTRY (__syscall_pwrite64) - -#ifndef __NR_pwrite - movl $-ENOSYS,%eax -# ifndef PIC - jmp syscall_error -# endif -#else - - PUSHARGS_5 /* Save register contents. */ - - /* Load arguments. This is unfortunately a little bit of a problem - since the kernel expects the arguments in a different order. */ - movl 0x20(%esp,1),%esi - movl 0x1c(%esp,1),%edi - movl 0x18(%esp,1),%edx - movl 0x14(%esp,1),%ecx - movl 0x10(%esp,1),%ebx - /* Load syscall number into %eax. */ - movl $SYS_ify(pwrite), %eax - int $0x80 /* Do the system call. */ - POPARGS_5 /* Restore register contents. */ - cmpl $-4095, %eax /* Check %eax for error. */ - jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */ -#endif -L(pseudo_end): - ret /* Return to caller. */ - -PSEUDO_END (__syscall_pwrite64) diff --git a/sysdeps/unix/sysv/linux/i386/setfsgid.c b/sysdeps/unix/sysv/linux/i386/setfsgid.c index 4af26f554d..1614431ada 100644 --- a/sysdeps/unix/sysv/linux/i386/setfsgid.c +++ b/sysdeps/unix/sysv/linux/i386/setfsgid.c @@ -17,9 +17,11 @@ Boston, MA 02111-1307, USA. */ #include <errno.h> -#include <sys/syscall.h> -#include <sys/types.h> #include <unistd.h> +#include <sys/types.h> + +#include <sysdep.h> +#include <sys/syscall.h> #include <linux/posix_types.h> @@ -35,13 +37,6 @@ setfsgid (gid_t gid) return -1; } - return __syscall_setfsgid (gid); -} -#else -int -setfsgid (gid_t gid) -{ - __set_errno (ENOSYS); - return -1; + return INLINE_SYSCALL (setfsgid, 1, gid); } #endif diff --git a/sysdeps/unix/sysv/linux/i386/setfsuid.c b/sysdeps/unix/sysv/linux/i386/setfsuid.c index 5133dc0045..a2983a5e7a 100644 --- a/sysdeps/unix/sysv/linux/i386/setfsuid.c +++ b/sysdeps/unix/sysv/linux/i386/setfsuid.c @@ -17,9 +17,11 @@ Boston, MA 02111-1307, USA. */ #include <errno.h> -#include <sys/syscall.h> -#include <sys/types.h> #include <unistd.h> +#include <sys/types.h> + +#include <sysdep.h> +#include <sys/syscall.h> #include <linux/posix_types.h> @@ -35,13 +37,6 @@ setfsuid (uid_t uid) return -1; } - return __syscall_setfsuid (uid); -} -#else -int -setfsuid (uid_t uid) -{ - __set_errno (ENOSYS); - return -1; + return INLINE_SYSCALL (setfsuid, 1, uid); } #endif diff --git a/sysdeps/unix/sysv/linux/i386/setgid.c b/sysdeps/unix/sysv/linux/i386/setgid.c index 87fbd74e05..2ab8dfda34 100644 --- a/sysdeps/unix/sysv/linux/i386/setgid.c +++ b/sysdeps/unix/sysv/linux/i386/setgid.c @@ -17,9 +17,11 @@ Boston, MA 02111-1307, USA. */ #include <errno.h> -#include <sys/syscall.h> -#include <sys/types.h> #include <unistd.h> +#include <sys/types.h> + +#include <sysdep.h> +#include <sys/syscall.h> #include <linux/posix_types.h> @@ -35,6 +37,6 @@ __setgid (gid_t gid) return -1; } - return __syscall_setgid (gid); + return INLINE_SYSCALL (setgid, 1, gid); } weak_alias (__setgid, setgid) diff --git a/sysdeps/unix/sysv/linux/i386/setgroups.c b/sysdeps/unix/sysv/linux/i386/setgroups.c index 38e62a8217..ad2a6b5493 100644 --- a/sysdeps/unix/sysv/linux/i386/setgroups.c +++ b/sysdeps/unix/sysv/linux/i386/setgroups.c @@ -17,9 +17,12 @@ Boston, MA 02111-1307, USA. */ #include <errno.h> -#include <sys/types.h> -#include <unistd.h> #include <grp.h> +#include <unistd.h> +#include <sys/types.h> + +#include <sysdep.h> +#include <sys/syscall.h> #include <linux/posix_types.h> @@ -45,5 +48,6 @@ setgroups (n, groups) return -1; } } - return __syscall_setgroups (n, kernel_groups); + + return INLINE_SYSCALL (setgroups, 2, n, kernel_groups); } diff --git a/sysdeps/unix/sysv/linux/i386/setregid.c b/sysdeps/unix/sysv/linux/i386/setregid.c new file mode 100644 index 0000000000..98603bd2a2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/setregid.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1998 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + 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. */ + +#include <errno.h> +#include <sys/types.h> +#include <unistd.h> + +#include <sysdep.h> +#include <sys/syscall.h> + +#include <linux/posix_types.h> + +extern int __syscall_setregid (__kernel_gid_t, __kernel_gid_t); + +int +__setregid (gid_t rgid, gid_t egid) +{ + if ((rgid != (gid_t) -1 && rgid != (gid_t) (__kernel_gid_t) rgid) + || (egid != (gid_t) -1 && egid != (gid_t) (__kernel_gid_t) egid)) + { + __set_errno (EINVAL); + return -1; + } + + return INLINE_SYSCALL (setregid, 2, rgid, egid); +} +weak_alias (__setregid, setregid) diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c index 20256e1ebd..ab2738582b 100644 --- a/sysdeps/unix/sysv/linux/i386/setresgid.c +++ b/sysdeps/unix/sysv/linux/i386/setresgid.c @@ -22,6 +22,7 @@ #include <linux/posix_types.h> +#include <sysdep.h> #include <sys/syscall.h> #ifdef __NR_setresgid @@ -31,14 +32,14 @@ extern int __syscall_setresgid (__kernel_gid_t rgid, __kernel_gid_t egid, int setresgid (gid_t rgid, gid_t egid, gid_t sgid) { - if ((rgid != (gid_t) ((__kernel_gid_t) rgid)) - || (egid != (gid_t) ((__kernel_gid_t) egid)) - || (sgid != (gid_t) ((__kernel_gid_t) sgid))) + if ((rgid != (gid_t) -1 && rgid != (gid_t) (__kernel_gid_t) rgid) + || (egid != (gid_t) -1 && egid != (gid_t) (__kernel_gid_t) egid) + || (sgid != (gid_t) -1 && sgid != (gid_t) (__kernel_gid_t) sgid)) { __set_errno (EINVAL); return -1; } - return __syscall_setresgid (rgid, egid, sgid); + return INLINE_SYSCALL (setresgid, 3, rgid, egid, sgid); } #endif diff --git a/sysdeps/unix/sysv/linux/i386/setresuid.c b/sysdeps/unix/sysv/linux/i386/setresuid.c index 5100681d2f..953b8294d6 100644 --- a/sysdeps/unix/sysv/linux/i386/setresuid.c +++ b/sysdeps/unix/sysv/linux/i386/setresuid.c @@ -22,6 +22,7 @@ #include <linux/posix_types.h> +#include <sysdep.h> #include <sys/syscall.h> #ifdef __NR_setresuid @@ -31,15 +32,15 @@ extern int __syscall_setresuid (__kernel_uid_t rgid, __kernel_uid_t egid, int __setresuid (uid_t ruid, uid_t euid, uid_t suid) { - if ((ruid != (uid_t) ((__kernel_uid_t) ruid)) - || (euid != (uid_t) ((__kernel_uid_t) euid)) - || (suid != (uid_t) ((__kernel_uid_t) suid))) + if ((ruid != (uid_t) -1 && ruid != (uid_t) (__kernel_uid_t) ruid) + || (euid != (uid_t) -1 && euid != (uid_t) (__kernel_uid_t) euid) + || (suid != (uid_t) -1 && suid != (uid_t) (__kernel_uid_t) suid)) { __set_errno (EINVAL); return -1; } - return __syscall_setresuid (ruid, euid, suid); + return INLINE_SYSCALL (setresuid, 3, ruid, euid, suid); } weak_alias (__setresuid, setresuid) #endif diff --git a/sysdeps/unix/sysv/linux/i386/setreuid.c b/sysdeps/unix/sysv/linux/i386/setreuid.c new file mode 100644 index 0000000000..f38f136920 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/setreuid.c @@ -0,0 +1,42 @@ +/* Copyright (C) 1998 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + 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. */ + +#include <errno.h> +#include <sys/types.h> +#include <unistd.h> + +#include <sysdep.h> +#include <sys/syscall.h> + +#include <linux/posix_types.h> + +extern int __syscall_setreuid (__kernel_uid_t, __kernel_uid_t); + +int +__setreuid (uid_t ruid, uid_t euid) +{ + if ((ruid != (uid_t) -1 && ruid != (uid_t) (__kernel_uid_t) ruid) + || (euid != (uid_t) -1 && euid != (uid_t) (__kernel_uid_t) euid)) + { + __set_errno (EINVAL); + return -1; + } + + return INLINE_SYSCALL (setreuid, 2, ruid, euid); +} +weak_alias (__setreuid, setreuid) diff --git a/sysdeps/unix/sysv/linux/i386/setuid.c b/sysdeps/unix/sysv/linux/i386/setuid.c index 3379114384..5e5346ca42 100644 --- a/sysdeps/unix/sysv/linux/i386/setuid.c +++ b/sysdeps/unix/sysv/linux/i386/setuid.c @@ -17,9 +17,11 @@ Boston, MA 02111-1307, USA. */ #include <errno.h> -#include <sys/syscall.h> -#include <sys/types.h> #include <unistd.h> +#include <sys/types.h> + +#include <sysdep.h> +#include <sys/syscall.h> #include <linux/posix_types.h> @@ -35,6 +37,6 @@ __setuid (uid_t uid) return -1; } - return __syscall_setuid (uid); + return INLINE_SYSCALL (setuid, 1, uid); } weak_alias (__setuid, setuid) diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list index e02c5cffce..b8421e9bb2 100644 --- a/sysdeps/unix/sysv/linux/i386/syscalls.list +++ b/sysdeps/unix/sysv/linux/i386/syscalls.list @@ -1,14 +1,5 @@ # File name Caller Syscall name # args Strong name Weak names modify_ldt EXTRA modify_ldt 3 __modify_ldt modify_ldt -s_chown chown chown 3 __syscall_chown -s_getgroups getgroups getgroups 2 __syscall_getgroups s_llseek llseek _llseek 5 __sys_llseek -s_setfsgid setfsgid setfsgid 1 __syscall_setfsgid -s_setfsuid setfsuid setfsuid 1 __syscall_setfsuid -s_setgid setgid setgid 1 __syscall_setgid -s_setgroups setgroups setgroups 2 __syscall_setgroups -s_setresgid setresgid setresgid 3 __syscall_setresgid -s_setresuid setresuid setresuid 3 __syscall_setresuid -s_setuid setuid setuid 1 __syscall_setuid vm86 - vm86 1 __vm86 vm86 |