diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-09-08 22:43:14 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-09-08 22:43:14 -0400 |
commit | 208eb584efbf995e0c5d92f76d5f4c08ae0054b4 (patch) | |
tree | 1d2613b937b371ca2fb3a1d550758ac298a4ebb7 /arch/arm | |
parent | fe0260400eebb613338a720c9568c10ab4f17225 (diff) | |
download | musl-208eb584efbf995e0c5d92f76d5f4c08ae0054b4.tar.gz musl-208eb584efbf995e0c5d92f76d5f4c08ae0054b4.tar.xz musl-208eb584efbf995e0c5d92f76d5f4c08ae0054b4.zip |
syscall organization overhaul
now public syscall.h only exposes __NR_* and SYS_* constants and the variadic syscall function. no macros or inline functions, no __syscall_ret or other internal details, no 16-/32-bit legacy syscall renaming, etc. this logic has all been moved to src/internal/syscall.h with the arch-specific parts in arch/$(ARCH)/syscall_arch.h, and the amount of arch-specific stuff has been reduced to a minimum. changes still need to be reviewed/double-checked. minimal testing on i386 and mips has already been performed.
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/bits/syscall.h | 191 | ||||
-rw-r--r-- | arch/arm/syscall_arch.h | 41 |
2 files changed, 41 insertions, 191 deletions
diff --git a/arch/arm/bits/syscall.h b/arch/arm/bits/syscall.h index c5e25b76..1be213d0 100644 --- a/arch/arm/bits/syscall.h +++ b/arch/arm/bits/syscall.h @@ -1,50 +1,3 @@ -#define __SYSCALL_LL_E(x) \ -((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ -((union { long long ll; long l[2]; }){ .ll = x }).l[1] -#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) - -#define __SYSCALL_SSLEN 8 - -long (__syscall)(long, ...); - -static __inline long __syscall0(long n) -{ - return (__syscall)(n); -} - -static __inline long __syscall1(long n, long a) -{ - return (__syscall)(n, a); -} - -static __inline long __syscall2(long n, long a, long b) -{ - return (__syscall)(n, a, b); -} - -static __inline long __syscall3(long n, long a, long b, long c) -{ - return (__syscall)(n, a, b, c); -} - -static __inline long __syscall4(long n, long a, long b, long c, long d) -{ - return (__syscall)(n, a, b, c, d); -} - -static __inline long __syscall5(long n, long a, long b, long c, long d, long e) -{ - return (__syscall)(n, a, b, c, d, e); -} - -static __inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) -{ - return (__syscall)(n, a, b, c, d, e, f); -} - -#define __socketcall(nm,a,b,c,d,e,f) syscall(SYS_##nm, a, b, c, d, e, f) -#define __socketcall_cp(nm,a,b,c,d,e,f) syscall_cp(SYS_##nm, a, b, c, d, e, f) - #define __NR_restart_syscall 0 #define __NR_exit 1 #define __NR_fork 2 @@ -379,78 +332,6 @@ static __inline long __syscall6(long n, long a, long b, long c, long d, long e, #define __NR_process_vm_readv 376 #define __NR_process_vm_writev 377 -/* 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 - - -/* fixup legacy 32-bit-vs-lfs64 junk */ -#undef __NR_fcntl -#undef __NR_getdents -#undef __NR_ftruncate -#undef __NR_truncate -#undef __NR_stat -#undef __NR_fstat -#undef __NR_lstat -#undef __NR_statfs -#undef __NR_fstatfs -#define __NR_fcntl __NR_fcntl64 -#define __NR_getdents __NR_getdents64 -#define __NR_ftruncate __NR_ftruncate64 -#define __NR_truncate __NR_truncate64 -#define __NR_stat __NR_stat64 -#define __NR_fstat __NR_fstat64 -#define __NR_lstat __NR_lstat64 -#define __NR_statfs __NR_statfs64 -#define __NR_fstatfs __NR_fstatfs64 -#define __NR_fstatat __NR_fstatat64 -#define __NR_pread __NR_pread64 -#define __NR_pwrite __NR_pwrite64 - -#define __NR_fadvise __NR_fadvise64_64 - -#undef __NR_getrlimit -#define __NR_getrlimit __NR_ugetrlimit - -#undef __NR_select -#define __NR_select __NR__newselect - /* Repeated with SYS_ prefix */ @@ -787,75 +668,3 @@ static __inline long __syscall6(long n, long a, long b, long c, long d, long e, #define SYS_setns 375 #define SYS_process_vm_readv 376 #define SYS_process_vm_writev 377 - -/* fixup legacy 16-bit junk */ -#undef SYS_lchown -#undef SYS_getuid -#undef SYS_getgid -#undef SYS_geteuid -#undef SYS_getegid -#undef SYS_setreuid -#undef SYS_setregid -#undef SYS_getgroups -#undef SYS_setgroups -#undef SYS_fchown -#undef SYS_setresuid -#undef SYS_getresuid -#undef SYS_setresgid -#undef SYS_getresgid -#undef SYS_chown -#undef SYS_setuid -#undef SYS_setgid -#undef SYS_setfsuid -#undef SYS_setfsgid -#define SYS_lchown SYS_lchown32 -#define SYS_getuid SYS_getuid32 -#define SYS_getgid SYS_getgid32 -#define SYS_geteuid SYS_geteuid32 -#define SYS_getegid SYS_getegid32 -#define SYS_setreuid SYS_setreuid32 -#define SYS_setregid SYS_setregid32 -#define SYS_getgroups SYS_getgroups32 -#define SYS_setgroups SYS_setgroups32 -#define SYS_fchown SYS_fchown32 -#define SYS_setresuid SYS_setresuid32 -#define SYS_getresuid SYS_getresuid32 -#define SYS_setresgid SYS_setresgid32 -#define SYS_getresgid SYS_getresgid32 -#define SYS_chown SYS_chown32 -#define SYS_setuid SYS_setuid32 -#define SYS_setgid SYS_setgid32 -#define SYS_setfsuid SYS_setfsuid32 -#define SYS_setfsgid SYS_setfsgid32 - - -/* fixup legacy 32-bit-vs-lfs64 junk */ -#undef SYS_fcntl -#undef SYS_getdents -#undef SYS_ftruncate -#undef SYS_truncate -#undef SYS_stat -#undef SYS_fstat -#undef SYS_lstat -#undef SYS_statfs -#undef SYS_fstatfs -#define SYS_fcntl SYS_fcntl64 -#define SYS_getdents SYS_getdents64 -#define SYS_ftruncate SYS_ftruncate64 -#define SYS_truncate SYS_truncate64 -#define SYS_stat SYS_stat64 -#define SYS_fstat SYS_fstat64 -#define SYS_lstat SYS_lstat64 -#define SYS_statfs SYS_statfs64 -#define SYS_fstatfs SYS_fstatfs64 -#define SYS_fstatat SYS_fstatat64 -#define SYS_pread SYS_pread64 -#define SYS_pwrite SYS_pwrite64 - -#define SYS_fadvise SYS_fadvise64_64 - -#undef SYS_getrlimit -#define SYS_getrlimit SYS_ugetrlimit - -#undef SYS_select -#define SYS_select SYS__newselect diff --git a/arch/arm/syscall_arch.h b/arch/arm/syscall_arch.h new file mode 100644 index 00000000..48b0e36b --- /dev/null +++ b/arch/arm/syscall_arch.h @@ -0,0 +1,41 @@ +#define __SYSCALL_LL_E(x) \ +((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ +((union { long long ll; long l[2]; }){ .ll = x }).l[1] +#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x)) + +#define __SYSCALL_SSLEN 8 + +static inline long __syscall0(long n) +{ + return (__syscall)(n); +} + +static inline long __syscall1(long n, long a) +{ + return (__syscall)(n, a); +} + +static inline long __syscall2(long n, long a, long b) +{ + return (__syscall)(n, a, b); +} + +static inline long __syscall3(long n, long a, long b, long c) +{ + return (__syscall)(n, a, b, c); +} + +static inline long __syscall4(long n, long a, long b, long c, long d) +{ + return (__syscall)(n, a, b, c, d); +} + +static inline long __syscall5(long n, long a, long b, long c, long d, long e) +{ + return (__syscall)(n, a, b, c, d, e); +} + +static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) +{ + return (__syscall)(n, a, b, c, d, e, f); +} |