aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-17 05:24:52 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-17 05:24:52 +0000
commit313fed01112e9d6a9560ac07ab4b1a79d3209d45 (patch)
treee97d97bad169a93bf735cb477fb014d60e987d26 /sysdeps/unix
parent2449110a8ae9b7fb65259560a96b6fafd14e791f (diff)
downloadglibc-313fed01112e9d6a9560ac07ab4b1a79d3209d45.tar
glibc-313fed01112e9d6a9560ac07ab4b1a79d3209d45.tar.gz
glibc-313fed01112e9d6a9560ac07ab4b1a79d3209d45.tar.bz2
glibc-313fed01112e9d6a9560ac07ab4b1a79d3209d45.zip
Update.
2000-01-12 Andreas Jaeger <aj@suse.de> * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_32BITUIDS): Added for Linux 2.3.39+. * sysdeps/unix/sysv/linux/getresgid.c: Support 32bit UIDs and 32bit GIDs. * sysdeps/unix/sysv/linux/getresuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/chown.c: Likewise. * sysdeps/unix/sysv/linux/i386/getgroups.c: Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c: Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setfsgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setfsuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/i386/setregid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setuid.c: Likewise. * sysdeps/unix/sysv/linux/setegid.c: Likewise. * sysdeps/unix/sysv/linux/arm/chown.c: New file. * sysdeps/unix/sysv/linux/arm/fchown.c: New file. * sysdeps/unix/sysv/linux/arm/geteuid.c: New file. * sysdeps/unix/sysv/linux/arm/getegid.c: New file. * sysdeps/unix/sysv/linux/arm/getuid.c: New file. * sysdeps/unix/sysv/linux/arm/getgid.c: New file. * sysdeps/unix/sysv/linux/arm/lchown.c: New file. * sysdeps/unix/sysv/linux/i386/fchown.c: New file. * sysdeps/unix/sysv/linux/i386/getegid.c: New file. * sysdeps/unix/sysv/linux/i386/geteuid.c: New file. * sysdeps/unix/sysv/linux/i386/getgid.c: New file. * sysdeps/unix/sysv/linux/i386/getuid.c: New file. * sysdeps/unix/sysv/linux/i386/lchown.c: New file. * sysdeps/unix/sysv/linux/m68k/chown.c: New file. * sysdeps/unix/sysv/linux/m68k/fchown.c: New file. * sysdeps/unix/sysv/linux/m68k/getegid.c: New file. * sysdeps/unix/sysv/linux/m68k/geteuid.c: New file. * sysdeps/unix/sysv/linux/m68k/getgid.c: New file. * sysdeps/unix/sysv/linux/m68k/getuid.c: New file. * sysdeps/unix/sysv/linux/m68k/lchown.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/chown.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/getegid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/geteuid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/getgid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/getuid.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c: New file. Based on a patch by Chris Wing <wingc@engin.umich.edu>. 2000-01-14 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/sparc/sys/procfs.h: New file. 2000-01-13 Jakub Jelinek <jakub@redhat.com> * sysdeps/generic/backtrace.c: Include signal.h which sigcontextinfo.h headers are used to expect. * sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h (register_dump): Fix a typo in the printout. Avoid using reg_window, so that asm/ptrace.h is not necessary. * sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h (ADVANCE_STACK_FRAME): Likewise. * stdlib/longlong.h: Avoid using __sparc_v9__ ifdefs. * sysdeps/sparc/sparc32/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc64/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Include bits/wordsize.h to make it clear this file depends on __WORDSIZE. * sysdeps/unix/sysv/linux/ftruncate64.c (__have_no_truncate64): Renamed from have_no_truncate64. * sysdeps/unix/sysv/linux/truncate64.c (__have_no_truncate64): Likewise.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/arm/chown.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/lchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/ftruncate64.c8
-rw-r--r--sysdeps/unix/sysv/linux/getresgid.c34
-rw-r--r--sysdeps/unix/sysv/linux/getresuid.c33
-rw-r--r--sysdeps/unix/sysv/linux/i386/chown.c46
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchown.c73
-rw-r--r--sysdeps/unix/sysv/linux/i386/getegid.c62
-rw-r--r--sysdeps/unix/sysv/linux/i386/geteuid.c62
-rw-r--r--sysdeps/unix/sysv/linux/i386/getgid.c63
-rw-r--r--sysdeps/unix/sysv/linux/i386/getgroups.c38
-rw-r--r--sysdeps/unix/sysv/linux/i386/getuid.c63
-rw-r--r--sysdeps/unix/sysv/linux/i386/lchown.c79
-rw-r--r--sysdeps/unix/sysv/linux/i386/setegid.c12
-rw-r--r--sysdeps/unix/sysv/linux/i386/seteuid.c11
-rw-r--r--sysdeps/unix/sysv/linux/i386/setfsgid.c33
-rw-r--r--sysdeps/unix/sysv/linux/i386/setfsuid.c32
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgid.c33
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgroups.c37
-rw-r--r--sysdeps/unix/sysv/linux/i386/setregid.c32
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresgid.c33
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresuid.c33
-rw-r--r--sysdeps/unix/sysv/linux/i386/setreuid.c32
-rw-r--r--sysdeps/unix/sysv/linux/i386/setuid.c31
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h5
-rw-r--r--sysdeps/unix/sysv/linux/m68k/chown.c57
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/setegid.c52
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/chown.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/getgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h11
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sys/procfs.h109
-rw-r--r--sysdeps/unix/sysv/linux/truncate64.c8
50 files changed, 1087 insertions, 63 deletions
diff --git a/sysdeps/unix/sysv/linux/arm/chown.c b/sysdeps/unix/sysv/linux/arm/chown.c
new file mode 100644
index 0000000000..1961622564
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/chown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/m68k/chown.c>
diff --git a/sysdeps/unix/sysv/linux/arm/fchown.c b/sysdeps/unix/sysv/linux/arm/fchown.c
new file mode 100644
index 0000000000..3a69ecc9e7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/fchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getegid.c b/sysdeps/unix/sysv/linux/arm/getegid.c
new file mode 100644
index 0000000000..37b4b4a530
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/getegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/geteuid.c b/sysdeps/unix/sysv/linux/arm/geteuid.c
new file mode 100644
index 0000000000..ebcb555b5e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/geteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getgid.c b/sysdeps/unix/sysv/linux/arm/getgid.c
new file mode 100644
index 0000000000..0a4d6061f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/getgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getuid.c b/sysdeps/unix/sysv/linux/arm/getuid.c
new file mode 100644
index 0000000000..d682c79a49
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/getuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/lchown.c b/sysdeps/unix/sysv/linux/arm/lchown.c
new file mode 100644
index 0000000000..c89de99ba2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/lchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c
index 49133e8dd0..a38d5bd560 100644
--- a/sysdeps/unix/sysv/linux/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/ftruncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000 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
@@ -28,7 +28,7 @@
#ifdef __NR_ftruncate64
#ifndef __ASSUME_TRUNCATE64_SYSCALL
/* The variable is shared between all wrappers around *truncate64 calls. */
-extern int have_no_truncate64;
+extern int __have_no_truncate64;
#endif
extern int __syscall_ftruncate64 (int fd, int high_length, int low_length);
@@ -41,7 +41,7 @@ ftruncate64 (fd, length)
off64_t length;
{
#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (! have_no_truncate64)
+ if (! __have_no_truncate64)
#endif
{
unsigned int low = length & 0xffffffff;
@@ -58,7 +58,7 @@ ftruncate64 (fd, length)
#ifndef __ASSUME_TRUNCATE64_SYSCALL
__set_errno (saved_errno);
- have_no_truncate64 = 1;
+ __have_no_truncate64 = 1;
#endif
}
diff --git a/sysdeps/unix/sysv/linux/getresgid.c b/sysdeps/unix/sysv/linux/getresgid.c
index 475592ead4..ce7d7aa649 100644
--- a/sysdeps/unix/sysv/linux/getresgid.c
+++ b/sysdeps/unix/sysv/linux/getresgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,16 +24,47 @@
#include <sysdep.h>
#include <sys/syscall.h>
+#include "kernel-features.h"
+
#ifdef __NR_getresgid
extern int __syscall_getresgid (__kernel_gid_t *rgid, __kernel_gid_t *egid,
__kernel_gid_t *sgid);
+# ifdef __NR_getresgid32
+extern int __syscall_getresgid32 (__kernel_gid32_t *rgid, __kernel_gid32_t *egid,
+ __kernel_gid32_t *sgid);
+
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_getresgid32 */
+
+
int
getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)
{
+# if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (getresgid32, 3, rgid, egid, sgid);
+# else
__kernel_gid_t k_rgid, k_egid, k_sgid;
int result;
+# ifdef __NR_getresgid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int r;
+ int saved_errno = errno;
+
+ r = INLINE_SYSCALL (getresgid32, 3, rgid, egid, sgid);
+ if (r == 0 || errno != ENOSYS)
+ return r;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_getresgid32 */
result = INLINE_SYSCALL (getresgid, 3, &k_rgid, &k_egid, &k_sgid);
@@ -45,6 +76,7 @@ getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)
}
return result;
+# endif
}
#else
# include <sysdeps/generic/getresgid.c>
diff --git a/sysdeps/unix/sysv/linux/getresuid.c b/sysdeps/unix/sysv/linux/getresuid.c
index 09b12a5e0e..465db9cc88 100644
--- a/sysdeps/unix/sysv/linux/getresuid.c
+++ b/sysdeps/unix/sysv/linux/getresuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,16 +24,46 @@
#include <sysdep.h>
#include <sys/syscall.h>
+
+#include "kernel-features.h"
+
#ifdef __NR_getresuid
extern int __syscall_getresuid (__kernel_uid_t *ruid, __kernel_uid_t *euid,
__kernel_uid_t *suid);
+# ifdef __NR_getresuid32
+extern int __syscall_getresuid32 (__kernel_uid32_t *ruid, __kernel_uid32_t *euid,
+ __kernel_uid32_t *suid);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_getresuid32 */
+
int
getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)
{
+# if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (getresuid32, 3, ruid, euid, suid);
+# else
__kernel_uid_t k_ruid, k_euid, k_suid;
int result;
+# ifdef __NR_getresuid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int r;
+ int saved_errno = errno;
+
+ r = INLINE_SYSCALL (getresuid32, 3, ruid, euid, suid);
+ if (r == 0 || errno != ENOSYS)
+ return r;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_getresuid32 */
result = INLINE_SYSCALL (getresuid, 3, &k_ruid, &k_euid, &k_suid);
@@ -45,6 +75,7 @@ getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)
}
return result;
+# endif
}
#else
# include <sysdeps/generic/getresuid.c>
diff --git a/sysdeps/unix/sysv/linux/i386/chown.c b/sysdeps/unix/sysv/linux/i386/chown.c
index 9ab03e3a7c..9addfd0598 100644
--- a/sysdeps/unix/sysv/linux/i386/chown.c
+++ b/sysdeps/unix/sysv/linux/i386/chown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000 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
@@ -23,6 +23,9 @@
#include <sys/syscall.h>
#include <kernel-features.h>
+#include <linux/posix_types.h>
+
+
/*
In Linux 2.1.x the chown functions have been changed. A new function lchown
@@ -39,6 +42,15 @@ extern int __syscall_chown (const char *__file,
#if defined __NR_lchown || __ASSUME_LCHOWN_SYSCALL > 0
/* Running under Linux > 2.1.80. */
+# ifdef __NR_chown32
+extern int __syscall_chown32 (const char *__file,
+ __kernel_uid32_t owner, __kernel_gid32_t group);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_chown32 */
int
__real_chown (const char *file, uid_t owner, gid_t group)
@@ -50,6 +62,20 @@ __real_chown (const char *file, uid_t owner, gid_t group)
if (!__libc_old_chown)
{
int saved_errno = errno;
+# ifdef __NR_chown32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (chown32, 3, file, owner, group);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_chown32 */
result = INLINE_SYSCALL (chown, 3, file, owner, group);
if (result >= 0 || errno != ENOSYS)
@@ -60,7 +86,25 @@ __real_chown (const char *file, uid_t owner, gid_t group)
}
return __lchown (file, owner, group);
+# elif __ASSUME_32BITUIDS
+ /* This implies __ASSUME_LCHOWN_SYSCALL. */
+ return INLINE_SYSCALL (chown32, 3, file, owner, group);
# else
+ /* !__ASSUME_32BITUIDS && ASSUME_LCHOWN_SYSCALL */
+# ifdef __NR_chown32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (chown32, 3, file, owner, group);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_chown32 */
return INLINE_SYSCALL (chown, 3, file, owner, group);
# endif
}
diff --git a/sysdeps/unix/sysv/linux/i386/fchown.c b/sysdeps/unix/sysv/linux/i386/fchown.c
new file mode 100644
index 0000000000..7d4c360dbd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fchown.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2000 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 <sysdep.h>
+#include <sys/syscall.h>
+
+#include <linux/posix_types.h>
+#include "kernel-features.h"
+
+extern int __syscall_fchown (int __fd,
+ __kernel_uid_t __owner, __kernel_gid_t __group);
+
+#ifdef __NR_fchown32
+extern int __syscall_fchown32 (int __fd,
+ __kernel_uid32_t __owner, __kernel_gid32_t __group);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_fchown32 */
+
+int
+__fchown (int fd, uid_t owner, gid_t group)
+{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (fchown32, 3, fd, owner, group);
+#else
+# ifdef __NR_fchown32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (fchown32, 3, fd, owner, group);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_fchown32 */
+
+ if ( (owner != (uid_t) ((__kernel_uid_t) owner)) ||
+ (group != (gid_t) ((__kernel_gid_t) group)) )
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (fchown, 3, fd, owner, group);
+#endif
+}
+
+weak_alias (__fchown, fchown)
diff --git a/sysdeps/unix/sysv/linux/i386/getegid.c b/sysdeps/unix/sysv/linux/i386/getegid.c
new file mode 100644
index 0000000000..05dd15d986
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/getegid.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2000 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 <sysdep.h>
+#include <sys/syscall.h>
+#include "kernel-features.h"
+
+extern int __syscall_getegid (void);
+
+#ifdef __NR_getegid32
+extern int __syscall_getegid32 (void);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_getegid32 */
+
+gid_t
+__getegid (void)
+{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (getegid32, 0);
+#else
+# ifdef __NR_getegid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (getegid32, 0);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_getegid32 */
+
+ return INLINE_SYSCALL (getegid, 0);
+#endif
+}
+
+weak_alias (__getegid, getegid)
diff --git a/sysdeps/unix/sysv/linux/i386/geteuid.c b/sysdeps/unix/sysv/linux/i386/geteuid.c
new file mode 100644
index 0000000000..e2f932a975
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/geteuid.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2000 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 <sysdep.h>
+#include <sys/syscall.h>
+#include "kernel-features.h"
+
+extern int __syscall_geteuid (void);
+
+#ifdef __NR_geteuid32
+extern int __syscall_geteuid32 (void);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_geteuid32 */
+
+uid_t
+__geteuid (void)
+{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (geteuid32, 0);
+#else
+# ifdef __NR_geteuid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (geteuid32, 0);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_geteuid32 */
+
+ return INLINE_SYSCALL (geteuid, 0);
+#endif
+}
+
+weak_alias (__geteuid, geteuid)
diff --git a/sysdeps/unix/sysv/linux/i386/getgid.c b/sysdeps/unix/sysv/linux/i386/getgid.c
new file mode 100644
index 0000000000..19794aac36
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/getgid.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2000 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 <sysdep.h>
+#include <sys/syscall.h>
+
+#include "kernel-features.h"
+
+extern int __syscall_getgid (void);
+
+#ifdef __NR_getgid32
+extern int __syscall_getgid32 (void);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_getgid32 */
+
+gid_t
+__getgid (void)
+{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (getgid32, 0);
+#else
+# ifdef __NR_getgid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (getgid32, 0);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_getgid32 */
+
+ return INLINE_SYSCALL (getgid, 0);
+#endif
+}
+
+weak_alias (__getgid, getgid)
diff --git a/sysdeps/unix/sysv/linux/i386/getgroups.c b/sysdeps/unix/sysv/linux/i386/getgroups.c
index 5484f72f1c..b538f8f79a 100644
--- a/sysdeps/unix/sysv/linux/i386/getgroups.c
+++ b/sysdeps/unix/sysv/linux/i386/getgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000 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
@@ -23,17 +23,25 @@
#include <sysdep.h>
#include <sys/syscall.h>
-
#include <linux/posix_types.h>
+#include <kernel-features.h>
+
+
+extern int __syscall_getgroups(int, __kernel_gid_t *);
-extern int __syscall_getgroups __P ((int, __kernel_gid_t *));
+#ifdef __NR_getgroups32
+extern int __syscall_getgroups32 (int, __kernel_gid32_t *);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_getgroups32 */
/* For Linux we must convert the array of groups from the format that the
kernel returns. */
int
-__getgroups (n, groups)
- int n;
- gid_t *groups;
+__getgroups (int n, gid_t *groups)
{
if (n < 0)
{
@@ -42,8 +50,25 @@ __getgroups (n, groups)
}
else
{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (getgroups32, 2, n, groups);
+#else
int i, ngids;
__kernel_gid_t kernel_groups[n = MIN (n, __sysconf (_SC_NGROUPS_MAX))];
+# ifdef __NR_getgroups32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (getgroups32, 2, n, groups);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_getgroups32 */
ngids = INLINE_SYSCALL (getgroups, 2, n, kernel_groups);
if (n != 0 && ngids > 0)
@@ -52,6 +77,7 @@ __getgroups (n, groups)
return ngids;
}
+#endif
}
weak_alias (__getgroups, getgroups)
diff --git a/sysdeps/unix/sysv/linux/i386/getuid.c b/sysdeps/unix/sysv/linux/i386/getuid.c
new file mode 100644
index 0000000000..d160e4423a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/getuid.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2000 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 <sysdep.h>
+#include <sys/syscall.h>
+
+#include "kernel-features.h"
+
+extern int __syscall_getuid (void);
+
+#ifdef __NR_getuid32
+extern int __syscall_getuid32 (void);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. This is the definition */
+int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_getuid32 */
+
+uid_t
+__getuid (void)
+{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (getuid32, 0);
+#else
+# ifdef __NR_getuid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (getuid32, 0);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_getuid32 */
+
+ return INLINE_SYSCALL (getuid, 0);
+#endif
+}
+
+weak_alias (__getuid, getuid)
diff --git a/sysdeps/unix/sysv/linux/i386/lchown.c b/sysdeps/unix/sysv/linux/i386/lchown.c
new file mode 100644
index 0000000000..86ff7d518d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/lchown.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2000 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 <sysdep.h>
+#include <sys/syscall.h>
+
+#include <linux/posix_types.h>
+#include "kernel-features.h"
+
+#ifdef __NR_lchown
+extern int __syscall_lchown (const char *__file,
+ __kernel_uid_t __owner, __kernel_gid_t __group);
+
+# ifdef __NR_lchown32
+extern int __syscall_lchown32 (const char *__file,
+ __kernel_uid32_t __owner, __kernel_gid32_t __group);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_lchown32 */
+
+int
+__lchown (const char *file, uid_t owner, gid_t group)
+{
+# if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (lchown32, 3, file, owner, group);
+# else
+# ifdef __NR_lchown32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (lchown32, 3, file, owner, group);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_lchown32 */
+
+ if ( (owner != (uid_t) ((__kernel_uid_t) owner)) ||
+ (group != (gid_t) ((__kernel_gid_t) group)) )
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (lchown, 3, file, owner, group);
+# endif
+}
+
+weak_alias (__lchown, lchown)
+
+#else
+# include <sysdeps/generic/lchown.c>
+#endif
+
diff --git a/sysdeps/unix/sysv/linux/i386/setegid.c b/sysdeps/unix/sysv/linux/i386/setegid.c
index e29d2eab7b..d4883fe31a 100644
--- a/sysdeps/unix/sysv/linux/i386/setegid.c
+++ b/sysdeps/unix/sysv/linux/i386/setegid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 96, 97, 98, 2000 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,22 +16,12 @@
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);
}
diff --git a/sysdeps/unix/sysv/linux/i386/seteuid.c b/sysdeps/unix/sysv/linux/i386/seteuid.c
index e82ecc36e9..c2b03f91e3 100644
--- a/sysdeps/unix/sysv/linux/i386/seteuid.c
+++ b/sysdeps/unix/sysv/linux/i386/seteuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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
@@ -21,7 +21,6 @@
#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);
@@ -31,14 +30,6 @@ 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);
diff --git a/sysdeps/unix/sysv/linux/i386/setfsgid.c b/sysdeps/unix/sysv/linux/i386/setfsgid.c
index 434b19377b..6fd7e46489 100644
--- a/sysdeps/unix/sysv/linux/i386/setfsgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setfsgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,15 +22,43 @@
#include <sysdep.h>
#include <sys/syscall.h>
-
#include <linux/posix_types.h>
+#include "kernel-features.h"
+
#ifdef __NR_setfsgid
+
extern int __syscall_setfsgid (__kernel_gid_t);
+# ifdef __NR_setfsgid32
+extern int __syscall_setfsgid32 (__kernel_gid32_t);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_setfsgid32 */
+
int
setfsgid (gid_t gid)
{
+# if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (setfsgid32, 1, gid);
+# else
+# ifdef __NR_setfsgid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (setfsgid32, 1, gid);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_setfsgid32 */
if (gid != (gid_t) ((__kernel_gid_t) gid))
{
__set_errno (EINVAL);
@@ -38,5 +66,6 @@ setfsgid (gid_t gid)
}
return INLINE_SYSCALL (setfsgid, 1, gid);
+# endif
}
#endif
diff --git a/sysdeps/unix/sysv/linux/i386/setfsuid.c b/sysdeps/unix/sysv/linux/i386/setfsuid.c
index f3771694a1..cf7bc16476 100644
--- a/sysdeps/unix/sysv/linux/i386/setfsuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setfsuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,13 +24,42 @@
#include <sys/syscall.h>
#include <linux/posix_types.h>
+#include "kernel-features.h"
#ifdef __NR_setfsuid
+
extern int __syscall_setfsuid (__kernel_uid_t);
+# ifdef __NR_setfsuid32
+extern int __syscall_setfsuid32 (__kernel_uid32_t);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_setfsuid32 */
+
int
setfsuid (uid_t uid)
{
+# if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (setfsuid32, 1, uid);
+# else
+# ifdef __NR_setfsuid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (setfsuid32, 1, uid);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_setfsuid32 */
+
if (uid != (uid_t) ((__kernel_uid_t) uid))
{
__set_errno (EINVAL);
@@ -38,5 +67,6 @@ setfsuid (uid_t uid)
}
return INLINE_SYSCALL (setfsuid, 1, uid);
+# endif
}
#endif
diff --git a/sysdeps/unix/sysv/linux/i386/setgid.c b/sysdeps/unix/sysv/linux/i386/setgid.c
index 2ab8dfda34..2a81302527 100644
--- a/sysdeps/unix/sysv/linux/i386/setgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,11 +25,41 @@
#include <linux/posix_types.h>
+#include "kernel-features.h"
+
extern int __syscall_setgid (__kernel_gid_t);
+#ifdef __NR_setgid32
+extern int __syscall_setgid32 (__kernel_gid32_t);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_setgid32 */
+
int
__setgid (gid_t gid)
{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (setgid32, 1, gid);
+#else
+# ifdef __NR_setgid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (setgid32, 1, gid);
+
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_setgid32 */
+
if (gid == (gid_t) ~0
|| gid != (gid_t) ((__kernel_gid_t) gid))
{
@@ -38,5 +68,6 @@ __setgid (gid_t gid)
}
return INLINE_SYSCALL (setgid, 1, gid);
+#endif
}
weak_alias (__setgid, setgid)
diff --git a/sysdeps/unix/sysv/linux/i386/setgroups.c b/sysdeps/unix/sysv/linux/i386/setgroups.c
index e57004f8ac..7c750acc74 100644
--- a/sysdeps/unix/sysv/linux/i386/setgroups.c
+++ b/sysdeps/unix/sysv/linux/i386/setgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000 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
@@ -23,18 +23,26 @@
#include <sysdep.h>
#include <sys/syscall.h>
-
#include <linux/posix_types.h>
+#include "kernel-features.h"
+
+
+extern int __syscall_setgroups (int, const __kernel_gid_t *);
-extern int __syscall_setgroups __P ((int, const __kernel_gid_t *));
+#ifdef __NR_setgroups32
+extern int __syscall_setgroups32 __P ((int, const __kernel_gid32_t *));
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_setgroups32 */
/* Set the group set for the current user to GROUPS (N of them). For
Linux we must convert the array of groups into the format that the
kernel expects. */
int
-setgroups (n, groups)
- size_t n;
- const gid_t *groups;
+setgroups (size_t n, const gid_t *groups)
{
if (n > (size_t) __sysconf (_SC_NGROUPS_MAX))
{
@@ -43,9 +51,25 @@ setgroups (n, groups)
}
else
{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (setgroups32, 2, n, groups);
+#else
size_t i;
__kernel_gid_t kernel_groups[n];
+# ifdef __NR_setgroups32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (setgroups32, 2, n, groups);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_setgroups32 */
for (i = 0; i < n; i++)
{
kernel_groups[i] = groups[i];
@@ -58,4 +82,5 @@ setgroups (n, groups)
return INLINE_SYSCALL (setgroups, 2, n, kernel_groups);
}
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/i386/setregid.c b/sysdeps/unix/sysv/linux/i386/setregid.c
index 98603bd2a2..4f00d30bc6 100644
--- a/sysdeps/unix/sysv/linux/i386/setregid.c
+++ b/sysdeps/unix/sysv/linux/i386/setregid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,12 +24,41 @@
#include <sys/syscall.h>
#include <linux/posix_types.h>
+#include "kernel-features.h"
+
extern int __syscall_setregid (__kernel_gid_t, __kernel_gid_t);
+#ifdef __NR_setregid32
+extern int __syscall_setregid32 (__kernel_gid32_t, __kernel_gid32_t);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_setregid32 */
+
int
__setregid (gid_t rgid, gid_t egid)
{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (setregid32, 2, rgid, egid);
+#else
+# ifdef __NR_setregid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (setregid32, 2, rgid, egid);
+
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_setregid32 */
if ((rgid != (gid_t) -1 && rgid != (gid_t) (__kernel_gid_t) rgid)
|| (egid != (gid_t) -1 && egid != (gid_t) (__kernel_gid_t) egid))
{
@@ -38,5 +67,6 @@ __setregid (gid_t rgid, gid_t egid)
}
return INLINE_SYSCALL (setregid, 2, rgid, egid);
+#endif
}
weak_alias (__setregid, setregid)
diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c
index ab2738582b..45dbcc8485 100644
--- a/sysdeps/unix/sysv/linux/i386/setresgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,14 +24,44 @@
#include <sysdep.h>
#include <sys/syscall.h>
+#include "kernel-features.h"
+
#ifdef __NR_setresgid
extern int __syscall_setresgid (__kernel_gid_t rgid, __kernel_gid_t egid,
__kernel_gid_t sgid);
+# ifdef __NR_setresgid32
+extern int __syscall_setresgid32 (__kernel_gid32_t rgid, __kernel_gid32_t egid,
+ __kernel_gid32_t sgid);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_setresgid32 */
+
int
setresgid (gid_t rgid, gid_t egid, gid_t sgid)
{
+# if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (setresgid32, 3, rgid, egid, sgid);
+# else
+# ifdef __NR_setresgid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (setresgid32, 3, rgid, egid, sgid);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_setresgid32 */
+
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))
@@ -41,5 +71,6 @@ setresgid (gid_t rgid, gid_t egid, gid_t sgid)
}
return INLINE_SYSCALL (setresgid, 3, rgid, egid, sgid);
+# endif
}
#endif
diff --git a/sysdeps/unix/sysv/linux/i386/setresuid.c b/sysdeps/unix/sysv/linux/i386/setresuid.c
index 953b8294d6..90214526ab 100644
--- a/sysdeps/unix/sysv/linux/i386/setresuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,14 +24,44 @@
#include <sysdep.h>
#include <sys/syscall.h>
+#include "kernel-features.h"
+
#ifdef __NR_setresuid
extern int __syscall_setresuid (__kernel_uid_t rgid, __kernel_uid_t egid,
__kernel_uid_t sgid);
+# ifdef __NR_setresuid32
+extern int __syscall_setresuid32 (__kernel_uid32_t rgid, __kernel_uid32_t egid,
+ __kernel_uid32_t sgid);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_setresuid32 */
+
int
__setresuid (uid_t ruid, uid_t euid, uid_t suid)
{
+# if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (setresuid32, 3, ruid, euid, suid);
+# else
+# ifdef __NR_setresuid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (setresuid32, 3, ruid, euid, suid);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_setresuid32 */
+
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))
@@ -41,6 +71,7 @@ __setresuid (uid_t ruid, uid_t euid, uid_t suid)
}
return INLINE_SYSCALL (setresuid, 3, ruid, euid, suid);
+# endif
}
weak_alias (__setresuid, setresuid)
#endif
diff --git a/sysdeps/unix/sysv/linux/i386/setreuid.c b/sysdeps/unix/sysv/linux/i386/setreuid.c
index f38f136920..58ddff2b00 100644
--- a/sysdeps/unix/sysv/linux/i386/setreuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setreuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,12 +24,41 @@
#include <sys/syscall.h>
#include <linux/posix_types.h>
+#include "kernel-features.h"
+
extern int __syscall_setreuid (__kernel_uid_t, __kernel_uid_t);
+#ifdef __NR_setreuid32
+extern int __syscall_setreuid32 (__kernel_uid32_t, __kernel_uid32_t);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_setreuid32 */
+
int
__setreuid (uid_t ruid, uid_t euid)
{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (setreuid32, 2, ruid, euid);
+#else
+# ifdef __NR_setreuid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (setreuid32, 2, ruid, euid);
+
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_setreuid32 */
if ((ruid != (uid_t) -1 && ruid != (uid_t) (__kernel_uid_t) ruid)
|| (euid != (uid_t) -1 && euid != (uid_t) (__kernel_uid_t) euid))
{
@@ -38,5 +67,6 @@ __setreuid (uid_t ruid, uid_t euid)
}
return INLINE_SYSCALL (setreuid, 2, ruid, euid);
+#endif
}
weak_alias (__setreuid, setreuid)
diff --git a/sysdeps/unix/sysv/linux/i386/setuid.c b/sysdeps/unix/sysv/linux/i386/setuid.c
index 5e5346ca42..ed0d8fa0bd 100644
--- a/sysdeps/unix/sysv/linux/i386/setuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 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,12 +24,40 @@
#include <sys/syscall.h>
#include <linux/posix_types.h>
+#include "kernel-features.h"
extern int __syscall_setuid (__kernel_uid_t);
+#ifdef __NR_setuid32
+extern int __syscall_setuid32 (__kernel_uid32_t);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_setuid32 */
+
int
__setuid (uid_t uid)
{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (setuid32, 1, uid);
+#else
+# ifdef __NR_setuid32
+ if (!__libc_missing_32bit_uids)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (setuid32, 1, uid);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_setuid32 */
+
if (uid == (uid_t) ~0
|| uid != (uid_t) ((__kernel_uid_t) uid))
{
@@ -38,5 +66,6 @@ __setuid (uid_t uid)
}
return INLINE_SYSCALL (setuid, 1, uid);
+#endif
}
weak_alias (__setuid, setuid)
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 73bfda63e0..f7bdf4808b 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -102,3 +102,8 @@
# define __ASSUME_MMAP2_SYSCALL 1
# define __ASSUME_STAT64_SYSCALL 1
#endif
+
+/* Linux 2.3.39 introduced 32bit UID/GIDs. */
+#if __LINUX_KERNEL_VERSION >= 131879
+# define __ASSUME_32BITUIDS 1
+#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/chown.c b/sysdeps/unix/sysv/linux/m68k/chown.c
new file mode 100644
index 0000000000..c27da95944
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/chown.c
@@ -0,0 +1,57 @@
+/* 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 <sysdep.h>
+#include <sys/syscall.h>
+
+#include <linux/posix_types.h>
+
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
+extern int __syscall_chown (const char *__file,
+ uid_t __owner, gid_t __group);
+
+#ifdef __NR_chown32
+extern int __syscall_chown32 (const char *__file,
+ __kernel_uid32_t owner, __kernel_gid32_t group);
+#endif /* __NR_chown32 */
+
+int
+__chown (const char *file, uid_t owner, gid_t group)
+{
+#ifdef __NR_chown32
+ if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (chown32, 3, file, owner, group);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = NO_HIGHUIDS;
+ }
+#endif /* __NR_chown32 */
+
+ return INLINE_SYSCALL (chown, 3, file, owner, group);
+}
+weak_alias (__chown, chown)
diff --git a/sysdeps/unix/sysv/linux/m68k/fchown.c b/sysdeps/unix/sysv/linux/m68k/fchown.c
new file mode 100644
index 0000000000..3a69ecc9e7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/fchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getegid.c b/sysdeps/unix/sysv/linux/m68k/getegid.c
new file mode 100644
index 0000000000..37b4b4a530
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/geteuid.c b/sysdeps/unix/sysv/linux/m68k/geteuid.c
new file mode 100644
index 0000000000..ebcb555b5e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/geteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getgid.c b/sysdeps/unix/sysv/linux/m68k/getgid.c
new file mode 100644
index 0000000000..0a4d6061f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getuid.c b/sysdeps/unix/sysv/linux/m68k/getuid.c
new file mode 100644
index 0000000000..d682c79a49
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/lchown.c b/sysdeps/unix/sysv/linux/m68k/lchown.c
new file mode 100644
index 0000000000..c89de99ba2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/lchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/setegid.c b/sysdeps/unix/sysv/linux/setegid.c
index 1b29a6ffb2..3fa5cc055f 100644
--- a/sysdeps/unix/sysv/linux/setegid.c
+++ b/sysdeps/unix/sysv/linux/setegid.c
@@ -1 +1,51 @@
-#include <sysdeps/unix/bsd/setegid.c>
+/* Copyright (C) 1998, 2000 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>
+
+#ifdef __NR_setresgid
+
+extern int __setresgid (gid_t rgid, gid_t egid, gid_t sgid);
+
+int
+setegid (gid_t gid)
+{
+ int result;
+
+ if (gid == (gid_t) ~0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ /* First try the syscall. */
+ result = __setresgid (-1, gid, -1);
+ if (result == -1 && errno == ENOSYS)
+ /* No system call available. Use emulation. This may not work
+ since `setregid' also sets the saved group ID when GID is not
+ equal to the real group ID, making it impossible to switch back. */
+ result = __setregid (-1, gid);
+
+ return result;
+}
+#else
+# include <sysdeps/unix/bsd/setegid.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index 53f0d507e2..6a8e45375f 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -21,6 +21,7 @@
#define _FCNTLBITS_H 1
#include <sys/types.h>
+#include <bits/wordsize.h>
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
located on an ext2 file system */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c b/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
new file mode 100644
index 0000000000..1961622564
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/m68k/chown.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c b/sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c
new file mode 100644
index 0000000000..3a69ecc9e7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getegid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getegid.c
new file mode 100644
index 0000000000..37b4b4a530
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/getegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/geteuid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/geteuid.c
new file mode 100644
index 0000000000..ebcb555b5e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/geteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getgid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getgid.c
new file mode 100644
index 0000000000..0a4d6061f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/getgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getgid.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getuid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getuid.c
new file mode 100644
index 0000000000..d682c79a49
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/getuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c b/sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c
new file mode 100644
index 0000000000..c89de99ba2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h b/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h
index 15b4f76cc0..55d996ad1d 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h
@@ -1,7 +1,7 @@
/* Dump registers.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 1999.
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
@@ -20,7 +20,6 @@
#include <sys/uio.h>
#include <stdio-common/_itoa.h>
-#include <asm/ptrace.h>
#include <bits/sigcontext.h>
/* We will print the register dump in this format:
@@ -95,7 +94,7 @@ register_dump (int fd, SIGCONTEXT ctx)
struct iovec iov[150];
size_t nr = 0;
int i;
- struct reg_window *r = (struct reg_window *)
+ unsigned int *r = (unsigned int *)
ctx->si_regs.u_regs[14];
#define ADD_STRING(str) \
@@ -115,7 +114,7 @@ register_dump (int fd, SIGCONTEXT ctx)
for (i = 1; i <= 15; i++)
hexvalue (ctx->si_regs.u_regs[i], regs[3+i], 8);
for (i = 0; i <= 15; i++)
- hexvalue (r->locals[i], regs[19+i], 8);
+ hexvalue (r[i], regs[19+i], 8);
hexvalue (ctx->si_mask, regs[35], 8);
/* Generate the output. */
@@ -252,7 +251,7 @@ register_dump (int fd, SIGCONTEXT ctx)
ADD_MEM (fregs[36], 16);
ADD_STRING (" f38: ");
ADD_MEM (fregs[38], 16);
- ADD_STRING (" f40: ");
+ ADD_STRING (" f40: ");
ADD_MEM (fregs[40], 16);
ADD_STRING ("\n f42: ");
ADD_MEM (fregs[42], 16);
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h
index 4e8fcd7871..d808b8c49e 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h
@@ -1,6 +1,6 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 1999.
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
@@ -21,6 +21,7 @@
#define SIGCONTEXT_EXTRA_ARGS
#define GET_PC(__ctx) ((void *) ((__ctx)->si_regs.pc))
#define ADVANCE_STACK_FRAME(__next) \
- ((void *)&(((struct reg_window *) (__next))->ins[6]))
+ ((void *) (((unsigned *)(__next))+14))
+
#define GET_STACK(__ctx) ((void *) (__ctx)->si_regs.u_regs[14])
#define GET_FRAME(__ctx) ADVANCE_STACK_FRAME (GET_STACK(__ctx))
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/procfs.h b/sysdeps/unix/sysv/linux/sparc/sys/procfs.h
new file mode 100644
index 0000000000..d7d990ce8a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sys/procfs.h
@@ -0,0 +1,109 @@
+/* Copyright (C) 1996, 1997, 1999, 2000 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 _SYS_PROCFS_H
+#define _SYS_PROCFS_H 1
+
+/* This is somehow modelled after the file of the same name on SysVr4
+ systems. It provides a definition of the core file format for ELF
+ used on Linux. */
+
+#include <features.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <sys/user.h>
+#include <asm/elf.h>
+#include <bits/wordsize.h>
+
+__BEGIN_DECLS
+
+struct elf_siginfo
+ {
+ int si_signo; /* Signal number. */
+ int si_code; /* Extra code. */
+ int si_errno; /* Errno. */
+ };
+
+/* Definitions to generate Intel SVR4-like core files. These mostly
+ have the same names as the SVR4 types with "elf_" tacked on the
+ front to prevent clashes with linux definitions, and the typedef
+ forms have been avoided. This is mostly like the SVR4 structure,
+ but more Linuxy, with things that Linux does not support and which
+ gdb doesn't really use excluded. Fields present but not used are
+ marked with "XXX". */
+struct elf_prstatus
+ {
+ struct elf_siginfo pr_info; /* Info associated with signal. */
+ short int pr_cursig; /* Current signal. */
+ unsigned long int pr_sigpend; /* Set of pending signals. */
+ unsigned long int pr_sighold; /* Set of held signals. */
+ __pid_t pr_pid;
+ __pid_t pr_ppid;
+ __pid_t pr_pgrp;
+ __pid_t pr_sid;
+ struct timeval pr_utime; /* User time. */
+ struct timeval pr_stime; /* System time. */
+ struct timeval pr_cutime; /* Cumulative user time. */
+ struct timeval pr_cstime; /* Cumulative system time. */
+ elf_gregset_t pr_reg; /* GP registers. */
+ int pr_fpvalid; /* True if math copro being used. */
+ };
+
+
+#define ELF_PRARGSZ (80) /* Number of chars for args */
+
+struct elf_prpsinfo
+ {
+ char pr_state; /* Numeric process state. */
+ char pr_sname; /* Char for pr_state. */
+ char pr_zomb; /* Zombie. */
+ char pr_nice; /* Nice val. */
+ unsigned long int pr_flag; /* Flags. */
+#if __WORDSIZE == 64
+ unsigned int pr_uid;
+ unsigned int pr_gid;
+#else
+ unsigned short int pr_uid;
+ unsigned short int pr_gid;
+#endif
+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+ /* Lots missing */
+ char pr_fname[16]; /* Filename of executable. */
+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
+ };
+
+/* Addresses. */
+typedef void *psaddr_t;
+
+/* Register sets. Linux has different names. */
+typedef gregset_t prgregset_t;
+typedef fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+ therefore habe only ine PID type. */
+typedef __pid_t lwpid_t;
+
+
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif /* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/truncate64.c b/sysdeps/unix/sysv/linux/truncate64.c
index d08adff5b6..fb3b80a411 100644
--- a/sysdeps/unix/sysv/linux/truncate64.c
+++ b/sysdeps/unix/sysv/linux/truncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000 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
@@ -28,7 +28,7 @@
#ifdef __NR_truncate64
#ifndef __ASSUME_TRUNCATE64_SYSCALL
/* The variable is shared between all wrappers around *truncate64 calls. */
-int have_no_truncate64;
+int __have_no_truncate64;
#endif
extern int __syscall_truncate64 (int fd, int high_length, int low_length);
@@ -41,7 +41,7 @@ truncate64 (path, length)
off64_t length;
{
#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (! have_no_truncate64)
+ if (! __have_no_truncate64)
#endif
{
unsigned int low = length & 0xffffffff;
@@ -58,7 +58,7 @@ truncate64 (path, length)
#ifndef __ASSUME_TRUNCATE64_SYSCALL
__set_errno (saved_errno);
- have_no_truncate64 = 1;
+ __have_no_truncate64 = 1;
#endif
}