shared/async: introduce asynchronous_close_many() helper

This commit is contained in:
Mike Yuan
2025-02-26 13:02:28 +01:00
parent 74cd56d31b
commit 4a5b06c5d1
2 changed files with 11 additions and 1 deletions
+7
View File
@@ -133,6 +133,13 @@ int asynchronous_close(int fd) {
return -EBADF; /* return an invalidated fd */
}
void asynchronous_close_many(const int fds[], size_t n_fds) {
assert(fds || n_fds == 0);
FOREACH_ARRAY(i, fds, n_fds)
asynchronous_close(*i);
}
int asynchronous_rm_rf(const char *p, RemoveFlags flags) {
int r;
+4 -1
View File
@@ -21,7 +21,10 @@
int asynchronous_sync(pid_t *ret_pid);
int asynchronous_fsync(int fd, pid_t *ret_pid);
int asynchronous_close(int fd);
int asynchronous_rm_rf(const char *p, RemoveFlags flags);
void asynchronous_close_many(const int fds[], size_t n_fds);
DEFINE_TRIVIAL_CLEANUP_FUNC(int, asynchronous_close);
int asynchronous_rm_rf(const char *p, RemoveFlags flags);