richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
Pablo Greco 48fc63
From 2cbb8dd0984e46b8650678c69f426d06e37c117b Mon Sep 17 00:00:00 2001
Pablo Greco 48fc63
From: Frantisek Sumsal <fsumsal@redhat.com>
Pablo Greco 48fc63
Date: Thu, 4 Apr 2019 11:23:59 +0200
Pablo Greco 48fc63
Subject: [PATCH] missing: when adding syscall replacements, use different
Pablo Greco 48fc63
 names
Pablo Greco 48fc63
Pablo Greco 48fc63
Based on 5187dd2c403caf92d09f3491e41f1ceb3f10491f
Pablo Greco 48fc63
Pablo Greco 48fc63
Resolves: #1694605
Pablo Greco 48fc63
---
Pablo Greco 48fc63
 src/shared/missing.h | 40 ++++++++++++++++++++++++++++++----------
Pablo Greco 48fc63
 1 file changed, 30 insertions(+), 10 deletions(-)
Pablo Greco 48fc63
Pablo Greco 48fc63
diff --git a/src/shared/missing.h b/src/shared/missing.h
Pablo Greco 48fc63
index a7771bc996..4596b2b494 100644
Pablo Greco 48fc63
--- a/src/shared/missing.h
Pablo Greco 48fc63
+++ b/src/shared/missing.h
Pablo Greco 48fc63
@@ -127,9 +127,11 @@
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #if !HAVE_DECL_PIVOT_ROOT
Pablo Greco 48fc63
-static inline int pivot_root(const char *new_root, const char *put_old) {
Pablo Greco 48fc63
+static inline int missing_pivot_root(const char *new_root, const char *put_old) {
Pablo Greco 48fc63
         return syscall(SYS_pivot_root, new_root, put_old);
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define pivot_root missing_pivot_root
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef __NR_memfd_create
Pablo Greco 48fc63
@@ -197,13 +199,15 @@ static inline int pivot_root(const char *new_root, const char *put_old) {
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef HAVE_FANOTIFY_INIT
Pablo Greco 48fc63
-static inline int fanotify_init(unsigned int flags, unsigned int event_f_flags) {
Pablo Greco 48fc63
+static inline int missing_fanotify_init(unsigned int flags, unsigned int event_f_flags) {
Pablo Greco 48fc63
         return syscall(__NR_fanotify_init, flags, event_f_flags);
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define fanotify_init missing_fanotify_init
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef HAVE_FANOTIFY_MARK
Pablo Greco 48fc63
-static inline int fanotify_mark(int fanotify_fd, unsigned int flags, uint64_t mask,
Pablo Greco 48fc63
+static inline int missing_fanotify_mark(int fanotify_fd, unsigned int flags, uint64_t mask,
Pablo Greco 48fc63
                                 int dfd, const char *pathname) {
Pablo Greco 48fc63
 #if defined _MIPS_SIM && _MIPS_SIM == _MIPS_SIM_ABI32 || defined __powerpc__ && !defined __powerpc64__ \
Pablo Greco 48fc63
     || defined __arm__ && !defined __aarch64__
Pablo Greco 48fc63
@@ -219,12 +223,16 @@ static inline int fanotify_mark(int fanotify_fd, unsigned int flags, uint64_t ma
Pablo Greco 48fc63
         return syscall(__NR_fanotify_mark, fanotify_fd, flags, mask, dfd, pathname);
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define fanotify_mark missing_fanotify_mark
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef HAVE_MEMFD_CREATE
Pablo Greco 48fc63
-static inline int memfd_create(const char *name, unsigned int flags) {
Pablo Greco 48fc63
+static inline int missing_memfd_create(const char *name, unsigned int flags) {
Pablo Greco 48fc63
         return syscall(__NR_memfd_create, name, flags);
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define memfd_create missing_memfd_create
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef __NR_getrandom
Pablo Greco 48fc63
@@ -261,9 +269,11 @@ static inline int memfd_create(const char *name, unsigned int flags) {
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #if !HAVE_DECL_GETRANDOM
Pablo Greco 48fc63
-static inline int getrandom(void *buffer, size_t count, unsigned flags) {
Pablo Greco 48fc63
+static inline int missing_getrandom(void *buffer, size_t count, unsigned flags) {
Pablo Greco 48fc63
         return syscall(__NR_getrandom, buffer, count, flags);
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define getrandom missing_getrandom
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef GRND_NONBLOCK
Pablo Greco 48fc63
@@ -529,9 +539,11 @@ struct btrfs_ioctl_clone_range_args {
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #if !HAVE_DECL_GETTID
Pablo Greco 48fc63
-static inline pid_t gettid(void) {
Pablo Greco 48fc63
+static inline pid_t missing_gettid(void) {
Pablo Greco 48fc63
         return (pid_t) syscall(SYS_gettid);
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define gettid missing_gettid
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef SCM_SECURITY
Pablo Greco 48fc63
@@ -583,9 +595,11 @@ struct file_handle {
Pablo Greco 48fc63
         unsigned char f_handle[0];
Pablo Greco 48fc63
 };
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-static inline int name_to_handle_at(int fd, const char *name, struct file_handle *handle, int *mnt_id, int flags) {
Pablo Greco 48fc63
+static inline int missing_name_to_handle_at(int fd, const char *name, struct file_handle *handle, int *mnt_id, int flags) {
Pablo Greco 48fc63
         return syscall(__NR_name_to_handle_at, fd, name, handle, mnt_id, flags);
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define name_to_handle_at missing_name_to_handle_at
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef HAVE_SECURE_GETENV
Pablo Greco 48fc63
@@ -647,9 +661,11 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #if !HAVE_DECL_SETNS
Pablo Greco 48fc63
-static inline int setns(int fd, int nstype) {
Pablo Greco 48fc63
+static inline int missing_setns(int fd, int nstype) {
Pablo Greco 48fc63
         return syscall(__NR_setns, fd, nstype);
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define setns missing_setns
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #if !HAVE_DECL_LO_FLAGS_PARTSCAN
Pablo Greco 48fc63
@@ -986,9 +1002,11 @@ static inline pid_t raw_getpid(void) {
Pablo Greco 48fc63
 #  endif
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
-static inline int renameat2(int oldfd, const char *oldname, int newfd, const char *newname, unsigned flags) {
Pablo Greco 48fc63
+static inline int missing_renameat2(int oldfd, const char *oldname, int newfd, const char *newname, unsigned flags) {
Pablo Greco 48fc63
         return syscall(__NR_renameat2, oldfd, oldname, newfd, newname, flags);
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define renameat2 missing_renameat2
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef RENAME_NOREPLACE
Pablo Greco 48fc63
@@ -996,9 +1014,11 @@ static inline int renameat2(int oldfd, const char *oldname, int newfd, const cha
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #if !HAVE_DECL_KCMP
Pablo Greco 48fc63
-static inline int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) {
Pablo Greco 48fc63
+static inline int missing_kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) {
Pablo Greco 48fc63
         return syscall(__NR_kcmp, pid1, pid2, type, idx1, idx2);
Pablo Greco 48fc63
 }
Pablo Greco 48fc63
+
Pablo Greco 48fc63
+#define kcmp missing_kcmp
Pablo Greco 48fc63
 #endif
Pablo Greco 48fc63
 
Pablo Greco 48fc63
 #ifndef KCMP_FILE