svn commit: trunk/uClibc/libc/sysdeps/linux/common

vapier at uclibc.org vapier at uclibc.org
Thu Sep 28 20:41:28 UTC 2006


Author: vapier
Date: 2006-09-28 13:41:28 -0700 (Thu, 28 Sep 2006)
New Revision: 16251

Log:
implement support for the rest of the 32bit uid syscalls

Modified:
   trunk/uClibc/libc/sysdeps/linux/common/chown.c
   trunk/uClibc/libc/sysdeps/linux/common/fchown.c
   trunk/uClibc/libc/sysdeps/linux/common/getgid.c
   trunk/uClibc/libc/sysdeps/linux/common/getuid.c
   trunk/uClibc/libc/sysdeps/linux/common/lchown.c
   trunk/uClibc/libc/sysdeps/linux/common/setfsgid.c
   trunk/uClibc/libc/sysdeps/linux/common/setfsuid.c
   trunk/uClibc/libc/sysdeps/linux/common/setgid.c
   trunk/uClibc/libc/sysdeps/linux/common/setregid.c
   trunk/uClibc/libc/sysdeps/linux/common/setreuid.c
   trunk/uClibc/libc/sysdeps/linux/common/setuid.c


Changeset:
Modified: trunk/uClibc/libc/sysdeps/linux/common/chown.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/chown.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/chown.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -9,10 +9,21 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#include <bits/wordsize.h>
 
 libc_hidden_proto(chown)
 
-#define __NR___syscall_chown __NR_chown
+#if (__WORDSIZE == 32 && defined(__NR_chown32)) || __WORDSIZE == 64
+# ifdef __NR_chown32
+#  undef __NR_chown
+#  define __NR_chown __NR_chown32
+# endif
+
+_syscall3(int, chown, const char *, path, uid_t, owner, gid_t, group);
+
+#else
+
+# define __NR___syscall_chown __NR_chown
 static inline _syscall3(int, __syscall_chown, const char *, path,
 		__kernel_uid_t, owner, __kernel_gid_t, group);
 
@@ -25,4 +36,6 @@
 	}
 	return (__syscall_chown(path, owner, group));
 }
+#endif
+
 libc_hidden_def(chown)

Modified: trunk/uClibc/libc/sysdeps/linux/common/fchown.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/fchown.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/fchown.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -2,24 +2,26 @@
 /*
  * fchown() for uClibc
  *
- * Copyright (C) 2000-2006 by Erik Andersen <andersen at codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen at codepoet.org>
  *
  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  */
 
 #include "syscalls.h"
 #include <unistd.h>
-#include <linux/version.h>
+#include <bits/wordsize.h>
 
-/* Linux 2.3.39 introduced 32bit UID/GIDs.  Some platforms had 32
-   bit type all along.  */
-#if LINUX_VERSION_CODE >= 131879
+#if (__WORDSIZE == 32 && defined(__NR_fchown32)) || __WORDSIZE == 64
+# ifdef __NR_fchown32
+#  undef __NR_fchown
+#  define __NR_fchown __NR_fchown32
+# endif
 
 _syscall3(int, fchown, int, fd, uid_t, owner, gid_t, group);
 
 #else
 
-#define __NR___syscall_fchown __NR_fchown
+# define __NR___syscall_fchown __NR_fchown
 static inline _syscall3(int, __syscall_fchown, int, fd,
 		__kernel_uid_t, owner, __kernel_gid_t, group);
 

Modified: trunk/uClibc/libc/sysdeps/linux/common/getgid.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/getgid.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/getgid.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -11,8 +11,14 @@
 #include <unistd.h>
 
 #if defined __NR_getxgid
+# undef __NR_getgid
 # define __NR_getgid __NR_getxgid
 #endif
+#ifdef __NR_getgid32
+# undef __NR_getgid
+# define __NR_getgid __NR_getgid32
+#endif
+
 libc_hidden_proto(getgid)
 _syscall0(gid_t, getgid);
 libc_hidden_def(getgid)

Modified: trunk/uClibc/libc/sysdeps/linux/common/getuid.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/getuid.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/getuid.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -11,8 +11,14 @@
 #include <unistd.h>
 
 #if defined __NR_getxuid
-# define __NR_getuid     __NR_getxuid
+# undef __NR_getuid
+# define __NR_getuid __NR_getxuid
 #endif
+#ifdef __NR_getuid32
+# undef __NR_getuid
+# define __NR_getuid __NR_getuid32
+#endif
+
 libc_hidden_proto(getuid)
 _syscall0(uid_t, getuid);
 libc_hidden_def(getuid)

Modified: trunk/uClibc/libc/sysdeps/linux/common/lchown.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/lchown.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/lchown.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -9,8 +9,19 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#include <bits/wordsize.h>
 
-#define __NR___syscall_lchown __NR_lchown
+#if (__WORDSIZE == 32 && defined(__NR_lchown32)) || __WORDSIZE == 64
+# ifdef __NR_lchown32
+#  undef __NR_lchown
+#  define __NR_lchown __NR_lchown32
+# endif
+
+_syscall3(int, lchown, const char *, path, uid_t, owner, gid_t, group);
+
+#else
+
+# define __NR___syscall_lchown __NR_lchown
 static inline _syscall3(int, __syscall_lchown, const char *, path,
 		__kernel_uid_t, owner, __kernel_gid_t, group);
 
@@ -23,3 +34,5 @@
 	}
 	return __syscall_lchown(path, owner, group);
 }
+
+#endif

Modified: trunk/uClibc/libc/sysdeps/linux/common/setfsgid.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/setfsgid.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/setfsgid.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -9,8 +9,19 @@
 
 #include "syscalls.h"
 #include <sys/fsuid.h>
+#include <bits/wordsize.h>
 
