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/systemctl/systemctl-whoami.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "bus-error.h" #include "bus-locator.h" #include "systemctl.h" #include "systemctl-util.h" #include "systemctl-whoami.h" #include "parse-util.h" static int lookup_pid(sd_bus *bus, pid_t pid) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERR...
2,212
30.169014
122
c
null
systemd-main/src/systemctl/systemctl.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <stdbool.h> #include "bus-print-properties.h" #include "bus-util.h" #include "image-policy.h" #include "install.h" #include "output-mode.h" #include "pager.h" enum action { ACTION_SYSTEMCTL, ACTION_HALT, ACTION_POWEROFF, ...
2,880
24.723214
58
h
null
systemd-main/src/systemd/_sd-common.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdcommonhfoo #define foosdcommonhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (...
3,773
33.623853
109
h
null
systemd-main/src/systemd/sd-bus-protocol.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdbusprotocolhfoo #define foosdbusprotocolhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the Licen...
5,950
53.59633
117
h
null
systemd-main/src/systemd/sd-bus-vtable.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdbusvtablehfoo #define foosdbusvtablehfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, ...
23,074
64.183616
122
h
null
systemd-main/src/systemd/sd-daemon.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosddaemonhfoo #define foosddaemonhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (...
14,163
39.701149
134
h
null
systemd-main/src/systemd/sd-device.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosddevicehfoo #define foosddevicehfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (...
8,375
48.857143
128
h
null
systemd-main/src/systemd/sd-dhcp-client.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosddhcpclienthfoo #define foosddhcpclienthfoo /*** Copyright © 2013 Intel Corporation. All rights reserved. systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the...
19,387
54.236467
123
h
null
systemd-main/src/systemd/sd-dhcp-lease.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosddhcpleasehfoo #define foosddhcpleasehfoo /*** Copyright © 2013 Intel Corporation. All rights reserved. systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Fr...
4,393
46.247312
115
h
null
systemd-main/src/systemd/sd-dhcp-option.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosddhcpoptionhfoo #define foosddhcpoptionhfoo /*** Copyright © 2013 Intel Corporation. All rights reserved. systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the ...
1,270
31.589744
94
h
null
systemd-main/src/systemd/sd-dhcp6-client.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosddhcp6clienthfoo #define foosddhcp6clienthfoo /*** Copyright © 2014 Intel Corporation. All rights reserved. systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by t...
16,236
54.227891
100
h
null
systemd-main/src/systemd/sd-dhcp6-lease.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosddhcp6leasehfoo #define foosddhcp6leasehfoo /*** Copyright © 2014-2015 Intel Corporation. All rights reserved. systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by ...
2,425
38.770492
88
h
null
systemd-main/src/systemd/sd-dhcp6-option.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosddhcp6optionhfoo #define foosddhcp6optionhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the Licen...
1,258
32.131579
129
h
null
systemd-main/src/systemd/sd-gpt.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdgpthfoo #define foosdgpthfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at you...
23,630
67.895044
114
h
null
systemd-main/src/systemd/sd-hwdb.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdhwdbhfoo #define foosdhwdbhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at y...
1,605
33.170213
90
h
null
systemd-main/src/systemd/sd-ipv4acd.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdipv4acdfoo #define foosdipv4acdfoo /*** Copyright © 2014 Axis Communications AB. All rights reserved. systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Fre...
2,503
38.125
110
h
null
systemd-main/src/systemd/sd-ipv4ll.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdipv4llfoo #define foosdipv4llfoo /*** Copyright © 2014 Axis Communications AB. All rights reserved. systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free...
2,481
36.606061
107
h
null
systemd-main/src/systemd/sd-lldp-rx.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdlldprxhfoo #define foosdlldprxhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (...
5,187
46.163636
122
h
null
systemd-main/src/systemd/sd-lldp-tx.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdlldptxhfoo #define foosdlldptxhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (...
2,604
35.690141
91
h
null
systemd-main/src/systemd/sd-lldp.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdlldphfoo #define foosdlldphfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at y...
4,983
39.193548
77
h
null
systemd-main/src/systemd/sd-login.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdloginhfoo #define foosdloginhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at...
10,545
37.915129
107
h
null
systemd-main/src/systemd/sd-messages.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdmessageshfoo #define foosdmessageshfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or...
17,892
85.439614
120
h
null
systemd-main/src/systemd/sd-ndisc.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdndiscfoo #define foosdndiscfoo /*** Copyright © 2014 Intel Corporation. All rights reserved. systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Softwa...
5,613
40.585185
111
h
null
systemd-main/src/systemd/sd-network.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdnetworkhfoo #define foosdnetworkhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or ...
8,413
36.395556
87
h
null
systemd-main/src/systemd/sd-path.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdpathhfoo #define foosdpathhfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at y...
4,128
30.280303
103
h
null
systemd-main/src/systemd/sd-radv.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdradvfoo #define foosdradvfoo /*** Copyright © 2017 Intel Corporation. All rights reserved. systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software...
4,115
41.875
119
h
null
systemd-main/src/systemd/sd-utf8.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef foosdutf8hfoo #define foosdutf8hfoo /*** systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at y...
936
30.233333
74
h
null
systemd-main/src/sysupdate/sysupdate-cache.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include "hashmap.h" typedef struct WebCacheItem { char *url; bool verified; size_t size; uint8_t data[]; } WebCacheItem; /* A simple in-memory cache for downloaded manifests. Very likely multiple transfers will use the sam...
614
31.368421
103
h
null
systemd-main/src/sysupdate/sysupdate-instance.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <fcntl.h> #include <sys/stat.h> #include "sysupdate-instance.h" void instance_metadata_destroy(InstanceMetadata *m) { assert(m); free(m->version); } int instance_new( Resource *rr, const char *path, ...
1,369
20.40625
54
c
null
systemd-main/src/sysupdate/sysupdate-instance.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <stdbool.h> #include <sys/types.h> #include "sd-id128.h" #include "fs-util.h" #include "time-util.h" typedef struct InstanceMetadata InstanceMetadata; typedef struct Instance Instance; #include "sysupdate-resource.h" #incl...
2,169
30.911765
108
h
null
systemd-main/src/sysupdate/sysupdate-partition.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sys/file.h> #include "alloc-util.h" #include "extract-word.h" #include "gpt.h" #include "id128-util.h" #include "parse-util.h" #include "stdio-util.h" #include "string-util.h" #include "sysupdate-partition.h" void partition_info_destroy(PartitionInfo *p) { ...
13,257
34.639785
123
c
null
systemd-main/src/sysupdate/sysupdate-partition.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <sys/types.h> #include "sd-id128.h" #include "fdisk-util.h" #include "macro.h" typedef struct PartitionInfo PartitionInfo; typedef enum PartitionChange { PARTITION_FLAGS = 1 << 0, PARTITION_NO_AUT...
1,620
31.42
118
h
null
systemd-main/src/sysupdate/sysupdate-update-set.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "glyph-util.h" #include "string-util.h" #include "sysupdate-update-set.h" #include "terminal-util.h" UpdateSet *update_set_free(UpdateSet *us) { if (!us) return NULL; free(us->version); free(us->...
2,045
30.96875
124
c
null
systemd-main/src/sysupdate/sysupdate-update-set.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <stdbool.h> #include <sys/types.h> typedef struct UpdateSet UpdateSet; #include "sysupdate-instance.h" typedef enum UpdateSetFlags { UPDATE_NEWEST = 1 << 0, UPDATE_AVAILABLE = 1 << 1, UPDATE_INSTA...
785
22.818182
60
h
null
systemd-main/src/sysupdate/sysupdate.h
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include <inttypes.h> #include <stdbool.h> extern bool arg_sync; extern uint64_t arg_instances_max; extern char *arg_root; static inline const char* import_binary_path(void) { return secure_getenv("SYSTEMD_IMPORT_PATH") ?: SYSTEMD_IMPORT_PATH; } ...
586
25.681818
81
h
null
systemd-main/src/test/nss-test-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <dlfcn.h> #include <stdio.h> #include <unistd.h> #include "nss-test-util.h" #include "string-util.h" const char* nss_status_to_string(enum nss_status status, char *buf, size_t buf_len) { switch (status) { case NSS_STATUS_TRYAGAIN: ...
1,304
29.348837
85
c
null
systemd-main/src/test/test-acl-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <fcntl.h> #include <stdlib.h> #include <sys/stat.h> #include <unistd.h> #include "acl-util.h" #include "errno-util.h" #include "fd-util.h" #include "format-util.h" #include "fs-util.h" #include "string-util.h" #include "tests.h" #include "tmpfile-util.h" #incl...
3,477
25.549618
93
c
null
systemd-main/src/test/test-af-list.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sys/socket.h> #include "macro.h" #include "string-util.h" #include "tests.h" _unused_ static const struct af_name* lookup_af(register const char *str, register GPERF_LEN_TYPE len); #include "af-from-name.h" #include "af-list.h" #include "af-to-name.h" TEST...
830
25.806452
94
c
null
systemd-main/src/test/test-architecture.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "architecture.h" #include "errno-util.h" #include "log.h" #include "tests.h" #include "virt.h" int main(int argc, char *argv[]) { Virtualization v; Architecture a; const char *p; test_setup_logging(LOG_INFO); assert_se...
1,617
28.962963
76
c
null
systemd-main/src/test/test-argv-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sched.h> #include <unistd.h> #if HAVE_VALGRIND_VALGRIND_H # include <valgrind/valgrind.h> #endif #include "argv-util.h" #include "missing_sched.h" #include "process-util.h" #include "tests.h" #include "virt.h" static void test_rename_process_now(const char...
4,426
32.285714
131
c
null
systemd-main/src/test/test-arphrd-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <linux/if_arp.h> #include "arphrd-util.h" #include "string-util.h" #include "tests.h" TEST(arphrd) { for (int i = 0; i <= ARPHRD_VOID + 1; i++) { const char *name; name = arphrd_to_name(i); if (name) { ...
672
23.925926
63
c
null
systemd-main/src/test/test-ask-password-api.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "ask-password-api.h" #include "strv.h" #include "tests.h" TEST(ask_password) { int r; _cleanup_strv_free_ char **ret = NULL; r = ask_password_tty(-1, "hello?", "da key", 0, ASK_PASSWORD_CONSOLE_COLOR, NULL, &ret); if (r == -ECA...
556
24.318182
96
c
null
systemd-main/src/test/test-async.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <fcntl.h> #include <sys/prctl.h> #include <sys/wait.h> #include <unistd.h> #include "async.h" #include "fs-util.h" #include "path-util.h" #include "process-util.h" #include "signal-util.h" #include "tests.h" #include "tmpfile-util.h" TEST(test_asynchronous_sy...
2,845
27.178218
115
c
null
systemd-main/src/test/test-barrier.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * IPC barrier tests * These tests verify the correct behavior of the IPC Barrier implementation. * Note that the tests use alarm-timers to verify dead-locks and timeouts. These * might not work on slow machines where 20ms are too short to perform specific * oper...
16,960
37.373303
108
c
null
systemd-main/src/test/test-bitmap.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "bitmap.h" int main(int argc, const char *argv[]) { _cleanup_bitmap_free_ Bitmap *b = NULL, *b2 = NULL; unsigned n = UINT_MAX, i = 0; b = bitmap_new(); assert_se(b); assert_se(bitmap_ensure_allocated(&b) == 0); ...
3,409
28.912281
59
c
null
systemd-main/src/test/test-blockdev-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "blockdev-util.h" #include "errno-util.h" #include "tests.h" static void test_path_is_encrypted_one(const char *p, int expect) { int r; r = path_is_encrypted(p); if (r == -ENOENT || (r < 0 && ERRNO_IS_PRIVILEGE(r))) /* ...
1,619
39.5
106
c
null
systemd-main/src/test/test-boot-timestamps.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sys/types.h> #include <unistd.h> #include "acpi-fpdt.h" #include "boot-timestamps.h" #include "efi-loader.h" #include "errno-util.h" #include "log.h" #include "tests.h" static int test_acpi_fpdt(void) { usec_t loader_start, loader_exit; int r...
2,883
31.044444
98
c
null
systemd-main/src/test/test-bootspec.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "bootspec.h" #include "fileio.h" #include "path-util.h" #include "rm-rf.h" #include "tests.h" #include "tmpfile-util.h" TEST_RET(bootspec_sort) { static const struct { const char *fname; const char *contents; } ...
6,163
39.287582
129
c
null
systemd-main/src/test/test-bpf-devices.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sys/resource.h> #include <sys/time.h> #include <unistd.h> #include "alloc-util.h" #include "bpf-devices.h" #include "bpf-program.h" #include "cgroup-setup.h" #include "errno-list.h" #include "fd-util.h" #include "fs-util.h" #include "path-util.h" #include "te...
10,933
34.732026
117
c
null
systemd-main/src/test/test-btrfs.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <fcntl.h> #include "btrfs-util.h" #include "fd-util.h" #include "fs-util.h" #include "fileio.h" #include "format-util.h" #include "log.h" #include "string-util.h" int main(int argc, char *argv[]) { BtrfsQuotaInfo quota; int r, fd; fd ...
7,829
38.746193
114
c
null
systemd-main/src/test/test-bus-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "bus-util.h" #include "log.h" #include "tests.h" static int callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { return 1; } static void destroy_callback(void *userdata) { int *n_called = userdata; (*n_called) ++; } ...
1,437
28.958333
115
c
null
systemd-main/src/test/test-calendarspec.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "calendarspec.h" #include "env-util.h" #include "errno-util.h" #include "string-util.h" #include "tests.h" static void _test_one(int line, const char *input, const char *output) { _cleanup_(calendar_spec_freep) CalendarSpec *c =...
13,026
49.492248
114
c
null
systemd-main/src/test/test-capability.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <netinet/in.h> #include <pwd.h> #include <sys/prctl.h> #include <sys/socket.h> #include <sys/wait.h> #include <unistd.h> #define TEST_CAPABILITY_C #include "alloc-util.h" #include "capability-util.h" #include "errno-util.h" #include "fd-util.h" #include "file...
10,609
30.861862
109
c
null
systemd-main/src/test/test-cgroup-setup.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <unistd.h> #include "alloc-util.h" #include "cgroup-setup.h" #include "errno-util.h" #include "log.h" #include "proc-cmdline.h" #include "string-util.h" #include "tests.h" #include "version.h" static void test_is_wanted_print_one(bool header) { _clean...
2,577
33.373333
80
c
null
systemd-main/src/test/test-cgroup-unit-default.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <stdio.h> #include "cgroup.h" #include "manager.h" #include "rm-rf.h" #include "tests.h" #include "unit.h" TEST_RET(default_memory_low, .sd_booted = true) { _cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL; _cleanup_(manager_freep)...
7,682
54.273381
130
c
null
systemd-main/src/test/test-cgroup.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <unistd.h> #include "cgroup-setup.h" #include "cgroup-util.h" #include "errno-util.h" #include "path-util.h" #include "process-util.h" #include "string-util.h" #include "tests.h" TEST(cg_split_spec) { char *c, *p; assert_se(cg_split_spec("foo...
4,858
36.666667
117
c
null
systemd-main/src/test/test-chase-manual.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <getopt.h> #include "chase.h" #include "fd-util.h" #include "log.h" #include "main-func.h" static char *arg_root = NULL; static int arg_flags = 0; static bool arg_open = false; static int parse_argv(int argc, char *argv[]) { enum { ARG...
3,800
31.767241
102
c
null
systemd-main/src/test/test-chown-rec.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sys/xattr.h> #include <unistd.h> #include "alloc-util.h" #include "chown-recursive.h" #include "log.h" #include "rm-rf.h" #include "string-util.h" #include "tests.h" #include "tmpfile-util.h" static const uint8_t acl[] = { 0x02, 0x00, 0x00, 0x00, 0x0...
5,264
32.322785
101
c
null
systemd-main/src/test/test-clock.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /*** Copyright © 2016 Canonical Ltd. ***/ #include <unistd.h> #include <fcntl.h> #include "clock-util.h" #include "fd-util.h" #include "fileio.h" #include "fs-util.h" #include "log.h" #include "macro.h" #include "tests.h" #include "tmpfile-util.h" TEST(clock_is_loca...
2,554
33.066667
111
c
null
systemd-main/src/test/test-compare-operator.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "compare-operator.h" #include "tests.h" TEST(parse_compare_operator) { const char *str_a = "<>version"; assert_se(parse_compare_operator(&str_a, 0) == COMPARE_UNEQUAL); const char *str_b = "$=version"; assert_se(parse_compare_op...
2,263
50.454545
104
c
null
systemd-main/src/test/test-compress-benchmark.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "compress.h" #include "env-util.h" #include "macro.h" #include "memory-util.h" #include "nulstr-util.h" #include "parse-util.h" #include "process-util.h" #include "random-util.h" #include "string-util.h" #include "tests.h" typedef int (...
5,332
29.129944
94
c
null
systemd-main/src/test/test-conf-parser.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "conf-parser.h" #include "fd-util.h" #include "fs-util.h" #include "log.h" #include "macro.h" #include "string-util.h" #include "strv.h" #include "tests.h" #include "tmpfile-util.h" static void test_config_parse_path_one(const char *rvalue, const char *expecte...
13,755
33.913706
129
c
null
systemd-main/src/test/test-core-unit.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "escape.h" #include "tests.h" #include "unit.h" static void test_unit_escape_setting_one( const char *s, const char *expected_exec_env, const char *expected_exec, const cha...
4,698
37.834711
104
c
null
systemd-main/src/test/test-coredump-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <elf.h> #include "alloc-util.h" #include "coredump-util.h" #include "fileio.h" #include "fd-util.h" #include "format-util.h" #include "macro.h" #include "tests.h" TEST(coredump_filter_to_from_string) { for (CoredumpFilter i = 0; i < _COREDUMP_FILTER_M...
6,632
39.944444
114
c
null
systemd-main/src/test/test-cpu-set-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "cpu-set-util.h" #include "string-util.h" #include "tests.h" #include "macro.h" TEST(parse_cpu_set) { CPUSet c = {}; _cleanup_free_ char *str = NULL; int cpu; /* Single value */ assert_se(parse_c...
11,923
41.434164
117
c
null
systemd-main/src/test/test-cryptolib.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "gcrypt-util.h" #include "macro.h" #include "openssl-util.h" #include "string-util.h" #include "tests.h" TEST(string_hashsum) { _cleanup_free_ char *out1 = NULL, *out2 = NULL, *out3 = NULL, *out4 = NULL; assert_se(strin...
1,563
39.102564
99
c
null
systemd-main/src/test/test-daemon.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <unistd.h> #include "sd-daemon.h" #include "parse-util.h" #include "strv.h" #include "time-util.h" int main(int argc, char *argv[]) { _cleanup_strv_free_ char **l = NULL; int n, i; usec_t duration = USEC_PER_SEC / 10; if (arg...
1,382
22.844828
73
c
null
systemd-main/src/test/test-data-fd-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include "data-fd-util.h" #include "fd-util.h" #include "memory-util.h" #include "process-util.h" #include "tests.h" #include "random-util.h" static void test_acquire_data_fd_one(unsig...
4,105
26.557047
106
c
null
systemd-main/src/test/test-date.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "string-util.h" #include "tests.h" #include "time-util.h" static void test_should_pass(const char *p) { usec_t t, q; char buf[FORMAT_TIMESTAMP_MAX], buf_relative[FORMAT_TIMESTAMP_RELATIVE_MAX]; log_info("Test: %...
3,473
30.581818
84
c
null
systemd-main/src/test/test-dev-setup.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "capability-util.h" #include "dev-setup.h" #include "fs-util.h" #include "mkdir.h" #include "path-util.h" #include "rm-rf.h" #include "tmpfile-util.h" int main(int argc, char *argv[]) { _cleanup_(rm_rf_physical_and_freep) char *p = NULL; const ...
1,999
30.25
72
c
null
systemd-main/src/test/test-device-nodes.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <stdio.h> #include <sys/types.h> #include "alloc-util.h" #include "device-nodes.h" #include "string-util.h" #include "tests.h" /* helpers for test_encode_devnode_name */ static char *do_encode_string(const char *in) { size_t out_len = strlen(in) * 4 +...
1,190
29.538462
77
c
null
systemd-main/src/test/test-devnum-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sys/stat.h> #include "devnum-util.h" #include "path-util.h" #include "stat-util.h" #include "tests.h" TEST(parse_devnum) { dev_t dev; assert_se(parse_devnum("", &dev) == -EINVAL); assert_se(parse_devnum("junk", &dev) == -EINVAL); ...
4,361
33.896
106
c
null
systemd-main/src/test/test-emergency-action.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "emergency-action.h" #include "tests.h" TEST(parse_emergency_action) { EmergencyAction x; assert_se(parse_emergency_action("none", RUNTIME_SCOPE_USER, &x) == 0); assert_se(x == EMERGENCY_ACTION_NONE); assert_se(parse_emergency_...
3,214
60.826923
103
c
null
systemd-main/src/test/test-env-file.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "env-file.h" #include "fd-util.h" #include "fileio.h" #include "fs-util.h" #include "macro.h" #include "strv.h" #include "tests.h" #include "tmpfile-util.h" /* In case of repeating keys, later entries win. */ #define env_file_1 \ ...
7,416
37.630208
98
c
null
systemd-main/src/test/test-errno-list.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include "errno-list.h" #include "errno-to-name.h" #include "macro.h" #include "string-util.h" #include "tests.h" TEST(errno_list) { for (size_t i = 0; i < ELEMENTSOF(errno_names); i++) { if (errno_names[i]) { ...
941
27.545455
78
c
null
systemd-main/src/test/test-errno-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "errno-util.h" #include "stdio-util.h" #include "string-util.h" #include "tests.h" TEST(strerror_not_threadsafe) { /* Just check that strerror really is not thread-safe. */ log_info("strerror(%d) → %s", 200, strerror(200)); log_info("st...
2,422
28.54878
101
c
null
systemd-main/src/test/test-escape.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "escape.h" #include "macro.h" #include "tests.h" TEST(cescape) { _cleanup_free_ char *t = NULL; assert_se(t = cescape("abc\\\"\b\f\n\r\t\v\a\003\177\234\313")); assert_se(streq(t, "abc\\\\\\\"\\b\\f\\n\\r\\t\\v\...
10,748
43.234568
128
c
null
systemd-main/src/test/test-execve.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "exec-util.h" #include "fd-util.h" #include "log.h" #include "main-func.h" #include "strv.h" #include "tests.h" /* This program can be used to call programs through fexecve / execveat(…, "", …, AT_EMPTY_PATH), * when compiled with -Dfexecve=true, and the fall...
1,285
30.365854
97
c
null
systemd-main/src/test/test-exit-status.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "exit-status.h" #include "string-util.h" #include "tests.h" TEST(exit_status_to_string) { for (int i = -1; i <= 256; i++) { const char *s, *class; s = exit_status_to_string(i, EXIT_STATUS_FULL); class = ...
1,425
35.564103
102
c
null
systemd-main/src/test/test-fdset.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <fcntl.h> #include <unistd.h> #include "fd-util.h" #include "fdset.h" #include "fs-util.h" #include "macro.h" #include "tests.h" #include "tmpfile-util.h" TEST(fdset_new_fill) { int fd = -EBADF; _cleanup_fdset_free_ FDSet *fdset = NULL; ...
6,093
28.019048
88
c
null
systemd-main/src/test/test-fstab-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <stdio.h> #include "alloc-util.h" #include "fstab-util.h" #include "log.h" #include "string-util.h" #include "strv.h" #include "tests.h" /* int fstab_filter_options( const char *opts, const char *names, const char **ret_namefound, ...
9,439
47.911917
131
c
null
systemd-main/src/test/test-glob-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <fcntl.h> #include <sys/stat.h> #include <unistd.h> #include "alloc-util.h" #include "dirent-util.h" #include "fs-util.h" #include "glob-util.h" #include "macro.h" #include "rm-rf.h" #include "tests.h" #include "tmpfile-util.h" TEST(glob_first) { char...
3,716
25.934783
83
c
null
systemd-main/src/test/test-gpt.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "architecture.h" #include "glyph-util.h" #include "gpt.h" #include "log.h" #include "pretty-print.h" #include "strv.h" #include "terminal-util.h" #include "tests.h" TEST(gpt_types_against_architectures) { int r; /* Dumps a table indicating for...
4,527
39.428571
105
c
null
systemd-main/src/test/test-gunicode.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "gunicode.h" #include "tests.h" #include "utf8.h" TEST(unichar_iswide) { char32_t c; int r; /* FIXME: the cats are wide, but we get this wrong */ for (const char *narrow = "abX_…ąęµ!" "😼😿🙀😸😻"; *narrow; narrow += r) { ...
750
25.821429
78
c
null
systemd-main/src/test/test-hash-funcs.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "tests.h" #include "hash-funcs.h" #include "set.h" TEST(path_hash_set) { /* The goal is to make sure that non-simplified path are hashed as expected, * and that we don't need to simplify them beforehand. */ /* No freeing of keys, we o...
3,433
43.025641
84
c
null
systemd-main/src/test/test-hashmap.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "hashmap.h" #include "string-util.h" #include "tests.h" unsigned custom_counter = 0; static void custom_destruct(void* p) { custom_counter--; free(p); } DEFINE_HASH_OPS_FULL(boring_hash_ops, char, string_hash_func, string_compare_func, free, c...
5,717
32.244186
123
c
null
systemd-main/src/test/test-hexdecoct.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <errno.h> #include "alloc-util.h" #include "hexdecoct.h" #include "macro.h" #include "random-util.h" #include "string-util.h" #include "tests.h" TEST(hexchar) { assert_se(hexchar(0xa) == 'a'); assert_se(hexchar(0x0) == '0'); } TEST(unhexchar)...
18,654
34.875
113
c
null
systemd-main/src/test/test-hostname-setup.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <unistd.h> #include "alloc-util.h" #include "fileio.h" #include "fs-util.h" #include "hostname-setup.h" #include "string-util.h" #include "tests.h" #include "tmpfile-util.h" TEST(read_etc_hostname) { _cleanup_(unlink_tempfilep) char path[] = "/tmp/hos...
2,203
32.907692
96
c
null
systemd-main/src/test/test-install-file.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "fileio.h" #include "install-file.h" #include "path-util.h" #include "rm-rf.h" #include "tests.h" #include "tmpfile-util.h" #include "umask-util.h" TEST(install_file) { _cleanup_(rm_rf_physical_and_freep) char *p = NULL; _cleanup_free_ char *a ...
2,511
37.646154
117
c
null
systemd-main/src/test/test-install.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <stdio.h> #include <string.h> #include "install.h" #include "tests.h" static void dump_changes(InstallChange *c, unsigned n) { unsigned i; assert_se(n == 0 || c); for (i = 0; i < n; i++) { if (c[i].type == INSTALL_CHA...
9,160
32.804428
121
c
null
systemd-main/src/test/test-io-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #include "alloc-util.h" #include "fd-util.h" #include "io-util.h" #include "macro.h" #include "tests.h" static void test_sparse_write_one(int fd, const char *buffer, size_t n) { char check[n]; ...
1,557
30.16
115
c
null
systemd-main/src/test/test-ip-protocol-list.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <netinet/in.h> #include "macro.h" #include "ip-protocol-list.h" #include "stdio-util.h" #include "string-util.h" #include "tests.h" static void test_int(int i) { char str[DECIMAL_STR_MAX(int)]; assert_se(ip_protocol_from_name(ip_protocol_to_n...
1,930
26.585714
91
c
null
systemd-main/src/test/test-ipcrm.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "clean-ipc.h" #include "errno-util.h" #include "main-func.h" #include "tests.h" #include "user-util.h" static int run(int argc, char *argv[]) { uid_t uid; int r; const char* name = argv[1] ?: NOBODY_USER_NAME; test_setup_loggin...
790
25.366667
80
c
null
systemd-main/src/test/test-journal-importer.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include "alloc-util.h" #include "log.h" #include "journal-importer.h" #include "path-util.h" #include "string-util.h" #include "tests.h" static void assert_iovec_entry(const struct iovec *iovec, const ch...
2,676
36.180556
94
c
null
systemd-main/src/test/test-kbd-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "kbd-util.h" #include "log.h" #include "strv.h" #include "tests.h" int main(int argc, char *argv[]) { _cleanup_strv_free_ char **maps = NULL; int r; log_show_color(true); test_setup_logging(LOG_DEBUG); r = get_keymaps(...
618
21.107143
68
c
null
systemd-main/src/test/test-libmount.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "alloc-util.h" #include "fd-util.h" #include "escape.h" #include "libmount-util.h" #include "tests.h" static void test_libmount_unescaping_one( const char *title, const char *string, bool may_fail, ...
3,841
33.612613
120
c
null
systemd-main/src/test/test-limits-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "format-util.h" #include "limits-util.h" #include "tests.h" TEST(physical_memory) { uint64_t p; p = physical_memory(); assert_se(p > 0); assert_se(p < UINT64_MAX); assert_se(p % page_size() == 0); log_info("Mem...
2,941
31.688889
112
c
null
systemd-main/src/test/test-list.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "list.h" int main(int argc, const char *argv[]) { size_t i; typedef struct list_item { LIST_FIELDS(struct list_item, item_list); } list_item; LIST_HEAD(list_item, head); LIST_HEAD(list_item, head2); ...
10,373
39.054054
90
c
null
systemd-main/src/test/test-local-addresses.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include <stdio.h> #include "af-list.h" #include "alloc-util.h" #include "in-addr-util.h" #include "local-addresses.h" #include "tests.h" static void print_local_addresses(struct local_address *a, unsigned n) { for (unsigned i = 0; i < n; i++) { ...
2,369
31.027027
134
c
null
systemd-main/src/test/test-locale-util.c
/* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "glyph-util.h" #include "kbd-util.h" #include "locale-util.h" #include "macro.h" #include "strv.h" #include "tests.h" TEST(get_locales) { _cleanup_strv_free_ char **locales = NULL; int r; r = get_locales(&locales); assert_se(r ...
4,365
33.377953
72
c