* sysdeps/unix/opendir.c: Use O_DIRECTORY if available.  If not
	available double check to verify it's a directory.

	* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Add O_DIRECTORY.
	* sysdeps/unix/sysv/linux/mips/bits/fcntl: Likewise.
	* sysdeps/unix/sysv/linux/bits/fcntl.h: Remove O_* constants which
	are not generally available.
	* sysdeps/unix/sysv/linux/i386/bits/fcntl.h: New file.

	* sysdeps/unix/sysv/linux/i386/setgroups.c: Add range check for values.
	* sysdeps/unix/sysv/linux/arm/Makefile: New file.
	* sysdeps/unix/sysv/linux/arm/setegid.c: New file.
	* sysdeps/unix/sysv/linux/arm/seteuid.c: New file.
	* sysdeps/unix/sysv/linux/arm/setfsgid.c: New file.
	* sysdeps/unix/sysv/linux/arm/setfsuid.c: New file.
	* sysdeps/unix/sysv/linux/arm/setgid.c: New file.
	* sysdeps/unix/sysv/linux/arm/setgroups.c: New file.
	* sysdeps/unix/sysv/linux/arm/setresgid.c: New file.
	* sysdeps/unix/sysv/linux/arm/setresuid.c: New file.
	* sysdeps/unix/sysv/linux/arm/setuid.c: New file.
	* sysdeps/unix/sysv/linux/i386/setegid.c: New file.
	* sysdeps/unix/sysv/linux/i386/seteuid.c: New file.
	* sysdeps/unix/sysv/linux/i386/setfsgid.c: New file.
	* sysdeps/unix/sysv/linux/i386/setfsuid.c: New file.
	* sysdeps/unix/sysv/linux/i386/setgid.c: New file.
	* sysdeps/unix/sysv/linux/i386/setgroups.c: New file.
	* sysdeps/unix/sysv/linux/i386/setresgid.c: New file.
	* sysdeps/unix/sysv/linux/i386/setresuid.c: New file.
	* sysdeps/unix/sysv/linux/i386/setuid.c: New file.
	* sysdeps/unix/sysv/linux/m68k/setegid.c: New file.
	* sysdeps/unix/sysv/linux/m68k/seteuid.c: New file.
	* sysdeps/unix/sysv/linux/m68k/setfsgid.c: New file.
	* sysdeps/unix/sysv/linux/m68k/setfsuid.c: New file.
	* sysdeps/unix/sysv/linux/m68k/setgid.c: New file.
	* sysdeps/unix/sysv/linux/m68k/setgroups.c: New file.
	* sysdeps/unix/sysv/linux/m68k/setresgid.c: New file.
	* sysdeps/unix/sysv/linux/m68k/setresuid.c: New file.
	* sysdeps/unix/sysv/linux/m68k/setuid.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setfsgid.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setfsuid.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c: New file.

	* sysdeps/unix/sysv/linux/arm/syscalls.list: Add s_setgid, s_setresuid,
	s_setresgid, and s_setuid.
	* sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/i386/Makefile [subdir=misc]
	(sysdep_routines): Add setfsgid, setfsuid, setresgid, and setresuid.
	* sysdeps/unix/sysv/linux/m68k/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/Makefile: Likewise.

1998-10-16  Ulrich Drepper  <drepper@cygnus.com>

	* iconv/skeleton.c: Include ELF header only of STATIC_GCONV is not
This commit is contained in:
Ulrich Drepper 1998-10-16 16:33:36 +00:00
parent 39e4f7f84e
commit 9ffbb61221
40 changed files with 646 additions and 16 deletions

View File

