]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: Move syscalls into a separate file
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Oct 2024 12:40:02 +0000 (12:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Oct 2024 12:40:02 +0000 (12:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/libpakfire/include/pakfire/syscalls.h [new file with mode: 0644]
src/libpakfire/include/pakfire/util.h
src/libpakfire/jail.c
src/libpakfire/job.c

index 3d08d0b8c35905f6e9c3d620c01fa8cd4cc2524c..6dc88ba252cae4d14e6db74bc7688e3a443d6a59 100644 (file)
@@ -284,6 +284,7 @@ pkginclude_HEADERS += \
        src/libpakfire/include/pakfire/snapshot.h \
        src/libpakfire/include/pakfire/solution.h \
        src/libpakfire/include/pakfire/string.h \
+       src/libpakfire/include/pakfire/syscalls.h \
        src/libpakfire/include/pakfire/transaction.h \
        src/libpakfire/include/pakfire/util.h \
        src/libpakfire/include/pakfire/xfer.h
diff --git a/src/libpakfire/include/pakfire/syscalls.h b/src/libpakfire/include/pakfire/syscalls.h
new file mode 100644 (file)
index 0000000..4e5147b
--- /dev/null
@@ -0,0 +1,37 @@
+/*#############################################################################
+#                                                                             #
+# Pakfire - The IPFire package management system                              #
+# Copyright (C) 2024 Pakfire development team                                 #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#ifndef PAKFIRE_SYSCALLS_H
+#define PAKFIRE_SYSCALLS_H
+
+#ifdef PAKFIRE_PRIVATE
+
+#include <syscall.h>
+
+static inline int clone3(struct clone_args* args, size_t size) {
+       return syscall(__NR_clone3, args, size);
+}
+
+static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t* info, unsigned int flags) {
+       return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags);
+}
+
+#endif /* PAKFIRE_PRIVATE */
+#endif /* PAKFIRE_SYSCALLS_H */
index 0d26af3f753df0c8d19579313d8c07a9991ae755..2be0756cb8a810ad9cffff420e6d41b83586c594 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/sched.h>
 #include <pwd.h>
 #include <stdio.h>
-#include <syscall.h>
 
 #define PCRE2_CODE_UNIT_WIDTH 8
 #include <pcre2.h>
@@ -125,16 +124,6 @@ static inline double pakfire_timespec_delta(struct timespec* t1, struct timespec
        ) / 1000.0;
 }
 
-// Syscalls
-
-static inline int clone3(struct clone_args* args, size_t size) {
-       return syscall(__NR_clone3, args, size);
-}
-
-static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t* info, unsigned int flags) {
-       return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags);
-}
-
 #endif
 
 #endif /* PAKFIRE_UTIL_H */
index 55938bb2c2a4aa7e1bf4dbbd1633f96c8a31f1a2..fc4bf7cee52658eee39a283b5ca44371bb21db3a 100644 (file)
@@ -58,6 +58,7 @@
 #include <pakfire/pty.h>
 #include <pakfire/pwd.h>
 #include <pakfire/string.h>
+#include <pakfire/syscalls.h>
 #include <pakfire/util.h>
 
 #define BUFFER_SIZE      1024 * 64
index 6cebb8a605becc91890eb2006ef2954ee6a7a503..ef88490e5e98f6904df5aab1c6cf36a3571e45e1 100644 (file)
@@ -41,6 +41,7 @@
 #include <pakfire/log_stream.h>
 #include <pakfire/logging.h>
 #include <pakfire/string.h>
+#include <pakfire/syscalls.h>
 #include <pakfire/util.h>
 
 struct pakfire_job {