Merge pull request #7855 from poettering/log-h-includes

log.h #include cleanups
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-01-15 13:43:09 +04:00 committed by GitHub
commit 67ddb52432
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
89 changed files with 182 additions and 249 deletions

2
TODO
View file

@ -24,6 +24,8 @@ Janitorial Clean-ups:
Features:
* rework pid watching logic, allow any number of units watch the same pid
* be stricter with fds we receive for the fdstore: close them asynchronously
* be stricter with pid file and notify pids: don't allow them to be outside of cgroup, except if sender is privileged

View file

@ -26,13 +26,13 @@ i.e. 0…4294967295. However, four UIDs are special on Linux:
call the `nobody` group `nogroup`. I wish they didn't.)
3. 4294967295, aka "32bit `(uid_t) -1`" → This UID is not a valid user ID, as
setresuid(), chown() and friends treat -1 as a special request to not change
the UID of the process/file. This UID is hence not available for assignment
to users in the user database.
`setresuid()`, `chown()` and friends treat -1 as a special request to not
change the UID of the process/file. This UID is hence not available for
assignment to users in the user database.
4. 65535, aka "16bit `(uid_t) -1`" → Once upon a time `uid_t` used to be 16bit, and
programs compiled for that would hence assume that `(uid_t) -1` is 65535. This
UID is hence not usable either.
4. 65535, aka "16bit `(uid_t) -1`" → Before Linux kernel 2.4 `uid_t` used to be
16bit, and programs compiled for that would hence assume that `(uid_t) -1`
is 65535. This UID is hence not usable either.
The `nss-systemd` glibc NSS module will synthesize user database records for
the UIDs 0 and 65534 if the system user database doesn't list them. This means

View file

@ -20,6 +20,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <sys/socket.h>
#include "string-util.h"
const char *af_to_name(int id);

View file

@ -35,6 +35,7 @@
#include "fileio.h"
#include "macro.h"
#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
#include "time-util.h"

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <string.h>
#include "errno-list.h"

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <net/ethernet.h>
#include <stdio.h>
#include <sys/types.h>

View file

@ -39,6 +39,7 @@
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "stat-util.h"
#include "stdio-util.h"
#include "string-util.h"

View file

@ -4,8 +4,6 @@
* Copyright 2000, 2005 Red Hat, Inc.
*/
#include <stdlib.h>
#include "gunicode.h"
#define unichar uint32_t

View file

