]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/async: introduce asynchronous_close_many() helper
authorMike Yuan <me@yhndnzj.com>
Tue, 25 Feb 2025 23:26:57 +0000 (00:26 +0100)
committerMike Yuan <me@yhndnzj.com>
Wed, 26 Feb 2025 12:02:28 +0000 (13:02 +0100)
src/shared/async.c
src/shared/async.h

index e0c7e7dcaab44b9206ed205345d2410b46dedfa4..acde1b11d7d66abb4c646df8673ce331ccda8d9d 100644 (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;
 
index 2f5bbd51a52f3664202117d87d8ca59fe4c44c3a..d8604f874621806938a86539fec76621d651cda4 100644 (file)
 
 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);