teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0739-missing-when-adding-syscall-replacements-use-differe.patch

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