From e814f4b04ee413a7bb3dfa43e74c8fb4abf58359 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 24 Aug 2021 16:12:24 -0300 Subject: support: Add support_open_dev_null_range It returns a range of file descriptor referring to the '/dev/null' pathname. The function takes care of restarting the open range if a file descriptor is found within the specified range and also increases RLIMIT_NOFILE if required. Checked on x86_64-linux-gnu. --- support/support.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'support/support.h') diff --git a/support/support.h b/support/support.h index 834dba9..e6911e1 100644 --- a/support/support.h +++ b/support/support.h @@ -193,6 +193,14 @@ struct support_stack support_stack_alloc (size_t size); /* Deallocate the STACK. */ void support_stack_free (struct support_stack *stack); + +/* Create a range of NUM opened '/dev/null' file descriptors using FLAGS and + MODE. The function takes care of restarting the open range if a file + descriptor is found within the specified range and also increases + RLIMIT_NOFILE if required. + The returned value is the lowest file descriptor number. */ +int support_open_dev_null_range (int num, int flags, mode_t mode); + __END_DECLS #endif /* SUPPORT_H */ -- cgit v1.1