Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
steam
systemd
Commits
3b63d2d3
Commit
3b63d2d3
authored
Oct 18, 2010
by
Lennart Poettering
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tmpfiles: integrate kay's directory cleanup code and otherwise beef up tmpfiles quite a bit
parent
12aad1d0
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
652 additions
and
144 deletions
+652
-144
Makefile.am
Makefile.am
+10
-11
TODO
TODO
+2
-4
src/macro.h
src/macro.h
+10
-0
src/tmpfiles.c
src/tmpfiles.c
+588
-119
src/util.c
src/util.c
+4
-0
src/util.h
src/util.h
+3
-0
tmpfiles.d/systemd.conf
tmpfiles.d/systemd.conf
+9
-3
tmpfiles.d/x11.conf
tmpfiles.d/x11.conf
+18
-2
units/.gitignore
units/.gitignore
+2
-0
units/systemd-tmpfiles-clean.service.in
units/systemd-tmpfiles-clean.service.in
+3
-3
units/systemd-tmpfiles-clean.timer
units/systemd-tmpfiles-clean.timer
+1
-1
units/systemd-tmpfiles-setup.service.in
units/systemd-tmpfiles-setup.service.in
+2
-1
No files found.
Makefile.am
View file @
3b63d2d3
...
...
@@ -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
)
...
...
TODO
View file @
3b63d2d3
...
...
@@ -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
...
...
src/macro.h
View file @
3b63d2d3
...
...
@@ -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__ ({ \
...
...
src/tmpfiles.c
View file @
3b63d2d3
This diff is collapsed.
Click to expand it.
src/util.c
View file @
3b63d2d3
...
...
@@ -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"
,
...
...
src/util.h
View file @
3b63d2d3
...
...
@@ -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)
...
...
tmpfiles.d/systemd.conf
View file @
3b63d2d3
...
...
@@ -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
10
d
d
/
var
/
run
/
user
0755
root
root
10
d
F
/
var
/
run
/
utmp
0664
root
utmp
-
f
/
var
/
log
/
wtmp
0644
root
utmp
-
d
/
tmp
1777
root
root
10
d
d
/
var
/
tmp
1777
root
root
30
d
d
/
var
/
cache
/
man
- - -
30
d
tmpfiles.d/x11.conf
View file @
3b63d2d3
...
...
@@ -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
10
d
d
/
tmp
/.
ICE
-
unix
1777
root
root
10
d
d
/
tmp
/.
XIM
-
unix
1777
root
root
10
d
d
/
tmp
/.
font
-
unix
1777
root
root
10
d
d
/
tmp
/.
Test
-
unix
1777
root
root
10
d
# 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
units/.gitignore
View file @
3b63d2d3
systemd-tmpfiles-clean.service
systemd-tmpfiles-setup.service
halt.service
poweroff.service
reboot.service
...
...
units/
tmpwatch
.service
→
units/
systemd-tmpfiles-clean
.service
.in
View file @
3b63d2d3
...
...
@@ -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
units/
tmpwatch
.timer
→
units/
systemd-tmpfiles-clean
.timer
View file @
3b63d2d3
...
...
@@ -9,5 +9,5 @@
Description=Daily Cleanup of Temporary Directories
[Timer]
OnBootSec=1
d
OnBootSec=1
5min
OnUnitActiveSec=1d
units/systemd-tmpfiles.service.in
→
units/systemd-tmpfiles
-setup
.service.in
View file @
3b63d2d3
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment