Compare commits

..

37 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 91b75f1f2f
Merge pull request #15508 from keszybz/add-dbus-entities-to-index
Add dbus entities to index
2020-04-21 13:58:01 +02:00
Lennart Poettering ede32a7cff
Merge pull request #15505 from keszybz/man-sd-hwdb-sd-journal
Document remaining sd-journal and sd-hwdb functions
2020-04-21 13:37:55 +02:00
Lennart Poettering e14a0c21e9 man: document how to get the boot menu with zero time-out
Fixes: #15125
2020-04-21 12:21:38 +02:00
Zbigniew Jędrzejewski-Szmek 32c4d2ba62 man: add SD_HWDB_FOREACH_PROPERTY with an example 2020-04-21 11:44:49 +02:00
Zbigniew Jędrzejewski-Szmek ec7ea47dae man: add description of all the sd-hwdb funtions 2020-04-21 11:37:30 +02:00
Zbigniew Jędrzejewski-Szmek 00bb75d7ce man: add markers to put all dbus entities in the directives index
Follow-up for f92c8d1c67.

directives.index:
- This index contains 3398 entries in 19 sections, referring to 333 individual
+ This index contains 4316 entries in 19 sections, referring to 333 individual
2020-04-21 10:59:24 +02:00
Zbigniew Jędrzejewski-Szmek 47fb7fd6b0 man: run systemd1(5) through the updater
For some reason I must've forgotten this page in 4fb222c4b2.
2020-04-21 10:56:51 +02:00
Zbigniew Jędrzejewski-Szmek 4a582e73b9
Merge pull request #15476 from boucman/directive_dbus
Generate systemd.directive entries from dbus documentation
2020-04-21 10:09:46 +02:00
Lennart Poettering f9411d5d5f
Merge pull request #15495 from keszybz/resolve-debugging-and-stub-handling
Resolve debugging and stub handling
2020-04-21 09:34:21 +02:00
Lennart Poettering 543d1e7854
Merge pull request #15314 from keszybz/network-server-access-functions
Define network server access functions
2020-04-21 09:24:48 +02:00
Zbigniew Jędrzejewski-Szmek 55c0fbde8f
Merge pull request #15502 from DaanDeMeyer/sd-bus-exit-on-disconnect-docs
sd-bus: Add sd_bus_get/set_exit_on_disconnect docs
2020-04-21 09:23:16 +02:00
Zbigniew Jędrzejewski-Szmek 309b7d41f2
Merge pull request #15503 from DaanDeMeyer/sd-bus-get-docs
sd-bus: Add sd_bus_get_scope/tid/unique_name docs
2020-04-21 09:16:29 +02:00
Zbigniew Jędrzejewski-Szmek 21dc5e82ad man: add sd_j_open_namespace as refname
This was forgotten in 241c8f67f6.
2020-04-21 09:08:14 +02:00
Zbigniew Jędrzejewski-Szmek 622018c5b4 check-api-docs: sd_journal_open_container is deprecated 2020-04-21 09:08:14 +02:00
Zbigniew Jędrzejewski-Szmek c11edfee98 man: document sd_journal_*_with_location 2020-04-21 09:08:14 +02:00
Daan De Meyer 23139f89dc sd-bus: Rewrap sd_bus_set_close_on_exit + small fixes 2020-04-21 08:48:55 +02:00
Daan De Meyer 4eaf8bc69e sd-bus: Add sd_bus_get_scope/tid/unique_name docs 2020-04-21 08:44:32 +02:00
Daan De Meyer b778146b94 sd-bus: Rewrap sd_bus_set_description docs 2020-04-20 21:39:07 +02:00
Daan De Meyer 75358555a5 sd-bus: sd_bus_get_fd docs typo fix 2020-04-20 21:32:35 +02:00
Jérémy Rosen f92c8d1c67 update-dbus-docs: automatically add variablelist for introspected items
Add a <variablelist/> tag after every programlisting we auto-generate that
will be read by make-directive-index to cross-reference all dbus elements.
2020-04-20 21:03:03 +02:00
Daan De Meyer d4169bf8b0 sd-bus: Rewrap sd_bus_get_fd docs 2020-04-20 20:59:27 +02:00
Daan De Meyer 37409a1c68 sd-bus: Small sd_bus_set_server doc fix 2020-04-20 20:03:44 +02:00
Daan De Meyer c72d0fb154 sd-bus: Add sd_bus_get/set_exit_on_disconnect docs 2020-04-20 20:03:41 +02:00
Jérémy Rosen 8906e26278 make-directive-index: allow variablelist to specify an element to index
This commit looks for a new "extra-ref" attribute in <variablelist>
If this attribute is specified, its content will be index as pointing to
the current man-page in systemd.directives
2020-04-20 18:49:58 +02:00
Jérémy Rosen acbfdec33e make-directive-index: allow pages to specify the path to search
So far, make-directive-index would look for
./valistentry/term/varname for elements to add to the directive man page.

This commit allows to specify xpath= in the varlist directive to tell
the generator what to look for.
2020-04-20 18:49:58 +02:00
Zbigniew Jędrzejewski-Szmek ca8b81d923 resolve: when the stub listener is disabled, symlink stub-resolv.conf to resolv.conf
When the stub listener is disabled, stub-resolv.conf is useless. Instead of
warning about this, let's just make stub-resolv.conf point to the private
resolv.conf file. (The original bug report asked for "mirroring", but I think
a symlink is nicer than a copy because it is easier to see that a redirection
was made.)

Fixes #14700.
2020-04-20 15:50:40 +02:00
Zbigniew Jędrzejewski-Szmek 965228a846 resolve: when writing of private resolv.confs fails, do not remove old copies
All callers ignore the return value.

This is almost entirely theoretical, since writing to /run is unlikely to
fail..., but the user is almost certainly better off keeping the old copy
around and having working dns resolution with an out-of-date dns server list
than having having a dangling /etc/resolv.conf symlink.
2020-04-20 15:48:05 +02:00
Zbigniew Jędrzejewski-Szmek 5c35cd5f47 resolved: include actual path in error message
An error with a full path is immediately clear. OTOH, a user might not be
familiar with concenpt like "private resolv.conf".

I opted to use %s-formatting for the path, because the code is much easier to
read this way. Any difference in t speed of execution is not important.
2020-04-20 15:43:33 +02:00
Zbigniew Jędrzejewski-Szmek e53b8cc521 resolved: return org.freedesktop.resolve1.DnsError.NXDOMAIN on LLMNR resolution failure
Fixes #14922.
2020-04-20 15:33:18 +02:00
Zbigniew Jędrzejewski-Szmek 6daebf9e4a TODO: add a hypothetical 2020-04-20 15:33:18 +02:00
Zbigniew Jędrzejewski-Szmek 7f25507647 man: add forgotten <para> tags around a paragaph in resolve1(5) 2020-04-20 15:33:18 +02:00
Zbigniew Jędrzejewski-Szmek df9578498f resolve: allow setting the log level dynamically as in pid1
This is useful to raise the log level for a single transaction or a few,
without affecting other state of the resolved as a restart would.
The log level can only be set, I didn't bother with having the ability
to restore the original as in pid1.
2020-04-20 15:33:18 +02:00
Zbigniew Jędrzejewski-Szmek 24e6f45842 network: use a loop for repetitive operation
This should hopefully help us avoid c&p mistakes. And there are plans to
add more settings like this, which should then be rather straightforward.

There is a slight functional change: the code got uplink handling wrong
and run manager_find_uplink() repeatedly. That part is fixed.
2020-04-10 17:57:31 +02:00
Zbigniew Jędrzejewski-Szmek c1997a5bf7 network: add helper to extract server lists
This code is repeable enough to define a common implementation.
2020-04-10 17:57:19 +02:00
Zbigniew Jędrzejewski-Szmek ddc026f303 network: define string lookup table for the DHCP info bits 2020-04-10 17:53:10 +02:00
Zbigniew Jędrzejewski-Szmek c8407baf30 sd-dhcp-server: add a meta-setter to simplify setting of server lists 2020-04-10 17:52:59 +02:00
Zbigniew Jędrzejewski-Szmek 8541db8f59 sd-dhcp-lease: add a meta-getter to simplify querying of server lists 2020-04-10 17:45:46 +02:00
39 changed files with 10184 additions and 1536 deletions

4
TODO
View File

@ -821,6 +821,10 @@ Features:
* teach ConditionKernelCommandLine= globs or regexes (in order to match foobar={no,0,off})
* Add ConditionDirectoryNotEmpty= handle non-absoute paths as a search path or add
ConditionConfigSearchPathNotEmpty= or different syntax? See the discussion starting at
https://github.com/systemd/systemd/pull/15109#issuecomment-607740136.
* BootLoaderSpec: Clarify that the kernel has to be in $BOOT. Clarify
that the boot loader should be installed to the ESP. Define a way
how an installer can figure out whether a BLS compliant boot loader

28
man/hwdb-usb-device.c Normal file
View File

@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdint.h>
#include <sd-hwdb.h>
int print_usb_properties(uint16_t vid, uint16_t pid) {
char match[15];
sd_hwdb *hwdb;
const char *key, *value;
int r;
/* Match this USB vendor and product ID combination */
snprintf(match, sizeof match, "usb:v%04Xp%04X", vid, pid);
r = sd_hwdb_new(&hwdb);
if (r < 0)
return r;
SD_HWDB_FOREACH_PROPERTY(hwdb, match, key, value)
printf("%s: \"%s\"\"%s\"\n", match, key, value);
sd_hwdb_unref(hwdb);
return 0;
}
int main(int argc, char **argv) {
print_usb_properties(0x046D, 0xC534);
return 0;
}

View File

