From: Kevin Day Date: Thu, 18 Dec 2025 02:18:46 +0000 (-0600) Subject: Update: The f_process syscalls should return F_implement_not if not available. X-Git-Tag: 0.8.0~4 X-Git-Url: https://www.git.kevux.org/?a=commitdiff_plain;h=d8e2ba81b16f85580f1d45da924f04bd35a2d4f5;p=fll Update: The f_process syscalls should return F_implement_not if not available. 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. --- diff --git a/level_0/f_process/c/process.c b/level_0/f_process/c/process.c index 9ba3c81..3c54eca 100644 --- a/level_0/f_process/c/process.c +++ b/level_0/f_process/c/process.c @@ -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) { diff --git a/level_0/f_process/c/process.h b/level_0/f_process/c/process.h index 19abc7c..03f4dec 100644 --- a/level_0/f_process/c/process.h +++ b/level_0/f_process/c/process.h @@ -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.