From a29943f96844654b6e601e5e22e8d211a2fcead6 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 26 Oct 2024 12:40:02 +0000 Subject: [PATCH] libpakfire: Move syscalls into a separate file Signed-off-by: Michael Tremer --- Makefile.am | 1 + src/libpakfire/include/pakfire/syscalls.h | 37 +++++++++++++++++++++++ src/libpakfire/include/pakfire/util.h | 11 ------- src/libpakfire/jail.c | 1 + src/libpakfire/job.c | 1 + 5 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 src/libpakfire/include/pakfire/syscalls.h diff --git a/Makefile.am b/Makefile.am index 3d08d0b8c..6dc88ba25 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 000000000..4e5147b92 --- /dev/null +++ b/src/libpakfire/include/pakfire/syscalls.h @@ -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 . # +# # +#############################################################################*/ + +#ifndef PAKFIRE_SYSCALLS_H +#define PAKFIRE_SYSCALLS_H + +#ifdef PAKFIRE_PRIVATE + +#include + +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 */ diff --git a/src/libpakfire/include/pakfire/util.h b/src/libpakfire/include/pakfire/util.h index 0d26af3f7..2be0756cb 100644 --- a/src/libpakfire/include/pakfire/util.h +++ b/src/libpakfire/include/pakfire/util.h @@ -26,7 +26,6 @@ #include #include #include -#include #define PCRE2_CODE_UNIT_WIDTH 8 #include @@ -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 */ diff --git a/src/libpakfire/jail.c b/src/libpakfire/jail.c index 55938bb2c..fc4bf7cee 100644 --- a/src/libpakfire/jail.c +++ b/src/libpakfire/jail.c @@ -58,6 +58,7 @@ #include #include #include +#include #include #define BUFFER_SIZE 1024 * 64 diff --git a/src/libpakfire/job.c b/src/libpakfire/job.c index 6cebb8a60..ef88490e5 100644 --- a/src/libpakfire/job.c +++ b/src/libpakfire/job.c @@ -41,6 +41,7 @@ #include #include #include +#include #include struct pakfire_job { -- 2.39.5