[systemd-commits] 4 commits - TODO src/core src/nspawn src/shared src/udev

Lennart Poettering lennart at kemper.freedesktop.org
Tue Aug 21 08:23:49 PDT 2012


 TODO                   |   12 ++++++++++--
 src/core/mount-setup.c |    2 +-
 src/nspawn/nspawn.c    |    3 +++
 src/shared/dev-setup.c |   19 ++++++++++++++++---
 src/shared/dev-setup.h |    7 ++-----
 src/udev/udevd.c       |    2 +-
 6 files changed, 33 insertions(+), 12 deletions(-)

New commits:
commit 01ed0e2307f3b889b64165fd503d79b4568c47e1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Aug 21 17:23:03 2012 +0200

    dev-setup: make NULL as parameter for dev_setup() equivalent to ""

diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index be11bb8..1a82a46 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -398,7 +398,7 @@ int mount_setup(bool loaded_policy) {
         /* Create a few default symlinks, which are normally created
          * by udevd, but some scripts might need them before we start
          * udevd. */
-        dev_setup("");
+        dev_setup(NULL);
 
         /* Mark the root directory as shared in regards to mount
          * propagation. The kernel defaults to "private", but we think
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c
index 759ecd7..b0ac02d 100644
--- a/src/shared/dev-setup.c
+++ b/src/shared/dev-setup.c
@@ -50,7 +50,7 @@ static int symlink_and_label(const char *old_path, const char *new_path) {
         return r;
 }
 
-void dev_setup(const char *pathprefix) {
+void dev_setup(const char *prefix) {
         const char *j, *k;
 
         static const char symlinks[] =
@@ -61,15 +61,18 @@ void dev_setup(const char *pathprefix) {
                 "/proc/self/fd/2\0"  "/dev/stderr\0";
 
         NULSTR_FOREACH_PAIR(j, k, symlinks) {
-                char *linkname;
 
-                if (asprintf(&linkname, "%s/%s", pathprefix, k) < 0) {
-                        log_oom();
-                        break;
-                }
+                if (prefix) {
+                        char *linkname;
 
-                symlink_and_label(j, linkname);
+                        if (asprintf(&linkname, "%s/%s", prefix, k) < 0) {
+                                log_oom();
+                                break;
+                        }
 
-                free(linkname);
+                        symlink_and_label(j, linkname);
+                        free(linkname);
+                } else
+                        symlink_and_label(j, k);
         }
 }
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 1bb15d8..b4fc624 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1155,7 +1155,7 @@ int main(int argc, char *argv[])
 
         mkdir("/run/udev", 0755);
 
-        dev_setup("");
+        dev_setup(NULL);
         static_dev_create_from_modules(udev);
 
         /* before opening new files, make sure std{in,out,err} fds are in a sane state */

commit 4fc9982cb0499f6502aefc5b8f410658c6d4d261
Author: Dave Reisner <dreisner at archlinux.org>
Date:   Tue Aug 14 20:00:31 2012 -0400

    nspawn: add /dev FD symlinks in container setup
    
    This creates /dev/fd, /dev/stdin, /dev/stdout, /dev/stderr, and
    /dev/core as symlinks to /proc on container creation. Except for
    /dev/core, these are needed for shells like bash to be fully functional.

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 7d188f0..40b9934 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -53,6 +53,7 @@
 #include "path-util.h"
 #include "loopback-setup.h"
 #include "sd-id128.h"
+#include "dev-setup.h"
 
 typedef enum LinkJournal {
         LINK_NO,
@@ -1204,6 +1205,8 @@ int main(int argc, char *argv[]) {
                 if (copy_devnodes(arg_directory) < 0)
                         goto child_fail;
 
+                dev_setup(arg_directory);
+
                 if (setup_dev_console(arg_directory, console) < 0)
                         goto child_fail;
 

commit 8f0e73f250f4a397ea07d29a339bd7e64d077612
Author: Dave Reisner <dreisner at archlinux.org>
Date:   Tue Aug 14 20:00:30 2012 -0400

    dev-setup: allow a path prefix for use in chroots
    
    With this adjustment, we can reuse this code elsewhere, such as in
    nspawn.

diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index e86a893..be11bb8 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -398,7 +398,7 @@ int mount_setup(bool loaded_policy) {
         /* Create a few default symlinks, which are normally created
          * by udevd, but some scripts might need them before we start
          * udevd. */
-        dev_setup();
+        dev_setup("");
 
         /* Mark the root directory as shared in regards to mount
          * propagation. The kernel defaults to "private", but we think
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c
index 0b3d648..759ecd7 100644
--- a/src/shared/dev-setup.c
+++ b/src/shared/dev-setup.c
@@ -50,7 +50,7 @@ static int symlink_and_label(const char *old_path, const char *new_path) {
         return r;
 }
 
-void dev_setup(void) {
+void dev_setup(const char *pathprefix) {
         const char *j, *k;
 
         static const char symlinks[] =
@@ -60,6 +60,16 @@ void dev_setup(void) {
                 "/proc/self/fd/1\0"  "/dev/stdout\0"
                 "/proc/self/fd/2\0"  "/dev/stderr\0";
 
-        NULSTR_FOREACH_PAIR(j, k, symlinks)
-                symlink_and_label(j, k);
+        NULSTR_FOREACH_PAIR(j, k, symlinks) {
+                char *linkname;
+
+                if (asprintf(&linkname, "%s/%s", pathprefix, k) < 0) {
+                        log_oom();
+                        break;
+                }
+
+                symlink_and_label(j, linkname);
+
+                free(linkname);
+        }
 }
diff --git a/src/shared/dev-setup.h b/src/shared/dev-setup.h
index 5850758..320c0b3 100644
--- a/src/shared/dev-setup.h
+++ b/src/shared/dev-setup.h
@@ -1,7 +1,6 @@
 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
-#ifndef foodevsetuphfoo
-#define foodevsetuphfoo
+#pragma once
 
 /***
   This file is part of systemd.
@@ -22,6 +21,4 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-void dev_setup(void);
-
-#endif
+void dev_setup(const char *pathprefix);
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 23351ae..1bb15d8 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1155,7 +1155,7 @@ int main(int argc, char *argv[])
 
         mkdir("/run/udev", 0755);
 
-        dev_setup();
+        dev_setup("");
         static_dev_create_from_modules(udev);
 
         /* before opening new files, make sure std{in,out,err} fds are in a sane state */

commit 50b3e64e27d1e73b84f96359f9f38dd497cb9b59
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Aug 21 17:19:32 2012 +0200

    update TODO

diff --git a/TODO b/TODO
index e16db6f..5f6d969 100644
--- a/TODO
+++ b/TODO
@@ -49,6 +49,16 @@ Bugfixes:
 
 Features:
 
+* ConditionHost= for filtering services for clusters
+
+* journald: add symlinks and device names to kernel messages
+
+* maybe make systemd-detect-virt suid? or use fscaps?
+
+* consider using __secure_getenv() instead of getenv() in libs
+
+* journald: automatic rekeying with no log messages doesn't appear to work
+
 * man: document in ExecStart= explicitly that we don't take shell command lines, only executable names with arguments
 
 * shutdown: don't read-only mount anything when running in container
@@ -498,5 +508,3 @@ Regularly:
 Scheduled for removal (or fixing):
 
 * xxxOverridable dependencies
-
-* prefdm.service



More information about the systemd-commits mailing list