diff options
author | Thomas Haller <thaller@redhat.com> | 2019-11-20 10:09:28 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-11-20 10:13:44 +0100 |
commit | 046568cd0903b32c0603792dbc14181ed0abcd7f (patch) | |
tree | 74e59756c0bbd9578afd4a8a12c8721806371259 /src/systemd | |
parent | 5d020e1c92589521a157cb9e1180610ca1c8c9a6 (diff) | |
parent | c016165e1baed0ecb6179d8b7c8bfbdcdd02d437 (diff) | |
download | NetworkManager-046568cd0903b32c0603792dbc14181ed0abcd7f.tar.gz |
systemd: update code from upstream (2019-11-19)
This is a direct dump from systemd git.
======
SYSTEMD_DIR=../systemd
COMMIT=25f9288e31a586460c13d49edea9edafdca2a972
(
cd "$SYSTEMD_DIR"
git checkout "$COMMIT"
git reset --hard
git clean -fdx
)
git ls-files -z :/src/systemd/src/ \
:/shared/systemd/src/ \
:/shared/nm-std-aux/unaligned.h | \
xargs -0 rm -f
nm_copy_sd_shared() {
mkdir -p "./shared/systemd/$(dirname "$1")"
cp "$SYSTEMD_DIR/$1" "./shared/systemd/$1"
}
nm_copy_sd_core() {
mkdir -p "./src/systemd/$(dirname "$1")"
cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}
nm_copy_sd_stdaux() {
mkdir -p "./shared/nm-std-aux/"
cp "$SYSTEMD_DIR/$1" "./shared/nm-std-aux/${1##*/}"
}
nm_copy_sd_core "src/libsystemd-network/arp-util.c"
nm_copy_sd_core "src/libsystemd-network/arp-util.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd_core "src/libsystemd-network/lldp-internal.h"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd_core "src/libsystemd-network/lldp-network.c"
nm_copy_sd_core "src/libsystemd-network/lldp-network.h"
nm_copy_sd_core "src/libsystemd-network/network-internal.c"
nm_copy_sd_core "src/libsystemd-network/network-internal.h"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd_core "src/libsystemd-network/sd-lldp.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd_core "src/systemd/_sd-common.h"
nm_copy_sd_core "src/systemd/sd-dhcp-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp-option.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd_core "src/systemd/sd-event.h"
nm_copy_sd_core "src/systemd/sd-id128.h"
nm_copy_sd_core "src/systemd/sd-ipv4acd.h"
nm_copy_sd_core "src/systemd/sd-ipv4ll.h"
nm_copy_sd_core "src/systemd/sd-lldp.h"
nm_copy_sd_core "src/systemd/sd-ndisc.h"
nm_copy_sd_shared "src/basic/alloc-util.c"
nm_copy_sd_shared "src/basic/alloc-util.h"
nm_copy_sd_shared "src/basic/async.h"
nm_copy_sd_shared "src/basic/env-file.c"
nm_copy_sd_shared "src/basic/env-file.h"
nm_copy_sd_shared "src/basic/env-util.c"
nm_copy_sd_shared "src/basic/env-util.h"
nm_copy_sd_shared "src/basic/errno-util.h"
nm_copy_sd_shared "src/basic/escape.c"
nm_copy_sd_shared "src/basic/escape.h"
nm_copy_sd_shared "src/basic/ether-addr-util.c"
nm_copy_sd_shared "src/basic/ether-addr-util.h"
nm_copy_sd_shared "src/basic/extract-word.c"
nm_copy_sd_shared "src/basic/extract-word.h"
nm_copy_sd_shared "src/basic/fd-util.c"
nm_copy_sd_shared "src/basic/fd-util.h"
nm_copy_sd_shared "src/basic/fileio.c"
nm_copy_sd_shared "src/basic/fileio.h"
nm_copy_sd_shared "src/basic/format-util.c"
nm_copy_sd_shared "src/basic/format-util.h"
nm_copy_sd_shared "src/basic/fs-util.c"
nm_copy_sd_shared "src/basic/fs-util.h"
nm_copy_sd_shared "src/basic/hash-funcs.c"
nm_copy_sd_shared "src/basic/hash-funcs.h"
nm_copy_sd_shared "src/basic/hashmap.c"
nm_copy_sd_shared "src/basic/hashmap.h"
nm_copy_sd_shared "src/basic/hexdecoct.c"
nm_copy_sd_shared "src/basic/hexdecoct.h"
nm_copy_sd_shared "src/basic/hostname-util.c"
nm_copy_sd_shared "src/basic/hostname-util.h"
nm_copy_sd_shared "src/basic/in-addr-util.c"
nm_copy_sd_shared "src/basic/in-addr-util.h"
nm_copy_sd_shared "src/basic/io-util.c"
nm_copy_sd_shared "src/basic/io-util.h"
nm_copy_sd_shared "src/basic/list.h"
nm_copy_sd_shared "src/basic/log.h"
nm_copy_sd_shared "src/basic/macro.h"
nm_copy_sd_shared "src/basic/memory-util.c"
nm_copy_sd_shared "src/basic/memory-util.h"
nm_copy_sd_shared "src/basic/mempool.c"
nm_copy_sd_shared "src/basic/mempool.h"
nm_copy_sd_shared "src/basic/missing_fcntl.h"
nm_copy_sd_shared "src/basic/missing_random.h"
nm_copy_sd_shared "src/basic/missing_socket.h"
nm_copy_sd_shared "src/basic/missing_stat.h"
nm_copy_sd_shared "src/basic/missing_type.h"
nm_copy_sd_shared "src/basic/parse-util.c"
nm_copy_sd_shared "src/basic/parse-util.h"
nm_copy_sd_shared "src/basic/path-util.c"
nm_copy_sd_shared "src/basic/path-util.h"
nm_copy_sd_shared "src/basic/prioq.c"
nm_copy_sd_shared "src/basic/prioq.h"
nm_copy_sd_shared "src/basic/process-util.c"
nm_copy_sd_shared "src/basic/process-util.h"
nm_copy_sd_shared "src/basic/random-util.c"
nm_copy_sd_shared "src/basic/random-util.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.h"
nm_copy_sd_shared "src/basic/socket-util.c"
nm_copy_sd_shared "src/basic/socket-util.h"
nm_copy_sd_shared "src/basic/sort-util.h"
nm_copy_sd_shared "src/basic/sparse-endian.h"
nm_copy_sd_shared "src/basic/stat-util.c"
nm_copy_sd_shared "src/basic/stat-util.h"
nm_copy_sd_shared "src/basic/stdio-util.h"
nm_copy_sd_shared "src/basic/string-table.c"
nm_copy_sd_shared "src/basic/string-table.h"
nm_copy_sd_shared "src/basic/string-util.c"
nm_copy_sd_shared "src/basic/string-util.h"
nm_copy_sd_shared "src/basic/strv.c"
nm_copy_sd_shared "src/basic/strv.h"
nm_copy_sd_shared "src/basic/strxcpyx.c"
nm_copy_sd_shared "src/basic/strxcpyx.h"
nm_copy_sd_shared "src/basic/time-util.c"
nm_copy_sd_shared "src/basic/time-util.h"
nm_copy_sd_shared "src/basic/tmpfile-util.c"
nm_copy_sd_shared "src/basic/tmpfile-util.h"
nm_copy_sd_shared "src/basic/umask-util.h"
nm_copy_sd_shared "src/basic/utf8.c"
nm_copy_sd_shared "src/basic/utf8.h"
nm_copy_sd_shared "src/basic/util.c"
nm_copy_sd_shared "src/basic/util.h"
nm_copy_sd_shared "src/shared/dns-domain.c"
nm_copy_sd_shared "src/shared/dns-domain.h"
nm_copy_sd_stdaux "src/basic/unaligned.h"
Diffstat (limited to 'src/systemd')
-rw-r--r-- | src/systemd/meson.build | 48 | ||||
-rw-r--r-- | src/systemd/nm-sd-utils-core.c | 27 | ||||
-rw-r--r-- | src/systemd/nm-sd-utils-core.h | 17 | ||||
-rw-r--r-- | src/systemd/nm-sd-utils-dhcp.c | 40 | ||||
-rw-r--r-- | src/systemd/nm-sd-utils-dhcp.h | 20 | ||||
-rw-r--r-- | src/systemd/nm-sd.c | 129 | ||||
-rw-r--r-- | src/systemd/nm-sd.h | 30 | ||||
-rw-r--r-- | src/systemd/sd-adapt-core/condition.h | 5 | ||||
-rw-r--r-- | src/systemd/sd-adapt-core/conf-parser.h | 3 | ||||
-rw-r--r-- | src/systemd/sd-adapt-core/device-util.h | 3 | ||||
-rw-r--r-- | src/systemd/sd-adapt-core/khash.h | 3 | ||||
-rw-r--r-- | src/systemd/sd-adapt-core/nm-sd-adapt-core.c | 21 | ||||
-rw-r--r-- | src/systemd/sd-adapt-core/nm-sd-adapt-core.h | 86 | ||||
-rw-r--r-- | src/systemd/sd-adapt-core/sd-daemon.h | 3 | ||||
-rw-r--r-- | src/systemd/sd-adapt-core/sd-device.h | 3 | ||||
-rw-r--r-- | src/systemd/sd-adapt-core/udev-util.h | 3 |
16 files changed, 441 insertions, 0 deletions
diff --git a/src/systemd/meson.build b/src/systemd/meson.build new file mode 100644 index 0000000000..5c4fa3e2ad --- /dev/null +++ b/src/systemd/meson.build @@ -0,0 +1,48 @@ +sources = files( + 'src/libsystemd-network/arp-util.c', + 'src/libsystemd-network/dhcp-identifier.c', + 'src/libsystemd-network/dhcp-network.c', + 'src/libsystemd-network/dhcp-option.c', + 'src/libsystemd-network/dhcp-packet.c', + 'src/libsystemd-network/dhcp6-network.c', + 'src/libsystemd-network/dhcp6-option.c', + 'src/libsystemd-network/lldp-neighbor.c', + 'src/libsystemd-network/lldp-network.c', + 'src/libsystemd-network/network-internal.c', + 'src/libsystemd-network/sd-dhcp-client.c', + 'src/libsystemd-network/sd-dhcp-lease.c', + 'src/libsystemd-network/sd-dhcp6-client.c', + 'src/libsystemd-network/sd-dhcp6-lease.c', + 'src/libsystemd-network/sd-ipv4acd.c', + 'src/libsystemd-network/sd-ipv4ll.c', + 'src/libsystemd-network/sd-lldp.c', + 'src/libsystemd/sd-event/event-util.c', + 'src/libsystemd/sd-event/sd-event.c', + 'src/libsystemd/sd-id128/id128-util.c', + 'src/libsystemd/sd-id128/sd-id128.c', + 'nm-sd.c', + 'nm-sd-utils-core.c', + 'nm-sd-utils-dhcp.c', + 'sd-adapt-core/nm-sd-adapt-core.c', +) + +incs = include_directories( + 'sd-adapt-core', + 'src/libsystemd-network', + 'src/libsystemd/sd-event', + 'src/systemd', +) + +deps = [ + daemon_nm_default_dep, + libnm_systemd_shared_dep, +] + +libnm_systemd_core = static_library( + 'nm-systemd-core', + sources: sources, + include_directories: incs, + dependencies: deps, + c_args: '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD', + link_with: libc_siphash, +) diff --git a/src/systemd/nm-sd-utils-core.c b/src/systemd/nm-sd-utils-core.c new file mode 100644 index 0000000000..4057c70a90 --- /dev/null +++ b/src/systemd/nm-sd-utils-core.c @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: LGPL-2.1+ +/* + * Copyright (C) 2018 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-sd-utils-core.h" + +#include "nm-core-internal.h" + +#include "nm-sd-adapt-core.h" + +#include "sd-id128.h" + +/*****************************************************************************/ + +NMUuid * +nm_sd_utils_id128_get_machine (NMUuid *out_uuid) +{ + g_assert (out_uuid); + + G_STATIC_ASSERT_EXPR (sizeof (*out_uuid) == sizeof (sd_id128_t)); + if (sd_id128_get_machine ((sd_id128_t *) out_uuid) < 0) + return NULL; + return out_uuid; +} diff --git a/src/systemd/nm-sd-utils-core.h b/src/systemd/nm-sd-utils-core.h new file mode 100644 index 0000000000..3b0bc23bc7 --- /dev/null +++ b/src/systemd/nm-sd-utils-core.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: LGPL-2.1+ +/* + * Copyright (C) 2018 Red Hat, Inc. + */ + +#ifndef __NM_SD_UTILS_CORE_H__ +#define __NM_SD_UTILS_CORE_H__ + +/*****************************************************************************/ + +struct _NMUuid; + +struct _NMUuid *nm_sd_utils_id128_get_machine (struct _NMUuid *out_uuid); + +/*****************************************************************************/ + +#endif /* __NM_SD_UTILS_CORE_H__ */ diff --git a/src/systemd/nm-sd-utils-dhcp.c b/src/systemd/nm-sd-utils-dhcp.c new file mode 100644 index 0000000000..4cfe054c0d --- /dev/null +++ b/src/systemd/nm-sd-utils-dhcp.c @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: LGPL-2.1+ +/* + * Copyright (C) 2019 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-sd-utils-dhcp.h" + +#include "sd-adapt-core/nm-sd-adapt-core.h" +#include "src/libsystemd-network/dhcp-lease-internal.h" + +int +nm_sd_dhcp_lease_get_private_options (sd_dhcp_lease *lease, nm_sd_dhcp_option **out_options) +{ + struct sd_dhcp_raw_option *raw_option; + int cnt = 0; + + g_return_val_if_fail (lease, -EINVAL); + g_return_val_if_fail (out_options, -EINVAL); + g_return_val_if_fail (*out_options == NULL, -EINVAL); + + if (lease->private_options == NULL) + return -ENODATA; + + LIST_FOREACH (options, raw_option, lease->private_options) + cnt++; + + *out_options = g_new (nm_sd_dhcp_option, cnt); + cnt = 0; + + LIST_FOREACH (options, raw_option, lease->private_options) { + (*out_options)[cnt].code = raw_option->tag; + (*out_options)[cnt].data = raw_option->data; + (*out_options)[cnt].data_len = raw_option->length; + cnt++; + } + + return cnt; +} diff --git a/src/systemd/nm-sd-utils-dhcp.h b/src/systemd/nm-sd-utils-dhcp.h new file mode 100644 index 0000000000..5228eb2515 --- /dev/null +++ b/src/systemd/nm-sd-utils-dhcp.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: LGPL-2.1+ +/* + * Copyright (C) 2019 Red Hat, Inc. + */ + +#ifndef __NETWORKMANAGER_DHCP_SYSTEMD_UTILS_H__ +#define __NETWORKMANAGER_DHCP_SYSTEMD_UTILS_H__ + +#include "nm-sd.h" + +typedef struct { + uint8_t code; + uint8_t data_len; + void *data; +} nm_sd_dhcp_option; + +int +nm_sd_dhcp_lease_get_private_options (sd_dhcp_lease *lease, nm_sd_dhcp_option **out_options); + +#endif /* __NETWORKMANAGER_DHCP_SYSTEMD_UTILS_H__ */ diff --git a/src/systemd/nm-sd.c b/src/systemd/nm-sd.c new file mode 100644 index 0000000000..4cbee99fa7 --- /dev/null +++ b/src/systemd/nm-sd.c @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2014 - 2016 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-sd.h" + +#include "sd-event.h" + +/***************************************************************************** + * Integrating sd_event into glib. Taken and adjusted from + * https://www.freedesktop.org/software/systemd/man/sd_event_get_fd.html + *****************************************************************************/ + +typedef struct SDEventSource { + GSource source; + GPollFD pollfd; + sd_event *event; + guint *default_source_id; +} SDEventSource; + +static gboolean +event_prepare (GSource *source, int *timeout_) +{ + return sd_event_prepare (((SDEventSource *) source)->event) > 0; +} + +static gboolean +event_check (GSource *source) +{ + return sd_event_wait (((SDEventSource *) source)->event, 0) > 0; +} + +static gboolean +event_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) +{ + return sd_event_dispatch (((SDEventSource *)source)->event) > 0; +} + +static void +event_finalize (GSource *source) +{ + SDEventSource *s; + + s = (SDEventSource *) source; + sd_event_unref (s->event); + if (s->default_source_id) + *s->default_source_id = 0; +} + +static SDEventSource * +event_create_source (sd_event *event, guint *default_source_id) +{ + static GSourceFuncs event_funcs = { + .prepare = event_prepare, + .check = event_check, + .dispatch = event_dispatch, + .finalize = event_finalize, + }; + SDEventSource *source; + + g_return_val_if_fail (event, NULL); + + source = (SDEventSource *) g_source_new (&event_funcs, sizeof (SDEventSource)); + + source->event = sd_event_ref (event); + source->pollfd.fd = sd_event_get_fd (event); + source->pollfd.events = G_IO_IN | G_IO_HUP | G_IO_ERR; + source->default_source_id = default_source_id; + + g_source_add_poll ((GSource *) source, &source->pollfd); + + return source; +} + +static guint +event_attach (sd_event *event, GMainContext *context) +{ + SDEventSource *source; + guint id; + int r; + sd_event *e = event; + guint *p_default_source_id = NULL; + + if (!e) { + static guint default_source_id = 0; + + if (default_source_id) { + /* The default event cannot be registered multiple times. */ + g_return_val_if_reached (0); + } + + r = sd_event_default (&e); + if (r < 0) + g_return_val_if_reached (0); + + p_default_source_id = &default_source_id; + } + + source = event_create_source (e, p_default_source_id); + id = g_source_attach ((GSource *) source, context); + g_source_unref ((GSource *) source); + + if (!event) { + *p_default_source_id = id; + sd_event_unref (e); + } + + g_return_val_if_fail (id, 0); + return id; +} + +guint +nm_sd_event_attach_default (void) +{ + return event_attach (NULL, NULL); +} + +/*****************************************************************************/ + +/* ensure that defines in nm-sd.h correspond to the internal defines. */ + +#include "nm-sd-adapt-core.h" +#include "dhcp-lease-internal.h" + +/*****************************************************************************/ + diff --git a/src/systemd/nm-sd.h b/src/systemd/nm-sd.h new file mode 100644 index 0000000000..99904243f8 --- /dev/null +++ b/src/systemd/nm-sd.h @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2014 - 2016 Red Hat, Inc. + */ + +#ifndef __NM_SD_H__ +#define __NM_SD_H__ + +#include "systemd/src/systemd/sd-dhcp-client.h" +#include "systemd/src/systemd/sd-dhcp6-client.h" +#include "systemd/src/systemd/sd-lldp.h" +#include "systemd/src/systemd/sd-ipv4ll.h" + +/*****************************************************************************/ + +guint nm_sd_event_attach_default (void); + +/***************************************************************************** + * expose internal systemd API + * + * FIXME: don't use any internal systemd API. + *****************************************************************************/ + +struct sd_dhcp_lease; + +int dhcp_lease_save(struct sd_dhcp_lease *lease, const char *lease_file); +int dhcp_lease_load(struct sd_dhcp_lease **ret, const char *lease_file); + +#endif /* __NM_SD_H__ */ + diff --git a/src/systemd/sd-adapt-core/condition.h b/src/systemd/sd-adapt-core/condition.h new file mode 100644 index 0000000000..d3a6812af0 --- /dev/null +++ b/src/systemd/sd-adapt-core/condition.h @@ -0,0 +1,5 @@ +#pragma once + +/* dummy header */ + +typedef struct _sd_adapt_Condition Condition; diff --git a/src/systemd/sd-adapt-core/conf-parser.h b/src/systemd/sd-adapt-core/conf-parser.h new file mode 100644 index 0000000000..637892c2d6 --- /dev/null +++ b/src/systemd/sd-adapt-core/conf-parser.h @@ -0,0 +1,3 @@ +#pragma once + +/* dummy header */ diff --git a/src/systemd/sd-adapt-core/device-util.h b/src/systemd/sd-adapt-core/device-util.h new file mode 100644 index 0000000000..637892c2d6 --- /dev/null +++ b/src/systemd/sd-adapt-core/device-util.h @@ -0,0 +1,3 @@ +#pragma once + +/* dummy header */ diff --git a/src/systemd/sd-adapt-core/khash.h b/src/systemd/sd-adapt-core/khash.h new file mode 100644 index 0000000000..637892c2d6 --- /dev/null +++ b/src/systemd/sd-adapt-core/khash.h @@ -0,0 +1,3 @@ +#pragma once + +/* dummy header */ diff --git a/src/systemd/sd-adapt-core/nm-sd-adapt-core.c b/src/systemd/sd-adapt-core/nm-sd-adapt-core.c new file mode 100644 index 0000000000..a9f8bd1c81 --- /dev/null +++ b/src/systemd/sd-adapt-core/nm-sd-adapt-core.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2014 - 2016 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-sd-adapt-core.h" + +#include "fd-util.h" + +/*****************************************************************************/ + +int +asynchronous_close (int fd) { + safe_close (fd); + return -1; +} + +/*****************************************************************************/ + diff --git a/src/systemd/sd-adapt-core/nm-sd-adapt-core.h b/src/systemd/sd-adapt-core/nm-sd-adapt-core.h new file mode 100644 index 0000000000..81bc73202d --- /dev/null +++ b/src/systemd/sd-adapt-core/nm-sd-adapt-core.h @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: LGPL-2.1+ +/* + * Copyright (C) 2014 - 2018 Red Hat, Inc. + */ + +#ifndef __NM_SD_ADAPT_CORE_H__ +#define __NM_SD_ADAPT_CORE_H__ + +#include "nm-default.h" + +#include <stdbool.h> +#include <sys/resource.h> +#include <time.h> + +#include "systemd/sd-adapt-shared/nm-sd-adapt-shared.h" + +#ifndef HAVE_SYS_AUXV_H +#define HAVE_SYS_AUXV_H 0 +#endif + +/***************************************************************************** + * The remainder of the header is only enabled when building the systemd code + * itself. + *****************************************************************************/ + +#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_SYSTEMD + +#include <netinet/in.h> +#include <string.h> +#include <stdio.h> +#include <errno.h> +#include <elf.h> +#ifdef HAVE_SYS_AUXV_H +#include <sys/auxv.h> +#endif +#include <unistd.h> +#include <sys/syscall.h> +#include <sys/ioctl.h> + +/* Missing in Linux 3.2.0, in Ubuntu 12.04 */ +#ifndef BPF_XOR +#define BPF_XOR 0xa0 +#endif + +#ifndef ETHERTYPE_LLDP +#define ETHERTYPE_LLDP 0x88cc +#endif + +#ifndef HAVE_SECURE_GETENV +# ifdef HAVE___SECURE_GETENV +# define secure_getenv __secure_getenv +# else +# error neither secure_getenv nor __secure_getenv is available +# endif +#endif + +/*****************************************************************************/ + +static inline int +sd_notify (int unset_environment, const char *state) +{ + return 0; +} + +/* Can't include both net/if.h and linux/if.h; so have to define this here */ +#ifndef IF_NAMESIZE +#define IF_NAMESIZE 16 +#endif + +#ifndef IFNAMSIZ +#define IFNAMSIZ IF_NAMESIZE +#endif + +#ifndef MAX_HANDLE_SZ +#define MAX_HANDLE_SZ 128 +#endif + +#include "sd-id128.h" +#include "sparse-endian.h" +#include "async.h" +#include "util.h" + +#endif /* (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_SYSTEMD */ + +#endif /* __NM_SD_ADAPT_CORE_H__ */ + diff --git a/src/systemd/sd-adapt-core/sd-daemon.h b/src/systemd/sd-adapt-core/sd-daemon.h new file mode 100644 index 0000000000..637892c2d6 --- /dev/null +++ b/src/systemd/sd-adapt-core/sd-daemon.h @@ -0,0 +1,3 @@ +#pragma once + +/* dummy header */ diff --git a/src/systemd/sd-adapt-core/sd-device.h b/src/systemd/sd-adapt-core/sd-device.h new file mode 100644 index 0000000000..637892c2d6 --- /dev/null +++ b/src/systemd/sd-adapt-core/sd-device.h @@ -0,0 +1,3 @@ +#pragma once + +/* dummy header */ diff --git a/src/systemd/sd-adapt-core/udev-util.h b/src/systemd/sd-adapt-core/udev-util.h new file mode 100644 index 0000000000..637892c2d6 --- /dev/null +++ b/src/systemd/sd-adapt-core/udev-util.h @@ -0,0 +1,3 @@ +#pragma once + +/* dummy header */ |