]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/login/logind-user.c
logind: improve error propagation of user_check_linger_file()
[thirdparty/systemd.git] / src / login / logind-user.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2
3 #include <errno.h>
4 #include <string.h>
5 #include <unistd.h>
6 #include <stdio_ext.h>
7
8 #include "alloc-util.h"
9 #include "bus-common-errors.h"
10 #include "bus-error.h"
11 #include "bus-util.h"
12 #include "cgroup-util.h"
13 #include "clean-ipc.h"
14 #include "escape.h"
15 #include "fd-util.h"
16 #include "fileio.h"
17 #include "format-util.h"
18 #include "fs-util.h"
19 #include "hashmap.h"
20 #include "label.h"
21 #include "logind-user.h"
22 #include "mkdir.h"
23 #include "parse-util.h"
24 #include "path-util.h"
25 #include "rm-rf.h"
26 #include "special.h"
27 #include "stdio-util.h"
28 #include "string-table.h"
29 #include "unit-name.h"
30 #include "user-util.h"
31 #include "util.h"
32
33 int user_new(User **ret,
34 Manager *m,
35 uid_t uid,
36 gid_t gid,
37 const char *name,
38 const char *home) {
39
40 _cleanup_(user_freep) User *u = NULL;
41 char lu[DECIMAL_STR_MAX(uid_t) + 1];
42 int r;
43
44 assert(ret);
45 assert(m);
46 assert(name);
47
48 u = new(User, 1);
49 if (!u)
50 return -ENOMEM;
51
52 *u = (User) {
53 .manager = m,
54 .uid = uid,
55 .gid = gid,
56 .last_session_timestamp = USEC_INFINITY,
57 };
58
59 u->name = strdup(name);
60 if (!u->name)
61 return -ENOMEM;
62
63 u->home = strdup(home);
64 if (!u->home)
65 return -ENOMEM;
66
67 if (asprintf(&u->state_file, "/run/systemd/users/"UID_FMT, uid) < 0)
68 return -ENOMEM;
69
70 if (asprintf(&u->runtime_path, "/run/user/"UID_FMT, uid) < 0)
71 return -ENOMEM;
72
73 xsprintf(lu, UID_FMT, uid);
74 r = slice_build_subslice(SPECIAL_USER_SLICE, lu, &u->slice);
75 if (r < 0)
76 return r;
77
78 r = unit_name_build("user", lu, ".service", &u->service);
79 if (r < 0)
80 return r;
81
82 r = unit_name_build("user-runtime-dir", lu, ".service", &u->runtime_dir_service);
83 if (r < 0)
84 return r;
85
86 r = hashmap_put(m->users, UID_TO_PTR(uid), u);
87 if (r < 0)
88 return r;
89
90 r = hashmap_put(m->user_units, u->slice, u);
91 if (r < 0)
92 return r;
93
94 r = hashmap_put(m->user_units, u->service, u);
95 if (r < 0)
96 return r;
97
98 r = hashmap_put(m->user_units, u->runtime_dir_service, u);
99 if (r < 0)
100 return r;
101
102 *ret = TAKE_PTR(u);
103 return 0;
104 }
105
106 User *user_free(User *u) {
107 if (!u)
108 return NULL;
109
110 if (u->in_gc_queue)
111 LIST_REMOVE(gc_queue, u->manager->user_gc_queue, u);
112
113 while (u->sessions)
114 session_free(u->sessions);
115
116 if (u->service)
117 hashmap_remove_value(u->manager->user_units, u->service, u);
118
119 if (u->runtime_dir_service)
120 hashmap_remove_value(u->manager->user_units, u->runtime_dir_service, u);
121
122 if (u->slice)
123 hashmap_remove_value(u->manager->user_units, u->slice, u);
124
125 hashmap_remove_value(u->manager->users, UID_TO_PTR(u->uid), u);
126
127 (void) sd_event_source_unref(u->timer_event_source);
128
129 u->service_job = mfree(u->service_job);
130
131 u->service = mfree(u->service);
132 u->runtime_dir_service = mfree(u->runtime_dir_service);
133 u->slice = mfree(u->slice);
134 u->runtime_path = mfree(u->runtime_path);
135 u->state_file = mfree(u->state_file);
136 u->name = mfree(u->name);
137 u->home = mfree(u->home);
138
139 return mfree(u);
140 }
141
142 static int user_save_internal(User *u) {
143 _cleanup_free_ char *temp_path = NULL;
144 _cleanup_fclose_ FILE *f = NULL;
145 int r;
146
147 assert(u);
148 assert(u->state_file);
149
150 r = mkdir_safe_label("/run/systemd/users", 0755, 0, 0, MKDIR_WARN_MODE);
151 if (r < 0)
152 goto fail;
153
154 r = fopen_temporary(u->state_file, &f, &temp_path);
155 if (r < 0)
156 goto fail;
157
158 (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
159 (void) fchmod(fileno(f), 0644);
160
161 fprintf(f,
162 "# This is private data. Do not parse.\n"
163 "NAME=%s\n"
164 "STATE=%s\n" /* friendly user-facing state */
165 "STOPPING=%s\n", /* low-level state */
166 u->name,
167 user_state_to_string(user_get_state(u)),
168 yes_no(u->stopping));
169
170 /* LEGACY: no-one reads RUNTIME= anymore, drop it at some point */
171 if (u->runtime_path)
172 fprintf(f, "RUNTIME=%s\n", u->runtime_path);
173
174 if (u->service_job)
175 fprintf(f, "SERVICE_JOB=%s\n", u->service_job);
176
177 if (u->display)
178 fprintf(f, "DISPLAY=%s\n", u->display->id);
179
180 if (dual_timestamp_is_set(&u->timestamp))
181 fprintf(f,
182 "REALTIME="USEC_FMT"\n"
183 "MONOTONIC="USEC_FMT"\n",
184 u->timestamp.realtime,
185 u->timestamp.monotonic);
186
187 if (u->last_session_timestamp != USEC_INFINITY)
188 fprintf(f, "LAST_SESSION_TIMESTAMP=" USEC_FMT "\n",
189 u->last_session_timestamp);
190
191 if (u->sessions) {
192 Session *i;
193 bool first;
194
195 fputs("SESSIONS=", f);
196 first = true;
197 LIST_FOREACH(sessions_by_user, i, u->sessions) {
198 if (first)
199 first = false;
200 else
201 fputc(' ', f);
202
203 fputs(i->id, f);
204 }
205
206 fputs("\nSEATS=", f);
207 first = true;
208 LIST_FOREACH(sessions_by_user, i, u->sessions) {
209 if (!i->seat)
210 continue;
211
212 if (first)
213 first = false;
214 else
215 fputc(' ', f);
216
217 fputs(i->seat->id, f);
218 }
219
220 fputs("\nACTIVE_SESSIONS=", f);
221 first = true;
222 LIST_FOREACH(sessions_by_user, i, u->sessions) {
223 if (!session_is_active(i))
224 continue;
225
226 if (first)
227 first = false;
228 else
229 fputc(' ', f);
230
231 fputs(i->id, f);
232 }
233
234 fputs("\nONLINE_SESSIONS=", f);
235 first = true;
236 LIST_FOREACH(sessions_by_user, i, u->sessions) {
237 if (session_get_state(i) == SESSION_CLOSING)
238 continue;
239
240 if (first)
241 first = false;
242 else
243 fputc(' ', f);
244
245 fputs(i->id, f);
246 }
247
248 fputs("\nACTIVE_SEATS=", f);
249 first = true;
250 LIST_FOREACH(sessions_by_user, i, u->sessions) {
251 if (!session_is_active(i) || !i->seat)
252 continue;
253
254 if (first)
255 first = false;
256 else
257 fputc(' ', f);
258
259 fputs(i->seat->id, f);
260 }
261
262 fputs("\nONLINE_SEATS=", f);
263 first = true;
264 LIST_FOREACH(sessions_by_user, i, u->sessions) {
265 if (session_get_state(i) == SESSION_CLOSING || !i->seat)
266 continue;
267
268 if (first)
269 first = false;
270 else
271 fputc(' ', f);
272
273 fputs(i->seat->id, f);
274 }
275 fputc('\n', f);
276 }
277
278 r = fflush_and_check(f);
279 if (r < 0)
280 goto fail;
281
282 if (rename(temp_path, u->state_file) < 0) {
283 r = -errno;
284 goto fail;
285 }
286
287 return 0;
288
289 fail:
290 (void) unlink(u->state_file);
291
292 if (temp_path)
293 (void) unlink(temp_path);
294
295 return log_error_errno(r, "Failed to save user data %s: %m", u->state_file);
296 }
297
298 int user_save(User *u) {
299 assert(u);
300
301 if (!u->started)
302 return 0;
303
304 return user_save_internal(u);
305 }
306
307 int user_load(User *u) {
308 _cleanup_free_ char *realtime = NULL, *monotonic = NULL, *stopping = NULL, *last_session_timestamp = NULL;
309 int r;
310
311 assert(u);
312
313 r = parse_env_file(NULL, u->state_file, NEWLINE,
314 "SERVICE_JOB", &u->service_job,
315 "STOPPING", &stopping,
316 "REALTIME", &realtime,
317 "MONOTONIC", &monotonic,
318 "LAST_SESSION_TIMESTAMP", &last_session_timestamp,
319 NULL);
320 if (r == -ENOENT)
321 return 0;
322 if (r < 0)
323 return log_error_errno(r, "Failed to read %s: %m", u->state_file);
324
325 if (stopping) {
326 r = parse_boolean(stopping);
327 if (r < 0)
328 log_debug_errno(r, "Failed to parse 'STOPPING' boolean: %s", stopping);
329 else
330 u->stopping = r;
331 }
332
333 if (realtime)
334 (void) timestamp_deserialize(realtime, &u->timestamp.realtime);
335 if (monotonic)
336 (void) timestamp_deserialize(monotonic, &u->timestamp.monotonic);
337 if (last_session_timestamp)
338 (void) timestamp_deserialize(last_session_timestamp, &u->last_session_timestamp);
339
340 return 0;
341 }
342
343 static void user_start_service(User *u) {
344 _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
345 int r;
346
347 assert(u);
348
349 /* Start the service containing the "systemd --user" instance (user@.service). Note that we don't explicitly
350 * start the per-user slice or the systemd-runtime-dir@.service instance, as those are pulled in both by
351 * user@.service and the session scopes as dependencies. */
352
353 u->service_job = mfree(u->service_job);
354
355 r = manager_start_unit(u->manager, u->service, &error, &u->service_job);
356 if (r < 0)
357 log_warning_errno(r, "Failed to start user service '%s', ignoring: %s", u->service, bus_error_message(&error, r));
358 }
359
360 int user_start(User *u) {
361 assert(u);
362
363 if (u->started && !u->stopping)
364 return 0;
365
366 /* If u->stopping is set, the user is marked for removal and service stop-jobs are queued. We have to clear
367 * that flag before queing the start-jobs again. If they succeed, the user object can be re-used just fine
368 * (pid1 takes care of job-ordering and proper restart), but if they fail, we want to force another user_stop()
369 * so possibly pending units are stopped. */
370 u->stopping = false;
371
372 if (!u->started)
373 log_debug("Starting services for new user %s.", u->name);
374
375 /* Save the user data so far, because pam_systemd will read the XDG_RUNTIME_DIR out of it while starting up
376 * systemd --user. We need to do user_save_internal() because we have not "officially" started yet. */
377 user_save_internal(u);
378
379 /* Start user@UID.service */
380 user_start_service(u);
381
382 if (!u->started) {
383 if (!dual_timestamp_is_set(&u->timestamp))
384 dual_timestamp_get(&u->timestamp);
385 user_send_signal(u, true);
386 u->started = true;
387 }
388
389 /* Save new user data */
390 user_save(u);
391
392 return 0;
393 }
394
395 static void user_stop_service(User *u) {
396 _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
397 int r;
398
399 assert(u);
400 assert(u->service);
401
402 /* The reverse of user_start_service(). Note that we only stop user@UID.service here, and let StopWhenUnneeded=
403 * deal with the slice and the user-runtime-dir@.service instance. */
404
405 u->service_job = mfree(u->service_job);
406
407 r = manager_stop_unit(u->manager, u->service, &error, &u->service_job);
408 if (r < 0)
409 log_warning_errno(r, "Failed to stop user service '%s', ignoring: %s", u->service, bus_error_message(&error, r));
410 }
411
412 int user_stop(User *u, bool force) {
413 Session *s;
414 int r = 0;
415 assert(u);
416
417 /* This is called whenever we begin with tearing down a user record. It's called in two cases: explicit API
418 * request to do so via the bus (in which case 'force' is true) and automatically due to GC, if there's no
419 * session left pinning it (in which case 'force' is false). Note that this just initiates tearing down of the
420 * user, the User object will remain in memory until user_finalize() is called, see below. */
421
422 if (!u->started)
423 return 0;
424
425 if (u->stopping) { /* Stop jobs have already been queued */
426 user_save(u);
427 return 0;
428 }
429
430 LIST_FOREACH(sessions_by_user, s, u->sessions) {
431 int k;
432
433 k = session_stop(s, force);
434 if (k < 0)
435 r = k;
436 }
437
438 user_stop_service(u);
439
440 u->stopping = true;
441
442 user_save(u);
443
444 return r;
445 }
446
447 int user_finalize(User *u) {
448 Session *s;
449 int r = 0, k;
450
451 assert(u);
452
453 /* Called when the user is really ready to be freed, i.e. when all unit stop jobs and suchlike for it are
454 * done. This is called as a result of an earlier user_done() when all jobs are completed. */
455
456 if (u->started)
457 log_debug("User %s logged out.", u->name);
458
459 LIST_FOREACH(sessions_by_user, s, u->sessions) {
460 k = session_finalize(s);
461 if (k < 0)
462 r = k;
463 }
464
465 /* Clean SysV + POSIX IPC objects, but only if this is not a system user. Background: in many setups cronjobs
466 * are run in full PAM and thus logind sessions, even if the code run doesn't belong to actual users but to
467 * system components. Since enable RemoveIPC= globally for all users, we need to be a bit careful with such
468 * cases, as we shouldn't accidentally remove a system service's IPC objects while it is running, just because
469 * a cronjob running as the same user just finished. Hence: exclude system users generally from IPC clean-up,
470 * and do it only for normal users. */
471 if (u->manager->remove_ipc && !uid_is_system(u->uid)) {
472 k = clean_ipc_by_uid(u->uid);
473 if (k < 0)
474 r = k;
475 }
476
477 (void) unlink(u->state_file);
478 user_add_to_gc_queue(u);
479
480 if (u->started) {
481 user_send_signal(u, false);
482 u->started = false;
483 }
484
485 return r;
486 }
487
488 int user_get_idle_hint(User *u, dual_timestamp *t) {
489 Session *s;
490 bool idle_hint = true;
491 dual_timestamp ts = DUAL_TIMESTAMP_NULL;
492
493 assert(u);
494
495 LIST_FOREACH(sessions_by_user, s, u->sessions) {
496 dual_timestamp k;
497 int ih;
498
499 ih = session_get_idle_hint(s, &k);
500 if (ih < 0)
501 return ih;
502
503 if (!ih) {
504 if (!idle_hint) {
505 if (k.monotonic < ts.monotonic)
506 ts = k;
507 } else {
508 idle_hint = false;
509 ts = k;
510 }
511 } else if (idle_hint) {
512
513 if (k.monotonic > ts.monotonic)
514 ts = k;
515 }
516 }
517
518 if (t)
519 *t = ts;
520
521 return idle_hint;
522 }
523
524 int user_check_linger_file(User *u) {
525 _cleanup_free_ char *cc = NULL;
526 char *p = NULL;
527
528 cc = cescape(u->name);
529 if (!cc)
530 return -ENOMEM;
531
532 p = strjoina("/var/lib/systemd/linger/", cc);
533 if (access(p, F_OK) < 0) {
534 if (errno != ENOENT)
535 return -errno;
536
537 return false;
538 }
539
540 return true;
541 }
542
543 bool user_may_gc(User *u, bool drop_not_started) {
544 int r;
545
546 assert(u);
547
548 if (drop_not_started && !u->started)
549 return true;
550
551 if (u->sessions)
552 return false;
553
554 if (u->last_session_timestamp != USEC_INFINITY) {
555 /* All sessions have been closed. Let's see if we shall leave the user record around for a bit */
556
557 if (u->manager->user_stop_delay == USEC_INFINITY)
558 return false; /* Leave it around forever! */
559 if (u->manager->user_stop_delay > 0 &&
560 now(CLOCK_MONOTONIC) < usec_add(u->last_session_timestamp, u->manager->user_stop_delay))
561 return false; /* Leave it around for a bit longer. */
562 }
563
564 /* Is this a user that shall stay around forever? */
565 if (user_check_linger_file(u) > 0)
566 return false;
567
568 /* Check if our job is still pending */
569 if (u->service_job) {
570 _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
571
572 r = manager_job_is_active(u->manager, u->service_job, &error);
573 if (r < 0)
574 log_debug_errno(r, "Failed to determine whether job '%s' is pending, ignoring: %s", u->service_job, bus_error_message(&error, r));
575 if (r != 0)
576 return false;
577 }
578
579 /* Note that we don't care if the three units we manage for each user object are up or not, as we are managing
580 * their state rather than tracking it. */
581
582 return true;
583 }
584
585 void user_add_to_gc_queue(User *u) {
586 assert(u);
587
588 if (u->in_gc_queue)
589 return;
590
591 LIST_PREPEND(gc_queue, u->manager->user_gc_queue, u);
592 u->in_gc_queue = true;
593 }
594
595 UserState user_get_state(User *u) {
596 Session *i;
597
598 assert(u);
599
600 if (u->stopping)
601 return USER_CLOSING;
602
603 if (!u->started || u->service_job)
604 return USER_OPENING;
605
606 if (u->sessions) {
607 bool all_closing = true;
608
609 LIST_FOREACH(sessions_by_user, i, u->sessions) {
610 SessionState state;
611
612 state = session_get_state(i);
613 if (state == SESSION_ACTIVE)
614 return USER_ACTIVE;
615 if (state != SESSION_CLOSING)
616 all_closing = false;
617 }
618
619 return all_closing ? USER_CLOSING : USER_ONLINE;
620 }
621
622 if (user_check_linger_file(u) > 0)
623 return USER_LINGERING;
624
625 return USER_CLOSING;
626 }
627
628 int user_kill(User *u, int signo) {
629 assert(u);
630
631 return manager_kill_unit(u->manager, u->slice, KILL_ALL, signo, NULL);
632 }
633
634 static bool elect_display_filter(Session *s) {
635 /* Return true if the session is a candidate for the user’s ‘primary session’ or ‘display’. */
636 assert(s);
637
638 return s->class == SESSION_USER && s->started && !s->stopping;
639 }
640
641 static int elect_display_compare(Session *s1, Session *s2) {
642 /* Indexed by SessionType. Lower numbers mean more preferred. */
643 const int type_ranks[_SESSION_TYPE_MAX] = {
644 [SESSION_UNSPECIFIED] = 0,
645 [SESSION_TTY] = -2,
646 [SESSION_X11] = -3,
647 [SESSION_WAYLAND] = -3,
648 [SESSION_MIR] = -3,
649 [SESSION_WEB] = -1,
650 };
651
652 /* Calculate the partial order relationship between s1 and s2,
653 * returning < 0 if s1 is preferred as the user’s ‘primary session’,
654 * 0 if s1 and s2 are equally preferred or incomparable, or > 0 if s2
655 * is preferred.
656 *
657 * s1 or s2 may be NULL. */
658 if (!s1 && !s2)
659 return 0;
660
661 if ((s1 == NULL) != (s2 == NULL))
662 return (s1 == NULL) - (s2 == NULL);
663
664 if (s1->stopping != s2->stopping)
665 return s1->stopping - s2->stopping;
666
667 if ((s1->class != SESSION_USER) != (s2->class != SESSION_USER))
668 return (s1->class != SESSION_USER) - (s2->class != SESSION_USER);
669
670 if ((s1->type == _SESSION_TYPE_INVALID) != (s2->type == _SESSION_TYPE_INVALID))
671 return (s1->type == _SESSION_TYPE_INVALID) - (s2->type == _SESSION_TYPE_INVALID);
672
673 if (s1->type != s2->type)
674 return type_ranks[s1->type] - type_ranks[s2->type];
675
676 return 0;
677 }
678
679 void user_elect_display(User *u) {
680 Session *s;
681
682 assert(u);
683
684 /* This elects a primary session for each user, which we call the "display". We try to keep the assignment
685 * stable, but we "upgrade" to better choices. */
686 log_debug("Electing new display for user %s", u->name);
687
688 LIST_FOREACH(sessions_by_user, s, u->sessions) {
689 if (!elect_display_filter(s)) {
690 log_debug("Ignoring session %s", s->id);
691 continue;
692 }
693
694 if (elect_display_compare(s, u->display) < 0) {
695 log_debug("Choosing session %s in preference to %s", s->id, u->display ? u->display->id : "-");
696 u->display = s;
697 }
698 }
699 }
700
701 static int user_stop_timeout_callback(sd_event_source *es, uint64_t usec, void *userdata) {
702 User *u = userdata;
703
704 assert(u);
705 user_add_to_gc_queue(u);
706
707 return 0;
708 }
709
710 void user_update_last_session_timer(User *u) {
711 int r;
712
713 assert(u);
714
715 if (u->sessions) {
716 /* There are sessions, turn off the timer */
717 u->last_session_timestamp = USEC_INFINITY;
718 u->timer_event_source = sd_event_source_unref(u->timer_event_source);
719 return;
720 }
721
722 if (u->last_session_timestamp != USEC_INFINITY)
723 return; /* Timer already started */
724
725 u->last_session_timestamp = now(CLOCK_MONOTONIC);
726
727 assert(!u->timer_event_source);
728
729 if (u->manager->user_stop_delay == 0 || u->manager->user_stop_delay == USEC_INFINITY)
730 return;
731
732 if (sd_event_get_state(u->manager->event) == SD_EVENT_FINISHED) {
733 log_debug("Not allocating user stop timeout, since we are already exiting.");
734 return;
735 }
736
737 r = sd_event_add_time(u->manager->event,
738 &u->timer_event_source,
739 CLOCK_MONOTONIC,
740 usec_add(u->last_session_timestamp, u->manager->user_stop_delay), 0,
741 user_stop_timeout_callback, u);
742 if (r < 0)
743 log_warning_errno(r, "Failed to enqueue user stop event source, ignoring: %m");
744
745 if (DEBUG_LOGGING) {
746 char s[FORMAT_TIMESPAN_MAX];
747
748 log_debug("Last session of user '%s' logged out, terminating user context in %s.",
749 u->name,
750 format_timespan(s, sizeof(s), u->manager->user_stop_delay, USEC_PER_MSEC));
751 }
752 }
753
754 static const char* const user_state_table[_USER_STATE_MAX] = {
755 [USER_OFFLINE] = "offline",
756 [USER_OPENING] = "opening",
757 [USER_LINGERING] = "lingering",
758 [USER_ONLINE] = "online",
759 [USER_ACTIVE] = "active",
760 [USER_CLOSING] = "closing"
761 };
762
763 DEFINE_STRING_TABLE_LOOKUP(user_state, UserState);
764
765 int config_parse_tmpfs_size(
766 const char* unit,
767 const char *filename,
768 unsigned line,
769 const char *section,
770 unsigned section_line,
771 const char *lvalue,
772 int ltype,
773 const char *rvalue,
774 void *data,
775 void *userdata) {
776
777 uint64_t *sz = data;
778 int r;
779
780 assert(filename);
781 assert(lvalue);
782 assert(rvalue);
783 assert(data);
784
785 /* First, try to parse as percentage */
786 r = parse_permille(rvalue);
787 if (r > 0 && r < 1000)
788 *sz = physical_memory_scale(r, 1000U);
789 else {
790 uint64_t k;
791
792 /* If the passed argument was not a percentage, or out of range, parse as byte size */
793
794 r = parse_size(rvalue, 1024, &k);
795 if (r >= 0 && (k <= 0 || (uint64_t) (size_t) k != k))
796 r = -ERANGE;
797 if (r < 0) {
798 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value '%s', ignoring: %m", rvalue);
799 return 0;
800 }
801
802 *sz = PAGE_ALIGN((size_t) k);
803 }
804
805 return 0;
806 }
807
808 int config_parse_compat_user_tasks_max(
809 const char *unit,
810 const char *filename,
811 unsigned line,
812 const char *section,
813 unsigned section_line,
814 const char *lvalue,
815 int ltype,
816 const char *rvalue,
817 void *data,
818 void *userdata) {
819
820 assert(filename);
821 assert(lvalue);
822 assert(rvalue);
823 assert(data);
824
825 log_syntax(unit, LOG_NOTICE, filename, line, 0,
826 "Support for option %s= has been removed.",
827 lvalue);
828 log_info("Hint: try creating /etc/systemd/system/user-.slice.d/50-limits.conf with:\n"
829 " [Slice]\n"
830 " TasksMax=%s",
831 rvalue);
832 return 0;
833 }