@ -1,3 +1,63 @@
1998-10-16 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/opendir.c: Use O_DIRECTORY if available. If not
available double check to verify it's a directory.
* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Add O_DIRECTORY.
* sysdeps/unix/sysv/linux/mips/bits/fcntl: Likewise.
* sysdeps/unix/sysv/linux/bits/fcntl.h: Remove O_* constants which
are not generally available.
* sysdeps/unix/sysv/linux/i386/bits/fcntl.h: New file.
* sysdeps/unix/sysv/linux/i386/setgroups.c: Add range check for values.
* sysdeps/unix/sysv/linux/arm/Makefile: New file.
* sysdeps/unix/sysv/linux/arm/setegid.c: New file.
* sysdeps/unix/sysv/linux/arm/seteuid.c: New file.
* sysdeps/unix/sysv/linux/arm/setfsgid.c: New file.
* sysdeps/unix/sysv/linux/arm/setfsuid.c: New file.
* sysdeps/unix/sysv/linux/arm/setgid.c: New file.
* sysdeps/unix/sysv/linux/arm/setgroups.c: New file.
* sysdeps/unix/sysv/linux/arm/setresgid.c: New file.
* sysdeps/unix/sysv/linux/arm/setresuid.c: New file.
* sysdeps/unix/sysv/linux/arm/setuid.c: New file.
* sysdeps/unix/sysv/linux/i386/setegid.c: New file.
* sysdeps/unix/sysv/linux/i386/seteuid.c: New file.
* sysdeps/unix/sysv/linux/i386/setfsgid.c: New file.
* sysdeps/unix/sysv/linux/i386/setfsuid.c: New file.
* sysdeps/unix/sysv/linux/i386/setgid.c: New file.
* sysdeps/unix/sysv/linux/i386/setgroups.c: New file.
* sysdeps/unix/sysv/linux/i386/setresgid.c: New file.
* sysdeps/unix/sysv/linux/i386/setresuid.c: New file.
* sysdeps/unix/sysv/linux/i386/setuid.c: New file.
* sysdeps/unix/sysv/linux/m68k/setegid.c: New file.
* sysdeps/unix/sysv/linux/m68k/seteuid.c: New file.
* sysdeps/unix/sysv/linux/m68k/setfsgid.c: New file.
* sysdeps/unix/sysv/linux/m68k/setfsuid.c: New file.
* sysdeps/unix/sysv/linux/m68k/setgid.c: New file.
* sysdeps/unix/sysv/linux/m68k/setgroups.c: New file.
* sysdeps/unix/sysv/linux/m68k/setresgid.c: New file.
* sysdeps/unix/sysv/linux/m68k/setresuid.c: New file.
* sysdeps/unix/sysv/linux/m68k/setuid.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/setfsgid.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/setfsuid.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c: New file.
* sysdeps/unix/sysv/linux/arm/syscalls.list: Add s_setgid, s_setresuid,
s_setresgid, and s_setuid.
* sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/i386/Makefile [subdir=misc]
(sysdep_routines): Add setfsgid, setfsuid, setresgid, and setresuid.
* sysdeps/unix/sysv/linux/m68k/Makefile: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/Makefile: Likewise.
1998-10-16 Ulrich Drepper <drepper@cygnus.com>
* time/mktime.c: Define _POSIX_THREAD_SAFE_FUNCTIONS to get
@ -7,7 +67,7 @@
* iconv/Makefile [! elf]: Define CFLAGS-gconv_simple.c to
-DSTATIC_GCONV.
* iconv/skeleton.c: Include ELF header only of STATIC?GCONV is not
* iconv/skeleton.c: Include ELF header only of STATIC_GCONV is not
defined. Avoid using DL_CLL_FCT if it is not defined.
1998-10-16 10:40 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>

View File

