X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fmissing.h;h=91a6215226f840edb57c437f1b3d28c0c430b603;hb=9b15b7846d4de01bb5d9700a24077787e984e8ab;hp=4faff89b6c37c65c53b3e07fd40b28fff42c3539;hpb=8ecec322fe6b34b64868d8cc3808b5613f09e8d3;p=elogind.git diff --git a/src/shared/missing.h b/src/shared/missing.h index 4faff89b6..91a621522 100644 --- a/src/shared/missing.h +++ b/src/shared/missing.h @@ -34,17 +34,22 @@ #include #include #include +#include #ifdef HAVE_AUDIT #include #endif -#include "macro.h" - #ifdef ARCH_MIPS #include #endif +#ifdef HAVE_LINUX_BTRFS_H +#include +#endif + +#include "macro.h" + #ifndef RLIMIT_RTTIME #define RLIMIT_RTTIME 15 #endif @@ -135,8 +140,11 @@ static inline int pivot_root(const char *new_root, const char *put_old) { # if _MIPS_SIM == _MIPS_SIM_ABI64 # define __NR_memfd_create 5314 # endif -# else +# elif defined __i386__ # define __NR_memfd_create 356 +# else +# warning "__NR_memfd_create unknown for your architecture" +# define __NR_memfd_create 0xffffffff # endif #endif @@ -563,6 +571,10 @@ static inline int setns(int fd, int nstype) { # define NET_ADDR_RANDOM 1 #endif +#ifndef NET_NAME_UNKNOWN +# define NET_NAME_UNKNOWN 0 +#endif + #ifndef NET_NAME_ENUM # define NET_NAME_ENUM 1 #endif @@ -599,3 +611,41 @@ static inline int setns(int fd, int nstype) { #ifndef AUDIT_NLGRP_MAX #define AUDIT_NLGRP_READLOG 1 #endif + +#ifndef CAP_MAC_OVERRIDE +#define CAP_MAC_OVERRIDE 32 +#endif + +#ifndef CAP_MAC_ADMIN +#define CAP_MAC_ADMIN 33 +#endif + +#ifndef CAP_SYSLOG +#define CAP_SYSLOG 34 +#endif + +#ifndef CAP_WAKE_ALARM +#define CAP_WAKE_ALARM 35 +#endif + +#ifndef CAP_BLOCK_SUSPEND +#define CAP_BLOCK_SUSPEND 36 +#endif + +#ifndef CAP_AUDIT_READ +#define CAP_AUDIT_READ 37 +#endif + +static inline int raw_clone(unsigned long flags, void *child_stack) { +#if defined(__s390__) || defined(__CRIS__) + /* On s390 and cris the order of the first and second arguments + * of the raw clone() system call is reversed. */ + return (int) syscall(__NR_clone, child_stack, flags); +#else + return (int) syscall(__NR_clone, flags, child_stack); +#endif +} + +static inline pid_t raw_getpid(void) { + return (pid_t) syscall(__NR_getpid); +}