Replaced Linux syscall macros by libc macros.

User-space programs should use the SYS_*form, as documented in
syscall(2).  That also adds compatibility to non-Linux systems.
This commit is contained in:
Alejandro Colomar
2022-06-18 15:59:12 +02:00
parent 0d15cbd5b6
commit 5015b05fc4
4 changed files with 6 additions and 6 deletions

View File

@@ -21,7 +21,7 @@ nxt_feature_test="#include <sys/wait.h>
#include <sys/syscall.h> #include <sys/syscall.h>
int main() { int main() {
return __NR_clone | SIGCHLD; return SYS_clone | SIGCHLD;
}" }"
. auto/feature . auto/feature
@@ -68,7 +68,7 @@ nxt_feature_libs=
nxt_feature_test="#include <sys/syscall.h> nxt_feature_test="#include <sys/syscall.h>
int main() { int main() {
return __NR_pivot_root; return SYS_pivot_root;
}" }"
. auto/feature . auto/feature

View File

@@ -14,9 +14,9 @@ pid_t
nxt_clone(nxt_int_t flags) nxt_clone(nxt_int_t flags)
{ {
#if defined(__s390x__) || defined(__s390__) || defined(__CRIS__) #if defined(__s390x__) || defined(__s390__) || defined(__CRIS__)
return syscall(__NR_clone, NULL, flags); return syscall(SYS_clone, NULL, flags);
#else #else
return syscall(__NR_clone, flags, NULL); return syscall(SYS_clone, flags, NULL);
#endif #endif
} }

View File

@@ -1003,7 +1003,7 @@ fail:
nxt_inline int nxt_inline int
nxt_pivot_root(const char *new_root, const char *old_root) nxt_pivot_root(const char *new_root, const char *old_root)
{ {
return syscall(__NR_pivot_root, new_root, old_root); return syscall(SYS_pivot_root, new_root, old_root);
} }

View File

@@ -19,7 +19,7 @@
* fork(2) calls. As we use clone(2) for container, it returns the wrong pid. * fork(2) calls. As we use clone(2) for container, it returns the wrong pid.
*/ */
#define nxt_getpid() \ #define nxt_getpid() \
syscall(__NR_getpid) syscall(SYS_getpid)
#else #else
#define nxt_getpid() \ #define nxt_getpid() \
getpid() getpid()