@ -29,6 +29,30 @@
#include <dirstream.h>
/* We want to be really safe the file we opened is a directory. Some systems
have support for this, others don't. */
#ifdef O_DIRECTORY
# define OPENDIR(NAME) \
do { \
fd = __open (NAME, O_RDONLY|O_NDELAY|O_DIRECTORY); \
if (fd < 0) \
return NULL; \
} while (0)
#else
# define OPENDIR(NAME) \
do { \
fd = __open (NAME, O_RDONLY|O_NDELAY); \
if (fd < 0 || __fstat (fd, &statbuf) < 0 || ! S_ISDIR (statbuf.st_mode)) \
{ \
if (fd >= 0) \
__close (fd); \
return NULL; \
} \
} while (0)
#endif
/* Open a directory stream on NAME. */
DIR *
__opendir (const char *name)
@ -58,9 +82,7 @@ __opendir (const char *name)
return NULL;
}
fd = __open (name, O_RDONLY|O_NDELAY);
if (fd < 0)
return NULL;
OPENDIR (name);
if (__fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
goto lose;

View File

@ -45,6 +45,7 @@
#ifdef __USE_GNU
# define O_DIRECT 040000 /* Direct disk access. */
# define O_DIRECTORY 0100000 /* Must be a directory. */
#endif
/* Not necessary, files are always with 64bit off_t. */

View File

@ -0,0 +1,3 @@
ifeq ($(subdir),misc)
sysdep_routines += setfsgid setfsuid setresgid setresuid
endif

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setegid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/seteuid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setgid.c>

View File

@ -0,0 +1,2 @@
/* We also have to rewrite the kernel gid_t to the user land type. */
#include <sysdeps/unix/sysv/linux/i386/setgroups.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setresgid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setresuid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setuid.c>

View File

@ -2,6 +2,10 @@
s_getgroups getgroups getgroups 2 __syscall_getgroups
s_llseek llseek _llseek 5 __sys_llseek
s_setgid setgid setgid 1 __syscall_setgid
s_setgroups setgroups setgroups 2 __syscall_setgroups
s_setresuid setresuid setresuid 3 __syscall_setresuid
s_setresgid setresgid setresgid 3 __syscall_setresgid
s_setuid setuid setuid 1 __syscall_setuid
vm86 - vm86 1 __vm86 vm86
syscall - syscall 5 syscall

View File

@ -42,7 +42,7 @@
#define O_ASYNC 020000
#ifdef __USE_GNU
# define O_DIRECT 040000 /* Direct disk access. */
# define O_DIRECTORY 040000 /* Must be a directory. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@ -53,10 +53,6 @@
# define O_RSYNC O_SYNC /* Synchronize read operations. */
#endif
#ifdef __USE_LARGEFILE64
# define O_LARGEFILE 0100000
#endif
/* Values for the second argument to `fcntl'. */
#define F_DUPFD 0 /* Duplicate file descriptor. */
#define F_GETFD 1 /* Get file descriptor flags. */

View File

@ -1,5 +1,6 @@
ifeq ($(subdir),misc)
sysdep_routines += ioperm iopl vm86 s_pread64 s_pwrite64
sysdep_routines += ioperm iopl vm86 s_pread64 s_pwrite64 setfsgid setfsuid \
setresgid setresuid
sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h
endif

View File

@ -0,0 +1,138 @@
/* O_*, F_*, FD_* bit values for Linux.
Copyright (C) 1995, 1996, 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. */
#ifndef _FCNTL_H
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
#include <sys/types.h>
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
#define O_ACCMODE 0003
#define O_RDONLY 00
#define O_WRONLY 01
#define O_RDWR 02
#define O_CREAT 0100 /* not fcntl */
#define O_EXCL 0200 /* not fcntl */
#define O_NOCTTY 0400 /* not fcntl */
#define O_TRUNC 01000 /* not fcntl */
#define O_APPEND 02000
#define O_NONBLOCK 04000
#define O_NDELAY O_NONBLOCK
#define O_SYNC 010000
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
#ifdef __USE_GNU
# define O_DIRECT 040000 /* Direct disk access. */
# define O_DIRECTORY 0200000 /* Must be a directory. */
#endif
/* For now Linux has synchronisity options for data and read operations.
We define the symbols here but let them do the same as O_SYNC since
this is a superset. */
#if defined __USE_POSIX199309 || defined __USE_UNIX98
# define O_DSYNC O_SYNC /* Synchronize data. */
# define O_RSYNC O_SYNC /* Synchronize read operations. */
#endif
#ifdef __USE_LARGEFILE64
# define O_LARGEFILE 0100000
#endif
/* Values for the second argument to `fcntl'. */
#define F_DUPFD 0 /* Duplicate file descriptor. */
#define F_GETFD 1 /* Get file descriptor flags. */
#define F_SETFD 2 /* Set file descriptor flags. */
#define F_GETFL 3 /* Get file status flags. */
#define F_SETFL 4 /* Set file status flags. */
#define F_GETLK 5 /* Get record locking info. */
#define F_SETLK 6 /* Set record locking info (non-blocking). */
#define F_SETLKW 7 /* Set record locking info (blocking). */
/* XXX missing */
#define F_GETLK64 5 /* Get record locking info. */
#define F_SETLK64 6 /* Set record locking info (non-blocking). */
#define F_SETLKW64 7 /* Set record locking info (blocking). */
#ifdef __USE_BSD
# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
#endif
#ifdef __USE_GNU
# define F_SETSIG 10 /* Set number of signal to be sent. */
# define F_GETSIG 11 /* Get number of signal to be sent. */
#endif
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
#define F_RDLCK 0 /* Read lock. */
#define F_WRLCK 1 /* Write lock. */
#define F_UNLCK 2 /* Remove lock. */
/* for old implementation of bsd flock () */
#define F_EXLCK 4 /* or 3 */
#define F_SHLCK 8 /* or 4 */
/* operations for bsd flock(), also used by the kernel implementation */
#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */
#define LOCK_NB 4 /* or'd with one of the above to prevent
blocking */
#define LOCK_UN 8 /* remove lock */
struct flock
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
#ifndef __USE_FILE_OFFSET64
__off_t l_start; /* Offset where the lock begins. */
__off_t l_len; /* Size of the locked area; zero means until EOF. */
#else
__off64_t l_start; /* Offset where the lock begins. */
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
#endif
__pid_t l_pid; /* Process holding the lock. */
};
#ifdef __USE_LARGEFILE64
struct flock64
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
__off64_t l_start; /* Offset where the lock begins. */
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
__pid_t l_pid; /* Process holding the lock. */
};
#endif
/* Define some more compatibility macros to be backward compatible with
BSD systems which did not managed to hide these kernel macros. */
#ifdef __USE_BSD
# define FAPPEND O_APPEND
# define FFSYNC O_FSYNC
# define FASYNC O_ASYNC
# define FNONBLOCK O_NONBLOCK
# define FNDELAY O_NDELAY
#endif /* Use BSD. */

