This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

32bit UID support for glibc 2.1.3



Hi,

Linux 2.3.39 contains support for 32bit UIDs and GIDs.  Chris Wing has
made the patch for the kernel and also one for glibc.  I'm appending a
first set of patches.

Here're some comments from Chris about the patches:

> Note that 2.3.39 does not have 32-bit UIDs in the stat structure like my
> original patches did. I'm going to get this clarified, but I'm guessing
> Linus/Alan decided that the existing stat() system calls should be
> deprecated in favor of stat64() et. al., which are also now in 2.3. If
> this is the case, then the glibc patch will need to be changed to always
> use stat64() when possible, and convert the stat64 format to the old stat
> format when needed.

The patches do not handle stat and stat64 yet.  If stat doesn't go in,
the patch can be simplified a bit.  Especially the file
sysdeps/unix/sysv/linux/32bit_uid_compat.h can go away and we can
handle __libc_missing_32bit_uids as boolean value.  I'll wait for a
confirmation from the kernel side what happens and will then finalize
the patch.

> The 32-bit UID support for msgctl(), semctl(), and shmctl() should
> probably wait until glibc 2.2, since it will require adding new symbol
> versions for the above in glibc.
> 
> I'm not sure what the best thing to do is. The unfortunate fact is that it
> isn't possible for glibc to support 32-bit UIDs there without requiring
> that old applications be recompiled.
> 
> Come to think of it, we don't need a new symbol version; we can just
> change the include files in glibc so that compiles use the new 32-bit UID
> API. For backwards compatibility, glibc will have to be able to translate
> between the different binary structures, that's all.
> 
> In any case, the changeover should be done in some upcoming major release
> of glibc so that no one is suprised :)

For now, I haven't patched msgctl et al.  We might need symbol
versioning for this and I will make a separate patch.

Also missing is support for 32bit uid in struct siginfo (already in
kernel but not in my patch).  Could anybody else please look at the
patches for siginfo?

Please have a look at the patch and tell me if anything is not ok.
Ulrich, please don't apply the patch for now - I'd like first to get
some comments from the kernel side about stat.

I'll make a patch for glibc 2.2 when this patch for 2.1.3 is finished.

Btw. Mips, Alpha and Sparc64 have already 32bit UIDs - no need to
change anything for these architectures.

Thanks to Chris for the great work,
Andreas


2000-01-11  Andreas Jaeger  <aj@suse.de>

	* 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/32bit_uid_compat.h: New file.
	* 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.
	Patch by Chris Wing <wingc@engin.umich.edu>.

============================================================
Index: sysdeps/unix/sysv/linux/getresgid.c
--- sysdeps/unix/sysv/linux/getresgid.c	1998/10/21 15:10:14	1.3
+++ sysdeps/unix/sysv/linux/getresgid.c	2000/01/11 09:56:55
@@ -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,37 @@
 
 #include <sysdep.h>
 #include <sys/syscall.h>