-#define __NR___syscall_setfsgid __NR_setfsgid
+#if (__WORDSIZE == 32 && defined(__NR_setfsgid32)) || __WORDSIZE == 64
+# ifdef __NR_setfsgid32
+#  undef __NR_setfsgid
+#  define __NR_setfsgid __NR_setfsgid32
+# endif
+
+_syscall1(int, setfsgid, gid_t, gid);
+
+#else
+
+# define __NR___syscall_setfsgid __NR_setfsgid
 static inline _syscall1(int, __syscall_setfsgid, __kernel_gid_t, gid);
 
 int setfsgid(gid_t gid)
@@ -21,3 +32,4 @@
 	}
 	return (__syscall_setfsgid(gid));
 }
+#endif

Modified: trunk/uClibc/libc/sysdeps/linux/common/setfsuid.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/setfsuid.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/setfsuid.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -9,8 +9,19 @@
 
 #include "syscalls.h"
 #include <sys/fsuid.h>
+#include <bits/wordsize.h>
 
-#define __NR___syscall_setfsuid __NR_setfsuid
+#if (__WORDSIZE == 32 && defined(__NR_setfsuid32)) || __WORDSIZE == 64
+# ifdef __NR_setfsuid32
+#  undef __NR_setfsuid
+#  define __NR_setfsuid __NR_setfsuid32
+# endif
+
+_syscall1(int, setfsuid, uid_t, uid);
+
+#else
+
+# define __NR___syscall_setfsuid __NR_setfsuid
 static inline _syscall1(int, __syscall_setfsuid, __kernel_uid_t, uid);
 
 int setfsuid(uid_t uid)
@@ -21,3 +32,4 @@
 	}
 	return (__syscall_setfsuid(uid));
 }
+#endif

Modified: trunk/uClibc/libc/sysdeps/linux/common/setgid.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/setgid.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/setgid.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -9,8 +9,19 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#include <bits/wordsize.h>
 
-#define __NR___syscall_setgid __NR_setgid
+#if (__WORDSIZE == 32 && defined(__NR_setgid32)) || __WORDSIZE == 64
+# ifdef __NR_setgid32
+#  undef __NR_setgid
+#  define __NR_setgid __NR_setgid32
+# endif
+
+_syscall1(int, setgid, gid_t, gid);
+
+#else
+
+# define __NR___syscall_setgid __NR_setgid
 static inline _syscall1(int, __syscall_setgid, __kernel_gid_t, gid);
 
 int setgid(gid_t gid)
@@ -21,3 +32,4 @@
 	}
 	return (__syscall_setgid(gid));
 }
+#endif

Modified: trunk/uClibc/libc/sysdeps/linux/common/setregid.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/setregid.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/setregid.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -9,10 +9,21 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#include <bits/wordsize.h>
 
 libc_hidden_proto(setregid)
 
-#define __NR___syscall_setregid __NR_setregid
+#if (__WORDSIZE == 32 && defined(__NR_setregid32)) || __WORDSIZE == 64
+# ifdef __NR_setregid32
+#  undef __NR_setregid
+#  define __NR_setregid __NR_setregid32
+# endif
+
+_syscall2(int, setregid, gid_t, rgid, gid_t, egid);
+
+#else
+
+# define __NR___syscall_setregid __NR_setregid
 static inline _syscall2(int, __syscall_setregid,
 		__kernel_gid_t, rgid, __kernel_gid_t, egid);
 
@@ -25,4 +36,6 @@
 	}
 	return (__syscall_setregid(rgid, egid));
 }
+#endif
+
 libc_hidden_def(setregid)

Modified: trunk/uClibc/libc/sysdeps/linux/common/setreuid.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/setreuid.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/setreuid.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -9,10 +9,21 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#include <bits/wordsize.h>
 
 libc_hidden_proto(setreuid)
 
-#define __NR___syscall_setreuid __NR_setreuid
+#if (__WORDSIZE == 32 && defined(__NR_setreuid32)) || __WORDSIZE == 64
+# ifdef __NR_setreuid32
+#  undef __NR_setreuid
+#  define __NR_setreuid __NR_setreuid32
+# endif
+
+_syscall2(int, setreuid, uid_t, ruid, uid_t, euid);
+
+#else
+
+# define __NR___syscall_setreuid __NR_setreuid
 static inline _syscall2(int, __syscall_setreuid,
 		__kernel_uid_t, ruid, __kernel_uid_t, euid);
 
@@ -25,4 +36,6 @@
 	}
 	return (__syscall_setreuid(ruid, euid));
 }
+#endif
+
 libc_hidden_def(setreuid)

Modified: trunk/uClibc/libc/sysdeps/linux/common/setuid.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/setuid.c	2006-09-28 17:38:06 UTC (rev 16250)
+++ trunk/uClibc/libc/sysdeps/linux/common/setuid.c	2006-09-28 20:41:28 UTC (rev 16251)
@@ -9,8 +9,19 @@
 
 #include "syscalls.h"
 #include <unistd.h>
+#include <bits/wordsize.h>
 
-#define __NR___syscall_setuid __NR_setuid
+#if (__WORDSIZE == 32 && defined(__NR_setuid32)) || __WORDSIZE == 64
+# ifdef __NR_setuid32
+#  undef __NR_setuid
+#  define __NR_setuid __NR_setuid32
+# endif
+
+_syscall1(int, setuid, uid_t, uid);
+
+#else
+
+# define __NR___syscall_setuid __NR_setuid
 static inline _syscall1(int, __syscall_setuid, __kernel_uid_t, uid);
 
 int setuid(uid_t uid)
@@ -21,3 +32,4 @@
 	}
 	return (__syscall_setuid(uid));
 }
+#endif




More information about the uClibc-cvs mailing list