X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Fbasic%2Fmissing_syscall.h;h=f9a541af809a8c5d541ea8a663668a0e97232cc7;hb=4f6d0cf8078962c89b54128be902a24de266c3ec;hp=b009ea5bfa6904b65deedbdb0697a1cc617eab7d;hpb=4a165974a31d7ed9eaca7a21ba2d25eeea3360f2;p=thirdparty%2Fsystemd.git diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h index b009ea5bfa6..f9a541af809 100644 --- a/src/basic/missing_syscall.h +++ b/src/basic/missing_syscall.h @@ -3,13 +3,24 @@ /* Missing glibc definitions to access certain kernel APIs */ +#include #include #include #include +#include + +#ifdef ARCH_MIPS +#include +#endif #include "missing_keyctl.h" #include "missing_stat.h" +/* linux/kcmp.h */ +#ifndef KCMP_FILE /* 3f4994cfc15f38a3159c6e3a4b3ab2e1481a6b02 (3.19) */ +#define KCMP_FILE 0 +#endif + #if !HAVE_PIVOT_ROOT static inline int missing_pivot_root(const char *new_root, const char *put_old) { return syscall(__NR_pivot_root, new_root, put_old); @@ -257,7 +268,7 @@ static inline int missing_kcmp(pid_t pid1, pid_t pid2, int type, unsigned long i /* ======================================================================= */ #if !HAVE_KEYCTL -static inline long missing_keyctl(int cmd, unsigned long arg2, unsigned long arg3, unsigned long arg4,unsigned long arg5) { +static inline long missing_keyctl(int cmd, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5) { # ifdef __NR_keyctl return syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5); # else @@ -380,6 +391,8 @@ static inline int missing_bpf(int cmd, union bpf_attr *attr, size_t size) { # define __NR_pkey_mprotect 394 # elif defined __powerpc__ # define __NR_pkey_mprotect 386 +# elif defined __s390__ +# define __NR_pkey_mprotect 384 # elif defined _MIPS_SIM # if _MIPS_SIM == _MIPS_SIM_ABI32 # define __NR_pkey_mprotect 4363 @@ -433,3 +446,45 @@ static inline ssize_t missing_statx(int dfd, const char *filename, unsigned flag # define statx missing_statx #endif + +#if !HAVE_SET_MEMPOLICY + +enum { + MPOL_DEFAULT, + MPOL_PREFERRED, + MPOL_BIND, + MPOL_INTERLEAVE, + MPOL_LOCAL, +}; + +static inline long missing_set_mempolicy(int mode, const unsigned long *nodemask, + unsigned long maxnode) { + long i; +# ifdef __NR_set_mempolicy + i = syscall(__NR_set_mempolicy, mode, nodemask, maxnode); +# else + errno = ENOSYS; + i = -1; +# endif + return i; +} + +# define set_mempolicy missing_set_mempolicy +#endif + +#if !HAVE_GET_MEMPOLICY +static inline long missing_get_mempolicy(int *mode, unsigned long *nodemask, + unsigned long maxnode, void *addr, + unsigned long flags) { + long i; +# ifdef __NR_get_mempolicy + i = syscall(__NR_get_mempolicy, mode, nodemask, maxnode, addr, flags); +# else + errno = ENOSYS; + i = -1; +# endif + return i; +} + +#define get_mempolicy missing_get_mempolicy +#endif