[uClibc-cvs] uClibc/libc/sysdeps/linux/common syscalls.c, 1.110, 1.111

Erik Andersen andersen at uclibc.org
Sun Sep 7 05:02:56 UTC 2003


Update of /var/cvs/uClibc/libc/sysdeps/linux/common
In directory winder:/tmp/cvs-serv3723/libc/sysdeps/linux/common

Modified Files:
	syscalls.c 
Log Message:
A few minor syscall cleanups


Index: syscalls.c
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/common/syscalls.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- syscalls.c	22 Aug 2003 21:10:47 -0000	1.110
+++ syscalls.c	7 Sep 2003 05:02:52 -0000	1.111
@@ -271,12 +271,18 @@
 #endif
 
 //#define __NR_getuid           24
-#ifdef L_getuid
+#ifdef L___syscall_getuid
 #include <unistd.h>
 #if defined (__alpha__)
 #define __NR_getuid     __NR_getxuid
 #endif
-_syscall0(uid_t, getuid);
+#define __NR___syscall_getuid __NR_getuid
+static inline 
+_syscall0(int, __syscall_getuid);
+uid_t getuid(void)
+{
+	return(__syscall_getuid());
+}
 #endif
 
 //#define __NR_stime            25
@@ -520,21 +526,33 @@
 #endif
 
 //#define __NR_getgid           47
-#ifdef L_getgid
+#ifdef L___syscall_getgid
 #include <unistd.h>
+#define __NR___syscall_getgid __NR_getgid
 #if defined (__alpha__)
 #define __NR_getgid     __NR_getxgid
 #endif
-_syscall0(gid_t, getgid);
+static inline 
+_syscall0(int, __syscall_getgid);
+gid_t getgid(void)
+{
+	return(__syscall_getgid());
+}
 #endif
 
 //#define __NR_signal           48
 
 //#define __NR_geteuid          49
-#ifdef	L_geteuid
+#ifdef	L___syscall_geteuid
 #include <unistd.h>
 #	ifdef	__NR_geteuid
-	_syscall0(uid_t, geteuid);
+#define __NR___syscall_geteuid __NR_geteuid
+	static inline 
+	_syscall0(int, __syscall_geteuid);
+	uid_t geteuid(void)
+	{
+		return(__syscall_geteuid());
+	}
 #	else
 	uid_t geteuid(void)
 	{
@@ -544,10 +562,16 @@
 #endif
 
 //#define __NR_getegid          50
-#ifdef	L_getegid
+#ifdef	L___syscall_getegid
 #include <unistd.h>
 #	ifdef	__NR_getegid
-	_syscall0(gid_t, getegid);
+#define __NR___syscall_getegid __NR_getegid
+static inline 
+_syscall0(int, __syscall_getegid);
+gid_t getegid(void)
+{
+	return(__syscall_getegid());
+}
 #	else
 	gid_t getegid(void)
 	{
@@ -592,24 +616,25 @@
 #endif
 
 //#define __NR_fcntl            55
-#ifdef L__fcntl
+#ifdef L___syscall_fcntl
 #include <stdarg.h>
 #include <fcntl.h>
-#define __NR__fcntl __NR_fcntl
-extern int _fcntl(int fd, int cmd, long arg);
-
-_syscall3(int, _fcntl, int, fd, int, cmd, long, arg);
-
-int __libc_fcntl(int fd, int command, ...)
+#define __NR___syscall_fcntl __NR_fcntl
+static inline
+_syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg);
+int __libc_fcntl(int fd, int cmd, ...)
 {
 	long arg;
 	va_list list;
-
-	va_start(list, command);
+	if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) 
+	{
+			__set_errno(ENOSYS);
+			return -1;
+	}
+	va_start(list, cmd);
 	arg = va_arg(list, long);
-
 	va_end(list);
-	return _fcntl(fd, command, arg);
+	return(__syscall_fcntl(fd, cmd, arg));
 }
 weak_alias(__libc_fcntl, fcntl)
 #endif
@@ -862,7 +887,7 @@
 		ngids = __syscall_getgroups(n, kernel_groups);
 		if (n != 0 && ngids > 0) {
 			for (i = 0; i < ngids; i++) {
-				(groups)[i] = kernel_groups[i];
+				groups[i] = kernel_groups[i];
 			}
 		}
 		return ngids;
@@ -1416,9 +1441,15 @@
 #endif
 
 //#define __NR_flock            143
-#ifdef L_flock
+#ifdef L___syscall_flock
 #include <sys/file.h>
-_syscall2(int,flock,int,fd, int,operation);
+#define __NR___syscall_flock __NR_flock
+static inline
+_syscall2(int, __syscall_flock, int, fd, int, operation);
+int flock(int fd, int operation)
+{
+	return(__syscall_flock(fd, operation));
+}
 #endif
 
 //#define __NR_msync            144
@@ -2042,41 +2073,25 @@
 // See getdents64.c
 
 //#define __NR_fcntl64		221
-#ifdef L__fcntl64
+#ifdef L___syscall_fcntl64
 #ifdef __UCLIBC_HAS_LFS__
 #include <stdarg.h>
 #include <fcntl.h>
-#ifdef __NR_fcntl64
-#define __NR__fcntl64 __NR_fcntl64
-extern int _fcntl64(int fd, int cmd, long arg);
-
-_syscall3(int, _fcntl64, int, fd, int, cmd, long, arg);
-
-int fcntl64(int fd, int command, ...)
+#define __NR___syscall_fcntl64 __NR_fcntl64
+static inline
+_syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg);
+int __libc_fcntl64(int fd, int cmd, ...)
 {
 	long arg;
 	va_list list;
-
-	va_start(list, command);
+	va_start(list, cmd);
 	arg = va_arg(list, long);
-
 	va_end(list);
-	return _fcntl64(fd, command, arg);
+	return(__syscall_fcntl64(fd, cmd, arg));
 }
+weak_alias(__libc_fcntl64, fcntl64)
 #else
-extern int _fcntl(int fd, int cmd, long arg);
-int fcntl64(int fd, int command, ...)
-{
-	long arg;
-	va_list list;
-
-	va_start(list, command);
-	arg = va_arg(list, long);
-
-	va_end(list);
-	return _fcntl(fd, command, arg);
-}
-#endif
+weak_alias(__libc_fcntl64, __libc_fcntl)
 #endif
 #endif
 




More information about the uClibc-cvs mailing list