Compare commits

..

50 Commits

Author SHA1 Message Date
Daan De Meyer 44c2c9a036 tree-wide: Mark linux and sys includes as system includes
Even though these are in our tree, we should still treat them as
system includes which helps various tools (clangd, iwyu, ...) understand
that these are system includes and <> should be used instead of "".
2025-04-18 14:19:16 +02:00
Daan De Meyer 9fea5b4250 tree-wide: Remove references to src/shared/linux
This directory doesn't exist anymore.
2025-04-18 14:19:16 +02:00
Daan De Meyer 793e187718 basic: Remove circular dependency between process-util.h and pidref.h 2025-04-18 14:19:16 +02:00
Daan De Meyer 95609f3dff basic: Remove circular dep between alloc-util.h and memory-util.h 2025-04-18 14:19:16 +02:00
Daan De Meyer 5d226b2f9a basic: Move macro.h include in list.h to the top of the file
Now that the circular dependency between log.h, macro.h and list.h
is gone, we can move the include to the top.
2025-04-18 14:19:16 +02:00
Daan De Meyer 93a1f7921a basic: Stop including log.h in macro.h
Now that the necessary functions from log.h have been moved to macro.h,
we can stop including log.h in macro.h. This requires modifying source
files all over the tree to include log.h instead.
2025-04-18 14:19:15 +02:00
Daan De Meyer c68eb22064 fundamental: Always use _Static_assert for assert_cc()
Let's get rid of the assert.h include in macro-fundamental.h by always
using the builtin. Behavior is unchanged.
2025-04-18 14:19:13 +02:00
Daan De Meyer 03e17cbe6e basic: Move assertion specific functions to assert-util.h
Various functions in log.h are only used by asserts, and there's
enough assertion related stuff in macro.h to justify a separate header
which also makes it easier to avoid circular dependencies.

