diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-10-05 20:20:38 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-10-05 20:20:38 +0200 |
commit | d0b4880988c5900c0f951aa6fe700686411cd03e (patch) | |
tree | 157748cd1eb3f8c7147fc0f309e9417c539fc413 /src/sd-daemon.c | |
parent | a55da3cd5ea9d8cb6d7f1490516734fd43d016cb (diff) |
sd-daemon: split off sd_readahead() since it is not a feature of systemd itself but of an auxiliary tool
Diffstat (limited to 'src/sd-daemon.c')
-rw-r--r-- | src/sd-daemon.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/sd-daemon.c b/src/sd-daemon.c index 316fccc50a..9c23b917f9 100644 --- a/src/sd-daemon.c +++ b/src/sd-daemon.c @@ -433,41 +433,3 @@ int sd_booted(void) { return a.st_dev != b.st_dev; #endif } - -static int touch(const char *path) { - -#if !defined(DISABLE_SYSTEMD) && defined(__linux__) - int fd; - - mkdir("/dev/.systemd", 0755); - mkdir("/dev/.systemd/readahead", 0755); - - if ((fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0666)) < 0) - return -errno; - - for (;;) { - if (close(fd) >= 0) - break; - - if (errno != -EINTR) - return -errno; - } - -#endif - return 0; -} - -int sd_readahead(const char *action) { - - if (!action) - return -EINVAL; - - if (strcmp(action, "cancel") == 0) - return touch("/dev/.systemd/readahead/cancel"); - else if (strcmp(action, "done") == 0) - return touch("/dev/.systemd/readahead/done"); - else if (strcmp(action, "noreplay") == 0) - return touch("/dev/.systemd/readahead/noreplay"); - - return -EINVAL; -} |