[systemd-commits] man/sd_readahead.xml src/ask-password-api.c src/fsck.c src/gnome-ask-password-agent.vala src/machine-id-setup.c src/main.c src/manager.c src/mount-setup.c src/path-lookup.c src/quotacheck.c src/readahead-collect.c src/readahead-common.c src/readahead-replay.c src/sd-readahead.c src/selinux-setup.c src/tty-ask-password-agent.c systemd.pc.in TODO units/systemd-ask-password-console.path units/systemd-ask-password-plymouth.path units/systemd-ask-password-wall.path

Lennart Poettering lennart at kemper.freedesktop.org
Wed Mar 9 13:45:56 PST 2011


 TODO                                     |    4 ++++
 man/sd_readahead.xml                     |    2 +-
 src/ask-password-api.c                   |    6 +++---
 src/fsck.c                               |    2 +-
 src/gnome-ask-password-agent.vala        |    2 +-
 src/machine-id-setup.c                   |   14 +++++++-------
 src/main.c                               |    4 +---
 src/manager.c                            |   18 ++++++++----------
 src/mount-setup.c                        |    6 +++++-
 src/path-lookup.c                        |    2 +-
 src/quotacheck.c                         |    2 +-
 src/readahead-collect.c                  |    4 ++--
 src/readahead-common.c                   |   14 +++++++-------
 src/readahead-replay.c                   |    2 +-
 src/sd-readahead.c                       |   10 +++++-----
 src/selinux-setup.c                      |    5 ++---
 src/tty-ask-password-agent.c             |   12 ++++++------
 systemd.pc.in                            |    2 +-
 units/systemd-ask-password-console.path  |    2 +-
 units/systemd-ask-password-plymouth.path |    2 +-
 units/systemd-ask-password-wall.path     |    2 +-
 21 files changed, 60 insertions(+), 57 deletions(-)

New commits:
commit b925e72633bf98438f56a140520e07ec8c959e46
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Mar 9 22:45:47 2011 +0100

    dev: use /dev/.run/systemd as runtime directory, instead of /dev/.systemd

diff --git a/TODO b/TODO
index 8395d69..a8b8797 100644
--- a/TODO
+++ b/TODO
@@ -20,10 +20,14 @@ F15:
 
 * save/restore tool for SysV as requested by FPC
 
+* optionally create watched directories in .path units
+
 Features:
 
 * consider services with no [Install] section and stored in /lib enabled by "systemctl is-enabled"
 
+* store time when conditions where checked to inform admins about whether a unit was considered at all
+
 * consider services with any kind of link in /etc/systemd/system enabled
 
 * show failure error string in "systemctl status"
diff --git a/man/sd_readahead.xml b/man/sd_readahead.xml
index ac54dc4..f5114e4 100644
--- a/man/sd_readahead.xml
+++ b/man/sd_readahead.xml
@@ -123,7 +123,7 @@
                 reference implementation.</para>
 
                 <para>Internally, this function creates a file in
-                <filename>/dev/.systemd/readahead/</filename> which is
+                <filename>/dev/.run/systemd/readahead/</filename> which is
                 then used as flag file to notify the read-ahead
                 subsystem.</para>
 
