diff options
author | Rich Felker <dalias@aerifal.cx> | 2024-10-10 17:09:24 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2024-10-10 17:11:39 -0400 |
commit | 6d8000d3c6e1026415f8398f540f5f3783622538 (patch) | |
tree | f4d59b573e007dd78fd796fb050f959169834626 | |
parent | 23ab04a8630225371455d5f4538fd078665bb646 (diff) | |
download | musl-6d8000d3c6e1026415f8398f540f5f3783622538.tar.gz musl-6d8000d3c6e1026415f8398f540f5f3783622538.tar.xz musl-6d8000d3c6e1026415f8398f540f5f3783622538.zip |
abstract missing SYS_pause syscall with macros
newer archs lack the syscall. the pause() function accounted for this with its own #ifdef, but that didn't allow use of the syscall directly elsewhere, so move the logic to macros in src/internal/syscall.h where it can be shared.
-rw-r--r-- | src/internal/syscall.h | 11 | ||||
-rw-r--r-- | src/unistd/pause.c | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/internal/syscall.h b/src/internal/syscall.h index 33d981f9..2d8a5c13 100644 --- a/src/internal/syscall.h +++ b/src/internal/syscall.h @@ -391,6 +391,17 @@ static inline long __alt_socketcall(int sys, int sock, int cp, syscall_arg_t a, #define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp,,__VA_ARGS__) #define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__)) +#ifdef SYS_pause +#define __sys_pause() __syscall(SYS_pause) +#define __sys_pause_cp() __syscall_cp(SYS_pause) +#else +#define __sys_pause() __syscall(SYS_ppoll, 0, 0, 0, 0) +#define __sys_pause_cp() __syscall_cp(SYS_ppoll, 0, 0, 0, 0) +#endif + +#define sys_pause() __syscall_ret(__sys_pause()) +#define sys_pause_cp() __syscall_ret(__sys_pause_cp()) + #ifdef SYS_wait4 #define __sys_wait4(a,b,c,d) __syscall(SYS_wait4,a,b,c,d) #define __sys_wait4_cp(a,b,c,d) __syscall_cp(SYS_wait4,a,b,c,d) diff --git a/src/unistd/pause.c b/src/unistd/pause.c index 90bbf4ca..90cc8db5 100644 --- a/src/unistd/pause.c +++ b/src/unistd/pause.c @@ -3,9 +3,5 @@ int pause(void) { -#ifdef SYS_pause - return syscall_cp(SYS_pause); -#else - return syscall_cp(SYS_ppoll, 0, 0, 0, 0); -#endif + return sys_pause_cp(); } |