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/shared/compare-operator.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fnmatch.h>
#include "compare-operator.h"
#include "string-util.h"
CompareOperator parse_compare_operator(const char **s, CompareOperatorParseFlags flags) {
static const struct {
CompareOperator op;
const char *str;
... | 4,472 | 36.275 | 117 | c |
null | systemd-main/src/shared/compare-operator.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <errno.h>
#include <stdbool.h>
#define COMPARE_OPERATOR_CHARS "!<=>"
#define COMPARE_OPERATOR_WITH_FNMATCH_CHARS COMPARE_OPERATOR_CHARS "$"
typedef enum CompareOperator {
/* Listed in order of checking. Note that some comparators are pref... | 2,204 | 34 | 108 | h |
null | systemd-main/src/shared/coredump-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <elf.h>
#include "coredump-util.h"
#include "extract-word.h"
#include "fileio.h"
#include "string-table.h"
#include "unaligned.h"
#include "virt.h"
static const char *const coredump_filter_table[_COREDUMP_FILTER_MAX] = {
[COREDUMP_FILTER_PRIVATE_ANONY... | 8,220 | 44.672222 | 112 | c |
null | systemd-main/src/shared/coredump-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "macro.h"
typedef enum CoredumpFilter {
COREDUMP_FILTER_PRIVATE_ANONYMOUS = 0,
COREDUMP_FILTER_SHARED_ANONYMOUS,
COREDUMP_FILTER_PRIVATE_FILE_BACKED,
COREDUMP_FILTER_SHARED_FILE_BACKED,
COREDUMP_FILTER_ELF_H... | 1,577 | 34.863636 | 103 | h |
null | systemd-main/src/shared/cpu-set-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <syslog.h>
#include "alloc-util.h"
#include "cpu-set-util.h"
#include "dirent-util.h"
#include "errno-util.h"
#include "extract-word.h"
#include "fd-util.h"
#include "log.h"
#include "macro.h"
#include ... | 8,785 | 28.986348 | 131 | c |
null | systemd-main/src/shared/cpu-set-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sched.h>
#include "macro.h"
#include "missing_syscall.h"
/* This wraps the libc interface with a variable to keep the allocated size. */
typedef struct CPUSet {
cpu_set_t *set;
size_t allocated; /* in bytes */
} CPUSet;
static i... | 1,560 | 28.45283 | 79 | h |
null | systemd-main/src/shared/cryptsetup-fido2.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/types.h>
#include "cryptsetup-util.h"
#include "libfido2-util.h"
#include "log.h"
#include "time-util.h"
#if HAVE_LIBFIDO2
int acquire_fido2_key(
const char *volume_name,
const char *friendly_name,
... | 2,674 | 31.228916 | 69 | h |
null | systemd-main/src/shared/daemon-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "daemon-util.h"
#include "fd-util.h"
#include "log.h"
#include "string-util.h"
static int notify_remove_fd_warn(const char *name) {
int r;
assert(name);
r = sd_notifyf(/* unset_environment = */ false,
"FDSTORERE... | 1,861 | 23.181818 | 112 | c |
null | systemd-main/src/shared/daemon-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "sd-daemon.h"
#include "macro.h"
#define NOTIFY_READY "READY=1\n" "STATUS=Processing requests..."
#define NOTIFY_STOPPING "STOPPING=1\n" "STATUS=Shutting down..."
static inline const char *notify_start(const char *start, co... | 799 | 26.586207 | 77 | h |
null | systemd-main/src/shared/data-fd-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#if HAVE_LINUX_MEMFD_H
#include <linux/memfd.h>
#endif
#include "alloc-util.h"
#include "copy.h"
#include "data-fd-util.h"
#include "fd-util.h"
#include "fs-util.h"
#include "io-util.h"... | 15,092 | 37.502551 | 132 | c |
null | systemd-main/src/shared/dev-setup.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include "alloc-util.h"
#include "dev-setup.h"
#include "label-util.h"
#include "log.h"
#include "mkdir-label.h"
#include "nulstr-util.h"
#include "path-util.h"
#include "umask-util.h"
#include "user-util.h"
i... | 4,330 | 35.091667 | 119 | c |
null | systemd-main/src/shared/device-nodes.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include "device-nodes.h"
#include "path-util.h"
#include "string-util.h"
#include "utf8.h"
int allow_listed_char_for_devnode(char c, const char *additional) {
return
... | 2,371 | 25.954545 | 94 | c |
null | systemd-main/src/shared/devnode-acl.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include "sd-device.h"
#include "acl-util.h"
#include "alloc-util.h"
#include "device-util.h"
#include "devnode-acl.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "glyph-util.h"
#include "set.... | 6,862 | 29.23348 | 127 | c |
null | systemd-main/src/shared/devnode-acl.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <sys/types.h>
#if HAVE_ACL
int devnode_acl(const char *path,
bool flush,
bool del, uid_t old_uid,
bool add, uid_t new_uid);
int devnode_acl_all(const char *seat,
... | 863 | 23.685714 | 60 | h |
null | systemd-main/src/shared/discover-image.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "sd-id128.h"
#include "hashmap.h"
#include "image-policy.h"
#include "lock-util.h"
#include "macro.h"
#include "os-util.h"
#include "path-util.h"
#include "string-util.h"
#include "time-util.h"
typedef en... | 2,820 | 25.12037 | 125 | h |
null | systemd-main/src/shared/dlfcn-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "dlfcn-util.h"
static int dlsym_many_or_warnv(void *dl, int log_level, va_list ap) {
void (**fn)(void);
/* Tries to resolve a bunch of function symbols, and logs an error about if it cannot resolve one of
* them. Note that this functi... | 2,039 | 30.384615 | 108 | c |
null | systemd-main/src/shared/dlfcn-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <dlfcn.h>
#include "macro.h"
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(void*, dlclose, NULL);
int dlsym_many_or_warn_sentinel(void *dl, int log_level, ...) _sentinel_;
int dlopen_many_sym_or_warn_sentinel(void **dlp, const char *filename, int log_level, ... | 1,358 | 37.828571 | 122 | h |
null | systemd-main/src/shared/dm-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include <linux/dm-ioctl.h>
#include <sys/ioctl.h>
#include "dm-util.h"
#include "fd-util.h"
#include "string-util.h"
int dm_deferred_remove_cancel(const char *name) {
_cleanup_close_ int fd = -EBADF;
struct message {
... | 1,435 | 30.217391 | 97 | c |
null | systemd-main/src/shared/dns-domain.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "dns-def.h"
#include "hashmap.h"
#include "in-addr-util.h"
typedef enum DNSLabelFlags {
DNS_LABEL_LDH = 1 << 0, /* Follow the "LDH" rule — only... | 3,856 | 35.733333 | 120 | h |
null | systemd-main/src/shared/dropin.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "chase.h"
#include "conf-files.h"
#include "dirent-util.h"
#include "dropin.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio-label.h"
#include "ha... | 9,192 | 31.949821 | 118 | c |
null | systemd-main/src/shared/dropin.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "hashmap.h"
#include "macro.h"
#include "set.h"
#include "unit-name.h"
int drop_in_file(const char *dir, const char *unit, unsigned level,
const char *name, char **_p, char **_q);
int write_drop_in(const char *dir, const char *un... | 890 | 32 | 83 | h |
null | systemd-main/src/shared/edit-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#define DROPIN_MARKER_START "### Anything between here and the comment below will become the contents of the drop-in file"
#define DROPIN_MARKER_END "### Edits below this comment will be discarded"
typedef struct EditFile EditFile;
ty... | 1,189 | 28.02439 | 122 | h |
null | systemd-main/src/shared/efi-loader.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "efi-loader.h"
#include "env-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "stat-util.h"
#include "strv.h"
#include "tpm-pcr.h"
#include "utf8.h"
#if ENABLE_EFI
static int read_usec(const char *variable, usec_t *ret) ... | 11,464 | 31.571023 | 124 | c |
null | systemd-main/src/shared/efi-loader.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/stat.h>
#include "efivars-fundamental.h"
#include "efivars.h"
/* Various calls that interface with EFI variables implementing https://systemd.io/BOOT_LOADER_INTERFACE */
#if ENABLE_EFI
int efi_loader_get_device_part_uuid(sd_id128_t *ret);
... | 1,664 | 25.015625 | 107 | h |
null | systemd-main/src/shared/ethtool-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <macro.h>
#include <net/ethernet.h>
#include <linux/ethtool.h>
#include "conf-parser.h"
#include "ether-addr-util.h"
#define N_ADVERTISE 4
/* we can't use DUPLEX_ prefix, as it
* clashes with <linux/ethtool.h> */
typedef enum Duplex {
D... | 7,320 | 34.538835 | 114 | h |
null | systemd-main/src/shared/exec-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <dirent.h>
#include <errno.h>
#include <sys/prctl.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include "alloc-util.h"
#include "conf-files.h"
#include "env-file.h"
#include "env-util.h"
#include "errno-util.h"
#include "exec-util.h"
#inclu... | 20,575 | 33.465662 | 133 | c |
null | systemd-main/src/shared/exec-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "time-util.h"
typedef int (*gather_stdout_callback_t) (int fd, void *arg);
enum {
STDOUT_GENERATE, /* from generators to helper process */
STDOUT_COLLECT, /* from helper process to main process */
... | 2,569 | 38.538462 | 120 | h |
null | systemd-main/src/shared/exit-status.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <signal.h>
#include <stdlib.h>
#include <sysexits.h>
#include "exit-status.h"
#include "macro.h"
#include "parse-util.h"
#include "set.h"
#include "string-util.h"
const ExitStatusMapping exit_status_mappings[256] = {
/* Exit status ranges:
*
... | 9,753 | 53.188889 | 132 | c |
null | systemd-main/src/shared/exit-status.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "bitmap.h"
#include "hashmap.h"
#include "macro.h"
/* This defines pretty names for the LSB 'start' verb exit codes. Note that they shouldn't be confused with
* the LSB 'status' verb exit codes which are defined very differe... | 3,585 | 30.45614 | 109 | h |
null | systemd-main/src/shared/extension-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "architecture.h"
#include "chase.h"
#include "env-util.h"
#include "extension-util.h"
#include "log.h"
#include "os-util.h"
#include "strv.h"
int extension_release_validate(
const char *name,
const char *... | 7,735 | 46.170732 | 129 | c |
null | systemd-main/src/shared/extension-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "os-util.h"
/* Given an image name (for logging purposes), a set of os-release values from the host and a key-value pair
* vector of extension-release variables, check that the distro and (system extension level or distro
* version) match and re... | 1,150 | 46.958333 | 108 | h |
null | systemd-main/src/shared/fdisk-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "dissect-image.h"
#include "fd-util.h"
#include "fdisk-util.h"
#if HAVE_LIBFDISK
int fdisk_new_context_fd(
int fd,
bool read_only,
uint32_t sector_size,
struct fdisk_context **ret) {
_cl... | 1,809 | 21.911392 | 83 | c |
null | systemd-main/src/shared/fdisk-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if HAVE_LIBFDISK
#include <libfdisk.h>
#include "sd-id128.h"
#include "macro.h"
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_context*, fdisk_unref_context, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_partition*, fdisk_unref_partition, NULL);
... | 762 | 32.173913 | 99 | h |
null | systemd-main/src/shared/fdset.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include "sd-daemon.h"
#include "alloc-util.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "fdset.h"
#include "log.h"
#include "macro.h"
#include "parse-util.h"
#include "path-util.h"
#include "set.h... | 7,581 | 23.777778 | 120 | c |
null | systemd-main/src/shared/fdset.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "hashmap.h"
#include "macro.h"
#include "set.h"
typedef struct FDSet FDSet;
FDSet* fdset_new(void);
FDSet* fdset_free(FDSet *s);
int fdset_put(FDSet *s, int fd);
int fdset_consume(FDSet *s, int fd);
int fdset_put_dup(FDSet ... | 1,181 | 23.625 | 83 | h |
null | systemd-main/src/shared/fileio-label.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/stat.h>
#include "fileio-label.h"
#include "fileio.h"
#include "selinux-util.h"
int write_string_file_atomic_label_ts(const char *fn, const char *line, struct timespec *ts) {
int r;
r = mac_selinux_create_file_prepare(fn, S_IFREG);
... | 1,676 | 37.113636 | 123 | c |
null | systemd-main/src/shared/fileio-label.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdio.h>
/* These functions are split out of fileio.h (and not for example just flags to the functions they wrap) in order to
* optimize linking: This way, -lselinux is needed only for the callers of these functions that need selinux, but not
*... | 628 | 38.3125 | 117 | h |
null | systemd-main/src/shared/firewall-util-iptables.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/* Temporary work-around for broken glibc vs. linux kernel header definitions
* This is already fixed upstream, remove this when distributions have updated.
*/
#define _NET_IF_H 1
#include <arpa/inet.h>
#include <endian.h>
#include <errno.h>
#include <stddef.h>
#incl... | 13,248 | 35.398352 | 130 | c |
null | systemd-main/src/shared/firewall-util-private.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "sd-netlink.h"
#include "in-addr-util.h"
typedef enum FirewallBackend {
FW_BACKEND_NONE,
#if HAVE_LIBIPTC
FW_BACKEND_IPTABLES,
#endif
FW_BACKEND_NFTABLES,
_FW_BACKEND_MAX,
... | 1,752 | 24.779412 | 66 | h |
null | systemd-main/src/shared/firewall-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stddef.h>
#include <string.h>
#include "alloc-util.h"
#include "firewall-util.h"
#include "firewall-util-private.h"
#include "log.h"
#include "string-table.h"
static const char * const firewall_backend_table[_FW_BACKEND_MAX] = {
[F... | 3,362 | 24.869231 | 125 | c |
null | systemd-main/src/shared/firewall-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "in-addr-util.h"
typedef struct FirewallContext FirewallContext;
int fw_ctx_new(FirewallContext **ret);
FirewallContext *fw_ctx_free(FirewallContext *ctx);
DEFINE_TRIVIAL_CLEANUP_FUNC(FirewallContext *, ... | 872 | 26.28125 | 60 | h |
null | systemd-main/src/shared/fstab-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "device-nodes.h"
#include "fstab-util.h"
#include "initrd-util.h"
#include "macro.h"
#include "mount-util.h"
#include "nulstr-util.h"
#include "parse-util.h"
#include "path-util.... | 10,049 | 32.059211 | 126 | c |
null | systemd-main/src/shared/fstab-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include "macro.h"
bool fstab_is_extrinsic(const char *mount, const char *opts);
int fstab_is_mount_point(const char *mount);
int fstab_has_fstype(const char *fstype);
int fstab_filter_options(
con... | 1,302 | 27.955556 | 83 | h |
null | systemd-main/src/shared/generator.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdio.h>
#include "macro.h"
#include "main-func.h"
int generator_open_unit_file_full(const char *dest, const char *source, const char *name, FILE **ret_file, char **ret_temp_path);
static inline int generator_open_unit_file(const char *dest, co... | 3,663 | 33.566038 | 129 | h |
null | systemd-main/src/shared/gpt.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-gpt.h"
#include "sd-id128.h"
#include "architecture.h"
#include "id128-util.h"
/* maximum length of gpt label */
#define GPT_LABEL_MAX 36
typedef enum PartitionDesignator {
PARTITION_ROOT, /* Primary architecture */
PARTITION... | 2,547 | 34.388889 | 104 | h |
null | systemd-main/src/shared/group-record.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "json.h"
#include "user-record.h"
typedef struct GroupRecord {
unsigned n_ref;
UserRecordMask mask;
bool incomplete;
char *group_name;
char *realm;
char *group_name_and_realm_auto;
char *de... | 1,362 | 28 | 108 | h |
null | systemd-main/src/shared/hostname-setup.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/utsname.h>
#include <unistd.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "hostname-setup.h"
#include "hostname-util.h"
#include "log.h"
#include... | 6,415 | 27.900901 | 131 | c |
null | systemd-main/src/shared/hostname-setup.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stdio.h>
typedef enum HostnameSource {
HOSTNAME_STATIC, /* from /etc/hostname */
HOSTNAME_TRANSIENT, /* a transient hostname set through systemd, hostnamed, the container manager, or otherwise */
... | 914 | 34.192308 | 123 | h |
null | systemd-main/src/shared/id128-print.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include "sd-id128.h"
#include "alloc-util.h"
#include "id128-print.h"
#include "log.h"
#include "pretty-print.h"
#include "terminal-util.h"
int id128_pretty_print_sample(const char *name, sd_id128_t id) {
_cleanup_free_ char *man_link = NUL... | 2,309 | 29 | 98 | c |
null | systemd-main/src/shared/id128-print.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "sd-id128.h"
typedef enum Id128PrettyPrintMode {
ID128_PRINT_ID128,
ID128_PRINT_UUID,
ID128_PRINT_PRETTY,
_ID128_PRETTY_PRINT_MODE_MAX,
_ID128_PRETTY_PRINT_MODE_INVALID = -EINVAL,
} Id... | 519 | 25 | 65 | h |
null | systemd-main/src/shared/idn-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#if HAVE_LIBIDN2
# include <idn2.h>
#elif HAVE_LIBIDN
# include <idna.h>
# include <stringprep.h>
#endif
#include "alloc-util.h"
#include "dlfcn-util.h"
#include "idn-util.h"
#if HAVE_LIBIDN || HAVE_LIBIDN2
static void* idn_dl = NULL;
#endif
#if HAVE_LIBIDN2
int (... | 2,371 | 32.885714 | 117 | c |
null | systemd-main/src/shared/idn-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if HAVE_LIBIDN2
# include <idn2.h>
#elif HAVE_LIBIDN
# include <idna.h>
# include <stringprep.h>
#endif
#include <inttypes.h>
#if HAVE_LIBIDN2 || HAVE_LIBIDN
int dlopen_idn(void);
#else
static inline int dlopen_idn(void) {
return -EOPNOTSUPP;
... | 1,046 | 30.727273 | 124 | h |
null | systemd-main/src/shared/import-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "macro.h"
typedef enum ImportVerify {
IMPORT_VERIFY_NO,
IMPORT_VERIFY_CHECKSUM,
IMPORT_VERIFY_SIGNATURE,
_IMPORT_VERIFY_MAX,
_IMPORT_VERIFY_INVALID = -EINVAL,
} ImportVerify;
int impor... | 1,154 | 30.216216 | 104 | h |
null | systemd-main/src/shared/in-addr-prefix-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "conf-parser.h"
#include "in-addr-util.h"
#include "set.h"
struct in_addr_prefix {
int family;
uint8_t prefixlen;
union in_addr_union address;
};
int in_addr_prefix_add(Set **prefixes, const struct in_addr_prefix *prefix);... | 724 | 29.208333 | 92 | h |
null | systemd-main/src/shared/initreq.h | /* SPDX-License-Identifier: LGPL-2.0-or-later */
/*
* initreq.h Interface to talk to init through /dev/initctl.
*
* Copyright (C) 1995-2004 Miquel van Smoorenburg
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as publis... | 2,215 | 28.546667 | 71 | h |
null | systemd-main/src/shared/install-file.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int fs_make_very_read_only(int fd);
typedef enum InstallFileFlags {
INSTALL_REPLACE = 1 << 0, /* Replace an existing inode */
INSTALL_READ_ONLY = 1 << 1, /* Call fs_make_very_read_only() to make the inode comprehensively read-only */
... | 786 | 51.466667 | 125 | h |
null | systemd-main/src/shared/install-printf.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include "format-util.h"
#include "install-printf.h"
#include "install.h"
#include "macro.h"
#include "specifier.h"
#include "string-util.h"
#include "unit-name.h"
#include "user-util.h"
static int specifier_pr... | 3,676 | 28.18254 | 128 | c |
null | systemd-main/src/shared/ip-protocol-list.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <netinet/in.h>
#include "alloc-util.h"
#include "ip-protocol-list.h"
#include "macro.h"
#include "parse-util.h"
#include "string-util.h"
static const struct ip_protocol_name* lookup_ip_protocol(register const char *str, register GPERF_LEN_T... | 1,838 | 22.576923 | 112 | c |
null | systemd-main/src/shared/ipvlan-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <net/if.h>
#include "ipvlan-util.h"
#include "string-table.h"
static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
[NETDEV_IPVLAN_MODE_L2] = "L2",
[NETDEV_IPVLAN_MODE_L3] = "L3",
[NETDEV_IPVLAN_MODE_L3S] = "L3S",
};
... | 653 | 27.434783 | 73 | c |
null | systemd-main/src/shared/ipvlan-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <netinet/in.h>
#include <linux/if_link.h>
#include "macro.h"
typedef enum IPVlanMode {
NETDEV_IPVLAN_MODE_L2 = IPVLAN_MODE_L2,
NETDEV_IPVLAN_MODE_L3 = IPVLAN_MODE_L3,
NETDEV_IPVLAN_MODE_L3S = IPVLAN_MODE_L3S,
_NETD... | 904 | 29.166667 | 59 | h |
null | systemd-main/src/shared/journal-importer.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <malloc.h>
#include <unistd.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "escape.h"
#include "fd-util.h"
#include "io-util.h"
#include "journal-file.h"
#include "journal-importer.h"
#include "journal-util.h"
#include "parse-ut... | 16,100 | 32.335404 | 111 | c |
null | systemd-main/src/shared/journal-importer.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stddef.h>
#include <stdbool.h>
#include <sys/uio.h>
#include "sd-id128.h"
#include "io-util.h"
#include "time-util.h"
/* Make sure not to make this smaller than the maximum coredump size.
* See JOURNAL_SIZE_MAX in coredump.c */
#ifndef FUZZIN... | 1,845 | 29.766667 | 94 | h |
null | systemd-main/src/shared/kbd-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "errno-util.h"
#include "kbd-util.h"
#include "log.h"
#include "nulstr-util.h"
#include "path-util.h"
#include "recurse-dir.h"
#include "set.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
struct recurse_dir_userdata {
const char *keyma... | 4,910 | 29.314815 | 107 | c |
null | systemd-main/src/shared/kbd-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#if HAVE_SPLIT_USR
#define KBD_KEYMAP_DIRS \
"/usr/share/keymaps/\0" \
"/usr/share/kbd/keymaps/\0" \
"/usr/lib/kbd/keymaps/\0" \
"/lib/kb... | 637 | 28 | 49 | h |
null | systemd-main/src/shared/kernel-image.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "fd-util.h"
#include "fileio.h"
#include "env-file.h"
#include "kernel-image.h"
#include "os-util.h"
#include "parse-util.h"
#include "pe-header.h"
#include "string-table.h"
#define MAX_SECTIONS 96
static const uint8_t dos_file_magic[2] = "MZ";
static const u... | 9,458 | 30.741611 | 124 | c |
null | systemd-main/src/shared/kernel-image.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <errno.h>
#include "macro.h"
typedef enum KernelImageType {
KERNEL_IMAGE_TYPE_UNKNOWN,
KERNEL_IMAGE_TYPE_UKI,
KERNEL_IMAGE_TYPE_PE,
_KERNEL_IMAGE_TYPE_MAX,
_KERNEL_IMAGE_TYPE_INVALID = -EINVAL,
} KernelImag... | 637 | 24.52 | 67 | h |
null | systemd-main/src/shared/keyring-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "keyring-util.h"
#include "memory-util.h"
#include "missing_syscall.h"
int keyring_read(key_serial_t serial, void **ret, size_t *ret_size) {
size_t m = 100;
for (;;) {
_cleanup_(erase_and_freep) uint8_t *p = NULL;
... | 1,081 | 26.74359 | 105 | c |
null | systemd-main/src/shared/killall.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/***
Copyright © 2010 ProFUSION embedded systems
***/
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
#include "alloc-util.h"
#include "constants.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "init... | 10,044 | 34.369718 | 116 | c |
null | systemd-main/src/shared/label-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <fcntl.h>
#include <stdbool.h>
#include <sys/types.h>
typedef enum LabelFixFlags {
LABEL_IGNORE_ENOENT = 1 << 0,
LABEL_IGNORE_EROFS = 1 << 1,
} LabelFixFlags;
int label_fix_full(int atfd, const char *inode_path, const char *label... | 898 | 30 | 98 | h |
null | systemd-main/src/shared/libcrypt-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#if HAVE_CRYPT_H
/* libxcrypt is a replacement for glibc's libcrypt, and libcrypt might be
* removed from glibc at some point. As part of the removal, defines for
* crypt(3) are dropped from unistd.h, and we must include crypt.h instead.
*
* Newer versions of glibc ... | 6,391 | 29.150943 | 118 | c |
null | systemd-main/src/shared/libcrypt-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
int make_salt(char **ret);
int hash_password_full(const char *password, void **cd_data, int *cd_size, char **ret);
static inline int hash_password(const char *password, char **ret) {
return hash_password_full(password, NULL, NU... | 524 | 36.5 | 87 | h |
null | systemd-main/src/shared/libfido2-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "macro.h"
typedef enum Fido2EnrollFlags {
FIDO2ENROLL_PIN = 1 << 0,
FIDO2ENROLL_UP = 1 << 1, /* User presence (ie: touching token) */
FIDO2ENROLL_UV = 1 << 2, /* User verification (ie: finger... | 5,917 | 44.523077 | 125 | h |
null | systemd-main/src/shared/libmount-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include "libmount-util.h"
int libmount_parse(
const char *path,
FILE *source,
struct libmnt_table **ret_table,
struct libmnt_iter **ret_iter) {
_cleanup_(mnt_free_tablep) stru... | 1,751 | 28.2 | 86 | c |
null | systemd-main/src/shared/libmount-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
/* This needs to be after sys/mount.h */
#include <libmount.h>
#include "macro.h"
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct libmnt_table*, mnt_free_table, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct libmnt_iter*, mnt_free_iter, NULL);
int libmount_parse... | 589 | 27.095238 | 77 | h |
null | systemd-main/src/shared/local-addresses.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <net/if_arp.h>
#include "sd-netlink.h"
#include "alloc-util.h"
#include "fd-util.h"
#include "local-addresses.h"
#include "macro.h"
#include "netlink-util.h"
#include "sort-util.h"
static int address_compare(const struct local_address *a, const struct local_... | 18,423 | 35.33925 | 122 | c |
null | systemd-main/src/shared/local-addresses.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-netlink.h"
#include "in-addr-util.h"
struct local_address {
int family, ifindex;
unsigned char scope;
uint32_t metric;
union in_addr_union address;
};
int local_addresses(sd_netlink *rtnl, int ifindex, int af,... | 527 | 25.4 | 87 | h |
null | systemd-main/src/shared/locale-setup.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <sys/stat.h>
#include "env-file-label.h"
#include "env-file.h"
#include "env-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "locale-setup.h"
#include "proc-cmdline.h"
#include "stat-util.h"
#include "strv.h"
void locale_conte... | 9,895 | 32.545763 | 106 | c |
null | systemd-main/src/shared/locale-setup.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/stat.h>
#include "locale-util.h"
typedef struct LocaleContext {
struct stat st;
char *locale[_VARIABLE_LC_MAX];
} LocaleContext;
typedef enum LocaleLoadFlag {
LOCALE_LOAD_PROC_CMDLINE = 1 << 0,
LOCALE_LOAD_LO... | 991 | 32.066667 | 89 | h |
null | systemd-main/src/shared/logs-show.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 "sd-id128.h"
#include "sd-journal.h"
#include "macro.h"
#include "output-mode.h"
#include "time-util.h"
int show_journal_entry(
FILE *f,
... | 1,847 | 26.176471 | 60 | h |
null | systemd-main/src/shared/loopback-setup.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <net/if.h>
#include <stdlib.h>
#include "sd-netlink.h"
#include "loopback-setup.h"
#include "missing_network.h"
#include "netlink-util.h"
#include "time-util.h"
#define LOOPBACK_SETUP_TIMEOUT_USEC (5 * USEC_PER_SEC)
struct state {
unsigned n_message... | 8,242 | 34.377682 | 132 | c |
null | systemd-main/src/shared/lsm-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "extract-word.h"
#include "fileio.h"
#include "lsm-util.h"
#include "string-util.h"
int lsm_supported(const char *name) {
_cleanup_free_ char *lsm_list = NULL;
int r;
assert(name);
r = read_one_line_fil... | 1,002 | 28.5 | 98 | c |
null | systemd-main/src/shared/machine-pool.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include "btrfs-util.h"
#include "label-util.h"
#include "machine-pool.h"
#include "missing_magic.h"
#include "stat-util.h"
static int check_btrfs(void) {
struct statfs sfs;
if (statfs("/var/lib/machines", &sfs) < 0) {
... | 1,465 | 27.192308 | 130 | c |
null | systemd-main/src/shared/macvlan-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "conf-parser.h"
#include "macvlan-util.h"
#include "string-table.h"
static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = {
[NETDEV_MACVLAN_MODE_PRIVATE] = "private",
[NETDEV_MACVLAN_MODE_VEPA] = "vepa",
[NETDEV_MACVLA... | 508 | 30.8125 | 73 | c |
null | systemd-main/src/shared/macvlan-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/if_link.h>
typedef enum MacVlanMode {
NETDEV_MACVLAN_MODE_PRIVATE = MACVLAN_MODE_PRIVATE,
NETDEV_MACVLAN_MODE_VEPA = MACVLAN_MODE_VEPA,
NETDEV_MACVLAN_MODE_BRIDGE = MACVLAN_MODE_BRIDGE,
NETDEV_MACVLAN_MODE_PA... | 627 | 33.888889 | 61 | h |
null | systemd-main/src/shared/main-func.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdlib.h>
#include "sd-daemon.h"
#include "argv-util.h"
#include "pager.h"
#include "selinux-util.h"
#include "spawn-ask-password-agent.h"
#include "spawn-polkit-agent.h"
#include "static-destruct.h"
#define _DEFINE_MAIN_FUNCTION(intro, impl, r... | 2,038 | 46.418605 | 85 | h |
null | systemd-main/src/shared/mkdir-label.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/stat.h>
#include "errno-util.h"
#include "mkdir-label.h"
#include "selinux-util.h"
#include "smack-util.h"
#include "user-util.h"
int mkdirat_label(int dirfd, const char *path, mode_t mode) {
int r;
assert(path);
r = mac_selinux... | 1,356 | 30.55814 | 121 | c |
null | systemd-main/src/shared/mkdir-label.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <fcntl.h>
#include <sys/types.h>
#include "mkdir.h"
int mkdirat_label(int dirfd, const char *path, mode_t mode);
static inline int mkdir_label(const char *path, mode_t mode) {
return mkdirat_label(AT_FDCWD, path, mode);
}
int mkdirat_sa... | 970 | 34.962963 | 120 | h |
null | systemd-main/src/shared/mkfs-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "sd-id128.h"
#include "strv.h"
int mkfs_exists(const char *fstype);
int mkfs_supports_root_option(const char *fstype);
int make_filesystem(
const char *node,
const char *fstype,
... | 638 | 23.576923 | 82 | h |
null | systemd-main/src/shared/module-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include "module-util.h"
#include "proc-cmdline.h"
#include "strv.h"
static int denylist_modules(const char *p, char ***denylist) {
_cleanup_strv_free_ char **k = NULL;
assert(p);
assert(denylist);
k = strv_split(p,... | 5,161 | 40.296 | 126 | c |
null | systemd-main/src/shared/net-condition.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <netinet/ether.h>
#include "condition.h"
#include "env-util.h"
#include "log.h"
#include "net-condition.h"
#include "netif-util.h"
#include "network-util.h"
#include "socket-util.h"
#include "string-table.h"
#include "strv.h"
#include "wifi-util.h"
void net_m... | 12,096 | 29.2425 | 116 | c |
null | systemd-main/src/shared/net-condition.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/nl80211.h>
#include <stdbool.h>
#include "sd-device.h"
#include "conf-parser.h"
#include "ether-addr-util.h"
#include "set.h"
typedef struct NetMatch {
Set *hw_addr;
Set *permanent_hw_addr;
char **path;
cha... | 1,461 | 29.458333 | 82 | h |
null | systemd-main/src/shared/netif-naming-scheme.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "netif-naming-scheme.h"
#include "proc-cmdline.h"
#include "string-util.h"
#include "string-table.h"
#ifdef _DEFAULT_NET_NAMING_SCHEME_TEST
/* The primary purpose of this check is to verify that _DEFAULT_NET_NAMING_SCHEME_TEST
* is a v... | 3,756 | 33.46789 | 109 | c |
null | systemd-main/src/shared/netif-sriov.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/if_link.h>
#include "sd-device.h"
#include "conf-parser.h"
#include "ether-addr-util.h"
#include "hashmap.h"
typedef enum SRIOVLinkState {
SR_IOV_LINK_STATE_AUTO = IFLA_VF_LINK_STATE_AUTO,
SR_IOV_LINK_STATE_ENABLE = IFLA_V... | 1,801 | 34.333333 | 95 | h |
null | systemd-main/src/shared/netif-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <inttypes.h>
#include <stdbool.h>
#include "sd-device.h"
#include "sd-id128.h"
#include "ether-addr-util.h"
bool netif_has_carrier(uint8_t operstate, unsigned flags);
int net_get_type_string(sd_device *device, uint16_t iftype, char **ret);
const... | 803 | 33.956522 | 102 | h |
null | systemd-main/src/shared/nsflags.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include "alloc-util.h"
#include "extract-word.h"
#include "namespace-util.h"
#include "nsflags.h"
#include "string-util.h"
int namespace_flags_from_string(const char *name, unsigned long *ret) {
unsigned long flags = 0;
int r;
... | 1,844 | 26.132353 | 91 | c |
null | systemd-main/src/shared/nsflags.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "missing_sched.h"
/* The combination of all namespace flags defined by the kernel. The right type for this isn't clear. setns() and
* unshare() expect these flags to be passed as (signed) "int", while clone() wants them as "unsigned long". The la... | 1,261 | 51.583333 | 119 | h |
null | systemd-main/src/shared/numa-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <sched.h>
#include "alloc-util.h"
#include "cpu-set-util.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "macro.h"
#include "missing_syscall.h"
#include "numa-util.h"
#include "stdio-util.h"
#include "string-tab... | 5,368 | 27.407407 | 118 | c |
null | systemd-main/src/shared/numa-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "cpu-set-util.h"
#include "missing_syscall.h"
static inline bool mpol_is_valid(int t) {
return t >= MPOL_DEFAULT && t <= MPOL_LOCAL;
}
typedef struct NUMAPolicy {
/* Always use numa_policy_get_type() to read the value */
i... | 924 | 24.694444 | 76 | h |
null | systemd-main/src/shared/open-file.c |
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include "escape.h"
#include "extract-word.h"
#include "fd-util.h"
#include "open-file.h"
#include "path-util.h"
#include "string-table.h"
#include "string-util.h"
int open_file_parse(const char *v, OpenFile **ret) {
_cleanup_free_ char *op... | 4,057 | 25.874172 | 132 | c |
null | systemd-main/src/shared/open-file.h |
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "list.h"
typedef enum OpenFileFlag {
OPENFILE_READ_ONLY = 1 << 0,
OPENFILE_APPEND = 1 << 1,
OPENFILE_TRUNCATE = 1 << 2,
OPENFILE_GRACEFUL = 1 << 3,
_OPENFILE_MAX,
_OPENFILE_INVALID = -EINVAL,
... | 1,030 | 26.864865 | 109 | h |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.