Commit 3b63d2d3 authored by Lennart Poettering's avatar Lennart Poettering

tmpfiles: integrate kay's directory cleanup code and otherwise beef up tmpfiles quite a bit

parent 12aad1d0
......@@ -204,9 +204,8 @@ dist_systemunit_DATA = \
units/printer.target \
units/bluetooth.target \
units/smartcard.target \
units/tmpwatch.service \
units/tmpwatch.timer \
units/systemd-readahead-done.timer
units/systemd-readahead-done.timer \
units/systemd-tmpfiles-clean.timer
nodist_systemunit_DATA = \
units/sysinit.target \
......@@ -229,7 +228,8 @@ nodist_systemunit_DATA = \
units/systemd-readahead-collect.service \
units/systemd-readahead-replay.service \
units/systemd-readahead-done.service \
units/systemd-tmpfiles.service \
units/systemd-tmpfiles-setup.service \
units/systemd-tmpfiles-clean.service \
units/systemd-user-sessions.service \
units/syslog.target \
units/halt.service \
......@@ -266,7 +266,8 @@ EXTRA_DIST = \
units/systemd-readahead-collect.service.in \
units/systemd-readahead-replay.service.in \
units/systemd-readahead-done.service.in \
units/systemd-tmpfiles.service.in \
units/systemd-tmpfiles-setup.service.in \
units/systemd-tmpfiles-clean.service.in \
units/systemd-user-sessions.service.in \
units/syslog.target.in \
units/halt.service.in \
......@@ -1093,10 +1094,9 @@ install-data-hook:
systemd-vconsole-setup.service \
systemd-modules-load.service \
systemd-random-seed-load.service \
systemd-tmpfiles.service \
systemd-tmpfiles-setup.service \
sysctl.service \
tmpwatch.timer \
tmpwatch.service && \
systemd-tmpfiles-clean.timer && \
$(LN_S) ../dev-hugepages.automount dev-hugepages.automount && \
$(LN_S) ../dev-mqueue.automount dev-mqueue.automount && \
$(LN_S) ../proc-sys-fs-binfmt_misc.automount proc-sys-fs-binfmt_misc.automount && \
......@@ -1105,10 +1105,9 @@ install-data-hook:
$(LN_S) ../systemd-vconsole-setup.service systemd-vconsole-setup.service && \
$(LN_S) ../systemd-modules-load.service systemd-modules-load.service && \
$(LN_S) ../systemd-random-seed-load.service systemd-random-seed-load.service && \
$(LN_S) ../systemd-tmpfiles.service systemd-tmpfiles.service && \
$(LN_S) ../systemd-tmpfiles-setup.service systemd-tmpfiles-setup.service && \
$(LN_S) ../sysctl.service sysctl.service && \
$(LN_S) ../tmpwatch.timer tmpwatch.timer && \
$(LN_S) ../tmpwatch.service tmpwatch.service )
$(LN_S) ../systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.timer )
( cd $(DESTDIR)$(dbussessionservicedir) && \
rm -f org.freedesktop.systemd1.service && \
$(LN_S) ../system-services/org.freedesktop.systemd1.service org.freedesktop.systemd1.service )
......
......@@ -50,13 +50,13 @@
* exec /sbin/poweroff as PID 1 and do the shutdown
* kexec, suspend, resume
* suspend, resume
* passphrase agent https://bugs.freedesktop.org/show_bug.cgi?id=30038
* systemctl auto-pager a la git
* fsck setup: quota flag, check kcmdline/forcefsck, reboot, single user
* fsck setup: quota flag, check kcmdline/forcefsck, reboot, single user, ac plug
* merge CK
......@@ -68,8 +68,6 @@
* document locale.conf, vconsole.conf and possibly the tempfiles.d and modules-load.d mechanism.
* beefed up tmpwatch that reads tmpfiles.d
* enable syslog.socket by default, activating our kmsg bridge
* when processes remain in a service even though the start command failed enter active
......
......@@ -57,19 +57,29 @@ static inline size_t PAGE_ALIGN(size_t l) {
#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
#ifndef MAX
#define MAX(a,b) \
__extension__ ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a > _b ? _a : _b; \
})
#endif
#define MAX3(a,b,c) \
MAX(MAX(a,b),c)
#ifndef MIN
#define MIN(a,b) \
__extension__ ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a < _b ? _a : _b; \
})
#endif
#define MIN3(a,b,c) \
MIN(MIN(a,b),c)
#define CLAMP(x, low, high) \
__extension__ ({ \
......
This diff is collapsed.
......@@ -3333,6 +3333,10 @@ bool null_or_empty(struct stat *st) {
return false;
}
DIR *xopendirat(int fd, const char *name) {
return fdopendir(openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC));
}
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",
......
......@@ -32,6 +32,7 @@
#include <sched.h>
#include <limits.h>
#include <sys/stat.h>
#include <dirent.h>
#include "macro.h"
......@@ -361,6 +362,8 @@ _noreturn_ void freeze(void);
bool null_or_empty(struct stat *st);
DIR *xopendirat(int dirfd, const char *name);
#define NULSTR_FOREACH(i, l) \
for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
......
......@@ -5,6 +5,12 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
d /var/lock/subsys 0755 root root
d /var/run/user 0755 root root
f /var/run/utmp 0664 root utmp
d /var/lock/subsys 0755 root root 10d
d /var/run/user 0755 root root 10d
F /var/run/utmp 0664 root utmp -
f /var/log/wtmp 0644 root utmp -
d /tmp 1777 root root 10d
d /var/tmp 1777 root root 30d
d /var/cache/man - - - 30d
......@@ -5,5 +5,21 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
d /tmp/.X11-unix 1777 root root
d /tmp/.ICE-unix 1777 root root
# Make sure these are created by default so that nobody else can
d /tmp/.X11-unix 1777 root root 10d
d /tmp/.ICE-unix 1777 root root 10d
d /tmp/.XIM-unix 1777 root root 10d
d /tmp/.font-unix 1777 root root 10d
d /tmp/.Test-unix 1777 root root 10d
# Unlink the X11 lock files
r /tmp/.X0-lock
r /tmp/.X1-lock
r /tmp/.X2-lock
r /tmp/.X3-lock
r /tmp/.X4-lock
r /tmp/.X5-lock
r /tmp/.X6-lock
r /tmp/.X7-lock
r /tmp/.X8-lock
r /tmp/.X9-lock
systemd-tmpfiles-clean.service
systemd-tmpfiles-setup.service
halt.service
poweroff.service
reboot.service
......
......@@ -10,10 +10,10 @@ Description=Cleanup of Temporary Directories
DefaultDependencies=no
Wants=local-fs.target
After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target
Before=basic.target poweroff.service reboot.service halt.service killall.service
Before=basic.target shutdown.target
ConditionPathExists=/etc/tmpfiles.d
[Service]
Type=oneshot
ExecStart=/usr/sbin/tmpwatch -umc -x /tmp/.X11-unix -x /tmp/.ICE-unix 10d /tmp
ExecStart=/usr/sbin/tmpwatch -umc 30d /var/tmp
ExecStart=@rootlibexecdir@/systemd-tmpfiles --clean
IOSchedulingClass=idle
......@@ -9,5 +9,5 @@
Description=Daily Cleanup of Temporary Directories
[Timer]
OnBootSec=1d
OnBootSec=15min
OnUnitActiveSec=1d
......@@ -11,8 +11,9 @@ DefaultDependencies=no
Wants=local-fs.target
After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target
Before=basic.target shutdown.target
ConditionPathExists=/etc/tmpfiles.d
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-tmpfiles
ExecStart=@rootlibexecdir@/systemd-tmpfiles --create --remove
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment