mirror of
https://github.com/systemd/systemd
synced 2026-04-11 17:44:58 +02:00
Compare commits
8 Commits
8470a16d6f
...
a9cab9f5cf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9cab9f5cf | ||
|
|
5bdeedb342 | ||
|
|
95d88436ea | ||
|
|
c99d5efc2d | ||
|
|
a3aff1c47f | ||
|
|
646b01121a | ||
|
|
eebbd595f0 | ||
|
|
ff6d286902 |
@ -3,5 +3,9 @@
|
|||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
# In kernel's arch/parisc/include/uapi/asm/errno.h, ECANCELLED and EREFUSED are defined as aliases of
|
||||||
|
# ECANCELED and ECONNREFUSED, respectively. Let's drop them.
|
||||||
|
|
||||||
${1:?} -dM -include errno.h - </dev/null | \
|
${1:?} -dM -include errno.h - </dev/null | \
|
||||||
|
grep -Ev '^#define[[:space:]]+(ECANCELLED|EREFUSED)' | \
|
||||||
awk '/^#define[ \t]+E[^ _]+[ \t]+/ { print $2; }'
|
awk '/^#define[ \t]+E[^ _]+[ \t]+/ { print $2; }'
|
||||||
|
|||||||
@ -24,12 +24,16 @@ typedef struct StaticDestructor {
|
|||||||
typeof(variable) *q = p; \
|
typeof(variable) *q = p; \
|
||||||
func(q); \
|
func(q); \
|
||||||
} \
|
} \
|
||||||
|
/* Older compilers don't know retain attribute. */ \
|
||||||
|
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
|
||||||
/* The actual destructor structure we place in a special section to find it */ \
|
/* The actual destructor structure we place in a special section to find it */ \
|
||||||
_section_("SYSTEMD_STATIC_DESTRUCT") \
|
_section_("SYSTEMD_STATIC_DESTRUCT") \
|
||||||
/* We pick pointer alignment, since that is apparently what gcc does for static variables */ \
|
/* We pick pointer alignment, since that is apparently what gcc does for static variables */ \
|
||||||
_alignptr_ \
|
_alignptr_ \
|
||||||
/* Make sure this is not dropped from the image because not explicitly referenced */ \
|
/* Make sure this is not dropped from the image because not explicitly referenced */ \
|
||||||
_used_ \
|
_used_ \
|
||||||
|
/* Prevent linker from garbage collection. */ \
|
||||||
|
_retain_ \
|
||||||
/* Make sure that AddressSanitizer doesn't pad this variable: we want everything in this section
|
/* Make sure that AddressSanitizer doesn't pad this variable: we want everything in this section
|
||||||
* packed next to each other so that we can enumerate it. */ \
|
* packed next to each other so that we can enumerate it. */ \
|
||||||
_variable_no_sanitize_address_ \
|
_variable_no_sanitize_address_ \
|
||||||
|
|||||||
@ -139,7 +139,7 @@ static int detect_vm_device_tree(void) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
|
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || defined(__loongarch64)
|
||||||
static int detect_vm_dmi_vendor(void) {
|
static int detect_vm_dmi_vendor(void) {
|
||||||
static const char *const dmi_vendors[] = {
|
static const char *const dmi_vendors[] = {
|
||||||
"/sys/class/dmi/id/product_name", /* Test this before sys_vendor to detect KVM over QEMU */
|
"/sys/class/dmi/id/product_name", /* Test this before sys_vendor to detect KVM over QEMU */
|
||||||
@ -226,10 +226,10 @@ static int detect_vm_smbios(void) {
|
|||||||
log_debug("DMI BIOS Extension table does not indicate virtualization.");
|
log_debug("DMI BIOS Extension table does not indicate virtualization.");
|
||||||
return SMBIOS_VM_BIT_UNSET;
|
return SMBIOS_VM_BIT_UNSET;
|
||||||
}
|
}
|
||||||
#endif /* defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) */
|
#endif /* defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || defined(__loongarch64) */
|
||||||
|
|
||||||
static int detect_vm_dmi(void) {
|
static int detect_vm_dmi(void) {
|
||||||
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
|
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || defined(__loongarch64)
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
r = detect_vm_dmi_vendor();
|
r = detect_vm_dmi_vendor();
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
#define _pure_ __attribute__((__pure__))
|
#define _pure_ __attribute__((__pure__))
|
||||||
#define _section_(x) __attribute__((__section__(x)))
|
#define _section_(x) __attribute__((__section__(x)))
|
||||||
#define _packed_ __attribute__((__packed__))
|
#define _packed_ __attribute__((__packed__))
|
||||||
|
#define _retain_ __attribute__((__retain__))
|
||||||
#define _used_ __attribute__((__used__))
|
#define _used_ __attribute__((__used__))
|
||||||
#define _unused_ __attribute__((__unused__))
|
#define _unused_ __attribute__((__unused__))
|
||||||
#define _cleanup_(x) __attribute__((__cleanup__(x)))
|
#define _cleanup_(x) __attribute__((__cleanup__(x)))
|
||||||
|
|||||||
@ -38,7 +38,7 @@ int bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_lis
|
|||||||
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
|
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
|
||||||
_section_("SYSTEMD_BUS_ERROR_MAP") \
|
_section_("SYSTEMD_BUS_ERROR_MAP") \
|
||||||
_used_ \
|
_used_ \
|
||||||
__attribute__((retain)) \
|
_retain_ \
|
||||||
_alignptr_ \
|
_alignptr_ \
|
||||||
_variable_no_sanitize_address_
|
_variable_no_sanitize_address_
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,8 @@ typedef struct TestFunc {
|
|||||||
|
|
||||||
/* See static-destruct.h for an explanation of how this works. */
|
/* See static-destruct.h for an explanation of how this works. */
|
||||||
#define REGISTER_TEST(func, ...) \
|
#define REGISTER_TEST(func, ...) \
|
||||||
_section_("SYSTEMD_TEST_TABLE") _alignptr_ _used_ _variable_no_sanitize_address_ \
|
_Pragma("GCC diagnostic ignored \"-Wattributes\"") \
|
||||||
|
_section_("SYSTEMD_TEST_TABLE") _alignptr_ _used_ _retain_ _variable_no_sanitize_address_ \
|
||||||
static const TestFunc UNIQ_T(static_test_table_entry, UNIQ) = { \
|
static const TestFunc UNIQ_T(static_test_table_entry, UNIQ) = { \
|
||||||
.f = (union f) &(func), \
|
.f = (union f) &(func), \
|
||||||
.name = STRINGIFY(func), \
|
.name = STRINGIFY(func), \
|
||||||
|
|||||||
@ -574,6 +574,9 @@ tests += [
|
|||||||
[['src/test/test-arphrd-util.c',
|
[['src/test/test-arphrd-util.c',
|
||||||
generated_gperf_headers]],
|
generated_gperf_headers]],
|
||||||
|
|
||||||
|
[['src/test/test-errno-list.c',
|
||||||
|
generated_gperf_headers]],
|
||||||
|
|
||||||
[['src/test/test-ip-protocol-list.c',
|
[['src/test/test-ip-protocol-list.c',
|
||||||
shared_generated_gperf_headers]],
|
shared_generated_gperf_headers]],
|
||||||
|
|
||||||
|
|||||||
33
src/test/test-errno-list.c
Normal file
33
src/test/test-errno-list.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/* 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"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
TEST(errno_list) {
|
||||||
|
for (size_t i = 0; i < ELEMENTSOF(errno_names); i++) {
|
||||||
|
if (errno_names[i]) {
|
||||||
|
assert_se(streq(errno_to_name(i), errno_names[i]));
|
||||||
|
assert_se(errno_from_name(errno_names[i]) == (int) i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ECANCELLED
|
||||||
|
/* ECANCELLED is an alias of ECANCELED. */
|
||||||
|
assert_se(streq(errno_to_name(ECANCELLED), "ECANCELED"));
|
||||||
|
#endif
|
||||||
|
assert_se(streq(errno_to_name(ECANCELED), "ECANCELED"));
|
||||||
|
|
||||||
|
#ifdef EREFUSED
|
||||||
|
/* EREFUSED is an alias of ECONNREFUSED. */
|
||||||
|
assert_se(streq(errno_to_name(EREFUSED), "ECONNREFUSED"));
|
||||||
|
#endif
|
||||||
|
assert_se(streq(errno_to_name(ECONNREFUSED), "ECONNREFUSED"));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_TEST_MAIN(LOG_INFO);
|
||||||
@ -381,6 +381,8 @@ static void test_exec_personality(Manager *m) {
|
|||||||
|
|
||||||
#elif defined(__i386__)
|
#elif defined(__i386__)
|
||||||
test(m, "exec-personality-x86.service", 0, CLD_EXITED);
|
test(m, "exec-personality-x86.service", 0, CLD_EXITED);
|
||||||
|
#elif defined(__loongarch64)
|
||||||
|
test(m, "exec-personality-loongarch64.service", 0, CLD_EXITED);
|
||||||
#else
|
#else
|
||||||
log_notice("Unknown personality, skipping %s", __func__);
|
log_notice("Unknown personality, skipping %s", __func__);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -133,7 +133,7 @@ udev_progs = [['ata_id/ata_id.c'],
|
|||||||
'mtd_probe/mtd_probe.h',
|
'mtd_probe/mtd_probe.h',
|
||||||
'mtd_probe/probe_smartmedia.c']]
|
'mtd_probe/probe_smartmedia.c']]
|
||||||
|
|
||||||
dmi_arches = ['x86', 'x86_64', 'aarch64', 'arm', 'ia64', 'mips']
|
dmi_arches = ['x86', 'x86_64', 'aarch64', 'arm', 'ia64', 'loongarch64', 'mips']
|
||||||
if dmi_arches.contains(host_machine.cpu_family())
|
if dmi_arches.contains(host_machine.cpu_family())
|
||||||
udev_progs += [['dmi_memory_id/dmi_memory_id.c']]
|
udev_progs += [['dmi_memory_id/dmi_memory_id.c']]
|
||||||
endif
|
endif
|
||||||
|
|||||||
7
test/test-execute/exec-personality-loongarch64.service
Normal file
7
test/test-execute/exec-personality-loongarch64.service
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Test for Personality=loongarch64
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/sh -c 'echo $(uname -m); exit $(test $(uname -m) = "loongarch64")'
|
||||||
|
Type=oneshot
|
||||||
|
Personality=loongarch64
|
||||||
Loading…
x
Reference in New Issue
Block a user