Let's introduce assert-util.h and an accompanying fundamental header
and move all the assertion related stuff over there. PROJECT_FILE is
moved over to macro.h.
2025-04-18 13:59:06 +02:00
Daan De Meyer edfd847d47 fundamental: Move alignment logic to memory-util-fundamental.h
Aligning is closely related to memory management, so let's move these
macros and functions to memory-util-fundamental.h. This will allow us
to move assertion related logic out of macro-fundamental.h as well in
a later commit.
2025-04-18 13:59:06 +02:00
Daan De Meyer 5a124e8ee1 macro: Move definition of dummy_t to macro-fundamental.h
There is code in macro-fundamental.h that makes use of dummy_t so
let's make sure to declare dummy_t in macro-fundamental.h as well.
2025-04-18 13:59:06 +02:00
Daan De Meyer 69ebfef1a1 basic: Remove stdio-util.h include from log.h 2025-04-18 13:59:06 +02:00
Daan De Meyer 4a52d26d2b basic: Remove list.h include from log.h 2025-04-18 13:59:06 +02:00
Daan De Meyer b14f74f9ab basic: Move trivial cleanup/ref/unref macros from macro.h to memory-util.h
Let's keep macro.h for the extremely generic macros that don't fit anywhere
else. Since CLEANUP_ARRAY() is already in memory-util-fundamental.h, we can
make a good case for moving the other cleanup macros in there as well.
2025-04-18 13:59:04 +02:00
Daan De Meyer a4bff6ef8e basic: Move log context functions to log-context.h 2025-04-18 11:57:33 +02:00
Daan De Meyer 40d60725ec basic: Move ratelimit logging functions to ratelimit.h
The ratelimit logging functions are only useful in a few scenarios
so let's move them to ratelimit.h instead of keeping them in the
generic log.h
2025-04-18 10:11:40 +02:00
Yu Watanabe 39dd06dbc4 meson: build tests for nspawn even -Dnspawn= is disabled
Follow-up for d95818f522.
Fixes #36880.
2025-04-18 09:03:33 +02:00
Zbigniew Jędrzejewski-Szmek a30684b983
udev: several follow-ups for recent change about listening fds (#37162) 2025-04-18 08:48:08 +02:00
Yu Watanabe 8e7ef6abb8 NEWS: mention integration-tests meson option is deprecated
Follow-up for 710653d3bc.
2025-04-18 09:36:29 +09:00
Yu Watanabe f6a2a9ba93 daemon-util: remove existing fds with the same name from fdstore
Currently, all use cases of notify_push_fd()/notify_push_fdf()
assume that the name of each fd in the fdstore is unique.
For safety, let's remove the existing fds before pushing a new one
to avoid multiple fds with the same name stored in the fdstore.
2025-04-18 09:12:43 +09:00
Yu Watanabe 1785961660 udev: re-add unintentionally dropped error log
Follow-up for 9b6bf4e10e.
2025-04-18 09:06:09 +09:00
LuK1337 edc49209f1 rules: Make ADB and fastboot work out-of-the-box
d0db47dcdf/adb.h (199)
7199051aaf/fastboot/fastboot.cpp (244)
2025-04-18 06:06:35 +09:00
Lennart Poettering 2791b2bc3d shutdown: handle gracefully if a device disappears while we detach it
Let's gracefully handle cases where a device disappears in the time we
between our discovery and when we want to detach it, due to "auto-clear"
or a similar logic.

The loopback case already handled this quite OK, do the same for MD and
swap too.

Switch to ERRNO_IS_DEVICE_ABSENT() for all checks, just in case.

Also improve debug logging for all these cases, so we know exactly what
is going on.

This is inspired by #37160, but shouldn't really fix anything there, I
am pretty sure the ENODEV seen in that output stems from the STOP_ARRAY
call, not from the open().

Note that this does not change anything for the device mapper case,
because the DM subsystem does not return useful error codes to
userspace, hence everything is a complete mess there.
2025-04-18 06:03:03 +09:00
Yu Watanabe 7baf24c949
network/manager: hash_ops related cleanups (#37121) 2025-04-18 06:00:15 +09:00
Yu Watanabe ce921df8d1
network/network: hash_ops related cleanups (#37120) 2025-04-18 05:59:47 +09:00
Yu Watanabe c96a5d9912
misc: hash_ops related cleanups (#37117) 2025-04-18 05:59:15 +09:00
Yu Watanabe 6858c1fd8b
libudev: several trivial cleanups (#37106) 2025-04-18 05:58:41 +09:00
Stefan Hansson b1236ce38b missing_fcntl: Introduce O_ACCMODE_STRICT
On musl, O_ACCMODE is defined as (03|O_SEARCH), unlike glibc which
defines it as (O_RDONLY|O_WRONLY|O_RDWR). Additionally, O_SEARCH is
simply defined as O_PATH.

This causes problems for systemd on musl, as it changes the
behaviour of open_mkdir_at_full() to return -EINVAL if O_PATH is
included in flags due to the fact that O_ACCMODE includes O_SEARCH
(i.e. O_PATH). Consequently, this makes the test-fs-util test fail.

Upstream musl seems content with this behaviour and doesn't seem
interested in matching glibc's behaviour due to that defining it this
way allows for O_SEARCH to match POSIX better by allowing it to open
directories where read permission is missing. Apparently musl does some
emulation in other places to make this work more consistently as well.

Initially I took the approach of working around this by redefining
O_SEARCH as O_RDONLY if O_SEARCH == O_PATH. This fixes the test and is
the approach taken by both XZ[1] and Gzip[2][3], but was not taken as
redefining system headers potentially could be problematic.

Instead, introduce O_ACCMODE_STRICT which just is a copy of glibc's
O_ACCMODE and use it everywhere. This way we don't have to deal with
unusual definitions of O_ACCMODE from C standard libraries other than
glibc.

 [1]: https://git.tukaani.org/?p=xz.git;a=blob;f=src/xz/file_io.c;h=8c83269b13fa31284f7ea5f3627a1dfbce7d6e14;hb=HEAD#l72
 [2]: https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/fcntl.in.h
      (lines 380 and 396, commit d7f551b30f3f2a0fa57c1b10c12f4eea41a9b89e)
 [3]: https://lists.gnu.org/archive/html/bug-gzip/2025-01/msg00000.html
2025-04-18 05:22:06 +09:00
Yu Watanabe 52278e0634 network/wiphy: use hash_ops with destructor for managing Wiphy objects 2025-04-13 10:15:02 +09:00
Yu Watanabe 4cf443e644 network/link: use hash_ops with destructor for managing Link objects 2025-04-13 10:15:02 +09:00
Yu Watanabe a85f73fa55 network/network: use hash_ops with destructor for managing Network objects 2025-04-13 10:15:02 +09:00
Yu Watanabe 09ddaf2af3 hashmap: introduce ordered_hashmap_free_and_replace() 2025-04-13 10:15:02 +09:00
Yu Watanabe 919aeb666a network/network: use hash_ops with destructor for managing stacked netdevs 2025-04-13 10:15:02 +09:00
Yu Watanabe 1b25b88f82 network/bridge-fdb,mdb: use hash_ops with destructor 2025-04-13 10:10:29 +09:00
Yu Watanabe 5c6e6f5ad1 network/dhcp-server: use hash_ops with destructor for static lease 2025-04-13 10:10:29 +09:00
Yu Watanabe 10d786458c network/radv: use hash_ops with destructor for managing prefixes 2025-04-13 10:10:29 +09:00
Yu Watanabe d3af116afd network,udev: use hash_ops with destructor to manage SR-IOV configs 2025-04-13 10:09:53 +09:00
Yu Watanabe 32b5deb1b2 network/ndisc: replace set_free_free() with set_free()
They uses in_addr_prefix_hash_ops_free, hence set_free() is enough.
2025-04-13 10:09:45 +09:00
Yu Watanabe 6d1a69d0f0 network: use in6_addr_hash_ops_free in Network.ipv6_proxy_ndp_addresses
This also one adjustment to network_adjust_ipv6_proxy_ndp().
2025-04-13 10:09:45 +09:00
Yu Watanabe 25a9bd72ef network: use dns_name_hash_ops_free in dnssec negative trust anchors 2025-04-13 10:09:45 +09:00
Yu Watanabe 4100e0f207 sysv-generator: introduce hash_ops for SysvStub
This also renames free_sysvstub() -> sysvstub_free(), to follow our
usual coding style.
2025-04-13 10:00:57 +09:00
Yu Watanabe 765ffa12ee sysusers: use trivial_hash_ops_free for storing user/group name 2025-04-13 10:00:57 +09:00
Yu Watanabe 5f43554f90 sd-netlink: introduce custom hash_ops for GenericNetlinkFamily 2025-04-13 10:00:57 +09:00
Yu Watanabe 70669fa2fe sd-device-enumerator: use custom hash_ops with destructor 2025-04-13 10:00:57 +09:00
Yu Watanabe f92fac7e9b sd-device: replace set_free_free() with set_free()
These uses string_hash_ops_free, hence not set_free() is enough.
2025-04-13 10:00:57 +09:00
Yu Watanabe 855800aaec coredump: replace custom cleanup function with specific hash_ops with destructor 2025-04-13 10:00:57 +09:00
Yu Watanabe f8b0277101 analyze: replace set_free_free() with set_free()
set_put_strdup() uses &string_hash_ops_free, hence set_free() also
frees stored contents.
2025-04-13 10:00:57 +09:00
Yu Watanabe 9ee08c8dce libudev: use 'type* func()' style rather than 'type *func()' 2025-04-12 22:30:57 +09:00
Yu Watanabe 19aa8c0f0e libudev-list: use strdup_to()
No functional change, just refactoring.
2025-04-12 22:30:57 +09:00
Yu Watanabe 3e8a4defa8 libudev-list: use hashmap_dump_sorted() 2025-04-12 22:30:57 +09:00
Yu Watanabe 76a8f5ae4b libudev-list: use custom hash_ops with destructor for udev_list_entry 2025-04-12 22:30:57 +09:00
214 changed files with 1137 additions and 961 deletions

View File

@ -32,23 +32,23 @@ The following exceptions apply:
* some sources under src/udev/ are licensed under **GPL-2.0-or-later**, * some sources under src/udev/ are licensed under **GPL-2.0-or-later**,
so all udev programs (`systemd-udevd`, `udevadm`, and the udev builtins so all udev programs (`systemd-udevd`, `udevadm`, and the udev builtins
and test programs) are also distributed under **GPL-2.0-or-later**. and test programs) are also distributed under **GPL-2.0-or-later**.
* the header files contained in src/basic/linux/linux are copied * the header files contained in src/basic/include/linux are copied
verbatim from the Linux kernel source tree and are licensed under **GPL-2.0 WITH verbatim from the Linux kernel source tree and are licensed under **GPL-2.0 WITH
Linux-syscall-note** and are used within the scope of the Linux-syscall-note Linux-syscall-note** and are used within the scope of the Linux-syscall-note
exception provisions exception provisions
* the following sources are licensed under the **LGPL-2.0-or-later** license: * the following sources are licensed under the **LGPL-2.0-or-later** license:
- src/basic/utf8.c - src/basic/utf8.c
- src/shared/initreq.h - src/shared/initreq.h
* the src/basic/linux/bpf_insn.h header is copied from the Linux kernel * the src/basic/include/linux/bpf_insn.h header is copied from the Linux kernel
source tree and is licensed under either **BSD-2-Clause** or **GPL-2.0-only**, source tree and is licensed under either **BSD-2-Clause** or **GPL-2.0-only**,
and thus is included in the systemd build under the BSD-2-Clause license. and thus is included in the systemd build under the BSD-2-Clause license.
* The src/basic/linux/linux/wireguard.h header is copied from the Linux kernel * The src/basic/include/linux/wireguard.h header is copied from the Linux kernel
source tree and is licensed under either **MIT** or **GPL-2.0 WITH Linux-syscall-note**, source tree and is licensed under either **MIT** or **GPL-2.0 WITH Linux-syscall-note**,
and thus is included in the systemd build under the MIT license. and thus is included in the systemd build under the MIT license.
* the following sources are licensed under the **MIT** license (in case of our * the following sources are licensed under the **MIT** license (in case of our
scripts, to facilitate copying and reuse of those helpers to other projects): scripts, to facilitate copying and reuse of those helpers to other projects):
- hwdb.d/parse_hwdb.py - hwdb.d/parse_hwdb.py
- src/basic/linux/linux/batman_adv.h - src/basic/include/linux/batman_adv.h
- src/basic/sparse-endian.h - src/basic/sparse-endian.h
- tools/catalog-report.py - tools/catalog-report.py
* the following sources are licensed under the **CC0-1.0** license: * the following sources are licensed under the **CC0-1.0** license:

3
NEWS
View File

@ -96,6 +96,9 @@ CHANGES WITH 258 in spe:
continue to work, update to xf86-input-evdev >= 2.11.0 and continue to work, update to xf86-input-evdev >= 2.11.0 and
xf86-input-libinput >= 1.5.0 before updating to systemd >= 258. xf86-input-libinput >= 1.5.0 before updating to systemd >= 258.
* The meson option 'integration-tests' has been deprecated, and will be
removed in a future release.
— <place>, <date> — <place>, <date>
CHANGES WITH 257: CHANGES WITH 257:

View File

@ -5,7 +5,7 @@ set -e
# Exclude following paths from the Coccinelle transformations # Exclude following paths from the Coccinelle transformations
EXCLUDED_PATHS=( EXCLUDED_PATHS=(
"src/boot/efi/*" "src/boot/efi/*"
"src/basic/linux/*" "src/basic/include/linux/*"
# Symlinked to test-bus-vtable-cc.cc, which causes issues with the IN_SET macro # Symlinked to test-bus-vtable-cc.cc, which causes issues with the IN_SET macro
"src/libsystemd/sd-bus/test-bus-vtable.c" "src/libsystemd/sd-bus/test-bus-vtable.c"
"src/libsystemd/sd-journal/lookup3.c" "src/libsystemd/sd-journal/lookup3.c"

View File

@ -2061,8 +2061,8 @@ basic_includes = [
'.', '.',
), ),
include_directories( include_directories(
'src/basic/linux', 'src/basic/include',
is_system : true is_system : true,
), ),
] ]

View File

@ -77,6 +77,20 @@ ENV{DDC_DEVICE}=="?*", TAG+="uaccess"
# media player raw devices (for user-mode drivers, Android SDK, etc.) # media player raw devices (for user-mode drivers, Android SDK, etc.)
SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="uaccess" SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="uaccess"
# Android devices (ADB DbC, ADB, Fastboot)
# Used to interact with devices over Android Debug Bridge and Fastboot protocols, see:
# * https://developer.android.com/tools/adb
# * https://source.android.com/docs/setup/test/running
# * https://source.android.com/docs/setup/test/flash
#
# The bInterfaceClass and bInterfaceSubClass used are documented in source code here:
# * https://android.googlesource.com/platform/packages/modules/adb/+/d0db47dcdf941673f405e1095e6ffb5e565902e5/adb.h#199
# * https://android.googlesource.com/platform/system/core/+/7199051aaf0ddfa2849650933119307327d8669c/fastboot/fastboot.cpp#244
#
# Since it's using a generic vendor specific interface class, this can potentially result
# in a rare case where non-ADB/Fastboot device ends up with an ID_DEBUG_APPLIANCE="android".
SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:dc0201:*|*:ff4201:*|*:ff4203:*", ENV{ID_DEBUG_APPLIANCE}="android"
# software-defined radio communication devices # software-defined radio communication devices
ENV{ID_SOFTWARE_RADIO}=="?*", TAG+="uaccess" ENV{ID_SOFTWARE_RADIO}=="?*", TAG+="uaccess"
@ -111,4 +125,7 @@ SUBSYSTEM=="hidraw", ENV{ID_HARDWARE_WALLET}=="1", TAG+="uaccess"
# As defined in https://en.wikipedia.org/wiki/3Dconnexion # As defined in https://en.wikipedia.org/wiki/3Dconnexion
SUBSYSTEM=="hidraw", ENV{ID_INPUT_3D_MOUSE}=="1", TAG+="uaccess" SUBSYSTEM=="hidraw", ENV{ID_INPUT_3D_MOUSE}=="1", TAG+="uaccess"
# Debug interfaces (e.g. Android Debug Bridge)
ENV{ID_DEBUG_APPLIANCE}=="?*", TAG+="uaccess"
LABEL="uaccess_end" LABEL="uaccess_end"

View File

@ -3,6 +3,7 @@
#include "sd-bus.h" #include "sd-bus.h"
#include "memory-util.h"
#include "time-util.h" #include "time-util.h"
#include "unit-def.h" #include "unit-def.h"

View File

@ -31,7 +31,7 @@ static void log_syntax_callback(const char *unit, int level, void *userdata) {
r = set_put_strdup(s, unit); r = set_put_strdup(s, unit);
if (r < 0) { if (r < 0) {
set_free_free(*s); set_free(*s);
*s = POINTER_MAX; *s = POINTER_MAX;
} }
} }
@ -265,7 +265,7 @@ static int verify_unit(Unit *u, bool check_man, const char *root) {
static void set_destroy_ignore_pointer_max(Set **s) { static void set_destroy_ignore_pointer_max(Set **s) {
if (*s == POINTER_MAX) if (*s == POINTER_MAX)
return; return;
set_free_free(*s); set_free(*s);
} }
int verify_units( int verify_units(

View File

@ -7,6 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "assert-util.h"
#include "macro.h" #include "macro.h"
#include "memory-util.h" #include "memory-util.h"

View File

@ -3,6 +3,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "assert-util.h"
#include "macro.h" #include "macro.h"
extern int saved_argc; extern int saved_argc;

View File

@ -2,9 +2,9 @@
#include <stdio.h> #include <stdio.h>
#include "assert-util.h"
#include "errno-util.h" #include "errno-util.h"
#include "log.h" #include "log.h"
#include "macro.h"
static bool assert_return_is_critical = BUILD_MODE_DEVELOPER; static bool assert_return_is_critical = BUILD_MODE_DEVELOPER;

84
src/basic/assert-util.h Normal file
View File

@ -0,0 +1,84 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "assert-fundamental.h"
#include "macro.h"
/* Logging for various assertions */
void log_set_assert_return_is_critical(bool b);
bool log_get_assert_return_is_critical(void) _pure_;
_noreturn_ void log_assert_failed(const char *text, const char *file, int line, const char *func);
_noreturn_ void log_assert_failed_unreachable(const char *file, int line, const char *func);
void log_assert_failed_return(const char *text, const char *file, int line, const char *func);
#ifdef __COVERITY__
/* Use special definitions of assertion macros in order to prevent
* false positives of ASSERT_SIDE_EFFECT on Coverity static analyzer
* for uses of assert_se() and assert_return().
*
* These definitions make expression go through a (trivial) function
* call to ensure they are not discarded. Also use ! or !! to ensure
* the boolean expressions are seen as such.
*
* This technique has been described and recommended in:
* https://community.synopsys.com/s/question/0D534000046Yuzb/suppressing-assertsideeffect-for-functions-that-allow-for-sideeffects
*/
extern void __coverity_panic__(void);
static inline void __coverity_check__(int condition) {
if (!condition)
__coverity_panic__();
}
static inline int __coverity_check_and_return__(int condition) {
return condition;
}
#define assert_message_se(expr, message) __coverity_check__(!!(expr))
#define assert_log(expr, message) __coverity_check_and_return__(!!(expr))
#else /* ! __COVERITY__ */
#define assert_message_se(expr, message) \
do { \
if (_unlikely_(!(expr))) \
log_assert_failed(message, PROJECT_FILE, __LINE__, __func__); \
} while (false)
#define assert_log(expr, message) ((_likely_(expr)) \
? (true) \
: (log_assert_failed_return(message, PROJECT_FILE, __LINE__, __func__), false))
#endif /* __COVERITY__ */
#define assert_se(expr) assert_message_se(expr, #expr)
/* We override the glibc assert() here. */
#undef assert
#ifdef NDEBUG
#define assert(expr) ({ if (!(expr)) __builtin_unreachable(); })
#else
#define assert(expr) assert_message_se(expr, #expr)
#endif
#define assert_not_reached() \
log_assert_failed_unreachable(PROJECT_FILE, __LINE__, __func__)
#define assert_return(expr, r) \
do { \
if (!assert_log(expr, #expr)) \
return (r); \
} while (false)
#define assert_return_errno(expr, r, err) \
do { \
if (!assert_log(expr, #expr)) { \
errno = err; \
return (r); \
} \
} while (false)

View File

@ -3,6 +3,7 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "assert-util.h"
#include "macro.h" #include "macro.h"
static inline void* safe_dlclose(void *dl) { static inline void* safe_dlclose(void *dl) {

View File

@ -5,6 +5,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "assert-util.h"
#include "macro.h" #include "macro.h"
/* strerror(3) says that glibc uses a maximum length of 1024 bytes. */ /* strerror(3) says that glibc uses a maximum length of 1024 bytes. */

View File

@ -1002,13 +1002,13 @@ int fd_verify_safe_flags_full(int fd, int extra_flags) {
if (flags < 0) if (flags < 0)
return -errno; return -errno;
unexpected_flags = flags & ~(O_ACCMODE|O_NOFOLLOW|RAW_O_LARGEFILE|extra_flags); unexpected_flags = flags & ~(O_ACCMODE_STRICT|O_NOFOLLOW|RAW_O_LARGEFILE|extra_flags);
if (unexpected_flags != 0) if (unexpected_flags != 0)
return log_debug_errno(SYNTHETIC_ERRNO(EREMOTEIO), return log_debug_errno(SYNTHETIC_ERRNO(EREMOTEIO),
"Unexpected flags set for extrinsic fd: 0%o", "Unexpected flags set for extrinsic fd: 0%o",
(unsigned) unexpected_flags); (unsigned) unexpected_flags);
return flags & (O_ACCMODE | extra_flags); /* return the flags variable, but remove the noise */ return flags & (O_ACCMODE_STRICT | extra_flags); /* return the flags variable, but remove the noise */
} }
int read_nr_open(void) { int read_nr_open(void) {
@ -1133,7 +1133,7 @@ int fds_are_same_mount(int fd1, int fd2) {
} }
const char* accmode_to_string(int flags) { const char* accmode_to_string(int flags) {
switch (flags & O_ACCMODE) { switch (flags & O_ACCMODE_STRICT) {
case O_RDONLY: case O_RDONLY:
return "ro"; return "ro";
case O_WRONLY: case O_WRONLY:

View File

@ -8,6 +8,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include "macro.h" #include "macro.h"
#include "memory-util.h"
#include "missing_fcntl.h" #include "missing_fcntl.h"
#include "stdio-util.h" #include "stdio-util.h"

View File

@ -1036,7 +1036,7 @@ int open_mkdir_at_full(int dirfd, const char *path, int flags, XOpenFlags xopen_
if (flags & ~(O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_EXCL|O_NOATIME|O_NOFOLLOW|O_PATH)) if (flags & ~(O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_EXCL|O_NOATIME|O_NOFOLLOW|O_PATH))
return -EINVAL; return -EINVAL;
if ((flags & O_ACCMODE) != O_RDONLY) if ((flags & O_ACCMODE_STRICT) != O_RDONLY)
return -EINVAL; return -EINVAL;
/* Note that O_DIRECTORY|O_NOFOLLOW is implied, but we allow specifying it anyway. The following /* Note that O_DIRECTORY|O_NOFOLLOW is implied, but we allow specifying it anyway. The following

View File

@ -11,6 +11,7 @@
#include "dlfcn-util.h" #include "dlfcn-util.h"
#include "macro.h" #include "macro.h"
#include "memory-util.h"
extern DLSYM_PROTOTYPE(gcry_md_close); extern DLSYM_PROTOTYPE(gcry_md_close);
extern DLSYM_PROTOTYPE(gcry_md_copy); extern DLSYM_PROTOTYPE(gcry_md_copy);

View File

@ -90,6 +90,8 @@ OrderedHashmap* _ordered_hashmap_new(const struct hash_ops *hash_ops HASHMAP_DE
#define hashmap_free_and_replace(a, b) \ #define hashmap_free_and_replace(a, b) \
free_and_replace_full(a, b, hashmap_free) free_and_replace_full(a, b, hashmap_free)
#define ordered_hashmap_free_and_replace(a, b) \
free_and_replace_full(a, b, ordered_hashmap_free)
HashmapBase* _hashmap_free(HashmapBase *h, free_func_t default_free_key, free_func_t default_free_value); HashmapBase* _hashmap_free(HashmapBase *h, free_func_t default_free_key, free_func_t default_free_value);
static inline Hashmap* hashmap_free(Hashmap *h) { static inline Hashmap* hashmap_free(Hashmap *h) {

Some files were not shown because too many files have changed in this diff Show More