X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Fmissing.h;h=c53579ff7f1a248fc710fbd86edffd9b1ba59969;hp=0cf7949d2cbde548c854af630c4fc2cd6a4720ce;hb=23406ce58aa7142e8df3c5c9e5ac34a01e90e3e0;hpb=48ac500bb65f1f2eb09704f15104eeebb9330d47 diff --git a/src/shared/missing.h b/src/shared/missing.h index 0cf7949d2..c53579ff7 100644 --- a/src/shared/missing.h +++ b/src/shared/missing.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foomissinghfoo -#define foomissinghfoo +#pragma once /*** This file is part of systemd. @@ -27,6 +26,7 @@ #include #include #include +#include #include #include @@ -84,9 +84,11 @@ #define IP_TRANSPARENT 19 #endif +#if !HAVE_DECL_PIVOT_ROOT static inline int pivot_root(const char *new_root, const char *put_old) { return syscall(SYS_pivot_root, new_root, put_old); } +#endif #ifdef __x86_64__ # ifndef __NR_fanotify_init @@ -127,10 +129,13 @@ static inline int pivot_root(const char *new_root, const char *put_old) { # endif #endif +#ifndef HAVE_FANOTIFY_INIT static inline int fanotify_init(unsigned int flags, unsigned int event_f_flags) { return syscall(__NR_fanotify_init, flags, event_f_flags); } +#endif +#ifndef HAVE_FANOTIFY_MARK static inline int fanotify_mark(int fanotify_fd, unsigned int flags, uint64_t mask, int dfd, const char *pathname) { #if defined _MIPS_SIM && _MIPS_SIM == _MIPS_SIM_ABI32 || defined __powerpc__ && !defined __powerpc64__ @@ -146,6 +151,7 @@ static inline int fanotify_mark(int fanotify_fd, unsigned int flags, uint64_t ma return syscall(__NR_fanotify_mark, fanotify_fd, flags, mask, dfd, pathname); #endif } +#endif #ifndef BTRFS_IOCTL_MAGIC #define BTRFS_IOCTL_MAGIC 0x94 @@ -176,9 +182,11 @@ struct btrfs_ioctl_vol_args { #define MS_PRIVATE (1 << 18) #endif +#if !HAVE_DECL_GETTID static inline pid_t gettid(void) { return (pid_t) syscall(SYS_gettid); } +#endif #ifndef SCM_SECURITY #define SCM_SECURITY 0x03 @@ -188,4 +196,64 @@ static inline pid_t gettid(void) { #define MS_STRICTATIME (1<<24) #endif +#ifndef PR_SET_NO_NEW_PRIVS +#define PR_SET_NO_NEW_PRIVS 38 +#endif + +#ifndef PR_SET_CHILD_SUBREAPER +#define PR_SET_CHILD_SUBREAPER 36 +#endif + +#ifndef MAX_HANDLE_SZ +#define MAX_HANDLE_SZ 128 +#endif + +#if defined __x86_64__ +# ifndef __NR_name_to_handle_at +# define __NR_name_to_handle_at 303 +# endif +#elif defined __i386__ +# ifndef __NR_name_to_handle_at +# define __NR_name_to_handle_at 341 +# endif +#elif defined __arm__ +# ifndef __NR_name_to_handle_at +# define __NR_name_to_handle_at 370 +# endif +#elif defined __powerpc__ +# ifndef __NR_name_to_handle_at +# define __NR_name_to_handle_at 345 +# endif +#else +# ifndef __NR_name_to_handle_at +# error __NR_name_to_handle_at is not defined +# endif +#endif + +#if !HAVE_DECL_NAME_TO_HANDLE_AT +struct file_handle { + unsigned int handle_bytes; + int handle_type; + unsigned char f_handle[0]; +}; + +static inline int name_to_handle_at(int fd, const char *name, struct file_handle *handle, int *mnt_id, int flags) { + return syscall(__NR_name_to_handle_at, fd, name, handle, mnt_id, flags); +} +#endif + +#ifndef HAVE_SECURE_GETENV +# ifdef HAVE___SECURE_GETENV +# define secure_getenv __secure_getenv +# else +# error neither secure_getenv nor __secure_getenv are available +# endif +#endif + +#ifndef CIFS_MAGIC_NUMBER +#define CIFS_MAGIC_NUMBER 0xFF534D42 +#endif + +#ifndef TFD_TIMER_CANCEL_ON_SET +#define TFD_TIMER_CANCEL_ON_SET (1 << 1) #endif