repo stringlengths 1 152 ⌀ | file stringlengths 14 221 | code stringlengths 501 25k | file_length int64 501 25k | avg_line_length float64 20 99.5 | max_line_length int64 21 134 | extension_type stringclasses 2
values |
|---|---|---|---|---|---|---|
null | systemd-main/src/basic/static-destruct.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "alloc-util.h"
#include "macro.h"
#include "memory-util.h"
/* A framework for registering static variables that shall be freed on shutdown of a process. It's a bit like gcc's
* destructor attribute, but allows us to precisely schedule when we wa... | 5,160 | 47.688679 | 116 | h |
null | systemd-main/src/basic/stdio-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <printf.h>
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include "macro.h"
_printf_(3, 4)
static inline char *snprintf_ok(char *buf, size_t len, const char *format, ...) {
va_list ap;
int r;
va_start(ap, ... | 4,108 | 53.786667 | 123 | h |
null | systemd-main/src/basic/strbuf.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "alloc-util.h"
#include "sort-util.h"
#include "strbuf.h"
/*
* Strbuf stores given strings in a single continuous allocated memory
* area. Identical strings are de-duplicated and return the same off... | 5,411 | 28.736264 | 109 | c |
null | systemd-main/src/basic/strbuf.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include "macro.h"
struct strbuf {
char *buf;
size_t len;
struct strbuf_node *root;
size_t nodes_count;
size_t in_count;
size_t in_len;
... | 867 | 20.7 | 73 | h |
null | systemd-main/src/basic/string-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include "alloc-util.h"
#include "macro.h"
#include "string-util-fundamental.h"
/* What is interpreted as whitespace? */
#define WHITESPACE " \t\n\r"
#define NEWLINE "\n\r"
... | 9,942 | 33.887719 | 118 | h |
null | systemd-main/src/basic/strv.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fnmatch.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "env-util.h"
#include "escape.h"
#include "extract-word.h"
#include "fileio.h"
#include "memory-util.h"
#include "nulstr-util.h"
#include... | 21,342 | 22.688124 | 126 | c |
null | systemd-main/src/basic/strv.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <fnmatch.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include "alloc-util.h"
#include "extract-word.h"
#include "hashmap.h"
#include "macro.h"
#include "string-util.h"
char* strv_find(char * const *l, const ... | 10,927 | 42.193676 | 125 | h |
null | systemd-main/src/basic/strxcpyx.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Concatenates/copies strings. In any case, terminates in all cases
* with '\0' and moves the @dest pointer forward to the added '\0'.
* Returns the remaining size, and 0 if the string was truncated.
*
* Due to the intended usage, these helpers silently noop inv... | 3,726 | 24.527397 | 98 | c |
null | systemd-main/src/basic/strxcpyx.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include "macro.h"
size_t strnpcpy_full(char **dest, size_t size, const char *src, size_t len, bool *ret_truncated);
static inline size_t strnpcpy(char **dest, size_t size, const char *src, size_t len) {
re... | 1,661 | 47.882353 | 105 | h |
null | systemd-main/src/basic/sync-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include <sys/stat.h>
#include "fd-util.h"
#include "fs-util.h"
#include "path-util.h"
#include "sync-util.h"
int fsync_directory_of_file(int fd) {
_cleanup_close_ int dfd = -EBADF;
struct stat st;
int r;
assert(fd >... | 5,146 | 31.16875 | 109 | c |
null | systemd-main/src/basic/sysctl-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "macro.h"
#include "stdio-util.h"
#include "string-util.h"
char *sysctl_normalize(char *s);
int sysctl_read(const char *property, char **value);
int sysctl_write(const char *property, const char *value);
i... | 1,334 | 42.064516 | 123 | h |
null | systemd-main/src/basic/syslog-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <syslog.h>
#include "sd-id128.h"
#include "glob-util.h"
#include "hexdecoct.h"
#include "macro.h"
#include "path-util.h"
#include "string-table.h"
#include "syslog-util.h"
#include "unit-name.h"
int syslog_parse_priority(const char **p, int *priority, bool w... | 3,910 | 28.628788 | 108 | c |
null | systemd-main/src/basic/syslog-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
int log_facility_unshifted_to_string_alloc(int i, char **s);
int log_facility_unshifted_from_string(const char *s);
bool log_facility_unshifted_is_valid(int faciliy);
int log_level_to_string_alloc(int i, char **s);
int log_level_from_... | 505 | 28.764706 | 77 | h |
null | systemd-main/src/basic/time-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
typedef uint64_t usec_t;
typedef uint64_t nsec_t;
#define PRI_NSEC PRIu64
#define PRI_USEC PRIu64
#define NSEC_FMT "%" PRI_NSEC
#define... | 9,672 | 39.136929 | 126 | h |
null | systemd-main/src/basic/tmpfile-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/mman.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "hexdecoct.h"
#include "macro.h"
#include "memfd-util.h"
#include "missing_fcntl.h"
#include "missing_syscall.h"
#include "path-util.h"
#include "proces... | 13,575 | 27.701903 | 119 | c |
null | systemd-main/src/basic/tmpfile-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
int fopen_temporary_at(int dir_fd, const char *path, FILE **ret_file, char **ret_path);
static inline int fopen_temporary(const char *path, FILE **ret_file, char **ret_path) {
return fopen_... | 1,970 | 42.8 | 102 | h |
null | systemd-main/src/basic/uid-alloc-range.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "chase.h"
#include "fd-util.h"
#include "fileio.h"
#include "missing_threads.h"
#include "string-util.h"
#include "uid-alloc-range.h"
#include "user-util.h"
static const UGIDAllocationRange default_ugid_allocation_range = {
.system_alloc_uid_min = SYST... | 4,794 | 35.325758 | 108 | c |
null | systemd-main/src/basic/uid-alloc-range.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <sys/types.h>
bool uid_is_system(uid_t uid);
bool gid_is_system(gid_t gid);
static inline bool uid_is_dynamic(uid_t uid) {
return DYNAMIC_UID_MIN <= uid && uid <= DYNAMIC_UID_MAX;
}
static inline bool gid_is_dynamic(... | 995 | 25.918919 | 87 | h |
null | systemd-main/src/basic/uid-range.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "macro.h"
#include "path-util.h"
#include "sort-util.h"
#include "stat-util.h"
#include "uid-range.h"
#incl... | 6,371 | 25.773109 | 109 | c |
null | systemd-main/src/basic/uid-range.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <sys/types.h>
#include "macro.h"
typedef struct UidRangeEntry {
uid_t start, nr;
} UidRangeEntry;
typedef struct UidRange {
UidRangeEntry *entries;
size_t n_entries;
} UidRange;
UidRange *uid_range_f... | 997 | 27.514286 | 83 | h |
null | systemd-main/src/basic/umask-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "macro.h"
static inline void umaskp(mode_t *u) {
umask(*u & 0777);
}
#define _cleanup_umask_ _cleanup_(umaskp)
/* We make use of the fact here that the umask() concept is... | 1,010 | 32.7 | 109 | h |
null | systemd-main/src/basic/unaligned.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <endian.h>
#include <stdint.h>
#include "unaligned-fundamental.h"
/* BE */
static inline uint16_t unaligned_read_be16(const void *_u) {
const struct __attribute__((__packed__, __may_alias__)) { uint16_t x; } *u = _u;
return be16... | 2,331 | 26.761905 | 88 | h |
null | systemd-main/src/basic/unit-def.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "bus-label.h"
#include "string-table.h"
#include "unit-def.h"
#include "unit-name.h"
char *unit_dbus_path_from_name(const char *name) {
_cleanup_free_ char *e = NULL;
assert(name);
e = bus_label_escape(name);
... | 12,608 | 36.978916 | 76 | c |
null | systemd-main/src/basic/unit-def.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "errno-list.h"
#include "glyph-util.h"
#include "macro.h"
/* The enum order is used to order unit jobs in the job queue
* when other criteria (cpu weight, nice level) are identical.
* In this case service units have the hig... | 10,909 | 30.80758 | 113 | h |
null | systemd-main/src/basic/unit-file.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "hashmap.h"
#include "path-lookup.h"
#include "time-util.h"
#include "unit-name.h"
typedef enum UnitFileState UnitFileState;
enum UnitFileState {
UNIT_FILE_ENABLED,
UNIT_FILE_ENABLED_RUNTIME,
UNIT_FIL... | 1,907 | 29.285714 | 105 | h |
null | systemd-main/src/basic/unit-name.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include "sd-id128.h"
#include "alloc-util.h"
#include "glob-util.h"
#include "hexdecoct.h"
#include "memory-util.h"
#include "path-util.h"
#include "random-util.h"
#include "sparse-endian.... | 23,358 | 24.782561 | 129 | c |
null | systemd-main/src/basic/unit-name.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "macro.h"
#include "unit-def.h"
#define UNIT_NAME_MAX 256
typedef enum UnitNameFlags {
UNIT_NAME_PLAIN = 1 << 0, /* Allow foo.service */
UNIT_NAME_TEMPLATE = 1 << 1, /* Allow foo@.service */
UNIT_N... | 2,676 | 37.242857 | 128 | h |
null | systemd-main/src/basic/utf8.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/* Parts of this file are based on the GLIB utf8 validation functions. The
* original license text follows. */
/* gutf8.c - Operations on UTF-8 strings.
*
* Copyright (C) 1999 Tom Tromey
* Copyright (C) 2000 Red Hat, Inc.
*
* This library is free software; you ca... | 17,596 | 27.847541 | 115 | c |
null | systemd-main/src/basic/utf8.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <uchar.h>
#include "macro.h"
#include "missing_type.h"
#define UTF8_REPLACEMENT_CHARACTER "\xef\xbf\xbd"
#define UTF8_BYTE_ORDER_MARK "\xef\xbb\xbf"
bool unichar_is_valid(char32_t c);
... | 2,071 | 33.533333 | 108 | h |
null | systemd-main/src/basic/virt.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "errno-list.h"
#include "macro.h"
typedef enum Virtualization {
VIRTUALIZATION_NONE = 0,
VIRTUALIZATION_VM_FIRST,
VIRTUALIZATION_KVM = VIRTUALIZATION_VM_FIRST,
VIRTUALIZATION_AMAZON,
V... | 2,188 | 30.271429 | 100 | h |
null | systemd-main/src/basic/xattr-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/xattr.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "macro.h"
#include "missing_syscall.h"
#include "sparse-endian.h"
#i... | 13,046 | 34.745205 | 130 | c |
null | systemd-main/src/basic/xattr-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <sys/types.h>
#include "time-util.h"
int getxattr_at_malloc(int fd, const char *path, const char *name, int flags, char **ret);
static inline int getxattr_malloc(const char *path, const char *name, char **... | 1,508 | 35.804878 | 101 | h |
null | systemd-main/src/basic/linux/batman_adv.h | /* SPDX-License-Identifier: MIT */
/* Copyright (C) B.A.T.M.A.N. contributors:
*
* Matthias Schiffer
*/
#ifndef _UAPI_LINUX_BATMAN_ADV_H_
#define _UAPI_LINUX_BATMAN_ADV_H_
#define BATADV_NL_NAME "batadv"
#define BATADV_NL_MCAST_GROUP_CONFIG "config"
#define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"
/**
* enum bat... | 16,902 | 22.975887 | 80 | h |
null | systemd-main/src/basic/linux/cfm_bridge.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
#ifndef _UAPI_LINUX_CFM_BRIDGE_H_
#define _UAPI_LINUX_CFM_BRIDGE_H_
#include <linux/types.h>
#include <linux/if_ether.h>
#define ETHER_HEADER_LENGTH (6+6+4+2)
#define CFM_MAID_LENGTH 48
#define CFM_CCM_PDU_LENGTH 75
#define CFM_PORT_STATUS_TLV_LENGT... | 1,466 | 21.569231 | 63 | h |
null | systemd-main/src/basic/linux/fib_rules.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __LINUX_FIB_RULES_H
#define __LINUX_FIB_RULES_H
#include <linux/types.h>
#include <linux/rtnetlink.h>
/* rule is permanent, and cannot be deleted */
#define FIB_RULE_PERMANENT 0x00000001
#define FIB_RULE_INVERT 0x00000002
#define FIB_RULE_UNRESOL... | 2,036 | 21.384615 | 62 | h |
null | systemd-main/src/basic/linux/genetlink.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI__LINUX_GENERIC_NETLINK_H
#define _UAPI__LINUX_GENERIC_NETLINK_H
#include <linux/types.h>
#include <linux/netlink.h>
#define GENL_NAMSIZ 16 /* length of family name */
#define GENL_MIN_ID NLMSG_MIN_TYPE
#define GENL_MAX_ID 1023
struct genlm... | 2,253 | 20.673077 | 76 | h |
null | systemd-main/src/basic/linux/if.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* Global definitions for the INET interface modu... | 10,874 | 35.493289 | 109 | h |
null | systemd-main/src/basic/linux/if_addr.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __LINUX_IF_ADDR_H
#define __LINUX_IF_ADDR_H
#include <linux/types.h>
#include <linux/netlink.h>
struct ifaddrmsg {
__u8 ifa_family;
__u8 ifa_prefixlen; /* The prefix length */
__u8 ifa_flags; /* Flags */
__u8 ifa_scope; /* Address scope... | 2,169 | 26.125 | 92 | h |
null | systemd-main/src/basic/linux/if_bonding.h | /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
/*
* Bond several ethernet interfaces into a Cisco, running 'Etherchannel'.
*
*
* Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes
* NCM: Network and Communications Management, Inc.
*
* BUT, I'm the one who modified it for ethernet, so:... | 5,145 | 31.987179 | 86 | h |
null | systemd-main/src/basic/linux/if_bridge.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* Linux ethernet bridge
*
* Authors:
* Lennert Buytenhek <buytenh@gnu.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Found... | 19,964 | 23.141475 | 85 | h |
null | systemd-main/src/basic/linux/if_ether.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* Global definitions for the Ethernet IEEE 802.3... | 8,781 | 47.252747 | 99 | h |
null | systemd-main/src/basic/linux/if_macsec.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* include/uapi/linux/if_macsec.h - MACsec device
*
* Copyright (c) 2015 Sabrina Dubroca <sd@queasysnail.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as publish... | 6,518 | 32.430769 | 77 | h |
null | systemd-main/src/basic/linux/if_tun.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* Universal TUN/TAP device driver.
* Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*... | 4,330 | 35.394958 | 75 | h |
null | systemd-main/src/basic/linux/if_tunnel.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_IF_TUNNEL_H_
#define _UAPI_IF_TUNNEL_H_
#include <linux/types.h>
#include <linux/if.h>
#include <linux/ip.h>
#include <linux/in6.h>
#include <asm/byteorder.h>
#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
#define SIOCADDTUNNEL (SIOCDEVPRIV... | 4,602 | 23.747312 | 63 | h |
null | systemd-main/src/basic/linux/in.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* Definitions of the Internet Protocol.
*
* Ve... | 10,822 | 31.599398 | 80 | h |
null | systemd-main/src/basic/linux/in6.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* Types and definitions for AF_INET6
* Linux INET6 implementation
*
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
* Sources:
* IPv6 Program Interfaces for BSD Systems
* <draft-ietf-ipngwg-bsd-api-05.txt>
*
* Advanced Sockets API for... | 7,619 | 24.148515 | 71 | h |
null | systemd-main/src/basic/linux/ipv6_route.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* Linux INET6 implementation
*
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free S... | 1,923 | 28.6 | 68 | h |
null | systemd-main/src/basic/linux/l2tp.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* L2TP-over-IP socket for L2TPv3.
*
* Author: James Chapman <jchapman@katalix.com>
*/
#ifndef _UAPI_LINUX_L2TP_H_
#define _UAPI_LINUX_L2TP_H_
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/in6.h>
/**
* st... | 5,761 | 27.245098 | 79 | h |
null | systemd-main/src/basic/linux/libc-compat.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Compatibility interface for userspace libc header coordination:
*
* Define compatibility macros that are used to control the inclusion or
* exclusion of UAPI structures and definitions in coordination with another
* userspace C library.
*
* This... | 8,304 | 29.988806 | 79 | h |
null | systemd-main/src/basic/linux/mrp_bridge.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
#ifndef _UAPI_LINUX_MRP_BRIDGE_H_
#define _UAPI_LINUX_MRP_BRIDGE_H_
#include <linux/types.h>
#include <linux/if_ether.h>
#define MRP_MAX_FRAME_LENGTH 200
#define MRP_DEFAULT_PRIO 0x8000
#define MRP_DOMAIN_UUID_LENGTH 16
#define MRP_VERSION 1
#defin... | 1,718 | 21.92 | 63 | h |
null | systemd-main/src/basic/linux/netdevice.h | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* Definitions for the Interfaces handler.
*
* ... | 2,268 | 32.865672 | 74 | h |
null | systemd-main/src/basic/linux/netlink.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI__LINUX_NETLINK_H
#define _UAPI__LINUX_NETLINK_H
#include <linux/const.h>
#include <linux/socket.h> /* for __kernel_sa_family_t */
#include <linux/types.h>
#define NETLINK_ROUTE 0 /* Routing/device hook */
#define NETLINK_UNUSED 1 /* Unu... | 12,272 | 31.382586 | 80 | h |
null | systemd-main/src/basic/linux/nexthop.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_LINUX_NEXTHOP_H
#define _UAPI_LINUX_NEXTHOP_H
#include <linux/types.h>
struct nhmsg {
unsigned char nh_family;
unsigned char nh_scope; /* return only */
unsigned char nh_protocol; /* Routing protocol that installed nh */
unsigned ch... | 2,835 | 26.009524 | 70 | h |
null | systemd-main/src/basic/linux/rtnetlink.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI__LINUX_RTNETLINK_H
#define _UAPI__LINUX_RTNETLINK_H
#include <linux/types.h>
#include <linux/netlink.h>
#include <linux/if_link.h>
#include <linux/if_addr.h>
#include <linux/neighbour.h>
/* rtnetlink families. Values up to 127 are reserved f... | 21,209 | 24.646917 | 93 | h |
null | systemd-main/src/basic/linux/stddef.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_LINUX_STDDEF_H
#define _UAPI_LINUX_STDDEF_H
#ifndef __always_inline
#define __always_inline inline
#endif
/**
* __struct_group() - Create a mirrored named and anonyomous struct
*
* @TAG: The tag name for the named sub-struct (usually emp... | 1,537 | 31.723404 | 74 | h |
null | systemd-main/src/basic/linux/wireguard.h | /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */
/*
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*
* Documentation
* =============
*
* The below enums and macros are for interfacing with WireGuard, using generic
* netlink, with family WG_GENL_NAME an... | 7,748 | 38.335025 | 106 | h |
null | systemd-main/src/basic/linux/can/netlink.h | /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* linux/can/netlink.h
*
* Definitions for the CAN netlink interface
*
* Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the version 2... | 5,150 | 26.693548 | 86 | h |
null | systemd-main/src/basic/linux/hdlc/ioctl.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __HDLC_IOCTL_H__
#define __HDLC_IOCTL_H__
#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
#define CLOCK_DEFAULT 0 /* Default setting */
#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
#define CLOCK_INT 2 /... | 2,979 | 30.368421 | 77 | h |
null | systemd-main/src/basic/linux/netfilter/nfnetlink.h | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_NFNETLINK_H
#define _UAPI_NFNETLINK_H
#include <linux/types.h>
#include <linux/netfilter/nfnetlink_compat.h>
enum nfnetlink_groups {
NFNLGRP_NONE,
#define NFNLGRP_NONE NFNLGRP_NONE
NFNLGRP_CONNTRACK_NEW,
#define NFNLGRP_CONNTRACK_NEW NFN... | 2,472 | 28.795181 | 76 | h |
null | systemd-main/src/binfmt/binfmt.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 "alloc-util.h"
#include "binfmt-util.h"
#include "build.h"
#include "conf-files.h"
#include "con... | 8,215 | 30.121212 | 113 | c |
null | systemd-main/src/boot/bless-boot-generator.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <unistd.h>
#include "efi-loader.h"
#include "generator.h"
#include "initrd-util.h"
#include "log.h"
#include "mkdir.h"
#include "special.h"
#include "string-util.h"
#include "virt.h"
/* This generator pulls systemd-bless-boot.service into t... | 1,999 | 34.087719 | 112 | c |
null | systemd-main/src/boot/boot-check-no-failures.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include "sd-bus.h"
#include "alloc-util.h"
#include "build.h"
#include "bus-error.h"
#include "log.h"
#include "main-func.h"
#include "pretty-print.h"
#include "terminal-util.h"
static int... | 3,069 | 25.929825 | 114 | c |
null | systemd-main/src/boot/bootctl-reboot-to-firmware.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bootctl-reboot-to-firmware.h"
#include "efi-api.h"
#include "parse-util.h"
int verb_reboot_to_firmware(int argc, char *argv[], void *userdata) {
int r;
if (argc < 2) {
r = efi_get_reboot_to_firmware();
if (r > ... | 1,284 | 31.948718 | 97 | c |
null | systemd-main/src/boot/bootctl-set-efivar.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <uchar.h>
#include <unistd.h>
#include "bootctl.h"
#include "bootctl-set-efivar.h"
#include "efivars.h"
#include "stdio-util.h"
#include "utf8.h"
#include "virt.h"
static int parse_timeout(const char *arg1, char16_t **ret_timeout, size_t *ret_timeout_size) {
... | 5,913 | 38.426667 | 123 | c |
null | systemd-main/src/boot/bootctl-systemd-efi-options.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "bootctl-systemd-efi-options.h"
#include "efi-loader.h"
int verb_systemd_efi_options(int argc, char *argv[], void *userdata) {
int r;
if (argc == 1) {
_cleanup_free_ char *line = NULL, *new = NULL;
... | 1,575 | 40.473684 | 118 | c |
null | systemd-main/src/boot/bootctl-uki.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include "alloc-util.h"
#include "bootctl-uki.h"
#include "kernel-image.h"
int verb_kernel_identify(int argc, char *argv[], void *userdata) {
KernelImageType t;
int r;
r = inspect_kernel(AT_FDCWD, argv[1], &t, NULL, NULL, NU... | 1,052 | 25.325 | 76 | c |
null | systemd-main/src/boot/bootctl-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/mman.h>
#include "bootctl.h"
#include "bootctl-util.h"
#include "fileio.h"
#include "stat-util.h"
#include "sync-util.h"
int sync_everything(void) {
int ret = 0, k;
if (arg_esp_path) {
k = syncfs_path(AT_FDCWD, arg_esp_pa... | 4,158 | 30.507576 | 108 | c |
null | systemd-main/src/boot/efi/addon.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "efi.h"
#include "version.h"
/* Magic string for recognizing our own binaries */
_used_ _section_(".sdmagic") static const char magic[] =
"#### LoaderInfo: systemd-addon " GIT_VERSION " ####";
/* This is intended to carry data, not to be executed */
... | 507 | 30.75 | 78 | c |
null | systemd-main/src/boot/efi/bcd.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdalign.h>
#include "bcd.h"
#include "efi-string.h"
enum {
SIG_BASE_BLOCK = 1718052210, /* regf */
SIG_KEY = 27502, /* nk */
SIG_SUBKEY_FAST = 26220, /* lf */
SIG_KEY_VALUE = 27510, /* vk */
};
enum... | 11,528 | 36.553746 | 110 | c |
null | systemd-main/src/boot/efi/console.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "console.h"
#include "proto/graphics-output.h"
#include "util.h"
#define SYSTEM_FONT_WIDTH 8
#define SYSTEM_FONT_HEIGHT 19
#define HORIZONTAL_MAX_OK 1920
#define VERTICAL_MAX_OK 1080
#define VIEWPORT_RATIO 10
static inline void event_closep(EFI_EVENT *event) ... | 13,195 | 41.159744 | 111 | c |
null | systemd-main/src/boot/efi/console.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "efi.h"
#include "proto/simple-text-io.h"
enum {
EFI_SHIFT_PRESSED = EFI_RIGHT_SHIFT_PRESSED|EFI_LEFT_SHIFT_PRESSED,
EFI_CONTROL_PRESSED = EFI_RIGHT_CONTROL_PRESSED|EFI_LEFT_CONTROL_PRESSED,
EFI_ALT_PRESSED = EFI_RIGH... | 1,689 | 42.333333 | 105 | h |
null | systemd-main/src/boot/efi/cpio.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "cpio.h"
#include "device-path-util.h"
#include "measure.h"
#include "proto/device-path.h"
#include "util.h"
static char *write_cpio_word(char *p, uint32_t v) {
static const char hex[] = "0123456789abcdef";
assert(p);
/* Writes a CPIO... | 19,668 | 37.566667 | 114 | c |
null | systemd-main/src/boot/efi/cpio.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "efi.h"
#include "proto/loaded-image.h"
EFI_STATUS pack_cpio(
EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
const char16_t *dropin_dir,
const char16_t *match_suffix,
const char *target_dir... | 1,062 | 32.21875 | 56 | h |
null | systemd-main/src/boot/efi/device-path-util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "device-path-util.h"
#include "util.h"
EFI_STATUS make_file_device_path(EFI_HANDLE device, const char16_t *file, EFI_DEVICE_PATH **ret_dp) {
EFI_STATUS err;
EFI_DEVICE_PATH *dp;
assert(file);
assert(ret_dp);
err = BS->... | 5,339 | 37.417266 | 111 | c |
null | systemd-main/src/boot/efi/device-path-util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "proto/device-path.h"
EFI_STATUS make_file_device_path(EFI_HANDLE device, const char16_t *file, EFI_DEVICE_PATH **ret_dp);
EFI_STATUS device_path_to_str(const EFI_DEVICE_PATH *dp, char16_t **ret);
bool device_path_startswith(const EFI_DEVICE_PATH ... | 1,182 | 41.25 | 107 | h |
null | systemd-main/src/boot/efi/devicetree.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "devicetree.h"
#include "proto/dt-fixup.h"
#include "util.h"
#define FDT_V1_SIZE (7*4)
static EFI_STATUS devicetree_allocate(struct devicetree_state *state, size_t size) {
size_t pages = DIV_ROUND_UP(size, EFI_PAGE_SIZE);
EFI_STATUS err;
... | 4,885 | 32.238095 | 111 | c |
null | systemd-main/src/boot/efi/drivers.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "device-path-util.h"
#include "drivers.h"
#include "util.h"
static EFI_STATUS load_one_driver(
EFI_HANDLE parent_image,
EFI_LOADED_IMAGE_PROTOCOL *loaded_image,
const char16_t *fname) {
_cleanup_(unload_... | 4,448 | 37.353448 | 107 | c |
null | systemd-main/src/boot/efi/efi-string.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "efi.h"
#include "macro-fundamental.h"
size_t strnlen8(const char *s, size_t n);
size_t strnlen16(const char16_t *s, size_t n);
static inline size_t strlen8(const char *s) {
return strnlen8(s, SIZE_MAX);
}
static inline size_t strlen16(c... | 5,852 | 32.067797 | 119 | h |
null | systemd-main/src/boot/efi/efi.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "macro-fundamental.h"
#if SD_BOOT
/* uchar.h/wchar.h are not suitable for freestanding environments. */
typedef __WCHAR_TYPE__ wchar_t;
typedef __CHAR16_TYPE__ char1... | 16,786 | 36.221729 | 103 | h |
null | systemd-main/src/boot/efi/fuzz-bcd.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "bcd.h"
#include "fuzz.h"
#include "utf8.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
_cleanup_free_ void *p = NULL;
/* This limit was borrowed from src/boot/efi/boot.c */
if (outside_size_r... | 651 | 27.347826 | 97 | c |
null | systemd-main/src/boot/efi/fuzz-efi-printf.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "efi-string.h"
#include "fuzz.h"
#include "utf8.h"
typedef struct {
EFI_STATUS status;
int16_t field_width;
int16_t precision;
const void *ptr;
char c;
unsigned char uchar;
signed ... | 3,355 | 42.584416 | 113 | c |
null | systemd-main/src/boot/efi/fuzz-efi-string.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "efi-string.h"
#include "fuzz.h"
#include "utf8.h"
static char16_t *memdup_str16(const uint8_t *data, size_t size) {
char16_t *ret = memdup(data, size);
assert_se(ret);
ret[size / sizeof(char16_t) - 1] = '\0';
... | 1,357 | 32.121951 | 111 | c |
null | systemd-main/src/boot/efi/graphics.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright © 2013 Intel Corporation
* Authored by Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
*/
#include "graphics.h"
#include "proto/console-control.h"
#include "proto/simple-text-io.h"
#include "util.h"
EFI_STATUS graphics_mode(bool on) {
EFI_... | 1,415 | 32.714286 | 111 | c |
null | systemd-main/src/boot/efi/initrd.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "initrd.h"
#include "macro-fundamental.h"
#include "proto/device-path.h"
#include "proto/load-file.h"
#include "util.h"
#define LINUX_INITRD_MEDIA_GUID \
GUID_DEF(0x5568e427, 0x68fc, 0x4f3d, 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68)
/* extend Lo... | 4,667 | 33.072993 | 107 | c |
null | systemd-main/src/boot/efi/linux.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Generic Linux boot protocol using the EFI/PE entry point of the kernel. Passes
* initrd with the LINUX_INITRD_MEDIA_GUID DevicePath and cmdline with
* EFI LoadedImageProtocol.
*
* This method works for Linux 5.8 and newer on ARM/Aarch64, x86/x68_64 and RISC-V.... | 6,061 | 37.611465 | 114 | c |
null | systemd-main/src/boot/efi/linux.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "efi.h"
EFI_STATUS linux_exec(
EFI_HANDLE parent,
const char16_t *cmdline,
const void *linux_buffer,
size_t linux_length,
const void *initrd_buffer,
si... | 614 | 29.75 | 48 | h |
null | systemd-main/src/boot/efi/linux_x86.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* x86 specific code to for EFI handover boot protocol
* Linux kernels version 5.8 and newer support providing the initrd by
* LINUX_INITRD_MEDIA_GUID DevicePath. In order to support older kernels too,
* this x86 specific linux_exec function passes the initrd by s... | 9,171 | 39.764444 | 113 | c |
null | systemd-main/src/boot/efi/log.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "log.h"
#include "proto/rng.h"
#include "proto/simple-text-io.h"
#include "util.h"
static unsigned log_count = 0;
void freeze(void) {
for (;;)
BS->Stall(60 * 1000 * 1000);
}
_noreturn_ static void panic(const char16_t *message) {
... | 3,579 | 30.681416 | 107 | c |
null | systemd-main/src/boot/efi/log.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "efi-string.h"
#if defined __has_attribute
# if __has_attribute(no_stack_protector)
# define HAVE_NO_STACK_PROTECTOR_ATTRIBUTE
# endif
#endif
#if defined(HAVE_NO_STACK_PROTECTOR_ATTRIBUTE) && \
(defined(__SSP__) || defined(__SSP_ALL__) |... | 1,122 | 33.030303 | 87 | h |
null | systemd-main/src/boot/efi/part-discovery.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "device-path-util.h"
#include "part-discovery.h"
#include "proto/block-io.h"
#include "proto/device-path.h"
#include "util.h"
typedef struct {
EFI_GUID PartitionTypeGUID;
EFI_GUID UniquePartitionGUID;
EFI_LBA StartingLBA;
EFI_LB... | 10,911 | 35.494983 | 112 | c |
null | systemd-main/src/boot/efi/pe.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "pe.h"
#include "util.h"
#define DOS_FILE_MAGIC "MZ"
#define PE_FILE_MAGIC "PE\0\0"
#define MAX_SECTIONS 96
#if defined(__i386__)
# define TARGET_MACHINE_TYPE 0x014CU
# define TARGET_MACHINE_TYPE_COMPATIBILITY 0x8664U
#elif defined(__x86_64__)
# define TA... | 11,183 | 32.585586 | 117 | c |
null | systemd-main/src/boot/efi/pe.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "efi.h"
EFI_STATUS pe_memory_locate_sections(
const void *base,
const char * const sections[],
size_t *addrs,
size_t *sizes);
EFI_STATUS pe_file_locate_sections(
EFI_... | 557 | 26.9 | 74 | h |
null | systemd-main/src/boot/efi/random-seed.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "memory-util-fundamental.h"
#include "proto/rng.h"
#include "random-seed.h"
#include "secure-boot.h"
#include "sha256.h"
#include "util.h"
#define RANDOM_MAX_SIZE_MIN (32U)
#define RANDOM_MAX_SIZE_MAX (32U*1024U)
struct linux_efi_random_seed {
uint32_... | 14,568 | 43.690184 | 133 | c |
null | systemd-main/src/boot/efi/secure-boot.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "console.h"
#include "proto/security-arch.h"
#include "sbat.h"
#include "secure-boot.h"
#include "util.h"
#include "vmm.h"
bool secure_boot_enabled(void) {
bool secure = false; /* avoid false maybe-uninitialized warning */
EFI_STATUS err;
... | 9,437 | 40.761062 | 124 | c |
null | systemd-main/src/boot/efi/splash.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "graphics.h"
#include "logarithm.h"
#include "proto/graphics-output.h"
#include "splash.h"
#include "unaligned-fundamental.h"
#include "util.h"
struct bmp_file {
char signature[2];
uint32_t size;
uint16_t reserved[2];
uint32_t o... | 12,763 | 37.101493 | 111 | c |
null | systemd-main/src/boot/efi/test-bcd.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "bcd.h"
#include "compress.h"
#include "fileio.h"
#include "tests.h"
#include "utf8.h"
/* Include the implementation directly, so we can poke at some internals. */
#include "bcd.c"
static void load_bcd(const char *path, void **ret_bcd,... | 5,843 | 34.852761 | 108 | c |
null | systemd-main/src/boot/efi/ticks.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "ticks.h"
#include "util.h"
#include "vmm.h"
#if defined(__i386__) || defined(__x86_64__)
# include <cpuid.h>
static uint64_t ticks_read_arch(void) {
/* The TSC might or might not be virtualized in VMs (and thus might not be accurate or start at zero... | 3,138 | 27.026786 | 108 | c |
null | systemd-main/src/boot/efi/ubsan.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "log.h"
typedef struct {
const char *filename;
uint32_t line;
uint32_t column;
} SourceLocation;
/* Note that all ubsan handlers have a pointer to a type-specific struct passed as first argument.
* Since we do not inspect the extra da... | 1,870 | 38.808511 | 98 | c |
null | systemd-main/src/boot/efi/util.c | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "device-path-util.h"
#include "proto/device-path.h"
#include "proto/simple-text-io.h"
#include "ticks.h"
#include "util.h"
#include "version.h"
EFI_STATUS parse_boolean(const char *v, bool *b) {
assert(b);
if (!v)
return EFI_IN... | 20,623 | 29.736215 | 119 | c |
null | systemd-main/src/boot/efi/util.h | /* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "efi.h"
#include "log.h"
#include "proto/file-io.h"
#include "string-util-fundamental.h"
/* This is provided by linker script. */
extern uint8_t __ImageBase;
static inline void free(void *p) {
if (!p)
return;
/* D... | 8,791 | 40.276995 | 121 | h |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.