#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);
}
return (__syscall_chown(path, owner, group));
}
+#endif
+
libc_hidden_def(chown)
/*
* fchown() for uClibc
*
- * Copyright (C) 2000-2006 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@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);
#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)
#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)
#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);
}
return __syscall_lchown(path, owner, group);
}
+
+#endif
#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)
}
return (__syscall_setfsgid(gid));
}
+#endif
#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)
}
return (__syscall_setfsuid(uid));
}
+#endif
#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)
}
return (__syscall_setgid(gid));
}
+#endif
#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);
}
return (__syscall_setregid(rgid, egid));
}
+#endif
+
libc_hidden_def(setregid)
#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);
}
return (__syscall_setreuid(ruid, euid));
}
+#endif
+
libc_hidden_def(setreuid)
#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)
}
return (__syscall_setuid(uid));
}
+#endif