Compare commits
No commits in common. "e8c47f7370f659f42d3b28e49f770ac065007212" and "eecf4f7e0425db72ea7a0c13a937fa6fcdbe3b1e" have entirely different histories.
e8c47f7370
...
eecf4f7e04
|
@ -277,7 +277,6 @@ manpages = [
|
||||||
['sd_bus_message_append_string_iovec', 'sd_bus_message_append_string_space'],
|
['sd_bus_message_append_string_iovec', 'sd_bus_message_append_string_space'],
|
||||||
''],
|
''],
|
||||||
['sd_bus_message_append_strv', '3', [], ''],
|
['sd_bus_message_append_strv', '3', [], ''],
|
||||||
['sd_bus_message_at_end', '3', [], ''],
|
|
||||||
['sd_bus_message_copy', '3', [], ''],
|
['sd_bus_message_copy', '3', [], ''],
|
||||||
['sd_bus_message_dump', '3', [], ''],
|
['sd_bus_message_dump', '3', [], ''],
|
||||||
['sd_bus_message_get_cookie', '3', ['sd_bus_message_get_reply_cookie'], ''],
|
['sd_bus_message_get_cookie', '3', ['sd_bus_message_get_reply_cookie'], ''],
|
||||||
|
@ -410,10 +409,8 @@ manpages = [
|
||||||
'3',
|
'3',
|
||||||
['sd_bus_get_bus_id',
|
['sd_bus_get_bus_id',
|
||||||
'sd_bus_is_bus_client',
|
'sd_bus_is_bus_client',
|
||||||
'sd_bus_is_monitor',
|
|
||||||
'sd_bus_is_server',
|
'sd_bus_is_server',
|
||||||
'sd_bus_set_bus_client',
|
'sd_bus_set_bus_client'],
|
||||||
'sd_bus_set_monitor'],
|
|
||||||
''],
|
''],
|
||||||
['sd_bus_set_watch_bind', '3', ['sd_bus_get_watch_bind'], ''],
|
['sd_bus_set_watch_bind', '3', ['sd_bus_get_watch_bind'], ''],
|
||||||
['sd_bus_slot_get_bus',
|
['sd_bus_slot_get_bus',
|
||||||
|
|
|
@ -84,7 +84,6 @@
|
||||||
<citerefentry><refentrytitle>sd_bus_get_scope</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_get_scope</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_get_tid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_get_tid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_get_unique_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_get_unique_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_is_monitor</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
|
||||||
<citerefentry><refentrytitle>sd_bus_is_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_is_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_is_server</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_is_server</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_list_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_list_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
|
@ -93,7 +92,6 @@
|
||||||
<citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_message_append_string_memfd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_message_append_string_memfd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_message_append_strv</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_message_append_strv</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_message_at_end</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
|
||||||
<citerefentry><refentrytitle>sd_bus_message_copy</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_message_copy</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_message_dump</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_message_dump</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_message_get_cookie</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_message_get_cookie</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
|
@ -135,7 +133,6 @@
|
||||||
<citerefentry><refentrytitle>sd_bus_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_set_exit_on_disconnect</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_set_exit_on_disconnect</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_set_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_set_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_set_monitor</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
|
||||||
<citerefentry><refentrytitle>sd_bus_set_property</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_set_property</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_set_propertyv</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_set_propertyv</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>sd_bus_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>sd_bus_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
<?xml version='1.0'?>
|
|
||||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
||||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
|
||||||
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
|
|
||||||
|
|
||||||
<refentry id="sd_bus_message_at_end" xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
||||||
<refentryinfo>
|
|
||||||
<title>sd_bus_message_at_end</title>
|
|
||||||
<productname>systemd</productname>
|
|
||||||
</refentryinfo>
|
|
||||||
|
|
||||||
<refmeta>
|
|
||||||
<refentrytitle>sd_bus_message_at_end</refentrytitle>
|
|
||||||
<manvolnum>3</manvolnum>
|
|
||||||
</refmeta>
|
|
||||||
|
|
||||||
<refnamediv>
|
|
||||||
<refname>sd_bus_message_at_end</refname>
|
|
||||||
|
|
||||||
<refpurpose>Check if a message has been fully read</refpurpose>
|
|
||||||
</refnamediv>
|
|
||||||
|
|
||||||
<refsynopsisdiv>
|
|
||||||
<funcsynopsis>
|
|
||||||
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
|
|
||||||
|
|
||||||
<funcprototype>
|
|
||||||
<funcdef>int <function>sd_bus_message_at_end</function></funcdef>
|
|
||||||
<paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
|
|
||||||
<paramdef>int <parameter>complete</parameter></paramdef>
|
|
||||||
</funcprototype>
|
|
||||||
</funcsynopsis>
|
|
||||||
</refsynopsisdiv>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>Description</title>
|
|
||||||
|
|
||||||
<para><function>sd_bus_message_at_end()</function> returns whether all data from the currently opened
|
|
||||||
container in <parameter>m</parameter> or all data from all containers in <parameter>m</parameter> has
|
|
||||||
been read. If <parameter>complete</parameter> is zero, this function returns whether all data from the
|
|
||||||
currently opened container has been read. If <parameter>complete</parameter> is non-zero, this function
|
|
||||||
returns whether all data from all containers in <parameter>m</parameter> has been read.</para>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>Return Value</title>
|
|
||||||
|
|
||||||
<para>If all data from all containers or the current container (depending on the value of
|
|
||||||
<parameter>complete</parameter>) has been read, <function>sd_bus_message_at_end()</function> returns a
|
|
||||||
positive integer. If there is still data left to be read, it returns zero. On failure, it returns a
|
|
||||||
negative errno-style error code.</para>
|
|
||||||
|
|
||||||
<refsect2>
|
|
||||||
<title>Errors</title>
|
|
||||||
|
|
||||||
<para>Returned errors may indicate the following problems:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
|
||||||
<varlistentry>
|
|
||||||
<term><constant>-EINVAL</constant></term>
|
|
||||||
|
|
||||||
<listitem><para>The <parameter>m</parameter> parameter is <constant>NULL</constant>.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><constant>-EPERM</constant></term>
|
|
||||||
|
|
||||||
<listitem><para>The message is not sealed.</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect2>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<xi:include href="libsystemd-pkgconfig.xml" />
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>See Also</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
|
||||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
|
||||||
<citerefentry><refentrytitle>sd_bus_message_read</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
|
||||||
</para>
|
|
||||||
</refsect1>
|
|
||||||
</refentry>
|
|
|
@ -22,10 +22,8 @@
|
||||||
<refname>sd_bus_get_bus_id</refname>
|
<refname>sd_bus_get_bus_id</refname>
|
||||||
<refname>sd_bus_set_bus_client</refname>
|
<refname>sd_bus_set_bus_client</refname>
|
||||||
<refname>sd_bus_is_bus_client</refname>
|
<refname>sd_bus_is_bus_client</refname>
|
||||||
<refname>sd_bus_set_monitor</refname>
|
|
||||||
<refname>sd_bus_is_monitor</refname>
|
|
||||||
|
|
||||||
<refpurpose>Configure connection mode for a bus object</refpurpose>
|
<refpurpose>Configure direct connection mode for a bus object</refpurpose>
|
||||||
</refnamediv>
|
</refnamediv>
|
||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
|
@ -60,83 +58,61 @@
|
||||||
<funcdef>int <function>sd_bus_is_bus_client</function></funcdef>
|
<funcdef>int <function>sd_bus_is_bus_client</function></funcdef>
|
||||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||||
</funcprototype>
|
</funcprototype>
|
||||||
|
|
||||||
<funcprototype>
|
|
||||||
<funcdef>int <function>sd_bus_set_monitor</function></funcdef>
|
|
||||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
|
||||||
<paramdef>int <parameter>b</parameter></paramdef>
|
|
||||||
</funcprototype>
|
|
||||||
|
|
||||||
<funcprototype>
|
|
||||||
<funcdef>int <function>sd_bus_is_monitor</function></funcdef>
|
|
||||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
|
||||||
</funcprototype>
|
|
||||||
</funcsynopsis>
|
</funcsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
|
|
||||||
<para><function>sd_bus_set_server()</function> configures the bus object as a server for direct D-Bus
|
<para><function>sd_bus_set_server()</function> configures the bus object as a server for direct
|
||||||
connections. <parameter>b</parameter> enables/disables the server mode. If zero, the server mode is
|
D-Bus connections. <parameter>b</parameter> enables/disables the server mode. If zero, the
|
||||||
disabled. Otherwise, the server mode is enabled. Configuring a bus object as a server is required to
|
server mode is disabled. Otherwise, the server mode is enabled. Configuring a bus object as a
|
||||||
allow establishing direct connections between two peers without going via the D-Bus daemon.
|
server is required to allow establishing direct connections between two peers without going via
|
||||||
<parameter>id</parameter> must contain a 128-bit integer id for the server. If clients add a guid field
|
the D-Bus daemon. <parameter>id</parameter> must contain a 128-bit integer id for the server. If
|
||||||
to their D-Bus address string, the server id must match this guid or the D-Bus authentication handshake
|
clients add a guid field to their D-Bus address string, the server id must match this guid or
|
||||||
will fail. If no specific id is defined for the server,
|
the D-Bus authentication handshake will fail. If no specific id is defined for the server,
|
||||||
<citerefentry><refentrytitle>sd_id128_randomize</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>sd_id128_randomize</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||||
can be used to generate a random id instead.</para>
|
can be used to generate a random id instead.</para>
|
||||||
|
|
||||||
<para><function>sd_bus_is_server()</function> returns whether the server mode is enabled for the given
|
<para><function>sd_bus_is_server()</function> returns whether the server mode is enabled for
|
||||||
bus object.</para>
|
the given bus object.</para>
|
||||||
|
|
||||||
<para><function>sd_bus_get_bus_id()</function> stores the D-Bus server id configured using
|
<para><function>sd_bus_get_bus_id()</function> stores the D-Bus server id configured using
|
||||||
<function>sd_bus_set_server()</function> (for server bus objects) or received during D-Bus authentication
|
<function>sd_bus_set_server()</function> (for server bus objects) or received during
|
||||||
(for client bus objects) in <parameter>id</parameter>.</para>
|
D-Bus authentication (for client bus objects) in <parameter>id</parameter>.</para>
|
||||||
|
|
||||||
<para><function>sd_bus_set_bus_client()</function> configures the bus object as a D-Bus daemon client.
|
<para><function>sd_bus_set_bus_client()</function> configures the bus object as a D-Bus daemon
|
||||||
<parameter>b</parameter> enables/disables the client mode. If zero, the client mode is disabled and the
|
client. <parameter>b</parameter> enables/disables the client mode. If zero, the client mode is
|
||||||
bus object should connect directly to a D-Bus server. Otherwise, the client mode is enabled and the bus
|
disabled and the bus object should connect directly to a D-Bus server. Otherwise, the client
|
||||||
object should connect to a D-Bus daemon. When connecting to an existing bus using any of the functions in
|
mode is enabled and the bus object should connect to a D-Bus daemon. When connecting to an
|
||||||
the <citerefentry><refentrytitle>sd_bus_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
existing bus using any of the functions in the
|
||||||
|
<citerefentry><refentrytitle>sd_bus_open</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||||
family of functions or any of the functions in the
|
family of functions or any of the functions in the
|
||||||
<citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry> family
|
<citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||||
of functions, the bus object is automatically configured as a bus client. However, when connecting to a
|
family of functions, the bus object is automatically configured as a bus client. However, when
|
||||||
D-Bus daemon by calling
|
connecting to a D-Bus daemon by calling
|
||||||
<citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||||
followed by
|
followed by
|
||||||
<citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>, the bus
|
<citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||||
object should be manually configured as a bus client using <function>sd_bus_set_bus_client()</function>.
|
the bus object should be manually configured as a bus client using
|
||||||
By default, a bus object is not configured as a D-Bus daemon client.</para>
|
<function>sd_bus_set_bus_client()</function>. By default, a bus object is not configured as a
|
||||||
|
D-Bus daemon client.</para>
|
||||||
<para><function>sd_bus_is_bus_client()</function> returns whether the client mode is enabled/disabled for
|
|
||||||
the given bus object.</para>
|
|
||||||
|
|
||||||
<para><function>sd_bus_set_monitor()</function> configures the bus object as a D-Bus monitor object.
|
|
||||||
<parameter>b</parameter> enables/disables the monitor mode. If zero, the monitor mode is disabled. If
|
|
||||||
non-zero, the monitor mode is enabled. When the monitor mode is enabled, no messages may be sent via the
|
|
||||||
bus object and it may not expose any objects on the bus. To start monitoring messages, call the
|
|
||||||
<function>org.freedesktop.DBus.Monitoring.BecomeMonitor</function> method of the D-Bus daemon and pass
|
|
||||||
a list of matches indicating which messages to intercept. See
|
|
||||||
<ulink url="https://dbus.freedesktop.org/doc/dbus-specification.html#bus-messages-become-monitor">
|
|
||||||
The D-Bus specification</ulink> for more information.</para>
|
|
||||||
|
|
||||||
<para><function>sd_bus_is_monitor()</function> returns whether the monitor mode is enabled/disabled for
|
|
||||||
the given bus object.</para>
|
|
||||||
|
|
||||||
|
<para><function>sd_bus_is_bus_client()</function> returns whether the client mode is
|
||||||
|
enabled/disabled for the given bus object.</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Return Value</title>
|
<title>Return Value</title>
|
||||||
|
|
||||||
<para>On success, <function>sd_bus_set_server()</function>,
|
<para>On success, <function>sd_bus_set_server()</function>,
|
||||||
<function>sd_bus_get_bus_id()</function>, <function>sd_bus_set_bus_client()</function> and
|
<function>sd_bus_get_bus_id()</function> and <function>sd_bus_set_bus_client()</function> return
|
||||||
<function>sd_bus_set_monitor()</function> return a non-negative integer. On failure, they return a
|
a non-negative integer. On failure, they return a negative errno-style error code.</para>
|
||||||
negative errno-style error code.</para>
|
|
||||||
|
|
||||||
<para><function>sd_bus_is_server()</function>, <function>sd_bus_is_bus_client()</function> and
|
<para><function>sd_bus_is_server()</function> and <function>sd_bus_is_bus_client()</function>
|
||||||
<function>sd_bus_is_monitor()</function> return a positive integer when the server or client mode is
|
return a positive integer when the server or client mode is enabled, respectively. Otherwise,
|
||||||
enabled, respectively. Otherwise, they return zero.</para>
|
they return zero.
|
||||||
|
</para>
|
||||||
|
|
||||||
<refsect2>
|
<refsect2>
|
||||||
<title>Errors</title>
|
<title>Errors</title>
|
||||||
|
|
|
@ -469,16 +469,18 @@
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>VirtualEthernetExtra=</varname></term>
|
<term><varname>VirtualEthernetExtra=</varname></term>
|
||||||
|
|
||||||
<listitem><para>Takes a colon-separated pair of interface names. Configures an additional virtual
|
<listitem><para>Takes a colon-separated pair of interface
|
||||||
Ethernet connection (<literal>veth</literal>) between host and the container. The first specified
|
names. Configures an additional virtual Ethernet connection
|
||||||
name is the interface name on the host, the second the interface name in the container. The latter
|
(<literal>veth</literal>) between host and the container. The
|
||||||
may be omitted in which case it is set to the same name as the host side interface. This setting
|
first specified name is the interface name on the host, the
|
||||||
implies <varname>Private=yes</varname>. This setting corresponds to the
|
second the interface name in the container. The latter may be
|
||||||
<option>--network-veth-extra=</option> command line switch, and maybe be used multiple times. It is
|
omitted in which case it is set to the same name as the host
|
||||||
independent of <varname>VirtualEthernet=</varname>. Note that this option is unrelated to the
|
side interface. This setting implies
|
||||||
<varname>Bridge=</varname> setting below, and thus any connections created this way are not
|
<varname>Private=yes</varname>. This setting corresponds to
|
||||||
automatically added to any bridge device on the host side. This option is privileged (see
|
the <option>--network-veth-extra=</option> command line
|
||||||
above).</para></listitem>
|
switch, and maybe be used multiple times. It is independent of
|
||||||
|
<varname>VirtualEthernet=</varname>. This option is privileged
|
||||||
|
(see above).</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "architecture.h"
|
#include "architecture.h"
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "bus-common-errors.h"
|
#include "bus-common-errors.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-util.h"
|
#include "bus-util.h"
|
||||||
#include "dbus-cgroup.h"
|
#include "dbus-cgroup.h"
|
||||||
#include "dbus-execute.h"
|
#include "dbus-execute.h"
|
||||||
|
@ -51,6 +50,7 @@ BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_oom_policy, oom_policy, OOMPolicy)
|
||||||
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_version, "s", GIT_VERSION);
|
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_version, "s", GIT_VERSION);
|
||||||
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_features, "s", SYSTEMD_FEATURES);
|
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_features, "s", SYSTEMD_FEATURES);
|
||||||
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_architecture, "s", architecture_to_string(uname_architecture()));
|
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_architecture, "s", architecture_to_string(uname_architecture()));
|
||||||
|
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_log_target, "s", log_target_to_string(log_get_target()));
|
||||||
static BUS_DEFINE_PROPERTY_GET2(property_get_system_state, "s", Manager, manager_state, manager_state_to_string);
|
static BUS_DEFINE_PROPERTY_GET2(property_get_system_state, "s", Manager, manager_state, manager_state_to_string);
|
||||||
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_timer_slack_nsec, "t", (uint64_t) prctl(PR_GET_TIMERSLACK));
|
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_timer_slack_nsec, "t", (uint64_t) prctl(PR_GET_TIMERSLACK));
|
||||||
static BUS_DEFINE_PROPERTY_GET_REF(property_get_hashmap_size, "u", Hashmap *, hashmap_size);
|
static BUS_DEFINE_PROPERTY_GET_REF(property_get_hashmap_size, "u", Hashmap *, hashmap_size);
|
||||||
|
@ -141,6 +141,28 @@ static int property_set_log_target(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int property_get_log_level(
|
||||||
|
sd_bus *bus,
|
||||||
|
const char *path,
|
||||||
|
const char *interface,
|
||||||
|
const char *property,
|
||||||
|
sd_bus_message *reply,
|
||||||
|
void *userdata,
|
||||||
|
sd_bus_error *error) {
|
||||||
|
|
||||||
|
_cleanup_free_ char *t = NULL;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(bus);
|
||||||
|
assert(reply);
|
||||||
|
|
||||||
|
r = log_level_to_string_alloc(log_get_max_level(), &t);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
return sd_bus_message_append(reply, "s", t);
|
||||||
|
}
|
||||||
|
|
||||||
static int property_set_log_level(
|
static int property_set_log_level(
|
||||||
sd_bus *bus,
|
sd_bus *bus,
|
||||||
const char *path,
|
const char *path,
|
||||||
|
@ -2382,8 +2404,8 @@ const sd_bus_vtable bus_manager_vtable[] = {
|
||||||
BUS_PROPERTY_DUAL_TIMESTAMP("InitRDGeneratorsFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD_GENERATORS_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST),
|
BUS_PROPERTY_DUAL_TIMESTAMP("InitRDGeneratorsFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD_GENERATORS_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||||
BUS_PROPERTY_DUAL_TIMESTAMP("InitRDUnitsLoadStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_START]), SD_BUS_VTABLE_PROPERTY_CONST),
|
BUS_PROPERTY_DUAL_TIMESTAMP("InitRDUnitsLoadStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_START]), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||||
BUS_PROPERTY_DUAL_TIMESTAMP("InitRDUnitsLoadFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST),
|
BUS_PROPERTY_DUAL_TIMESTAMP("InitRDUnitsLoadFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||||
SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", bus_property_get_log_level, property_set_log_level, 0, 0),
|
SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", property_get_log_level, property_set_log_level, 0, 0),
|
||||||
SD_BUS_WRITABLE_PROPERTY("LogTarget", "s", bus_property_get_log_target, property_set_log_target, 0, 0),
|
SD_BUS_WRITABLE_PROPERTY("LogTarget", "s", property_get_log_target, property_set_log_target, 0, 0),
|
||||||
SD_BUS_PROPERTY("NNames", "u", property_get_hashmap_size, offsetof(Manager, units), 0),
|
SD_BUS_PROPERTY("NNames", "u", property_get_hashmap_size, offsetof(Manager, units), 0),
|
||||||
SD_BUS_PROPERTY("NFailedUnits", "u", property_get_set_size, offsetof(Manager, failed_units), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
SD_BUS_PROPERTY("NFailedUnits", "u", property_get_set_size, offsetof(Manager, failed_units), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
||||||
SD_BUS_PROPERTY("NJobs", "u", property_get_hashmap_size, offsetof(Manager, jobs), 0),
|
SD_BUS_PROPERTY("NJobs", "u", property_get_hashmap_size, offsetof(Manager, jobs), 0),
|
||||||
|
@ -3022,21 +3044,6 @@ const sd_bus_vtable bus_manager_vtable[] = {
|
||||||
SD_BUS_VTABLE_END
|
SD_BUS_VTABLE_END
|
||||||
};
|
};
|
||||||
|
|
||||||
const sd_bus_vtable bus_manager_log_control_vtable[] = {
|
|
||||||
SD_BUS_VTABLE_START(0),
|
|
||||||
|
|
||||||
/* We define a private version of this interface here, since we want slightly different
|
|
||||||
* implementations for the setters. We'll still use the generic getters however, and we share the
|
|
||||||
* setters with the implementations for the Manager interface above (which pre-dates the generic
|
|
||||||
* service API interface). */
|
|
||||||
|
|
||||||
SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", bus_property_get_log_level, property_set_log_level, 0, 0),
|
|
||||||
SD_BUS_WRITABLE_PROPERTY("LogTarget", "s", bus_property_get_log_target, property_set_log_target, 0, 0),
|
|
||||||
SD_BUS_PROPERTY("SyslogIdentifier", "s", bus_property_get_syslog_identifier, 0, 0),
|
|
||||||
|
|
||||||
SD_BUS_VTABLE_END,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int send_finished(sd_bus *bus, void *userdata) {
|
static int send_finished(sd_bus *bus, void *userdata) {
|
||||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *message = NULL;
|
_cleanup_(sd_bus_message_unrefp) sd_bus_message *message = NULL;
|
||||||
usec_t *times = userdata;
|
usec_t *times = userdata;
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include "manager.h"
|
#include "manager.h"
|
||||||
|
|
||||||
extern const sd_bus_vtable bus_manager_vtable[];
|
extern const sd_bus_vtable bus_manager_vtable[];
|
||||||
extern const sd_bus_vtable bus_manager_log_control_vtable[];
|
|
||||||
|
|
||||||
void bus_manager_send_finished(Manager *m, usec_t firmware_usec, usec_t loader_usec, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec);
|
void bus_manager_send_finished(Manager *m, usec_t firmware_usec, usec_t loader_usec, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec);
|
||||||
void bus_manager_send_reloading(Manager *m, bool active);
|
void bus_manager_send_reloading(Manager *m, bool active);
|
||||||
|
|
|
@ -539,10 +539,6 @@ static int bus_setup_api_vtables(Manager *m, sd_bus *bus) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to register Manager vtable: %m");
|
return log_error_errno(r, "Failed to register Manager vtable: %m");
|
||||||
|
|
||||||
r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/LogControl1", "org.freedesktop.LogControl1", bus_manager_log_control_vtable, m);
|
|
||||||
if (r < 0)
|
|
||||||
return log_error_errno(r, "Failed to register service API vtable: %m");
|
|
||||||
|
|
||||||
r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/job", "org.freedesktop.systemd1.Job", bus_job_vtable, bus_job_find, m);
|
r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/job", "org.freedesktop.systemd1.Job", bus_job_vtable, bus_job_find, m);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to register Job vtable: %m");
|
return log_error_errno(r, "Failed to register Job vtable: %m");
|
||||||
|
|
|
@ -1820,13 +1820,12 @@ static int build_environment(
|
||||||
|
|
||||||
tty_path = exec_context_tty_path(c);
|
tty_path = exec_context_tty_path(c);
|
||||||
|
|
||||||
/* If we are forked off PID 1 and we are supposed to operate on /dev/console, then let's try
|
/* If we are forked off PID 1 and we are supposed to operate on /dev/console, then let's try to inherit
|
||||||
* to inherit the $TERM set for PID 1. This is useful for containers so that the $TERM the
|
* the $TERM set for PID 1. This is useful for containers so that the $TERM the container manager
|
||||||
* container manager passes to PID 1 ends up all the way in the console login shown. */
|
* passes to PID 1 ends up all the way in the console login shown. */
|
||||||
|
|
||||||
if (path_equal_ptr(tty_path, "/dev/console") && getppid() == 1)
|
if (path_equal(tty_path, "/dev/console") && getppid() == 1)
|
||||||
term = getenv("TERM");
|
term = getenv("TERM");
|
||||||
|
|
||||||
if (!term)
|
if (!term)
|
||||||
term = default_term_for_tty(tty_path);
|
term = default_term_for_tty(tty_path);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "btrfs-util.h"
|
#include "btrfs-util.h"
|
||||||
#include "bus-common-errors.h"
|
#include "bus-common-errors.h"
|
||||||
#include "bus-error.h"
|
#include "bus-error.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "clean-ipc.h"
|
#include "clean-ipc.h"
|
||||||
#include "conf-files.h"
|
#include "conf-files.h"
|
||||||
|
@ -895,10 +894,6 @@ static int manager_connect_bus(Manager *m) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to add object manager: %m");
|
return log_error_errno(r, "Failed to add object manager: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(m->bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.home1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.home1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-common-errors.h"
|
#include "bus-common-errors.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
#include "env-file-label.h"
|
#include "env-file-label.h"
|
||||||
|
@ -755,10 +754,6 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to register object: %m");
|
return log_error_errno(r, "Failed to register object: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.hostname1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.hostname1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-common-errors.h"
|
#include "bus-common-errors.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
|
@ -1309,10 +1308,6 @@ static int manager_add_bus_objects(Manager *m) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to add transfer enumerator: %m");
|
return log_error_errno(r, "Failed to add transfer enumerator: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(m->bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.import1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.import1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-error.h"
|
#include "bus-error.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-message.h"
|
#include "bus-message.h"
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
|
@ -725,10 +724,6 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to register object: %m");
|
return log_error_errno(r, "Failed to register object: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.locale1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.locale1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-error.h"
|
#include "bus-error.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "cgroup-util.h"
|
#include "cgroup-util.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
|
@ -707,10 +706,6 @@ static int manager_connect_bus(Manager *m) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to enable subscription: %m");
|
return log_error_errno(r, "Failed to enable subscription: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(m->bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.login1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.login1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-error.h"
|
#include "bus-error.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "cgroup-util.h"
|
#include "cgroup-util.h"
|
||||||
#include "dirent-util.h"
|
#include "dirent-util.h"
|
||||||
|
@ -264,10 +263,6 @@ static int manager_connect_bus(Manager *m) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to enable subscription: %m");
|
return log_error_errno(r, "Failed to enable subscription: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(m->bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.machine1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.machine1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "sd-netlink.h"
|
#include "sd-netlink.h"
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "bus-util.h"
|
#include "bus-util.h"
|
||||||
#include "conf-parser.h"
|
#include "conf-parser.h"
|
||||||
|
@ -166,10 +165,6 @@ int manager_connect_bus(Manager *m) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to add network enumerator: %m");
|
return log_error_errno(r, "Failed to add network enumerator: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(m->bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.network1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.network1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "sd-daemon.h"
|
#include "sd-daemon.h"
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
#include "main-func.h"
|
#include "main-func.h"
|
||||||
|
@ -85,10 +84,6 @@ static int manager_connect_bus(Manager *m) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to add image enumerator: %m");
|
return log_error_errno(r, "Failed to add image enumerator: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(m->bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.portable1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.portable1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -2529,8 +2529,8 @@ static int verb_log_level(int argc, char *argv[], void *userdata) {
|
||||||
r = sd_bus_get_property_string(
|
r = sd_bus_get_property_string(
|
||||||
bus,
|
bus,
|
||||||
"org.freedesktop.resolve1",
|
"org.freedesktop.resolve1",
|
||||||
"/org/freedesktop/LogControl1",
|
"/org/freedesktop/resolve1",
|
||||||
"org.freedesktop.LogControl1",
|
"org.freedesktop.resolve1.Manager",
|
||||||
"LogLevel",
|
"LogLevel",
|
||||||
&error,
|
&error,
|
||||||
&level);
|
&level);
|
||||||
|
@ -2545,8 +2545,8 @@ static int verb_log_level(int argc, char *argv[], void *userdata) {
|
||||||
r = sd_bus_set_property(
|
r = sd_bus_set_property(
|
||||||
bus,
|
bus,
|
||||||
"org.freedesktop.resolve1",
|
"org.freedesktop.resolve1",
|
||||||
"/org/freedesktop/LogControl1",
|
"/org/freedesktop/resolve1",
|
||||||
"org.freedesktop.LogControl1",
|
"org.freedesktop.resolve1.Manager",
|
||||||
"LogLevel",
|
"LogLevel",
|
||||||
&error,
|
&error,
|
||||||
"s",
|
"s",
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-common-errors.h"
|
#include "bus-common-errors.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "bus-util.h"
|
#include "bus-util.h"
|
||||||
#include "dns-domain.h"
|
#include "dns-domain.h"
|
||||||
|
@ -1837,6 +1836,57 @@ static int bus_method_unregister_service(sd_bus_message *message, void *userdata
|
||||||
return call_dnssd_method(m, message, bus_dnssd_method_unregister, error);
|
return call_dnssd_method(m, message, bus_dnssd_method_unregister, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int property_get_log_level(
|
||||||
|
sd_bus *bus,
|
||||||
|
const char *path,
|
||||||
|
const char *interface,
|
||||||
|
const char *property,
|
||||||
|
sd_bus_message *reply,
|
||||||
|
void *userdata,
|
||||||
|
sd_bus_error *error) {
|
||||||
|
|
||||||
|
_cleanup_free_ char *t = NULL;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(bus);
|
||||||
|
assert(reply);
|
||||||
|
|
||||||
|
r = log_level_to_string_alloc(log_get_max_level(), &t);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
return sd_bus_message_append(reply, "s", t);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int property_set_log_level(
|
||||||
|
sd_bus *bus,
|
||||||
|
const char *path,
|
||||||
|
const char *interface,
|
||||||
|
const char *property,
|
||||||
|
sd_bus_message *value,
|
||||||
|
void *userdata,
|
||||||
|
sd_bus_error *error) {
|
||||||
|
|
||||||
|
const char *t;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(bus);
|
||||||
|
assert(value);
|
||||||
|
|
||||||
|
r = sd_bus_message_read(value, "s", &t);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
r = log_level_from_string(t);
|
||||||
|
if (r < 0)
|
||||||
|
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid log level '%s'", t);
|
||||||
|
|
||||||
|
log_info("Setting log level to %s.", t);
|
||||||
|
log_set_max_level(r);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const sd_bus_vtable resolve_vtable[] = {
|
static const sd_bus_vtable resolve_vtable[] = {
|
||||||
SD_BUS_VTABLE_START(0),
|
SD_BUS_VTABLE_START(0),
|
||||||
SD_BUS_PROPERTY("LLMNRHostname", "s", NULL, offsetof(Manager, llmnr_hostname), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
SD_BUS_PROPERTY("LLMNRHostname", "s", NULL, offsetof(Manager, llmnr_hostname), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
|
||||||
|
@ -1855,6 +1905,8 @@ static const sd_bus_vtable resolve_vtable[] = {
|
||||||
SD_BUS_PROPERTY("DNSSECNegativeTrustAnchors", "as", bus_property_get_ntas, 0, 0),
|
SD_BUS_PROPERTY("DNSSECNegativeTrustAnchors", "as", bus_property_get_ntas, 0, 0),
|
||||||
SD_BUS_PROPERTY("DNSStubListener", "s", bus_property_get_dns_stub_listener_mode, offsetof(Manager, dns_stub_listener_mode), 0),
|
SD_BUS_PROPERTY("DNSStubListener", "s", bus_property_get_dns_stub_listener_mode, offsetof(Manager, dns_stub_listener_mode), 0),
|
||||||
|
|
||||||
|
SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", property_get_log_level, property_set_log_level, 0, 0),
|
||||||
|
|
||||||
SD_BUS_METHOD_WITH_NAMES("ResolveHostname",
|
SD_BUS_METHOD_WITH_NAMES("ResolveHostname",
|
||||||
"isit",
|
"isit",
|
||||||
SD_BUS_PARAM(ifindex)
|
SD_BUS_PARAM(ifindex)
|
||||||
|
@ -2069,10 +2121,6 @@ int manager_connect_bus(Manager *m) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to register dnssd enumerator: %m");
|
return log_error_errno(r, "Failed to register dnssd enumerator: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(m->bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.resolve1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.resolve1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -1,123 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
||||||
|
|
||||||
#include "alloc-util.h"
|
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-util.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "sd-bus.h"
|
|
||||||
#include "syslog-util.h"
|
|
||||||
|
|
||||||
int bus_property_get_log_level(
|
|
||||||
sd_bus *bus,
|
|
||||||
const char *path,
|
|
||||||
const char *interface,
|
|
||||||
const char *property,
|
|
||||||
sd_bus_message *reply,
|
|
||||||
void *userdata,
|
|
||||||
sd_bus_error *error) {
|
|
||||||
|
|
||||||
_cleanup_free_ char *t = NULL;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(bus);
|
|
||||||
assert(reply);
|
|
||||||
|
|
||||||
r = log_level_to_string_alloc(log_get_max_level(), &t);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
return sd_bus_message_append(reply, "s", t);
|
|
||||||
}
|
|
||||||
|
|
||||||
int bus_property_set_log_level(
|
|
||||||
sd_bus *bus,
|
|
||||||
const char *path,
|
|
||||||
const char *interface,
|
|
||||||
const char *property,
|
|
||||||
sd_bus_message *value,
|
|
||||||
void *userdata,
|
|
||||||
sd_bus_error *error) {
|
|
||||||
|
|
||||||
const char *t;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(bus);
|
|
||||||
assert(value);
|
|
||||||
|
|
||||||
r = sd_bus_message_read(value, "s", &t);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = log_level_from_string(t);
|
|
||||||
if (r < 0)
|
|
||||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid log level '%s'", t);
|
|
||||||
|
|
||||||
log_info("Setting log level to %s.", t);
|
|
||||||
log_set_max_level(r);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BUS_DEFINE_PROPERTY_GET_GLOBAL(bus_property_get_log_target, "s", log_target_to_string(log_get_target()));
|
|
||||||
|
|
||||||
int bus_property_set_log_target(
|
|
||||||
sd_bus *bus,
|
|
||||||
const char *path,
|
|
||||||
const char *interface,
|
|
||||||
const char *property,
|
|
||||||
sd_bus_message *value,
|
|
||||||
void *userdata,
|
|
||||||
sd_bus_error *error) {
|
|
||||||
|
|
||||||
LogTarget target;
|
|
||||||
const char *t;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(bus);
|
|
||||||
assert(value);
|
|
||||||
|
|
||||||
r = sd_bus_message_read(value, "s", &t);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
target = log_target_from_string(t);
|
|
||||||
if (target < 0)
|
|
||||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid log target '%s'", t);
|
|
||||||
|
|
||||||
log_info("Setting log target to %s.", log_target_to_string(target));
|
|
||||||
log_set_target(target);
|
|
||||||
log_open();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BUS_DEFINE_PROPERTY_GET_GLOBAL(bus_property_get_syslog_identifier, "s", program_invocation_short_name);
|
|
||||||
|
|
||||||
static const sd_bus_vtable log_control_vtable[] = {
|
|
||||||
SD_BUS_VTABLE_START(0),
|
|
||||||
|
|
||||||
SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", bus_property_get_log_level, bus_property_set_log_level, 0, 0),
|
|
||||||
SD_BUS_WRITABLE_PROPERTY("LogTarget", "s", bus_property_get_log_target, bus_property_set_log_target, 0, 0),
|
|
||||||
SD_BUS_PROPERTY("SyslogIdentifier", "s", bus_property_get_syslog_identifier, 0, 0),
|
|
||||||
|
|
||||||
/* One of those days we might want to add a similar, second interface to cover common service
|
|
||||||
* operations such as Reload(), Reexecute(), Exit() … and maybe some properties exposing version
|
|
||||||
* number and other meta-data of the service. */
|
|
||||||
|
|
||||||
SD_BUS_VTABLE_END,
|
|
||||||
};
|
|
||||||
|
|
||||||
int bus_log_control_api_register(sd_bus *bus) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
r = sd_bus_add_object_vtable(
|
|
||||||
bus,
|
|
||||||
NULL,
|
|
||||||
"/org/freedesktop/LogControl1",
|
|
||||||
"org.freedesktop.LogControl1",
|
|
||||||
log_control_vtable, NULL);
|
|
||||||
if (r < 0)
|
|
||||||
return log_error_errno(r, "Failed to register service API object: %m");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
||||||
|
|
||||||
#include "sd-bus.h"
|
|
||||||
|
|
||||||
int bus_log_control_api_register(sd_bus *bus);
|
|
||||||
|
|
||||||
int bus_property_get_log_level(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
|
|
||||||
int bus_property_set_log_level(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *value, void *userdata, sd_bus_error *error);
|
|
||||||
|
|
||||||
int bus_property_get_log_target(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
|
|
||||||
int bus_property_set_log_target(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
|
|
||||||
|
|
||||||
int bus_property_get_syslog_identifier(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
|
|
|
@ -23,16 +23,14 @@ shared_sources = files('''
|
||||||
bpf-program.h
|
bpf-program.h
|
||||||
bridge-util.c
|
bridge-util.c
|
||||||
bridge-util.h
|
bridge-util.h
|
||||||
bus-log-control-api.c
|
|
||||||
bus-log-control-api.h
|
|
||||||
bus-polkit.c
|
|
||||||
bus-polkit.h
|
|
||||||
bus-unit-procs.c
|
bus-unit-procs.c
|
||||||
bus-unit-procs.h
|
bus-unit-procs.h
|
||||||
bus-unit-util.c
|
bus-unit-util.c
|
||||||
bus-unit-util.h
|
bus-unit-util.h
|
||||||
bus-util.c
|
bus-util.c
|
||||||
bus-util.h
|
bus-util.h
|
||||||
|
bus-polkit.c
|
||||||
|
bus-polkit.h
|
||||||
bus-wait-for-jobs.c
|
bus-wait-for-jobs.c
|
||||||
bus-wait-for-jobs.h
|
bus-wait-for-jobs.h
|
||||||
bus-wait-for-units.c
|
bus-wait-for-units.c
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-common-errors.h"
|
#include "bus-common-errors.h"
|
||||||
#include "bus-error.h"
|
#include "bus-error.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "clock-util.h"
|
#include "clock-util.h"
|
||||||
#include "conf-files.h"
|
#include "conf-files.h"
|
||||||
|
@ -1101,10 +1100,6 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to register object: %m");
|
return log_error_errno(r, "Failed to register object: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.timedate1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(bus, NULL, "org.freedesktop.timedate1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "bus-internal.h"
|
#include "bus-internal.h"
|
||||||
#include "bus-log-control-api.h"
|
|
||||||
#include "bus-protocol.h"
|
#include "bus-protocol.h"
|
||||||
#include "bus-util.h"
|
#include "bus-util.h"
|
||||||
#include "in-addr-util.h"
|
#include "in-addr-util.h"
|
||||||
|
@ -190,10 +189,6 @@ int manager_connect_bus(Manager *m) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to add manager object vtable: %m");
|
return log_error_errno(r, "Failed to add manager object vtable: %m");
|
||||||
|
|
||||||
r = bus_log_control_api_register(m->bus);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.timesync1", 0, NULL, NULL);
|
r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.timesync1", 0, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to request name: %m");
|
return log_error_errno(r, "Failed to request name: %m");
|
||||||
|
|
Loading…
Reference in New Issue