by systemd-sysusers again. Distributors or system administrators
may need to create these users and groups if they not exist (or need
to re-enable DynamicUser= for those units) while upgrading systemd.
+ Also, the clock file for systemd-timesyncd may need to move from
+ /var/lib/private/systemd/timesync/clock to /var/lib/systemd/timesync/clock.
* When unit files are loaded from disk, previously systemd would
sometimes (depending on the unit loading order) load units from the
# Lenovo MOBGUL
mouse:usb:v17efp601d:name:Primax Lenovo Laser Mouse:
+ MOUSE_DPI=1600@125
+
# Lenovo MOBGULA
mouse:usb:v17efp6045:name:Lenovo USB Laser Mouse:
MOUSE_DPI=1600@125
# Logitech G5 Laser Mouse
mouse:usb:v046dpc049:name:Logitech USB Gaming Mouse:
+ MOUSE_DPI=400@500 *800@500 2000@500
+
# Logitech G500s Laser Gaming Mouse
mouse:usb:v046dpc24e:name:Logitech G500s Laser Gaming Mouse:
MOUSE_DPI=400@500 *800@500 2000@500
# Logitech Wireless Mouse M185
mouse:usb:v046dp4008:name:Logitech M185:
mouse:usb:v046dpc52b:name:Logitech Unifying Device. Wireless PID:4008:
+ MOUSE_DPI=1000@125
+
# Logitech Wireless Mouse M510
mouse:usb:v046dp1025:name:Logitech M510:
+ MOUSE_DPI=1000@125
+
# Logitech M705 (marathon mouse)
mouse:usb:v046dp101b:name:Logitech M705:
mouse:usb:v046dpc52b:name:Logitech Unifying Device. Wireless PID:101b:
# Logitech Anywhere MX
mouse:usb:v046dpc52b:name:Logitech Unifying Device. Wireless PID:1017:
mouse:usb:v046dp1017:name:Logitech Anywhere MX:
+ MOUSE_WHEEL_CLICK_ANGLE=20
+
# Logitech Anywhere MX 2S
mouse:usb:v046dp406a:name:Logitech MX Anywhere 2S:
MOUSE_WHEEL_CLICK_ANGLE=20
# Logitech M-BJ58 Optical Mouse
mouse:usb:v046dpc00e:name:Logitech USB-PS/2 Optical Mouse:
+ MOUSE_DPI=400@125
+
# Logitech Mini Optical Mouse
mouse:usb:v046dpc016:name:Logitech Optical USB Mouse:
+ MOUSE_DPI=400@125
+
# Logitech MX310 Optical Mouse
mouse:usb:v046dpc01b:name:Logitech USB-PS/2 Optical Mouse:
+ MOUSE_DPI=400@125
+
# Logitech USB-PS/2 M-BT58
mouse:usb:v046dpc03e:name:Logitech USB-PS/2 Optical Mouse:
+ MOUSE_DPI=400@125
+
# Logitech TrackMan Marble Wheel USB
mouse:usb:v046dpc401:name:Logitech USB-PS/2 Trackball:
MOUSE_DPI=400@125
# Logitech MX400 Performance Laser Mouse
mouse:usb:v046dpc043:name:Logitech USB-PS/2 Optical Mouse:
+ MOUSE_DPI=800@125
+
# Logitech MX1000 Laser Cordless Mouse
mouse:usb:v046dpc50e:name:Logitech USB RECEIVER:
+ MOUSE_DPI=800@125
+
# Logitech Cordless Click! Plus
mouse:usb:v046dpc50e:name:Logitech USB Receiver:
+ MOUSE_DPI=800@125
+
# Logitech, Inc. RX 300 Optical Mouse
mouse:usb:v046dpc040:name:Logitech USB-PS/2 Optical Mouse:
MOUSE_DPI=800@125
# Logitech RX1000 Laser Mouse
mouse:usb:v046dpc046:name:Logitech USB Optical Mouse:
+ MOUSE_DPI=1000@125
+
# Logitech M100 Optical Mouse
mouse:usb:v046dpc05a:name:Logitech USB Optical Mouse:
+ MOUSE_DPI=1000@125
+
# Logitech USB Laser Mouse M-U0011-O rebranded as "terra Laser"
mouse:usb:v046dpc065:name:Logitech USB Laser Mouse:
+ MOUSE_DPI=1000@125
+
# Logitech USB Laser Mouse M-U0007 [M500]
mouse:usb:v046dpc069:name:Logitech USB Laser Mouse:
+ MOUSE_DPI=1000@125
+
# Logitech V500 Cordless Notebook Mouse
mouse:usb:v046dpc510:name:Logitech USB Receiver:
+ MOUSE_DPI=1000@125
+
# Logitech M560 Wireless Mouse
mouse:usb:v046dp402d:name:Logitech M560:
mouse:usb:v046dpc52b:name:Logitech Unifying Device. Wireless PID:402d:
# Microsoft Wireless Mobile Mouse 4000
mouse:usb:v045ep0745:name:Microsoft Microsoft® Nano Transceiver v2.0:
+ MOUSE_DPI=1000@142
+
# Microsoft Sculpt Ergonomic Mouse
mouse:usb:v045ep07a5:name:Microsoft Microsoft® 2.4GHz Transceiver v9.0:
MOUSE_DPI=1000@142
see <option>--level-prefix=</option> below.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--stderr-priority=</option></term>
+
+ <listitem><para>Specifies the default priority level for
+ messages from the process's standard error output (stderr).
+ Usage of this option is the same as the
+ <option>--priority=</option> option, above, and both can be
+ used at once. When both are used, <option>--priority=</option>
+ will specify the default priority for standard output (stdout).
+ </para>
+
+ <para>If <option>--stderr-priority=</option> is not specified,
+ messages from stderr will still be logged, with the same
+ default priority level as stdout.</para>
+
+ <para>Also, note that when stdout and stderr use the same
+ default priority, the messages will be strictly ordered,
+ because one channel is used for both. When the default priority
+ differs, two channels are used, and so stdout messages will not
+ be strictly ordered with respect to stderr messages - though
+ they will tend to be approximately ordered.</para></listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>--level-prefix=</option></term>
} BtrfsQuotaInfo;
typedef enum BtrfsSnapshotFlags {
- BTRFS_SNAPSHOT_FALLBACK_COPY = 1, /* If the source isn't a subvolume, reflink everything */
- BTRFS_SNAPSHOT_READ_ONLY = 2,
- BTRFS_SNAPSHOT_RECURSIVE = 4,
- BTRFS_SNAPSHOT_QUOTA = 8,
- BTRFS_SNAPSHOT_FALLBACK_DIRECTORY = 16, /* If the destination doesn't support subvolumes, reflink/copy instead */
- BTRFS_SNAPSHOT_FALLBACK_IMMUTABLE = 32, /* When we can't create a subvolume, use the FS_IMMUTABLE attribute for indicating read-only */
+ BTRFS_SNAPSHOT_FALLBACK_COPY = 1 << 0, /* If the source isn't a subvolume, reflink everything */
+ BTRFS_SNAPSHOT_READ_ONLY = 1 << 1,
+ BTRFS_SNAPSHOT_RECURSIVE = 1 << 2,
+ BTRFS_SNAPSHOT_QUOTA = 1 << 3,
+ BTRFS_SNAPSHOT_FALLBACK_DIRECTORY = 1 << 4, /* If the destination doesn't support subvolumes, reflink/copy instead */
+ BTRFS_SNAPSHOT_FALLBACK_IMMUTABLE = 1 << 5, /* When we can't create a subvolume, use the FS_IMMUTABLE attribute for indicating read-only */
} BtrfsSnapshotFlags;
typedef enum BtrfsRemoveFlags {
- BTRFS_REMOVE_RECURSIVE = 1,
- BTRFS_REMOVE_QUOTA = 2,
+ BTRFS_REMOVE_RECURSIVE = 1 << 0,
+ BTRFS_REMOVE_QUOTA = 1 << 1,
} BtrfsRemoveFlags;
int btrfs_is_filesystem(int fd);
int cg_read_subgroup(DIR *d, char **fn);
typedef enum CGroupFlags {
- CGROUP_SIGCONT = 1,
- CGROUP_IGNORE_SELF = 2,
- CGROUP_REMOVE = 4,
+ CGROUP_SIGCONT = 1 << 0,
+ CGROUP_IGNORE_SELF = 1 << 1,
+ CGROUP_REMOVE = 1 << 2,
} CGroupFlags;
typedef void (*cg_kill_log_func_t)(pid_t pid, int sig, void *userdata);
bool env_assignment_is_valid(const char *e);
enum {
- REPLACE_ENV_USE_ENVIRONMENT = 1u,
- REPLACE_ENV_ALLOW_BRACELESS = 2u,
- REPLACE_ENV_ALLOW_EXTENDED = 4u,
+ REPLACE_ENV_USE_ENVIRONMENT = 1 << 0,
+ REPLACE_ENV_ALLOW_BRACELESS = 1 << 1,
+ REPLACE_ENV_ALLOW_EXTENDED = 1 << 2,
};
char *replace_env_n(const char *format, size_t n, char **env, unsigned flags);
#include "macro.h"
typedef enum ExtractFlags {
- EXTRACT_RELAX = 1,
- EXTRACT_CUNESCAPE = 2,
- EXTRACT_CUNESCAPE_RELAX = 4,
- EXTRACT_QUOTES = 8,
- EXTRACT_DONT_COALESCE_SEPARATORS = 16,
- EXTRACT_RETAIN_ESCAPE = 32,
+ EXTRACT_RELAX = 1 << 0,
+ EXTRACT_CUNESCAPE = 1 << 1,
+ EXTRACT_CUNESCAPE_RELAX = 1 << 2,
+ EXTRACT_QUOTES = 1 << 3,
+ EXTRACT_DONT_COALESCE_SEPARATORS = 1 << 4,
+ EXTRACT_RETAIN_ESCAPE = 1 << 5,
} ExtractFlags;
int extract_first_word(const char **p, char **ret, const char *separators, ExtractFlags flags);
return -ENOMEM;
return 0;
-
}
int device_path_make_canonical(mode_t mode, dev_t devno, char **ret) {
#define UNIT_NAME_MAX 256
typedef enum UnitNameFlags {
- UNIT_NAME_PLAIN = 1, /* Allow foo.service */
- UNIT_NAME_INSTANCE = 2, /* Allow foo@bar.service */
- UNIT_NAME_TEMPLATE = 4, /* Allow foo@.service */
+ UNIT_NAME_PLAIN = 1 << 0, /* Allow foo.service */
+ UNIT_NAME_INSTANCE = 1 << 1, /* Allow foo@bar.service */
+ UNIT_NAME_TEMPLATE = 1 << 2, /* Allow foo@.service */
UNIT_NAME_ANY = UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE|UNIT_NAME_TEMPLATE,
} UnitNameFlags;
int unit_name_to_path(const char *name, char **ret);
typedef enum UnitNameMangle {
- UNIT_NAME_MANGLE_GLOB = 1,
- UNIT_NAME_MANGLE_WARN = 2,
+ UNIT_NAME_MANGLE_GLOB = 1 << 0,
+ UNIT_NAME_MANGLE_WARN = 1 << 1,
} UnitNameMangle;
int unit_name_mangle_with_suffix(const char *name, UnitNameMangle flags, const char *suffix, char **ret);
r = getpeername(fd, &sa.peer.sa, &salen);
if (r < 0)
- return log_error_errno(errno, "getpeername failed: %m");
+ return log_unit_error_errno(UNIT(s), errno, "getpeername failed: %m");
if (!IN_SET(sa.peer.sa.sa_family, AF_INET, AF_INET6, AF_VSOCK)) {
*p = NULL;
label);
}
+static int log_address_error_errno(Unit *u, const SocketAddress *address, int error, const char *fmt) {
+ _cleanup_free_ char *t = NULL;
+
+ (void) socket_address_print(address, &t);
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+ return log_unit_error_errno(u, error, fmt, strna(t));
+#pragma GCC diagnostic pop
+}
+
static int socket_address_listen_in_cgroup(
Socket *s,
const SocketAddress *address,
fd = socket_address_listen_do(s, address, label);
if (fd < 0) {
- log_unit_error_errno(UNIT(s), fd, "Failed to create listening socket: %m");
+ log_address_error_errno(UNIT(s), address, fd, "Failed to create listening socket (%s): %m");
_exit(EXIT_FAILURE);
}
r = send_one_fd(pair[1], fd, 0);
if (r < 0) {
- log_unit_error_errno(UNIT(s), r, "Failed to send listening socket to parent: %m");
+ log_address_error_errno(UNIT(s), address, r, "Failed to send listening socket (%s) to parent: %m");
_exit(EXIT_FAILURE);
}
}
if (fd < 0)
- return log_unit_error_errno(UNIT(s), fd, "Failed to receive listening socket: %m");
+ return log_address_error_errno(UNIT(s), address, fd, "Failed to receive listening socket (%s): %m");
return fd;
shortcut:
fd = socket_address_listen_do(s, address, label);
if (fd < 0)
- return log_error_errno(fd, "Failed to create listening socket: %m");
+ return log_address_error_errno(UNIT(s), address, fd, "Failed to create listening socket (%s): %m");
return fd;
}
-static int socket_open_fds(Socket *s) {
+DEFINE_TRIVIAL_CLEANUP_FUNC(Socket *, socket_close_fds);
+
+static int socket_open_fds(Socket *_s) {
+ _cleanup_(socket_close_fdsp) Socket *s = _s;
_cleanup_(mac_selinux_freep) char *label = NULL;
bool know_label = false;
SocketPort *p;
r = socket_determine_selinux_label(s, &label);
if (r < 0)
- goto rollback;
+ return log_unit_error_errno(UNIT(s), r, "Failed to determine SELinux label: %m");
know_label = true;
}
r = socket_address_listen_in_cgroup(s, &p->address, label);
if (r < 0)
- goto rollback;
+ return r;
p->fd = r;
socket_apply_socket_options(s, p->fd);
case SOCKET_SPECIAL:
- p->fd = special_address_create(p->path, s->writable);
- if (p->fd < 0) {
- r = p->fd;
- goto rollback;
- }
+ r = special_address_create(p->path, s->writable);
+ if (r < 0)
+ return log_unit_error_errno(UNIT(s), r, "Failed to open special file %s: %m", p->path);
+
+ p->fd = r;
break;
case SOCKET_FIFO:
- p->fd = fifo_address_create(
+ r = fifo_address_create(
p->path,
s->directory_mode,
s->socket_mode);
- if (p->fd < 0) {
- r = p->fd;
- goto rollback;
- }
+ if (r < 0)
+ return log_unit_error_errno(UNIT(s), r, "Failed to open FIFO %s: %m", p->path);
+ p->fd = r;
socket_apply_fifo_options(s, p->fd);
socket_symlink(s);
break;
case SOCKET_MQUEUE:
- p->fd = mq_address_create(
+ r = mq_address_create(
p->path,
s->socket_mode,
s->mq_maxmsg,
s->mq_msgsize);
- if (p->fd < 0) {
- r = p->fd;
- goto rollback;
- }
+ if (r < 0)
+ return log_unit_error_errno(UNIT(s), r, "Failed to open message queue %s: %m", p->path);
+
+ p->fd = r;
break;
case SOCKET_USB_FUNCTION: {
ep = path_make_absolute("ep0", p->path);
- p->fd = usbffs_address_create(ep);
- if (p->fd < 0) {
- r = p->fd;
- goto rollback;
- }
+ r = usbffs_address_create(ep);
+ if (r < 0)
+ return r;
+
+ p->fd = r;
r = usbffs_write_descs(p->fd, SERVICE(UNIT_DEREF(s->service)));
if (r < 0)
- goto rollback;
+ return r;
r = usbffs_dispatch_eps(p);
if (r < 0)
- goto rollback;
+ return r;
break;
}
}
}
+ s = NULL;
return 0;
-
-rollback:
- socket_close_fds(s);
- return r;
}
static void socket_unwatch_fds(Socket *s) {
copy = fdset_put_dup(fds, p->fd);
if (copy < 0)
- return log_warning_errno(copy, "Failed to serialize socket fd: %m");
+ return log_unit_warning_errno(u, copy, "Failed to serialize socket fd: %m");
if (p->type == SOCKET_SOCKET) {
_cleanup_free_ char *t = NULL;
r = socket_address_print(&p->address, &t);
if (r < 0)
- return log_error_errno(r, "Failed to format socket address: %m");
+ return log_unit_error_errno(u, r, "Failed to format socket address: %m");
if (socket_address_family(&p->address) == AF_NETLINK)
(void) serialize_item_format(f, "netlink", "%i %s", copy, t);
exit_status = wait_for_terminate_and_check("fsck", pid, WAIT_LOG_ABNORMAL);
if (exit_status < 0)
return exit_status;
- if (exit_status & ~1) {
+ if ((exit_status & ~FSCK_ERROR_CORRECTED) != FSCK_SUCCESS) {
log_error("fsck failed with exit status %i.", exit_status);
if ((exit_status & FSCK_SYSTEM_SHOULD_REBOOT) && root_directory) {
static const char *arg_identifier = NULL;
static int arg_priority = LOG_INFO;
+static int arg_stderr_priority = -1;
static bool arg_level_prefix = true;
static int help(void) {
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Execute process with stdout/stderr connected to the journal.\n\n"
- " -h --help Show this help\n"
- " --version Show package version\n"
- " -t --identifier=STRING Set syslog identifier\n"
- " -p --priority=PRIORITY Set priority value (0..7)\n"
- " --level-prefix=BOOL Control whether level prefix shall be parsed\n"
+ " -h --help Show this help\n"
+ " --version Show package version\n"
+ " -t --identifier=STRING Set syslog identifier\n"
+ " -p --priority=PRIORITY Set priority value (0..7)\n"
+ " --stderr-priority=PRIORITY Set priority value (0..7) used for stderr\n"
+ " --level-prefix=BOOL Control whether level prefix shall be parsed\n"
"\nSee the %s for details.\n"
, program_invocation_short_name
, link
enum {
ARG_VERSION = 0x100,
+ ARG_STDERR_PRIORITY,
ARG_LEVEL_PREFIX
};
static const struct option options[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, ARG_VERSION },
- { "identifier", required_argument, NULL, 't' },
- { "priority", required_argument, NULL, 'p' },
- { "level-prefix", required_argument, NULL, ARG_LEVEL_PREFIX },
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, ARG_VERSION },
+ { "identifier", required_argument, NULL, 't' },
+ { "priority", required_argument, NULL, 'p' },
+ { "stderr-priority", required_argument, NULL, ARG_STDERR_PRIORITY },
+ { "level-prefix", required_argument, NULL, ARG_LEVEL_PREFIX },
{}
};
"Failed to parse priority value.");
break;
+ case ARG_STDERR_PRIORITY:
+ arg_stderr_priority = log_level_from_string(optarg);
+ if (arg_stderr_priority < 0)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Failed to parse stderr priority value.");
+ break;
+
case ARG_LEVEL_PREFIX: {
int k;
}
static int run(int argc, char *argv[]) {
- _cleanup_close_ int fd = -1, saved_stderr = -1;
+ _cleanup_close_ int outfd = -1, errfd = -1, saved_stderr = -1;
int r;
log_parse_environment();
if (r <= 0)
return r;
- fd = sd_journal_stream_fd(arg_identifier, arg_priority, arg_level_prefix);
- if (fd < 0)
- return log_error_errno(fd, "Failed to create stream fd: %m");
+ outfd = sd_journal_stream_fd(arg_identifier, arg_priority, arg_level_prefix);
+ if (outfd < 0)
+ return log_error_errno(outfd, "Failed to create stream fd: %m");
+
+ if (arg_stderr_priority >= 0 && arg_stderr_priority != arg_priority) {
+ errfd = sd_journal_stream_fd(arg_identifier, arg_stderr_priority, arg_level_prefix);
+ if (errfd < 0)
+ return log_error_errno(errfd, "Failed to create stream fd: %m");
+ }
saved_stderr = fcntl(STDERR_FILENO, F_DUPFD_CLOEXEC, 3);
- r = rearrange_stdio(STDIN_FILENO, fd, fd); /* Invalidates fd on succcess + error! */
- TAKE_FD(fd);
+ r = rearrange_stdio(STDIN_FILENO, outfd, errfd < 0 ? outfd : errfd); /* Invalidates fd on succcess + error! */
+ TAKE_FD(outfd);
+ TAKE_FD(errfd);
if (r < 0)
return log_error_errno(r, "Failed to rearrange stdout/stderr: %m");
#include "sd-bus.h"
enum {
- BUS_MESSAGE_DUMP_WITH_HEADER = 1,
- BUS_MESSAGE_DUMP_SUBTREE_ONLY = 2,
+ BUS_MESSAGE_DUMP_WITH_HEADER = 1 << 0,
+ BUS_MESSAGE_DUMP_SUBTREE_ONLY = 1 << 1,
};
int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags);
/* Flags */
enum {
- BUS_MESSAGE_NO_REPLY_EXPECTED = 1,
- BUS_MESSAGE_NO_AUTO_START = 2,
- BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION = 4,
+ BUS_MESSAGE_NO_REPLY_EXPECTED = 1 << 0,
+ BUS_MESSAGE_NO_AUTO_START = 1 << 1,
+ BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION = 1 << 2,
};
/* Header fields */
/* RequestName parameters */
enum {
- BUS_NAME_ALLOW_REPLACEMENT = 1,
- BUS_NAME_REPLACE_EXISTING = 2,
- BUS_NAME_DO_NOT_QUEUE = 4
+ BUS_NAME_ALLOW_REPLACEMENT = 1 << 0,
+ BUS_NAME_REPLACE_EXISTING = 1 << 1,
+ BUS_NAME_DO_NOT_QUEUE = 1 << 2,
};
/* RequestName returns */
typedef struct Inhibitor Inhibitor;
typedef enum InhibitWhat {
- INHIBIT_SHUTDOWN = 1,
- INHIBIT_SLEEP = 2,
- INHIBIT_IDLE = 4,
- INHIBIT_HANDLE_POWER_KEY = 8,
- INHIBIT_HANDLE_SUSPEND_KEY = 16,
- INHIBIT_HANDLE_HIBERNATE_KEY = 32,
- INHIBIT_HANDLE_LID_SWITCH = 64,
- _INHIBIT_WHAT_MAX = 128,
- _INHIBIT_WHAT_INVALID = -1
+ INHIBIT_SHUTDOWN = 1 << 0,
+ INHIBIT_SLEEP = 1 << 1,
+ INHIBIT_IDLE = 1 << 2,
+ INHIBIT_HANDLE_POWER_KEY = 1 << 3,
+ INHIBIT_HANDLE_SUSPEND_KEY = 1 << 4,
+ INHIBIT_HANDLE_HIBERNATE_KEY = 1 << 5,
+ INHIBIT_HANDLE_LID_SWITCH = 1 << 6,
+ _INHIBIT_WHAT_MAX = 1 << 7,
+ _INHIBIT_WHAT_INVALID = -1
} InhibitWhat;
typedef enum InhibitMode {
* Note that we usually encode the empty DnsAnswer object as a simple NULL. */
typedef enum DnsAnswerFlags {
- DNS_ANSWER_AUTHENTICATED = 1, /* Item has been authenticated */
- DNS_ANSWER_CACHEABLE = 2, /* Item is subject to caching */
- DNS_ANSWER_SHARED_OWNER = 4, /* For mDNS: RRset may be owner by multiple peers */
- DNS_ANSWER_CACHE_FLUSH = 8, /* For mDNS: sets cache-flush bit in the rrclass of response records */
- DNS_ANSWER_GOODBYE = 16, /* For mDNS: item is subject to disappear */
+ DNS_ANSWER_AUTHENTICATED = 1 << 0, /* Item has been authenticated */
+ DNS_ANSWER_CACHEABLE = 1 << 1, /* Item is subject to caching */
+ DNS_ANSWER_SHARED_OWNER = 1 << 2, /* For mDNS: RRset may be owner by multiple peers */
+ DNS_ANSWER_CACHE_FLUSH = 1 << 3, /* For mDNS: sets cache-flush bit in the rrclass of response records */
+ DNS_ANSWER_GOODBYE = 1 << 4, /* For mDNS: item is subject to disappear */
} DnsAnswerFlags;
struct DnsAnswerItem {
JsonVariantType rt;
v = json_variant_dereference(v);
+ if (!v)
+ return false;
rt = json_variant_type(v);
if (rt == type)
va_list ap;
int r;
- if (error < 0)
- error = -error;
-
- errno = error;
+ errno = ERRNO_VALUE(error);
va_start(ap, format);
(void) vsnprintf(buffer, sizeof buffer, format, ap);
/* SPDX-License-Identifier: LGPL-2.1+ */
-
#pragma once
#include <stdbool.h>
JSON_FORMAT_NEWLINE = 1 << 0, /* suffix with newline */
JSON_FORMAT_PRETTY = 1 << 1, /* add internal whitespace to appeal to human readers */
JSON_FORMAT_COLOR = 1 << 2, /* insert ANSI color sequences */
- JSON_FORMAT_COLOR_AUTO = 1 << 3, /* insetr ANSI color sequences if colors_enabled() says so */
+ JSON_FORMAT_COLOR_AUTO = 1 << 3, /* insert ANSI color sequences if colors_enabled() says so */
JSON_FORMAT_SOURCE = 1 << 4, /* prefix with source filename/line/column */
JSON_FORMAT_SSE = 1 << 5, /* prefix/suffix with W3C server-sent events */
JSON_FORMAT_SEQ = 1 << 6, /* prefix/suffix with RFC 7464 application/json-seq */
*d = (LoopDevice) {
.fd = copy,
.nr = -1,
+ .relinquished = true, /* It's not allocated by us, don't destroy it when this object is freed */
};
*ret = d;
-
- return 0;
+ return d->fd;
}
r = stat_verify_regular(&st);
};
*ret = d;
-
- return (*ret)->fd;
+ return d->fd;
}
int loop_device_make_by_path(const char *path, int open_flags, LoopDevice **ret) {
#include "udevadm.h"
#include "udev-ctrl.h"
#include "util.h"
+#include "virt.h"
static int help(void) {
printf("%s control OPTION\n\n"
if (r < 0)
return r;
+ if (running_in_chroot() > 0) {
+ log_info("Running in chroot, ignoring request.");
+ return 0;
+ }
+
if (argc <= 1)
log_error("Option missing");
#include "signal-util.h"
#include "string-util.h"
#include "udevadm.h"
+#include "virt.h"
static bool arg_show_property = false;
static bool arg_print_kernel = false;
if (r <= 0)
goto finalize;
+ if (running_in_chroot() > 0) {
+ log_info("Running in chroot, ignoring request.");
+ return 0;
+ }
+
/* Callers are expecting to see events as they happen: Line buffering */
setlinebuf(stdout);
#include "udevadm.h"
#include "udev-ctrl.h"
#include "util.h"
+#include "virt.h"
static usec_t arg_timeout = 120 * USEC_PER_SEC;
static const char *arg_exists = NULL;
if (r <= 0)
return r;
+ if (running_in_chroot() > 0) {
+ log_info("Running in chroot, ignoring request.");
+ return 0;
+ }
+
deadline = now(CLOCK_MONOTONIC) + arg_timeout;
/* guarantee that the udev daemon isn't pre-processing */
#include "strv.h"
#include "udevadm.h"
#include "udevadm-util.h"
+#include "virt.h"
static bool arg_verbose = false;
static bool arg_dry_run = false;
bool settle = false;
int c, r;
+ if (running_in_chroot() > 0) {
+ log_info("Running in chroot, ignoring request.");
+ return 0;
+ }
+
r = sd_device_enumerator_new(&e);
if (r < 0)
return r;