@ -19,6 +19,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <string.h>
#include "hash-funcs.h"
void string_hash_func(const void *p, struct siphash *state) {

View file

@ -21,6 +21,7 @@
***/
#include <stdbool.h>
#include <stdio.h>
#include "macro.h"

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <unistd.h>
#include "alloc-util.h"

View file

@ -54,6 +54,7 @@
#include "syslog-util.h"
#include "terminal-util.h"
#include "time-util.h"
#include "utf8.h"
#include "util.h"
#define SNDBUF_SIZE (8*1024*1024)
@ -1226,10 +1227,12 @@ static const char *const log_target_table[_LOG_TARGET_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(log_target, LogTarget);
void log_received_signal(int level, const struct signalfd_siginfo *si) {
if (si->ssi_pid > 0) {
assert(si);
if (pid_is_valid(si->ssi_pid)) {
_cleanup_free_ char *p = NULL;
get_process_comm(si->ssi_pid, &p);
(void) get_process_comm(si->ssi_pid, &p);
log_full(level,
"Received SIG%s from PID %"PRIu32" (%s).",
@ -1239,7 +1242,6 @@ void log_received_signal(int level, const struct signalfd_siginfo *si) {
log_full(level,
"Received SIG%s.",
signal_to_string(si->ssi_signo));
}
int log_syntax_internal(
@ -1289,6 +1291,27 @@ int log_syntax_internal(
NULL);
}
int log_syntax_invalid_utf8_internal(
const char *unit,
int level,
const char *config_file,
unsigned config_line,
const char *file,
int line,
const char *func,
const char *rvalue) {
_cleanup_free_ char *p = NULL;
if (rvalue)
p = utf8_escape_invalid(rvalue);
log_syntax_internal(unit, level, config_file, config_line, 0, file, line, func,
"String is not UTF-8 clean, ignoring assignment: %s", strna(p));
return -EINVAL;
}
void log_set_upgrade_syslog_to_journal(bool b) {
upgrade_syslog_to_journal = b;
}
@ -1300,3 +1323,10 @@ void log_set_always_reopen_console(bool b) {
void log_set_open_when_needed(bool b) {
open_when_needed = b;
}
int log_emergency_level(void) {
/* Returns the log level to use for log_emergency() logging. We use LOG_EMERG only when we are PID 1, as only
* then the system of the whole system is obviously affected. */
return getpid_cached() == 1 ? LOG_EMERG : LOG_ERR;
}

View file

@ -20,18 +20,16 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/signalfd.h>
#include <sys/socket.h>
#include <syslog.h>
#include "sd-id128.h"
#include "macro.h"
#include "process-util.h"
/* Some structures we reference but don't want to pull in headers for */
struct iovec;
struct signalfd_siginfo;
typedef enum LogRealm {
LOG_REALM_SYSTEMD,
@ -194,7 +192,7 @@ int log_struct_iovec_internal(
const char *file,
int line,
const char *func,
const struct iovec input_iovec[],
const struct iovec *input_iovec,
size_t n_input_iovec);
/* This modifies the buffer passed! */
@ -240,9 +238,9 @@ void log_assert_failed_return_realm(
/* Logging with level */
#define log_full_errno_realm(realm, level, error, ...) \
({ \
int _level = (level), _e = (error); \
(log_get_max_level_realm((realm)) >= LOG_PRI(_level)) \
? log_internal_realm(LOG_REALM_PLUS_LEVEL((realm), _level), _e, \
int _level = (level), _e = (error), _realm = (realm); \
(log_get_max_level_realm(_realm) >= LOG_PRI(_level)) \
? log_internal_realm(LOG_REALM_PLUS_LEVEL(_realm, _level), _e, \
__FILE__, __LINE__, __func__, __VA_ARGS__) \
: -abs(_e); \
})
@ -252,13 +250,15 @@ void log_assert_failed_return_realm(
#define log_full(level, ...) log_full_errno((level), 0, __VA_ARGS__)
int log_emergency_level(void);
/* Normal logging */
#define log_debug(...) log_full(LOG_DEBUG, __VA_ARGS__)
#define log_info(...) log_full(LOG_INFO, __VA_ARGS__)
#define log_notice(...) log_full(LOG_NOTICE, __VA_ARGS__)
#define log_warning(...) log_full(LOG_WARNING, __VA_ARGS__)
#define log_error(...) log_full(LOG_ERR, __VA_ARGS__)
#define log_emergency(...) log_full(getpid_cached() == 1 ? LOG_EMERG : LOG_ERR, __VA_ARGS__)
#define log_emergency(...) log_full(log_emergency_level(), __VA_ARGS__)
/* Logging triggered by an errno-like error */
#define log_debug_errno(error, ...) log_full_errno(LOG_DEBUG, error, __VA_ARGS__)
@ -266,7 +266,7 @@ void log_assert_failed_return_realm(
#define log_notice_errno(error, ...) log_full_errno(LOG_NOTICE, error, __VA_ARGS__)
#define log_warning_errno(error, ...) log_full_errno(LOG_WARNING, error, __VA_ARGS__)
#define log_error_errno(error, ...) log_full_errno(LOG_ERR, error, __VA_ARGS__)
#define log_emergency_errno(error, ...) log_full_errno(getpid_cached() == 1 ? LOG_EMERG : LOG_ERR, error, __VA_ARGS__)
#define log_emergency_errno(error, ...) log_full_errno(log_emergency_level(), error, __VA_ARGS__)
#ifdef LOG_TRACE
# define log_trace(...) log_debug(__VA_ARGS__)
@ -317,6 +317,16 @@ int log_syntax_internal(
const char *func,
const char *format, ...) _printf_(9, 10);
int log_syntax_invalid_utf8_internal(
const char *unit,
int level,
const char *config_file,
unsigned config_line,
const char *file,
int line,
const char *func,
const char *rvalue);
#define log_syntax(unit, level, config_file, config_line, error, ...) \
({ \
int _level = (level), _e = (error); \
@ -328,12 +338,9 @@ int log_syntax_internal(
#define log_syntax_invalid_utf8(unit, level, config_file, config_line, rvalue) \
({ \
int _level = (level); \
if (log_get_max_level() >= LOG_PRI(_level)) { \
_cleanup_free_ char *_p = NULL; \
_p = utf8_escape_invalid(rvalue); \
log_syntax_internal(unit, _level, config_file, config_line, 0, __FILE__, __LINE__, __func__, \
"String is not UTF-8 clean, ignoring assignment: %s", strna(_p)); \
} \
(log_get_max_level() >= LOG_PRI(_level)) \
? log_syntax_invalid_utf8_internal(unit, _level, config_file, config_line, __FILE__, __LINE__, __func__, rvalue) \
: -EINVAL; \
})
#define DEBUG_LOGGING _unlikely_(log_get_max_level() >= LOG_DEBUG)

View file

@ -21,6 +21,7 @@
***/
#include <alloca.h>
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdbool.h>

View file

@ -21,11 +21,12 @@
#include <elf.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/time.h>
#include <linux/random.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#if HAVE_SYS_AUXV_H
# include <sys/auxv.h>

View file

@ -19,6 +19,7 @@
***/
#include <errno.h>
#include <stdio.h>
#include "alloc-util.h"
#include "extract-word.h"

View file

@ -41,6 +41,7 @@
#include "missing.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "socket-util.h"
#include "string-table.h"
#include "string-util.h"

View file

@ -21,10 +21,11 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <linux/magic.h>
#include <sched.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/types.h>
#include <unistd.h>
#include "dirent-util.h"

View file

@ -38,6 +38,7 @@
#include "macro.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"

View file

@ -22,10 +22,12 @@
#include <getopt.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include "env-util.h"
#include "log.h"
#include "macro.h"
#include "process-util.h"
#include "string-util.h"
#include "verbs.h"
#include "virt.h"

View file

@ -36,6 +36,8 @@
#include <sys/statfs.h>
#include <unistd.h>
#include "sd-id128.h"
#include "alloc-util.h"
#include "blkid-util.h"
#include "bootspec.h"

View file

@ -41,6 +41,7 @@
#include "log.h"
#include "missing.h"
#include "mkdir.h"
#include "process-util.h"
#include "selinux-access.h"
#include "special.h"
#include "string-util.h"

View file

@ -20,6 +20,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "env-util.h"
#include "fileio.h"

View file

@ -2588,7 +2588,9 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
log_unit_debug(u, "Failed to parse main-pid value: %s", value);
else {
service_set_main_pid(s, pid);
unit_watch_pid(UNIT(s), pid);
r = unit_watch_pid(UNIT(s), pid);
if (r < 0)
log_unit_debug_errno(u, r, "Failed to watch main PID, ignoring: %m");
}
} else if (streq(key, "main-pid-known")) {
int b;

View file

@ -38,6 +38,7 @@
#include "mount-setup.h"
#include "mount-util.h"
#include "path-util.h"
#include "process-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "udev-util.h"

View file

@ -23,6 +23,8 @@
#include <shadow.h>
#include <unistd.h>
#include "sd-id128.h"
#include "alloc-util.h"
#include "ask-password-api.h"
#include "copy.h"

View file

@ -21,6 +21,7 @@
#include <getopt.h>
#include "sd-event.h"
#include "sd-id128.h"
#include "alloc-util.h"
#include "export-raw.h"

View file

@ -27,6 +27,7 @@
#include "capability-util.h"
#include "fd-util.h"
#include "import-common.h"
#include "process-util.h"
#include "signal-util.h"
#include "util.h"

View file

@ -21,6 +21,7 @@
#include <getopt.h>
#include "sd-event.h"
#include "sd-id128.h"
#include "alloc-util.h"
#include "fd-util.h"

View file

@ -21,6 +21,7 @@
#include <getopt.h>
#include "sd-event.h"
#include "sd-id128.h"
#include "alloc-util.h"
#include "hostname-util.h"

View file

@ -38,6 +38,7 @@
#include "log.h"
#include "special.h"
#include "util.h"
#include "process-util.h"
#define SERVER_FD_MAX 16
#define TIMEOUT_MSEC ((int) (DEFAULT_EXIT_USEC/USEC_PER_MSEC))

View file

@ -43,6 +43,7 @@
#include "journald-native.h"
#include "macro.h"
#include "parse-util.h"
#include "process-util.h"
#include "signal-util.h"
#include "socket-util.h"
#include "stat-util.h"

View file

@ -37,6 +37,7 @@
#include "log.h"
#include "mkdir.h"
#include "parse-util.h"
#include "process-util.h"
#include "sigbus.h"
#include "signal-util.h"
#include "string-util.h"

View file

@ -28,6 +28,7 @@
#include "journald-kmsg.h"
#include "journald-server.h"
#include "journald-syslog.h"
#include "process-util.h"
#include "sigbus.h"
int main(int argc, char *argv[]) {

View file

@ -48,6 +48,7 @@
#include "lookup3.h"
#include "missing.h"
#include "path-util.h"
#include "process-util.h"
#include "replace-var.h"
#include "stat-util.h"
#include "stdio-util.h"

View file

@ -23,6 +23,7 @@
#include "env-util.h"
#include "macro.h"
#include "parse-util.h"
#include "process-util.h"
#include "random-util.h"
#include "string-util.h"
#include "util.h"

View file

@ -22,6 +22,7 @@
#include <linux/if.h>
#include <netinet/ether.h>
#include "sd-id128.h"
#include "sd-ndisc.h"
#include "alloc-util.h"

View file

@ -28,6 +28,7 @@
#include "dhcp-server-internal.h"
#include "fd-util.h"
#include "in-addr-util.h"
#include "sd-id128.h"
#include "siphash24.h"
#include "string-util.h"
#include "unaligned.h"

View file

@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include "sd-id128.h"
#include "sd-ipv4acd.h"
#include "sd-ipv4ll.h"

View file

@ -20,6 +20,7 @@
***/
#include <arpa/inet.h>
#include <errno.h>
#include <net/ethernet.h>
#include <stdio.h>
#include <string.h>

View file

@ -18,8 +18,6 @@
sd_login_c = files('sd-login/sd-login.c')
libsystemd_sources = files('''
sd-bus/bus-bloom.c
sd-bus/bus-bloom.h
sd-bus/bus-common-errors.c
sd-bus/bus-common-errors.h
sd-bus/bus-container.c

View file

@ -1,157 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "bus-bloom.h"
#include "siphash24.h"
#include "util.h"
static inline void set_bit(uint64_t filter[], unsigned long b) {
filter[b >> 6] |= 1ULL << (b & 63);
}
static const sd_id128_t hash_keys[] = {
SD_ID128_ARRAY(b9,66,0b,f0,46,70,47,c1,88,75,c4,9c,54,b9,bd,15),
SD_ID128_ARRAY(aa,a1,54,a2,e0,71,4b,39,bf,e1,dd,2e,9f,c5,4a,3b),
SD_ID128_ARRAY(63,fd,ae,be,cd,82,48,12,a1,6e,41,26,cb,fa,a0,c8),
SD_ID128_ARRAY(23,be,45,29,32,d2,46,2d,82,03,52,28,fe,37,17,f5),
SD_ID128_ARRAY(56,3b,bf,ee,5a,4f,43,39,af,aa,94,08,df,f0,fc,10),
SD_ID128_ARRAY(31,80,c8,73,c7,ea,46,d3,aa,25,75,0f,9e,4c,09,29),
SD_ID128_ARRAY(7d,f7,18,4b,7b,a4,44,d5,85,3c,06,e0,65,53,96,6d),
SD_ID128_ARRAY(f2,77,e9,6f,93,b5,4e,71,9a,0c,34,88,39,25,bf,35),
};
static void bloom_add_data(
uint64_t filter[], /* The filter bits */
size_t size, /* Size of the filter in bytes */
unsigned k, /* Number of hash functions */
const void *data, /* Data to hash */
size_t n) { /* Size of data to hash in bytes */
uint64_t h;
uint64_t m;
unsigned w, i, c = 0;
unsigned hash_index;
assert(size > 0);
assert(k > 0);
/* Determine bits in filter */
m = size * 8;
/* Determine how many bytes we need to generate a bit index 0..m for this filter */
w = (u64log2(m) + 7) / 8;
assert(w <= sizeof(uint64_t));
/* Make sure we have enough hash keys to generate m * k bits
* of hash value. Note that SipHash24 generates 64 bits of
* hash value for each 128 bits of hash key. */
assert(k * w <= ELEMENTSOF(hash_keys) * 8);
for (i = 0, hash_index = 0; i < k; i++) {
uint64_t p = 0;
unsigned d;
for (d = 0; d < w; d++) {
if (c <= 0) {
h = siphash24(data, n, hash_keys[hash_index++].bytes);
c += 8;
}
p = (p << 8ULL) | (uint64_t) ((uint8_t *)&h)[8 - c];
c--;
}
p &= m - 1;
set_bit(filter, p);
}
/* log_debug("bloom: adding <%.*s>", (int) n, (char*) data); */
}
void bloom_add_pair(uint64_t filter[], size_t size, unsigned k, const char *a, const char *b) {
size_t n;
char *c;
assert(filter);
assert(a);
assert(b);
n = strlen(a) + 1 + strlen(b);
c = alloca(n + 1);
strcpy(stpcpy(stpcpy(c, a), ":"), b);
bloom_add_data(filter, size, k, c, n);
}
void bloom_add_prefixes(uint64_t filter[], size_t size, unsigned k, const char *a, const char *b, char sep) {
size_t n;
char *c, *p;
assert(filter);
assert(a);
assert(b);
n = strlen(a) + 1 + strlen(b);
c = alloca(n + 1);
p = stpcpy(stpcpy(c, a), ":");
strcpy(p, b);
bloom_add_data(filter, size, k, c, n);
for (;;) {
char *e;
e = strrchr(p, sep);
if (!e)
break;
*(e + 1) = 0;
bloom_add_data(filter, size, k, c, e - c + 1);
if (e == p)
break;
*e = 0;
bloom_add_data(filter, size, k, c, e - c);
}
}
bool bloom_validate_parameters(size_t size, unsigned k) {
uint64_t m;
unsigned w;
if (size <= 0)
return false;
if (k <= 0)
return false;
m = size * 8;
w = (u64log2(m) + 7) / 8;
if (w > sizeof(uint64_t))
return false;
if (k * w > ELEMENTSOF(hash_keys) * 8)
return false;
return true;
}

View file

@ -1,44 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/*
* Our default bloom filter has the following parameters:
*
* m=512 (bits in the filter)
* k=8 (hash functions)
*
* We use SipHash24 as hash function with a number of (originally
* randomized) but fixed hash keys.
*
*/
#define DEFAULT_BLOOM_SIZE (512/8) /* m: filter size */
#define DEFAULT_BLOOM_N_HASH 8 /* k: number of hash functions */
void bloom_add_pair(uint64_t filter[], size_t size, unsigned n_hash, const char *a, const char *b);
void bloom_add_prefixes(uint64_t filter[], size_t size, unsigned n_hash, const char *a, const char *b, char sep);
bool bloom_validate_parameters(size_t size, unsigned n_hash);

View file

@ -28,12 +28,12 @@
#include "sd-bus.h"
#include "alloc-util.h"
#include "bus-bloom.h"
#include "bus-control.h"
#include "bus-internal.h"
#include "bus-message.h"
#include "bus-util.h"
#include "capability-util.h"
#include "process-util.h"
#include "stdio-util.h"
#include "string-util.h"
#include "strv.h"

View file

@ -18,6 +18,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <string.h>
#include "sd-bus.h"
#include "bus-gvariant.h"
#include "bus-signature.h"
#include "bus-type.h"

View file

@ -20,6 +20,8 @@
#include <util.h>
#include "sd-bus.h"
#include "bus-signature.h"
#include "bus-type.h"

View file

@ -38,6 +38,7 @@
#include "macro.h"
#include "missing.h"
#include "path-util.h"
#include "process-util.h"
#include "selinux-util.h"
#include "signal-util.h"
#include "stdio-util.h"

View file

@ -18,6 +18,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include "sd-bus.h"
#include "bus-type.h"
bool bus_type_is_valid(char c) {

View file

@ -22,8 +22,6 @@
#include <stdbool.h>
#include "sd-bus.h"
#include "macro.h"
bool bus_type_is_valid(char c) _const_;

View file

@ -50,6 +50,7 @@
#include "macro.h"
#include "missing.h"
#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"

View file

@ -18,6 +18,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <sys/socket.h>
#include "sd-bus.h"
#include "macro.h"

View file

@ -39,6 +39,7 @@
#include "fs-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "socket-util.h"
#include "strv.h"
#include "util.h"

View file

@ -27,6 +27,7 @@
#include "macro.h"
#include "signal-util.h"
#include "util.h"
#include "process-util.h"
static int prepare_handler(sd_event_source *s, void *userdata) {
log_info("preparing %c", PTR_TO_INT(userdata));

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>

View file

@ -30,6 +30,7 @@
#include "missing.h"
#include "netlink-internal.h"
#include "netlink-util.h"
#include "process-util.h"
#include "socket-util.h"
#include "util.h"

View file

@ -40,6 +40,7 @@
#include "missing.h"
#include "socket-util.h"
#include "util.h"
#include "process-util.h"
#define WORKERS_MIN 1U
#define WORKERS_MAX 16U

View file

@ -31,6 +31,7 @@
#include "fd-util.h"
#include "logind.h"
#include "parse-util.h"
#include "process-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "udev-util.h"

View file

@ -29,17 +29,18 @@
#include "alloc-util.h"
#include "bus-error.h"
#include "bus-util.h"
#include "cgroup-util.h"
#include "conf-parser.h"
#include "def.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "logind.h"
#include "process-util.h"
#include "selinux-util.h"
#include "signal-util.h"
#include "strv.h"
#include "udev-util.h"
#include "cgroup-util.h"
static void manager_free(Manager *m);

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <linux/if_tun.h>
#include <net/if.h>

View file

@ -18,8 +18,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <net/if.h>
#include <errno.h>
#include <linux/veth.h>
#include <net/if.h>
#include "sd-netlink.h"

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <linux/if_vlan.h>
#include <net/if.h>

View file

@ -22,6 +22,8 @@
#include <stdio.h>
#include "sd-id128.h"
#include "macro.h"
#include "nspawn-expose-ports.h"
#include "nspawn-mount.h"

View file

@ -23,6 +23,7 @@
#include <unistd.h>
#include "alloc-util.h"
#include "errno.h"
#include "fd-util.h"
#include "mkdir.h"
#include "nspawn-setuid.h"

View file

@ -28,6 +28,7 @@
#include "alloc-util.h"
#include "dissect-image.h"
#include "process-util.h"
#include "signal-util.h"
#include "string-util.h"

View file

@ -19,6 +19,7 @@
***/
#include <sys/socket.h>
#include <errno.h>
#include "dns-type.h"
#include "parse-util.h"

View file

@ -21,6 +21,8 @@
#include <net/if.h>
#include <glob.h>
#include "sd-id128.h"
#include "alloc-util.h"
#include "fileio.h"
#include "glob-util.h"

View file

@ -20,6 +20,8 @@
#include <stdio.h>
#include <linux/magic.h>
#include "sd-id128.h"
#include "alloc-util.h"
#include "blkid-util.h"
#include "bootspec.h"

View file

@ -22,6 +22,8 @@
#include <sys/prctl.h>
#include <sys/wait.h>
#include "sd-id128.h"
#include "architecture.h"
#include "ask-password-api.h"
#include "blkid-util.h"

View file

@ -22,6 +22,8 @@
#include <stdbool.h>
#include "sd-id128.h"
#include "macro.h"
typedef struct DissectedImage DissectedImage;

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <linux/loop.h>
#include <sys/ioctl.h>

View file

@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef const char* (*lookup_t)(int);
typedef int (*reverse_t)(const char*);

View file

@ -18,6 +18,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include "alloc-util.h"
#include "macro.h"
#include "parse-util.h"

View file

@ -23,6 +23,7 @@
#include "cgroup-util.h"
#include "path-util.h"
#include "process-util.h"
#include "string-util.h"
#include "util.h"

View file

@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdlib.h>
#include <string.h>

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdio.h>
#include "alloc-util.h"

View file

@ -18,6 +18,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include "alloc-util.h"
#include "hexdecoct.h"
#include "macro.h"

View file

@ -23,6 +23,7 @@
#include "format-util.h"
#include "log.h"
#include "process-util.h"
#include "util.h"
assert_cc(LOG_REALM_REMOVE_LEVEL(LOG_REALM_PLUS_LEVEL(LOG_REALM_SYSTEMD, LOG_FTP | LOG_DEBUG))

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>

View file

@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <locale.h>
#include <math.h>

View file

@ -23,6 +23,7 @@
#include "macro.h"
#include "signal-util.h"
#include "process-util.h"
static void test_block_signals(void) {
sigset_t ss;

View file

@ -19,6 +19,7 @@
***/
#include <stdio.h>
#include <string.h>
#include "time-util.h"

View file

@ -28,6 +28,7 @@
#include "in-addr-util.h"
#include "log.h"
#include "macro.h"
#include "process-util.h"
#include "socket-util.h"
#include "string-util.h"
#include "util.h"

View file

@ -29,6 +29,7 @@
#include "format-util.h"
#include "fs-util.h"
#include "log.h"
#include "process-util.h"
#include "string-util.h"
#include "util.h"

View file

@ -28,6 +28,7 @@
#include "fileio.h"
#include "fs-util.h"
#include "parse-util.h"
#include "process-util.h"
#include "raw-clone.h"
#include "rm-rf.h"
#include "string-util.h"

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <string.h>
#include <unistd.h>
#include "env-util.h"

View file

@ -417,8 +417,8 @@ static int wall_tty_block(void) {
if (asprintf(&p, "/run/systemd/ask-password-block/%u:%u", major(devnr), minor(devnr)) < 0)
return log_oom();
mkdir_parents_label(p, 0700);
mkfifo(p, 0600);
(void) mkdir_parents_label(p, 0700);
(void) mkfifo(p, 0600);
fd = open(p, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
if (fd < 0)

View file

@ -21,6 +21,7 @@
#include <string.h>
#include <unistd.h>
#include "process-util.h"
#include "time-util.h"
#include "udev-util.h"
#include "udev.h"

View file

@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/stat.h>

View file

@ -18,14 +18,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdio.h>
#include <sys/stat.h>
#include "crypt-util.h"
#include "log.h"
#include "hexdecoct.h"
#include "string-util.h"
#include "alloc-util.h"
#include "crypt-util.h"
#include "hexdecoct.h"
#include "log.h"
#include "string-util.h"
static char *arg_root_hash = NULL;
static char *arg_data_what = NULL;