repo
stringlengths
1
152
file
stringlengths
14
221
code
stringlengths
501
25k
file_length
int64
501
25k
avg_line_length
float64
20
99.5
max_line_length
int64
21
134
extension_type
stringclasses
2 values
null
systemd-main/src/basic/extract-word.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <stdarg.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdlib.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...
11,832
38.182119
129
c
null
systemd-main/src/basic/fd-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <dirent.h> #include <fcntl.h> #include <stdbool.h> #include <stdio.h> #include <sys/socket.h> #include "macro.h" #include "stdio-util.h" /* maximum length of fdname */ #define FDNAME_MAX 255 /* Make sure we can distinguish fd 0 and NULL */ #defi...
3,941
28.2
107
h
null
systemd-main/src/basic/filesystems.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "filesystems-gperf.h" #include "stat-util.h" const char *fs_type_to_string(statfs_f_type_t magic) { switch (magic) { #include "filesystem-switch-case.h" } return NULL; } int fs_type_from_string(const char *name, const statfs_f_type_...
5,060
27.755682
75
c
null
systemd-main/src/basic/filesystems.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include "nulstr-util.h" #include "stat-util.h" #include "string-util.h" #define FILESYSTEM_MAGIC_MAX 10 typedef enum FilesystemGroups { /* Please leave BASIC_API first and KNOWN last, but sort the rest alphabetically */ FILESYSTEM_SET_BAS...
1,331
29.976744
95
h
null
systemd-main/src/basic/format-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "format-util.h" #include "memory-util.h" #include "stdio-util.h" #include "strxcpyx.h" assert_cc(STRLEN("%") + DECIMAL_STR_MAX(int) <= IF_NAMESIZE); int format_ifname_full(int ifindex, FormatIfnameFlag flag, char buf[static IF_NAMESIZE]) { if (ifindex ...
3,839
36.647059
126
c
null
systemd-main/src/basic/format-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <net/if.h> #include <stdbool.h> #include "cgroup-util.h" #include "macro.h" assert_cc(sizeof(pid_t) == sizeof(int32_t)); #define PID_PRI PRIi32 #define PID_FMT "%" PID_PRI assert_cc(sizeof(uid_t) == sizeof(uint32_t)); #defi...
3,121
28.45283
119
h
null
systemd-main/src/basic/fs-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <dirent.h> #include <fcntl.h> #include <limits.h> #include <stdbool.h> #include <stdint.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include "alloc-util.h" #include "errno-util.h" #include "lock-util.h" #include "time-util....
4,903
33.535211
134
h
null
systemd-main/src/basic/gcrypt-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #if HAVE_GCRYPT #include "gcrypt-util.h" #include "hexdecoct.h" void initialize_libgcrypt(bool secmem) { if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) return; gcry_control(GCRYCTL_SET_PREFERRED_RNG_TYPE, GCRY_RNG_TYPE_SYSTEM); ...
1,418
24.8
77
c
null
systemd-main/src/basic/gcrypt-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <errno.h> #include <stdbool.h> #include <stddef.h> #if HAVE_GCRYPT #include <gcrypt.h> #include "macro.h" void initialize_libgcrypt(bool secmem); DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gcry_md_hd_t, gcry_md_close, NULL); #endif #if !PREFER_OPENSSL ...
845
20.15
80
h
null
systemd-main/src/basic/getopt-defs.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <getopt.h> #define SYSTEMD_GETOPT_SHORT_OPTIONS "hDbsz:" #define COMMON_GETOPT_ARGS \ ARG_LOG_LEVEL = 0x100, \ ARG_LOG_TARGET, \ ARG_LOG_COLOR, ...
4,609
59.657895
96
h
null
systemd-main/src/basic/glob-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include "dirent-util.h" #include "errno-util.h" #include "glob-util.h" #include "macro.h" #include "path-util.h" #include "strv.h" static void closedir_wrapper(void* v) { (voi...
2,712
25.086538
81
c
null
systemd-main/src/basic/glob-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <glob.h> #include <stdbool.h> #include "macro.h" #include "string-util.h" /* Note: this function modifies pglob to set various functions. */ int safe_glob(const char *path, int flags, glob_t *pglob); /* Note: which match is returned depends on t...
808
30.115385
104
h
null
systemd-main/src/basic/glyph-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <errno.h> #include <stdbool.h> #include "macro.h" typedef enum SpecialGlyph { SPECIAL_GLYPH_TREE_VERTICAL, SPECIAL_GLYPH_TREE_BRANCH, SPECIAL_GLYPH_TREE_RIGHT, SPECIAL_GLYPH_TREE_SPACE, SPECIAL_GLYPH_TREE_T...
2,165
30.852941
101
h
null
systemd-main/src/basic/gunicode.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* gunicode.c - Unicode manipulation functions * * Copyright (C) 1999, 2000 Tom Tromey * Copyright © 2000, 2005 Red Hat, Inc. */ #include "gunicode.h" #define unichar uint32_t /** * g_utf8_prev_char: * @p: a pointer to a position within a UTF-8 encoded string ...
3,333
28.767857
96
c
null
systemd-main/src/basic/gunicode.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* gunicode.h - Unicode manipulation functions * * Copyright (C) 1999, 2000 Tom Tromey * Copyright © 2000, 2005 Red Hat, Inc. */ #pragma once #include <stdbool.h> #include <stdint.h> #include <stdlib.h> char *utf8_prev_char (const char *p); extern const char utf...
930
29.032258
85
h
null
systemd-main/src/basic/hash-funcs.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <string.h> #include "hash-funcs.h" #include "path-util.h" #include "strv.h" void string_hash_func(const char *p, struct siphash *state) { siphash24_compress(p, strlen(p) + 1, state); } DEFINE_HASH_OPS(string_hash_ops, char, string_hash_func, string_c...
3,912
31.07377
119
c
null
systemd-main/src/basic/hash-funcs.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include "alloc-util.h" #include "macro.h" #include "siphash24.h" typedef void (*hash_func_t)(const void *p, struct siphash *state); typedef int (*compare_func_t)(const void *a, const void *b); struct hash_ops { hash_func_t hash; compare_f...
6,033
52.875
124
h
null
systemd-main/src/basic/hexdecoct.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include <stddef.h> #include <stdio.h> #include <sys/types.h> #include "macro.h" char octchar(int x) _const_; int unoctchar(char c) _const_; char decchar(int x) _const_; int undecchar(char c) _const_; char hexchar(int x) _const_; in...
1,612
28.87037
84
h
null
systemd-main/src/basic/hmac.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <assert.h> #include <string.h> #include "hmac.h" #include "sha256.h" #define HMAC_BLOCK_SIZE 64 #define INNER_PADDING_BYTE 0x36 #define OUTER_PADDING_BYTE 0x5c void hmac_sha256(const void *key, size_t key_size, const void *i...
2,148
34.229508
89
c
null
systemd-main/src/basic/hostname-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <sys/utsname.h> #include <unistd.h> #include "alloc-util.h" #include "env-file.h" #include "hostname-util.h" #include "os-util.h" #include "string-util.h" #include "strv.h" char* ge...
6,617
30.514286
109
c
null
systemd-main/src/basic/hostname-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include <stdio.h> #include "macro.h" #include "strv.h" typedef enum GetHostnameFlags { GET_HOSTNAME_ALLOW_LOCALHOST = 1 << 0, /* accepts "localhost" or friends. */ GET_HOSTNAME_FALLBACK_DEFAULT = 1 << 1, /* use defau...
2,324
31.291667
120
h
null
systemd-main/src/basic/initrd-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <unistd.h> #include "env-util.h" #include "errno-util.h" #include "initrd-util.h" #include "parse-util.h" #include "stat-util.h" #include "string-util.h" static int saved_in_initrd = -1; bool in_initrd(void) { int r; if (saved_in_initrd >= 0...
1,147
25.697674
118
c
null
systemd-main/src/basic/inotify-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "fd-util.h" #include "inotify-util.h" #include "stat-util.h" int inotify_add_watch_fd(int fd, int what, uint32_t mask) { int wd, r; /* This is like inotify_add_watch(), except that the file to watch is not referenced by a path, but by an fd */...
1,342
30.97619
125
c
null
systemd-main/src/basic/inotify-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <limits.h> #include <stddef.h> #include <sys/inotify.h> #include "log.h" #define INOTIFY_EVENT_MAX (offsetof(struct inotify_event, name) + NAME_MAX + 1) #define _FOREACH_INOTIFY_EVENT(e, buffer, sz, log_level, start, end) ...
1,683
42.179487
100
h
null
systemd-main/src/basic/io-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <limits.h> #include <stdio.h> #include <unistd.h> #include "io-util.h" #include "string-util.h" #include "time-util.h" int flush_fd(int fd) { int count = 0; /* Read from the specified file descriptor, until POLLIN is not se...
11,080
27.707254
119
c
null
systemd-main/src/basic/io-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <poll.h> #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); ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll); ...
3,782
32.477876
116
h
null
systemd-main/src/basic/ioprio-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "ioprio-util.h" #include "parse-util.h" #include "string-table.h" int ioprio_parse_priority(const char *s, int *ret) { int i, r; assert(s); assert(ret); r = safe_atoi(s, &i); if (r < 0) return r; ...
721
21.5625
78
c
null
systemd-main/src/basic/ioprio-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include "macro.h" #include "missing_ioprio.h" int ioprio_class_to_string_alloc(int i, char **s); int ioprio_class_from_string(const char *s); static inline bool ioprio_class_is_valid(int i) { return IN_SET(i, IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, I...
925
32.071429
109
h
null
systemd-main/src/basic/label.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <stddef.h> #include "label.h" static const LabelOps *label_ops = NULL; int label_ops_set(const LabelOps *ops) { if (label_ops) return -EBUSY; label_ops = ops; return 0; } int label_ops_pre(int dir_...
651
20.032258
62
c
null
systemd-main/src/basic/limits-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <unistd.h> #include "alloc-util.h" #include "cgroup-util.h" #include "limits-util.h" #include "memory-util.h" #include "parse-util.h" #include "process-util.h" #include "procfs-util.h" #include "string-util.h" uint64_t physical_memory(void) { _cleanup...
6,693
34.231579
134
c
null
systemd-main/src/basic/list.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once /* The head of the linked list. Use this in the structure that shall * contain the head of the linked list */ #define LIST_HEAD(t,name) \ t *name /* The pointers in the linked list's items. Use this in...
11,896
59.085859
107
h
null
systemd-main/src/basic/locale-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <fcntl.h> #include <langinfo.h> #include <libintl.h> #include <stddef.h> #include <stdint.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/stat.h> #include "constants.h" #include "dirent-util.h" #include "env-util.h" #include "fd-u...
10,988
27.994723
109
c
null
systemd-main/src/basic/locale-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <libintl.h> #include <locale.h> #include <stdbool.h> #include "macro.h" typedef enum LocaleVariable { /* We don't list LC_ALL here on purpose. People should be * using LANG instead. */ VARIABLE_LANG, VARIABLE_LAN...
1,477
24.929825
72
h
null
systemd-main/src/basic/lock-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <sys/file.h> #include <sys/stat.h> #include "alloc-util.h" #include "fd-util.h" #include "fs-util.h" #include "lock-util.h" #include "macro.h" #include "missing_fcntl.h" #include "pat...
4,965
25.275132
99
c
null
systemd-main/src/basic/lock-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <fcntl.h> typedef struct LockFile { int dir_fd; char *path; int fd; int operation; } LockFile; int make_lock_file_at(int dir_fd, const char *p, int operation, LockFile *ret); static inline int make_lock_file(const ...
1,463
32.272727
105
h
null
systemd-main/src/basic/login-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include <unistd.h> #define SD_LOGIND_ROOT_CHECK_INHIBITORS (UINT64_C(1) << 0) #define SD_LOGIND_REBOOT_VIA_KEXEC (UINT64_C(1) << 1) #define SD_LOGIND_SOFT_REBOOT (UINT64_C(1) << 2) /* For ...
803
35.545455
132
h
null
systemd-main/src/basic/macro.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <assert.h> #include <errno.h> #include <inttypes.h> #include <stdbool.h> #include <sys/param.h> #include <sys/sysmacros.h> #include <sys/types.h> #include "constants.h" #include "macro-fundamental.h" /* Note: on GCC "no_sanitize_address" is a fun...
20,986
45.950783
130
h
null
systemd-main/src/basic/mallinfo-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <malloc.h> #if HAVE_MALLINFO2 # define HAVE_GENERIC_MALLINFO 1 typedef struct mallinfo2 generic_mallinfo; static inline generic_mallinfo generic_mallinfo_get(void) { return mallinfo2(); } #elif HAVE_MALLINFO # define HAVE_GENERIC_MALLINF...
690
26.64
105
h
null
systemd-main/src/basic/math-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <math.h> #include "macro.h" /* On some optimization level, iszero(x) is converted to (x == 0.0), and emits warning -Wfloat-equal. * The argument must be a floating point, i.e. one of float, double, or long double. */ #define iszero_safe(x) (fpcl...
568
36.933333
109
h
null
systemd-main/src/basic/memfd-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <sys/stat.h> #include <unistd.h> #if HAVE_LINUX_MEMFD_H #include <linux/memfd.h> #endif #include <stdio.h> #include <sys/prctl.h> #include "alloc-util.h" #include "errno-util.h" #include "fd-util.h" #include "macro.h" #include "memfd-util.h"...
4,563
23.021053
119
c
null
systemd-main/src/basic/memfd-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <stddef.h> #include <stdint.h> #include <sys/types.h> int memfd_create_wrapper(const char *name, unsigned mode); int memfd_new(const char *name); int memfd_new_and_map(const char *name, size_t sz, void **p); int memfd_new_an...
584
25.590909
70
h
null
systemd-main/src/basic/memory-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <unistd.h> #include "memory-util.h" #include "missing_threads.h" size_t page_size(void) { static thread_local size_t pgsz = 0; long r; if (_likely_(pgsz > 0)) return pgsz; r = sysconf(_SC_PAGESIZE); as...
1,137
26.095238
79
c
null
systemd-main/src/basic/memory-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <malloc.h> #include <stdbool.h> #include <string.h> #include <sys/types.h> #include "alloc-util.h" #include "macro.h" #include "memory-util-fundamental.h" size_t page_size(void) _pure_; #define PAGE_ALIGN(l) ALIGN_TO((l), pa...
4,560
29.817568
114
h
null
systemd-main/src/basic/mempool.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <stdint.h> #include <stdlib.h> #include "format-util.h" #include "macro.h" #include "memory-util.h" #include "mempool.h" struct pool { struct pool *next; size_t n_tiles; size_t n_used; }; static void* pool_ptr(struct pool *p) { ...
4,285
23.352273
110
c
null
systemd-main/src/basic/mempool.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include <stddef.h> struct pool; struct mempool { struct pool *first_pool; void *freelist; size_t tile_size; size_t at_least; }; void* mempool_alloc_tile(struct mempool *mp); void* mempool_alloc0_tile(...
670
22.137931
62
h
null
systemd-main/src/basic/memstream-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "fd-util.h" #include "fileio.h" #include "log.h" #include "memstream-util.h" void memstream_done(MemStream *m) { assert(m); /* First, close file stream, as the buffer may be reallocated on close. */ safe_fclose(...
1,806
22.776316
85
c
null
systemd-main/src/basic/memstream-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdio.h> #include "macro.h" typedef struct MemStream { FILE *f; char *buf; size_t sz; } MemStream; void memstream_done(MemStream *m); FILE* memstream_init(MemStream *m); int memstream_finalize(MemStream *m, char **ret_bu...
747
25.714286
78
h
null
systemd-main/src/basic/missing_capability.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <linux/capability.h> /* 3a101b8de0d39403b2c7e5c23fd0b005668acf48 (3.16) */ #ifndef CAP_AUDIT_READ # define CAP_AUDIT_READ 37 #endif /* 980737282232b752bb14dab96d77665c15889c36 (5.8) */ #ifndef CAP_PERFMON # define CAP_PERFMON 38 #endif /* a17b...
898
21.475
58
h
null
systemd-main/src/basic/missing_fcntl.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <fcntl.h> #ifndef F_LINUX_SPECIFIC_BASE #define F_LINUX_SPECIFIC_BASE 1024 #endif #ifndef F_SETPIPE_SZ #define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7) #endif #ifndef F_GETPIPE_SZ #define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) #endif #ifndef ...
2,223
27.512821
108
h
null
systemd-main/src/basic/missing_input.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <linux/input.h> #include <linux/types.h> /* linux@c7dc65737c9a607d3e6f8478659876074ad129b8 (3.12) */ #ifndef EVIOCREVOKE #define EVIOCREVOKE _IOW('E', 0x91, int) #endif /* linux@06a16293f71927f756dcf37558a79c0b05a91641 (4.4) */ #ifndef EVIOCSMASK...
1,135
23.695652
59
h
null
systemd-main/src/basic/missing_keyctl.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <linux/keyctl.h> #ifndef KEYCTL_JOIN_SESSION_KEYRING #define KEYCTL_JOIN_SESSION_KEYRING 1 #endif #ifndef KEYCTL_CHOWN #define KEYCTL_CHOWN 4 #endif #ifndef KEYCTL_SETPERM #define KEYCTL_SETPERM 5 #endif #ifndef KEYCTL_DES...
1,740
20.7625
48
h
null
systemd-main/src/basic/missing_loop.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <linux/loop.h> #ifndef LOOP_CONFIGURE struct loop_config { __u32 fd; __u32 block_size; struct loop_info64 info; __u64 __reserved[8]; }; #define LOOP_CONFIGURE 0x4C0A #endif #ifndef LO_FLAGS_DIRECT_IO #define LO_FL...
526
20.08
100
h
null
systemd-main/src/basic/missing_magic.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <linux/magic.h> /* 62aa81d7c4c24b90fdb61da70ac0dbbc414f9939 (4.13) */ #ifndef OCFS2_SUPER_MAGIC #define OCFS2_SUPER_MAGIC 0x7461636f #endif /* 67e9c74b8a873408c27ac9a8e4c1d1c8d72c93ff (4.5) */ #ifndef CGROUP2_SUPER_MAGIC #define CGROUP2_SUPER_MAG...
4,714
23.179487
100
h
null
systemd-main/src/basic/missing_network.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once /* linux/in6.h or netinet/in.h */ #ifndef IPV6_UNICAST_IF #define IPV6_UNICAST_IF 76 #endif /* linux/in6.h or netinet/in.h */ #ifndef IPV6_TRANSPARENT #define IPV6_TRANSPARENT 75 #endif /* Not exposed but defined at include/net/ip.h */ #ifndef IPV4_MIN_MT...
2,253
25.833333
70
h
null
systemd-main/src/basic/missing_prctl.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <linux/prctl.h> /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ #ifndef PR_CAP_AMBIENT #define PR_CAP_AMBIENT 47 #define PR_CAP_AMBIENT_IS_SET 1 #define PR_CAP_AMBIENT_RAISE 2 #define PR_CAP_AMBIENT_LOWER 3 #define PR_CAP_AMBIENT_...
585
20.703704
52
h
null
systemd-main/src/basic/missing_sched.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <sched.h> #ifndef CLONE_NEWCGROUP #define CLONE_NEWCGROUP 0x02000000 #endif /* 769071ac9f20b6a447410c7eaa55d1a5233ef40c (5.8) */ #ifndef CLONE_NEWTIME #define CLONE_NEWTIME 0x00000080 #endif /* Not exposed yet. Defined at include/linux/sched.h *...
748
26.740741
116
h
null
systemd-main/src/basic/missing_securebits.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <linux/securebits.h> /* 746bf6d64275be0c65b0631d8a72b16f1454cfa1 (4.3) */ #ifndef SECURE_NO_CAP_AMBIENT_RAISE #define SECURE_NO_CAP_AMBIENT_RAISE 6 #define SECURE_NO_CAP_AMBIENT_RAISE_LOCKED 7 /* make bit-6 immutable */ #define SECBIT_NO_C...
807
41.526316
94
h
null
systemd-main/src/basic/missing_stat.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <linux/types.h> #include <sys/stat.h> #if WANT_LINUX_STAT_H #include <linux/stat.h> #endif /* Thew newest definition we are aware of (fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60; 5.8) */ #define STATX_DEFINITION { \ __u3...
3,798
26.933824
107
h
null
systemd-main/src/basic/missing_xfs.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once /* This is currently not exported in the public kernel headers, but the libxfs library code part of xfsprogs * defines it as public header */ #ifndef XFS_IOC_FSGEOMETRY #define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom) typedef struct xfs_f...
1,148
25.72093
108
h
null
systemd-main/src/basic/mountpoint-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <fcntl.h> #include <stdbool.h> #include <sys/types.h> /* The limit used for /dev itself. 4MB should be enough since device nodes and symlinks don't * consume any space and udev isn't supposed to create regular file either. There's no limit on the...
3,227
45.114286
131
h
null
systemd-main/src/basic/namespace-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mount.h> #include "errno-util.h" #include "fd-util.h" #include "fileio.h" #include "missing_fs.h" #include "missing_magic.h" #include "missing_sched.h" #include "namespace-util.h" #include "process-util.h" #includ...
9,903
35.681481
130
c
null
systemd-main/src/basic/namespace-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <sys/types.h> typedef enum NamespaceType { NAMESPACE_CGROUP, NAMESPACE_IPC, NAMESPACE_NET, NAMESPACE_MOUNT, NAMESPACE_PID, NAMESPACE_USER, NAMESPACE_UTS, NAMESPACE_TIME, _NAME...
1,420
28
106
h
null
systemd-main/src/basic/nss-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <grp.h> #include <netdb.h> #include <nss.h> #include <pwd.h> #include <resolv.h> #define NSS_SIGNALS_BLOCK SIGALRM,SIGVTALRM,SIGPIPE,SIGCHLD,SIGTSTP,SIGIO,SIGHUP,SIGUSR1,SIGUSR2,SIGPROF,SIGURG,SIGWINCH #ifndef DEPRECATED_RES_USE_INET6 # define D...
12,876
45.99635
120
h
null
systemd-main/src/basic/nulstr-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "nulstr-util.h" #include "string-util.h" #include "strv.h" char** strv_parse_nulstr_full(const char *s, size_t l, bool drop_trailing_nuls) { /* l is the length of the input data, which will be split at NULs into elements of the resulting * str...
4,759
31.60274
123
c
null
systemd-main/src/basic/ordered-set.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "fileio.h" #include "ordered-set.h" #include "strv.h" int _ordered_set_ensure_allocated(OrderedSet **s, const struct hash_ops *ops HASHMAP_DEBUG_PARAMS) { if (*s) return 0; *s = _ordered_set_new(ops HASHMAP_DEBUG_PASS_ARGS); ...
2,350
21.605769
104
c
null
systemd-main/src/basic/ordered-set.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdio.h> #include "hashmap.h" typedef struct OrderedSet OrderedSet; static inline OrderedSet* _ordered_set_new(const struct hash_ops *ops HASHMAP_DEBUG_PARAMS) { return (OrderedSet*) _ordered_hashmap_new(ops HASHMAP_DEBUG_PASS_ARGS); ...
4,419
39.181818
114
h
null
systemd-main/src/basic/origin-id.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <pthread.h> #include "random-util.h" /* This pattern needs to be repeated exactly in multiple modules, so macro it. * To ensure an object is not passed into a different module (e.g.: when two shared objects statically * linked to libsystemd get...
2,037
54.081081
102
h
null
systemd-main/src/basic/parse-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <inttypes.h> #include <net/if.h> #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include "alloc-util.h" #include "errno-list.h" #include "extract-word.h" #include "locale-util.h" #include "macro.h" #include "missing_network.h...
19,514
25.02
131
c
null
systemd-main/src/basic/parse-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <limits.h> #include <stddef.h> #include <stdint.h> #include <sys/types.h> #include "macro.h" typedef unsigned long loadavg_t; int parse_boolean(const char *v) _pure_; int parse_pid(const char *s, pid_t* ret_pid); int parse_...
5,504
34.516129
119
h
null
systemd-main/src/basic/path-lookup.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include "constants.h" #include "macro.h" #include "runtime-scope.h" typedef enum LookupPathsFlags { LOOKUP_PATHS_EXCLUDE_GENERATED = 1 << 0, LOOKUP_PATHS_TEMPORARY_GENERATED = 1 << 1, LOOKUP_PATHS_SPLIT_USR ...
3,245
41.155844
119
h
null
systemd-main/src/basic/pcapng.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once /* * For details about the file format see RFC: * https://www.ietf.org/id/draft-tuexen-opsawg-pcapng-03.html * and * https://github.com/pcapng/pcapng/ */ enum pcapng_block_types { PCAPNG_INTERFACE_BLOCK = 1, PCAPNG_PACKET_BLOCK, ...
2,769
22.87931
63
h
null
systemd-main/src/basic/percent-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "percent-util.h" #include "string-util.h" #include "parse-util.h" static int parse_parts_value_whole(const char *p, const char *symbol) { const char *pc, *n; int r, v; pc = endswith(p, symbol); if (!pc) return -...
3,956
24.044304
89
c
null
systemd-main/src/basic/percent-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <errno.h> #include <inttypes.h> #include "macro.h" int parse_percent_unbounded(const char *p); int parse_percent(const char *p); int parse_permille_unbounded(const char *p); int parse_permille(const char *p); int parse_permyriad_unbounded(const...
1,936
28.348485
108
h
null
systemd-main/src/basic/prioq.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Priority Queue * The prioq object implements a priority queue. That is, it orders objects by * their priority and allows O(1) access to the object with the highest * priority. Insertion and removal are Θ(log n). Optionally, the caller can * provide a pointer t...
6,967
21.477419
89
c
null
systemd-main/src/basic/prioq.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include "hashmap.h" #include "macro.h" typedef struct Prioq Prioq; #define PRIOQ_IDX_NULL (UINT_MAX) Prioq *prioq_new(compare_func_t compare); Prioq *prioq_free(Prioq *q); DEFINE_TRIVIAL_CLEANUP_FUNC(Prioq*, prioq_free); int prioq_...
1,020
29.029412
88
h
null
systemd-main/src/basic/proc-cmdline.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <stdbool.h> #include <stddef.h> #include "alloc-util.h" #include "efivars.h" #include "extract-word.h" #include "fileio.h" #include "getopt-defs.h" #include "initrd-util.h" #include "macro.h" #include "parse-util.h" #include "proc-cmdline.h" #include "process-...
16,342
31.751503
119
c
null
systemd-main/src/basic/procfs-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <unistd.h> #include "alloc-util.h" #include "constants.h" #include "fd-util.h" #include "fileio.h" #include "parse-util.h" #include "process-util.h" #include "procfs-util.h" #include "stdio-util.h" #include "string-util.h" int procfs_get_pi...
8,137
29.252788
119
c
null
systemd-main/src/basic/procfs-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include "time-util.h" int procfs_get_pid_max(uint64_t *ret); int procfs_get_threads_max(uint64_t *ret); int procfs_tasks_set_limit(uint64_t limit); int procfs_tasks_get_current(uint64_t *ret); int procfs_cpu_get_usage(nsec_t *ret)...
569
24.909091
75
h
null
systemd-main/src/basic/psi-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <stdio.h> #include <unistd.h> #include "alloc-util.h" #include "errno-util.h" #include "extract-word.h" #include "fd-util.h" #include "fileio.h" #include "missing_threads.h" #include "parse-util.h" #include "psi-util.h" #include "string-util.h" #include "stat-...
3,918
28.916031
102
c
null
systemd-main/src/basic/psi-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include "parse-util.h" #include "time-util.h" typedef enum PressureType { PRESSURE_TYPE_SOME, PRESSURE_TYPE_FULL, } PressureType; /* Averages are stored in fixed-point with 11 bit fractions */ typedef struct Resource...
1,065
28.611111
87
h
null
systemd-main/src/basic/random-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <elf.h> #include <errno.h> #include <fcntl.h> #include <linux/random.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> #include <sys/time.h> #if HAVE_SYS_AUXV_H # include <sys/auxv.h> #endif #include "...
8,432
32.464286
109
c
null
systemd-main/src/basic/random-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include <stddef.h> #include <stdint.h> void random_bytes(void *p, size_t n); /* Returns random bytes suitable for most uses, but may be insecure sometimes. */ int crypto_random_bytes(void *p, size_t n); /* Returns secure random bytes ...
948
27.757576
119
h
null
systemd-main/src/basic/ratelimit.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sys/time.h> #include "macro.h" #include "ratelimit.h" /* Modelled after Linux' lib/ratelimit.c by Dave Young * <hidave.darkstar@gmail.com>, which is licensed GPLv2. */ bool ratelimit_below(RateLimit *r) { usec_t ts; assert(r); if ...
1,376
21.57377
74
c
null
systemd-main/src/basic/ratelimit.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include "time-util.h" typedef struct RateLimit { usec_t interval; /* Keep those two fields first so they can be initialized easily: */ unsigned burst; /* RateLimit rl = { INTERVAL, BURST }; */ unsigned num;...
726
24.068966
93
h
null
systemd-main/src/basic/raw-clone.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once /*** Copyright © 2016 Michael Karcher ***/ #include <errno.h> #include <sched.h> #include <sys/syscall.h> #include "log.h" #include "macro.h" #include "process-util.h" /** * raw_clone() - uses clone to create a new process with clone flags * @flags: ...
3,337
37.813953
120
h
null
systemd-main/src/basic/raw-reboot.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <linux/reboot.h> #include <sys/reboot.h> #include <sys/syscall.h> /* glibc defines the reboot() API call, which is a wrapper around the system call of the same name, but without the * extra "arg" parameter. Since we need that parameter for some c...
583
37.933333
116
h
null
systemd-main/src/basic/replace-var.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <stddef.h> #include <stdlib.h> #include "alloc-util.h" #include "macro.h" #include "replace-var.h" #include "string-util.h" /* * Generic infrastructure for replacing @FOO@ style variables in * strings. Will call a callback for each replac...
2,003
20.319149
108
c
null
systemd-main/src/basic/rlimit-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <sys/resource.h> #include "macro.h" const char *rlimit_to_string(int i) _const_; int rlimit_from_string(const char *s) _pure_; int rlimit_from_string_harder(const char *s) _pure_; int setrlimit_closest(int resource, const struct rlimit *rlim); i...
765
28.461538
80
h
null
systemd-main/src/basic/runtime-scope.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "runtime-scope.h" #include "string-table.h" static const char* const runtime_scope_table[_RUNTIME_SCOPE_MAX] = { [RUNTIME_SCOPE_SYSTEM] = "system", [RUNTIME_SCOPE_USER] = "user", [RUNTIME_SCOPE_GLOBAL] = "global", }; DEFINE_STRING_TA...
665
30.714286
83
c
null
systemd-main/src/basic/runtime-scope.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <errno.h> #include "macro.h" typedef enum RuntimeScope { RUNTIME_SCOPE_SYSTEM, /* for the system */ RUNTIME_SCOPE_USER, /* for a user */ RUNTIME_SCOPE_GLOBAL, /* for all users */ _RU...
605
29.3
79
h
null
systemd-main/src/basic/set.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include "extract-word.h" #include "hashmap.h" #include "macro.h" #define set_free_and_replace(a, b) \ free_and_replace_full(a, b, set_free) Set* _set_new(const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS); #define set_new(ops) _se...
5,603
34.923077
115
h
null
systemd-main/src/basic/sigbus.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <signal.h> #include <stddef.h> #include <sys/mman.h> #include "macro.h" #include "memory-util.h" #include "missing_syscall.h" #include "process-util.h" #include "sigbus.h" #include "signal-util.h" #define SIGBUS_QUEUE_MAX 64 static struct ...
5,042
31.960784
123
c
null
systemd-main/src/basic/signal-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include <stdarg.h> #include "errno-util.h" #include "macro.h" #include "missing_syscall.h" #include "missing_threads.h" #include "parse-util.h" #include "signal-util.h" #include "stdio-util.h" #include "string-table.h" #include "string-util.h" int ...
7,853
24.835526
113
c
null
systemd-main/src/basic/signal-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <signal.h> #include "macro.h" int reset_all_signal_handlers(void); int reset_signal_mask(void); int sigaction_many_internal(const struct sigaction *sa, ...); #define ignore_signals(...) \ siga...
2,693
37.485714
84
h
null
systemd-main/src/basic/siphash24.h
/* SPDX-License-Identifier: CC0-1.0 */ #pragma once #include <inttypes.h> #include <stddef.h> #include <stdint.h> #include <sys/types.h> #include "string-util.h" #include "time-util.h" struct siphash { uint64_t v0; uint64_t v1; uint64_t v2; uint64_t v3; uint64_t padding; ...
1,502
26.833333
105
h
null
systemd-main/src/basic/socket-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <linux/netlink.h> #include <linux/if_ether.h> #include <linux/if_infiniband.h> #include <linux/if_packet.h> #include <netinet/in.h> #include <stdbool.h> #include <stddef.h> #include <string.h> #include <sys/socket.h> #include ...
16,687
44.846154
127
h
null
systemd-main/src/basic/sort-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "sort-util.h" #include "alloc-util.h" /* hey glibc, APIs with callbacks without a user pointer are so useless */ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, comparison_userdata_fn_t compar, void *arg) { ...
959
27.235294
78
c
null
systemd-main/src/basic/sort-util.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdlib.h> #include "macro.h" /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that ...
3,417
42.265823
121
h
null
systemd-main/src/basic/sparse-endian.h
/* SPDX-License-Identifier: MIT * * Copyright (c) 2012 Josh Triplett <josh@joshtriplett.org> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without lim...
3,553
38.054945
99
h
null
systemd-main/src/basic/special.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #define SPECIAL_DEFAULT_TARGET "default.target" #define SPECIAL_INITRD_TARGET "initrd.target" /* Shutdown targets */ #define SPECIAL_UMOUNT_TARGET "umount.target" /* This is not really intended to be started by directly. This is * mostly so that other tar...
5,449
42.6
80
h