Compare commits
No commits in common. "ed6727d40ae31df16c989763160ac511c67bac5f" and "0f2d351f790516bc3f1158d964c5f83f339addb2" have entirely different histories.
ed6727d40a
...
0f2d351f79
|
@ -1,44 +0,0 @@
|
||||||
---
|
|
||||||
# vi: ts=2 sw=2 et:
|
|
||||||
#
|
|
||||||
name: Build test
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- '**/meson.build'
|
|
||||||
- '.github/workflows/**'
|
|
||||||
- 'meson_options.txt'
|
|
||||||
- 'src/**'
|
|
||||||
- 'test/fuzz/**'
|
|
||||||
- 'travis-ci/managers/ubuntu-build-check.sh'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
env:
|
|
||||||
# As we use postfixed clang/gcc binaries, we need to override $AR
|
|
||||||
# as well, otherwise meson falls back to ar from binutils which
|
|
||||||
# doesn't work with LTO
|
|
||||||
- { CC: "clang-10", CXX: "clang++-10", AR: "llvm-ar-10" }
|
|
||||||
- { CC: "gcc-10", CXX: "g++-10", AR: "gcc-ar-10" }
|
|
||||||
env: ${{ matrix.env }}
|
|
||||||
steps:
|
|
||||||
- name: Repository checkout
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
- name: Configure custom APT repositories for ${{ env.CC }}
|
|
||||||
run: |
|
|
||||||
if [[ "$CC" == clang-* ]]; then
|
|
||||||
# Latest LLVM stack deb packages provided by https://apt.llvm.org/
|
|
||||||
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
|
|
||||||
sudo apt-get install clang-10 llvm-10
|
|
||||||
else
|
|
||||||
# Latest gcc stack deb packages provided by
|
|
||||||
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
|
|
||||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
||||||
sudo apt-get install gcc-10
|
|
||||||
fi
|
|
||||||
- name: Build check (${{ env.CC }})
|
|
||||||
run: sudo -E travis-ci/managers/ubuntu-build-check.sh
|
|
61
.travis.yml
61
.travis.yml
|
@ -1,5 +1,5 @@
|
||||||
sudo: required
|
sudo: required
|
||||||
dist: bionic
|
dist: xenial
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ env:
|
||||||
- REPO_ROOT="$TRAVIS_BUILD_DIR"
|
- REPO_ROOT="$TRAVIS_BUILD_DIR"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- name: Build check
|
||||||
|
if: type != cron
|
||||||
|
|
||||||
- name: Build & test
|
- name: Build & test
|
||||||
if: type != cron
|
if: type != cron
|
||||||
|
|
||||||
|
@ -20,6 +23,45 @@ stages:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
|
- stage: Build check
|
||||||
|
name: Fedora Rawhide (gcc)
|
||||||
|
language: bash
|
||||||
|
env:
|
||||||
|
- FEDORA_RELEASE="rawhide"
|
||||||
|
- CONT_NAME="systemd-fedora-$FEDORA_RELEASE"
|
||||||
|
- DOCKER_EXEC="docker exec -ti $CONT_NAME"
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
||||||
|
- docker --version
|
||||||
|
install:
|
||||||
|
- $CI_MANAGERS/fedora.sh SETUP
|
||||||
|
script:
|
||||||
|
- set -e
|
||||||
|
# Build systemd
|
||||||
|
- $CI_MANAGERS/fedora.sh RUN_BUILD_CHECK_GCC
|
||||||
|
- set +e
|
||||||
|
after_script:
|
||||||
|
- $CI_MANAGERS/fedora.sh CLEANUP
|
||||||
|
|
||||||
|
- name: Fedora Rawhide (clang)
|
||||||
|
language: bash
|
||||||
|
env:
|
||||||
|
- FEDORA_RELEASE="rawhide"
|
||||||
|
- CONT_NAME="systemd-fedora-$FEDORA_RELEASE"
|
||||||
|
- DOCKER_EXEC="docker exec -ti $CONT_NAME"
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
||||||
|
- docker --version
|
||||||
|
install:
|
||||||
|
- $CI_MANAGERS/fedora.sh SETUP
|
||||||
|
script:
|
||||||
|
- set -e
|
||||||
|
# Build systemd
|
||||||
|
- $CI_MANAGERS/fedora.sh RUN_BUILD_CHECK_CLANG
|
||||||
|
- set +e
|
||||||
|
after_script:
|
||||||
|
- $CI_MANAGERS/fedora.sh CLEANUP
|
||||||
|
|
||||||
- stage: Build & test
|
- stage: Build & test
|
||||||
name: Debian Testing
|
name: Debian Testing
|
||||||
language: bash
|
language: bash
|
||||||
|
@ -33,7 +75,10 @@ jobs:
|
||||||
install:
|
install:
|
||||||
- $CI_MANAGERS/debian.sh SETUP
|
- $CI_MANAGERS/debian.sh SETUP
|
||||||
script:
|
script:
|
||||||
- $CI_MANAGERS/debian.sh RUN || travis_terminate 1
|
- set -e
|
||||||
|
# Build systemd
|
||||||
|
- $CI_MANAGERS/debian.sh RUN
|
||||||
|
- set +e
|
||||||
after_script:
|
after_script:
|
||||||
- $CI_MANAGERS/debian.sh CLEANUP
|
- $CI_MANAGERS/debian.sh CLEANUP
|
||||||
|
|
||||||
|
@ -49,7 +94,9 @@ jobs:
|
||||||
install:
|
install:
|
||||||
- $CI_MANAGERS/debian.sh SETUP
|
- $CI_MANAGERS/debian.sh SETUP
|
||||||
script:
|
script:
|
||||||
- $CI_MANAGERS/debian.sh RUN_ASAN || travis_terminate 1
|
- set -e
|
||||||
|
- $CI_MANAGERS/debian.sh RUN_ASAN
|
||||||
|
- set +e
|
||||||
after_script:
|
after_script:
|
||||||
- $CI_MANAGERS/debian.sh CLEANUP
|
- $CI_MANAGERS/debian.sh CLEANUP
|
||||||
|
|
||||||
|
@ -65,7 +112,9 @@ jobs:
|
||||||
install:
|
install:
|
||||||
- $CI_MANAGERS/debian.sh SETUP
|
- $CI_MANAGERS/debian.sh SETUP
|
||||||
script:
|
script:
|
||||||
- $CI_MANAGERS/debian.sh RUN_CLANG || travis-travis_terminate 1
|
- set -e
|
||||||
|
- $CI_MANAGERS/debian.sh RUN_CLANG
|
||||||
|
- set +e
|
||||||
after_script:
|
after_script:
|
||||||
- $CI_MANAGERS/debian.sh CLEANUP
|
- $CI_MANAGERS/debian.sh CLEANUP
|
||||||
|
|
||||||
|
@ -81,7 +130,9 @@ jobs:
|
||||||
install:
|
install:
|
||||||
- $CI_MANAGERS/debian.sh SETUP
|
- $CI_MANAGERS/debian.sh SETUP
|
||||||
script:
|
script:
|
||||||
- $CI_MANAGERS/debian.sh RUN_CLANG_ASAN || travis_terminate 1
|
- set -e
|
||||||
|
- $CI_MANAGERS/debian.sh RUN_CLANG_ASAN
|
||||||
|
- set +e
|
||||||
after_script:
|
after_script:
|
||||||
- $CI_MANAGERS/debian.sh CLEANUP
|
- $CI_MANAGERS/debian.sh CLEANUP
|
||||||
|
|
||||||
|
|
|
@ -96,9 +96,11 @@ _public_ int sd_journal_printv(int priority, const char *format, va_list ap) {
|
||||||
|
|
||||||
/* Allocate large buffer to accommodate big message */
|
/* Allocate large buffer to accommodate big message */
|
||||||
if (len >= LINE_MAX) {
|
if (len >= LINE_MAX) {
|
||||||
|
_unused_ int rlen;
|
||||||
buffer = alloca(len + 9);
|
buffer = alloca(len + 9);
|
||||||
memcpy(buffer, "MESSAGE=", 8);
|
memcpy(buffer, "MESSAGE=", 8);
|
||||||
assert_se(vsnprintf(buffer + 8, len + 1, format, ap) == len);
|
rlen = vsnprintf(buffer + 8, len + 1, format, ap);
|
||||||
|
assert(len == rlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Strip trailing whitespace, keep prefix whitespace. */
|
/* Strip trailing whitespace, keep prefix whitespace. */
|
||||||
|
@ -472,9 +474,11 @@ _public_ int sd_journal_printv_with_location(int priority, const char *file, con
|
||||||
|
|
||||||
/* Allocate large buffer to accommodate big message */
|
/* Allocate large buffer to accommodate big message */
|
||||||
if (len >= LINE_MAX) {
|
if (len >= LINE_MAX) {
|
||||||
|
_unused_ int rlen;
|
||||||
buffer = alloca(len + 9);
|
buffer = alloca(len + 9);
|
||||||
memcpy(buffer, "MESSAGE=", 8);
|
memcpy(buffer, "MESSAGE=", 8);
|
||||||
assert_se(vsnprintf(buffer + 8, len + 1, format, ap) == len);
|
rlen = vsnprintf(buffer + 8, len + 1, format, ap);
|
||||||
|
assert(len == rlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Strip trailing whitespace, keep prefixing whitespace */
|
/* Strip trailing whitespace, keep prefixing whitespace */
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "dns-domain.h"
|
#include "dns-domain.h"
|
||||||
#include "event-util.h"
|
#include "event-util.h"
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
#include "hexdecoct.h"
|
|
||||||
#include "hostname-util.h"
|
#include "hostname-util.h"
|
||||||
#include "in-addr-util.h"
|
#include "in-addr-util.h"
|
||||||
#include "network-internal.h"
|
#include "network-internal.h"
|
||||||
|
@ -332,48 +331,6 @@ int sd_dhcp6_client_set_duid_llt(
|
||||||
return dhcp6_client_set_duid_internal(client, DUID_TYPE_LLT, NULL, 0, llt_time);
|
return dhcp6_client_set_duid_internal(client, DUID_TYPE_LLT, NULL, 0, llt_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* const dhcp6_duid_type_table[_DUID_TYPE_MAX] = {
|
|
||||||
[DUID_TYPE_LLT] = "DUID-LLT",
|
|
||||||
[DUID_TYPE_EN] = "DUID-EN/Vendor",
|
|
||||||
[DUID_TYPE_LL] = "DUID-LL",
|
|
||||||
[DUID_TYPE_UUID] = "UUID",
|
|
||||||
};
|
|
||||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(dhcp6_duid_type, DUIDType);
|
|
||||||
|
|
||||||
int sd_dhcp6_client_duid_as_string(
|
|
||||||
sd_dhcp6_client *client,
|
|
||||||
char **duid) {
|
|
||||||
_cleanup_free_ char *p = NULL, *s = NULL, *t = NULL;
|
|
||||||
const char *v;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert_return(client, -EINVAL);
|
|
||||||
assert_return(client->duid_len > 0, -ENODATA);
|
|
||||||
|
|
||||||
v = dhcp6_duid_type_to_string(be16toh(client->duid.type));
|
|
||||||
if (v) {
|
|
||||||
s = strdup(v);
|
|
||||||
if (!s)
|
|
||||||
return -ENOMEM;
|
|
||||||
} else {
|
|
||||||
r = asprintf(&s, "%0x", client->duid.type);
|
|
||||||
if (r < 0)
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
t = hexmem(&client->duid.raw.data, client->duid_len);
|
|
||||||
if (!t)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
p = strjoin(s, ":", t);
|
|
||||||
if (!p)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
*duid = TAKE_PTR(p);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sd_dhcp6_client_set_iaid(sd_dhcp6_client *client, uint32_t iaid) {
|
int sd_dhcp6_client_set_iaid(sd_dhcp6_client *client, uint32_t iaid) {
|
||||||
assert_return(client, -EINVAL);
|
assert_return(client, -EINVAL);
|
||||||
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
|
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
|
||||||
|
|
|
@ -176,10 +176,6 @@ _public_ int sd_network_link_get_dhcp6_client_iaid_string(int ifindex, char **ia
|
||||||
return network_link_get_string(ifindex, "DHCP6_CLIENT_IAID", iaid);
|
return network_link_get_string(ifindex, "DHCP6_CLIENT_IAID", iaid);
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ int sd_network_link_get_dhcp6_client_duid_string(int ifindex, char **duid) {
|
|
||||||
return network_link_get_string(ifindex, "DHCP6_CLIENT_DUID", duid);
|
|
||||||
}
|
|
||||||
|
|
||||||
_public_ int sd_network_link_get_required_for_online(int ifindex) {
|
_public_ int sd_network_link_get_required_for_online(int ifindex) {
|
||||||
_cleanup_free_ char *s = NULL;
|
_cleanup_free_ char *s = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
|
@ -1380,9 +1380,9 @@ static int link_status_one(
|
||||||
|
|
||||||
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **sip = NULL, **search_domains = NULL, **route_domains = NULL,
|
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **sip = NULL, **search_domains = NULL, **route_domains = NULL,
|
||||||
**pop3_server = NULL, **smtp_server = NULL, **lpr_server = NULL;
|
**pop3_server = NULL, **smtp_server = NULL, **lpr_server = NULL;
|
||||||
_cleanup_free_ char *t = NULL, *network = NULL, *client_id = NULL, *iaid = NULL, *duid = NULL;
|
|
||||||
const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL;
|
|
||||||
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL;
|
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL;
|
||||||
|
_cleanup_free_ char *t = NULL, *network = NULL, *client_id = NULL, *iaid = NULL;
|
||||||
|
const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL;
|
||||||
const char *on_color_operational, *off_color_operational,
|
const char *on_color_operational, *off_color_operational,
|
||||||
*on_color_setup, *off_color_setup;
|
*on_color_setup, *off_color_setup;
|
||||||
_cleanup_free_ int *carrier_bound_to = NULL, *carrier_bound_by = NULL;
|
_cleanup_free_ int *carrier_bound_to = NULL, *carrier_bound_by = NULL;
|
||||||
|
@ -2093,16 +2093,6 @@ static int link_status_one(
|
||||||
return table_log_add_error(r);
|
return table_log_add_error(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sd_network_link_get_dhcp6_client_duid_string(info->ifindex, &duid);
|
|
||||||
if (r >= 0) {
|
|
||||||
r = table_add_many(table,
|
|
||||||
TABLE_EMPTY,
|
|
||||||
TABLE_STRING, "DHCP6 Client DUID:",
|
|
||||||
TABLE_STRING, duid);
|
|
||||||
if (r < 0)
|
|
||||||
return table_log_add_error(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
r = dump_lldp_neighbors(table, "Connected To:", info->ifindex);
|
r = dump_lldp_neighbors(table, "Connected To:", info->ifindex);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -4086,6 +4086,7 @@ int link_save(Link *link) {
|
||||||
const char *admin_state, *oper_state, *carrier_state, *address_state;
|
const char *admin_state, *oper_state, *carrier_state, *address_state;
|
||||||
_cleanup_free_ char *temp_path = NULL;
|
_cleanup_free_ char *temp_path = NULL;
|
||||||
_cleanup_fclose_ FILE *f = NULL;
|
_cleanup_fclose_ FILE *f = NULL;
|
||||||
|
uint32_t iaid;
|
||||||
Route *route;
|
Route *route;
|
||||||
Address *a;
|
Address *a;
|
||||||
Iterator i;
|
Iterator i;
|
||||||
|
@ -4420,19 +4421,10 @@ int link_save(Link *link) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link->dhcp6_client) {
|
|
||||||
_cleanup_free_ char *duid = NULL;
|
|
||||||
uint32_t iaid;
|
|
||||||
|
|
||||||
r = sd_dhcp6_client_get_iaid(link->dhcp6_client, &iaid);
|
r = sd_dhcp6_client_get_iaid(link->dhcp6_client, &iaid);
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
fprintf(f, "DHCP6_CLIENT_IAID=0x%x\n", iaid);
|
fprintf(f, "DHCP6_CLIENT_IAID=0x%x\n", iaid);
|
||||||
|
|
||||||
r = sd_dhcp6_client_duid_as_string(link->dhcp6_client, &duid);
|
|
||||||
if (r >= 0)
|
|
||||||
fprintf(f, "DHCP6_CLIENT_DUID=%s\n", duid);
|
|
||||||
}
|
|
||||||
|
|
||||||
r = fflush_and_check(f);
|
r = fflush_and_check(f);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -108,16 +108,12 @@ int can_sleep_state(char **types) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* If /sys is read-only we cannot sleep */
|
/* If /sys is read-only we cannot sleep */
|
||||||
if (access("/sys/power/state", W_OK) < 0) {
|
if (access("/sys/power/state", W_OK) < 0)
|
||||||
log_debug_errno(errno, "/sys/power/state is not writable, cannot sleep: %m");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
r = read_one_line_file("/sys/power/state", &p);
|
r = read_one_line_file("/sys/power/state", &p);
|
||||||
if (r < 0) {
|
if (r < 0)
|
||||||
log_debug_errno(r, "Failed to read /sys/power/state, cannot sleep: %m");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
STRV_FOREACH(type, types) {
|
STRV_FOREACH(type, types) {
|
||||||
const char *word, *state;
|
const char *word, *state;
|
||||||
|
@ -133,9 +129,9 @@ int can_sleep_state(char **types) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int can_sleep_disk(char **types) {
|
int can_sleep_disk(char **types) {
|
||||||
_cleanup_free_ char *p = NULL;
|
|
||||||
char **type;
|
char **type;
|
||||||
int r;
|
int r;
|
||||||
|
_cleanup_free_ char *p = NULL;
|
||||||
|
|
||||||
if (strv_isempty(types))
|
if (strv_isempty(types))
|
||||||
return true;
|
return true;
|
||||||
|
@ -203,16 +199,15 @@ static int swap_device_to_device_id(const SwapEntry *swap, dev_t *ret_dev) {
|
||||||
|
|
||||||
r = stat(swap->device, &sb);
|
r = stat(swap->device, &sb);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return -errno;
|
return r;
|
||||||
|
|
||||||
if (streq(swap->type, "partition")) {
|
if (streq(swap->type, "partition")) {
|
||||||
if (!S_ISBLK(sb.st_mode))
|
if (!S_ISBLK(sb.st_mode))
|
||||||
return -ENOTBLK;
|
return -ENOTBLK;
|
||||||
|
|
||||||
*ret_dev = sb.st_rdev;
|
*ret_dev = sb.st_rdev;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
|
} else
|
||||||
return get_block_device(swap->device, ret_dev);
|
return get_block_device(swap->device, ret_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,15 +227,15 @@ static int calculate_swap_file_offset(const SwapEntry *swap, uint64_t *ret_offse
|
||||||
|
|
||||||
fd = open(swap->device, O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
fd = open(swap->device, O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return log_debug_errno(errno, "Failed to open swap file %s to determine on-disk offset: %m", swap->device);
|
return log_error_errno(errno, "Failed to open swap file %s to determine on-disk offset: %m", swap->device);
|
||||||
|
|
||||||
if (fstat(fd, &sb) < 0)
|
if (fstat(fd, &sb) < 0)
|
||||||
return log_debug_errno(errno, "Failed to stat %s: %m", swap->device);
|
return log_error_errno(errno, "Failed to stat %s: %m", swap->device);
|
||||||
|
|
||||||
btrfs = btrfs_is_filesystem(fd);
|
btrfs = btrfs_is_filesystem(fd);
|
||||||
if (btrfs < 0)
|
if (btrfs < 0)
|
||||||
return log_debug_errno(btrfs, "Error checking %s for Btrfs filesystem: %m", swap->device);
|
return log_error_errno(btrfs, "Error checking %s for Btrfs filesystem: %m", swap->device);
|
||||||
if (btrfs > 0) {
|
else if (btrfs > 0) {
|
||||||
log_debug("%s: detection of swap file offset on Btrfs is not supported", swap->device);
|
log_debug("%s: detection of swap file offset on Btrfs is not supported", swap->device);
|
||||||
*ret_offset = UINT64_MAX;
|
*ret_offset = UINT64_MAX;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -251,13 +246,14 @@ static int calculate_swap_file_offset(const SwapEntry *swap, uint64_t *ret_offse
|
||||||
return log_debug_errno(r, "Unable to read extent map for '%s': %m", swap->device);
|
return log_debug_errno(r, "Unable to read extent map for '%s': %m", swap->device);
|
||||||
|
|
||||||
*ret_offset = fiemap->fm_extents[0].fe_physical / page_size();
|
*ret_offset = fiemap->fm_extents[0].fe_physical / page_size();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_resume_files(dev_t *ret_resume, uint64_t *ret_resume_offset) {
|
static int read_resume_files(dev_t *ret_resume, uint64_t *ret_resume_offset) {
|
||||||
_cleanup_free_ char *resume_str = NULL, *resume_offset_str = NULL;
|
_cleanup_free_ char *resume_str = NULL, *resume_offset_str = NULL;
|
||||||
uint64_t resume_offset = 0;
|
|
||||||
dev_t resume;
|
dev_t resume;
|
||||||
|
uint64_t resume_offset = 0;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = read_one_line_file("/sys/power/resume", &resume_str);
|
r = read_one_line_file("/sys/power/resume", &resume_str);
|
||||||
|
@ -270,13 +266,13 @@ static int read_resume_files(dev_t *ret_resume, uint64_t *ret_resume_offset) {
|
||||||
|
|
||||||
r = read_one_line_file("/sys/power/resume_offset", &resume_offset_str);
|
r = read_one_line_file("/sys/power/resume_offset", &resume_offset_str);
|
||||||
if (r == -ENOENT)
|
if (r == -ENOENT)
|
||||||
log_debug_errno(r, "Kernel does not support resume_offset; swap file offset detection will be skipped.");
|
log_debug("Kernel does not support resume_offset; swap file offset detection will be skipped.");
|
||||||
else if (r < 0)
|
else if (r < 0)
|
||||||
return log_debug_errno(r, "Error reading /sys/power/resume_offset: %m");
|
return log_debug_errno(r, "Error reading /sys/power/resume_offset: %m");
|
||||||
else {
|
else {
|
||||||
r = safe_atou64(resume_offset_str, &resume_offset);
|
r = safe_atou64(resume_offset_str, &resume_offset);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_debug_errno(r, "Failed to parse value in /sys/power/resume_offset \"%s\": %m", resume_offset_str);
|
return log_error_errno(r, "Failed to parse value in /sys/power/resume_offset \"%s\": %m", resume_offset_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resume_offset > 0 && resume == 0)
|
if (resume_offset > 0 && resume == 0)
|
||||||
|
@ -329,8 +325,9 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
|
||||||
|
|
||||||
f = fopen("/proc/swaps", "re");
|
f = fopen("/proc/swaps", "re");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
log_debug_errno(errno, "Failed to open /proc/swaps: %m");
|
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
|
||||||
return errno == ENOENT ? -EOPNOTSUPP : -errno; /* Convert swap not supported to a recognizable error */
|
"Failed to open /proc/swaps: %m");
|
||||||
|
return negative_errno();
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) fscanf(f, "%*s %*s %*s %*s %*s\n");
|
(void) fscanf(f, "%*s %*s %*s %*s %*s\n");
|
||||||
|
@ -341,7 +338,7 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
|
||||||
|
|
||||||
swap = new0(SwapEntry, 1);
|
swap = new0(SwapEntry, 1);
|
||||||
if (!swap)
|
if (!swap)
|
||||||
return -ENOMEM;
|
return log_oom();
|
||||||
|
|
||||||
k = fscanf(f,
|
k = fscanf(f,
|
||||||
"%ms " /* device/file */
|
"%ms " /* device/file */
|
||||||
|
@ -353,13 +350,13 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
|
||||||
if (k == EOF)
|
if (k == EOF)
|
||||||
break;
|
break;
|
||||||
if (k != 5) {
|
if (k != 5) {
|
||||||
log_debug("Failed to parse /proc/swaps:%u, ignoring", i);
|
log_warning("Failed to parse /proc/swaps:%u", i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (streq(swap->type, "file")) {
|
if (streq(swap->type, "file")) {
|
||||||
if (endswith(swap->device, "\\040(deleted)")) {
|
if (endswith(swap->device, "\\040(deleted)")) {
|
||||||
log_debug("Ignoring deleted swap file '%s'.", swap->device);
|
log_warning("Ignoring deleted swap file '%s'.", swap->device);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,12 +393,12 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
|
||||||
dev_t swap_device;
|
dev_t swap_device;
|
||||||
r = swap_device_to_device_id(swap, &swap_device);
|
r = swap_device_to_device_id(swap, &swap_device);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_debug_errno(r, "%s: failed to query device number: %m", swap->device);
|
return log_error_errno(r, "%s: failed to query device number: %m", swap->device);
|
||||||
|
|
||||||
hibernate_location = hibernate_location_free(hibernate_location);
|
hibernate_location = hibernate_location_free(hibernate_location);
|
||||||
hibernate_location = new(HibernateLocation, 1);
|
hibernate_location = new(HibernateLocation, 1);
|
||||||
if (!hibernate_location)
|
if (!hibernate_location)
|
||||||
return -ENOMEM;
|
return log_oom();
|
||||||
|
|
||||||
*hibernate_location = (HibernateLocation) {
|
*hibernate_location = (HibernateLocation) {
|
||||||
.devno = swap_device,
|
.devno = swap_device,
|
||||||
|
@ -588,7 +585,8 @@ static bool can_s2h(const SleepConfig *sleep_config) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!clock_supported(CLOCK_BOOTTIME_ALARM)) {
|
if (!clock_supported(CLOCK_BOOTTIME_ALARM)) {
|
||||||
log_debug("CLOCK_BOOTTIME_ALARM is not supported.");
|
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
|
||||||
|
"CLOCK_BOOTTIME_ALARM is not supported");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,9 +675,9 @@ int sleep_settings(const char *verb, const SleepConfig *sleep_config, bool *ret_
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SleepConfig* free_sleep_config(SleepConfig *sc) {
|
void free_sleep_config(SleepConfig *sc) {
|
||||||
if (!sc)
|
if (!sc)
|
||||||
return NULL;
|
return;
|
||||||
|
|
||||||
strv_free(sc->suspend_modes);
|
strv_free(sc->suspend_modes);
|
||||||
strv_free(sc->suspend_states);
|
strv_free(sc->suspend_states);
|
||||||
|
@ -690,5 +688,5 @@ SleepConfig* free_sleep_config(SleepConfig *sc) {
|
||||||
strv_free(sc->hybrid_modes);
|
strv_free(sc->hybrid_modes);
|
||||||
strv_free(sc->hybrid_states);
|
strv_free(sc->hybrid_states);
|
||||||
|
|
||||||
return mfree(sc);
|
free(sc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ typedef struct SleepConfig {
|
||||||
usec_t hibernate_delay_sec; /* HibernateDelaySec */
|
usec_t hibernate_delay_sec; /* HibernateDelaySec */
|
||||||
} SleepConfig;
|
} SleepConfig;
|
||||||
|
|
||||||
SleepConfig* free_sleep_config(SleepConfig *sc);
|
void free_sleep_config(SleepConfig *sc);
|
||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(SleepConfig*, free_sleep_config);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(SleepConfig*, free_sleep_config);
|
||||||
|
|
||||||
/* entry in /proc/swaps */
|
/* entry in /proc/swaps */
|
||||||
|
|
|
@ -108,9 +108,6 @@ static int write_state(FILE **f, char **states) {
|
||||||
char **state;
|
char **state;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(f);
|
|
||||||
assert(*f);
|
|
||||||
|
|
||||||
STRV_FOREACH(state, states) {
|
STRV_FOREACH(state, states) {
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
|
@ -197,14 +194,12 @@ static int execute(char **modes, char **states) {
|
||||||
|
|
||||||
setvbuf(f, NULL, _IONBF, 0);
|
setvbuf(f, NULL, _IONBF, 0);
|
||||||
|
|
||||||
/* Configure hibernation settings if we are supposed to hibernate */
|
/* Configure the hibernation mode */
|
||||||
if (!strv_isempty(modes)) {
|
if (!strv_isempty(modes)) {
|
||||||
r = find_hibernate_location(&hibernate_location);
|
r = find_hibernate_location(&hibernate_location);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to find location to hibernate to: %m");
|
return r;
|
||||||
if (r == 0) { /* 0 means: no hibernation location was configured in the kernel so far, let's
|
else if (r == 0) {
|
||||||
* do it ourselves then. > 0 means: kernel already had a configured hibernation
|
|
||||||
* location which we shouldn't touch. */
|
|
||||||
r = write_hibernate_location_info(hibernate_location);
|
r = write_hibernate_location_info(hibernate_location);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to prepare for hibernation: %m");
|
return log_error_errno(r, "Failed to prepare for hibernation: %m");
|
||||||
|
@ -280,11 +275,11 @@ static int execute_s2h(const SleepConfig *sleep_config) {
|
||||||
|
|
||||||
r = execute(sleep_config->hibernate_modes, sleep_config->hibernate_states);
|
r = execute(sleep_config->hibernate_modes, sleep_config->hibernate_states);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_notice_errno(r, "Couldn't hibernate, will try to suspend again: %m");
|
log_notice_errno(r, "Couldn't hibernate, will try to suspend again.");
|
||||||
|
|
||||||
r = execute(sleep_config->suspend_modes, sleep_config->suspend_states);
|
r = execute(sleep_config->suspend_modes, sleep_config->suspend_states);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Could neither hibernate nor suspend, giving up: %m");
|
return log_notice_errno(r, "Could neither hibernate nor suspend again, giving up.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -113,9 +113,6 @@ int sd_dhcp6_client_set_iaid(
|
||||||
int sd_dhcp6_client_get_iaid(
|
int sd_dhcp6_client_get_iaid(
|
||||||
sd_dhcp6_client *client,
|
sd_dhcp6_client *client,
|
||||||
uint32_t *iaid);
|
uint32_t *iaid);
|
||||||
int sd_dhcp6_client_duid_as_string(
|
|
||||||
sd_dhcp6_client *client,
|
|
||||||
char **duid);
|
|
||||||
int sd_dhcp6_client_set_fqdn(
|
int sd_dhcp6_client_set_fqdn(
|
||||||
sd_dhcp6_client *client,
|
sd_dhcp6_client *client,
|
||||||
const char *fqdn);
|
const char *fqdn);
|
||||||
|
|
|
@ -194,9 +194,6 @@ int sd_network_link_get_dhcp4_client_id_string(int ifindex, char **client_id);
|
||||||
/* Get DHCPv6 client IAID for a given link. */
|
/* Get DHCPv6 client IAID for a given link. */
|
||||||
int sd_network_link_get_dhcp6_client_iaid_string(int ifindex, char **iaid);
|
int sd_network_link_get_dhcp6_client_iaid_string(int ifindex, char **iaid);
|
||||||
|
|
||||||
/* Get DHCPv6 client DUID for a given link. */
|
|
||||||
int sd_network_link_get_dhcp6_client_duid_string(int ifindex, char **duid);
|
|
||||||
|
|
||||||
/* Monitor object */
|
/* Monitor object */
|
||||||
typedef struct sd_network_monitor sd_network_monitor;
|
typedef struct sd_network_monitor sd_network_monitor;
|
||||||
|
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
info() { echo -e "\033[33;1m$1\033[0m"; }
|
|
||||||
error() { echo >&2 -e "\033[31;1m$1\033[0m"; }
|
|
||||||
success() { echo >&2 -e "\033[32;1m$1\033[0m"; }
|
|
||||||
|
|
||||||
ARGS=(
|
|
||||||
"--optimization=0"
|
|
||||||
"--optimization=2"
|
|
||||||
"--optimization=3"
|
|
||||||
"--optimization=s"
|
|
||||||
"-Db_lto=true"
|
|
||||||
"-Db_ndebug=true"
|
|
||||||
)
|
|
||||||
PACKAGES=(
|
|
||||||
cryptsetup-bin
|
|
||||||
expect
|
|
||||||
fdisk
|
|
||||||
gettext
|
|
||||||
iptables-dev
|
|
||||||
iputils-ping
|
|
||||||
isc-dhcp-client
|
|
||||||
itstool
|
|
||||||
kbd
|
|
||||||
libblkid-dev
|
|
||||||
libcap-dev
|
|
||||||
libcurl4-gnutls-dev
|
|
||||||
libfdisk-dev
|
|
||||||
libgpg-error-dev
|
|
||||||
liblz4-dev
|
|
||||||
liblzma-dev
|
|
||||||
libmicrohttpd-dev
|
|
||||||
libmount-dev
|
|
||||||
libp11-kit-dev
|
|
||||||
libpwquality-dev
|
|
||||||
libqrencode-dev
|
|
||||||
libssl-dev
|
|
||||||
libxkbcommon-dev
|
|
||||||
libzstd-dev
|
|
||||||
mount
|
|
||||||
net-tools
|
|
||||||
ninja-build
|
|
||||||
perl
|
|
||||||
python-lxml
|
|
||||||
python3-evdev
|
|
||||||
python3-lxml
|
|
||||||
python3-pip
|
|
||||||
python3-pyparsing
|
|
||||||
python3-setuptools
|
|
||||||
quota
|
|
||||||
strace
|
|
||||||
unifont
|
|
||||||
util-linux
|
|
||||||
zstd
|
|
||||||
)
|
|
||||||
CC="${CC:?}"
|
|
||||||
CXX="${CXX:?}"
|
|
||||||
AR="${AR:-""}"
|
|
||||||
RELEASE="$(lsb_release -cs)"
|
|
||||||
|
|
||||||
bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ $RELEASE main restricted universe multiverse' >>/etc/apt/sources.list"
|
|
||||||
|
|
||||||
# PPA with some newer build dependencies (like zstd)
|
|
||||||
add-apt-repository -y ppa:upstream-systemd-ci/systemd-ci
|
|
||||||
apt-get update
|
|
||||||
apt-get build-dep systemd -y
|
|
||||||
apt-get install -y "${PACKAGES[@]}"
|
|
||||||
# Install latest meson from pip, as the distro-one doesn't support
|
|
||||||
# --optimization=
|
|
||||||
pip3 install meson
|
|
||||||
|
|
||||||
$CC --version
|
|
||||||
|
|
||||||
for args in "${ARGS[@]}"; do
|
|
||||||
SECONDS=0
|
|
||||||
|
|
||||||
info "Checking build with $args"
|
|
||||||
if ! AR="$AR" CC="$CC" CXX="$CXX" meson --werror $args build; then
|
|
||||||
error "meson failed with $args"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! ninja -C build; then
|
|
||||||
error "ninja failed with $args"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git clean -dxf
|
|
||||||
|
|
||||||
success "Build with $args passed in $SECONDS seconds"
|
|
||||||
done
|
|
Loading…
Reference in New Issue