basic: include only what we use

This is a cleaned up result of running iwyu but without forward
declarations on src/basic.
This commit is contained in:
Thomas Hindoe Paaboel Andersen 2015-11-30 21:43:37 +01:00
parent bca27e1729
commit 11c3a36649
128 changed files with 481 additions and 135 deletions

View File

@ -23,7 +23,7 @@
#include <sys/socket.h>
#include "af-list.h"
#include "util.h"
#include "macro.h"
static const struct af_name* lookup_af(register const char *str, register unsigned int len);

View File

@ -19,7 +19,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdint.h>
#include <string.h>
#include "alloc-util.h"
#include "macro.h"
#include "util.h"
void* memdup(const void *p, size_t l) {

View File

@ -22,6 +22,7 @@
***/
#include <alloca.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

View File

@ -23,7 +23,7 @@
#include <string.h>
#include "arphrd-list.h"
#include "util.h"
#include "macro.h"
static const struct arphrd_name* lookup_arphrd(register const char *str, register unsigned int len);

View File

@ -19,12 +19,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <pthread.h>
#include <stddef.h>
#include <unistd.h>
#include "async.h"
#include "fd-util.h"
#include "log.h"
#include "macro.h"
#include "util.h"
int asynchronous_job(void* (*func)(void *p), void *arg) {

View File

@ -20,7 +20,9 @@
***/
#include <errno.h>
#include <linux/netlink.h>
#include <stdio.h>
#include <sys/socket.h>
#include "alloc-util.h"
#include "audit-util.h"
@ -30,7 +32,6 @@
#include "parse-util.h"
#include "process-util.h"
#include "user-util.h"
#include "util.h"
int audit_session_from_pid(pid_t pid, uint32_t *id) {
_cleanup_free_ char *s = NULL;

View File

@ -32,7 +32,6 @@
#include "barrier.h"
#include "fd-util.h"
#include "macro.h"
#include "util.h"
/**
* Barriers

View File

@ -21,6 +21,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include "macro.h"

View File

@ -19,9 +19,16 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "alloc-util.h"
#include "bitmap.h"
#include "util.h"
#include "hashmap.h"
#include "macro.h"
struct Bitmap {
uint64_t *bitmaps;

View File

@ -21,6 +21,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include "hashmap.h"
#include "macro.h"

View File

@ -19,9 +19,20 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <linux/loop.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/vfs.h>
#include <sys/statfs.h>
#include <sys/sysmacros.h>
#include <unistd.h>
#ifdef HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h>
#endif
@ -37,6 +48,8 @@
#include "path-util.h"
#include "selinux-util.h"
#include "smack-util.h"
#include "sparse-endian.h"
#include "time-util.h"
#include "stat-util.h"
#include "string-util.h"
#include "util.h"

View File

@ -22,8 +22,11 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include "sd-id128.h"
#include "time-util.h"
typedef struct BtrfsSubvolInfo {

View File

@ -25,7 +25,6 @@
#include "bus-label.h"
#include "hexdecoct.h"
#include "macro.h"
#include "util.h"
char *bus_label_escape(const char *s) {
char *r, *t;

View File

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

View File

@ -19,13 +19,19 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <alloca.h>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "alloc-util.h"
#include "calendarspec.h"
#include "fileio.h"
#include "parse-util.h"
#include "macro.h"
#include "string-util.h"
#define BITS_WEEKDAYS 127

View File

@ -26,6 +26,7 @@
#include <stdbool.h>
#include "time-util.h"
#include "util.h"
typedef struct CalendarComponent {

View File

@ -19,11 +19,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <string.h>
#include "cap-list.h"
#include "missing.h"
#include "parse-util.h"
#include "macro.h"
#include "util.h"
static const struct capability_name* lookup_capability(register const char *str, register unsigned int len);

View File

@ -22,6 +22,7 @@
#include <errno.h>
#include <grp.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/capability.h>
#include <sys/prctl.h>
#include <unistd.h>

View File

@ -22,8 +22,11 @@
***/
#include <stdbool.h>
#include <stdint.h>
#include <sys/capability.h>
#include <sys/types.h>
#include "macro.h"
#include "util.h"
unsigned long cap_last_cap(void);

View File

@ -22,10 +22,13 @@
#include <dirent.h>
#include <errno.h>
#include <ftw.h>
#include <limits.h>
#include <signal.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/types.h>
#include <unistd.h>
@ -46,12 +49,14 @@
#include "process-util.h"
#include "set.h"
#include "special.h"
#include "def.h"
#include "log.h"
#include "missing.h"
#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "unit-name.h"
#include "user-util.h"
#include "util.h"
int cg_enumerate_processes(const char *controller, const char *path, FILE **_f) {
_cleanup_free_ char *fs = NULL;

View File

@ -22,11 +22,15 @@
***/
#include <dirent.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#include "def.h"
#include "set.h"
#include "hashmap.h"
#include "macro.h"
/* An enum of well known cgroup controllers */
typedef enum CGroupController {

View File

@ -19,13 +19,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <linux/fs.h>
#include "chattr-util.h"
#include "fd-util.h"
#include "util.h"
#include "macro.h"
int chattr_fd(int fd, unsigned value, unsigned mask) {
unsigned old_attr, new_attr;

View File

@ -21,6 +21,9 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdbool.h>
#include <time.h>
#include <linux/rtc.h>
#include <stdio.h>
#include <sys/ioctl.h>
@ -30,7 +33,6 @@
#include "fd-util.h"
#include "macro.h"
#include "string-util.h"
#include "util.h"
int clock_get_hwclock(struct tm *tm) {
_cleanup_close_ int fd = -1;

View File

@ -21,6 +21,7 @@
#include <dirent.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -19,8 +19,18 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/sendfile.h>
#include <sys/stat.h>
#include <sys/xattr.h>
#include <time.h>
#include <unistd.h>
#include "alloc-util.h"
#include "btrfs-util.h"
@ -31,10 +41,11 @@
#include "fileio.h"
#include "fs-util.h"
#include "io-util.h"
#include "macro.h"
#include "time-util.h"
#include "string-util.h"
#include "strv.h"
#include "umask-util.h"
#include "util.h"
#include "xattr-util.h"
#define COPY_BUFFER_SIZE (16*1024)

View File

@ -23,6 +23,7 @@
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
int copy_file_fd(const char *from, int to, bool try_reflink);

View File

@ -20,12 +20,17 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stddef.h>
#include <syslog.h>
#include "alloc-util.h"
#include "cpu-set-util.h"
#include "extract-word.h"
#include "parse-util.h"
#include "log.h"
#include "macro.h"
#include "string-util.h"
#include "util.h"
cpu_set_t* cpu_set_malloc(unsigned *ncpus) {
cpu_set_t *c;

View File

@ -19,7 +19,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "device-nodes.h"
#include "utf8.h"

View File

@ -21,6 +21,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stddef.h>
#include <sys/types.h>
int encode_devnode_name(const char *str, char *str_enc, size_t len);

View File

@ -21,10 +21,9 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "dirent-util.h"
#include "path-util.h"
#include "string-util.h"
int dirent_ensure_type(DIR *d, struct dirent *de) {

View File

@ -22,8 +22,11 @@
***/
#include <dirent.h>
#include <errno.h>
#include <stdbool.h>
#include "path-util.h"
#include "macro.h"
int dirent_ensure_type(DIR *d, struct dirent *de);

View File

@ -19,17 +19,21 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "alloc-util.h"
#include "def.h"
#include "env-util.h"
#include "parse-util.h"
#include "extract-word.h"
#include "macro.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
#include "util.h"
#define VALID_CHARS_ENV_NAME \
DIGITS LETTERS \

View File

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

View File

@ -22,7 +22,7 @@
#include <string.h>
#include "errno-list.h"
#include "util.h"
#include "macro.h"
static const struct errno_name* lookup_errno(register const char *str,
register unsigned int len);

View File

@ -19,12 +19,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "alloc-util.h"
#include "escape.h"
#include "hexdecoct.h"
#include "string-util.h"
#include "macro.h"
#include "utf8.h"
#include "util.h"
size_t cescape_char(char c, char *buf) {
char * buf_old = buf;

View File

@ -22,8 +22,12 @@
***/
#include <inttypes.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include "string-util.h"
/* What characters are special in the shell? */
/* must be escaped outside and inside double-quotes */
#define SHELL_NEED_ESCAPE "\"\\`$"

View File

@ -19,7 +19,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <net/ethernet.h>
#include <stdio.h>
#include <sys/types.h>
#include "ether-addr-util.h"
#include "macro.h"

View File

@ -24,6 +24,8 @@
#include <stdbool.h>
#include "set.h"
#include "hashmap.h"
#include "macro.h"
typedef enum ExitStatus {
/* EXIT_SUCCESS defined by libc */

View File

@ -19,12 +19,22 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include "alloc-util.h"
#include "escape.h"
#include "extract-word.h"
#include "log.h"
#include "macro.h"
#include "string-util.h"
#include "utf8.h"
#include "util.h"
int extract_first_word(const char **p, char **ret, const char *separators, ExtractFlags flags) {
_cleanup_free_ char *s = NULL;

View File

@ -19,10 +19,19 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "dirent-util.h"
#include <errno.h>
#include <fcntl.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <unistd.h>
#include "fd-util.h"
#include "parse-util.h"
#include "socket-util.h"
#include "macro.h"
#include "missing.h"
#include "path-util.h"
#include "util.h"
int close_nointr(int fd) {

View File

@ -19,19 +19,21 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <alloca.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include "sd-daemon.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "fdset.h"
#include "macro.h"
#include "parse-util.h"
#include "set.h"
#include "util.h"
#include "log.h"
#include "path-util.h"
#define MAKE_SET(s) ((Set*) s)
#define MAKE_FDSET(s) ((FDSet*) s)

View File

@ -21,7 +21,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include "set.h"
#include "hashmap.h"
#include "macro.h"
typedef struct FDSet FDSet;

View File

@ -20,9 +20,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <sys/stat.h>
#include "fileio-label.h"
#include "selinux-util.h"
#include "util.h"
#include "fileio.h"
int write_string_file_atomic_label(const char *fn, const char *line) {
int r;

View File

@ -19,6 +19,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
@ -31,12 +40,14 @@
#include "parse-util.h"
#include "path-util.h"
#include "random-util.h"
#include "log.h"
#include "macro.h"
#include "time-util.h"
#include "stdio-util.h"
#include "string-util.h"
#include "strv.h"
#include "umask-util.h"
#include "utf8.h"
#include "util.h"
int write_string_stream(FILE *f, const char *line, bool enforce_newline) {

View File

@ -19,6 +19,16 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <dirent.h>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "alloc-util.h"
#include "dirent-util.h"
#include "fd-util.h"
@ -27,6 +37,10 @@
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "log.h"
#include "macro.h"
#include "missing.h"
#include "time-util.h"
#include "string-util.h"
#include "strv.h"
#include "user-util.h"

View File

@ -23,6 +23,8 @@
#include <fcntl.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/inotify.h>
#include <sys/types.h>
#include <unistd.h>

View File

@ -19,12 +19,12 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <glob.h>
#include "glob-util.h"
#include "string-util.h"
#include "macro.h"
#include "strv.h"
#include "util.h"
int glob_exists(const char *path) {
_cleanup_globfree_ glob_t g = {};

View File

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

View File

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

View File

@ -21,8 +21,9 @@
***/
#include <errno.h>
#include <pthread.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "alloc-util.h"
#include "hashmap.h"

View File

@ -22,7 +22,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include "macro.h"
#include "siphash24.h"

View File

@ -20,11 +20,13 @@
***/
#include <ctype.h>
#include <inttypes.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "hexdecoct.h"
#include "util.h"
#include "macro.h"
char octchar(int x) {
return '0' + (x & 7);

View File

@ -22,6 +22,7 @@
***/
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <sys/types.h>

View File

@ -19,14 +19,19 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <ctype.h>
#include <bits/local_lim.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>
#include <unistd.h>
#include "fd-util.h"
#include "fileio.h"
#include "hostname-util.h"
#include "macro.h"
#include "string-util.h"
#include "util.h"
bool hostname_is_set(void) {
struct utsname u;

View File

@ -20,9 +20,15 @@
***/
#include <arpa/inet.h>
#include <endian.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "in-addr-util.h"
#include "macro.h"
#include "util.h"
int in_addr_is_null(int family, const union in_addr_union *u) {
assert(u);

View File

@ -22,6 +22,8 @@
***/
#include <netinet/in.h>
#include <stddef.h>
#include <sys/socket.h>
#include "macro.h"
#include "util.h"

View File

@ -19,10 +19,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <limits.h>
#include <poll.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include "io-util.h"
#include "time-util.h"
int flush_fd(int fd) {
struct pollfd pollfd = {

View File

@ -22,9 +22,12 @@
***/
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/uio.h>
#include "macro.h"
#include "time-util.h"
int flush_fd(int fd);

View File

@ -19,7 +19,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "alloc-util.h"

View File

@ -22,7 +22,10 @@
***/
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "macro.h"
#include "util.h"
enum {

View File

@ -19,10 +19,14 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
#include "label.h"
#include "selinux-util.h"
#include "smack-util.h"
#include "util.h"
#include "macro.h"
int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
int r, q;

View File

@ -19,20 +19,29 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <langinfo.h>
#include <libintl.h>
#include <locale.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include "dirent-util.h"
#include "fd-util.h"
#include "locale-util.h"
#include "path-util.h"
#include "set.h"
#include "hashmap.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
#include "util.h"
static int add_locales_from_archive(Set *locales) {
/* Stolen from glibc... */

View File

@ -20,20 +20,18 @@
***/
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
#include <sys/stat.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "lockfile-util.h"
#include "path-util.h"
#include "util.h"
#include "macro.h"
int make_lock_file(const char *p, int operation, LockFile *ret) {
_cleanup_close_ int fd = -1;

View File

@ -21,6 +21,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stddef.h>
#include "macro.h"
#include "missing.h"

View File

@ -21,12 +21,18 @@
#include <errno.h>
#include <fcntl.h>
#include <printf.h>
#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <sys/signalfd.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <time.h>
#include <unistd.h>
#include "sd-messages.h"
@ -43,6 +49,7 @@
#include "process-util.h"
#include "signal-util.h"
#include "socket-util.h"
#include "time-util.h"
#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"

View File

@ -19,7 +19,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "def.h"
#include <string.h>
#include "login-util.h"
#include "string-util.h"

View File

@ -19,7 +19,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#ifdef HAVE_LINUX_MEMFD_H
#include <linux/memfd.h>
#endif
@ -31,9 +34,9 @@
#include "fd-util.h"
#include "memfd-util.h"
#include "missing.h"
#include "macro.h"
#include "string-util.h"
#include "utf8.h"
#include "util.h"
int memfd_new(const char *name) {
_cleanup_free_ char *g = NULL;

View File

@ -22,6 +22,8 @@
***/
#include <inttypes.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
int memfd_new(const char *name);

View File

@ -20,6 +20,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdint.h>
#include <stdlib.h>
#include "macro.h"
#include "mempool.h"
#include "util.h"

View File

@ -21,6 +21,7 @@
***/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include "label.h"

View File

@ -20,14 +20,16 @@
***/
#include <errno.h>
#include <stdbool.h>
#include <string.h>
#include <sys/stat.h>
#include "fs-util.h"
#include "mkdir.h"
#include "path-util.h"
#include "macro.h"
#include "stat-util.h"
#include "user-util.h"
#include "util.h"
int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkdir_func_t _mkdir) {
struct stat st;

View File

@ -19,9 +19,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <unistd.h>
#include "alloc-util.h"
#include "escape.h"
@ -31,9 +35,9 @@
#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "hashmap.h"
#include "stdio-util.h"
#include "string-util.h"
#include "util.h"
static int fd_fdinfo_mnt_id(int fd, const char *filename, int flags, int *mnt_id) {
char path[strlen("/proc/self/fdinfo/") + DECIMAL_STR_MAX(int)];

View File

@ -24,10 +24,12 @@
#include <fcntl.h>
#include <mntent.h>
#include <stdbool.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "missing.h"
#include "macro.h"
int fd_is_mount_point(int fd, const char *filename, int flags);
int path_is_mount_point(const char *path, int flags);

View File

@ -19,11 +19,19 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <inttypes.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <xlocale.h>
#include "alloc-util.h"
#include "extract-word.h"
#include "parse-util.h"
#include "macro.h"
#include "string-util.h"
#include "util.h"
int parse_boolean(const char *v) {
assert(v);

View File

@ -22,6 +22,9 @@
***/
#include <inttypes.h>
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include "macro.h"

View File

@ -20,11 +20,11 @@
***/
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/statvfs.h>
#include <sys/stat.h>
#include <unistd.h>
/* When we include libgen.h because we need dirname() we immediately
@ -34,18 +34,16 @@
#undef basename
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "log.h"
#include "macro.h"
#include "missing.h"
#include "parse-util.h"
#include "path-util.h"
#include "extract-word.h"
#include "time-util.h"
#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
bool path_is_absolute(const char *p) {
return p[0] == '/';

View File

@ -21,7 +21,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <alloca.h>
#include <stdbool.h>
#include <stddef.h>
#include "macro.h"
#include "time-util.h"

View File

@ -29,9 +29,12 @@
* The underlying algorithm used in this implementation is a Heap.
*/
#include <errno.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "prioq.h"
#include "util.h"
#include "hashmap.h"
struct prioq_item {
void *data;

View File

@ -21,7 +21,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include "hashmap.h"
#include "macro.h"
typedef struct Prioq Prioq;

View File

@ -19,6 +19,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include "alloc-util.h"
#include "extract-word.h"
#include "fileio.h"

View File

@ -17,18 +17,21 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <linux/oom.h>
#include <sched.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/personality.h>
#include <sys/prctl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <syslog.h>
#include <unistd.h>
#include "alloc-util.h"
@ -40,6 +43,8 @@
#include "log.h"
#include "process-util.h"
#include "signal-util.h"
#include "macro.h"
#include "missing.h"
#include "string-table.h"
#include "string-util.h"
#include "user-util.h"

View File

@ -22,6 +22,7 @@
#include <alloca.h>
#include <signal.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>

View File

@ -17,23 +17,24 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <elf.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/time.h>
#include <linux/random.h>
#include <stdint.h>
#ifdef HAVE_SYS_AUXV_H
#include <sys/auxv.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include "fd-util.h"
#include "io-util.h"
#include "missing.h"
#include "random-util.h"
#include "time-util.h"
#include "util.h"
int dev_urandom(void *p, size_t n) {
static int have_syscall = -1;

View File

@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stddef.h>
#include <stdint.h>
int dev_urandom(void *p, size_t n);

View File

@ -20,7 +20,10 @@
***/
#include <sys/time.h>
#include "ratelimit.h"
#include "macro.h"
/* Modelled after Linux' lib/ratelimit.c by Dave Young
* <hidave.darkstar@gmail.com>, which is licensed GPLv2. */

View File

@ -21,6 +21,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include "time-util.h"
#include "util.h"
typedef struct RateLimit {

View File

@ -19,13 +19,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "alloc-util.h"
#include "macro.h"
#include "replace-var.h"
#include "string-util.h"
#include "util.h"
/*
* Generic infrastructure for replacing @FOO@ style variables in

View File

@ -19,10 +19,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <sys/resource.h>
#include "missing.h"
#include "rlimit-util.h"
#include "macro.h"
#include "string-table.h"
#include "util.h"
int setrlimit_closest(int resource, const struct rlimit *rlim) {
struct rlimit highest, fixed;

View File

@ -19,14 +19,24 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stddef.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <unistd.h>
#include "btrfs-util.h"
#include "fd-util.h"
#include "mount-util.h"
#include "path-util.h"
#include "rm-rf.h"
#include "log.h"
#include "macro.h"
#include "stat-util.h"
#include "string-util.h"
#include "util.h"
int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) {
_cleanup_closedir_ DIR *d = NULL;

View File

@ -21,7 +21,12 @@
#include <errno.h>
#include <malloc.h>
#include <stddef.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/un.h>
#include <syslog.h>
#ifdef HAVE_SELINUX
#include <selinux/context.h>
@ -32,7 +37,10 @@
#include "alloc-util.h"
#include "path-util.h"
#include "selinux-util.h"
#include "strv.h"
#include "log.h"
#include "macro.h"
#include "time-util.h"
#include "util.h"
#ifdef HAVE_SELINUX
DEFINE_TRIVIAL_CLEANUP_FUNC(security_context_t, freecon);

View File

@ -23,6 +23,7 @@
#include <stdbool.h>
#include <sys/socket.h>
#include <sys/types.h>
#include "macro.h"

View File

@ -19,7 +19,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <signal.h>
#include <stddef.h>
#include <sys/mman.h>
#include "macro.h"

View File

@ -19,11 +19,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include "parse-util.h"
#include "signal-util.h"
#include "macro.h"
#include "string-table.h"
#include "string-util.h"
#include "util.h"
int reset_all_signal_handlers(void) {
static const struct sigaction sa = {

View File

@ -18,9 +18,8 @@
*/
#include "siphash24.h"
#include "sparse-endian.h"
#include "macro.h"
#include "unaligned.h"
#include "util.h"
static inline uint64_t rotate_left(uint64_t x, uint8_t b) {
assert(b < 64);

View File

@ -1,6 +1,8 @@
#pragma once
#include <inttypes.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
struct siphash {

View File

@ -21,15 +21,20 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/xattr.h>
#include <unistd.h>
#include "alloc-util.h"
#include "fileio.h"
#include "path-util.h"
#include "process-util.h"
#include "smack-util.h"
#include "log.h"
#include "macro.h"
#include "string-table.h"
#include "util.h"
#include "xattr-util.h"
#ifdef HAVE_SMACK

View File

@ -24,6 +24,7 @@
***/
#include <stdbool.h>
#include <sys/types.h>
#include "macro.h"

View File

@ -20,9 +20,13 @@
***/
#include <errno.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <unistd.h>
#include "alloc-util.h"
@ -32,7 +36,7 @@
#include "mkdir.h"
#include "selinux-util.h"
#include "socket-util.h"
#include "util.h"
#include "log.h"
int socket_address_listen(
const SocketAddress *a,

View File

@ -21,13 +21,15 @@
#include <arpa/inet.h>
#include <errno.h>
#include <limits.h>
#include <net/if.h>
#include <netdb.h>
#include <netinet/ip.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
@ -39,6 +41,7 @@
#include "parse-util.h"
#include "path-util.h"
#include "socket-util.h"
#include "log.h"
#include "string-table.h"
#include "string-util.h"
#include "user-util.h"

View File

@ -23,7 +23,10 @@
#include <netinet/ether.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stddef.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <linux/netlink.h>
#include <linux/if_packet.h>

Some files were not shown because too many files have changed in this diff Show More