ryantimwilson / rpms / systemd

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