]> Kevux Git Server - fll/commitdiff
Update: The f_process syscalls should return F_implement_not if not available.
authorKevin Day <Kevin@kevux.org>
Thu, 18 Dec 2025 02:18:46 +0000 (20:18 -0600)
committerKevin Day <Kevin@kevux.org>
Thu, 18 Dec 2025 02:18:46 +0000 (20:18 -0600)
The `f_process` is very new.
The syscalls might not be available.

Ensure that this doesn't break older software stacks by returning `F_implement_not` when the associated syscall is not available.

level_0/f_process/c/process.c
level_0/f_process/c/process.h

index 9ba3c81ae727deac698b3c757bef1c7604055789..3c54ecaf461d6ec24564d1956e46d9c0ad9be21c 100644 (file)
@@ -4,7 +4,11 @@
 extern "C" {
 #endif
 
-#ifndef _di_f_process_descriptor_clone_
+#if !defined(_di_f_process_descriptor_clone_) && defined(_en_use_syscall_pidfd_getfd_) && !defined(SYS_pidfd_getfd)
+  f_status_t f_process_descriptor_clone(const pid_t pid, const int clone, const unsigned int flags, int * const id) {
+    return F_status_set_error(F_implement_not);
+  }
+#elif !defined(_di_f_process_descriptor_clone_)
   f_status_t f_process_descriptor_clone(const pid_t pid, const int clone, const unsigned int flags, int * const id) {
     #ifndef _di_level_0_parameter_checking_
       if (!id) return F_status_set_error(F_parameter);
@@ -31,9 +35,13 @@ extern "C" {
 
     return F_okay;
   }
-#endif // _di_f_process_descriptor_clone_
+#endif // !defined(_di_f_process_descriptor_clone_) && defined(_en_use_syscall_pidfd_getfd_) && !defined(SYS_pidfd_getfd)
 
-#ifndef _di_f_process_descriptor_open_
+#if !defined(_di_f_process_descriptor_open_) && defined(_en_use_syscall_pidfd_getfd_) && !defined(SYS_pidfd_open)
+  f_status_t f_process_descriptor_open(const pid_t pid, const unsigned int flags, int * const id) {
+    return F_status_set_error(F_implement_not);
+  }
+#elif !defined(_di_f_process_descriptor_open_)
   f_status_t f_process_descriptor_open(const pid_t pid, const unsigned int flags, int * const id) {
     #ifndef _di_level_0_parameter_checking_
       if (!id) return F_status_set_error(F_parameter);
@@ -60,9 +68,13 @@ extern "C" {
 
     return F_okay;
   }
-#endif // _di_f_process_descriptor_open_
+#endif // !defined(_di_f_process_descriptor_open_) && defined(_en_use_syscall_pidfd_getfd_) && !defined(SYS_pidfd_open)
 
-#ifndef _di_f_process_descriptor_signal_
+#if !defined(_di_f_process_descriptor_signal_) && defined(_en_use_syscall_pidfd_getfd_) && !defined(SYS_pidfd_send_signal)
+  f_status_t f_process_descriptor_signal(const int id, const int signal, const unsigned int flags, siginfo_t * const information) {
+    return F_status_set_error(F_implement_not);
+  }
+#elif !defined(_di_f_process_descriptor_signal_)
   f_status_t f_process_descriptor_signal(const int id, const int signal, const unsigned int flags, siginfo_t * const information) {
 
     #ifdef _en_use_syscall_pidfd_send_signal_
@@ -82,7 +94,7 @@ extern "C" {
 
     return F_okay;
   }
-#endif // _di_f_process_descriptor_signal_
+#endif // !defined(_di_f_process_descriptor_signal_) && defined(_en_use_syscall_pidfd_getfd_) && !defined(SYS_pidfd_send_signal)
 
 #ifndef _di_f_process_handle_from_path_at_
   f_status_t f_process_handle_from_path_at(const int at_id, const f_string_static_t path, const int flags, f_handle_t * const handle, int * const id) {
index 19abc7c21693d7040e5ea5bcaa41f0aeb9776c52..03f4decd00c64cb1fe81854417bcecc76128f747 100644 (file)
@@ -58,6 +58,7 @@ extern "C" {
  *   F_file_descriptor_max (with error bit) if max file descriptors is reached.
  *   F_file_descriptor_not (with error bit) if the file descriptor is invalid.
  *   F_file_open_max (with error bit) when system-wide max open files is reached.
+ *   F_implement_not (with error bit) if this function is not available (such as the syscall not being available).
  *   F_parameter (with error bit) if a parameter is invalid.
  *   F_prohibited (with error bit) if the current process is not allowed to clone the requested file descriptor.
  *   F_search (with error bit) if the process could not be found.
@@ -89,6 +90,7 @@ extern "C" {
  *   F_device_not (with error bit) if the device does not exist.
  *   F_file_descriptor_max (with error bit) if max file descriptors is reached.
  *   F_file_open_max (with error bit) when system-wide max open files is reached.
+ *   F_implement_not (with error bit) if this function is not available (such as the syscall not being available).
  *   F_memory_not (with error bit) if out of memory.
  *   F_parameter (with error bit) if a parameter is invalid.
  *   F_search (with error bit) if the process could not be found.
@@ -117,6 +119,7 @@ extern "C" {
  *   F_okay on success.
  *
  *   F_file_descriptor_not (with error bit) if the file descriptor is invalid.
+ *   F_implement_not (with error bit) if this function is not available (such as the syscall not being available).
  *   F_parameter (with error bit) if a parameter is invalid.
  *   F_prohibited (with error bit) if the current process is not allowed to signal the requested file descriptor.
  *   F_search (with error bit) if the process could not be found.