23
23
* Contact the authors at <mandos@recompile.se>.
26
#define _GNU_SOURCE /* asprintf(), TEMP_FAILURE_RETRY() */
27
#include <signal.h> /* sig_atomic_t, struct sigaction,
28
sigemptyset(), sigaddset(), SIGINT,
29
SIGHUP, SIGTERM, sigaction(),
26
#define _GNU_SOURCE /* program_invocation_short_name,
27
vasprintf(), asprintf(),
28
TEMP_FAILURE_RETRY() */
29
#include <sys/types.h> /* sig_atomic_t, pid_t, setuid(),
30
geteuid(), setsid() */
31
#include <argp.h> /* argp_program_version,
32
argp_program_bug_address,
35
ARGP_ERR_UNKNOWN, struct argp,
36
argp_parse(), ARGP_IN_ORDER */
37
#include <stddef.h> /* NULL, size_t */
31
38
#include <stdbool.h> /* bool, false, true */
39
#include <stdio.h> /* FILE, fprintf(), vfprintf(),
40
vasprintf(), stderr, asprintf(),
41
fopen(), fscanf(), fclose(),
43
#include <stdarg.h> /* va_list, va_start(), vfprintf() */
44
#include <errno.h> /* program_invocation_short_name,
45
errno, ENOMEM, EINTR, ENOENT,
47
#include <string.h> /* strerror(), strdup(), memcmp() */
48
#include <error.h> /* error() */
49
#include <stdlib.h> /* free(), getenv(), malloc(),
50
reallocarray(), realloc(),
51
EXIT_FAILURE, EXIT_SUCCESS */
52
#include <unistd.h> /* TEMP_FAILURE_RETRY(), setuid(),
53
geteuid(), setsid(), chdir(),
54
dup2(), STDERR_FILENO,
55
STDOUT_FILENO, fork(), _exit(),
56
execv(), ssize_t, readlink(),
57
close(), read(), access(), X_OK */
58
#include <signal.h> /* kill(), SIGTERM, struct sigaction,
59
sigemptyset(), SIGINT, SIGHUP,
60
sigaddset(), SIG_IGN */
61
#include <sys/wait.h> /* waitpid(), WIFEXITED(),
62
WEXITSTATUS(), WIFSIGNALED(),
64
#include <iso646.h> /* not, and, or */
65
#include <sysexits.h> /* EX_OSERR, EX_USAGE,
67
#include <stdint.h> /* SIZE_MAX */
68
#include <dirent.h> /* struct dirent, scandir(),
70
#include <inttypes.h> /* uintmax_t, strtoumax(), SCNuMAX,
72
#include <sys/stat.h> /* struct stat, lstat(), S_ISLNK() */
32
73
#include <fcntl.h> /* open(), O_RDONLY */
33
#include <iso646.h> /* and, or, not*/
34
#include <sys/types.h> /* size_t, ssize_t, pid_t, struct
36
#include <sys/wait.h> /* waitpid() */
37
#include <stddef.h> /* NULL */
38
#include <string.h> /* strchr(), memcmp() */
39
#include <stdio.h> /* asprintf(), perror(), fopen(),
40
fscanf(), vasprintf(), fprintf(),
42
#include <unistd.h> /* close(), readlink(), read(),
43
fork(), setsid(), chdir(), dup2(),
44
STDERR_FILENO, execv(), access() */
45
#include <stdlib.h> /* free(), EXIT_FAILURE, realloc(),
46
EXIT_SUCCESS, malloc(), _exit(),
48
#include <dirent.h> /* scandir(), alphasort() */
49
#include <inttypes.h> /* intmax_t, strtoumax(), SCNuMAX */
50
#include <sys/stat.h> /* struct stat, lstat() */
51
#include <sysexits.h> /* EX_OSERR, EX_UNAVAILABLE */
52
#include <error.h> /* error() */
53
#include <errno.h> /* TEMP_FAILURE_RETRY */
54
74
#include <argz.h> /* argz_count(), argz_extract() */
55
#include <stdarg.h> /* va_list, va_start(), ... */
58
76
sig_atomic_t interrupted_by_signal = 0;
59
77
const char *argp_program_version = "plymouth " VERSION;