@ -121,6 +121,56 @@ node /org/freedesktop/hostname1 {
<!--property HomeURL is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.hostname1"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.hostname1"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetHostname()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetStaticHostname()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetPrettyHostname()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetIconName()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetChassis()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDeployment()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLocation()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetProductUUID()"/>
<variablelist class="dbus-property" generated="True" extra-ref="Hostname"/>
<variablelist class="dbus-property" generated="True" extra-ref="StaticHostname"/>
<variablelist class="dbus-property" generated="True" extra-ref="PrettyHostname"/>
<variablelist class="dbus-property" generated="True" extra-ref="IconName"/>
<variablelist class="dbus-property" generated="True" extra-ref="Chassis"/>
<variablelist class="dbus-property" generated="True" extra-ref="Deployment"/>
<variablelist class="dbus-property" generated="True" extra-ref="Location"/>
<variablelist class="dbus-property" generated="True" extra-ref="KernelName"/>
<variablelist class="dbus-property" generated="True" extra-ref="KernelRelease"/>
<variablelist class="dbus-property" generated="True" extra-ref="KernelVersion"/>
<variablelist class="dbus-property" generated="True" extra-ref="OperatingSystemPrettyName"/>
<variablelist class="dbus-property" generated="True" extra-ref="OperatingSystemCPEName"/>
<variablelist class="dbus-property" generated="True" extra-ref="HomeURL"/>
<!--End of Autogenerated section-->
<para>Whenever the hostname or other metadata is changed via the daemon,
<function>PropertyChanged</function> signals are sent out to subscribed clients. Changing a hostname
using this interface is authenticated via PolicyKit.</para>

View File

@ -111,6 +111,36 @@ node /org/freedesktop/import1 {
<!--method ImportFileSystem is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Manager"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Manager"/>
<variablelist class="dbus-method" generated="True" extra-ref="ImportTar()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ImportRaw()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ImportFileSystem()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ExportTar()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ExportRaw()"/>
<variablelist class="dbus-method" generated="True" extra-ref="PullTar()"/>
<variablelist class="dbus-method" generated="True" extra-ref="PullRaw()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ListTransfers()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CancelTransfer()"/>
<variablelist class="dbus-signal" generated="True" extra-ref="TransferNew"/>
<variablelist class="dbus-signal" generated="True" extra-ref="TransferRemoved"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>
@ -242,6 +272,30 @@ node /org/freedesktop/import1/transfer/_1 {
<!--signal LogMessage is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Transfer"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Transfer"/>
<variablelist class="dbus-method" generated="True" extra-ref="Cancel()"/>
<variablelist class="dbus-signal" generated="True" extra-ref="LogMessage"/>
<variablelist class="dbus-property" generated="True" extra-ref="Id"/>
<variablelist class="dbus-property" generated="True" extra-ref="Local"/>
<variablelist class="dbus-property" generated="True" extra-ref="Remote"/>
<variablelist class="dbus-property" generated="True" extra-ref="Type"/>
<variablelist class="dbus-property" generated="True" extra-ref="Verify"/>
<variablelist class="dbus-property" generated="True" extra-ref="Progress"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>

View File

@ -69,6 +69,34 @@ node /org/freedesktop/locale1 {
};
</programlisting>
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.locale1"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.locale1"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLocale()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetVConsoleKeyboard()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetX11Keyboard()"/>
<variablelist class="dbus-property" generated="True" extra-ref="Locale"/>
<variablelist class="dbus-property" generated="True" extra-ref="X11Layout"/>
<variablelist class="dbus-property" generated="True" extra-ref="X11Model"/>
<variablelist class="dbus-property" generated="True" extra-ref="X11Variant"/>
<variablelist class="dbus-property" generated="True" extra-ref="X11Options"/>
<variablelist class="dbus-property" generated="True" extra-ref="VConsoleKeymap"/>
<variablelist class="dbus-property" generated="True" extra-ref="VConsoleKeymapToggle"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>

View File

@ -235,6 +235,210 @@ node /org/freedesktop/login1 {
};
</programlisting>
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Manager"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Manager"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetSession()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetSessionByPID()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetUser()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetUserByPID()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetSeat()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ListSessions()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ListUsers()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ListSeats()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ListInhibitors()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CreateSession()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ReleaseSession()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ActivateSession()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ActivateSessionOnSeat()"/>
<variablelist class="dbus-method" generated="True" extra-ref="LockSession()"/>
<variablelist class="dbus-method" generated="True" extra-ref="UnlockSession()"/>
<variablelist class="dbus-method" generated="True" extra-ref="LockSessions()"/>
<variablelist class="dbus-method" generated="True" extra-ref="UnlockSessions()"/>
<variablelist class="dbus-method" generated="True" extra-ref="KillSession()"/>
<variablelist class="dbus-method" generated="True" extra-ref="KillUser()"/>
<variablelist class="dbus-method" generated="True" extra-ref="TerminateSession()"/>
<variablelist class="dbus-method" generated="True" extra-ref="TerminateUser()"/>
<variablelist class="dbus-method" generated="True" extra-ref="TerminateSeat()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetUserLinger()"/>
<variablelist class="dbus-method" generated="True" extra-ref="AttachDevice()"/>
<variablelist class="dbus-method" generated="True" extra-ref="FlushDevices()"/>
<variablelist class="dbus-method" generated="True" extra-ref="PowerOff()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Reboot()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Halt()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Suspend()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Hibernate()"/>
<variablelist class="dbus-method" generated="True" extra-ref="HybridSleep()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SuspendThenHibernate()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanPowerOff()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanReboot()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanHalt()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanSuspend()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanHibernate()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanHybridSleep()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanSuspendThenHibernate()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ScheduleShutdown()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CancelScheduledShutdown()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Inhibit()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanRebootParameter()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetRebootParameter()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanRebootToFirmwareSetup()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetRebootToFirmwareSetup()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanRebootToBootLoaderMenu()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetRebootToBootLoaderMenu()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CanRebootToBootLoaderEntry()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetRebootToBootLoaderEntry()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetWallMessage()"/>
<variablelist class="dbus-signal" generated="True" extra-ref="SessionNew"/>
<variablelist class="dbus-signal" generated="True" extra-ref="SessionRemoved"/>
<variablelist class="dbus-signal" generated="True" extra-ref="UserNew"/>
<variablelist class="dbus-signal" generated="True" extra-ref="UserRemoved"/>
<variablelist class="dbus-signal" generated="True" extra-ref="SeatNew"/>
<variablelist class="dbus-signal" generated="True" extra-ref="SeatRemoved"/>
<variablelist class="dbus-signal" generated="True" extra-ref="PrepareForShutdown"/>
<variablelist class="dbus-signal" generated="True" extra-ref="PrepareForSleep"/>
<variablelist class="dbus-property" generated="True" extra-ref="EnableWallMessages"/>
<variablelist class="dbus-property" generated="True" extra-ref="WallMessage"/>
<variablelist class="dbus-property" generated="True" extra-ref="NAutoVTs"/>
<variablelist class="dbus-property" generated="True" extra-ref="KillOnlyUsers"/>
<variablelist class="dbus-property" generated="True" extra-ref="KillExcludeUsers"/>
<variablelist class="dbus-property" generated="True" extra-ref="KillUserProcesses"/>
<variablelist class="dbus-property" generated="True" extra-ref="RebootParameter"/>
<variablelist class="dbus-property" generated="True" extra-ref="RebootToFirmwareSetup"/>
<variablelist class="dbus-property" generated="True" extra-ref="RebootToBootLoaderMenu"/>
<variablelist class="dbus-property" generated="True" extra-ref="RebootToBootLoaderEntry"/>
<variablelist class="dbus-property" generated="True" extra-ref="BootLoaderEntries"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleHint"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHint"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHintMonotonic"/>
<variablelist class="dbus-property" generated="True" extra-ref="BlockInhibited"/>
<variablelist class="dbus-property" generated="True" extra-ref="DelayInhibited"/>
<variablelist class="dbus-property" generated="True" extra-ref="InhibitDelayMaxUSec"/>
<variablelist class="dbus-property" generated="True" extra-ref="UserStopDelayUSec"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandlePowerKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleSuspendKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleHibernateKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitch"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitchExternalPower"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitchDocked"/>
<variablelist class="dbus-property" generated="True" extra-ref="HoldoffTimeoutUSec"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleAction"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleActionUSec"/>
<variablelist class="dbus-property" generated="True" extra-ref="PreparingForShutdown"/>
<variablelist class="dbus-property" generated="True" extra-ref="PreparingForSleep"/>
<variablelist class="dbus-property" generated="True" extra-ref="ScheduledShutdown"/>
<variablelist class="dbus-property" generated="True" extra-ref="Docked"/>
<variablelist class="dbus-property" generated="True" extra-ref="LidClosed"/>
<variablelist class="dbus-property" generated="True" extra-ref="OnExternalPower"/>
<variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/>
<variablelist class="dbus-property" generated="True" extra-ref="RuntimeDirectorySize"/>
<variablelist class="dbus-property" generated="True" extra-ref="InhibitorsMax"/>
<variablelist class="dbus-property" generated="True" extra-ref="NCurrentInhibitors"/>
<variablelist class="dbus-property" generated="True" extra-ref="SessionsMax"/>
<variablelist class="dbus-property" generated="True" extra-ref="NCurrentSessions"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>
@ -568,6 +772,42 @@ node /org/freedesktop/login1/seat/seat0 {
};
</programlisting>
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Seat"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Seat"/>
<variablelist class="dbus-method" generated="True" extra-ref="Terminate()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ActivateSession()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SwitchTo()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SwitchToNext()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SwitchToPrevious()"/>
<variablelist class="dbus-property" generated="True" extra-ref="Id"/>
<variablelist class="dbus-property" generated="True" extra-ref="ActiveSession"/>
<variablelist class="dbus-property" generated="True" extra-ref="CanMultiSession"/>
<variablelist class="dbus-property" generated="True" extra-ref="CanTTY"/>
<variablelist class="dbus-property" generated="True" extra-ref="CanGraphical"/>
<variablelist class="dbus-property" generated="True" extra-ref="Sessions"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleHint"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHint"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHintMonotonic"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>
@ -657,6 +897,48 @@ node /org/freedesktop/login1/user/_1000 {
};
</programlisting>
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.User"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.User"/>
<variablelist class="dbus-method" generated="True" extra-ref="Terminate()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Kill()"/>
<variablelist class="dbus-property" generated="True" extra-ref="UID"/>
<variablelist class="dbus-property" generated="True" extra-ref="GID"/>
<variablelist class="dbus-property" generated="True" extra-ref="Name"/>
<variablelist class="dbus-property" generated="True" extra-ref="Timestamp"/>
<variablelist class="dbus-property" generated="True" extra-ref="TimestampMonotonic"/>
<variablelist class="dbus-property" generated="True" extra-ref="RuntimePath"/>
<variablelist class="dbus-property" generated="True" extra-ref="Service"/>
<variablelist class="dbus-property" generated="True" extra-ref="Slice"/>
<variablelist class="dbus-property" generated="True" extra-ref="Display"/>
<variablelist class="dbus-property" generated="True" extra-ref="State"/>
<variablelist class="dbus-property" generated="True" extra-ref="Sessions"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleHint"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHint"/>
<variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHintMonotonic"/>
<variablelist class="dbus-property" generated="True" extra-ref="Linger"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>

View File

@ -171,7 +171,115 @@ node /org/freedesktop/machine1 {
interface org.freedesktop.DBus.Introspectable { ... };
interface org.freedesktop.DBus.Properties { ... };
};
</programlisting>
</programlisting>
<!--method UnregisterMachine is not documented!-->
<!--method OpenMachineRootDirectory is not documented!-->
<!--method GetMachineUIDShift is not documented!-->
<!--method GetImageHostname is not documented!-->
<!--method GetImageMachineID is not documented!-->
<!--method GetImageMachineInfo is not documented!-->
<!--method GetImageOSRelease is not documented!-->
<!--method CleanPool is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.machine1.Manager"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.machine1.Manager"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetMachine()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetImage()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetMachineByPID()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ListMachines()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ListImages()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CreateMachine()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CreateMachineWithNetwork()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RegisterMachine()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RegisterMachineWithNetwork()"/>
<variablelist class="dbus-method" generated="True" extra-ref="UnregisterMachine()"/>
<variablelist class="dbus-method" generated="True" extra-ref="TerminateMachine()"/>
<variablelist class="dbus-method" generated="True" extra-ref="KillMachine()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetMachineAddresses()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetMachineOSRelease()"/>
<variablelist class="dbus-method" generated="True" extra-ref="OpenMachinePTY()"/>
<variablelist class="dbus-method" generated="True" extra-ref="OpenMachineLogin()"/>
<variablelist class="dbus-method" generated="True" extra-ref="OpenMachineShell()"/>
<variablelist class="dbus-method" generated="True" extra-ref="BindMountMachine()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CopyFromMachine()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CopyToMachine()"/>
<variablelist class="dbus-method" generated="True" extra-ref="OpenMachineRootDirectory()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetMachineUIDShift()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RemoveImage()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RenameImage()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CloneImage()"/>
<variablelist class="dbus-method" generated="True" extra-ref="MarkImageReadOnly()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetImageHostname()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetImageMachineID()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetImageMachineInfo()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetImageOSRelease()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetPoolLimit()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetImageLimit()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CleanPool()"/>
<variablelist class="dbus-method" generated="True" extra-ref="MapFromMachineUser()"/>
<variablelist class="dbus-method" generated="True" extra-ref="MapToMachineUser()"/>
<variablelist class="dbus-method" generated="True" extra-ref="MapFromMachineGroup()"/>
<variablelist class="dbus-method" generated="True" extra-ref="MapToMachineGroup()"/>
<variablelist class="dbus-signal" generated="True" extra-ref="MachineNew"/>
<variablelist class="dbus-signal" generated="True" extra-ref="MachineRemoved"/>
<variablelist class="dbus-property" generated="True" extra-ref="PoolPath"/>
<variablelist class="dbus-property" generated="True" extra-ref="PoolUsage"/>
<variablelist class="dbus-property" generated="True" extra-ref="PoolLimit"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>
@ -390,6 +498,76 @@ node /org/freedesktop/machine1/machine/rawhide {
};
</programlisting>
<!--method GetUIDShift is not documented!-->
<!--method OpenPTY is not documented!-->
<!--method OpenLogin is not documented!-->
<!--method OpenShell is not documented!-->
<!--method BindMount is not documented!-->
<!--method CopyFrom is not documented!-->
<!--method CopyTo is not documented!-->
<!--method OpenRootDirectory is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.machine1.Machine"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.machine1.Machine"/>
<variablelist class="dbus-method" generated="True" extra-ref="Terminate()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Kill()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetAddresses()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetOSRelease()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetUIDShift()"/>
<variablelist class="dbus-method" generated="True" extra-ref="OpenPTY()"/>
<variablelist class="dbus-method" generated="True" extra-ref="OpenLogin()"/>
<variablelist class="dbus-method" generated="True" extra-ref="OpenShell()"/>
<variablelist class="dbus-method" generated="True" extra-ref="BindMount()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CopyFrom()"/>
<variablelist class="dbus-method" generated="True" extra-ref="CopyTo()"/>
<variablelist class="dbus-method" generated="True" extra-ref="OpenRootDirectory()"/>
<variablelist class="dbus-property" generated="True" extra-ref="Name"/>
<variablelist class="dbus-property" generated="True" extra-ref="Id"/>
<variablelist class="dbus-property" generated="True" extra-ref="Timestamp"/>
<variablelist class="dbus-property" generated="True" extra-ref="TimestampMonotonic"/>
<variablelist class="dbus-property" generated="True" extra-ref="Service"/>
<variablelist class="dbus-property" generated="True" extra-ref="Unit"/>
<variablelist class="dbus-property" generated="True" extra-ref="Leader"/>
<variablelist class="dbus-property" generated="True" extra-ref="Class"/>
<variablelist class="dbus-property" generated="True" extra-ref="RootDirectory"/>
<variablelist class="dbus-property" generated="True" extra-ref="NetworkInterfaces"/>
<variablelist class="dbus-property" generated="True" extra-ref="State"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>

View File

@ -145,6 +145,9 @@ node /org/freedesktop/resolve1 {
readonly as DNSSECNegativeTrustAnchors = ['...', ...];
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
readonly s DNSStubListener = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
@org.freedesktop.systemd1.Privileged("true")
readwrite s LogLevel = '...';
};
interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... };
@ -180,6 +183,84 @@ node /org/freedesktop/resolve1 {
<!--property DNSStubListener is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.resolve1.Manager"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.resolve1.Manager"/>
<variablelist class="dbus-method" generated="True" extra-ref="ResolveHostname()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ResolveAddress()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ResolveRecord()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ResolveService()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetLink()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDomains()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDefaultRoute()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkLLMNR()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkMulticastDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSOverTLS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSSEC()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLinkDNSSECNegativeTrustAnchors()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RevertLink()"/>
<variablelist class="dbus-method" generated="True" extra-ref="RegisterService()"/>
<variablelist class="dbus-method" generated="True" extra-ref="UnregisterService()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ResetStatistics()"/>
<variablelist class="dbus-method" generated="True" extra-ref="FlushCaches()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ResetServerFeatures()"/>
<variablelist class="dbus-property" generated="True" extra-ref="LLMNRHostname"/>
<variablelist class="dbus-property" generated="True" extra-ref="LLMNR"/>
<variablelist class="dbus-property" generated="True" extra-ref="MulticastDNS"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSOverTLS"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNS"/>
<variablelist class="dbus-property" generated="True" extra-ref="FallbackDNS"/>
<variablelist class="dbus-property" generated="True" extra-ref="CurrentDNSServer"/>
<variablelist class="dbus-property" generated="True" extra-ref="Domains"/>
<variablelist class="dbus-property" generated="True" extra-ref="TransactionStatistics"/>
<variablelist class="dbus-property" generated="True" extra-ref="CacheStatistics"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSSEC"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSSECStatistics"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSSECSupported"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSSECNegativeTrustAnchors"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSStubListener"/>
<variablelist class="dbus-property" generated="True" extra-ref="LogLevel"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>
@ -406,10 +487,10 @@ node /org/freedesktop/resolve1 {
<refsect2>
<title>Properties</title>
<varname>LLMNRHostname</varname> contains the hostname currently exposed on the network via LLMNR. It
usually follows the system hostname as may be queried via
<para><varname>LLMNRHostname</varname> contains the hostname currently exposed on the network via
LLMNR. It usually follows the system hostname as may be queried via
<citerefentry project="man-pages"><refentrytitle>gethostname</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
but may differ if a conflict is detected on the network.
but may differ if a conflict is detected on the network.</para>
<para><varname>DNS</varname> contains an array of all DNS servers currently used by
<filename>systemd-resolved</filename>. It contains similar information as the DNS server data written to
@ -460,6 +541,10 @@ node /org/freedesktop/resolve1 {
which DNS is configured and for the system-wide settings if there are any. Note that <filename>systemd-resolved</filename> assumes
DNSSEC is supported by DNS servers until it verifies that this is not the case. Thus, the reported
value may initially be true, until the first transactions are executed.</para>
<para>The <varname>LogLevel</varname> property shows the (maximum) log level of the manager, with the
same values as the <option>--log-level=</option> option described in
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
</refsect2>
</refsect1>
@ -543,6 +628,54 @@ node /org/freedesktop/resolve1/link/_34 {
<!--property DNSSECNegativeTrustAnchors is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.resolve1.Link"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.resolve1.Link"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDomains()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDefaultRoute()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLLMNR()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetMulticastDNS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDNSOverTLS()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDNSSEC()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetDNSSECNegativeTrustAnchors()"/>
<variablelist class="dbus-method" generated="True" extra-ref="Revert()"/>
<variablelist class="dbus-property" generated="True" extra-ref="ScopesMask"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNS"/>
<variablelist class="dbus-property" generated="True" extra-ref="CurrentDNSServer"/>
<variablelist class="dbus-property" generated="True" extra-ref="Domains"/>
<variablelist class="dbus-property" generated="True" extra-ref="DefaultRoute"/>
<variablelist class="dbus-property" generated="True" extra-ref="LLMNR"/>
<variablelist class="dbus-property" generated="True" extra-ref="MulticastDNS"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSOverTLS"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSSEC"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSSECNegativeTrustAnchors"/>
<variablelist class="dbus-property" generated="True" extra-ref="DNSSECSupported"/>
<!--End of Autogenerated section-->
<para>For each Linux network interface a "Link" object is created which exposes per-link DNS
configuration and state. Use <function>GetLink()</function> on the Manager interface to retrieve the
object path for a link object given the network interface index (see above).</para>

File diff suppressed because it is too large Load Diff

View File

@ -88,6 +88,38 @@ node /org/freedesktop/timedate1 {
<!--property RTCTimeUSec is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.timedate1"/>
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.timedate1"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetTime()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetTimezone()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetLocalRTC()"/>
<variablelist class="dbus-method" generated="True" extra-ref="SetNTP()"/>
<variablelist class="dbus-method" generated="True" extra-ref="ListTimezones()"/>
<variablelist class="dbus-property" generated="True" extra-ref="Timezone"/>
<variablelist class="dbus-property" generated="True" extra-ref="LocalRTC"/>
<variablelist class="dbus-property" generated="True" extra-ref="CanNTP"/>
<variablelist class="dbus-property" generated="True" extra-ref="NTP"/>
<variablelist class="dbus-property" generated="True" extra-ref="NTPSynchronized"/>
<variablelist class="dbus-property" generated="True" extra-ref="TimeUSec"/>
<variablelist class="dbus-property" generated="True" extra-ref="RTCTimeUSec"/>
<!--End of Autogenerated section-->
<refsect2>
<title>Methods</title>

View File

@ -175,6 +175,7 @@
automatically, an explicit reverting is not necessary in that case.</para></listitem>
</varlistentry>
<xi:include href="systemctl.xml" xpointer="log-level" />
</variablelist>
</refsect1>

View File

@ -107,6 +107,7 @@ manpages = [
'SD_WARNING'],
''],
['sd-event', '3', [], ''],
['sd-hwdb', '3', [], ''],
['sd-id128',
'3',
['SD_ID128_CONST_STR',
@ -379,12 +380,16 @@ manpages = [
'3',
['sd_bus_get_allow_interactive_authorization',
'sd_bus_get_description',
'sd_bus_get_scope',
'sd_bus_get_tid',
'sd_bus_get_unique_name',
'sd_bus_is_anonymous',
'sd_bus_is_trusted',
'sd_bus_set_allow_interactive_authorization',
'sd_bus_set_anonymous',
'sd_bus_set_trusted'],
''],
['sd_bus_set_exit_on_disconnect', '3', ['sd_bus_get_exit_on_disconnect'], ''],
['sd_bus_set_method_call_timeout',
'3',
['sd_bus_get_method_call_timeout'],
@ -559,6 +564,11 @@ manpages = [
'3',
['sd_get_machine_names', 'sd_get_sessions', 'sd_get_uids'],
'HAVE_PAM'],
['sd_hwdb_get',
'3',
['SD_HWDB_FOREACH_PROPERTY', 'sd_hwdb_enumerate', 'sd_hwdb_seek'],
''],
['sd_hwdb_new', '3', ['sd_hwdb_ref', 'sd_hwdb_unref'], ''],
['sd_id128_get_machine',
'3',
['sd_id128_get_boot',
@ -637,15 +647,21 @@ manpages = [
'sd_journal_open_directory',
'sd_journal_open_directory_fd',
'sd_journal_open_files',
'sd_journal_open_files_fd'],
'sd_journal_open_files_fd',
'sd_journal_open_namespace'],
''],
['sd_journal_print',
'3',
['SD_JOURNAL_SUPPRESS_LOCATION',
'sd_journal_perror',
'sd_journal_perror_with_location',
'sd_journal_print_with_location',
'sd_journal_printv',
'sd_journal_printv_with_location',
'sd_journal_send',
'sd_journal_sendv'],
'sd_journal_send_with_location',
'sd_journal_sendv',
'sd_journal_sendv_with_location'],
''],
['sd_journal_query_unique',
'3',

View File

@ -77,9 +77,13 @@
<citerefentry><refentrytitle>sd_bus_get_current_message</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_current_slot</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_current_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_exit_on_disconnect</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_n_queued_read</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_unique_name</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_message_append</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@ -121,16 +125,17 @@
<citerefentry><refentrytitle>sd_bus_request_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_close_on_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_connected_signal</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_method_call_timeout</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_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_server</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>sd_bus_set_close_on_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_get_current_handler</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_get_current_message</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_get_current_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>,

57
man/sd-hwdb.xml Normal file
View File

@ -0,0 +1,57 @@
<?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-hwdb" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>sd-hwdb</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>sd-hwdb</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>sd-hwdb</refname>
<refpurpose>Read-only access to the hardware description database</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include &lt;systemd/sd-hwdb.h&gt;</funcsynopsisinfo>
</funcsynopsis>
<cmdsynopsis>
<command>pkg-config --cflags --libs libsystemd</command>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><filename>sd-hwdb.h</filename> allows read-only access the systemd database of hardware properties.
See <citerefentry><refentrytitle>hwdb</refentrytitle><manvolnum>7</manvolnum></citerefentry> and
<citerefentry><refentrytitle>systemd-hwdb</refentrytitle><manvolnum>8</manvolnum></citerefentry> for more
information about the database.</para>
<para>See <citerefentry><refentrytitle>sd_hwdb_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
and <citerefentry><refentrytitle>sd_hwdb_get</refentrytitle><manvolnum>3</manvolnum></citerefentry> for
information about the functions available.</para>
</refsect1>
<xi:include href="libsystemd-pkgconfig.xml" />
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

View File

@ -26,7 +26,8 @@
<refname>sd_bus_get_events</refname>
<refname>sd_bus_get_timeout</refname>
<refpurpose>Get the file descriptor, I/O events and time-out to wait for from a message bus object</refpurpose>
<refpurpose>Get the file descriptor, I/O events and time-out to wait for from a message bus
object</refpurpose>
</refnamediv>
<refsynopsisdiv>
@ -61,65 +62,74 @@
<refsect1>
<title>Description</title>
<para><function>sd_bus_get_fd()</function> returns the file descriptor used to communicate from a message bus
object. This descriptor can be used with <citerefentry
project='man-pages'><refentrytitle>poll</refentrytitle><manvolnum>3</manvolnum></citerefentry> or a similar
function to wait for I/O events on the specified bus connection object. If the bus object was configured with the
<function>sd_bus_set_fd()</function> function, then the <parameter>input_fd</parameter> file descriptor used in
that call is returned.</para>
<para><function>sd_bus_get_fd()</function> returns the file descriptor used to communicate from
a message bus object. This descriptor can be used with
<citerefentry project='man-pages'><refentrytitle>poll</refentrytitle><manvolnum>3</manvolnum></citerefentry>
or a similar function to wait for I/O events on the specified bus connection object. If the bus
object was configured with the <function>sd_bus_set_fd()</function> function, then the
<parameter>input_fd</parameter> file descriptor used in that call is returned.</para>
<para><function>sd_bus_set_fd()</function> sets the file descriptors used to communicate from a message bus
object. Both <parameter>input_fd</parameter> and <parameter>output_fd</parameter> must be valid file descriptors.
The same file descriptor may be used as both the input and the output file descriptor. This function must be called
before the bus is started.</para>
<para><function>sd_bus_set_fd()</function> sets the file descriptors used to communicate from a
message bus object. Both <parameter>input_fd</parameter> and <parameter>output_fd</parameter>
must be valid file descriptors. The same file descriptor may be used as both the input and the
output file descriptor. This function must be called before the bus is started.</para>
<para><function>sd_bus_get_events()</function> returns the I/O events to wait for, suitable for passing to
<function>poll()</function> or a similar call. Returns a combination of <constant>POLLIN</constant>,
<constant>POLLOUT</constant>, … events, or negative on error.</para>
<para><function>sd_bus_get_events()</function> returns the I/O events to wait for, suitable for
passing to <function>poll()</function> or a similar call. Returns a combination of
<constant>POLLIN</constant>, <constant>POLLOUT</constant>, … events, or negative on error.
</para>
<para><function>sd_bus_get_timeout()</function> returns the time-out in µs to pass to to
<function>poll()</function> or a similar call when waiting for events on the specified bus connection. The returned
time-out may be zero, in which case a subsequent I/O polling call should be invoked in non-blocking mode. The
returned timeout may be <constant>UINT64_MAX</constant> in which case the I/O polling call may block indefinitely,
without any applied time-out. Note that the returned time-out should be considered only a maximum sleeping time. It
is permissible (and even expected) that shorter time-outs are used by the calling program, in case other event
sources are polled in the same event loop. Note that the returned time-value is relative and specified in
microseconds. When converting this value in order to pass it as third argument to <function>poll()</function>
(which expects milliseconds), care should be taken to use a division that rounds up to ensure the I/O polling
operation doesn't sleep for shorter than necessary, which might result in unintended busy looping (alternatively,
use <citerefentry project='man-pages'><refentrytitle>ppoll</refentrytitle><manvolnum>3</manvolnum></citerefentry>
instead of plain <function>poll()</function>, which understands time-outs with nano-second granularity).</para>
<function>poll()</function> or a similar call when waiting for events on the specified bus
connection. The returned time-out may be zero, in which case a subsequent I/O polling call
should be invoked in non-blocking mode. The returned timeout may be
<constant>UINT64_MAX</constant> in which case the I/O polling call may block indefinitely,
without any applied time-out. Note that the returned time-out should be considered only a
maximum sleeping time. It is permissible (and even expected) that shorter time-outs are used by
the calling program, in case other event sources are polled in the same event loop. Note that
the returned time-value is relative and specified in microseconds. When converting this value in
order to pass it as third argument to <function>poll()</function> (which expects milliseconds),
care should be taken to use a division that rounds up to ensure the I/O polling operation
doesn't sleep for shorter than necessary, which might result in unintended busy looping
(alternatively, use
<citerefentry project='man-pages'><refentrytitle>ppoll</refentrytitle><manvolnum>3</manvolnum></citerefentry>
instead of plain <function>poll()</function>, which understands time-outs with nano-second
granularity).</para>
<para>These three functions are useful to hook up a bus connection object with an external or manual event loop
involving <function>poll()</function> or a similar I/O polling call. Before each invocation of the I/O polling
call, all three functions should be invoked: the file descriptor returned by <function>sd_bus_get_fd()</function>
should be polled for the events indicated by <function>sd_bus_get_events()</function>, and the I/O call should
block for that up to the time-out returned by <function>sd_bus_get_timeout()</function>. After each I/O polling
<para>These three functions are useful to hook up a bus connection object with an external or
manual event loop involving <function>poll()</function> or a similar I/O polling call. Before
each invocation of the I/O polling call, all three functions should be invoked: the file
descriptor returned by <function>sd_bus_get_fd()</function> should be polled for the events
indicated by <function>sd_bus_get_events()</function>, and the I/O call should block for that up
to the time-out returned by <function>sd_bus_get_timeout()</function>. After each I/O polling
call the bus connection needs to process incoming or outgoing data, by invoking
<citerefentry><refentrytitle>sd_bus_process</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
<citerefentry><refentrytitle>sd_bus_process</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
<para>Note that these function are only one of three supported ways to implement I/O event handling for bus
connections. Alternatively use
<citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry> to attach a
bus connection to an <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
event loop. Or use <citerefentry><refentrytitle>sd_bus_wait</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<para>Note that these functions are only one of three supported ways to implement I/O event
handling for bus connections. Alternatively use
<citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
to attach a bus connection to an
<citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
event loop. Or use
<citerefentry><refentrytitle>sd_bus_wait</refentrytitle><manvolnum>3</manvolnum></citerefentry>
as a simple synchronous, blocking I/O waiting call.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, <function>sd_bus_get_fd()</function> returns the file descriptor used for communication. On failure,
it returns a negative errno-style error code.</para>
<para>On success, <function>sd_bus_get_fd()</function> returns the file descriptor used for
communication. On failure, it returns a negative errno-style error code.</para>
<para>On success, <function>sd_bus_set_fd()</function> returns a non-negative integer. On failure, it returns a
negative errno-style error code.</para>
<para>On success, <function>sd_bus_set_fd()</function> returns a non-negative integer. On
failure, it returns a negative errno-style error code.</para>
<para>On success, <function>sd_bus_get_events()</function> returns the I/O event mask to use for I/O event watching.
On failure, it returns a negative errno-style error code.</para>
<para>On success, <function>sd_bus_get_events()</function> returns the I/O event mask to use for
I/O event watching. On failure, it returns a negative errno-style error code.</para>
<para>On success, <function>sd_bus_get_timeout()</function> returns a non-negative integer. On failure, it returns a
negative errno-style error code.</para>
<para>On success, <function>sd_bus_get_timeout()</function> returns a non-negative integer. On
failure, it returns a negative errno-style error code.</para>
<refsect2>
<title>Errors</title>
@ -136,8 +146,8 @@
<varlistentry>
<term><constant>-ECHILD</constant></term>
<listitem><para>The bus connection was allocated in a parent process and is being reused in a child
process after <function>fork()</function>.</para></listitem>
<listitem><para>The bus connection was allocated in a parent process and is being reused
in a child process after <function>fork()</function>.</para></listitem>
</varlistentry>
<varlistentry>
@ -157,8 +167,8 @@
<varlistentry>
<term><constant>-EBADF</constant></term>
<listitem><para>An invalid file descriptor was passed to <function>sd_bus_set_fd()</function>.
</para></listitem>
<listitem><para>An invalid file descriptor was passed to
<function>sd_bus_set_fd()</function>.</para></listitem>
</varlistentry>
<varlistentry>

View File

@ -20,7 +20,8 @@
<refname>sd_bus_set_close_on_exit</refname>
<refname>sd_bus_get_close_on_exit</refname>
<refpurpose>Control whether to close the bus connection during the event loop exit phase</refpurpose>
<refpurpose>Control whether to close the bus connection during the event loop exit phase
</refpurpose>
</refnamediv>
<refsynopsisdiv>
@ -44,30 +45,35 @@
<refsect1>
<title>Description</title>
<para><function>sd_bus_set_close_on_exit()</function> may be used to enable or disable whether the bus connection
is automatically flushed (as in
<citerefentry><refentrytitle>sd_bus_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>) and closed (as in
<citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>) during the exit
phase of the event loop. This logic only applies to bus connections that are attached to an
<citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry> event loop, see
<citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>. By default
this mechanism is enabled and makes sure that any pending messages that have not been written to the bus connection
are written out when the event loop is shutting down. In some cases this behaviour is not desirable, for example
when the bus connection shall remain usable until after the event loop exited. If <parameter>b</parameter> is
true, the feature is enabled (which is the default), otherwise disabled.</para>
<para><function>sd_bus_set_close_on_exit()</function> may be used to enable or disable whether
the bus connection is automatically flushed (as in
<citerefentry><refentrytitle>sd_bus_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
and closed (as in
<citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
during the exit phase of the event loop. This logic only applies to bus connections that are
attached to an
<citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
event loop, see
<citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
By default this mechanism is enabled and makes sure that any pending messages that have not been
written to the bus connection are written out when the event loop is shutting down. In some
cases this behaviour is not desirable, for example when the bus connection shall remain usable
until after the event loop exited. If <parameter>b</parameter> is true, the feature is enabled
(which is the default), otherwise disabled.</para>
<para><function>sd_bus_get_close_on_exit()</function> may be used to query the current setting of this feature. It
returns zero when the feature is disabled, and positive if enabled.</para>
<para><function>sd_bus_get_close_on_exit()</function> may be used to query the current setting
of this feature. It returns zero when the feature is disabled, and positive if enabled.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, <function>sd_bus_set_close_on_exit()</function> returns 0 or a positive integer. On failure, it returns a negative errno-style
error code.</para>
<para>On success, <function>sd_bus_set_close_on_exit()</function> returns a non-negative
integer. On failure, it returns a negative errno-style error code.</para>
<para><function>sd_bus_get_close_on_exit()</function> returns 0 if the feature is currently turned off or a
positive integer if it is on. On failure, it returns a negative errno-style error code.</para>
<para><function>sd_bus_get_close_on_exit()</function> returns 0 if the feature is currently
disabled or a positive integer if it is enabled. On failure, it returns a negative errno-style
error code.</para>
<refsect2>
<title>Errors</title>
@ -78,7 +84,8 @@
<varlistentry>
<term><constant>-ECHILD</constant></term>
<listitem><para>The bus connection has been created in a different process.</para></listitem>
<listitem><para>The bus connection was created in a different process.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
@ -98,5 +105,4 @@
<citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

View File

@ -24,6 +24,9 @@
<refname>sd_bus_is_trusted</refname>
<refname>sd_bus_set_allow_interactive_authorization</refname>
<refname>sd_bus_get_allow_interactive_authorization</refname>
<refname>sd_bus_get_scope</refname>
<refname>sd_bus_get_tid</refname>
<refname>sd_bus_get_unique_name</refname>
<refpurpose>Set or query properties of a bus object</refpurpose>
</refnamediv>
@ -76,59 +79,94 @@
<funcdef>int <function>sd_bus_get_allow_interactive_authorization</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_get_scope</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>const char **<parameter>scope</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_get_tid</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>pid_t *<parameter>tid</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_get_unique_name</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>const char **<parameter>unique</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_bus_set_description()</function> sets the description string
that is used in logging to the specified string. The string is copied internally
and freed when the bus object is deallocated. The
<parameter>description</parameter> argument may be <constant>NULL</constant>, in
which case the description is unset. This function must be called before the bus
is started.</para>
<para><function>sd_bus_set_description()</function> sets the description string that is used in
logging to the specified string. The string is copied internally and freed when the bus object
is deallocated. The <parameter>description</parameter> argument may be
<constant>NULL</constant>, in which case the description is unset. This function must be called
before the bus is started.</para>
<para><function>sd_bus_get_description()</function> returns a description string
in <parameter>description</parameter>. This string may have been previously set
with <function>sd_bus_set_description()</function> or
<para><function>sd_bus_get_description()</function> returns a description string in
<parameter>description</parameter>. This string may have been previously set with
<function>sd_bus_set_description()</function> or
<citerefentry><refentrytitle>sd_bus_open_with_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>
or similar. If not set this way, a default string like <literal>system</literal>
or <literal>user</literal> will be returned for the system or user buses,
and <constant>NULL</constant> otherwise.</para>
or similar. If not set this way, a default string like <literal>system</literal> or
<literal>user</literal> will be returned for the system or user buses, and
<constant>NULL</constant> otherwise.</para>
<para><function>sd_bus_set_anonymous()</function> enables or disables "anonymous
authentication", i.e. lack of authentication, of the bus peer. This function must
be called before the bus is started. See the <ulink
url="view-source:https://dbus.freedesktop.org/doc/dbus-specification.html#auth-mechanisms">Authentication
Mechanisms</ulink> section of the D-Bus specification for details.</para>
<para><function>sd_bus_set_anonymous()</function> enables or disables "anonymous authentication",
i.e. lack of authentication, of the bus peer. This function must be called before the bus is
started. See the
<ulink url="view-source:https://dbus.freedesktop.org/doc/dbus-specification.html#auth-mechanisms">
Authentication Mechanisms</ulink> section of the D-Bus specification for details.</para>
<para><function>sd_bus_is_anonymous()</function> returns true if the bus connection allows anonymous
authentication (in the sense described in previous paragraph).</para>
<para><function>sd_bus_is_anonymous()</function> returns true if the bus connection allows
anonymous authentication (in the sense described in previous paragraph).</para>
<para><function>sd_bus_set_trusted()</function> sets the "trusted" state on the
<parameter>bus</parameter> object. If true, all connections on the bus are
trusted and access to all privileged and unprivileged methods is granted. This
function must be called before the bus is started.</para>
<parameter>bus</parameter> object. If true, all connections on the bus are trusted and access to
all privileged and unprivileged methods is granted. This function must be called before the bus
is started.</para>
<para><function>sd_bus_is_trusted()</function> returns true if the bus connection is trusted (in the
sense described in previous paragraph).</para>
<para><function>sd_bus_is_trusted()</function> returns true if the bus connection is trusted (in
the sense described in previous paragraph).</para>
<para><function>sd_bus_set_allow_interactive_authorization()</function>
enables or disables interactive authorization for method calls. If true,
messages are marked with the
<para><function>sd_bus_set_allow_interactive_authorization()</function> enables or disables
interactive authorization for method calls. If true, messages are marked with the
<constant>ALLOW_INTERACTIVE_AUTHORIZATION</constant> flag specified by the
<ulink
url="view-source:https://dbus.freedesktop.org/doc/dbus-specification.html">D-Bus</ulink>
specification, informing the receiving side that the caller is prepared to
wait for interactive authorization, which might take a considerable time to
complete. If this flag is set, the user may be queried for passwords or
confirmation via <ulink
url="http://www.freedesktop.org/wiki/Software/polkit">polkit</ulink> or a
similar framework.</para>
<ulink url="view-source:https://dbus.freedesktop.org/doc/dbus-specification.html">D-Bus</ulink>
specification, informing the receiving side that the caller is prepared to wait for interactive
authorization, which might take a considerable time to complete. If this flag is set, the user
may be queried for passwords or confirmation via
<ulink url="http://www.freedesktop.org/wiki/Software/polkit">polkit</ulink> or a similar
framework.</para>
<para><function>sd_bus_get_allow_interactive_authorization()</function> returns
true if interactive authorization is allowed and false if not.</para>
<para><function>sd_bus_get_allow_interactive_authorization()</function> returns true if
interactive authorization is allowed and false if not.</para>
<para><function>sd_bus_get_scope()</function> stores the scope of the given bus object in
<parameter>scope</parameter>. The scope of the system bus is <literal>system</literal>. The
scope of a user session bus is <literal>user</literal>. If the given bus object is not the
system or a user session bus, <function>sd_bus_get_scope()</function> returns an error.</para>
<para><function>sd_bus_get_tid()</function> stores the kernel thread id of the thread associated
with the given bus object in <parameter>tid</parameter>. If <parameter>bus</parameter> is a
default bus object obtained by calling one of the functions of the
<citerefentry><refentrytitle>sd_bus_default</refentrytitle><manvolnum>3</manvolnum></citerefentry>
family of functions, it stores the thread id of the thread the bus object was created in.
Otherwise, if the bus object is attached to an event loop, it stores the thread id of the
thread the event loop object was created in. If <parameter>bus</parameter> is not a default bus
object and is not attached to an event loop, <function>sd_bus_get_tid()</function> returns an
error.</para>
<para><function>sd_bus_get_unique_name()</function> stores the unique name of the bus object on
the bus in <parameter>unique</parameter>. See
<ulink url="https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus">
The D-Bus specification</ulink> for more information on bus names. Note that the caller does not
own the string stored in <parameter>unique</parameter> and should not free it.</para>
</refsect1>
<refsect1>
@ -172,8 +210,21 @@
<listitem><para>Memory allocation failed.</para></listitem>
</varlistentry>
</variablelist>
<varlistentry>
<term><constant>-ENODATA</constant></term>
<listitem><para>The bus object passed to <function>sd_bus_get_scope()</function> was not a
system or user session bus.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>-ENXIO</constant></term>
<listitem><para>The bus object passed to <function>sd_bus_get_tid()</function> was not a
default bus object and is not attached to an event loop.</para></listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>

View File

@ -0,0 +1,114 @@
<?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_set_exit_on_disconnect"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>sd_bus_set_exit_on_disconnect</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>sd_bus_set_exit_on_disconnect</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>sd_bus_set_exit_on_disconnect</refname>
<refname>sd_bus_get_exit_on_disconnect</refname>
<refpurpose>Control the exit behavior when the bus object disconnects</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>sd_bus_set_exit_on_disconnect</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
<paramdef>int <parameter>b</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_bus_get_exit_on_disconnect</function></funcdef>
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_bus_set_exit_on_disconnect()</function> may be used to configure the exit
behavior when the given bus object disconnects. If <parameter>b</parameter> is zero, no special
logic is executed when the bus object disconnects. If <parameter>b</parameter> is non-zero, the
behavior on disconnect depends on whether the bus object is attached to an event loop or not. If
the bus object is attached to an event loop (see
<citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>),
the event loop is closed when the bus object disconnects (as if calling
<citerefentry><refentrytitle>sd_event_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>).
Otherwise,
<citerefentry project='man-pages'><refentrytitle>exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
is called. The exit code passed to <function>sd_event_exit()</function> and
<function>exit()</function> is <constant>EXIT_FAILURE</constant>. If the bus object has already
disconnected when enabling the exit behavior, the exit behavior is executed immediately. By
default, the exit behavior is disabled.</para>
<para><function>sd_bus_get_exit_on_disconnect()</function> returns whether the exit on
disconnect behavior is enabled for the given bus object.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, <function>sd_bus_set_exit_on_disconnect()</function> returns a non-negative
integer. On failure, it returns a negative errno-style error code.</para>
<para><function>sd_bus_get_exit_on_disconnect()</function> returns a positive integer if the
exit on disconnect behavior is enabled. Otherwise, it returns zero.</para>
<refsect2>
<title>Errors</title>
<para>Returned errors may indicate the following problems:</para>
<variablelist>
<varlistentry>
<term><constant>-EINVAL</constant></term>
<listitem><para>A required parameter was <constant>NULL</constant>.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>-ENOPKG</constant></term>
<listitem><para>The bus object could not be resolved.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>-ECHILD</constant></term>
<listitem><para>The bus connection was created in a different process.</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_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_event_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

View File

@ -110,7 +110,8 @@
a non-negative integer. On failure, they return a negative errno-style error code.</para>
<para><function>sd_bus_is_server()</function> and <function>sd_bus_is_bus_client()</function>
return 1 when the server or client mode is enabled, respectively. Otherwise, they return 0.
return a positive integer when the server or client mode is enabled, respectively. Otherwise,
they return zero.
</para>
<refsect2>

157
man/sd_hwdb_get.xml Normal file
View File

@ -0,0 +1,157 @@
<?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_hwdb_get" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>sd_hwdb_get</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>sd_hwdb_get</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>sd_hwdb_get</refname>
<refname>sd_hwdb_seek</refname>
<refname>sd_hwdb_enumerate</refname>
<refname>SD_HWDB_FOREACH_PROPERTY</refname>
<refpurpose>Seek to a location in hwdb or access entries</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include &lt;systemd/sd-hwdb.h&gt;</funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>sd_hwdb_get</function></funcdef>
<paramdef>sd_hwdb *<parameter>hwdb</parameter></paramdef>
<paramdef>const char *<parameter>modalias</parameter></paramdef>
<paramdef>const char *<parameter>key</parameter></paramdef>
<paramdef>const char **<parameter>value</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_hwdb_seek</function></funcdef>
<paramdef>sd_hwdb *<parameter>hwdb</parameter></paramdef>
<paramdef>const char *<parameter>modalias</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_hwdb_enumerate</function></funcdef>
<paramdef>sd_hwdb *<parameter>hwdb</parameter></paramdef>
<paramdef>const char **<parameter>key</parameter></paramdef>
<paramdef>const char **<parameter>value</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef><function>SD_HWDB_FOREACH_PROPERTY</function></funcdef>
<paramdef>hwdb</paramdef>
<paramdef>modalias</paramdef>
<paramdef>key</paramdef>
<paramdef>value</paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_hwdb_get()</function> queries the <parameter>hwdb</parameter> object created earlier
with <citerefentry><refentrytitle>sd_hwdb_new</refentrytitle><manvolnum>3</manvolnum></citerefentry> for
entries matching the specified string <parameter>modalias</parameter>, and returns the value
corresponding to the the key <parameter>key</parameter>. The value is returned as a
<constant>NUL</constant>-terminated string in <parameter>value</parameter>. It must not be modified by
the caller and is valid as long as a reference to <parameter>hwdb</parameter> is kept. When multiple
patterns in the database match <parameter>modalias</parameter>, the one with the highest priority is
used. See <citerefentry><refentrytitle>hwdb</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
details.</para>
<para><function>sd_hwdb_seek()</function> selects entries matching the specified string
<parameter>modalias</parameter>. Subsequent queries with <function>sd_hwdb_enumerate()</function> will
access the key-value pairs for that string.</para>
<para><function>sd_hwdb_enumerate()</function> returns (in turn) all the key-value pairs defined for the
string used with <function>sd_hwdb_seek()</function>. Each pair is returned as
<constant>NUL</constant>-terminated strings in <parameter>key</parameter> and
<parameter>value</parameter>. The strings must not be modified by the caller and are valid as long as a
reference to <parameter>hwdb</parameter> is kept. When multiple patterns in the database match
<parameter>modalias</parameter>, the combination of all matching key-value pairs is used. See
<citerefentry><refentrytitle>hwdb</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
details.</para>
<para>The <function>SD_HWDB_FOREACH_PROPERTY</function> macro combines
<function>sd_hwdb_seek()</function> and <function>sd_hwdb_enumerate()</function>. No error handling is
performed and interation simply stops on error. See the example below.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, <function>sd_hwdb_get()</function> and <function>sd_hwdb_seek()</function> return a
non-negative integer. On failure, they return a negative errno-style error code.</para>
<para><function>sd_hwdb_enumerate()</function> returns a positive integer if another key-value pair was found or zero if
all entries have already been enumerated. 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>A parameter is <constant>NULL</constant>.</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>-ENOENT</constant></term>
<listitem><para>An entry for the specified <parameter>modalias</parameter> was not found.
</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>-EAGAIN</constant></term>
<listitem><para><function>sd_hwdb_seek()</function> was not called before
<function>sd_hwdb_enumerate()</function>.</para></listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
<xi:include href="libsystemd-pkgconfig.xml" />
<refsect1>
<title>Examples</title>
<example>
<title>Look up hwdb entries for a USB device</title>
<programlisting><xi:include href="hwdb-usb-device.c" parse="text" /></programlisting>
<para>The effect is similar to calling <command>systemd-hwdb query usb:v046DpC534</command>.
</para>
</example>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-udev.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-hwdb</refentrytitle><manvolnum>8</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

121
man/sd_hwdb_new.xml Normal file
View File

@ -0,0 +1,121 @@
<?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_hwdb_new" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>sd_hwdb_new</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>sd_hwdb_new</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>sd_hwdb_new</refname>
<refname>sd_hwdb_ref</refname>
<refname>sd_hwdb_unref</refname>
<refpurpose>Create a new hwdb object and create or destroy references to it</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include &lt;systemd/sd-hwdb.h&gt;</funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>sd_hwdb_new</function></funcdef>
<paramdef>sd_hwdb **<parameter>hwdb</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>sd_hwdb* <function>sd_hwdb_ref</function></funcdef>
<paramdef>sd_hwdb *<parameter>hwdb</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>sd_hwdb* <function>sd_hwdb_unref</function></funcdef>
<paramdef>sd_hwdb *<parameter>hwdb</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_hwdb_new()</function> creates a new hwdb object to access the binary hwdb
database. Upon initialization, the file containing the binary representation of the hardware database is
located and opened. The new object is returned in <parameter>hwdb</parameter>.</para>
<para>The <parameter>hwdb</parameter> object is reference counted. <function>sd_hwdb_ref()</function> and
<function>sd_hwdb_unref()</function> may be used to get a new reference or destroy an existing reference
to an object. The caller must dispose of the reference acquired with <function>sd_hwdb_new()</function>
by calling <function>sd_hwdb_unref()</function> when done with the object.</para>
<para>Use
<citerefentry><refentrytitle>sd_hwdb_seek</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_hwdb_get</refentrytitle><manvolnum>3</manvolnum></citerefentry>, and
<citerefentry><refentrytitle>sd_hwdb_enumerate</refentrytitle><manvolnum>3</manvolnum></citerefentry> to
access entries.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, <function>sd_hwdb_new()</function> returns a non-negative integer. On
failure, it returns a negative errno-style error code.</para>
<para><function>sd_hwdb_ref()</function> always returns the argument.
</para>
<para><function>sd_hwdb_unref()</function> always returns <constant>NULL</constant>.
</para>
<refsect2>
<title>Errors</title>
<para>Returned errors may indicate the following problems:</para>
<variablelist>
<varlistentry>
<term><constant>-ENOENT</constant></term>
<listitem><para>The binary hardware database file could not be located. See
<citerefentry><refentrytitle>systemd-hwdb</refentrytitle><manvolnum>8</manvolnum></citerefentry>
for more information.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>-EINVAL</constant></term>
<listitem><para>The located binary hardware database file is in an incompatible format.
</para></listitem>
</varlistentry>
<varlistentry>
<term><constant>-ENOMEM</constant></term>
<listitem><para>Memory allocation failed.</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>systemd-udev.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

View File

@ -22,6 +22,7 @@
<refname>sd_journal_open_directory_fd</refname>
<refname>sd_journal_open_files</refname>
<refname>sd_journal_open_files_fd</refname>
<refname>sd_journal_open_namespace</refname>
<refname>sd_journal_close</refname>
<refname>sd_journal</refname>
<refname>SD_JOURNAL_LOCAL_ONLY</refname>

View File

@ -22,6 +22,12 @@
<refname>sd_journal_sendv</refname>
<refname>sd_journal_perror</refname>
<refname>SD_JOURNAL_SUPPRESS_LOCATION</refname>
<refname>sd_journal_print_with_location</refname>
<refname>sd_journal_printv_with_location</refname>
<refname>sd_journal_send_with_location</refname>
<refname>sd_journal_sendv_with_location</refname>
<refname>sd_journal_perror_with_location</refname>
<refpurpose>Submit log entries to the journal</refpurpose>
</refnamediv>
@ -60,6 +66,51 @@
<paramdef>const char *<parameter>message</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_journal_print_with_location</function></funcdef>
<paramdef>const char *<parameter>file</parameter></paramdef>
<paramdef>const char *<parameter>line</parameter></paramdef>
<paramdef>const char *<parameter>func</parameter></paramdef>
<paramdef>int <parameter>priority</parameter></paramdef>
<paramdef>const char *<parameter>format</parameter></paramdef>
<paramdef></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_journal_printv_with_location</function></funcdef>
<paramdef>int <parameter>priority</parameter></paramdef>
<paramdef>const char *<parameter>file</parameter></paramdef>
<paramdef>const char *<parameter>line</parameter></paramdef>
<paramdef>const char *<parameter>func</parameter></paramdef>
<paramdef>const char *<parameter>format</parameter></paramdef>
<paramdef>va_list <parameter>ap</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_journal_send_with_location</function></funcdef>
<paramdef>const char *<parameter>file</parameter></paramdef>
<paramdef>const char *<parameter>line</parameter></paramdef>
<paramdef>const char *<parameter>func</parameter></paramdef>
<paramdef>const char *<parameter>format</parameter></paramdef>
<paramdef></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_journal_sendv_with_location</function></funcdef>
<paramdef>const char *<parameter>file</parameter></paramdef>
<paramdef>const char *<parameter>line</parameter></paramdef>
<paramdef>const char *<parameter>func</parameter></paramdef>
<paramdef>const struct iovec *<parameter>iov</parameter></paramdef>
<paramdef>int <parameter>n</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>sd_journal_perror_with_location</function></funcdef>
<paramdef>const char *<parameter>file</parameter></paramdef>
<paramdef>const char *<parameter>line</parameter></paramdef>
<paramdef>const char *<parameter>func</parameter></paramdef>
<paramdef>const char *<parameter>message</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
@ -136,11 +187,20 @@ sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(
"PRIORITY=%i", LOG_INFO,
NULL);</programlisting>
<para>Note that these calls implicitly add fields for the source
file, function name and code line where invoked. This is
implemented with macros. If this is not desired, it can be turned
off by defining SD_JOURNAL_SUPPRESS_LOCATION before including
<filename>sd-journal.h</filename>.</para>
<para>Note that these calls implicitly add fields for the source file, function name and code line where
invoked. This is implemented with macros. If this is not desired, it can be turned off by defining
<constant>SD_JOURNAL_SUPPRESS_LOCATION</constant> before including <filename>sd-journal.h</filename>.
</para>
<para><function>sd_journal_print_with_location</function>,
<function>sd_journal_printv_with_location</function>, <function>sd_journal_send_with_location</function>,
<function>sd_journal_sendv_with_location</function>, and
<function>sd_journal_perror_with_location</function> are similar to their counterparts without
<literal>_with_location</literal>, but accept additional parameters to explicitly set the source file
name, function, and line. Those arguments must contain valid journal entries including the variable name,
e.g. <literal>CODE_FILE=src/foo.c</literal>, <literal>CODE_LINE=666</literal>,
<literal>CODE_FUNC=myfunc</literal>. These variants are primarily useful when writing custom wrappers,
for example in bindings for a different language.</para>
<para><citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
and <function>sd_journal_print()</function> may
@ -163,9 +223,9 @@ sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(
<refsect1>
<title>Return Value</title>
<para>The five calls return 0 on success or a negative errno-style error code. The <citerefentry
project='man-pages'><refentrytitle>errno</refentrytitle><manvolnum>3</manvolnum></citerefentry> variable itself is
not altered.</para>
<para>The ten functions return 0 on success or a negative errno-style error code. The
<citerefentry project='man-pages'><refentrytitle>errno</refentrytitle><manvolnum>3</manvolnum></citerefentry>
variable itself is not altered.</para>
<para>If
<citerefentry><refentrytitle>systemd-journald</refentrytitle><manvolnum>8</manvolnum></citerefentry>
@ -178,15 +238,17 @@ sd_journal_send("MESSAGE=Hello World, this is PID %lu!", (unsigned long) getpid(
<xi:include href="threads-aware.xml" xpointer="safe"/>
<para><function>sd_journal_sendv()</function> is "async signal safe" in the meaning of <citerefentry
project='man-pages'><refentrytitle>signal-safety</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
<para><function>sd_journal_sendv()</function> and <function>sd_journal_sendv_with_location()</function>
are "async signal safe" in the meaning of
<citerefentry project='man-pages'><refentrytitle>signal-safety</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
</para>
<para><function>sd_journal_print</function>,
<function>sd_journal_printv</function>,
<function>sd_journal_send</function>, and
<function>sd_journal_perror</function> are
not async signal safe.</para>
<function>sd_journal_send</function>,
<function>sd_journal_perror</function>,
and their counterparts with <literal>_with_location</literal>
are not async signal safe.</para>
</refsect1>
<xi:include href="libsystemd-pkgconfig.xml" />

View File

@ -1067,7 +1067,7 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
</listitem>
</varlistentry>
<varlistentry>
<varlistentry id='log-level'>
<term><command>log-level</command> [<replaceable>LEVEL</replaceable>]</term>
<listitem><para>If no argument is given, print the current log level of the manager. If an

View File

@ -176,8 +176,8 @@
</varlistentry>
</variablelist>
<para>The following keys may be used during bootup or in the boot menu to
directly boot a specific entry:</para>
<para>The following keys may be pressed during bootup or in the boot menu to directly boot a specific
entry:</para>
<variablelist>
<varlistentry>
@ -214,6 +214,17 @@
</varlistentry>
</variablelist>
<para>The boot menu is shown when a non-zero menu timeout has been configured. If the menu timeout has
been set to zero, it is sufficient to press any key — before the boot loader initializes — to bring up
the boot menu, except for the keys listed immediately above as they directly boot into the selected boot
menu item. Note that depending on the firmware implementation the time window where key presses are
accepted before the boot loader initializes might be short. If the window is missed, reboot and try
again, possibly pressing a suitable key (e.g. the space bar) continuously; on most systems it should be
possible to hit the time window after a few attempts. To avoid this problem, consider setting a non-zero
timeout, thus showing the boot menu unconditionally. Some desktop environments might offer an option to
directly boot into the boot menu, to avoid the problem altogether. Alternatively, use the command line
<command>systemctl reboot --boot-loader-menu=0</command> from the shell.</para>
<para>In the editor, most keys simply insert themselves, but the following keys
may be used to perform additional actions:</para>

View File

@ -96,59 +96,70 @@ int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu) {
return 0;
}
int sd_dhcp_lease_get_servers(
sd_dhcp_lease *lease,
sd_dhcp_lease_info what,
const struct in_addr **addr) {
assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL);
switch (what) {
case SD_DHCP_LEASE_DNS_SERVERS:
if (lease->dns_size <= 0)
return -ENODATA;
*addr = lease->dns;
return (int) lease->dns_size;
case SD_DHCP_LEASE_NTP_SERVERS:
if (lease->ntp_size <= 0)
return -ENODATA;
*addr = lease->ntp;
return (int) lease->ntp_size;
case SD_DHCP_LEASE_SIP_SERVERS:
if (lease->sip_size <= 0)
return -ENODATA;
*addr = lease->sip;
return (int) lease->sip_size;
case SD_DHCP_LEASE_POP3_SERVERS:
if (lease->pop3_server_size <= 0)
return -ENODATA;
*addr = lease->pop3_server;
return (int) lease->pop3_server_size;
case SD_DHCP_LEASE_SMTP_SERVERS:
if (lease->smtp_server_size <= 0)
return -ENODATA;
*addr = lease->smtp_server;
return (int) lease->smtp_server_size;
default:
log_debug("Uknown DHCP lease info item %d.", what);
return -ENXIO;
}
}
int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr) {
assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL);
if (lease->dns_size <= 0)
return -ENODATA;
*addr = lease->dns;
return (int) lease->dns_size;
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_DNS_SERVERS, addr);
}
int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr) {
assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL);
if (lease->ntp_size <= 0)
return -ENODATA;
*addr = lease->ntp;
return (int) lease->ntp_size;
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_NTP_SERVERS, addr);
}
int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr) {
assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL);
if (lease->sip_size <= 0)
return -ENODATA;
*addr = lease->sip;
return (int) lease->sip_size;
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_SIP_SERVERS, addr);
}
int sd_dhcp_lease_get_pop3_server(sd_dhcp_lease *lease, const struct in_addr **addr) {
assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL);
if (lease->pop3_server_size <= 0)
return -ENODATA;
*addr = lease->pop3_server;
return (int) lease->pop3_server_size;
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_POP3_SERVERS, addr);
}
int sd_dhcp_lease_get_smtp_server(sd_dhcp_lease *lease, const struct in_addr **addr) {
assert_return(lease, -EINVAL);
assert_return(addr, -EINVAL);
if (lease->smtp_server_size <= 0)
return -ENODATA;
*addr = lease->smtp_server;
return (int) lease->smtp_server_size;
return sd_dhcp_lease_get_servers(lease, SD_DHCP_LEASE_SMTP_SERVERS, addr);
}
int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname) {

View File

@ -1123,132 +1123,81 @@ int sd_dhcp_server_set_default_lease_time(sd_dhcp_server *server, uint32_t t) {
return 1;
}
int sd_dhcp_server_set_servers(
sd_dhcp_server *server,
sd_dhcp_lease_info what,
const struct in_addr addresses[],
unsigned n_addresses) {
assert_return(server, -EINVAL);
assert_return(addresses || n_addresses == 0, -EINVAL);
struct in_addr **a;
unsigned *n_a;
switch (what) {
case SD_DHCP_LEASE_DNS_SERVERS:
a = &server->dns;
n_a = &server->n_dns;
break;
case SD_DHCP_LEASE_NTP_SERVERS:
a = &server->ntp;
n_a = &server->n_ntp;
break;
case SD_DHCP_LEASE_SIP_SERVERS:
a = &server->sip;
n_a = &server->n_sip;
break;
case SD_DHCP_LEASE_POP3_SERVERS:
a = &server->pop3_server;
n_a = &server->n_pop3_server;
break;
case SD_DHCP_LEASE_SMTP_SERVERS:
a = &server->smtp_server;
n_a = &server->n_smtp_server;
break;
default:
log_debug("Uknown DHCP lease info item %d.", what);
return -ENXIO;
}
if (*n_a == n_addresses &&
memcmp(*a, addresses, sizeof(struct in_addr) * n_addresses) == 0)
return 0;
struct in_addr *c = NULL;
if (n_addresses > 0) {
c = newdup(struct in_addr, addresses, n_addresses);
if (!c)
return -ENOMEM;
}
free(*a);
*a = c;
*n_a = n_addresses;
return 1;
}
int sd_dhcp_server_set_dns(sd_dhcp_server *server, const struct in_addr dns[], unsigned n) {
assert_return(server, -EINVAL);
assert_return(dns || n <= 0, -EINVAL);
if (server->n_dns == n &&
memcmp(server->dns, dns, sizeof(struct in_addr) * n) == 0)
return 0;
if (n <= 0) {
server->dns = mfree(server->dns);
server->n_dns = 0;
} else {
struct in_addr *c;
c = newdup(struct in_addr, dns, n);
if (!c)
return -ENOMEM;
free(server->dns);
server->dns = c;
server->n_dns = n;
}
return 1;
return sd_dhcp_server_set_servers(server, SD_DHCP_LEASE_DNS_SERVERS, dns, n);
}
int sd_dhcp_server_set_ntp(sd_dhcp_server *server, const struct in_addr ntp[], unsigned n) {
assert_return(server, -EINVAL);
assert_return(ntp || n <= 0, -EINVAL);
if (server->n_ntp == n &&
memcmp(server->ntp, ntp, sizeof(struct in_addr) * n) == 0)
return 0;
if (n <= 0) {
server->ntp = mfree(server->ntp);
server->n_ntp = 0;
} else {
struct in_addr *c;
c = newdup(struct in_addr, ntp, n);
if (!c)
return -ENOMEM;
free(server->ntp);
server->ntp = c;
server->n_ntp = n;
}
return 1;
return sd_dhcp_server_set_servers(server, SD_DHCP_LEASE_NTP_SERVERS, ntp, n);
}
int sd_dhcp_server_set_sip(sd_dhcp_server *server, const struct in_addr sip[], unsigned n) {
assert_return(server, -EINVAL);
assert_return(sip || n <= 0, -EINVAL);
if (server->n_sip == n &&
memcmp(server->sip, sip, sizeof(struct in_addr) * n) == 0)
return 0;
if (n <= 0) {
server->sip = mfree(server->sip);
server->n_sip = 0;
} else {
struct in_addr *c;
c = newdup(struct in_addr, sip, n);
if (!c)
return -ENOMEM;
free(server->sip);
server->sip = c;
server->n_sip = n;
}
return 1;
return sd_dhcp_server_set_servers(server, SD_DHCP_LEASE_SIP_SERVERS, sip, n);
}
int sd_dhcp_server_set_pop3_server(sd_dhcp_server *server, const struct in_addr pop3_server[], unsigned n) {
assert_return(server, -EINVAL);
assert_return(pop3_server || n <= 0, -EINVAL);
if (server->n_pop3_server == n &&
memcmp(server->pop3_server, pop3_server, sizeof(struct in_addr) * n) == 0)
return 0;
if (n <= 0) {
server->pop3_server = mfree(server->pop3_server);
server->n_pop3_server = 0;
} else {
struct in_addr *c;
c = newdup(struct in_addr, pop3_server, n);
if (!c)
return -ENOMEM;
free_and_replace(server->pop3_server, c);
server->n_pop3_server = n;
}
return 1;
int sd_dhcp_server_set_pop3_server(sd_dhcp_server *server, const struct in_addr pop3[], unsigned n) {
return sd_dhcp_server_set_servers(server, SD_DHCP_LEASE_POP3_SERVERS, pop3, n);
}
int sd_dhcp_server_set_smtp_server(sd_dhcp_server *server, const struct in_addr smtp_server[], unsigned n) {
assert_return(server, -EINVAL);
assert_return(smtp_server || n <= 0, -EINVAL);
if (server->n_smtp_server == n &&
memcmp(server->smtp_server, smtp_server, sizeof(struct in_addr) * n) == 0)
return 0;
if (n <= 0) {
server->smtp_server = mfree(server->smtp_server);
server->n_smtp_server = 0;
} else {
struct in_addr *c;
c = newdup(struct in_addr, smtp_server, n);
if (!c)
return -ENOMEM;
free_and_replace(server->smtp_server, c);
server->n_smtp_server = n;
}
return 1;
int sd_dhcp_server_set_smtp_server(sd_dhcp_server *server, const struct in_addr smtp[], unsigned n) {
return sd_dhcp_server_set_servers(server, SD_DHCP_LEASE_SMTP_SERVERS, smtp, n);
}
int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled) {

View File

@ -45,11 +45,6 @@ static int link_push_uplink_dns_to_dhcp_server(Link *link, sd_dhcp_server *s) {
size_t n_addresses = 0, n_allocated = 0;
unsigned i;
log_link_debug(link, "Copying DNS server information from link");
if (!link->network)
return 0;
for (i = 0; i < link->network->n_dns; i++) {
struct in_addr ia;
@ -91,17 +86,53 @@ static int link_push_uplink_dns_to_dhcp_server(Link *link, sd_dhcp_server *s) {
return sd_dhcp_server_set_dns(s, addresses, n_addresses);
}
static int link_push_uplink_ntp_to_dhcp_server(Link *link, sd_dhcp_server *s) {
static int link_push_uplink_to_dhcp_server(
Link *link,
sd_dhcp_lease_info what,
sd_dhcp_server *s) {
_cleanup_free_ struct in_addr *addresses = NULL;
size_t n_addresses = 0, n_allocated = 0;
char **a;
bool lease_condition;
char **servers;
if (!link->network)
return 0;
log_link_debug(link, "Copying NTP server information from link");
log_link_debug(link, "Copying %s from link", dhcp_lease_info_to_string(what));
STRV_FOREACH(a, link->network->ntp) {
switch (what) {
case SD_DHCP_LEASE_DNS_SERVERS:
/* DNS servers are stored as parsed data, so special handling is required.
* TODO: check if DNS servers should be stored unparsed too. */
return link_push_uplink_dns_to_dhcp_server(link, s);
case SD_DHCP_LEASE_NTP_SERVERS:
servers = link->network->ntp;
lease_condition = link->network->dhcp_use_ntp;
break;
case SD_DHCP_LEASE_POP3_SERVERS:
servers = link->network->pop3;
lease_condition = true;
break;
case SD_DHCP_LEASE_SMTP_SERVERS:
servers = link->network->smtp;
lease_condition = true;
break;
case SD_DHCP_LEASE_SIP_SERVERS:
servers = link->network->sip;
lease_condition = link->network->dhcp_use_sip;
break;
default:
assert_not_reached("Uknown DHCP lease info item");
}
char **a;
STRV_FOREACH(a, servers) {
union in_addr_union ia;
/* Only look for IPv4 addresses */
@ -118,173 +149,24 @@ static int link_push_uplink_ntp_to_dhcp_server(Link *link, sd_dhcp_server *s) {
addresses[n_addresses++] = ia.in;
}
if (link->network->dhcp_use_ntp && link->dhcp_lease) {
const struct in_addr *da = NULL;
int j, n;
if (lease_condition && link->dhcp_lease) {
const struct in_addr *da;
n = sd_dhcp_lease_get_ntp(link->dhcp_lease, &da);
size_t n = sd_dhcp_lease_get_servers(link->dhcp_lease, what, &da);
if (n > 0) {
if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + n))
return log_oom();
for (j = 0; j < n; j++)
if (in4_addr_is_non_local(&da[j]))
addresses[n_addresses++] = da[j];
for (unsigned i = 0; i < n; i++)
if (in4_addr_is_non_local(&da[i]))
addresses[n_addresses++] = da[i];
}
}
if (n_addresses <= 0)
return 0;
return sd_dhcp_server_set_ntp(s, addresses, n_addresses);
}
static int link_push_uplink_pop3_to_dhcp_server(Link *link, sd_dhcp_server *s) {
_cleanup_free_ struct in_addr *addresses = NULL;
size_t n_addresses = 0, n_allocated = 0;
char **a;
if (!link->network)
return 0;
log_link_debug(link, "Copying POP3 server information from link");
STRV_FOREACH(a, link->network->pop3) {
union in_addr_union ia;
/* Only look for IPv4 addresses */
if (in_addr_from_string(AF_INET, *a, &ia) <= 0)
continue;
/* Never propagate obviously borked data */
if (in4_addr_is_null(&ia.in) || in4_addr_is_localhost(&ia.in))
continue;
if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + 1))
return log_oom();
addresses[n_addresses++] = ia.in;
}
if (link->dhcp_lease) {
const struct in_addr *da = NULL;
int j, n;
n = sd_dhcp_lease_get_pop3_server(link->dhcp_lease, &da);
if (n > 0) {
if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + n))
return log_oom();
for (j = 0; j < n; j++)
if (in4_addr_is_non_local(&da[j]))
addresses[n_addresses++] = da[j];
}
}
if (n_addresses <= 0)
return 0;
return sd_dhcp_server_set_pop3_server(s, addresses, n_addresses);
}
static int link_push_uplink_smtp_to_dhcp_server(Link *link, sd_dhcp_server *s) {
_cleanup_free_ struct in_addr *addresses = NULL;
size_t n_addresses = 0, n_allocated = 0;
char **a;
if (!link->network)
return 0;
log_link_debug(link, "Copying SMTP server information from link");
STRV_FOREACH(a, link->network->smtp) {
union in_addr_union ia;
/* Only look for IPv4 addresses */
if (in_addr_from_string(AF_INET, *a, &ia) <= 0)
continue;
/* Never propagate obviously borked data */
if (in4_addr_is_null(&ia.in) || in4_addr_is_localhost(&ia.in))
continue;
if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + 1))
return log_oom();
addresses[n_addresses++] = ia.in;
}
if (link->dhcp_lease) {
const struct in_addr *da = NULL;
int j, n;
n = sd_dhcp_lease_get_smtp_server(link->dhcp_lease, &da);
if (n > 0) {
if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + n))
return log_oom();
for (j = 0; j < n; j++)
if (in4_addr_is_non_local(&da[j]))
addresses[n_addresses++] = da[j];
}
}
if (n_addresses <= 0)
return 0;
return sd_dhcp_server_set_smtp_server(s, addresses, n_addresses);
}
static int link_push_uplink_sip_to_dhcp_server(Link *link, sd_dhcp_server *s) {
_cleanup_free_ struct in_addr *addresses = NULL;
size_t n_addresses = 0, n_allocated = 0;
char **a;
if (!link->network)
return 0;
log_link_debug(link, "Copying SIP server information from link");
STRV_FOREACH(a, link->network->sip) {
union in_addr_union ia;
/* Only look for IPv4 addresses */
if (in_addr_from_string(AF_INET, *a, &ia) <= 0)
continue;
/* Never propagate obviously borked data */
if (in4_addr_is_null(&ia.in) || in4_addr_is_localhost(&ia.in))
continue;
if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + 1))
return log_oom();
addresses[n_addresses++] = ia.in;
}
if (link->network->dhcp_use_sip && link->dhcp_lease) {
const struct in_addr *da = NULL;
int j, n;
n = sd_dhcp_lease_get_sip(link->dhcp_lease, &da);
if (n > 0) {
if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + n))
return log_oom();
for (j = 0; j < n; j++)
if (in4_addr_is_non_local(&da[j]))
addresses[n_addresses++] = da[j];
}
}
if (n_addresses <= 0)
return 0;
return sd_dhcp_server_set_sip(s, addresses, n_addresses);
return sd_dhcp_server_set_servers(s, what, addresses, n_addresses);
}
int dhcp4_server_configure(Link *link) {
@ -326,89 +208,63 @@ int dhcp4_server_configure(Link *link) {
return log_link_error_errno(link, r, "Failed to set default lease time for DHCPv4 server instance: %m");
}
if (link->network->dhcp_server_emit_dns) {
if (link->network->n_dhcp_server_dns > 0)
r = sd_dhcp_server_set_dns(link->dhcp_server, link->network->dhcp_server_dns, link->network->n_dhcp_server_dns);
else {
uplink = manager_find_uplink(link->manager, link);
acquired_uplink = true;
const struct {
bool condition;
const struct in_addr *servers;
unsigned n_servers;
} configs[] = {
[SD_DHCP_LEASE_DNS_SERVERS] = {
link->network->dhcp_server_emit_dns,
link->network->dhcp_server_dns,
link->network->n_dhcp_server_dns,
},
[SD_DHCP_LEASE_NTP_SERVERS] = {
link->network->dhcp_server_emit_ntp,
link->network->dhcp_server_ntp,
link->network->n_dhcp_server_ntp,
},
[SD_DHCP_LEASE_SIP_SERVERS] = {
link->network->dhcp_server_emit_sip,
link->network->dhcp_server_sip,
link->network->n_dhcp_server_sip,
},
[SD_DHCP_LEASE_POP3_SERVERS] = {
true,
link->network->dhcp_server_pop3,
link->network->n_dhcp_server_pop3,
},
[SD_DHCP_LEASE_SMTP_SERVERS] = {
true,
link->network->dhcp_server_smtp,
link->network->n_dhcp_server_smtp,
},
};
assert_cc(ELEMENTSOF(configs) == _SD_DHCP_LEASE_INFO_MAX);
if (!uplink) {
log_link_debug(link, "Not emitting DNS server information on link, couldn't find suitable uplink.");
r = 0;
} else
r = link_push_uplink_dns_to_dhcp_server(uplink, link->dhcp_server);
for (unsigned n = 0; n < ELEMENTSOF(configs); n++)
if (configs[n].condition) {
if (configs[n].n_servers > 0)
r = sd_dhcp_server_set_servers(link->dhcp_server, n,
configs[n].servers, configs[n].n_servers);
else {
if (!acquired_uplink) {
uplink = manager_find_uplink(link->manager, link);
acquired_uplink = true;
}
if (!uplink) {
log_link_debug(link,
"Not emitting %s on link, couldn't find suitable uplink.",
dhcp_lease_info_to_string(n));
r = 0;
} else
r = link_push_uplink_to_dhcp_server(uplink, n, link->dhcp_server);
}
if (r < 0)
log_link_warning_errno(link, r,
"Failed to set %s for DHCP server, ignoring: %m",
dhcp_lease_info_to_string(n));
}
if (r < 0)
log_link_warning_errno(link, r, "Failed to set DNS server for DHCP server, ignoring: %m");
}
if (link->network->dhcp_server_emit_ntp) {
if (link->network->n_dhcp_server_ntp > 0)
r = sd_dhcp_server_set_ntp(link->dhcp_server, link->network->dhcp_server_ntp, link->network->n_dhcp_server_ntp);
else {
if (!acquired_uplink)
uplink = manager_find_uplink(link->manager, link);
if (!uplink) {
log_link_debug(link, "Not emitting NTP server information on link, couldn't find suitable uplink.");
r = 0;
} else
r = link_push_uplink_ntp_to_dhcp_server(uplink, link->dhcp_server);
}
if (r < 0)
log_link_warning_errno(link, r, "Failed to set NTP server for DHCP server, ignoring: %m");
}
if (link->network->dhcp_server_emit_sip) {
if (link->network->n_dhcp_server_sip > 0)
r = sd_dhcp_server_set_sip(link->dhcp_server, link->network->dhcp_server_sip, link->network->n_dhcp_server_sip);
else {
if (!acquired_uplink)
uplink = manager_find_uplink(link->manager, link);
if (!uplink) {
log_link_debug(link, "Not emitting sip server information on link, couldn't find suitable uplink.");
r = 0;
} else
r = link_push_uplink_sip_to_dhcp_server(uplink, link->dhcp_server);
}
if (r < 0)
log_link_warning_errno(link, r, "Failed to set SIP server for DHCP server, ignoring: %m");
}
if (link->network->n_dhcp_server_pop3 > 0)
r = sd_dhcp_server_set_pop3_server(link->dhcp_server, link->network->dhcp_server_pop3, link->network->n_dhcp_server_pop3);
else {
if (!acquired_uplink)
uplink = manager_find_uplink(link->manager, link);
if (!uplink) {
log_link_debug(link, "Not emitting POP3 server information on link, couldn't find suitable uplink.");
r = 0;
} else
r = link_push_uplink_pop3_to_dhcp_server(uplink, link->dhcp_server);
}
if (r < 0)
log_link_warning_errno(link, r, "Failed to set POP3 server for DHCP server, ignoring: %m");
if (link->network->n_dhcp_server_smtp > 0)
r = sd_dhcp_server_set_smtp_server(link->dhcp_server, link->network->dhcp_server_smtp, link->network->n_dhcp_server_smtp);
else {
if (!acquired_uplink)
uplink = manager_find_uplink(link->manager, link);
if (!uplink) {
log_link_debug(link, "Not emitting SMTP server information on link, couldn't find suitable uplink.");
r = 0;
} else
r = link_push_uplink_smtp_to_dhcp_server(uplink, link->dhcp_server);
}
if (r < 0)
log_link_warning_errno(link, r, "Failed to SMTP server for DHCP server, ignoring: %m");
r = sd_dhcp_server_set_emit_router(link->dhcp_server, link->network->dhcp_server_emit_router);
if (r < 0)
@ -458,6 +314,51 @@ int dhcp4_server_configure(Link *link) {
return 0;
}
static int config_parse_dhcp_lease_server_list(
const char *unit,
const char *filename,
unsigned line,
const char *lvalue,
const char *rvalue,
struct in_addr **addresses,
unsigned *n_addresses) {
assert(filename);
assert(lvalue);
assert(rvalue);
for (const char *p = rvalue;;) {
_cleanup_free_ char *w = NULL;
union in_addr_union a;
int r;
r = extract_first_word(&p, &w, NULL, 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to extract word, ignoring: %s", rvalue);
return 0;
}
if (r == 0)
return 0;
r = in_addr_from_string(AF_INET, w, &a);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse %s= address '%s', ignoring: %m", lvalue, w);
continue;
}
struct in_addr *m = reallocarray(*addresses, *n_addresses + 1, sizeof(struct in_addr));
if (!m)
return log_oom();
m[(*n_addresses)++] = a.in;
*addresses = m;
}
}
int config_parse_dhcp_server_dns(
const char *unit,
const char *filename,
@ -471,45 +372,10 @@ int config_parse_dhcp_server_dns(
void *userdata) {
Network *n = data;
const char *p = rvalue;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
for (;;) {
_cleanup_free_ char *w = NULL;
union in_addr_union a;
struct in_addr *m;
r = extract_first_word(&p, &w, NULL, 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to extract word, ignoring: %s", rvalue);
return 0;
}
if (r == 0)
break;
r = in_addr_from_string(AF_INET, w, &a);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse DNS server address '%s', ignoring assignment: %m", w);
continue;
}
m = reallocarray(n->dhcp_server_dns, n->n_dhcp_server_dns + 1, sizeof(struct in_addr));
if (!m)
return log_oom();
m[n->n_dhcp_server_dns++] = a.in;
n->dhcp_server_dns = m;
}
return 0;
return config_parse_dhcp_lease_server_list(unit, filename, line,
lvalue, rvalue,
&n->dhcp_server_dns, &n->n_dhcp_server_dns);
}
int config_parse_dhcp_server_ntp(
@ -525,43 +391,10 @@ int config_parse_dhcp_server_ntp(
void *userdata) {
Network *n = data;
const char *p = rvalue;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
for (;;) {
_cleanup_free_ char *w = NULL;
union in_addr_union a;
struct in_addr *m;
r = extract_first_word(&p, &w, NULL, 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to extract word, ignoring: %s", rvalue);
return 0;
}
if (r == 0)
return 0;
r = in_addr_from_string(AF_INET, w, &a);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse NTP server address '%s', ignoring: %m", w);
continue;
}
m = reallocarray(n->dhcp_server_ntp, n->n_dhcp_server_ntp + 1, sizeof(struct in_addr));
if (!m)
return log_oom();
m[n->n_dhcp_server_ntp++] = a.in;
n->dhcp_server_ntp = m;
}
return config_parse_dhcp_lease_server_list(unit, filename, line,
lvalue, rvalue,
&n->dhcp_server_ntp, &n->n_dhcp_server_ntp);
}
int config_parse_dhcp_server_sip(
@ -577,45 +410,10 @@ int config_parse_dhcp_server_sip(
void *userdata) {
Network *n = data;
const char *p = rvalue;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
for (;;) {
_cleanup_free_ char *w = NULL;
union in_addr_union a;
struct in_addr *m;
r = extract_first_word(&p, &w, NULL, 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to extract word, ignoring: %s", rvalue);
return 0;
}
if (r == 0)
return 0;
r = in_addr_from_string(AF_INET, w, &a);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse SIP server address '%s', ignoring: %m", w);
continue;
}
m = reallocarray(n->dhcp_server_sip, n->n_dhcp_server_sip + 1, sizeof(struct in_addr));
if (!m)
return log_oom();
m[n->n_dhcp_server_sip++] = a.in;
n->dhcp_server_sip = m;
}
return 0;
return config_parse_dhcp_lease_server_list(unit, filename, line,
lvalue, rvalue,
&n->dhcp_server_sip, &n->n_dhcp_server_sip);
}
int config_parse_dhcp_server_pop3_servers(
@ -631,45 +429,10 @@ int config_parse_dhcp_server_pop3_servers(
void *userdata) {
Network *n = data;
const char *p = rvalue;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
for (;;) {
_cleanup_free_ char *w = NULL;
union in_addr_union a;
struct in_addr *m;
r = extract_first_word(&p, &w, NULL, 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to extract word, ignoring: %s", rvalue);
return 0;
}
if (r == 0)
return 0;
r = in_addr_from_string(AF_INET, w, &a);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse POP3 server address '%s', ignoring: %m", w);
continue;
}
m = reallocarray(n->dhcp_server_pop3, n->n_dhcp_server_pop3 + 1, sizeof(struct in_addr));
if (!m)
return log_oom();
m[n->n_dhcp_server_pop3++] = a.in;
n->dhcp_server_pop3 = m;
}
return 0;
return config_parse_dhcp_lease_server_list(unit, filename, line,
lvalue, rvalue,
&n->dhcp_server_pop3, &n->n_dhcp_server_pop3);
}
int config_parse_dhcp_server_smtp_servers(
@ -685,43 +448,9 @@ int config_parse_dhcp_server_smtp_servers(
void *userdata) {
Network *n = data;
const char *p = rvalue;
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
return config_parse_dhcp_lease_server_list(unit, filename, line,
lvalue, rvalue,
&n->dhcp_server_smtp, &n->n_dhcp_server_smtp);
for (;;) {
_cleanup_free_ char *w = NULL;
union in_addr_union a;
struct in_addr *m;
r = extract_first_word(&p, &w, NULL, 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to extract word, ignoring: %s", rvalue);
return 0;
}
if (r == 0)
return 0;
r = in_addr_from_string(AF_INET, w, &a);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to parse SMTP server address '%s', ignoring: %m", w);
continue;
}
m = reallocarray(n->dhcp_server_smtp, n->n_dhcp_server_smtp + 1, sizeof(struct in_addr));
if (!m)
return log_oom();
m[n->n_dhcp_server_smtp++] = a.in;
n->dhcp_server_smtp = m;
}
return 0;
}

View File

@ -8,14 +8,14 @@
#include "string-util.h"
#include "util.h"
static const char * const address_family_table[_ADDRESS_FAMILY_MAX] = {
static const char* const address_family_table[_ADDRESS_FAMILY_MAX] = {
[ADDRESS_FAMILY_NO] = "no",
[ADDRESS_FAMILY_YES] = "yes",
[ADDRESS_FAMILY_IPV4] = "ipv4",
[ADDRESS_FAMILY_IPV6] = "ipv6",
};
static const char * const link_local_address_family_table[_ADDRESS_FAMILY_MAX] = {
static const char* const link_local_address_family_table[_ADDRESS_FAMILY_MAX] = {
[ADDRESS_FAMILY_NO] = "no",
[ADDRESS_FAMILY_YES] = "yes",
[ADDRESS_FAMILY_IPV4] = "ipv4",
@ -24,25 +24,34 @@ static const char * const link_local_address_family_table[_ADDRESS_FAMILY_MAX] =
[ADDRESS_FAMILY_FALLBACK_IPV4] = "ipv4-fallback",
};
static const char * const routing_policy_rule_address_family_table[_ADDRESS_FAMILY_MAX] = {
static const char* const routing_policy_rule_address_family_table[_ADDRESS_FAMILY_MAX] = {
[ADDRESS_FAMILY_YES] = "both",
[ADDRESS_FAMILY_IPV4] = "ipv4",
[ADDRESS_FAMILY_IPV6] = "ipv6",
};
static const char * const duplicate_address_detection_address_family_table[_ADDRESS_FAMILY_MAX] = {
static const char* const duplicate_address_detection_address_family_table[_ADDRESS_FAMILY_MAX] = {
[ADDRESS_FAMILY_NO] = "none",
[ADDRESS_FAMILY_YES] = "both",
[ADDRESS_FAMILY_IPV4] = "ipv4",
[ADDRESS_FAMILY_IPV6] = "ipv6",
};
static const char* const dhcp_lease_info_table[_SD_DHCP_LEASE_INFO_MAX] = {
[SD_DHCP_LEASE_DNS_SERVERS] = "DNS servers",
[SD_DHCP_LEASE_NTP_SERVERS] = "NTP servers",
[SD_DHCP_LEASE_SIP_SERVERS] = "SIP servers",
[SD_DHCP_LEASE_POP3_SERVERS] = "POP3 servers",
[SD_DHCP_LEASE_SMTP_SERVERS] = "SMTP servers",
};
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(address_family, AddressFamily, ADDRESS_FAMILY_YES);
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(link_local_address_family, AddressFamily, ADDRESS_FAMILY_YES);
DEFINE_STRING_TABLE_LOOKUP(routing_policy_rule_address_family, AddressFamily);
DEFINE_STRING_TABLE_LOOKUP(duplicate_address_detection_address_family, AddressFamily);
DEFINE_CONFIG_PARSE_ENUM(config_parse_link_local_address_family, link_local_address_family,
AddressFamily, "Failed to parse option");
DEFINE_STRING_TABLE_LOOKUP(dhcp_lease_info, sd_dhcp_lease_info);
int config_parse_address_family_with_kernel(
const char* unit,

View File

@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include "sd-dhcp-lease.h"
#include "conf-parser.h"
#include "hash-funcs.h"
#include "macro.h"
@ -38,6 +40,9 @@ AddressFamily routing_policy_rule_address_family_from_string(const char *s) _pur
const char *duplicate_address_detection_address_family_to_string(AddressFamily b) _const_;
AddressFamily duplicate_address_detection_address_family_from_string(const char *s) _pure_;
const char *dhcp_lease_info_to_string(sd_dhcp_lease_info info) _const_;
sd_dhcp_lease_info dhcp_lease_info_from_string(const char *s) _pure_;
int kernel_route_expiration_supported(void);
int network_config_section_new(const char *filename, unsigned line, NetworkConfigSection **s);

View File

@ -2516,6 +2516,48 @@ static int verb_revert_link(int argc, char **argv, void *userdata) {
return 0;
}
static int verb_log_level(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus *bus = userdata;
int r;
assert(bus);
if (argc == 1) {
_cleanup_free_ char *level = NULL;
r = sd_bus_get_property_string(
bus,
"org.freedesktop.resolve1",
"/org/freedesktop/resolve1",
"org.freedesktop.resolve1.Manager",
"LogLevel",
&error,
&level);
if (r < 0)
return log_error_errno(r, "Failed to get log level: %s", bus_error_message(&error, r));
puts(level);
} else {
assert(argc == 2);
r = sd_bus_set_property(
bus,
"org.freedesktop.resolve1",
"/org/freedesktop/resolve1",
"org.freedesktop.resolve1.Manager",
"LogLevel",
&error,
"s",
argv[1]);
if (r < 0)
return log_error_errno(r, "Failed to set log level: %s", bus_error_message(&error, r));
}
return 0;
}
static void help_protocol_types(void) {
if (arg_legend)
puts("Known protocol types:");
@ -3190,6 +3232,7 @@ static int native_main(int argc, char *argv[], sd_bus *bus) {
{ "dnssec", VERB_ANY, 3, 0, verb_dnssec },
{ "nta", VERB_ANY, VERB_ANY, 0, verb_nta },
{ "revert", VERB_ANY, 2, 0, verb_revert_link },
{ "log-level", VERB_ANY, 2, 0, verb_log_level },
{}
};

View File

@ -16,6 +16,7 @@
#include "socket-netlink.h"
#include "stdio-util.h"
#include "strv.h"
#include "syslog-util.h"
#include "user-util.h"
#include "utf8.h"
@ -1835,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);
}
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[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_PROPERTY("LLMNRHostname", "s", NULL, offsetof(Manager, llmnr_hostname), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
@ -1853,7 +1905,7 @@ static const sd_bus_vtable resolve_vtable[] = {
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_WRITABLE_PROPERTY("LogLevel", "s", property_get_log_level, property_set_log_level, 0, 0),
SD_BUS_METHOD_WITH_NAMES("ResolveHostname",
"isit",

View File

@ -1350,7 +1350,16 @@ static int dns_transaction_prepare(DnsTransaction *t, usec_t ts) {
}
if (t->n_attempts >= TRANSACTION_ATTEMPTS_MAX(t->scope->protocol)) {
dns_transaction_complete(t, DNS_TRANSACTION_ATTEMPTS_MAX_REACHED);
DnsTransactionState result;
if (t->scope->protocol == DNS_PROTOCOL_LLMNR)
/* If we didn't find anything on LLMNR, it's not an error, but a failure to resolve
* the name. */
result = DNS_TRANSACTION_NOT_FOUND;
else
result = DNS_TRANSACTION_ATTEMPTS_MAX_REACHED;
dns_transaction_complete(t, result);
return 0;
}

View File

@ -9,6 +9,7 @@
#include "dns-domain.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "ordered-set.h"
#include "resolved-conf.h"
#include "resolved-dns-server.h"
@ -27,41 +28,30 @@
#define PRIVATE_STATIC_RESOLV_CONF ROOTLIBEXECDIR "/resolv.conf"
int manager_check_resolv_conf(const Manager *m) {
const char *path;
struct stat st;
int r;
struct stat st, own;
assert(m);
/* This warns only when our stub listener is disabled and /etc/resolv.conf is a symlink to
* PRIVATE_STATIC_RESOLV_CONF or PRIVATE_STUB_RESOLV_CONF. */
* PRIVATE_STATIC_RESOLV_CONF. */
if (m->dns_stub_listener_mode != DNS_STUB_LISTENER_NO)
return 0;
r = stat("/etc/resolv.conf", &st);
if (r < 0) {
if (stat("/etc/resolv.conf", &st) < 0) {
if (errno == ENOENT)
return 0;
return log_warning_errno(errno, "Failed to stat /etc/resolv.conf: %m");
}
FOREACH_STRING(path,
PRIVATE_STUB_RESOLV_CONF,
PRIVATE_STATIC_RESOLV_CONF) {
struct stat own;
/* Is it symlinked to our own uplink file? */
if (stat(path, &own) >= 0 &&
st.st_dev == own.st_dev &&
st.st_ino == own.st_ino) {
log_warning("DNSStubListener= is disabled, but /etc/resolv.conf is a symlink to %s "
"which expects DNSStubListener= to be enabled.", path);
return -EOPNOTSUPP;
}
}
/* Is it symlinked to our own uplink file? */
if (stat(PRIVATE_STATIC_RESOLV_CONF, &own) >= 0 &&
st.st_dev == own.st_dev &&
st.st_ino == own.st_ino)
return log_warning_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"DNSStubListener= is disabled, but /etc/resolv.conf is a symlink to "
PRIVATE_STATIC_RESOLV_CONF " which expects DNSStubListener= to be enabled.");
return 0;
}
@ -355,45 +345,49 @@ int manager_write_resolv_conf(Manager *m) {
r = fopen_temporary_label(PRIVATE_UPLINK_RESOLV_CONF, PRIVATE_UPLINK_RESOLV_CONF, &f_uplink, &temp_path_uplink);
if (r < 0)
return log_warning_errno(r, "Failed to open private resolv.conf file for writing: %m");
return log_warning_errno(r, "Failed to open new %s for writing: %m", PRIVATE_UPLINK_RESOLV_CONF);
(void) fchmod(fileno(f_uplink), 0644);
r = fopen_temporary_label(PRIVATE_STUB_RESOLV_CONF, PRIVATE_STUB_RESOLV_CONF, &f_stub, &temp_path_stub);
if (r < 0)
return log_warning_errno(r, "Failed to open private stub-resolv.conf file for writing: %m");
(void) fchmod(fileno(f_stub), 0644);
r = write_uplink_resolv_conf_contents(f_uplink, dns, domains);
if (r < 0) {
log_error_errno(r, "Failed to write private resolv.conf contents: %m");
log_error_errno(r, "Failed to write new %s: %m", PRIVATE_UPLINK_RESOLV_CONF);
goto fail;
}
if (rename(temp_path_uplink, PRIVATE_UPLINK_RESOLV_CONF) < 0) {
r = log_error_errno(errno, "Failed to move private resolv.conf file into place: %m");
goto fail;
if (m->dns_stub_listener_mode != DNS_STUB_LISTENER_NO) {
r = fopen_temporary_label(PRIVATE_STUB_RESOLV_CONF, PRIVATE_STUB_RESOLV_CONF, &f_stub, &temp_path_stub);
if (r < 0) {
log_warning_errno(r, "Failed to open new %s for writing: %m", PRIVATE_STUB_RESOLV_CONF);
goto fail;
}
(void) fchmod(fileno(f_stub), 0644);
r = write_stub_resolv_conf_contents(f_stub, dns, domains);
if (r < 0) {
log_error_errno(r, "Failed to write new %s: %m", PRIVATE_STUB_RESOLV_CONF);
goto fail;
}
if (rename(temp_path_stub, PRIVATE_STUB_RESOLV_CONF) < 0)
r = log_error_errno(errno, "Failed to move new %s into place: %m", PRIVATE_STUB_RESOLV_CONF);
} else {
r = symlink_atomic(basename(PRIVATE_UPLINK_RESOLV_CONF), PRIVATE_STUB_RESOLV_CONF);
if (r < 0)
log_error_errno(r, "Failed to symlink %s: %m", PRIVATE_STUB_RESOLV_CONF);
}
r = write_stub_resolv_conf_contents(f_stub, dns, domains);
if (rename(temp_path_uplink, PRIVATE_UPLINK_RESOLV_CONF) < 0)
r = log_error_errno(errno, "Failed to move new %s into place: %m", PRIVATE_UPLINK_RESOLV_CONF);
fail:
if (r < 0) {
log_error_errno(r, "Failed to write private stub-resolv.conf contents: %m");
goto fail;
/* Something went wrong, perform cleanup... */
(void) unlink(temp_path_uplink);
(void) unlink(temp_path_stub);
}
if (rename(temp_path_stub, PRIVATE_STUB_RESOLV_CONF) < 0) {
r = log_error_errno(errno, "Failed to move private stub-resolv.conf file into place: %m");
goto fail;
}
return 0;
fail:
(void) unlink(PRIVATE_UPLINK_RESOLV_CONF);
(void) unlink(temp_path_uplink);
(void) unlink(PRIVATE_STUB_RESOLV_CONF);
(void) unlink(temp_path_stub);
return r;
}

View File

@ -33,6 +33,15 @@ typedef struct sd_dhcp_route sd_dhcp_route;
sd_dhcp_lease *sd_dhcp_lease_ref(sd_dhcp_lease *lease);
sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease);
typedef enum sd_dhcp_lease_info {
SD_DHCP_LEASE_DNS_SERVERS = 0,
SD_DHCP_LEASE_NTP_SERVERS,
SD_DHCP_LEASE_SIP_SERVERS,
SD_DHCP_LEASE_POP3_SERVERS,
SD_DHCP_LEASE_SMTP_SERVERS,
_SD_DHCP_LEASE_INFO_MAX,
} sd_dhcp_lease_info;
int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr);
int sd_dhcp_lease_get_lifetime(sd_dhcp_lease *lease, uint32_t *lifetime);
int sd_dhcp_lease_get_t1(sd_dhcp_lease *lease, uint32_t *t1);
@ -42,6 +51,7 @@ int sd_dhcp_lease_get_netmask(sd_dhcp_lease *lease, struct in_addr *addr);
int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_next_server(sd_dhcp_lease *lease, struct in_addr *addr);
int sd_dhcp_lease_get_server_identifier(sd_dhcp_lease *lease, struct in_addr *addr);
int sd_dhcp_lease_get_servers(sd_dhcp_lease *lease, sd_dhcp_lease_info what, const struct in_addr **addr);
int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr);
int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr);

View File

@ -21,6 +21,7 @@
#include <inttypes.h>
#include <netinet/in.h>
#include "sd-dhcp-lease.h"
#include "sd-dhcp-option.h"
#include "sd-event.h"
@ -47,12 +48,19 @@ int sd_dhcp_server_stop(sd_dhcp_server *server);
int sd_dhcp_server_configure_pool(sd_dhcp_server *server, struct in_addr *address, unsigned char prefixlen, uint32_t offset, uint32_t size);
int sd_dhcp_server_set_timezone(sd_dhcp_server *server, const char *timezone);
int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled);
int sd_dhcp_server_set_servers(
sd_dhcp_server *server,
sd_dhcp_lease_info what,
const struct in_addr addresses[],
unsigned n_addresses);
int sd_dhcp_server_set_dns(sd_dhcp_server *server, const struct in_addr dns[], unsigned n);
int sd_dhcp_server_set_ntp(sd_dhcp_server *server, const struct in_addr ntp[], unsigned n);
int sd_dhcp_server_set_sip(sd_dhcp_server *server, const struct in_addr sip[], unsigned n);
int sd_dhcp_server_set_pop3_server(sd_dhcp_server *server, const struct in_addr pop3_server[], unsigned n);
int sd_dhcp_server_set_smtp_server(sd_dhcp_server *server, const struct in_addr smtp_server[], unsigned n);
int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled);
int sd_dhcp_server_add_option(sd_dhcp_server *server, sd_dhcp_option *v);
int sd_dhcp_server_add_vendor_option(sd_dhcp_server *server, sd_dhcp_option *v);

View File

@ -160,6 +160,38 @@ TEMPLATE = '''\
<variablelist id='filenames' />
</refsect1>
<refsect1>
<title>D-Bus interfaces</title>
<para>Interaces exposed over D-Bus.</para>
<variablelist id='dbus-interface' />
</refsect1>
<refsect1>
<title>D-Bus methods</title>
<para>Methods exposed in the D-Bus interface.</para>
<variablelist id='dbus-method' />
</refsect1>
<refsect1>
<title>D-Bus properties</title>
<para>Properties exposed in the D-Bus interface.</para>
<variablelist id='dbus-property' />
</refsect1>
<refsect1>
<title>D-Bus signals</title>
<para>Signals emitted in the D-Bus interface.</para>
<variablelist id='dbus-signal' />
</refsect1>
<refsect1>
<title>Colophon</title>
<para id='colophon' />
@ -180,9 +212,10 @@ def _extract_directives(directive_groups, formatting, page):
storopt = directive_groups['options']
for variablelist in t.iterfind('.//variablelist'):
klass = variablelist.attrib.get('class')
searchpath = variablelist.attrib.get('xpath','./varlistentry/term/varname')
storvar = directive_groups[klass or 'miscellaneous']
# <option>s go in OPTIONS, unless class is specified
for xpath, stor in (('./varlistentry/term/varname', storvar),
for xpath, stor in ((searchpath, storvar),
('./varlistentry/term/option',
storvar if klass else storopt)):
for name in variablelist.iterfind(xpath):
@ -199,6 +232,13 @@ def _extract_directives(directive_groups, formatting, page):
name.tail = ''
name.text = text
formatting[text] = name
extra = variablelist.attrib.get('extra-ref')
if extra:
stor[extra].append((pagename, section))
if extra not in formatting:
elt = tree.Element("varname")
elt.text= extra
formatting[extra] = elt
storfile = directive_groups['filenames']
for xpath, absolute_only in (('.//refsynopsisdiv//filename', False),

View File

@ -12,6 +12,7 @@ deprecated="
-e sd_bus_message_get_priority
-e sd_bus_message_set_priority
-e sd_seat_can_multi_session
-e sd_journal_open_container
"
for symbol in `nm -g --defined-only "$@" | grep " T " | cut -d" " -f3 | grep -wv $deprecated | sort -u` ; do

View File

@ -164,6 +164,7 @@ def xml_to_text(destination, xml, *, only_interface=None):
file = io.StringIO()
declarations = collections.defaultdict(list)
interfaces = []
print(f'''node {destination} {{''', file=file)
@ -173,10 +174,13 @@ def xml_to_text(destination, xml, *, only_interface=None):
print_boring=print_boring,
only_interface=only_interface,
declarations=declarations)
name = iface.get('name')
if not name in BORING_INTERFACES:
interfaces.append(name)
print(f'''}};''', file=file)
return file.getvalue(), declarations
return file.getvalue(), declarations, interfaces
def subst_output(document, programlisting):
try:
@ -201,7 +205,7 @@ def subst_output(document, programlisting):
xml = etree.fromstring(out, parser=PARSER)
new_text, declarations = xml_to_text(object_path, xml, only_interface=only_interface)
new_text, declarations, interfaces = xml_to_text(object_path, xml, only_interface=only_interface)
programlisting.text = '\n'.join(prefix_lines) + '\n' + new_text + footer
@ -211,9 +215,50 @@ def subst_output(document, programlisting):
# delete old comments
for child in parent:
if (child.tag == etree.Comment
and 'Autogenerated' in child.text):
parent.remove(child)
if (child.tag == etree.Comment
and 'not documented' in child.text):
parent.remove(child)
if (child.tag == "variablelist"
and child.attrib.get("generated",False) == "True"):
parent.remove(child)
# insert pointer for systemd-directives generation
the_tail = programlisting.tail #tail is erased by addnext, so save it here.
prev_element = etree.Comment("Autogenerated cross-references for systemd.directives, do not edit")
programlisting.addnext(prev_element)
programlisting.tail = the_tail
for interface in interfaces:
variablelist = etree.Element("variablelist")
variablelist.attrib['class'] = 'dbus-interface'
variablelist.attrib['generated'] = 'True'
variablelist.attrib['extra-ref'] = interface
prev_element.addnext(variablelist)
prev_element.tail = the_tail
prev_element = variablelist
for decl_type,decl_list in declarations.items():
for declaration in decl_list:
variablelist = etree.Element("variablelist")
variablelist.attrib['class'] = 'dbus-'+decl_type
variablelist.attrib['generated'] = 'True'
if decl_type == 'method' :
variablelist.attrib['extra-ref'] = declaration + '()'
else:
variablelist.attrib['extra-ref'] = declaration
prev_element.addnext(variablelist)
prev_element.tail = the_tail
prev_element = variablelist
last_element = etree.Comment("End of Autogenerated section")
prev_element.addnext(last_element)
prev_element.tail = the_tail
last_element.tail = the_tail
# insert comments for undocumented items
for item in reversed(missing):