From: Jan Synacek Date: Tue, 26 Sep 2017 14:07:34 +0000 (+0200) Subject: test-cpu-set-util.c: fix typo in comment (#6916) X-Git-Tag: v235~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cde65e263643cf00a6b29c3178c9a73724da812;p=thirdparty%2Fsystemd.git test-cpu-set-util.c: fix typo in comment (#6916) --- 0cde65e263643cf00a6b29c3178c9a73724da812 diff --cc TODO index 2de99823a86,9488cd475e8..b638ab95c85 --- a/TODO +++ b/TODO @@@ -24,8 -24,15 +24,17 @@@ Janitorial Clean-ups Features: +* replace all uses of fgets() + LINE_MAX by read_line() + + * fix logging in execute.c: extend log.c to have an optional mode where + log_open() is implicitly done before each log line and log_close() right + after. This way we don't have open fds around but logs will still + work. Because it is slow this mode should used exclusively in the execute.c + case. + + * set IPAddressDeny=any on all services that shouldn't do networking (possibly + combined with IPAddressAllow=localhost). + * dissect: when we discover squashfs, don't claim we had a "writable" partition in systemd-dissect diff --cc src/core/unit.c index f1936bdf0b0,5526dd805cf..0fe881436ea --- a/src/core/unit.c +++ b/src/core/unit.c @@@ -4429,10 -4639,54 +4639,50 @@@ int unit_acquire_invocation_id(Unit *u return 0; } -void unit_set_exec_params(Unit *s, ExecParameters *p) { - CGroupContext *c; - - assert(s); - assert(s); - - p->cgroup_path = s->cgroup_path; +void unit_set_exec_params(Unit *u, ExecParameters *p) { + assert(u); + assert(p); - c = unit_get_cgroup_context(s); - SET_FLAG(p->flags, EXEC_CGROUP_DELEGATE, c && c->delegate); + p->cgroup_path = u->cgroup_path; + SET_FLAG(p->flags, EXEC_CGROUP_DELEGATE, unit_cgroup_delegate(u)); } + + int unit_fork_helper_process(Unit *u, pid_t *ret) { + pid_t pid; + int r; + + assert(u); + assert(ret); + + /* Forks off a helper process and makes sure it is a member of the unit's cgroup. Returns == 0 in the child, + * and > 0 in the parent. The pid parameter is always filled in with the child's PID. */ + + (void) unit_realize_cgroup(u); + + pid = fork(); + if (pid < 0) + return -errno; + + if (pid == 0) { + + (void) default_signals(SIGNALS_CRASH_HANDLER, SIGNALS_IGNORE, -1); + (void) ignore_signals(SIGPIPE, -1); + + log_close(); + log_open(); + + if (u->cgroup_path) { + r = cg_attach_everywhere(u->manager->cgroup_supported, u->cgroup_path, 0, NULL, NULL); + if (r < 0) { + log_unit_error_errno(u, r, "Failed to join unit cgroup %s: %m", u->cgroup_path); + _exit(EXIT_CGROUP); + } + } + + *ret = getpid_cached(); + return 0; + } + + *ret = pid; + return 1; + }