+
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.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);
+#endif /* __NR_getresgid32 */
+
 int
 getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)
 {
   __kernel_gid_t k_rgid, k_egid, k_sgid;
   int result;
+#ifdef __NR_getresgid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_getresgid32 */
 
   result = INLINE_SYSCALL (getresgid, 3, &k_rgid, &k_egid, &k_sgid);
 
============================================================
Index: sysdeps/unix/sysv/linux/getresuid.c
--- sysdeps/unix/sysv/linux/getresuid.c	1998/10/21 15:10:22	1.3
+++ sysdeps/unix/sysv/linux/getresuid.c	2000/01/11 09:56:55
@@ -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,37 @@
 
 #include <sysdep.h>
 #include <sys/syscall.h>
+
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.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);
+#endif /* __NR_getresuid32 */
+
 int
 getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)
 {
   __kernel_uid_t k_ruid, k_euid, k_suid;
   int result;
+#ifdef __NR_getresuid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_getresuid32 */
 
   result = INLINE_SYSCALL (getresuid, 3, &k_ruid, &k_euid, &k_suid);
 
============================================================
Index: sysdeps/unix/sysv/linux/setegid.c
--- sysdeps/unix/sysv/linux/setegid.c	1995/09/08 14:01:33	1.1
+++ sysdeps/unix/sysv/linux/setegid.c	2000/01/11 09:56:55
@@ -1 +1,51 @@
-#include <sysdeps/unix/bsd/setegid.c>
+/* 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 <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
============================================================
Index: sysdeps/unix/sysv/linux/i386/chown.c
--- sysdeps/unix/sysv/linux/i386/chown.c	1998/10/21 15:16:40	1.5
+++ sysdeps/unix/sysv/linux/i386/chown.c	2000/01/11 09:56:55
@@ -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,6 +22,10 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
+#include <linux/posix_types.h>
+
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
 /*
   In Linux 2.1.x the chown functions have been changed.  A new function lchown
   was introduced.  The new chown now follows symlinks - the old chown and the
@@ -38,6 +42,10 @@
 /* Running under Linux > 2.1.80.  */
 static int __libc_old_chown;
 
+#ifdef __NR_chown32
+extern int __syscall_chown32 (const char *__file,
+			      __kernel_uid32_t owner, __kernel_gid32_t group);
+#endif /* __NR_chown32 */
 
 int
 __real_chown (const char *file, uid_t owner, gid_t group)
@@ -47,6 +55,20 @@
   if (!__libc_old_chown)
     {
       int saved_errno = errno;
+#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 */
       result = INLINE_SYSCALL (chown, 3, file, owner, group);
 
       if (result >= 0 || errno != ENOSYS)
============================================================
Index: sysdeps/unix/sysv/linux/i386/getgroups.c
--- sysdeps/unix/sysv/linux/i386/getgroups.c	1998/10/22 11:47:31	1.3
+++ sysdeps/unix/sysv/linux/i386/getgroups.c	2000/01/11 09:56:55
@@ -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
@@ -26,8 +26,14 @@
 
 #include <linux/posix_types.h>
 
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
 extern int __syscall_getgroups __P ((int, __kernel_gid_t *));
 
+#ifdef __NR_getgroups32
+extern int __syscall_getgroups32 __P ((int, __kernel_gid32_t *));
+#endif /* __NR_getgroups32 */
+
 /* For Linux we must convert the array of groups from the format that the
    kernel returns.  */
 int
@@ -44,6 +50,20 @@
     {
       int i, ngids;
       __kernel_gid_t kernel_groups[n = MIN (n, __sysconf (_SC_NGROUPS_MAX))];
+#ifdef __NR_getgroups32
+      if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+	{
+	  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 = NO_HIGHUIDS;
+	}
+#endif /* __NR_getgroups32 */
 
       ngids = INLINE_SYSCALL (getgroups, 2, n, kernel_groups);
       if (n != 0 && ngids > 0)
============================================================
Index: sysdeps/unix/sysv/linux/i386/setegid.c
--- sysdeps/unix/sysv/linux/i386/setegid.c	1998/10/16 16:25:41	1.1
+++ sysdeps/unix/sysv/linux/i386/setegid.c	2000/01/11 09:56:55
@@ -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
@@ -26,12 +26,5 @@
 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);
 }
============================================================
Index: sysdeps/unix/sysv/linux/i386/seteuid.c
--- sysdeps/unix/sysv/linux/i386/seteuid.c	1998/10/16 16:25:45	1.1
+++ sysdeps/unix/sysv/linux/i386/seteuid.c	2000/01/11 09:56:55
@@ -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
@@ -31,14 +31,6 @@
 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);
============================================================
Index: sysdeps/unix/sysv/linux/i386/setfsgid.c
--- sysdeps/unix/sysv/linux/i386/setfsgid.c	1998/11/30 14:21:33	1.3
+++ sysdeps/unix/sysv/linux/i386/setfsgid.c	2000/01/11 09:56:55
@@ -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,12 +25,33 @@
 
 #include <linux/posix_types.h>
 
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
 #ifdef __NR_setfsgid
+
 extern int __syscall_setfsgid (__kernel_gid_t);
 
+#ifdef __NR_setfsgid32
+extern int __syscall_setfsgid32 (__kernel_gid32_t);
+#endif /* __NR_setfsgid32 */
+
 int
 setfsgid (gid_t gid)
 {
+#ifdef __NR_setfsgid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_setfsgid32 */
   if (gid != (gid_t) ((__kernel_gid_t) gid))
     {
       __set_errno (EINVAL);
============================================================
Index: sysdeps/unix/sysv/linux/i386/setfsuid.c
--- sysdeps/unix/sysv/linux/i386/setfsuid.c	1998/11/30 14:21:34	1.3
+++ sysdeps/unix/sysv/linux/i386/setfsuid.c	2000/01/11 09:56:55
@@ -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,12 +25,35 @@
 
 #include <linux/posix_types.h>
 
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
 #ifdef __NR_setfsuid
+
 extern int __syscall_setfsuid (__kernel_uid_t);
 
+#ifdef __NR_setfsuid32
+extern int __syscall_setfsuid32 (__kernel_uid32_t);
+#else
+#endif /* __NR_setfsuid32 */
+
 int
 setfsuid (uid_t uid)
 {
+#ifdef __NR_setfsuid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_setfsuid32 */
+
   if (uid != (uid_t) ((__kernel_uid_t) uid))
     {
       __set_errno (EINVAL);
============================================================
Index: sysdeps/unix/sysv/linux/i386/setgid.c
--- sysdeps/unix/sysv/linux/i386/setgid.c	1998/10/21 15:20:39	1.2
+++ sysdeps/unix/sysv/linux/i386/setgid.c	2000/01/11 09:56:55
@@ -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,33 @@
 
 #include <linux/posix_types.h>
 
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
 extern int __syscall_setgid (__kernel_gid_t);
 
+#ifdef __NR_setgid32
+extern int __syscall_setgid32 (__kernel_gid32_t);
+#endif /* __NR_setgid32 */
+
 int
 __setgid (gid_t gid)
 {
+#ifdef __NR_setgid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_setgid32 */
+
   if (gid == (gid_t) ~0
       || gid != (gid_t) ((__kernel_gid_t) gid))
     {
============================================================
Index: sysdeps/unix/sysv/linux/i386/setgroups.c
--- sysdeps/unix/sysv/linux/i386/setgroups.c	1998/11/02 10:04:58	1.6
+++ sysdeps/unix/sysv/linux/i386/setgroups.c	2000/01/11 09:56:55
@@ -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
@@ -26,8 +26,14 @@
 
 #include <linux/posix_types.h>
 
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
 extern int __syscall_setgroups __P ((int, const __kernel_gid_t *));
 
+#ifdef __NR_setgroups32
+extern int __syscall_setgroups32 __P ((int, const __kernel_gid32_t *));
+#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.  */
@@ -45,7 +51,20 @@
     {
       size_t i;
       __kernel_gid_t kernel_groups[n];
-
+#ifdef __NR_setgroups32
+      if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+	{
+	  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 = NO_HIGHUIDS;
+	}
+#endif /* __NR_setgroups32 */
       for (i = 0; i < n; i++)
 	{
 	  kernel_groups[i] = groups[i];
============================================================
Index: sysdeps/unix/sysv/linux/i386/setregid.c
--- sysdeps/unix/sysv/linux/i386/setregid.c	1998/10/21 15:21:09	1.1
+++ sysdeps/unix/sysv/linux/i386/setregid.c	2000/01/11 09:56:55
@@ -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,32 @@
 
 #include <linux/posix_types.h>
 
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
 extern int __syscall_setregid (__kernel_gid_t, __kernel_gid_t);
 
+#ifdef __NR_setregid32
+extern int __syscall_setregid32 (__kernel_gid32_t, __kernel_gid32_t);
+#endif /* __NR_setregid32 */
+
 int
 __setregid (gid_t rgid, gid_t egid)
 {
+#ifdef __NR_setregid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#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))
     {
============================================================
Index: sysdeps/unix/sysv/linux/i386/setresgid.c
--- sysdeps/unix/sysv/linux/i386/setresgid.c	1998/10/21 15:25:36	1.3
+++ sysdeps/unix/sysv/linux/i386/setresgid.c	2000/01/11 09:56:55
@@ -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,36 @@
 
 #include <sysdep.h>
 #include <sys/syscall.h>
+
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.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);
+#endif /* __NR_setresgid32 */
+
 int
 setresgid (gid_t rgid, gid_t egid, gid_t sgid)
 {
+#ifdef __NR_setresgid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#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))
============================================================
Index: sysdeps/unix/sysv/linux/i386/setresuid.c
--- sysdeps/unix/sysv/linux/i386/setresuid.c	1998/10/21 15:25:37	1.4
+++ sysdeps/unix/sysv/linux/i386/setresuid.c	2000/01/11 09:56:57
@@ -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,36 @@
 
 #include <sysdep.h>
 #include <sys/syscall.h>
+
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.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);
+#endif /* __NR_setresuid32 */
+
 int
 __setresuid (uid_t ruid, uid_t euid, uid_t suid)
 {
+#ifdef __NR_setresuid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#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))
============================================================
Index: sysdeps/unix/sysv/linux/i386/setreuid.c
--- sysdeps/unix/sysv/linux/i386/setreuid.c	1998/10/21 15:21:15	1.1
+++ sysdeps/unix/sysv/linux/i386/setreuid.c	2000/01/11 09:56:57
@@ -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,32 @@
 
 #include <linux/posix_types.h>
 
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
 extern int __syscall_setreuid (__kernel_uid_t, __kernel_uid_t);
 
+#ifdef __NR_setreuid32
+extern int __syscall_setreuid32 (__kernel_uid32_t, __kernel_uid32_t);
+#endif /* __NR_setreuid32 */
+
 int
 __setreuid (uid_t ruid, uid_t euid)
 {
+#ifdef __NR_setreuid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#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))
     {
============================================================
Index: sysdeps/unix/sysv/linux/i386/setuid.c
--- sysdeps/unix/sysv/linux/i386/setuid.c	1998/10/21 15:25:45	1.2
+++ sysdeps/unix/sysv/linux/i386/setuid.c	2000/01/11 09:56:57
@@ -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,32 @@
 
 #include <linux/posix_types.h>
 
+#include <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
 extern int __syscall_setuid (__kernel_uid_t);
 
+#ifdef __NR_setuid32
+extern int __syscall_setuid32 (__kernel_uid32_t);
+#endif /* __NR_setuid32 */
+
 int
 __setuid (uid_t uid)
 {
+#ifdef __NR_setuid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_setuid32 */
+
   if (uid == (uid_t) ~0
       || uid != (uid_t) ((__kernel_uid_t) uid))
     {
============================================================
Index: sysdeps/unix/sysv/linux/32bit_uid_compat.h
--- sysdeps/unix/sysv/linux/32bit_uid_compat.h	created
+++ sysdeps/unix/sysv/linux/32bit_uid_compat.h	Tue Jan 11 10:22:22 2000	1.1
@@ -0,0 +1,30 @@
+/* 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.  */
+
+/* Are we compiling against a kernel that has support for 32-bit UIDs?  */
+#ifdef __NR_getuid32
+
+/* Global libc variable so that we don't bother checking to see what
+   kernel we are running on every time we make a system call.  */
+
+#define DONT_KNOW	0
+#define HAVE_HIGHUIDS	1
+#define NO_HIGHUIDS	2
+extern int __libc_missing_32bit_uids;
+
+#endif /* __NR_getuid32 */
============================================================
Index: sysdeps/unix/sysv/linux/arm/chown.c
--- sysdeps/unix/sysv/linux/arm/chown.c	created
+++ sysdeps/unix/sysv/linux/arm/chown.c	Tue Jan 11 09:38:53 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/m68k/chown.c>
============================================================
Index: sysdeps/unix/sysv/linux/arm/fchown.c
--- sysdeps/unix/sysv/linux/arm/fchown.c	created
+++ sysdeps/unix/sysv/linux/arm/fchown.c	Tue Jan 11 09:38:53 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
============================================================
Index: sysdeps/unix/sysv/linux/arm/geteuid.c
--- sysdeps/unix/sysv/linux/arm/geteuid.c	created
+++ sysdeps/unix/sysv/linux/arm/geteuid.c	Tue Jan 11 09:38:53 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
============================================================
Index: sysdeps/unix/sysv/linux/arm/getegid.c
--- sysdeps/unix/sysv/linux/arm/getegid.c	created
+++ sysdeps/unix/sysv/linux/arm/getegid.c	Tue Jan 11 09:38:53 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
============================================================
Index: sysdeps/unix/sysv/linux/arm/getuid.c
--- sysdeps/unix/sysv/linux/arm/getuid.c	created
+++ sysdeps/unix/sysv/linux/arm/getuid.c	Tue Jan 11 09:38:53 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
============================================================
Index: sysdeps/unix/sysv/linux/arm/getgid.c
--- sysdeps/unix/sysv/linux/arm/getgid.c	created
+++ sysdeps/unix/sysv/linux/arm/getgid.c	Tue Jan 11 09:38:53 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getgid.c>
============================================================
Index: sysdeps/unix/sysv/linux/arm/lchown.c
--- sysdeps/unix/sysv/linux/arm/lchown.c	created
+++ sysdeps/unix/sysv/linux/arm/lchown.c	Tue Jan 11 09:38:53 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lchown.c>
============================================================
Index: sysdeps/unix/sysv/linux/i386/fchown.c
--- sysdeps/unix/sysv/linux/i386/fchown.c	created
+++ sysdeps/unix/sysv/linux/i386/fchown.c	Tue Jan 11 09:45:44 2000	1.1
@@ -0,0 +1,65 @@
+/* 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 <sysdeps/unix/sysv/linux/32bit_uid_compat.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);
+#endif /* __NR_fchown32 */
+
+int
+__fchown (int fd, uid_t owner, gid_t group)
+{
+#ifdef __NR_fchown32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#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);
+}
+
+weak_alias (__fchown, fchown)
============================================================
Index: sysdeps/unix/sysv/linux/i386/getegid.c
--- sysdeps/unix/sysv/linux/i386/getegid.c	created
+++ sysdeps/unix/sysv/linux/i386/getegid.c	Tue Jan 11 09:46:37 2000	1.1
@@ -0,0 +1,56 @@
+/* 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 <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
+extern int __syscall_getegid (void);
+
+#ifdef __NR_getegid32
+extern int __syscall_getegid32 (void);
+#endif /* __NR_getegid32 */
+
+gid_t
+__getegid (void)
+{
+#ifdef __NR_getegid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_getegid32 */
+
+  return INLINE_SYSCALL (getegid, 0);
+}
+
+weak_alias (__getegid, getegid)
============================================================
Index: sysdeps/unix/sysv/linux/i386/geteuid.c
--- sysdeps/unix/sysv/linux/i386/geteuid.c	created
+++ sysdeps/unix/sysv/linux/i386/geteuid.c	Tue Jan 11 09:47:52 2000	1.1
@@ -0,0 +1,56 @@
+/* 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 <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
+extern int __syscall_geteuid (void);
+
+#ifdef __NR_geteuid32
+extern int __syscall_geteuid32 (void);
+#endif /* __NR_geteuid32 */
+
+uid_t
+__geteuid (void)
+{
+#ifdef __NR_geteuid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_geteuid32 */
+
+  return INLINE_SYSCALL (geteuid, 0);
+}
+
+weak_alias (__geteuid, geteuid)
============================================================
Index: sysdeps/unix/sysv/linux/i386/getgid.c
--- sysdeps/unix/sysv/linux/i386/getgid.c	created
+++ sysdeps/unix/sysv/linux/i386/getgid.c	Tue Jan 11 09:48:00 2000	1.1
@@ -0,0 +1,56 @@
+/* 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 <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
+extern int __syscall_getgid (void);
+
+#ifdef __NR_getgid32
+extern int __syscall_getgid32 (void);
+#endif /* __NR_getgid32 */
+
+gid_t
+__getgid (void)
+{
+#ifdef __NR_getgid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_getgid32 */
+
+  return INLINE_SYSCALL (getgid, 0);
+}
+
+weak_alias (__getgid, getgid)
============================================================
Index: sysdeps/unix/sysv/linux/i386/getuid.c
--- sysdeps/unix/sysv/linux/i386/getuid.c	created
+++ sysdeps/unix/sysv/linux/i386/getuid.c	Tue Jan 11 09:49:46 2000	1.1
@@ -0,0 +1,57 @@
+/* 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 <sysdeps/unix/sysv/linux/32bit_uid_compat.h>
+
+extern int __syscall_getuid (void);
+
+#ifdef __NR_getuid32
+extern int __syscall_getuid32 (void);
+int __libc_missing_32bit_uids;
+#endif /* __NR_getuid32 */
+
+uid_t
+__getuid (void)
+{
+#ifdef __NR_getuid32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#endif /* __NR_getuid32 */
+
+  return INLINE_SYSCALL (getuid, 0);
+}
+
+weak_alias (__getuid, getuid)
============================================================
Index: sysdeps/unix/sysv/linux/i386/lchown.c
--- sysdeps/unix/sysv/linux/i386/lchown.c	created
+++ sysdeps/unix/sysv/linux/i386/lchown.c	Tue Jan 11 09:50:19 2000	1.1
@@ -0,0 +1,67 @@
+/* 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 <sysdeps/unix/sysv/linux/32bit_uid_compat.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);
+#endif /* __NR_lchown32 */
+
+int
+__lchown (const char *file, uid_t owner, gid_t group)
+{
+#ifdef __NR_lchown32
+  if (__libc_missing_32bit_uids != NO_HIGHUIDS)
+    {
+      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 = NO_HIGHUIDS;
+    }
+#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)
============================================================
Index: sysdeps/unix/sysv/linux/m68k/chown.c
--- sysdeps/unix/sysv/linux/m68k/chown.c	created
+++ sysdeps/unix/sysv/linux/m68k/chown.c	Tue Jan 11 09:36:21 2000	1.1
@@ -0,0 +1,57 @@
+/* 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 <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)
============================================================
Index: sysdeps/unix/sysv/linux/m68k/fchown.c
--- sysdeps/unix/sysv/linux/m68k/fchown.c	created
+++ sysdeps/unix/sysv/linux/m68k/fchown.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
============================================================
Index: sysdeps/unix/sysv/linux/m68k/getegid.c
--- sysdeps/unix/sysv/linux/m68k/getegid.c	created
+++ sysdeps/unix/sysv/linux/m68k/getegid.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
============================================================
Index: sysdeps/unix/sysv/linux/m68k/geteuid.c
--- sysdeps/unix/sysv/linux/m68k/geteuid.c	created
+++ sysdeps/unix/sysv/linux/m68k/geteuid.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
============================================================
Index: sysdeps/unix/sysv/linux/m68k/getgid.c
--- sysdeps/unix/sysv/linux/m68k/getgid.c	created
+++ sysdeps/unix/sysv/linux/m68k/getgid.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getgid.c>
============================================================
Index: sysdeps/unix/sysv/linux/m68k/getuid.c
--- sysdeps/unix/sysv/linux/m68k/getuid.c	created
+++ sysdeps/unix/sysv/linux/m68k/getuid.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
============================================================
Index: sysdeps/unix/sysv/linux/m68k/lchown.c
--- sysdeps/unix/sysv/linux/m68k/lchown.c	created
+++ sysdeps/unix/sysv/linux/m68k/lchown.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lchown.c>
============================================================
Index: sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
--- sysdeps/unix/sysv/linux/sparc/sparc32/chown.c	created
+++ sysdeps/unix/sysv/linux/sparc/sparc32/chown.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/m68k/chown.c>
============================================================
Index: sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c
--- sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c	created
+++ sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
============================================================
Index: sysdeps/unix/sysv/linux/sparc/sparc32/getegid.c
--- sysdeps/unix/sysv/linux/sparc/sparc32/getegid.c	created
+++ sysdeps/unix/sysv/linux/sparc/sparc32/getegid.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
============================================================
Index: sysdeps/unix/sysv/linux/sparc/sparc32/geteuid.c
--- sysdeps/unix/sysv/linux/sparc/sparc32/geteuid.c	created
+++ sysdeps/unix/sysv/linux/sparc/sparc32/geteuid.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
============================================================
Index: sysdeps/unix/sysv/linux/sparc/sparc32/getgid.c
--- sysdeps/unix/sysv/linux/sparc/sparc32/getgid.c	created
+++ sysdeps/unix/sysv/linux/sparc/sparc32/getgid.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getgid.c>
============================================================
Index: sysdeps/unix/sysv/linux/sparc/sparc32/getuid.c
--- sysdeps/unix/sysv/linux/sparc/sparc32/getuid.c	created
+++ sysdeps/unix/sysv/linux/sparc/sparc32/getuid.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
============================================================
Index: sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c
--- sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c	created
+++ sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c	Tue Jan 11 09:38:56 2000	1.1
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lchown.c>

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]