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/openssl-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "openssl-util.h"
#include "alloc-util.h"
#include "hexdecoct.h"
#if HAVE_OPENSSL
int openssl_hash(const EVP_MD *alg,
const void *msg,
size_t msg_len,
uint8_t *ret_hash,
size_t *ret_hash_len) {... | 6,848 | 30.562212 | 127 | c |
null | systemd-main/src/shared/output-mode.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "output-mode.h"
#include "string-table.h"
JsonFormatFlags output_mode_to_json_format_flags(OutputMode m) {
switch (m) {
case OUTPUT_JSON_SSE:
return JSON_FORMAT_SSE;
case OUTPUT_JSON_SEQ:
return JSON_F... | 1,281 | 28.136364 | 64 | c |
null | systemd-main/src/shared/output-mode.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "json.h"
#include "macro.h"
typedef enum OutputMode {
OUTPUT_SHORT,
OUTPUT_SHORT_FULL,
OUTPUT_SHORT_ISO,
OUTPUT_SHORT_ISO_PRECISE,
OUTPUT_SHORT_PRECISE,
OUTPUT_SHORT_MONOTONIC,
OUTPUT_SHORT_D... | 1,780 | 29.706897 | 116 | h |
null | systemd-main/src/shared/pam-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <security/pam_ext.h>
#include <syslog.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "format-util.h"
#include "macro.h"
#include "pam-util.h"
#include "process-util.h"
#include "stdio-util.h"
#include "string-util.h"
int pam_s... | 7,363 | 35.098039 | 119 | c |
null | systemd-main/src/shared/pam-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <security/pam_modules.h>
#include "sd-bus.h"
int pam_syslog_errno(pam_handle_t *handle, int level, int error, const char *format, ...) _printf_(4,5);
int pam_syslog_pam_error(pam_handle_t *handle, int level, int error, const char *format, ...) _... | 1,880 | 43.785714 | 123 | h |
null | systemd-main/src/shared/parse-argument.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "format-table.h"
#include "parse-argument.h"
#include "path-util.h"
#include "signal-util.h"
#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"
/* All functions in this file emit warnings. */
int parse_boolean_argument(const char *optn... | 3,764 | 29.362903 | 109 | c |
null | systemd-main/src/shared/parse-helpers.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "af-list.h"
#include "extract-word.h"
#include "ip-protocol-list.h"
#include "log.h"
#include "parse-helpers.h"
#include "parse-util.h"
#include "path-util.h"
#include "utf8.h"
int path_simplify_and_warn(
char *path,
unsigned fl... | 6,901 | 28 | 122 | c |
null | systemd-main/src/shared/parse-helpers.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdint.h>
enum {
PATH_CHECK_FATAL = 1 << 0, /* If not set, then error message is appended with 'ignoring'. */
PATH_CHECK_ABSOLUTE = 1 << 1,
PATH_CHECK_RELATIVE = 1 << 2,
};
int path_simplify_and_warn(
... | 1,042 | 26.447368 | 104 | h |
null | systemd-main/src/shared/pcre2-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "dlfcn-util.h"
#include "log.h"
#include "pcre2-util.h"
#if HAVE_PCRE2
static void *pcre2_dl = NULL;
pcre2_match_data* (*sym_pcre2_match_data_create)(uint32_t, pcre2_general_context *);
void (*sym_pcre2_match_data_free)(pcre2_match_data *);
void (*sym_pcre2_c... | 6,352 | 37.041916 | 132 | c |
null | systemd-main/src/shared/pe-header.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <inttypes.h>
#include "macro.h"
#include "sparse-endian.h"
struct DosFileHeader {
uint8_t Magic[2];
le16_t LastSize;
le16_t nBlocks;
le16_t nReloc;
le16_t HdrSize;
le16_t MinAlloc;
le16_t M... | 1,343 | 21.779661 | 48 | h |
null | systemd-main/src/shared/pretty-print.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/utsname.h>
#include <errno.h>
#include <stdio.h>
#include "alloc-util.h"
#include "conf-files.h"
#include "constants.h"
#include "env-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "pager.h"
#include "path-util.h"
#include "pretty-print.h"
#inc... | 10,523 | 29.952941 | 119 | c |
null | systemd-main/src/shared/ptyfwd.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/epoll.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <termios.h>
#include <unistd.h>
#i... | 22,974 | 32.886431 | 119 | c |
null | systemd-main/src/shared/ptyfwd.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "sd-event.h"
#include "macro.h"
typedef struct PTYForward PTYForward;
typedef enum PTYForwardFlags {
PTY_FORWARD_READ_ONLY = 1,
/* Continue reading after hangup? */
PTY_FORWARD_IGNORE_VHANGUP = 2,
... | 1,245 | 27.976744 | 88 | h |
null | systemd-main/src/shared/quota-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/quota.h>
#include <sys/stat.h>
#include "alloc-util.h"
#include "blockdev-util.h"
#include "device-util.h"
#include "quota-util.h"
int quotactl_devnum(int cmd, dev_t devnum, int id, void *addr) {
_cleanup_free_ char *devnode = NULL;
int r... | 1,211 | 27.186047 | 108 | c |
null | systemd-main/src/shared/quota-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <inttypes.h>
#include <sys/quota.h>
#include <sys/types.h>
/* Wrapper around the QCMD() macro of linux/quota.h that removes some undefined behaviour. A typical quota
* command such as QCMD(Q_GETQUOTA, USRQUOTA) cannot be resolved on platforms whe... | 962 | 47.15 | 109 | h |
null | systemd-main/src/shared/reboot-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <unistd.h>
#if HAVE_XENCTRL
#define __XEN_INTERFACE_VERSION__ 0x00040900
#include <xen/xen.h>
#include <xen/kexec.h>
#include <xen/sys/privcmd.h>
#endif
#include "alloc-util.h... | 6,132 | 30.777202 | 109 | c |
null | systemd-main/src/shared/recovery-key.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "memory-util.h"
#include "random-util.h"
#include "recovery-key.h"
const char modhex_alphabet[16] = {
'c', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'r', 't', 'u', 'v'
};
int decode_modhex_char(char x) {
for (size_t i = 0; i < EL... | 3,510 | 30.918182 | 98 | c |
null | systemd-main/src/shared/recovery-key.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
/* 256 bit keys = 32 bytes */
#define RECOVERY_KEY_MODHEX_RAW_LENGTH 32
/* Formatted as sequences of 64 modhex characters, with dashes inserted after multiples of 8 chars (incl. trailing NUL) */
#define RECOVERY_KEY_MODHEX_FORMATTED_LENGTH (RECOVERY_KEY_MO... | 515 | 29.352941 | 122 | h |
null | systemd-main/src/shared/resize-fs.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <linux/btrfs.h>
#include <linux/magic.h>
#include <sys/ioctl.h>
#include <sys/vfs.h>
#include "blockdev-util.h"
#include "fs-util.h"
#include "missing_fs.h"
#include "missing_magic.h"
#include "missing_xfs.h"
#include "resize-fs.h"
#include "stat-util.h"
int ... | 3,502 | 26.582677 | 109 | c |
null | systemd-main/src/shared/resolve-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "conf-parser.h"
#include "in-addr-util.h"
#include "macro.h"
/* 127.0.0.53 in native endian (The IP address we listen on with the full DNS stub, i.e. that does LLMNR/mDNS, and stuff) */
#define INADDR_DNS_STUB ((in_addr_t) 0x7f000035U)
/* 127.0.0... | 3,654 | 35.55 | 125 | h |
null | systemd-main/src/shared/rm-rf.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <fcntl.h>
#include <sys/stat.h>
#include "alloc-util.h"
#include "errno-util.h"
typedef enum RemoveFlags {
REMOVE_ONLY_DIRECTORIES = 1 << 0, /* Only remove empty directories, no files */
REMOVE_ROOT = 1 << 1, /* Remove... | 2,399 | 40.37931 | 124 | h |
null | systemd-main/src/shared/seccomp-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if HAVE_SECCOMP
#include <seccomp.h>
#include <stdbool.h>
#include <stdint.h>
#include "errno-list.h"
#include "parse-util.h"
#include "set.h"
#include "string-util.h"
const char* seccomp_arch_to_string(uint32_t c);
int seccomp_arch_from_string(const ch... | 5,759 | 32.488372 | 125 | h |
null | systemd-main/src/shared/securebits-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdio.h>
#include "alloc-util.h"
#include "extract-word.h"
#include "securebits-util.h"
#include "string-util.h"
int secure_bits_to_string_alloc(int i, char **s) {
_cleanup_free_ char *str = NULL;
size_t len;
int r;... | 2,219 | 32.134328 | 97 | c |
null | systemd-main/src/shared/securebits-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "missing_securebits.h"
int secure_bits_to_string_alloc(int i, char **s);
int secure_bits_from_string(const char *s);
static inline bool secure_bits_is_valid(int i) {
return ((SECURE_ALL_BITS | SECURE_ALL_LOCKS) & i) ... | 528 | 24.190476 | 75 | h |
null | systemd-main/src/shared/selinux-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <fcntl.h>
#include <stdbool.h>
#include <sys/socket.h>
#include <sys/types.h>
#include "macro.h"
#include "label-util.h"
#if HAVE_SELINUX
#include <selinux/selinux.h>
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, freecon, NULL);
#define _cleanup_freec... | 1,644 | 31.9 | 106 | h |
null | systemd-main/src/shared/serialize.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include "alloc-util.h"
#include "env-util.h"
#include "escape.h"
#include "fileio.h"
#include "memfd-util.h"
#include "missing_mman.h"
#include "missing_syscall.h"
#include "parse-util.h"
#include "process-util.h"
#include "serialize.h"
#include "st... | 6,006 | 25.117391 | 117 | c |
null | systemd-main/src/shared/serialize.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdio.h>
#include "fdset.h"
#include "macro.h"
#include "string-util.h"
#include "time-util.h"
int serialize_item(FILE *f, const char *key, const char *value);
int serialize_item_escaped(FILE *f, const char *key, const char *value);
int serializ... | 1,080 | 36.275862 | 90 | h |
null | systemd-main/src/shared/service-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include <stdio.h>
#include "alloc-util.h"
#include "build.h"
#include "pretty-print.h"
#include "service-util.h"
#include "terminal-util.h"
static int help(const char *program_path, const char *service, const char *description, bool bus_introspect... | 2,743 | 30.181818 | 110 | c |
null | systemd-main/src/shared/sleep-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/fiemap.h>
#include <sys/types.h>
#include "hashmap.h"
#include "time-util.h"
#define DEFAULT_SUSPEND_ESTIMATION_USEC (1 * USEC_PER_HOUR)
typedef enum SleepOperation {
SLEEP_SUSPEND,
SLEEP_HIBERNATE,
SLEEP_HYBRID_SL... | 2,631 | 29.964706 | 74 | h |
null | systemd-main/src/shared/smack-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/***
Copyright © 2013 Intel Corporation
Author: Auke Kok <auke-jan.h.kok@intel.com>
***/
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/xattr.h>
#include <unistd.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "fd-util.h"
#in... | 8,345 | 25.75 | 111 | c |
null | systemd-main/src/shared/smack-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
/***
Copyright © 2013 Intel Corporation
Author: Auke Kok <auke-jan.h.kok@intel.com>
***/
#include <stdbool.h>
#include <sys/types.h>
#include "label-util.h"
#include "macro.h"
#define SMACK_FLOOR_LABEL "_"
#define SMACK_STAR_LABEL "*"
typedef enum... | 1,795 | 32.259259 | 102 | h |
null | systemd-main/src/shared/socket-label.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include <sys/un.h>
#include <unistd.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "fs-util.h"
#include "log.h"
#include "macro.h"
#include "missing_socke... | 4,250 | 30.962406 | 118 | c |
null | systemd-main/src/shared/socket-netlink.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <arpa/inet.h>
#include <errno.h>
#include <net/if.h>
#include <string.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "extract-word.h"
#include "log.h"
#include "memory-util.h"
#include "netlink-util.h"
#include "parse-util.h"
#include "socket-netl... | 12,890 | 30.441463 | 108 | c |
null | systemd-main/src/shared/spawn-ask-password-agent.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include "exec-util.h"
#include "log.h"
#include "process-util.h"
#include "spawn-ask-password-agent.h"
static pid_t agent_pid = 0;
int ask_password_agent_open(void) {
int r;
if (agent_pid >... | 1,475 | 23.6 | 87 | c |
null | systemd-main/src/shared/spawn-polkit-agent.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <poll.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include "exec-util.h"
#include "fd-util.h"
#include "io-util.h"
#include "log.h"
#include "macro.h"
#include "process-util.h"
#include "spawn-polkit-agent.h"
#include "std... | 2,281 | 22.525773 | 95 | c |
null | systemd-main/src/shared/test-tables.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "string-util.h"
#define _test_table(name, lookup, reverse, size, sparse) \
for (int64_t _i = -EINVAL, _boring = 0; _i < siz... | 2,434 | 54.340909 | 104 | h |
null | systemd-main/src/shared/tests.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sched.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/wait.h>
#include "sd-bus.h"
#include "alloc-util.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "bus-wait-for-jobs.... | 11,273 | 30.579832 | 118 | c |
null | systemd-main/src/shared/tests.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "sd-daemon.h"
#include "argv-util.h"
#include "macro.h"
#include "static-destruct.h"
#include "strv.h"
static inline bool manager_errno_skip_test(int r) {
return IN_SET(abs(r),
EPERM,
... | 6,161 | 38 | 105 | h |
null | systemd-main/src/shared/tmpfile-util-label.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/stat.h>
#include "selinux-util.h"
#include "tmpfile-util-label.h"
#include "tmpfile-util.h"
int fopen_temporary_at_label(
int dir_fd,
const char *target,
const char *path,
FILE **f,
... | 681 | 21 | 72 | c |
null | systemd-main/src/shared/tmpfile-util-label.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <fcntl.h>
#include <stdio.h>
/* These functions are split out of tmpfile-util.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
* t... | 656 | 42.8 | 108 | h |
null | systemd-main/src/shared/udev-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if HAVE_SYS_SDT_H
#define SDT_USE_VARIADIC
#include <sys/sdt.h>
#endif
#include "sd-device.h"
#include "time-util.h"
#define UDEV_NAME_SIZE 512
#define UDEV_PATH_SIZE 1024
#define UDEV_LINE_SIZE 16384
typedef enum ResolveNameTiming {
RESOLVE... | 3,533 | 40.093023 | 115 | h |
null | systemd-main/src/shared/user-record-nss.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <grp.h>
#include <gshadow.h>
#include <pwd.h>
#include <shadow.h>
#include "group-record.h"
#include "user-record.h"
/* Synthesize UserRecord and GroupRecord objects from NSS data */
int nss_passwd_to_user_record(const struct passwd *pwd, const ... | 965 | 37.64 | 99 | h |
null | systemd-main/src/shared/user-record.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <inttypes.h>
#include <sys/types.h>
#include "sd-id128.h"
#include "json.h"
#include "missing_resource.h"
#include "time-util.h"
typedef enum UserDisposition {
USER_INTRINSIC, /* root and nobody */
USER_SYSTEM, /* statical... | 18,905 | 40.920177 | 130 | h |
null | systemd-main/src/shared/userdb-dropin.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "errno-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "path-util.h"
#include "stdio-util.h"
#include "user-util.h"
#include "userdb-dropin.h"
static int load_user(
FILE *f,
const char *path,
... | 10,440 | 33.232787 | 130 | c |
null | systemd-main/src/shared/userdb-dropin.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "constants.h"
#include "group-record.h"
#include "user-record.h"
#include "userdb.h"
/* This could be put together with CONF_PATHS_NULSTR, with the exception of the /run/host/ part in the
* middle, which we use here, but not otherwise. */
#define... | 1,063 | 43.333333 | 106 | h |
null | systemd-main/src/shared/userdb.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/socket.h>
#include <sys/un.h>
#include "group-record.h"
#include "user-record.h"
/* Inquire local services for user/group records */
typedef struct UserDBIterator UserDBIterator;
UserDBIterator *userdb_iterator_free(UserDBIterator *iterato... | 2,597 | 43.033898 | 120 | h |
null | systemd-main/src/shared/utmp-wtmp.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <utmpx.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "fd-util.h"... | 11,668 | 27.391727 | 114 | c |
null | systemd-main/src/shared/utmp-wtmp.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <sys/types.h>
#include "time-util.h"
#if ENABLE_UTMP
#include <utmpx.h>
int utmp_get_runlevel(int *runlevel, int *previous);
int utmp_put_shutdown(void);
int utmp_put_reboot(usec_t timestamp);
int utmp_put_runlevel(int runl... | 1,845 | 26.552239 | 128 | h |
null | systemd-main/src/shared/verb-log-control.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "bus-error.h"
#include "log.h"
#include "strv.h"
#include "syslog-util.h"
#include "verb-log-control.h"
int verb_log_control_common(sd_bus *bus, const char *destination, const char *verb, const char *value) {
_cleanup_(sd_bus_er... | 2,071 | 38.846154 | 104 | c |
null | systemd-main/src/shared/verbs.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <getopt.h>
#include <stdbool.h>
#include <stddef.h>
#include "env-util.h"
#include "log.h"
#include "macro.h"
#include "process-util.h"
#include "string-util.h"
#include "verbs.h"
#include "virt.h"
/* Wraps running_in_chroot() which is used... | 3,909 | 33.60177 | 118 | c |
null | systemd-main/src/shared/verbs.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#define VERB_ANY (UINT_MAX)
typedef enum VerbFlags {
VERB_DEFAULT = 1 << 0, /* The verb to run if no verb is specified */
VERB_ONLINE_ONLY = 1 << 1, /* Just do nothing when running in chroot or offline */
} Ver... | 703 | 28.333333 | 92 | h |
null | systemd-main/src/shared/vlan-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "conf-parser.h"
#include "parse-util.h"
#include "string-util.h"
#include "vlan-util.h"
int parse_vlanid(const char *p, uint16_t *ret) {
uint16_t id;
int r;
assert(p);
assert(ret);
r = safe_atou16(p, &id);
if (... | 2,565 | 24.919192 | 98 | c |
null | systemd-main/src/shared/vlan-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <inttypes.h>
#include "conf-parser.h"
#define VLANID_MAX 4094
#define VLANID_INVALID UINT16_MAX
/* Note that we permit VLAN Id 0 here, as that is apparently OK by the Linux kernel */
static inline bool vlanid_is_valid(uint16... | 589 | 25.818182 | 86 | h |
null | systemd-main/src/shared/volatile-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include "alloc-util.h"
#include "macro.h"
#include "parse-util.h"
#include "proc-cmdline.h"
#include "string-table.h"
#include "string-util.h"
#include "volatile-util.h"
int query_volatile_mode(VolatileMode *ret) {
_cleanup_free_ char *mode... | 1,138 | 23.234043 | 89 | c |
null | systemd-main/src/shared/watchdog.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "time-util.h"
const char *watchdog_get_device(void);
usec_t watchdog_get_last_ping(clockid_t clock);
int watchdog_set_device(const char *path);
int watchdog_setup(usec_t timeout);
int watchdog_setup_pretimeout(usec_t usec);
... | 570 | 24.954545 | 61 | h |
null | systemd-main/src/shared/wifi-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "log.h"
#include "string-table.h"
#include "string-util.h"
#include "wifi-util.h"
int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *ret_iftype, char **ret_ssid) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NUL... | 14,205 | 45.273616 | 118 | c |
null | systemd-main/src/shared/wifi-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/nl80211.h>
#include "sd-netlink.h"
#include "ether-addr-util.h"
int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *ret_iftype, char **ret_ssid);
int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_add... | 532 | 30.352941 | 104 | h |
null | systemd-main/src/shared/xml.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stddef.h>
#include "macro.h"
#include "string-util.h"
#include "xml.h"
enum {
STATE_NULL,
STATE_TEXT,
STATE_TAG,
STATE_ATTRIBUTE,
};
static void inc_lines(unsigned *line, const char *s, size_t n) {
... | 7,229 | 29.378151 | 126 | c |
null | systemd-main/src/shared/linux/auto_dev-ioctl.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* Copyright 2008 Red Hat, Inc. All rights reserved.
* Copyright 2008 Ian Kent <raven@themaw.net>
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, a... | 5,040 | 21.809955 | 73 | h |
null | systemd-main/src/shared/linux/bpf_common.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __LINUX_BPF_COMMON_H__
#define __LINUX_BPF_COMMON_H__
/* Instruction classes */
#define BPF_CLASS(code) ((code) & 0x07)
#define BPF_LD 0x00
#define BPF_LDX 0x01
#define BPF_ST 0x02
#define BPF_STX 0x03
#define BPF_ALU 0x04
#define BPF_JM... | 1,367 | 22.586207 | 62 | h |
null | systemd-main/src/shared/linux/bpf_insn.h | /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/* eBPF instruction mini library */
#ifndef __BPF_INSN_H
#define __BPF_INSN_H
struct bpf_insn;
/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
#define BPF_ALU64_REG(OP, DST, SRC) \
((struct bpf_insn) { \
.code = BPF_ALU64 | BPF_... | 6,606 | 26.301653 | 85 | h |
null | systemd-main/src/shared/linux/dm-ioctl.h | /* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */
/*
* Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.
* Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved.
*
* This file is released under the LGPL.
*/
#ifndef _LINUX_DM_IOCTL_V4_H
#define _LINUX_DM_IOCTL_V4_H
#include <linux/type... | 11,598 | 29.049223 | 89 | h |
null | systemd-main/src/shutdown/detach-dm.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/***
Copyright © 2010 ProFUSION embedded systems
***/
#include <linux/dm-ioctl.h>
#include <sys/ioctl.h>
#include "sd-device.h"
#include "alloc-util.h"
#include "blockdev-util.h"
#include "detach-dm.h"
#include "device-util.h"
#include "devnum-util.h"
#include "errn... | 4,574 | 26.232143 | 112 | c |
null | systemd-main/src/shutdown/detach-md.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/***
Copyright © 2010 ProFUSION embedded systems
***/
#include <linux/major.h>
#include <linux/raid/md_u.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "sd-device.h"
#include "alloc-util.h"
#include "blockdev-util.h"
#include "detach-md.h"
#include "device-u... | 4,943 | 27.090909 | 110 | c |
null | systemd-main/src/shutdown/detach-swap.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/***
Copyright © 2010 ProFUSION embedded systems
***/
#include <sys/swap.h>
#include "alloc-util.h"
#include "detach-swap.h"
#include "libmount-util.h"
static void swap_device_free(SwapDevice **head, SwapDevice *m) {
assert(head);
assert(m);
... | 2,948 | 25.567568 | 114 | c |
null | systemd-main/src/shutdown/test-umount.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "detach-swap.h"
#include "errno-util.h"
#include "log.h"
#include "path-util.h"
#include "string-util.h"
#include "tests.h"
#include "umount.h"
static void test_mount_points_list_one(const char *fname) {
_cleanup_(mount_points_l... | 2,179 | 30.594203 | 80 | c |
null | systemd-main/src/shutdown/umount.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
/***
Copyright © 2010 ProFUSION embedded systems
***/
#include <stdbool.h>
#include "list.h"
int umount_all(bool *changed, bool last_try);
/* This is exported just for testing */
typedef struct MountPoint {
char *path;
char *remount_op... | 625 | 22.185185 | 68 | h |
null | systemd-main/src/socket-activate/socket-activate.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include <sys/epoll.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <unistd.h>
#include "sd-daemon.h"
#include "alloc-util.h"
#include "build.h"
#include "env-util.h"
#include "errno-util.h"
#include "escape.h"
#include "fd-util.h"
#includ... | 17,191 | 33.66129 | 126 | c |
null | systemd-main/src/socket-proxy/socket-proxyd.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/un.h>
#include <unistd.h>
#include "sd-daemon.h"
#include "sd-event.h"
#include "sd-resolve.h"
#include "alloc-util.h"
#include "build.h"
... | 23,186 | 31.070539 | 127 | c |
null | systemd-main/src/stdio-bridge/stdio-bridge.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <getopt.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include "sd-bus.h"
#include "sd-daemon.h"
#include "alloc-util.h"
#include "build.h"
#include "bus-internal.h"
#include "bus-util.h"
#include "errno-util.h"
#include "i... | 8,601 | 32.601563 | 109 | c |
null | systemd-main/src/sulogin-shell/sulogin-shell.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/***
Copyright © 2017 Felipe Sateler
***/
#include <errno.h>
#include <sys/prctl.h>
#include "sd-bus.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-unit-util.h"
#include "bus-util.h"
#include "constants.h"
#include "env-util.h"
#include "initrd-uti... | 5,103 | 31.303797 | 123 | c |
null | systemd-main/src/sysctl/sysctl.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "build.h"
#include "conf-files.h"
#include "constants.h"
#include "creds-util.h"
#include "errno... | 16,585 | 32.238477 | 121 | c |
null | systemd-main/src/system-update-generator/system-update-generator.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <unistd.h>
#include "fs-util.h"
#include "generator.h"
#include "initrd-util.h"
#include "log.h"
#include "path-util.h"
#include "proc-cmdline.h"
#include "special.h"
#include "string-util.h"
#include "unit-file.h"
/*
* Implements the logi... | 2,562 | 29.879518 | 115 | c |
null | systemd-main/src/systemctl/fuzz-systemctl-parse-argv.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include <unistd.h>
#include "env-util.h"
#include "fd-util.h"
#include "fuzz.h"
#include "nulstr-util.h"
#include "selinux-util.h"
#include "static-destruct.h"
#include "stdio-util.h"
#include "strv.h"
#include "systemctl.h"
#include "systemctl-util... | 2,919 | 36.922078 | 109 | c |
null | systemd-main/src/systemctl/systemctl-cancel-job.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "parse-util.h"
#include "systemctl-cancel-job.h"
#include "systemctl-trivial-method.h"
#include "systemctl-util.h"
#include "systemctl.h"
int verb_cancel(int argc, char *argv[], void *userdata) {
sd_bus *... | 1,335 | 30.069767 | 115 | c |
null | systemd-main/src/systemctl/systemctl-clean-or-freeze.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-wait-for-units.h"
#include "systemctl-clean-or-freeze.h"
#include "systemctl-util.h"
#include "systemctl.h"
int verb_clean_or_freeze(int argc, char *argv[], void *userdata) {
_cleanup_(bus_wait_for_u... | 3,748 | 36.118812 | 130 | c |
null | systemd-main/src/systemctl/systemctl-compat-halt.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include <unistd.h>
#include "sd-daemon.h"
#include "alloc-util.h"
#include "pretty-print.h"
#include "process-util.h"
#include "reboot-util.h"
#include "systemctl-compat-halt.h"
#include "systemctl-compat-telinit.h"
#include "systemctl-logind.h"
#... | 7,379 | 35.176471 | 120 | c |
null | systemd-main/src/systemctl/systemctl-compat-runlevel.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include "alloc-util.h"
#include "pretty-print.h"
#include "systemctl-compat-runlevel.h"
#include "systemctl.h"
#include "terminal-util.h"
#include "utmp-wtmp.h"
static int runlevel_help(void) {
_cleanup_free_ char *link = NULL;
int... | 2,026 | 23.421687 | 85 | c |
null | systemd-main/src/systemctl/systemctl-compat-shutdown.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include "alloc-util.h"
#include "pretty-print.h"
#include "reboot-util.h"
#include "systemctl-compat-shutdown.h"
#include "systemctl-sysv-compat.h"
#include "systemctl.h"
#include "terminal-util.h"
static int shutdown_help(void) {
_cleanup... | 5,586 | 33.91875 | 106 | c |
null | systemd-main/src/systemctl/systemctl-compat-telinit.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include <unistd.h>
#include "alloc-util.h"
#include "pretty-print.h"
#include "rlimit-util.h"
#include "systemctl-compat-telinit.h"
#include "systemctl-daemon-reload.h"
#include "systemctl-start-unit.h"
#include "systemctl-sysv-compat.h"
#include "... | 5,078 | 29.596386 | 96 | c |
null | systemd-main/src/systemctl/systemctl-daemon-reload.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "systemctl-daemon-reload.h"
#include "systemctl-util.h"
#include "systemctl.h"
int daemon_reload(enum action action, bool graceful) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
... | 2,207 | 27.675325 | 126 | c |
null | systemd-main/src/systemctl/systemctl-enable.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "locale-util.h"
#include "path-util.h"
#include "systemctl-daemon-reload.h"
#include "systemctl-enable.h"
#include "systemctl-start-unit.h"
#include "systemctl-sysv-compat.h"
#include "systemctl-util.h"
#include "... | 14,056 | 42.119632 | 132 | c |
null | systemd-main/src/systemctl/systemctl-is-active.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "pretty-print.h"
#include "syslog-util.h"
#include "systemctl-is-active.h"
#include "systemctl-sysv-compat.h"
#include "systemctl-util.h"
#include "systemctl.h"
static int check_unit_generic(int code, const UnitA... | 2,427 | 32.260274 | 116 | c |
null | systemd-main/src/systemctl/systemctl-is-enabled.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "systemctl-is-enabled.h"
#include "systemctl-sysv-compat.h"
#include "systemctl-util.h"
#include "systemctl.h"
static int show_installation_targets_client_side(const char *name) {
InstallChange *changes =... | 6,053 | 37.316456 | 122 | c |
null | systemd-main/src/systemctl/systemctl-is-system-running.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-event.h"
#include "sd-daemon.h"
#include "systemctl-util.h"
#include "systemctl-is-system-running.h"
#include "virt.h"
#include "systemctl.h"
#include "bus-util.h"
#include "bus-locator.h"
#include "bus-error.h"
static int match_startup_finished(sd_bus_me... | 2,911 | 34.084337 | 108 | c |
null | systemd-main/src/systemctl/systemctl-kill.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "systemctl-kill.h"
#include "systemctl-util.h"
#include "systemctl.h"
int verb_kill(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **names = NULL;
const char *kill_whom;
... | 2,044 | 33.661017 | 110 | c |
null | systemd-main/src/systemctl/systemctl-list-dependencies.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "locale-util.h"
#include "sort-util.h"
#include "special.h"
#include "systemctl-list-dependencies.h"
#include "systemctl-util.h"
#include "systemctl.h"
#include "terminal-util.h"
static int list_dependencies_print(const char *name, UnitActiveState state, int l... | 6,252 | 30.741117 | 131 | c |
null | systemd-main/src/systemctl/systemctl-list-jobs.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "locale-util.h"
#include "systemctl-list-jobs.h"
#include "systemctl-util.h"
#include "systemctl.h"
#include "terminal-util.h"
static int output_waiting_jobs(sd_bus *bus, Table *table, uint32_t id, const char *me... | 5,820 | 32.262857 | 112 | c |
null | systemd-main/src/systemctl/systemctl-list-machines.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <unistd.h>
#include "sd-login.h"
#include "bus-map-properties.h"
#include "hostname-util.h"
#include "locale-util.h"
#include "memory-util.h"
#include "sort-util.h"
#include "systemctl-list-machines.h"
#include "systemctl-util.h"
#include "systemctl.h"
#inclu... | 8,135 | 31.806452 | 111 | c |
null | systemd-main/src/systemctl/systemctl-list-machines.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <inttypes.h>
#include <stdbool.h>
#include "bus-map-properties.h"
#include "time-util.h"
int verb_list_machines(int argc, char *argv[], void *userdata);
struct machine_info {
bool is_host;
char *name;
char *version;
... | 625 | 21.357143 | 67 | h |
null | systemd-main/src/systemctl/systemctl-log-setting.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "pretty-print.h"
#include "syslog-util.h"
#include "systemctl-log-setting.h"
#include "systemctl-util.h"
#include "systemctl.h"
#include "verb-log-control.h"
static void give_log_control1_hint(const char *name) {... | 3,130 | 31.278351 | 109 | c |
null | systemd-main/src/systemctl/systemctl-reset-failed.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "systemctl-reset-failed.h"
#include "systemctl-trivial-method.h"
#include "systemctl-util.h"
#include "systemctl.h"
int verb_reset_failed(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char... | 1,328 | 31.414634 | 127 | c |
null | systemd-main/src/systemctl/systemctl-service-watchdogs.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "parse-util.h"
#include "systemctl-service-watchdogs.h"
#include "systemctl-util.h"
#include "systemctl.h"
int verb_service_watchdogs(int argc, char *argv[], void *userdata) {
sd_bus *bus;
_cleanu... | 1,434 | 31.613636 | 124 | c |
null | systemd-main/src/systemctl/systemctl-set-default.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "proc-cmdline.h"
#include "systemctl-daemon-reload.h"
#include "systemctl-set-default.h"
#include "systemctl-util.h"
#include "systemctl.h"
static int parse_proc_cmdline_item(const char *key, const char *value, v... | 5,529 | 33.347826 | 116 | c |
null | systemd-main/src/systemctl/systemctl-set-property.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "systemctl-set-property.h"
#include "systemctl-util.h"
#include "systemctl.h"
static int set_property_one(sd_bus *bus, const char *name, char **properties) {
_cleanup_(sd_bus_error_free) sd_bus_error erro... | 2,165 | 30.391304 | 91 | c |
null | systemd-main/src/systemctl/systemctl-start-special.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <unistd.h>
#include "bootspec.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "efivars.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "reboot-util.h"
#include "systemctl-logind.h"
#include "systemctl-start-spec... | 9,606 | 35.528517 | 128 | c |
null | systemd-main/src/systemctl/systemctl-switch-root.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "argv-util.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "chase.h"
#include "parse-util.h"
#include "path-util.h"
#include "proc-cmdline.h"
#include "signal-util.h"
#include "stat-util.h"
#include "systemctl.h"
#include "systemctl-switch-root.h"
#... | 3,935 | 35.444444 | 125 | c |
null | systemd-main/src/systemctl/systemctl-sysv-compat.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "env-util.h"
#include "fd-util.h"
#include "initreq.h"
#include "install.h"
#include "io-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "strv.h"
#include... | 8,941 | 31.398551 | 126 | c |
null | systemd-main/src/systemctl/systemctl-sysv-compat.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "time-util.h"
int talk_initctl(char runlevel);
int parse_shutdown_time_spec(const char *t, usec_t *ret);
/* The init script exit codes for the LSB 'status' verb. (This is different from the 'start' verb, whose exit
codes are defined in exit-s... | 1,338 | 30.880952 | 109 | h |
null | systemd-main/src/systemctl/systemctl-trivial-method.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-locator.h"
#include "systemctl-trivial-method.h"
#include "systemctl-util.h"
#include "systemctl.h"
/* A generic implementation for cases we just need to invoke a simple method call on the Manager object. */
int verb_trivial_method... | 1,725 | 36.521739 | 107 | c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.