[systemd-commits] 2 commits - TODO src/core

Lennart Poettering lennart at kemper.freedesktop.org
Fri May 2 08:58:03 PDT 2014


 TODO             |    4 ++++
 src/core/async.c |   22 ++++++++++++++++++++++
 src/core/async.h |    2 ++
 3 files changed, 28 insertions(+)

New commits:
commit 8a474b0c04a5a3608dda53edc1ddaa932ba177bf
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri May 2 17:56:05 2014 +0200

    async: add asynchronous close() call

diff --git a/src/core/async.c b/src/core/async.c
index af527be..3876ded 100644
--- a/src/core/async.c
+++ b/src/core/async.c
@@ -24,6 +24,7 @@
 
 #include "async.h"
 #include "log.h"
+#include "util.h"
 
 int asynchronous_job(void* (*func)(void *p), void *arg) {
         pthread_attr_t a;
@@ -70,3 +71,24 @@ int asynchronous_sync(void) {
 
         return asynchronous_job(sync_thread, NULL);
 }
+
+static void *close_thread(void *p) {
+        safe_close(PTR_TO_INT(p));
+        return NULL;
+}
+
+int asynchronous_close(int fd) {
+        int r;
+
+        /* This is supposed to behave similar to safe_close(), but
+         * actually invoke close() asynchronously, so that it will
+         * never block. Ideally the kernel would have an API for this,
+         * but it doesn't, so we work around it, and hide this as a
+         * far away as we can. */
+
+        r = asynchronous_job(close_thread, INT_TO_PTR(fd));
+        if (r < 0)
+                safe_close(fd);
+
+        return -1;
+}
diff --git a/src/core/async.h b/src/core/async.h
index 6601b4d..7f1ef79 100644
--- a/src/core/async.h
+++ b/src/core/async.h
@@ -22,4 +22,6 @@
 ***/
 
 int asynchronous_job(void* (*func)(void *p), void *arg);
+
 int asynchronous_sync(void);
+int asynchronous_close(int fd);

commit 7348b3adb324614132cf376f478e883bd7de28f1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri May 2 17:56:01 2014 +0200

    update TODO

diff --git a/TODO b/TODO
index c9fcd30..5cef3be 100644
--- a/TODO
+++ b/TODO
@@ -32,6 +32,10 @@ External:
 
 Features:
 
+* figure out a nice way how we can let the admin know what child/sibling unit causes cgroup membership for a specific unit
+
+* add a kernel command line option to enable the debug shell
+
 * journalctl: add the ability to look for the most recent process of a binary. journalctl /usr/bin/X11 --pid=-1 or so...
 
 * set NOTIFY_SOCKET also for control processes



More information about the systemd-commits mailing list