#define __NR_preadv 333
#define __NR_pwritev 334
+/* fixup legacy 16-bit junk */
+#undef __NR_lchown
+#undef __NR_getuid
+#undef __NR_getgid
+#undef __NR_geteuid
+#undef __NR_getegid
+#undef __NR_setreuid
+#undef __NR_setregid
+#undef __NR_getgroups
+#undef __NR_setgroups
+#undef __NR_fchown
+#undef __NR_setresuid
+#undef __NR_getresuid
+#undef __NR_setresgid
+#undef __NR_getresgid
+#undef __NR_chown
+#undef __NR_setuid
+#undef __NR_setgid
+#undef __NR_setfsuid
+#undef __NR_setfsgid
+#define __NR_lchown __NR_lchown32
+#define __NR_getuid __NR_getuid32
+#define __NR_getgid __NR_getgid32
+#define __NR_geteuid __NR_geteuid32
+#define __NR_getegid __NR_getegid32
+#define __NR_setreuid __NR_setreuid32
+#define __NR_setregid __NR_setregid32
+#define __NR_getgroups __NR_getgroups32
+#define __NR_setgroups __NR_setgroups32
+#define __NR_fchown __NR_fchown32
+#define __NR_setresuid __NR_setresuid32
+#define __NR_getresuid __NR_getresuid32
+#define __NR_setresgid __NR_setresgid32
+#define __NR_getresgid __NR_getresgid32
+#define __NR_chown __NR_chown32
+#define __NR_setuid __NR_setuid32
+#define __NR_setgid __NR_setgid32
+#define __NR_setfsuid __NR_setfsuid32
+#define __NR_setfsgid __NR_setfsgid32
+
#undef O_LARGEFILE
#define O_LARGEFILE 0100000
#define __syscall_ioctl(fd,ioc,arg) syscall3(__NR_ioctl, (fd), (ioc), (long)(arg))
#define __syscall_exit(code) syscall1(__NR_exit, code)
-#define __NEED_off_t
-#include <bits/alltypes.h>
-
-static inline off_t __syscall_lseek(int fd, off_t offset, int whence)
-{
- off_t result;
- return syscall5(__NR__llseek, fd, offset>>32, offset, (long)&result, whence) ? -1 : result;
-}
-
#endif
#include <unistd.h>
-#define SYSCALL_STANDALONE
#include "syscall.h"
int setgroups(int count, const gid_t list[])
{
- /* this depends on our gid_t being 32bit */
- return syscall2(__NR_setgroups32, count, (long)list);
+ return syscall2(__NR_setgroups, count, (long)list);
}
if (sizeof(off_t) > sizeof(long))
if (((long)off & 0xfff) | ((long)((unsigned long long)off>>(12 + 8*(sizeof(off_t)-sizeof(long))))))
start = (void *)-1;
+#ifdef __NR_mmap2
return (void *)syscall6(__NR_mmap2, (long)start, len, prot, flags, fd, off>>12);
+#else
+ return (void *)syscall6(__NR_mmap, (long)start, len, prot, flags, fd, off);
+#endif
}
weak_alias(__mmap, mmap);
off_t __stdio_seek(FILE *f, off_t off, int whence)
{
- off_t ret = __syscall_lseek(f->fd, off, whence);
+ off_t ret;
+#ifdef __NR__llseek
+ if (syscall5(__NR__llseek, f->fd, off>>32, off, (long)&ret, whence)<0)
+ ret = -1;
+#else
+ ret = syscall3(__NR_lseek, f->fd, off, whence);
+#endif
/* Detect unseekable files and optimize future failures out */
if (ret < 0 && off == 0 && whence == SEEK_CUR)
f->seek = retneg1;
int chown(const char *path, uid_t uid, gid_t gid)
{
- return syscall3(__NR_chown32, (long)path, uid, gid);
+ return syscall3(__NR_chown, (long)path, uid, gid);
}
int fchown(int fd, uid_t uid, gid_t gid)
{
- return syscall3(__NR_fchown32, fd, uid, gid);
+ return syscall3(__NR_fchown, fd, uid, gid);
}
gid_t getegid(void)
{
- return syscall0(__NR_getegid32);
+ return syscall0(__NR_getegid);
}
uid_t geteuid(void)
{
- return syscall0(__NR_geteuid32);
+ return syscall0(__NR_geteuid);
}
gid_t getgid(void)
{
- return syscall0(__NR_getgid32);
+ return syscall0(__NR_getgid);
}
int getgroups(int count, gid_t list[])
{
- /* this depends on our gid_t being 32bit */
- return syscall2(__NR_getgroups32, count, (long)list);
+ return syscall2(__NR_getgroups, count, (long)list);
}
uid_t getuid(void)
{
- return syscall0(__NR_getuid32);
+ return syscall0(__NR_getuid);
}
int lchown(const char *path, uid_t uid, gid_t gid)
{
- return syscall3(__NR_lchown32, (long)path, uid, gid);
+ return syscall3(__NR_lchown, (long)path, uid, gid);
}
off_t lseek(int fd, off_t offset, int whence)
{
- /* optimized away at compiletime */
- if (sizeof(long) == 8)
- return syscall3(__NR_lseek, fd, offset, whence);
- else {
- off_t result;
- return syscall5(__NR__llseek, fd, offset>>32, offset, (long)&result, whence) ? -1 : result;
- }
+#ifdef __NR__llseek
+ off_t result;
+ return syscall5(__NR__llseek, fd, offset>>32, offset, (long)&result, whence) ? -1 : result;
+#else
+ return syscall3(__NR_lseek, fd, offset, whence);
+#endif
}
LFS64(lseek);
#include <unistd.h>
+#include <sys/resource.h>
#include "syscall.h"
int nice(int inc)
{
+#ifdef __NR_nice
return syscall1(__NR_nice, inc);
+#else
+ return setpriority(PRIO_PROCESS, 0, getpriority(PRIO_PROCESS, 0)+inc);
+#endif
}
int setgid(gid_t gid)
{
- if (libc.rsyscall) return libc.rsyscall(__NR_setgid32, gid, 0, 0, 0, 0, 0);
- return syscall1(__NR_setgid32, gid);
+ if (libc.rsyscall) return libc.rsyscall(__NR_setgid, gid, 0, 0, 0, 0, 0);
+ return syscall1(__NR_setgid, gid);
}
int setregid(gid_t rgid, gid_t egid)
{
- if (libc.rsyscall) return libc.rsyscall(__NR_setregid32, rgid, egid, 0, 0, 0, 0);
- return syscall2(__NR_setregid32, rgid, egid);
+ if (libc.rsyscall) return libc.rsyscall(__NR_setregid, rgid, egid, 0, 0, 0, 0);
+ return syscall2(__NR_setregid, rgid, egid);
}
int setreuid(uid_t ruid, uid_t euid)
{
- if (libc.rsyscall) return libc.rsyscall(__NR_setreuid32, ruid, euid, 0, 0, 0, 0);
- return syscall2(__NR_setreuid32, ruid, euid);
+ if (libc.rsyscall) return libc.rsyscall(__NR_setreuid, ruid, euid, 0, 0, 0, 0);
+ return syscall2(__NR_setreuid, ruid, euid);
}
int setuid(uid_t uid)
{
- if (libc.rsyscall) return libc.rsyscall(__NR_setuid32, uid, 0, 0, 0, 0, 0);
- return syscall1(__NR_setuid32, uid);
+ if (libc.rsyscall) return libc.rsyscall(__NR_setuid, uid, 0, 0, 0, 0, 0);
+ return syscall1(__NR_setuid, uid);
}