View File

@ -0,0 +1,37 @@
/* Copyright (C) 1995, 1996, 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 <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <linux/posix_types.h>
int
setegid (gid)
gid_t gid;
{
if (gid == (gid_t) ~0
|| gid != (gid_t) ((__kernel_gid_t) gid))
{
__set_errno (EINVAL);
return -1;
}
return __setregid (-1, gid);
}

View File

@ -0,0 +1,53 @@
/* 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/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/posix_types.h>
#ifdef __NR_setresuid
extern int __setresuid (uid_t ruid, uid_t euid, uid_t suid);
#endif
int
seteuid (uid_t uid)
{
int result;
if (uid == (uid_t) ~0
|| uid != (uid_t) ((__kernel_uid_t) uid))
{
__set_errno (EINVAL);
return -1;
}
/* First try the syscall. */
#ifdef __NR_setresuid
result = __setresuid (-1, uid, -1);
if (result == -1 && errno == ENOSYS)
/* No system call available. Use emulation. This may not work
since `setreuid' also sets the saved user ID when UID is not
equal to the real user ID, making it impossible to switch back. */
#endif
result = __setreuid (-1, uid);
return result;
}

View File

@ -0,0 +1,47 @@
/* 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/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/posix_types.h>
#ifdef __NR_setfsgid
extern int __syscall_setfsgid (__kernel_gid_t);
int
setfsgid (gid_t gid)
{
if (gid != (gid_t) ((__kernel_gid_t) gid))
{
__set_errno (EINVAL);
return -1;
}
return __syscall_setfsgid (gid);
}
#else
int
setfsgid (gid_t gid)
{
__set_errno (ENOSYS);
return -1;
}
#endif

View File

@ -0,0 +1,47 @@
/* 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/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/posix_types.h>
#ifdef __NR_setfsuid
extern int __syscall_setfsuid (__kernel_uid_t);
int
setfsuid (uid_t uid)
{
if (uid != (uid_t) ((__kernel_uid_t) uid))
{
__set_errno (EINVAL);
return -1;
}
return __syscall_setfsuid (uid);
}
#else
int
setfsuid (uid_t uid)
{
__set_errno (ENOSYS);
return -1;
}
#endif

View File

@ -0,0 +1,40 @@
/* 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/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/posix_types.h>
extern int __syscall_setgid (__kernel_gid_t);
int
__setgid (gid_t gid)
{
if (gid == (gid_t) ~0
|| gid != (gid_t) ((__kernel_gid_t) gid))
{
__set_errno (EINVAL);
return -1;
}
return __syscall_setgid (gid);
}
weak_alias (__setgid, setgid)

View File

@ -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,6 +16,7 @@
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 <grp.h>
@ -36,6 +37,13 @@ setgroups (n, groups)
__kernel_gid_t kernel_groups[n];
for (i = 0; i < n; i++)
kernel_groups[i] = groups[i];
{
kernel_groups[i] = groups[i];
if (groups[i] != (gid_t) ((__kernel_gid_t) groups[i]))
{
__set_errno (EINVAL);
return -1;
}
}
return __syscall_setgroups (n, kernel_groups);
}

View File

@ -0,0 +1,46 @@
/* 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 <unistd.h>
#include <sys/types.h>
#include <linux/posix_types.h>
#include <sys/syscall.h>
#ifdef __NR_setresgid
extern int __syscall_setresgid (__kernel_gid_t rgid, __kernel_gid_t egid,
__kernel_gid_t sgid);
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)))
{
__set_errno (EINVAL);
return -1;
}
return __syscall_setresgid (rgid, egid, sgid);
}
#else
# include <sysdeps/generic/setresgid.c>
#endif

View File

@ -0,0 +1,47 @@
/* 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 <unistd.h>
#include <sys/types.h>
#include <linux/posix_types.h>
#include <sys/syscall.h>
#ifdef __NR_setresuid
extern int __syscall_setresuid (__kernel_uid_t rgid, __kernel_uid_t egid,
__kernel_uid_t sgid);
int
__setresuid (gid_t ruid, gid_t euid, gid_t suid)
{
if ((ruid != (uid_t) ((__kernel_uid_t) ruid))
|| (euid != (uid_t) ((__kernel_uid_t) euid))
|| (suid != (uid_t) ((__kernel_uid_t) suid)))
{
__set_errno (EINVAL);
return -1;
}
return __syscall_setresuid (ruid, euid, suid);
}
weak_alias (__setresuid, setresuid)
#else
# include <sysdeps/generic/setresuid.c>
#endif

View File

@ -0,0 +1,40 @@
/* 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/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/posix_types.h>
extern int __syscall_setuid (__kernel_uid_t);
int
__setuid (uid_t uid)
{
if (uid == (uid_t) ~0
|| uid != (uid_t) ((__kernel_uid_t) uid))
{
__set_errno (EINVAL);
return -1;
}
return __syscall_setuid (uid);
}
weak_alias (__setuid, setuid)

View File

@ -4,5 +4,11 @@ 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

View File

@ -3,7 +3,7 @@
m68k-syntax-flag = -DMOTOROLA_SYNTAX
ifeq ($(subdir),misc)
sysdep_routines += mremap
sysdep_routines += mremap setfsgid setfsuid setresgid setresuid
sysdep_headers += sys/reg.h
endif

View File

@ -4,4 +4,8 @@ cacheflush EXTRA cacheflush 4 __cacheflush cacheflush
s_getgroups getgroups getgroups 2 __syscall_getgroups
s_llseek llseek _llseek 5 __sys_llseek
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

View File

@ -38,7 +38,11 @@
#define O_EXCL 0x0400 /* not fcntl */
#define O_NOCTTY 0x0800 /* not fcntl */
#define O_FSYNC O_SYNC
#define O_ASYNC 020000
#define O_ASYNC 0x1000
#ifdef __USE_GNU
# define O_DIRECTORY 0x2000 /* Must be a directory. */
#endif
#define O_NDELAY O_NONBLOCK

View File

@ -1,6 +1,10 @@
asm-CPPFLAGS=-D__ASSEMBLY__
ASFLAGS-.os=-fPIC
ifeq ($(subdir),misc)
sysdep_routines += setfsgid setfsuid setresgid setresuid
endif
# When I get this to work, this is the right thing
ifeq ($(subdir),elf)
CFLAGS-rtld.c += -mv8

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setegid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/seteuid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setgid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setresgid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setresuid.c>

View File

@ -0,0 +1 @@
#include <sysdeps/unix/sysv/linux/i386/setuid.c>

View File

@ -1,6 +1,10 @@
# File name Caller Syscall name # args Strong name Weak names
s_getgroups getgroups getgroups 2 __syscall_getgroups
s_llseek llseek _llseek 5 __sys_llseek
s_setgroups setgroups setgroups 2 __syscall_setgroups
s_getpagesize getpagesize getpagesize 0 __syscall_getpagesize
s_llseek llseek _llseek 5 __sys_llseek
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