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/nspawn/test-patch-uid.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdlib.h>
#include "log.h"
#include "nspawn-patch-uid.h"
#include "user-util.h"
#include "string-util.h"
#include "tests.h"
int main(int argc, char *argv[]) {
uid_t shift, range;
int r;
test_setup_logging(LOG_DEBUG);
if (arg... | 1,090 | 23.795455 | 77 | c |
null | systemd-main/src/nss-myhostname/nss-myhostname.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <net/if.h>
#include <netdb.h>
#include <nss.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "hostname-util.h"
#include "local-addresses.h"
#include "macro.h"
#include "nss-util.h"
#include "resolve-util.h"
#in... | 16,870 | 31.196565 | 128 | c |
null | systemd-main/src/nss-mymachines/nss-mymachines.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <netdb.h>
#include <nss.h>
#include <pthread.h>
#include "sd-bus.h"
#include "sd-login.h"
#include "alloc-util.h"
#include "bus-common-errors.h"
#include "bus-locator.h"
#include "env-util.h"
#include "errno-util.h"
#include "format-util.h"
#include "hostname... | 12,283 | 26.854875 | 132 | c |
null | systemd-main/src/nss-systemd/userdb-glue.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <nss.h>
#include <pwd.h>
#include <grp.h>
#include <sys/types.h>
#include "userdb.h"
UserDBFlags nss_glue_userdb_flags(void);
int nss_pack_user_record(UserRecord *hr, struct passwd *pwd, char *buffer, size_t buflen);
int nss_pack_group_record(Gr... | 1,262 | 44.107143 | 112 | h |
null | systemd-main/src/oom/oomctl.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include <unistd.h>
#include "build.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "copy.h"
#include "main-func.h"
#include "pretty-print.h"
#include "terminal-util.h"
#include "verbs.h"
static PagerFlags arg_pager_flags = 0;
static i... | 3,915 | 28.223881 | 102 | c |
null | systemd-main/src/oom/oomd-manager-bus.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <linux/capability.h>
#include "bus-common-errors.h"
#include "bus-polkit.h"
#include "data-fd-util.h"
#include "fd-util.h"
#include "oomd-manager-bus.h"
#include "oomd-manager.h"
#include "user-util.h"
static int bus_method_dump_by_fd(sd_bus_message *message,... | 1,601 | 29.226415 | 96 | c |
null | systemd-main/src/oom/oomd.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include "build.h"
#include "bus-log-control-api.h"
#include "bus-object.h"
#include "cgroup-util.h"
#include "conf-parser.h"
#include "daemon-util.h"
#include "fileio.h"
#include "log.h"
#include "main-func.h"
#include "oomd-manager-bus.h"
#include... | 6,966 | 34.186869 | 126 | c |
null | systemd-main/src/oom/test-oomd-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <unistd.h>
#include "alloc-util.h"
#include "cgroup-setup.h"
#include "cgroup-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "oomd-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"... | 22,408 | 42.597276 | 134 | c |
null | systemd-main/src/partition/growfs.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/magic.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/vfs.h>
/* This needs to be included after sys/mount.h, as since [0] linux/btrfs.h
* includes linux/fs.h... | 9,789 | 34.215827 | 126 | c |
null | systemd-main/src/partition/makefs.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include <sys/file.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
#include "blockdev-util.h"
#include "dissect-image.h"
#include "fd-util.h"
#include "main-func.h"
#include "mkfs-uti... | 2,942 | 33.623529 | 130 | c |
null | systemd-main/src/path/path.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include "sd-path.h"
#include "alloc-util.h"
#include "build.h"
#include "log.h"
#include "macro.h"
#include "main-func.h"
#include "pretty-print.h"
#include "string-util.h"
static const ch... | 9,758 | 40.351695 | 110 | c |
null | systemd-main/src/portable/portabled-bus.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "btrfs-util.h"
#include "bus-common-errors.h"
#include "bus-object.h"
#include "bus-polkit.h"
#include "discover-image.h"
#include "fd-util.h"
#include "io-util.h"
#include "missing_capability.h"
#include "portable.h"
#include "portabled... | 23,380 | 37.141925 | 130 | c |
null | systemd-main/src/portable/portabled-image.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "portable.h"
#include "portabled-image.h"
#include "portabled.h"
Image *manager_image_cache_get(Manager *m, const char *name_or_path) {
assert(m);
return hashmap_get(m->image_cache, name_or_path);
}
static int image_cache_flush(sd_event_sourc... | 2,669 | 24.92233 | 118 | c |
null | systemd-main/src/portable/portabled-operation.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <unistd.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "portabled-operation.h"
#include "process-util.h"
static int operation_done(sd_event_source *s, const siginfo_t *si, void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = S... | 3,695 | 27.430769 | 118 | c |
null | systemd-main/src/portable/portabled-operation.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/types.h>
#include "sd-bus.h"
#include "sd-event.h"
#include "list.h"
typedef struct Operation Operation;
#include "portabled.h"
#define OPERATIONS_MAX 64
struct Operation {
Manager *manager;
pid_t pid;
sd_bus_mess... | 677 | 21.6 | 105 | h |
null | systemd-main/src/portable/portabled.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/stat.h>
#include <sys/types.h>
#include "sd-bus.h"
#include "alloc-util.h"
#include "bus-log-control-api.h"
#include "bus-polkit.h"
#include "common-signal.h"
#include "constants.h"
#include "daemon-util.h"
#include "main-func.h"
#include "portabled-bus.... | 4,786 | 25.893258 | 101 | c |
null | systemd-main/src/rc-local-generator/rc-local-generator.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include "generator.h"
#include "initrd-util.h"
#include "log.h"
#include "mkdir-label.h"
#include "string-util.h"
static const char *arg_dest = NULL;
/* So you are reading this, and might wonder: why is this ... | 2,407 | 30.272727 | 121 | c |
null | systemd-main/src/remount-fs/remount-fs.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <mntent.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include "env-util.h"
#include "exit-status.h"
#include "fstab-util.h"
#include "log.h"
#include "main-func.h"
#include "mount-setup.h"
#includ... | 4,840 | 31.273333 | 124 | c |
null | systemd-main/src/reply-password/reply-password.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stddef.h>
#include <sys/un.h>
#include "alloc-util.h"
#include "main-func.h"
#include "fd-util.h"
#include "fileio.h"
#include "log.h"
#include "macro.h"
#include "memory-util.h"
#include "socket-util.h"
#include "string-util.h"
static int... | 2,439 | 29.123457 | 125 | c |
null | systemd-main/src/resolve/dns-type.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/socket.h>
#include <errno.h>
#include "dns-type.h"
#include "parse-util.h"
#include "string-util.h"
typedef const struct {
uint16_t type;
const char *name;
} dns_type;
static const struct dns_type_name *
lookup_dns_type (register const c... | 8,421 | 25.567823 | 117 | c |
null | systemd-main/src/resolve/dns-type.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "macro.h"
/* DNS record types, taken from
* http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml.
*/
enum {
/* Normal records */
DNS_TYPE_A = 0x01,
DNS_TYPE_NS,
DNS_TYPE_MD,
DNS_TYP... | 3,868 | 25.682759 | 74 | h |
null | systemd-main/src/resolve/fuzz-dns-packet.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "fuzz.h"
#include "memory-util.h"
#include "resolved-dns-packet.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
_cleanup_(dns_packet_unrefp) DnsPacket *p = NULL;
if (outside_size_range(size, 0, DNS_PACKET_SIZE_MAX))
... | 972 | 36.423077 | 85 | c |
null | systemd-main/src/resolve/fuzz-resource-record.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "fd-util.h"
#include "fuzz.h"
#include "memory-util.h"
#include "memstream-util.h"
#include "resolved-dns-packet.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
_cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL, *copy... | 1,207 | 32.555556 | 102 | c |
null | systemd-main/src/resolve/resolvconf-compat.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include <net/if.h>
#include "alloc-util.h"
#include "build.h"
#include "constants.h"
#include "dns-domain.h"
#include "extract-word.h"
#include "fileio.h"
#include "parse-util.h"
#include "pretty-print.h"
#include "resolvconf-compat.h"
#include "re... | 9,804 | 34.143369 | 118 | c |
null | systemd-main/src/resolve/resolvectl.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <in-addr-util.h>
#include <stdbool.h>
#include <sys/types.h>
typedef enum ExecutionMode {
MODE_RESOLVE_HOST,
MODE_RESOLVE_RECORD,
MODE_RESOLVE_SERVICE,
MODE_RESOLVE_OPENPGP,
MODE_RESOLVE_TLSA,
MODE_S... | 942 | 25.194444 | 68 | h |
null | systemd-main/src/resolve/resolved-bus.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "bus-object.h"
#include "resolved-manager.h"
extern const BusObjectImplementation manager_object;
int manager_connect_bus(Manager *m);
int _manager_send_changed(Manager *manager, const char *property, ...) _sentinel_;
#define manager_send_changed... | 790 | 42.944444 | 97 | h |
null | systemd-main/src/resolve/resolved-conf.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "conf-parser.h"
#include "resolved-dns-server.h"
int manager_parse_config_file(Manager *m);
int manager_parse_search_domains_and_warn(Manager *m, const char *string);
int manager_parse_dns_server_string_and_warn(Manager *m, DnsServerType type, c... | 927 | 39.347826 | 97 | h |
null | systemd-main/src/resolve/resolved-dns-answer.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include "alloc-util.h"
#include "dns-domain.h"
#include "random-util.h"
#include "resolved-dns-answer.h"
#include "resolved-dns-dnssec.h"
#include "string-util.h"
static DnsAnswerItem *dns_answer_item_free(DnsAnswerItem *item) {
if (!item)
... | 23,835 | 27.009401 | 119 | c |
null | systemd-main/src/resolve/resolved-dns-cache.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "hashmap.h"
#include "list.h"
#include "prioq.h"
#include "resolve-util.h"
#include "resolved-dns-dnssec.h"
#include "time-util.h"
typedef struct DnsCache {
Hashmap *by_key;
Prioq *by_expiry;
unsigned n_hit;
unsigne... | 1,832 | 29.04918 | 130 | h |
null | systemd-main/src/resolve/resolved-dns-search-domain.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "dns-domain.h"
#include "resolved-dns-search-domain.h"
#include "resolved-link.h"
#include "resolved-manager.h"
int dns_search_domain_new(
Manager *m,
DnsSearchDomain **ret,
DnsSearchDomai... | 5,006 | 24.035 | 93 | c |
null | systemd-main/src/resolve/resolved-dns-search-domain.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "list.h"
#include "macro.h"
typedef struct DnsSearchDomain DnsSearchDomain;
typedef struct Link Link;
typedef struct Manager Manager;
typedef enum DnsSearchDomainType {
DNS_SEARCH_DOMAIN_SYSTEM,
DNS_SEARCH_DOMAIN_LINK,
} DnsSearch... | 1,505 | 25.421053 | 92 | h |
null | systemd-main/src/resolve/resolved-dns-stream.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <netinet/tcp.h>
#include <unistd.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "io-util.h"
#include "macro.h"
#include "missing_network.h"
#include "resolved-dns-stream.h"
#include "resolved-manager.h"
#define DNS_STREAMS_MAX 128
#define DNS_QUERI... | 21,824 | 35.619128 | 133 | c |
null | systemd-main/src/resolve/resolved-dns-stream.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-event.h"
#include "ordered-set.h"
#include "socket-util.h"
typedef struct DnsServer DnsServer;
typedef struct DnsStream DnsStream;
typedef struct DnsTransaction DnsTransaction;
typedef struct Manager Manager;
typedef struct DnsStubListenerExt... | 4,176 | 31.379845 | 108 | h |
null | systemd-main/src/resolve/resolved-dns-stub.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "hash-funcs.h"
typedef struct DnsStubListenerExtra DnsStubListenerExtra;
typedef enum DnsStubListenerMode {
DNS_STUB_LISTENER_NO,
DNS_STUB_LISTENER_UDP = 1 << 0,
DNS_STUB_LISTENER_TCP = 1 << 1,
DNS_STUB_LISTENER_YE... | 1,409 | 27.77551 | 78 | h |
null | systemd-main/src/resolve/resolved-dns-transaction.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-event.h"
#include "in-addr-util.h"
typedef struct DnsTransaction DnsTransaction;
typedef struct DnsTransactionFinder DnsTransactionFinder;
typedef enum DnsTransactionState DnsTransactionState;
typedef enum DnsTransactionSource DnsTransactionSo... | 8,011 | 35.752294 | 129 | h |
null | systemd-main/src/resolve/resolved-dns-trust-anchor.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
typedef struct DnsTrustAnchor DnsTrustAnchor;
#include "hashmap.h"
#include "resolved-dns-answer.h"
#include "resolved-dns-rr.h"
/* This contains a fixed database mapping domain names to DS or DNSKEY records. */
struct DnsTrustAnchor {
Hashmap *p... | 847 | 31.615385 | 103 | h |
null | systemd-main/src/resolve/resolved-dns-zone.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "hashmap.h"
typedef struct DnsZone {
Hashmap *by_key;
Hashmap *by_name;
} DnsZone;
typedef struct DnsZoneItem DnsZoneItem;
typedef enum DnsZoneItemState DnsZoneItemState;
#include "resolved-dns-answer.h"
#include "resolved-dns-qu... | 1,929 | 26.571429 | 120 | h |
null | systemd-main/src/resolve/resolved-dnssd.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "conf-files.h"
#include "conf-parser.h"
#include "constants.h"
#include "resolved-dnssd.h"
#include "resolved-dns-rr.h"
#include "resolved-manager.h"
#include "resolved-conf.h"
#include "specifier.h"
#include "strv.h"
#define DNSSD_SERVICE_DIRS ((const char* c... | 11,328 | 30.209366 | 123 | c |
null | systemd-main/src/resolve/resolved-dnssd.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "list.h"
typedef struct DnssdService DnssdService;
typedef struct DnssdTxtData DnssdTxtData;
typedef struct Manager Manager;
typedef struct DnsResourceRecord DnsResourceRecord;
typedef struct DnsTxtItem DnsTxtItem;
enum {
DNS_TXT_ITEM_T... | 1,729 | 26.903226 | 111 | h |
null | systemd-main/src/resolve/resolved-dnstls-gnutls.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#if !ENABLE_DNS_OVER_TLS || !DNS_OVER_TLS_USE_GNUTLS
#error This source file requires DNS-over-TLS to be enabled and GnuTLS to be available.
#endif
#include <gnutls/socket.h>
#include "io-util.h"
#include "resolved-dns-stream.h"
#include "resolved-dnstls.h"
#include "... | 9,487 | 36.354331 | 134 | c |
null | systemd-main/src/resolve/resolved-dnstls-gnutls.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if !ENABLE_DNS_OVER_TLS || !DNS_OVER_TLS_USE_GNUTLS
#error This source file requires DNS-over-TLS to be enabled and GnuTLS to be available.
#endif
#include <gnutls/gnutls.h>
#include <stdbool.h>
struct DnsTlsManagerData {
gnutls_certificate_crede... | 562 | 21.52 | 87 | h |
null | systemd-main/src/resolve/resolved-dnstls.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if ENABLE_DNS_OVER_TLS
#include <stdint.h>
#include <sys/uio.h>
typedef struct DnsServer DnsServer;
typedef struct DnsStream DnsStream;
typedef struct DnsTlsManagerData DnsTlsManagerData;
typedef struct DnsTlsServerData DnsTlsServerData;
typedef struct D... | 1,180 | 29.282051 | 88 | h |
null | systemd-main/src/resolve/resolved-etc-hosts.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "resolved-manager.h"
#include "resolved-dns-question.h"
#include "resolved-dns-answer.h"
typedef struct EtcHostsItemByAddress {
struct in_addr_data address;
Set *names;
const char *canonical_name;
} EtcHostsItemByAddress;
... | 630 | 25.291667 | 77 | h |
null | systemd-main/src/resolve/resolved-link-bus.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "bus-util.h"
#include "resolved-link.h"
extern const BusObjectImplementation link_object;
char *link_bus_path(const Link *link);
int bus_link_method_set_dns_servers(sd_bus_message *message, void *userdata, sd_bus_error *erro... | 1,208 | 51.565217 | 116 | h |
null | systemd-main/src/resolve/resolved-link.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/stat.h>
#include "sd-netlink.h"
#include "in-addr-util.h"
#include "network-util.h"
#include "ratelimit.h"
#include "resolve-util.h"
typedef struct Link Link;
typedef struct LinkAddress LinkAddress;
#include "resolved-dns-rr.h"
#include "r... | 3,557 | 26.796875 | 88 | h |
null | systemd-main/src/resolve/resolved-resolv-conf.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "resolved-manager.h"
int manager_check_resolv_conf(const Manager *m);
int manager_read_resolv_conf(Manager *m);
int manager_write_resolv_conf(Manager *m);
typedef enum ResolvConfMode {
RESOLV_CONF_UPLINK,
RESOLV_CONF_STUB,
... | 656 | 26.375 | 66 | h |
null | systemd-main/src/resolve/resolved-socket-graveyard.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "resolved-socket-graveyard.h"
#define SOCKET_GRAVEYARD_USEC (5 * USEC_PER_SEC)
#define SOCKET_GRAVEYARD_MAX 100
/* This implements a socket "graveyard" for UDP sockets. If a socket fd is added to the graveyard it is kept
* open for a couple of more seconds, ... | 4,764 | 35.098485 | 109 | c |
null | systemd-main/src/resolve/resolved-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "dns-def.h"
#include "dns-domain.h"
#include "hostname-util.h"
#include "idn-util.h"
#include "resolved-util.h"
#include "utf8.h"
int resolve_system_hostname(char **full_hostname, char **first_label) {
_cleanup_free_ char *h = NULL, *n = NULL;
#if HAVE... | 2,919 | 33.352941 | 99 | c |
null | systemd-main/src/resolve/resolved.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-daemon.h"
#include "sd-event.h"
#include "bus-log-control-api.h"
#include "capability-util.h"
#include "daemon-util.h"
#include "main-func.h"
#include "mkdir-label.h"
#include "resolved-bus.... | 3,662 | 35.63 | 122 | c |
null | systemd-main/src/resolve/test-dnssec-complex.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <netinet/ip.h>
#include "sd-bus.h"
#include "af-list.h"
#include "alloc-util.h"
#include "bus-common-errors.h"
#include "bus-locator.h"
#include "dns-type.h"
#include "random-util.h"
#include "resolved-def.h"
#include "string-util.h"
#include "time-util.h"
s... | 9,263 | 42.492958 | 117 | c |
null | systemd-main/src/resolve/test-resolve-tables.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "dns-type.h"
#include "resolved-dns-dnssec.h"
#include "resolved-dns-packet.h"
#include "test-tables.h"
int main(int argc, char **argv) {
uint16_t i;
test_table(dns_protocol, DNS_PROTOCOL);
test_table(dnssec_result, DNSSEC_RESULT);
... | 2,156 | 38.218182 | 97 | c |
null | systemd-main/src/resolve/test-resolved-etc-hosts.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <arpa/inet.h>
#include <malloc.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "log.h"
#include "resolved-etc-hosts.h"
#include "strv.h"
#include "tests.h"
#include "tmpfile-util.h"
TES... | 5,968 | 37.509677 | 115 | c |
null | systemd-main/src/resolve/test-resolved-packet.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "log.h"
#include "resolved-dns-packet.h"
#include "tests.h"
TEST(dns_packet_new) {
size_t i;
_cleanup_(dns_packet_unrefp) DnsPacket *p2 = NULL;
for (i = 0; i <= DNS_PACKET_SIZE_MAX; i++) {
_cleanup_(dns_packet_unrefp) ... | 890 | 32 | 113 | c |
null | systemd-main/src/run-generator/run-generator.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <unistd.h>
#include "alloc-util.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
#include "generator.h"
#include "glyph-util.h"
#include "mkdir.h"
#include "proc-cmdline.h"
#include "special.h"
#include "specifier.h"
#include "strv.h"
static co... | 4,646 | 32.431655 | 110 | c |
null | systemd-main/src/shared/acl-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "acl-util.h"
#include "alloc-util.h"
#include "errno-util.h"
#include "string-util.h"
#include "strv.h"
#include "user-util.h"
#if HAVE_ACL
int acl_find_uid(acl_t acl, uid_t... | 18,388 | 27.160796 | 119 | c |
null | systemd-main/src/shared/acl-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <errno.h>
#include <unistd.h>
int fd_acl_make_read_only_fallback(int fd);
int fd_acl_make_writable_fallback(int fd);
#if HAVE_ACL
#include <acl/libacl.h>
#include <stdbool.h>
#include <sys/acl.h>
#include "macro.h"
int acl_find_uid(acl_t acl, u... | 1,780 | 28.196721 | 79 | h |
null | systemd-main/src/shared/acpi-fpdt.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include "acpi-fpdt.h"
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "time-util.h"
struct acpi_table_header {
char... | 5,688 | 29.260638 | 108 | c |
null | systemd-main/src/shared/apparmor-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stddef.h>
#include "alloc-util.h"
#include "apparmor-util.h"
#include "fileio.h"
#include "parse-util.h"
bool mac_apparmor_use(void) {
static int cached_use = -1;
if (cached_use < 0) {
_cleanup_free_ char *p = NULL;
... | 525 | 21.869565 | 97 | c |
null | systemd-main/src/shared/async.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stddef.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <unistd.h>
#include "async.h"
#include "errno-util.h"
#include "fd-util.h"
#include "log.h"
#include "macro.h"
#include "process-util.h"
#include "signal-util.h"
int asynchron... | 5,367 | 37.898551 | 121 | c |
null | systemd-main/src/shared/async.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/types.h>
#include "macro.h"
#include "rm-rf.h"
/* These functions implement various potentially slow operations that are executed asynchronously. They are
* carefully written to not use pthreads, but use fork() or clone() (without CLONE_VM)... | 1,327 | 48.185185 | 109 | h |
null | systemd-main/src/shared/barrier.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/eventfd.h>
#include <sys/types.h>
#include <unistd.h>
#include "barrier.h"
#include "errno-util.h"
#include "fd-util.h"
#include "io-util.h"
#include "macro... | 14,504 | 35.721519 | 80 | c |
null | systemd-main/src/shared/barrier.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include "macro.h"
/* See source file for an API description. */
typedef struct Barrier Barrier;
enum {
BARRIER_SINGLE = 1LL,
BARRIER_ABORTION ... | 1,903 | 24.386667 | 83 | h |
null | systemd-main/src/shared/base-filesystem.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <syslog.h>
#include <unistd.h>
#include "alloc-util.h"
#include "architecture.h"
#include "base-filesystem.h"
#include "errno-util.h"
#include "fd-util.h"
#inc... | 8,965 | 41.492891 | 123 | c |
null | systemd-main/src/shared/binfmt-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/vfs.h>
#include "binfmt-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "missing_magic.h"
#include "stat-util.h"
int binfmt_mounted(void) {
_cle... | 1,688 | 29.160714 | 107 | c |
null | systemd-main/src/shared/bitmap.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "alloc-util.h"
#include "bitmap.h"
#include "hashmap.h"
#include "macro.h"
#include "memory-util.h"
/* Bitmaps are only meant to store relatively small numbers
... | 4,862 | 21.938679 | 90 | c |
null | systemd-main/src/shared/bitmap.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "hashmap.h"
#include "macro.h"
typedef struct Bitmap {
uint64_t *bitmaps;
size_t n_bitmaps;
} Bitmap;
Bitmap* bitmap_new(void);
Bitmap* bitmap_copy(Bitmap *b);
int bitmap_ensure_allocated(Bitmap **b);
Bitmap*... | 957 | 24.891892 | 73 | h |
null | systemd-main/src/shared/blkid-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if HAVE_BLKID
# include <blkid.h>
# include "sd-id128.h"
# include "macro.h"
# include "string-util.h"
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(blkid_probe, blkid_free_probe, NULL);
static inline int blkid_partition_get_uuid_id128(blkid_partition p, sd_id1... | 1,199 | 24 | 106 | h |
null | systemd-main/src/shared/blockdev-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <linux/blkpg.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <unistd.h>
#include "sd-device.h"
#include "alloc-util.h"
#include "blockdev-util.h"
#include "btrfs-util.h"
#include "device-util.h"
#include "devnum-util.h"
#includ... | 24,328 | 28.347407 | 130 | c |
null | systemd-main/src/shared/blockdev-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/types.h>
#include "sd-device.h"
#include "macro.h"
#include "stdio-util.h"
#include "string-util.h"
#define SYS_BLOCK_PATH_MAX(suffix) \
(STRLEN("/sys/dev/block/") + DECIMAL_STR_MAX(dev_t) + 1 + ... | 2,592 | 41.508197 | 110 | h |
null | systemd-main/src/shared/bond-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bond-util.h"
#include "string-table.h"
static const char* const bond_mode_table[_NETDEV_BOND_MODE_MAX] = {
[NETDEV_BOND_MODE_BALANCE_RR] = "balance-rr",
[NETDEV_BOND_MODE_ACTIVE_BACKUP] = "active-backup",
[NETDEV_BOND_MODE_BALANCE_XOR]... | 2,888 | 38.040541 | 91 | c |
null | systemd-main/src/shared/bond-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <netinet/in.h>
#include <linux/if_bonding.h>
#include "macro.h"
/*
* Maximum number of targets supported by the kernel for a single
* bond netdev.
*/
#define NETDEV_BOND_ARP_TARGETS_MAX 16
typedef enum BondMode {
NETDEV_BOND_MODE_BALA... | 3,970 | 36.11215 | 76 | h |
null | systemd-main/src/shared/boot-entry.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "boot-entry.h"
#include "chase.h"
#include "fd-util.h"
#include "fileio.h"
#include "id128-util.h"
#include "os-util.h"
#include "path-util.h"
#include "string-util.h"
#include "utf8.h"
bool boot_entry_token_valid(const char *p) {
return utf8_is_valid(... | 8,193 | 30.155894 | 114 | c |
null | systemd-main/src/shared/boot-entry.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "sd-id128.h"
typedef enum BootEntryTokenType {
BOOT_ENTRY_TOKEN_MACHINE_ID,
BOOT_ENTRY_TOKEN_OS_IMAGE_ID,
BOOT_ENTRY_TOKEN_OS_ID,
BOOT_ENTRY_TOKEN_LITERAL,
BOOT_ENTRY_TOKEN_AUTO,
} Boot... | 1,125 | 32.117647 | 98 | h |
null | systemd-main/src/shared/boot-timestamps.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "acpi-fpdt.h"
#include "boot-timestamps.h"
#include "efi-loader.h"
#include "macro.h"
#include "time-util.h"
int boot_timestamps(const dual_timestamp *n, dual_timestamp *firmware, dual_timestamp *loader) {
usec_t x = 0, y = 0, a;
int r;
... | 1,351 | 27.765957 | 96 | c |
null | systemd-main/src/shared/bootspec.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
#include <sys/types.h>
#include "json.h"
#include "set.h"
#include "string-util.h"
typedef enum BootEntryType {
BOOT_ENTRY_CONF, /* Boot Loader Specification Type #1 entries: *.... | 4,315 | 32.2 | 131 | h |
null | systemd-main/src/shared/bpf-compat.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
/* libbpf has been moving quickly.
* They added new symbols in the 0.x versions and shortly after removed
* deprecated symbols in 1.0.
* We only need bpf_map_create and libbpf_probe_bpf_prog_type so we work
* around the incompatibility here by:
* - de... | 2,556 | 45.490909 | 128 | h |
null | systemd-main/src/shared/bpf-dlopen.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "dlfcn-util.h"
#include "bpf-dlopen.h"
#include "log.h"
#include "strv.h"
#if HAVE_LIBBPF
/* libbpf changed types of function prototypes around, so we need to disable some type checking for older
* libbpf. We consider everything older than 0.7 too old for ac... | 6,521 | 43.367347 | 134 | c |
null | systemd-main/src/shared/bpf-dlopen.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if HAVE_LIBBPF
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
#include "bpf-compat.h"
extern struct bpf_link* (*sym_bpf_program__attach_cgroup)(const struct bpf_program *, int);
extern struct bpf_link* (*sym_bpf_program__attach_lsm)(const struct bpf_progr... | 1,618 | 45.257143 | 111 | h |
null | systemd-main/src/shared/bpf-link.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bpf-dlopen.h"
#include "bpf-link.h"
#include "serialize.h"
bool bpf_can_link_program(struct bpf_program *prog) {
_cleanup_(bpf_link_freep) struct bpf_link *link = NULL;
assert(prog);
if (dlopen_bpf() < 0)
return false... | 1,392 | 30.659091 | 109 | c |
null | systemd-main/src/shared/bpf-program.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
#include "bpf-program.h"
#include "errno-util.h"
#include "escape.h"
#include "fd-util.h"
#include "memory-util.h"
#include "missing_syscall.h"
#include "path-ut... | 16,524 | 31.149805 | 123 | c |
null | systemd-main/src/shared/bpf-program.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/bpf.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/syscall.h>
#include "fdset.h"
#include "list.h"
#include "macro.h"
typedef struct BPFProgram BPFProgram;
/* This encapsulates three different concepts: the loaded BPF program, th... | 2,695 | 39.848485 | 109 | h |
null | systemd-main/src/shared/bridge-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <netinet/in.h>
#include <linux/if_bridge.h>
#include "conf-parser.h"
typedef enum BridgeState {
NETDEV_BRIDGE_STATE_DISABLED = BR_STATE_DISABLED,
NETDEV_BRIDGE_STATE_LISTENING = BR_STATE_LISTENING,
NETDEV_BRIDGE_STATE_L... | 692 | 32 | 61 | h |
null | systemd-main/src/shared/bus-get-properties.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-get-properties.h"
#include "rlimit-util.h"
#include "stdio-util.h"
#include "string-util.h"
int bus_property_get_bool(
sd_bus *bus,
const char *path,
const char *interface,
const char *proper... | 4,592 | 26.502994 | 116 | c |
null | systemd-main/src/shared/bus-log-control-api.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "bus-get-properties.h"
#include "bus-log-control-api.h"
#include "bus-util.h"
#include "log.h"
#include "sd-bus.h"
#include "syslog-util.h"
int bus_property_get_log_level(
sd_bus *bus,
const char *path,
... | 3,406 | 28.626087 | 115 | c |
null | systemd-main/src/shared/bus-map-properties.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-map-properties.h"
#include "alloc-util.h"
#include "bus-util.h"
#include "strv.h"
#include "bus-message.h"
int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
sd_id128_t *p = userdata;
... | 7,580 | 29.083333 | 127 | c |
null | systemd-main/src/shared/bus-message-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-message-util.h"
#include "resolve-util.h"
int bus_message_read_ifindex(sd_bus_message *message, sd_bus_error *error, int *ret) {
int ifindex, r;
assert(message);
assert(ret);
assert_cc(sizeof(int) == sizeof(int32_t));
... | 5,192 | 26.919355 | 129 | c |
null | systemd-main/src/shared/bus-message-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "in-addr-util.h"
#include "socket-netlink.h"
int bus_message_read_ifindex(sd_bus_message *message, sd_bus_error *error, int *ret);
int bus_message_read_family(sd_bus_message *message, sd_bus_error *error, int *ret);
int bus_me... | 707 | 36.263158 | 128 | h |
null | systemd-main/src/shared/bus-object.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-introspect.h"
#include "bus-object.h"
#include "macro.h"
#include "string-util.h"
#include "strv.h"
int bus_add_implementation(sd_bus *bus, const BusObjectImplementation *impl, void *userdata) {
int r;
log_debug("Registering bus object im... | 6,935 | 37.966292 | 109 | c |
null | systemd-main/src/shared/bus-object.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stdio.h>
#include "sd-bus.h"
typedef struct BusObjectImplementation BusObjectImplementation;
typedef struct BusObjectVtablePair {
const sd_bus_vtable *vtable;
sd_bus_object_find_t object_find;
} BusObjectVta... | 1,154 | 32 | 93 | h |
null | systemd-main/src/shared/bus-unit-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "install.h"
#include "unit-def.h"
typedef struct UnitInfo {
const char *machine;
const char *id;
const char *description;
const char *load_state;
const char *active_state;
const ... | 1,004 | 27.714286 | 95 | h |
null | systemd-main/src/shared/bus-wait-for-jobs.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "bus-wait-for-jobs.h"
#include "set.h"
#include "bus-util.h"
#include "bus-internal.h"
#include "unit-def.h"
#include "escape.h"
#include "strv.h"
typedef struct BusWaitForJobs {
sd_bus *bus;
/* The set of jobs to wait ... | 11,753 | 34.191617 | 119 | c |
null | systemd-main/src/shared/bus-wait-for-jobs.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "macro.h"
typedef struct BusWaitForJobs BusWaitForJobs;
int bus_wait_for_jobs_new(sd_bus *bus, BusWaitForJobs **ret);
BusWaitForJobs* bus_wait_for_jobs_free(BusWaitForJobs *d);
int bus_wait_for_jobs_add(BusWaitForJobs *d, con... | 599 | 34.294118 | 106 | h |
null | systemd-main/src/shared/bus-wait-for-units.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-error.h"
#include "bus-map-properties.h"
#include "bus-wait-for-units.h"
#include "hashmap.h"
#include "string-util.h"
#include "strv.h"
#include "unit-def.h"
typedef struct WaitForItem {
BusWaitForUnits *parent;
BusWaitForUnitsFlags flag... | 12,617 | 28.550351 | 124 | c |
null | systemd-main/src/shared/calendarspec.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
/* A structure for specifying (possibly repetitive) points in calendar
* time, a la cron */
#include <stdbool.h>
#include "time-util.h"
typedef struct CalendarComponent {
int start;
int stop;
int repeat;
struct CalendarC... | 1,120 | 23.911111 | 81 | h |
null | systemd-main/src/shared/clean-ipc.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <mqueue.h>
#include <stdbool.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <unistd.h>
#include "clean-ipc.h"
#i... | 14,798 | 31.668874 | 130 | c |
null | systemd-main/src/shared/clean-ipc.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/types.h>
#include "user-util.h"
int clean_ipc_internal(uid_t uid, gid_t gid, bool rm);
/* Remove all IPC objects owned by the specified UID or GID */
int clean_ipc_by_uid(uid_t uid);
int clean_ipc_by_gid(gid_t gid);
/* Check if any IPC obj... | 507 | 27.222222 | 102 | h |
null | systemd-main/src/shared/clock-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdbool.h>
#include <time.h>
#include <linux/rtc.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include "alloc-util.h"
#include "clock-util.h"
#include "errno-util.h"
#include "fd-... | 4,951 | 28.47619 | 111 | c |
null | systemd-main/src/shared/clock-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <errno.h>
#include <time.h>
typedef enum ClockChangeDirection {
CLOCK_CHANGE_NOOP,
CLOCK_CHANGE_FORWARD,
CLOCK_CHANGE_BACKWARD,
_CLOCK_CHANGE_MAX,
_CLOCK_CHANGE_INVALID = -EINVAL,
} ClockChangeDirection;
in... | 596 | 27.428571 | 66 | h |
null | systemd-main/src/shared/common-signal.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "common-signal.h"
#include "fd-util.h"
#include "fileio.h"
#include "memstream-util.h"
#include "process-util.h"
#include "signal-util.h"
int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
struct sigrtmin18_... | 2,906 | 32.802326 | 119 | c |
null | systemd-main/src/shared/common-signal.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <syslog.h>
#include <sd-event.h>
/* All our long-running services should implement a SIGRTMIN+18 handler that can be used to trigger certain
* actions that affect service runtime. The specific action is indicated via the "value integer" you can pass
* along... | 2,442 | 40.40678 | 109 | h |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.