diff --git a/src/ask-password-api.c b/src/ask-password-api.c
index af1b611..0b2e9ad 100644
--- a/src/ask-password-api.c
+++ b/src/ask-password-api.c
@@ -223,7 +223,7 @@ static int create_socket(char **name) {
 
         zero(sa);
         sa.un.sun_family = AF_UNIX;
-        snprintf(sa.un.sun_path, sizeof(sa.un.sun_path)-1, "/dev/.systemd/ask-password/sck.%llu", random_ull());
+        snprintf(sa.un.sun_path, sizeof(sa.un.sun_path)-1, "/dev/.run/systemd/ask-password/sck.%llu", random_ull());
 
         if (bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
                 r = -errno;
@@ -265,7 +265,7 @@ int ask_password_agent(
                 _FD_MAX
         };
 
-        char temp[] = "/dev/.systemd/ask-password/tmp.XXXXXX";
+        char temp[] = "/dev/.run/systemd/ask-password/tmp.XXXXXX";
         char final[sizeof(temp)] = "";
         int fd = -1, r;
         FILE *f = NULL;
@@ -276,7 +276,7 @@ int ask_password_agent(
 
         assert(_passphrases);
 
-        mkdir_p("/dev/.systemd/ask-password", 0755);
+        mkdir_p("/dev/.run/systemd/ask-password", 0755);
 
         if ((fd = mkostemp(temp, O_CLOEXEC|O_CREAT|O_WRONLY)) < 0) {
                 log_error("Failed to create password file: %m");
diff --git a/src/fsck.c b/src/fsck.c
index dbfb475..b5d8764 100644
--- a/src/fsck.c
+++ b/src/fsck.c
@@ -262,7 +262,7 @@ int main(int argc, char *argv[]) {
                 r = EXIT_SUCCESS;
 
         if (status.si_code == CLD_EXITED && (status.si_status & 1))
-                touch("/dev/.systemd/quotacheck");
+                touch("/dev/.run/systemd/quotacheck");
 
 finish:
         if (udev_device)
diff --git a/src/gnome-ask-password-agent.vala b/src/gnome-ask-password-agent.vala
index 84f2549..1bc97f5 100644
--- a/src/gnome-ask-password-agent.vala
+++ b/src/gnome-ask-password-agent.vala
@@ -91,7 +91,7 @@ public class MyStatusIcon : StatusIcon {
                 GLib.Object(icon_name : "dialog-password");
                 set_title("System Password");
 
-                directory = File.new_for_path("/dev/.systemd/ask-password/");
+                directory = File.new_for_path("/dev/.run/systemd/ask-password/");
                 file_monitor = directory.monitor_directory(0);
                 file_monitor.changed.connect(file_monitor_changed);
 
diff --git a/src/machine-id-setup.c b/src/machine-id-setup.c
index 65792e9..59a1424 100644
--- a/src/machine-id-setup.c
+++ b/src/machine-id-setup.c
@@ -142,20 +142,20 @@ int machine_id_setup(void) {
         fd = -1;
 
         /* Hmm, we couldn't write it? So let's write it to
-         * /dev/.systemd/machine-id as a replacement */
+         * /dev/.run/systemd/machine-id as a replacement */
 
-        mkdir_p("/dev/.systemd", 0755);
+        mkdir_p("/dev/.run/systemd", 0755);
 
-        if ((r = write_one_line_file("/dev/.systemd/machine-id", id)) < 0) {
-                log_error("Cannot write /dev/.systemd/machine-id: %s", strerror(-r));
+        if ((r = write_one_line_file("/dev/.run/systemd/machine-id", id)) < 0) {
+                log_error("Cannot write /dev/.run/systemd/machine-id: %s", strerror(-r));
 
-                unlink("/dev/.systemd/machine-id");
+                unlink("/dev/.run/systemd/machine-id");
                 goto finish;
         }
 
         /* And now, let's mount it over */
-        r = mount("/dev/.systemd/machine-id", "/etc/machine-id", "bind", MS_BIND|MS_RDONLY, NULL) < 0 ? -errno : 0;
-        unlink("/dev/.systemd/machine-id");
+        r = mount("/dev/.run/systemd/machine-id", "/etc/machine-id", "bind", MS_BIND|MS_RDONLY, NULL) < 0 ? -errno : 0;
+        unlink("/dev/.run/systemd/machine-id");
 
         if (r < 0)
                 log_error("Failed to mount /etc/machine-id: %s", strerror(-r));
diff --git a/src/main.c b/src/main.c
index a041a22..37768c6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1044,7 +1044,7 @@ int main(int argc, char *argv[]) {
 
         /* If Plymouth is being run make sure we show the status, so
          * that there's something nice to see when people press Esc */
-        if (access("/dev/.systemd/plymouth", F_OK) >= 0)
+        if (access("/dev/.run/systemd/plymouth", F_OK) >= 0)
                 arg_show_status = true;
 
         if (arg_action == ACTION_HELP) {
@@ -1131,8 +1131,6 @@ int main(int argc, char *argv[]) {
                 machine_id_setup();
                 loopback_setup();
 
-                mkdir_p("/dev/.systemd/ask-password/", 0755);
-
                 test_mtab();
                 test_usr();
         }
diff --git a/src/manager.c b/src/manager.c
index 194ad66..8bbde7c 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2550,22 +2550,20 @@ void manager_dispatch_bus_query_pid_done(
 }
 
 int manager_open_serialization(Manager *m, FILE **_f) {
-        char *path;
+        char *path = NULL;
         mode_t saved_umask;
         int fd;
         FILE *f;
 
         assert(_f);
 
-        if (m->running_as == MANAGER_SYSTEM) {
-                mkdir_p("/dev/.systemd", 0755);
+        if (m->running_as == MANAGER_SYSTEM)
+                asprintf(&path, "/dev/.run/systemd/dump-%lu-XXXXXX", (unsigned long) getpid());
+        else
+                asprintf(&path, "/tmp/systemd-dump-%lu-XXXXXX", (unsigned long) getpid());
 
-                if (asprintf(&path, "/dev/.systemd/dump-%lu-XXXXXX", (unsigned long) getpid()) < 0)
-                        return -ENOMEM;
-        } else {
-                if (asprintf(&path, "/tmp/systemd-dump-%lu-XXXXXX", (unsigned long) getpid()) < 0)
-                        return -ENOMEM;
-        }
+        if (!path)
+                return -ENOMEM;
 
         saved_umask = umask(0077);
         fd = mkostemp(path, O_RDWR|O_CLOEXEC);
@@ -2862,7 +2860,7 @@ void manager_run_generators(Manager *m) {
 
         if (!m->generator_unit_path) {
                 char *p;
-                char system_path[] = "/dev/.systemd/generator-XXXXXX",
+                char system_path[] = "/dev/.run/systemd/generator-XXXXXX",
                         user_path[] = "/tmp/systemd-generator-XXXXXX";
 
                 if (!(p = mkdtemp(m->running_as == MANAGER_SYSTEM ? system_path : user_path))) {
diff --git a/src/mount-setup.c b/src/mount-setup.c
index 09ee07f..d740d4f 100644
--- a/src/mount-setup.c
+++ b/src/mount-setup.c
@@ -242,7 +242,7 @@ int mount_setup(void) {
          * appropriate labels, after mounting. The other virtual API
          * file systems do not need. */
 
-        if (unlink("/dev/.systemd/relabel-devtmpfs") >= 0)
+        if (unlink("/dev/.systemd-relabel-devtmpfs") >= 0)
                 nftw("/dev", nftw_cb, 64, FTW_MOUNT|FTW_PHYS);
 
         /* Create a few default symlinks, which are normally created
@@ -252,5 +252,9 @@ int mount_setup(void) {
         NULSTR_FOREACH_PAIR(j, k, symlinks)
                 symlink_and_label(j, k);
 
+        /* Create a few directories we always want around */
+        mkdir("/dev/.run/systemd", 0755);
+        mkdir("/dev/.run/systemd/ask-password", 0755);
+
         return mount_cgroup_controllers();
 }
diff --git a/src/path-lookup.c b/src/path-lookup.c
index 1a21ca0..922e722 100644
--- a/src/path-lookup.c
+++ b/src/path-lookup.c
@@ -183,7 +183,7 @@ int lookup_paths_init(LookupPaths *p, ManagerRunningAs running_as) {
                         if (!(p->unit_path = strv_new(
                                               /* If you modify this you also want to modify
                                                * systemdsystemunitpath= in systemd.pc.in! */
-                                              "/dev/.systemd/system",
+                                              "/dev/.run/systemd/system",
                                               SYSTEM_CONFIG_UNIT_PATH,
                                               "/etc/systemd/system",
                                               "/usr/local/share/systemd/system",
diff --git a/src/quotacheck.c b/src/quotacheck.c
index 5ced933..55c2f0c 100644
--- a/src/quotacheck.c
+++ b/src/quotacheck.c
@@ -94,7 +94,7 @@ int main(int argc, char *argv[]) {
                 if (arg_skip)
                         return 0;
 
-                if (access("/dev/.systemd/quotacheck", F_OK) < 0)
+                if (access("/dev/.run/systemd/quotacheck", F_OK) < 0)
                         return 0;
         }
 
diff --git a/src/readahead-collect.c b/src/readahead-collect.c
index 0970b58..ca82271 100644
--- a/src/readahead-collect.c
+++ b/src/readahead-collect.c
@@ -289,13 +289,13 @@ static int collect(const char *root) {
 
         log_debug("Collecting...");
 
-        if (access("/dev/.systemd/readahead/cancel", F_OK) >= 0) {
+        if (access("/dev/.run/systemd/readahead/cancel", F_OK) >= 0) {
                 log_debug("Collection canceled");
                 r = -ECANCELED;
                 goto finish;
         }
 
-        if (access("/dev/.systemd/readahead/done", F_OK) >= 0) {
+        if (access("/dev/.run/systemd/readahead/done", F_OK) >= 0) {
                 log_debug("Got termination request");
                 goto done;
         }
diff --git a/src/readahead-common.c b/src/readahead-common.c
index e991dfd..990ffd4 100644
--- a/src/readahead-common.c
+++ b/src/readahead-common.c
@@ -167,11 +167,11 @@ int open_inotify(void) {
                 return -errno;
         }
 
-        mkdir("/dev/.systemd", 0755);
-        mkdir("/dev/.systemd/readahead", 0755);
+        mkdir("/dev/.run/systemd", 0755);
+        mkdir("/dev/.run/systemd/readahead", 0755);
 
-        if (inotify_add_watch(fd, "/dev/.systemd/readahead", IN_CREATE) < 0) {
-                log_error("Failed to watch /dev/.systemd/readahead: %m");
+        if (inotify_add_watch(fd, "/dev/.run/systemd/readahead", IN_CREATE) < 0) {
+                log_error("Failed to watch /dev/.run/systemd/readahead: %m");
                 close_nointr_nofail(fd);
                 return -errno;
         }
@@ -183,10 +183,10 @@ ReadaheadShared *shared_get(void) {
         int fd;
         ReadaheadShared *m = NULL;
 
-        mkdir("/dev/.systemd", 0755);
-        mkdir("/dev/.systemd/readahead", 0755);
+        mkdir("/dev/.run/systemd", 0755);
+        mkdir("/dev/.run/systemd/readahead", 0755);
 
-        if ((fd = open("/dev/.systemd/readahead/shared", O_CREAT|O_RDWR|O_CLOEXEC, 0644)) < 0) {
+        if ((fd = open("/dev/.run/systemd/readahead/shared", O_CREAT|O_RDWR|O_CLOEXEC, 0644)) < 0) {
                 log_error("Failed to create shared memory segment: %m");
                 goto finish;
         }
diff --git a/src/readahead-replay.c b/src/readahead-replay.c
index 3bea929..d2de7ef 100644
--- a/src/readahead-replay.c
+++ b/src/readahead-replay.c
@@ -192,7 +192,7 @@ static int replay(const char *root) {
 
         log_debug("Replaying...");
 
-        if (access("/dev/.systemd/readahead/noreplay", F_OK) >= 0) {
+        if (access("/dev/.run/systemd/readahead/noreplay", F_OK) >= 0) {
                 log_debug("Got termination request");
                 goto done;
         }
diff --git a/src/sd-readahead.c b/src/sd-readahead.c
index 41e6d3d..0dfe4ab 100644
--- a/src/sd-readahead.c
+++ b/src/sd-readahead.c
@@ -42,8 +42,8 @@ static int touch(const char *path) {
 #if !defined(DISABLE_SYSTEMD) && defined(__linux__)
         int fd;
 
-        mkdir("/dev/.systemd", 0755);
-        mkdir("/dev/.systemd/readahead", 0755);
+        mkdir("/dev/.run/systemd", 0755);
+        mkdir("/dev/.run/systemd/readahead", 0755);
 
         if ((fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0666)) < 0)
                 return -errno;
@@ -66,11 +66,11 @@ int sd_readahead(const char *action) {
                 return -EINVAL;
 
         if (strcmp(action, "cancel") == 0)
-                return touch("/dev/.systemd/readahead/cancel");
+                return touch("/dev/.run/systemd/readahead/cancel");
         else if (strcmp(action, "done") == 0)
-                return touch("/dev/.systemd/readahead/done");
+                return touch("/dev/.run/systemd/readahead/done");
         else if (strcmp(action, "noreplay") == 0)
-                return touch("/dev/.systemd/readahead/noreplay");
+                return touch("/dev/.run/systemd/readahead/noreplay");
 
         return -EINVAL;
 }
diff --git a/src/selinux-setup.c b/src/selinux-setup.c
index 8bd9380..e21ff6b 100644
--- a/src/selinux-setup.c
+++ b/src/selinux-setup.c
@@ -45,8 +45,7 @@ int selinux_setup(char *const argv[]) {
        /* Before we load the policy we create a flag file to ensure
         * that after the reexec we iterate through /dev to relabel
         * things. */
-       mkdir_p("/dev/.systemd", 0755);
-       touch("/dev/.systemd/relabel-devtmpfs");
+       touch("/dev/.systemd-relabel-devtmpfs");
 
        if (selinux_init_load_policy(&enforce) == 0) {
                log_debug("Successfully loaded SELinux policy, reexecuting.");
@@ -61,7 +60,7 @@ int selinux_setup(char *const argv[]) {
        } else {
                log_full(enforce > 0 ? LOG_ERR : LOG_WARNING, "Failed to load SELinux policy.");
 
-               unlink("/dev/.systemd/relabel-devtmpfs");
+               unlink("/dev/.systemd-relabel-devtmpfs");
 
                if (enforce > 0)
                        return -EIO;
diff --git a/src/tty-ask-password-agent.c b/src/tty-ask-password-agent.c
index 35e4d63..2c854fa 100644
--- a/src/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent.c
@@ -431,7 +431,7 @@ static int wall_tty_block(void) {
         if ((r = get_ctty_devnr(&devnr)) < 0)
                 return -r;
 
-        if (asprintf(&p, "/dev/.systemd/ask-password-block/%u:%u", major(devnr), minor(devnr)) < 0)
+        if (asprintf(&p, "/dev/.run/systemd/ask-password-block/%u:%u", major(devnr), minor(devnr)) < 0)
                 return -ENOMEM;
 
         mkdir_parents(p, 0700);
@@ -475,7 +475,7 @@ static bool wall_tty_match(const char *path) {
          * advantage that the block will automatically go away if the
          * process dies. */
 
-        if (asprintf(&p, "/dev/.systemd/ask-password-block/%u:%u", major(st.st_rdev), minor(st.st_rdev)) < 0)
+        if (asprintf(&p, "/dev/.run/systemd/ask-password-block/%u:%u", major(st.st_rdev), minor(st.st_rdev)) < 0)
                 return true;
 
         fd = open(p, O_WRONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
@@ -494,7 +494,7 @@ static int show_passwords(void) {
         struct dirent *de;
         int r = 0;
 
-        if (!(d = opendir("/dev/.systemd/ask-password"))) {
+        if (!(d = opendir("/dev/.run/systemd/ask-password"))) {
                 if (errno == ENOENT)
                         return 0;
 
@@ -519,7 +519,7 @@ static int show_passwords(void) {
                 if (!startswith(de->d_name, "ask."))
                         continue;
 
-                if (!(p = strappend("/dev/.systemd/ask-password/", de->d_name))) {
+                if (!(p = strappend("/dev/.run/systemd/ask-password/", de->d_name))) {
                         log_error("Out of memory");
                         r = -ENOMEM;
                         goto finish;
@@ -558,14 +558,14 @@ static int watch_passwords(void) {
 
         tty_block_fd = wall_tty_block();
 
-        mkdir_p("/dev/.systemd/ask-password", 0755);
+        mkdir_p("/dev/.run/systemd/ask-password", 0755);
 
         if ((notify = inotify_init1(IN_CLOEXEC)) < 0) {
                 r = -errno;
                 goto finish;
         }
 
-        if (inotify_add_watch(notify, "/dev/.systemd/ask-password", IN_CLOSE_WRITE|IN_MOVED_TO) < 0) {
+        if (inotify_add_watch(notify, "/dev/.run/systemd/ask-password", IN_CLOSE_WRITE|IN_MOVED_TO) < 0) {
                 r = -errno;
                 goto finish;
         }
diff --git a/systemd.pc.in b/systemd.pc.in
index e939293..f962b58 100644
--- a/systemd.pc.in
+++ b/systemd.pc.in
@@ -11,7 +11,7 @@ systemdsystemunitdir=@systemunitdir@
 systemduserunitdir=@pkgdatadir@/user
 systemdsystemconfdir=@pkgsysconfdir@/system
 systemduserconfdir=@pkgsysconfdir@/user
-systemdsystemunitpath=/dev/.systemd/system:${systemdsystemconfdir}:/etc/systemd/system:/usr/local/share/systemd/system:/usr/share/systemd/system:/lib/systemd/system:${systemdsystemunitdir}
+systemdsystemunitpath=/dev/.run/systemd/system:${systemdsystemconfdir}:/etc/systemd/system:/usr/local/share/systemd/system:/usr/share/systemd/system:/lib/systemd/system:${systemdsystemunitdir}
 
 Name: systemd
 Description: systemd System and Service Manager
diff --git a/units/systemd-ask-password-console.path b/units/systemd-ask-password-console.path
index 9d3d80d..ac76fc1 100644
--- a/units/systemd-ask-password-console.path
+++ b/units/systemd-ask-password-console.path
@@ -12,4 +12,4 @@ Conflicts=shutdown.target
 Before=basic.target shutdown.target
 
 [Path]
-DirectoryNotEmpty=/dev/.systemd/ask-password
+DirectoryNotEmpty=/dev/.run/systemd/ask-password
diff --git a/units/systemd-ask-password-plymouth.path b/units/systemd-ask-password-plymouth.path
index 1d09223..b339b5e 100644
--- a/units/systemd-ask-password-plymouth.path
+++ b/units/systemd-ask-password-plymouth.path
@@ -12,4 +12,4 @@ Conflicts=shutdown.target systemd-ask-password-console.path systemd-ask-password
 Before=basic.target shutdown.target
 
 [Path]
-DirectoryNotEmpty=/dev/.systemd/ask-password
+DirectoryNotEmpty=/dev/.run/systemd/ask-password
diff --git a/units/systemd-ask-password-wall.path b/units/systemd-ask-password-wall.path
index 9c4b1d3..c277563 100644
--- a/units/systemd-ask-password-wall.path
+++ b/units/systemd-ask-password-wall.path
@@ -12,4 +12,4 @@ Conflicts=shutdown.target
 Before=basic.target shutdown.target
 
 [Path]
-DirectoryNotEmpty=/dev/.systemd/ask-password
+DirectoryNotEmpty=/dev/.run/systemd/ask-password



More information about the systemd-commits mailing list