Compare commits
27 Commits
69d06b7acf
...
c4ae2704b7
Author | SHA1 | Date |
---|---|---|
Evgeny Vereshchagin | c4ae2704b7 | |
Zbigniew Jędrzejewski-Szmek | 4a874560c5 | |
Daan De Meyer | 35bae98dce | |
Daan De Meyer | 45069c67ce | |
Topi Miettinen | a6c9f8fa6d | |
Kevin Kuehler | 7ea4392f1e | |
Zbigniew Jędrzejewski-Szmek | 3e118d135b | |
Michal Sekletár | 2e129d5d6b | |
Michal Sekletár | 7c4d139485 | |
Zbigniew Jędrzejewski-Szmek | 2e09fa8906 | |
Zbigniew Jędrzejewski-Szmek | e342055851 | |
Zbigniew Jędrzejewski-Szmek | f52b9131e5 | |
Zbigniew Jędrzejewski-Szmek | f1bb691a5a | |
Zbigniew Jędrzejewski-Szmek | b0c8219260 | |
Zbigniew Jędrzejewski-Szmek | 96d33e4ac0 | |
Zbigniew Jędrzejewski-Szmek | 9c5bb2033d | |
Zbigniew Jędrzejewski-Szmek | ce7eb6aa84 | |
Zbigniew Jędrzejewski-Szmek | 09e6443ef4 | |
Zbigniew Jędrzejewski-Szmek | 385093b702 | |
Zbigniew Jędrzejewski-Szmek | a7addf32a5 | |
Zbigniew Jędrzejewski-Szmek | b35ed5530b | |
Zbigniew Jędrzejewski-Szmek | 557afad2b7 | |
Zbigniew Jędrzejewski-Szmek | 3919ecc553 | |
Zbigniew Jędrzejewski-Szmek | 51327bcc74 | |
Zbigniew Jędrzejewski-Szmek | d32014a5bb | |
Zbigniew Jędrzejewski-Szmek | 4908de44b0 | |
Zbigniew Jędrzejewski-Szmek | 009b80a48d |
|
@ -12,7 +12,8 @@ System and Service Manager
|
|||
[![Travis CI Build Status](https://travis-ci.org/systemd/systemd.svg?branch=master)](https://travis-ci.org/systemd/systemd)<br/>
|
||||
[![Language Grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/systemd/systemd.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/systemd/systemd/context:cpp)<br/>
|
||||
[![CentOS CI Build Status](https://ci.centos.org/buildStatus/icon?job=systemd-pr-build)](https://ci.centos.org/job/systemd-pr-build/)<br/>
|
||||
[![Build Status](https://dev.azure.com/evvers/systemd-systemd/_apis/build/status/systemd.systemd?branchName=master)](https://dev.azure.com/evvers/systemd-systemd/_build/latest?definitionId=1&branchName=master)
|
||||
[![Build Status](https://dev.azure.com/evvers/systemd-systemd/_apis/build/status/systemd.systemd?branchName=master)](https://dev.azure.com/evvers/systemd-systemd/_build/latest?definitionId=1&branchName=master)<br/>
|
||||
[![Packaging status](https://repology.org/badge/tiny-repos/systemd.svg)](https://repology.org/project/systemd/versions)
|
||||
|
||||
## Details
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!ENTITY MOUNT_PATH @MOUNT_PATH@>
|
||||
<!ENTITY UMOUNT_PATH @UMOUNT_PATH@>
|
||||
<!ENTITY systemgeneratordir @SYSTEM_GENERATOR_PATH@>
|
||||
<!ENTITY usergeneratordir @USER_GENERATOR_PATH@>
|
||||
<!ENTITY systemenvgeneratordir @SYSTEM_ENV_GENERATOR_PATH@>
|
||||
<!ENTITY userenvgeneratordir @USER_ENV_GENERATOR_PATH@>
|
||||
<!ENTITY systemgeneratordir @SYSTEM_GENERATOR_DIR@>
|
||||
<!ENTITY usergeneratordir @USER_GENERATOR_DIR@>
|
||||
<!ENTITY systemenvgeneratordir @SYSTEM_ENV_GENERATOR_DIR@>
|
||||
<!ENTITY userenvgeneratordir @USER_ENV_GENERATOR_DIR@>
|
||||
<!ENTITY CERTIFICATE_ROOT @CERTIFICATE_ROOT@>
|
||||
<!ENTITY MEMORY_ACCOUNTING_DEFAULT @MEMORY_ACCOUNTING_DEFAULT_YES_NO@>
|
||||
<!ENTITY KILL_USER_PROCESSES @KILL_USER_PROCESSES_YES_NO@>
|
||||
|
|
|
@ -6,6 +6,9 @@ if [ -z "$1" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# make sure the rules have been regenrated (in case man/update-man-rules was just run)
|
||||
ninja -C "@BUILD_ROOT@" version.h
|
||||
|
||||
target="man/$1.html"
|
||||
ninja -C "@BUILD_ROOT@" "$target"
|
||||
set -x
|
||||
|
|
|
@ -6,6 +6,9 @@ if [ -z "$1" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# make sure the rules have been regenrated (in case man/update-man-rules was just run)
|
||||
ninja -C "@BUILD_ROOT@" version.h
|
||||
|
||||
page="$(echo "$1" | sed 's/\./\\./')"
|
||||
target=$(ninja -C "@BUILD_ROOT@" -t query man/man | grep -E -m1 "man/$page\.[0-9]$" | awk '{print $2}')
|
||||
if [ -z "$target" ]; then
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#include <stdio.h>
|
||||
#include <sd-path.h>
|
||||
|
||||
int main(void) {
|
||||
char *t;
|
||||
|
||||
sd_path_lookup(SD_PATH_USER_DOCUMENTS, NULL, &t);
|
||||
printf("~/Documents: %s\n", t);
|
||||
}
|
|
@ -352,10 +352,13 @@ manpages = [
|
|||
''],
|
||||
['sd_bus_set_sender', '3', ['sd_bus_get_sender'], ''],
|
||||
['sd_bus_set_watch_bind', '3', ['sd_bus_get_watch_bind'], ''],
|
||||
['sd_bus_slot_ref',
|
||||
['sd_bus_slot_get_bus',
|
||||
'3',
|
||||
['sd_bus_slot_get_bus', 'sd_bus_slot_unref', 'sd_bus_slot_unrefp'],
|
||||
['sd_bus_slot_get_current_handler',
|
||||
'sd_bus_slot_get_current_message',
|
||||
'sd_bus_slot_get_current_userdata'],
|
||||
''],
|
||||
['sd_bus_slot_ref', '3', ['sd_bus_slot_unref', 'sd_bus_slot_unrefp'], ''],
|
||||
['sd_bus_slot_set_description', '3', ['sd_bus_slot_get_description'], ''],
|
||||
['sd_bus_slot_set_destroy_callback',
|
||||
'3',
|
||||
|
@ -623,6 +626,7 @@ manpages = [
|
|||
'3',
|
||||
['sd_notifyf', 'sd_pid_notify', 'sd_pid_notify_with_fds', 'sd_pid_notifyf'],
|
||||
''],
|
||||
['sd_path_lookup', '3', ['sd_path_lookup_strv'], ''],
|
||||
['sd_pid_get_owner_uid',
|
||||
'3',
|
||||
['sd_peer_get_cgroup',
|
||||
|
|
|
@ -96,7 +96,10 @@
|
|||
<citerefentry><refentrytitle>sd_bus_set_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_set_sender</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_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>,
|
||||
<citerefentry><refentrytitle>sd_bus_slot_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_slot_set_destroy_callback</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_slot_set_floating</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
<?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_slot_get_bus" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<refentryinfo>
|
||||
<title>sd_bus_slot_get_bus</title>
|
||||
<productname>systemd</productname>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>sd_bus_slot_get_bus</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_bus_slot_get_bus</refname>
|
||||
<refname>sd_bus_slot_get_current_handler</refname>
|
||||
<refname>sd_bus_slot_get_current_message</refname>
|
||||
<refname>sd_bus_slot_get_current_userdata</refname>
|
||||
|
||||
<refpurpose>Query information attached to a bus slot object</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>sd_bus *<function>sd_bus_slot_get_bus</function></funcdef>
|
||||
<paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>sd_bus_message_handler_t <function>sd_bus_slot_get_current_handler</function>
|
||||
</funcdef>
|
||||
<paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>sd_bus_message *<function>sd_bus_slot_get_current_message</function></funcdef>
|
||||
<paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>void *<function>sd_bus_slot_get_current_userdata</function></funcdef>
|
||||
<paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><function>sd_bus_slot_get_bus()</function> returns the bus object that message
|
||||
<parameter>slot</parameter> is attached to.</para>
|
||||
|
||||
<para><function>sd_bus_slot_get_current_handler()</function>,
|
||||
<function>sd_bus_slot_get_current_message()</function> and
|
||||
<function>sd_bus_slot_get_current_userdata()</function> return the current handler, message and
|
||||
userdata respectively of the bus <parameter>slot</parameter> is attached to if we're currently
|
||||
executing the callback associated with <parameter>slot</parameter>.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para><function>sd_bus_slot_get_bus()</function> always returns the bus object.</para>
|
||||
|
||||
<para>On success, <function>sd_bus_slot_get_current_handler()</function>,
|
||||
<function>sd_bus_slot_get_current_message()</function> and
|
||||
<function>sd_bus_slot_get_current_userdata()</function> return the requested object. On failure,
|
||||
they return <constant>NULL</constant>.</para>
|
||||
</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>,
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
|
@ -18,7 +18,6 @@
|
|||
<refname>sd_bus_slot_ref</refname>
|
||||
<refname>sd_bus_slot_unref</refname>
|
||||
<refname>sd_bus_slot_unrefp</refname>
|
||||
<refname>sd_bus_slot_get_bus</refname>
|
||||
|
||||
<refpurpose>Create and destroy references to a bus slot object</refpurpose>
|
||||
</refnamediv>
|
||||
|
@ -41,11 +40,6 @@
|
|||
<funcdef>void <function>sd_bus_slot_unrefp</function></funcdef>
|
||||
<paramdef>sd_bus_slot **<parameter>slotp</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>sd_bus *<function>sd_bus_slot_get_bus</function></funcdef>
|
||||
<paramdef>sd_bus_slot *<parameter>m</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
@ -72,11 +66,7 @@
|
|||
execute no operation if the passed in bus object address is
|
||||
<constant>NULL</constant>. <function>sd_bus_slot_unrefp()</function> will first dereference
|
||||
its argument, which must not be <constant>NULL</constant>, and will execute no operation if
|
||||
<emphasis>that</emphasis> is <constant>NULL</constant>.
|
||||
</para>
|
||||
|
||||
<para><function>sd_bus_slot_get_bus()</function> returns the bus object that message
|
||||
<parameter>slot</parameter> is attached to.</para>
|
||||
<emphasis>that</emphasis> is <constant>NULL</constant>.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
|
@ -85,8 +75,6 @@
|
|||
<para><function>sd_bus_slot_ref()</function> always returns the argument.</para>
|
||||
|
||||
<para><function>sd_bus_slot_unref()</function> always returns <constant>NULL</constant>.</para>
|
||||
|
||||
<para><function>sd_bus_slot_get_bus()</function> always returns the bus object.</para>
|
||||
</refsect1>
|
||||
|
||||
<xi:include href="libsystemd-pkgconfig.xml" />
|
||||
|
|
|
@ -0,0 +1,215 @@
|
|||
<?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_path_lookup" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
<title>sd_path_lookup</title>
|
||||
<productname>systemd</productname>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>sd_path_lookup</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_path_lookup</refname>
|
||||
<refname>sd_path_lookup_strv</refname>
|
||||
|
||||
<refpurpose>Query well-known file system paths</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <systemd/sd-path.h></funcsynopsisinfo>
|
||||
|
||||
<!-- note: individual constants are not added as <refname>s, there's just too many -->
|
||||
|
||||
<funcsynopsisinfo><token>enum</token> {
|
||||
<constant>SD_PATH_TEMPORARY</constant>,
|
||||
<constant>SD_PATH_TEMPORARY_LARGE</constant>,
|
||||
|
||||
<constant>SD_PATH_SYSTEM_BINARIES</constant>,
|
||||
<constant>SD_PATH_SYSTEM_INCLUDE</constant>,
|
||||
<constant>SD_PATH_SYSTEM_LIBRARY_PRIVATE</constant>,
|
||||
<constant>SD_PATH_SYSTEM_LIBRARY_ARCH</constant>,
|
||||
<constant>SD_PATH_SYSTEM_SHARED</constant>,
|
||||
<constant>SD_PATH_SYSTEM_CONFIGURATION_FACTORY</constant>,
|
||||
<constant>SD_PATH_SYSTEM_STATE_FACTORY</constant>,
|
||||
|
||||
<constant>SD_PATH_SYSTEM_CONFIGURATION</constant>,
|
||||
<constant>SD_PATH_SYSTEM_RUNTIME</constant>,
|
||||
<constant>SD_PATH_SYSTEM_RUNTIME_LOGS</constant>,
|
||||
<constant>SD_PATH_SYSTEM_STATE_PRIVATE</constant>,
|
||||
<constant>SD_PATH_SYSTEM_STATE_LOGS</constant>,
|
||||
<constant>SD_PATH_SYSTEM_STATE_CACHE</constant>,
|
||||
<constant>SD_PATH_SYSTEM_STATE_SPOOL</constant>,
|
||||
|
||||
<constant>SD_PATH_USER_BINARIES</constant>,
|
||||
<constant>SD_PATH_USER_LIBRARY_PRIVATE</constant>,
|
||||
<constant>SD_PATH_USER_LIBRARY_ARCH</constant>,
|
||||
<constant>SD_PATH_USER_SHARED</constant>,
|
||||
|
||||
<constant>SD_PATH_USER_CONFIGURATION</constant>,
|
||||
<constant>SD_PATH_USER_RUNTIME</constant>,
|
||||
<constant>SD_PATH_USER_STATE_CACHE</constant>,
|
||||
|
||||
<constant>SD_PATH_USER</constant>,
|
||||
<constant>SD_PATH_USER_DOCUMENTS</constant>,
|
||||
<constant>SD_PATH_USER_MUSIC</constant>,
|
||||
<constant>SD_PATH_USER_PICTURES</constant>,
|
||||
<constant>SD_PATH_USER_VIDEOS</constant>,
|
||||
<constant>SD_PATH_USER_DOWNLOAD</constant>,
|
||||
<constant>SD_PATH_USER_PUBLIC</constant>,
|
||||
<constant>SD_PATH_USER_TEMPLATES</constant>,
|
||||
<constant>SD_PATH_USER_DESKTOP</constant>,
|
||||
|
||||
<constant>SD_PATH_SEARCH_BINARIES</constant>,
|
||||
<constant>SD_PATH_SEARCH_BINARIES_DEFAULT</constant>,
|
||||
<constant>SD_PATH_SEARCH_LIBRARY_PRIVATE</constant>,
|
||||
<constant>SD_PATH_SEARCH_LIBRARY_ARCH</constant>,
|
||||
<constant>SD_PATH_SEARCH_SHARED</constant>,
|
||||
<constant>SD_PATH_SEARCH_CONFIGURATION_FACTORY</constant>,
|
||||
<constant>SD_PATH_SEARCH_STATE_FACTORY</constant>,
|
||||
<constant>SD_PATH_SEARCH_CONFIGURATION</constant>,
|
||||
|
||||
<constant>SD_PATH_SYSTEMD_UTIL_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_SYSTEM_UNIT_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_SYSTEM_PRESET_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_USER_UNIT_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_USER_PRESET_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_SYSTEM_CONF_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_USER_CONF_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_USER_UNIT_PATH</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_SYSTEM_GENERATOR_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_USER_GENERATOR_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_USER_GENERATOR_PATH</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_SLEEP_DIR</constant>,
|
||||
<constant>SD_PATH_SYSTEMD_SHUTDOWN_DIR</constant>,
|
||||
|
||||
<constant>SD_PATH_TMPFILES_DIR</constant>,
|
||||
<constant>SD_PATH_SYSUSERS_DIR</constant>,
|
||||
<constant>SD_PATH_SYSCTL_DIR</constant>,
|
||||
<constant>SD_PATH_BINFMT_DIR</constant>,
|
||||
<constant>SD_PATH_MODULES_LOAD_DIR</constant>,
|
||||
<constant>SD_PATH_CATALOG_DIR</constant>,
|
||||
|
||||
<constant>SD_PATH_SYSTEMD_NETWORK_PATH</constant>,
|
||||
};</funcsynopsisinfo>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_path_lookup</function></funcdef>
|
||||
<paramdef>uint64_t <parameter>type</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>suffix</parameter></paramdef>
|
||||
<paramdef>char **<parameter>paths</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_path_lookup_strv</function></funcdef>
|
||||
<paramdef>uint64_t <parameter>type</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>suffix</parameter></paramdef>
|
||||
<paramdef>char ***<parameter>paths</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><function>sd_path_lookup()</function> and <function>sd_bus_path_lookup_strv()</function> return a
|
||||
single path or set of file system paths specified by the argument <parameter>type</parameter>. In case of
|
||||
<function>sd_path_lookup()</function> a single <constant>NUL</constant>-terminated string is returned.
|
||||
When <parameter>type</parameter> specifies a set of paths, they are concatenated using
|
||||
<literal>:</literal> as a separator (as is traditionally done for e.g. <varname>$PATH</varname> or
|
||||
<varname>$LD_LIBRARY_PATH</varname>). In case of <function>sd_path_lookup_strv()</function> a
|
||||
<constant>NULL</constant>-terminated array of strings is returned (strv). If suffix
|
||||
<parameter>suffix</parameter> is given, it is concatenated to each of the paths after a slash
|
||||
(<literal>/</literal>). All returned paths are absolute.</para>
|
||||
|
||||
<para>For paths which refer to user directories, the relevant XDG standard is followed, with support for
|
||||
environment variables like <varname>$XDG_DOCUMENTS_DIR</varname>, <varname>$XDG_DESKTOP_DIR</varname>,
|
||||
..., and explicit configuration in <filename>/etc/xdg/user-dirs.conf</filename> or
|
||||
<filename>${XDG_CONFIG_HOME}/user-dirs.dirs</filename>. See
|
||||
<ulink url="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html">
|
||||
XDG Base Directory Specification</ulink> for details.</para>
|
||||
|
||||
<para><citerefentry><refentrytitle>systemd-path</refentrytitle><manvolnum>1</manvolnum></citerefentry> is
|
||||
a wrapper around <function>sd_path_lookup()</function> and allows the same set of paths to be queried.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para>On success, <function>sd_path_lookup()</function> and <function>sd_path_lookup_strv()</function>
|
||||
return a non-negative integer. On failure, a negative errno-style error number is returned by either
|
||||
function.</para>
|
||||
|
||||
<para>The returned string or string array (strv) must be
|
||||
<citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>'d by the
|
||||
caller.</para>
|
||||
|
||||
<refsect2 id='errors'>
|
||||
<title>Errors</title>
|
||||
|
||||
<para>Returned errors may indicate the following problems:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><constant>-EOPNOTSUPP</constant></term>
|
||||
|
||||
<listitem><para>Unknown identifier <parameter>type</parameter>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-EINVAL</constant></term>
|
||||
|
||||
<listitem><para>Output argument is <constant>NULL</constant>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-ENXIO</constant></term>
|
||||
|
||||
<listitem><para>Query failed because of an undefined environment variable (e.g. for
|
||||
<constant>SD_PATH_USER_RUNTIME</constant> when <varname>$XDG_RUNTIME_DIR</varname> is not
|
||||
defined).</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-ENOMEM</constant></term>
|
||||
|
||||
<listitem><para>Memory allocation failed.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Examples</title>
|
||||
|
||||
<refsect2>
|
||||
<title>Look up the location of ~/Documents</title>
|
||||
|
||||
<programlisting><xi:include href="path-documents.c" parse="text" /></programlisting>
|
||||
<para>Note that the default answer of <filename index='false'>$HOME/Documents</filename> may be
|
||||
overridden by <filename index='false'>user-dirs.conf</filename> or
|
||||
<varname>$XDG_DOCUMENTS_DIR</varname>.</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
<xi:include href="libsystemd-pkgconfig.xml" />
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<para>
|
||||
<citerefentry><refentrytitle>systemd-path</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
|
@ -32,7 +32,7 @@ key.middle/part/with/dots.foo = 123
|
|||
-key.that.will.not.fail = value
|
||||
key.pattern.*.with.glob = whatever
|
||||
-key.pattern.excluded.with.glob
|
||||
key.pattern.overriden.with.glob = custom
|
||||
key.pattern.overridden.with.glob = custom
|
||||
</programlisting>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
|
14
meson.build
14
meson.build
|
@ -196,7 +196,7 @@ memory_accounting_default = get_option('memory-accounting-default')
|
|||
status_unit_format_default = get_option('status-unit-format-default')
|
||||
|
||||
conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
|
||||
conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
|
||||
conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'system'))
|
||||
conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
|
||||
conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
|
||||
conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
|
||||
|
@ -204,8 +204,8 @@ conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-loc
|
|||
|
||||
conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
|
||||
|
||||
conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
|
||||
conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
|
||||
conf.set_quoted('USER_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'user'))
|
||||
conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
|
||||
conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
|
||||
conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
|
||||
conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
|
||||
|
@ -221,10 +221,10 @@ conf.set_quoted('ROOTPREFIX', rootprefixdir)
|
|||
conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
|
||||
conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
|
||||
conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
|
||||
conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
|
||||
conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
|
||||
conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
|
||||
conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
|
||||
conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
|
||||
conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
|
||||
conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
|
||||
conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
|
||||
conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
|
||||
conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
|
||||
conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
|
||||
|
|
|
@ -107,6 +107,10 @@ int capability_ambient_set_apply(uint64_t set, bool also_inherit) {
|
|||
unsigned long i;
|
||||
int r;
|
||||
|
||||
/* Check that we can use PR_CAP_AMBIENT or quit early. */
|
||||
if (!ambient_capabilities_supported())
|
||||
return 0;
|
||||
|
||||
/* Add the capabilities to the ambient set. */
|
||||
|
||||
if (also_inherit) {
|
||||
|
|
|
@ -159,6 +159,8 @@ basic_sources = files('''
|
|||
ordered-set.h
|
||||
parse-util.c
|
||||
parse-util.h
|
||||
path-lookup.c
|
||||
path-lookup.h
|
||||
path-util.c
|
||||
path-util.h
|
||||
prioq.c
|
||||
|
|
|
@ -6,19 +6,15 @@
|
|||
|
||||
#include "alloc-util.h"
|
||||
#include "fs-util.h"
|
||||
#include "install.h"
|
||||
#include "log.h"
|
||||
#include "macro.h"
|
||||
#include "mkdir.h"
|
||||
#include "path-lookup.h"
|
||||
#include "path-util.h"
|
||||
#include "rm-rf.h"
|
||||
#include "stat-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "tmpfile-util.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int xdg_user_runtime_dir(char **ret, const char *suffix) {
|
||||
const char *e;
|
||||
|
@ -100,14 +96,14 @@ int xdg_user_data_dir(char **ret, const char *suffix) {
|
|||
static const char* const user_data_unit_paths[] = {
|
||||
"/usr/local/lib/systemd/user",
|
||||
"/usr/local/share/systemd/user",
|
||||
USER_DATA_UNIT_PATH,
|
||||
USER_DATA_UNIT_DIR,
|
||||
"/usr/lib/systemd/user",
|
||||
"/usr/share/systemd/user",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char* const user_config_unit_paths[] = {
|
||||
USER_CONFIG_UNIT_PATH,
|
||||
USER_CONFIG_UNIT_DIR,
|
||||
"/etc/systemd/user",
|
||||
NULL
|
||||
};
|
||||
|
@ -325,12 +321,12 @@ static int acquire_config_dirs(UnitFileScope scope, char **persistent, char **ru
|
|||
switch (scope) {
|
||||
|
||||
case UNIT_FILE_SYSTEM:
|
||||
a = strdup(SYSTEM_CONFIG_UNIT_PATH);
|
||||
a = strdup(SYSTEM_CONFIG_UNIT_DIR);
|
||||
b = strdup("/run/systemd/system");
|
||||
break;
|
||||
|
||||
case UNIT_FILE_GLOBAL:
|
||||
a = strdup(USER_CONFIG_UNIT_PATH);
|
||||
a = strdup(USER_CONFIG_UNIT_DIR);
|
||||
b = strdup("/run/systemd/user");
|
||||
break;
|
||||
|
||||
|
@ -618,7 +614,7 @@ int lookup_paths_init(
|
|||
STRV_IFNOTNULL(transient),
|
||||
STRV_IFNOTNULL(generator_early),
|
||||
persistent_config,
|
||||
SYSTEM_CONFIG_UNIT_PATH,
|
||||
SYSTEM_CONFIG_UNIT_DIR,
|
||||
"/etc/systemd/system",
|
||||
STRV_IFNOTNULL(persistent_attached),
|
||||
runtime_config,
|
||||
|
@ -642,7 +638,7 @@ int lookup_paths_init(
|
|||
STRV_IFNOTNULL(transient),
|
||||
STRV_IFNOTNULL(generator_early),
|
||||
persistent_config,
|
||||
USER_CONFIG_UNIT_PATH,
|
||||
USER_CONFIG_UNIT_DIR,
|
||||
"/etc/systemd/user",
|
||||
runtime_config,
|
||||
"/run/systemd/user",
|
||||
|
@ -650,7 +646,7 @@ int lookup_paths_init(
|
|||
"/usr/local/share/systemd/user",
|
||||
"/usr/share/systemd/user",
|
||||
"/usr/local/lib/systemd/user",
|
||||
USER_DATA_UNIT_PATH,
|
||||
USER_DATA_UNIT_DIR,
|
||||
"/usr/lib/systemd/user",
|
||||
STRV_IFNOTNULL(generator_late));
|
||||
break;
|
||||
|
@ -783,56 +779,6 @@ void lookup_paths_log(LookupPaths *p) {
|
|||
}
|
||||
}
|
||||
|
||||
int lookup_paths_mkdir_generator(LookupPaths *p) {
|
||||
int r, q;
|
||||
|
||||
assert(p);
|
||||
|
||||
if (!p->generator || !p->generator_early || !p->generator_late)
|
||||
return -EINVAL;
|
||||
|
||||
r = mkdir_p_label(p->generator, 0755);
|
||||
|
||||
q = mkdir_p_label(p->generator_early, 0755);
|
||||
if (q < 0 && r >= 0)
|
||||
r = q;
|
||||
|
||||
q = mkdir_p_label(p->generator_late, 0755);
|
||||
if (q < 0 && r >= 0)
|
||||
r = q;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void lookup_paths_trim_generator(LookupPaths *p) {
|
||||
assert(p);
|
||||
|
||||
/* Trim empty dirs */
|
||||
|
||||
if (p->generator)
|
||||
(void) rmdir(p->generator);
|
||||
if (p->generator_early)
|
||||
(void) rmdir(p->generator_early);
|
||||
if (p->generator_late)
|
||||
(void) rmdir(p->generator_late);
|
||||
}
|
||||
|
||||
void lookup_paths_flush_generator(LookupPaths *p) {
|
||||
assert(p);
|
||||
|
||||
/* Flush the generated unit files in full */
|
||||
|
||||
if (p->generator)
|
||||
(void) rm_rf(p->generator, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
if (p->generator_early)
|
||||
(void) rm_rf(p->generator_early, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
if (p->generator_late)
|
||||
(void) rm_rf(p->generator_late, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
|
||||
if (p->temporary_dir)
|
||||
(void) rm_rf(p->temporary_dir, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
}
|
||||
|
||||
char **generator_binary_paths(UnitFileScope scope) {
|
||||
bool append = false; /* Add items from SYSTEMD_GENERATOR_PATH before normal directories */
|
||||
_cleanup_strv_free_ char **paths = NULL;
|
||||
|
@ -852,7 +798,7 @@ char **generator_binary_paths(UnitFileScope scope) {
|
|||
add = strv_new("/run/systemd/system-generators",
|
||||
"/etc/systemd/system-generators",
|
||||
"/usr/local/lib/systemd/system-generators",
|
||||
SYSTEM_GENERATOR_PATH);
|
||||
SYSTEM_GENERATOR_DIR);
|
||||
break;
|
||||
|
||||
case UNIT_FILE_GLOBAL:
|
||||
|
@ -860,7 +806,7 @@ char **generator_binary_paths(UnitFileScope scope) {
|
|||
add = strv_new("/run/systemd/user-generators",
|
||||
"/etc/systemd/user-generators",
|
||||
"/usr/local/lib/systemd/user-generators",
|
||||
USER_GENERATOR_PATH);
|
||||
USER_GENERATOR_DIR);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -899,12 +845,12 @@ char **env_generator_binary_paths(bool is_system) {
|
|||
add = strv_new("/run/systemd/system-environment-generators",
|
||||
"/etc/systemd/system-environment-generators",
|
||||
"/usr/local/lib/systemd/system-environment-generators",
|
||||
SYSTEM_ENV_GENERATOR_PATH);
|
||||
SYSTEM_ENV_GENERATOR_DIR);
|
||||
else
|
||||
add = strv_new("/run/systemd/user-environment-generators",
|
||||
"/etc/systemd/user-environment-generators",
|
||||
"/usr/local/lib/systemd/user-environment-generators",
|
||||
USER_ENV_GENERATOR_PATH);
|
||||
USER_ENV_GENERATOR_DIR);
|
||||
|
||||
if (!add)
|
||||
return NULL;
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
typedef struct LookupPaths LookupPaths;
|
||||
|
||||
#include "def.h"
|
||||
#include "unit-file.h"
|
||||
#include "macro.h"
|
||||
|
||||
|
@ -64,12 +65,10 @@ bool path_is_user_data_dir(const char *path);
|
|||
bool path_is_user_config_dir(const char *path);
|
||||
|
||||
void lookup_paths_log(LookupPaths *p);
|
||||
|
||||
int lookup_paths_mkdir_generator(LookupPaths *p);
|
||||
void lookup_paths_trim_generator(LookupPaths *p);
|
||||
void lookup_paths_flush_generator(LookupPaths *p);
|
||||
|
||||
void lookup_paths_free(LookupPaths *p);
|
||||
|
||||
char **generator_binary_paths(UnitFileScope scope);
|
||||
char **env_generator_binary_paths(bool is_system);
|
||||
|
||||
#define NETWORK_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/network"))
|
||||
#define NETWORK_DIRS_NULSTR CONF_PATHS_NULSTR("systemd/network")
|
|
@ -87,6 +87,16 @@ char **strv_parse_nulstr(const char *s, size_t l);
|
|||
char **strv_split_nulstr(const char *s);
|
||||
int strv_make_nulstr(char * const *l, char **p, size_t *n);
|
||||
|
||||
static inline int strv_from_nulstr(char ***a, const char *nulstr) {
|
||||
char **t;
|
||||
|
||||
t = strv_split_nulstr(nulstr);
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
*a = t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool strv_overlap(char * const *a, char * const *b) _pure_;
|
||||
|
||||
#define STRV_FOREACH(s, l) \
|
||||
|
|
|
@ -83,6 +83,8 @@ static int device_set_sysfs(Device *d, const char *sysfs) {
|
|||
}
|
||||
|
||||
d->sysfs = TAKE_PTR(copy);
|
||||
unit_add_to_dbus_queue(UNIT(d));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -562,9 +564,6 @@ static int device_setup_unit(Manager *m, sd_device *dev, const char *path, bool
|
|||
if (dev && device_is_bound_by_mounts(DEVICE(u), dev))
|
||||
device_upgrade_mount_deps(u);
|
||||
|
||||
/* Note that this won't dispatch the load queue, the caller has to do that if needed and appropriate */
|
||||
unit_add_to_dbus_queue(u);
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "generator-setup.h"
|
||||
#include "macro.h"
|
||||
#include "mkdir.h"
|
||||
#include "rm-rf.h"
|
||||
|
||||
int lookup_paths_mkdir_generator(LookupPaths *p) {
|
||||
int r, q;
|
||||
|
||||
assert(p);
|
||||
|
||||
if (!p->generator || !p->generator_early || !p->generator_late)
|
||||
return -EINVAL;
|
||||
|
||||
r = mkdir_p_label(p->generator, 0755);
|
||||
|
||||
q = mkdir_p_label(p->generator_early, 0755);
|
||||
if (q < 0 && r >= 0)
|
||||
r = q;
|
||||
|
||||
q = mkdir_p_label(p->generator_late, 0755);
|
||||
if (q < 0 && r >= 0)
|
||||
r = q;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void lookup_paths_trim_generator(LookupPaths *p) {
|
||||
assert(p);
|
||||
|
||||
/* Trim empty dirs */
|
||||
|
||||
if (p->generator)
|
||||
(void) rmdir(p->generator);
|
||||
if (p->generator_early)
|
||||
(void) rmdir(p->generator_early);
|
||||
if (p->generator_late)
|
||||
(void) rmdir(p->generator_late);
|
||||
}
|
||||
|
||||
void lookup_paths_flush_generator(LookupPaths *p) {
|
||||
assert(p);
|
||||
|
||||
/* Flush the generated unit files in full */
|
||||
|
||||
if (p->generator)
|
||||
(void) rm_rf(p->generator, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
if (p->generator_early)
|
||||
(void) rm_rf(p->generator_early, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
if (p->generator_late)
|
||||
(void) rm_rf(p->generator_late, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
|
||||
if (p->temporary_dir)
|
||||
(void) rm_rf(p->temporary_dir, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include "path-lookup.h"
|
||||
|
||||
int lookup_paths_mkdir_generator(LookupPaths *p);
|
||||
void lookup_paths_trim_generator(LookupPaths *p);
|
||||
void lookup_paths_flush_generator(LookupPaths *p);
|
|
@ -44,6 +44,7 @@
|
|||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
#include "generator-setup.h"
|
||||
#include "hashmap.h"
|
||||
#include "install.h"
|
||||
#include "io-util.h"
|
||||
|
@ -689,7 +690,7 @@ static int manager_setup_prefix(Manager *m) {
|
|||
p = paths_user;
|
||||
|
||||
for (i = 0; i < _EXEC_DIRECTORY_TYPE_MAX; i++) {
|
||||
r = sd_path_home(p[i].type, p[i].suffix, &m->prefix[i]);
|
||||
r = sd_path_lookup(p[i].type, p[i].suffix, &m->prefix[i]);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,8 @@ libcore_sources = '''
|
|||
emergency-action.h
|
||||
execute.c
|
||||
execute.h
|
||||
generator-setup.c
|
||||
generator-setup.h
|
||||
hostname-setup.c
|
||||
hostname-setup.h
|
||||
ima-setup.c
|
||||
|
|
|
@ -7,36 +7,93 @@
|
|||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# Names with prefixes are prefered, and the run-together names should be
|
||||
# considered deprecated (though there is no plan to remove them). New names
|
||||
# shall have underscores.
|
||||
|
||||
prefix=@prefix@
|
||||
rootprefix=@rootprefix_noslash@
|
||||
sysconfdir=@sysconfdir@
|
||||
systemdutildir=${rootprefix}/lib/systemd
|
||||
systemdsystemunitdir=${rootprefix}/lib/systemd/system
|
||||
systemdsystempresetdir=${rootprefix}/lib/systemd/system-preset
|
||||
systemduserunitdir=${prefix}/lib/systemd/user
|
||||
systemduserpresetdir=${prefix}/lib/systemd/user-preset
|
||||
systemdsystemconfdir=${sysconfdir}/systemd/system
|
||||
systemduserconfdir=${sysconfdir}/systemd/user
|
||||
systemdsystemunitpath=${systemdsystemconfdir}:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:${systemdsystemunitdir}:/usr/lib/systemd/system:/lib/systemd/system
|
||||
systemduserunitpath=${systemduserconfdir}:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:${systemduserunitdir}:/usr/lib/systemd/user:/usr/share/systemd/user
|
||||
systemdsystemgeneratordir=${rootprefix}/lib/systemd/system-generators
|
||||
systemdusergeneratordir=${prefix}/lib/systemd/user-generators
|
||||
systemdsystemgeneratorpath=/run/systemd/system-generators:/etc/systemd/system-generators:/usr/local/lib/systemd/system-generators:${systemdsystemgeneratordir}
|
||||
systemdusergeneratorpath=/run/systemd/user-generators:/etc/systemd/user-generators:/usr/local/lib/systemd/user-generators:${systemdusergeneratordir}
|
||||
systemdsleepdir=${rootprefix}/lib/systemd/system-sleep
|
||||
systemdshutdowndir=${rootprefix}/lib/systemd/system-shutdown
|
||||
tmpfilesdir=${prefix}/lib/tmpfiles.d
|
||||
sysusersdir=${prefix}/lib/sysusers.d
|
||||
sysctldir=${prefix}/lib/sysctl.d
|
||||
binfmtdir=${prefix}/lib/binfmt.d
|
||||
modulesloaddir=${prefix}/lib/modules-load.d
|
||||
catalogdir=${prefix}/lib/systemd/catalog
|
||||
systemuidmax=@systemuidmax@
|
||||
systemgidmax=@systemgidmax@
|
||||
dynamicuidmin=@dynamicuidmin@
|
||||
dynamicuidmax=@dynamicuidmax@
|
||||
containeruidbasemin=@containeruidbasemin@
|
||||
containeruidbasemax=@containeruidbasemax@
|
||||
root_prefix=@rootprefix_noslash@
|
||||
rootprefix=${root_prefix}
|
||||
sysconf_dir=@sysconfdir@
|
||||
sysconfdir=${sysconf_dir}
|
||||
|
||||
systemd_util_dir=${root_prefix}/lib/systemd
|
||||
systemdutildir=${systemd_util_dir}
|
||||
|
||||
systemd_system_unit_dir=${rootprefix}/lib/systemd/system
|
||||
systemdsystemunitdir=${systemd_system_unit_dir}
|
||||
|
||||
systemd_system_preset_dir=${rootprefix}/lib/systemd/system-preset
|
||||
systemdsystempresetdir=${systemd_system_preset_dir}
|
||||
|
||||
systemd_user_unit_dir=${prefix}/lib/systemd/user
|
||||
systemduserunitdir=${systemd_user_unit_dir}
|
||||
|
||||
systemd_user_preset_dir=${prefix}/lib/systemd/user-preset
|
||||
systemduserpresetdir=${systemd_user_preset_dir}
|
||||
|
||||
systemd_system_conf_dir=${sysconfdir}/systemd/system
|
||||
systemdsystemconfdir=${systemd_system_conf_dir}
|
||||
|
||||
systemd_user_conf_dir=${sysconfdir}/systemd/user
|
||||
systemduserconfdir=${systemd_user_conf_dir}
|
||||
|
||||
systemd_system_unit_path=${systemd_system_conf_dir}:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:${systemd_system_unit_dir}:/usr/lib/systemd/system:/lib/systemd/system
|
||||
systemdsystemunitpath=${systemd_system_unit_path}
|
||||
|
||||
systemd_user_unit_path=${systemd_user_conf_dir}:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:${systemd_user_unit_dir}:/usr/lib/systemd/user:/usr/share/systemd/user
|
||||
systemduserunitpath=${systemd_user_unit_path}
|
||||
|
||||
systemd_system_generator_dir=${root_prefix}/lib/systemd/system-generators
|
||||
systemdsystemgeneratordir=${systemd_system_generator_dir}
|
||||
|
||||
systemd_user_generator_dir=${prefix}/lib/systemd/user-generators
|
||||
systemdusergeneratordir=${systemd_user_generator_dir}
|
||||
|
||||
systemd_system_generator_path=/run/systemd/system-generators:/etc/systemd/system-generators:/usr/local/lib/systemd/system-generators:${systemd_system_generator_dir}
|
||||
systemdsystemgeneratorpath=${systemd_system_generator_path}
|
||||
|
||||
systemd_user_generator_path=/run/systemd/user-generators:/etc/systemd/user-generators:/usr/local/lib/systemd/user-generators:${systemd_user_generator_dir}
|
||||
systemdusergeneratorpath=${systemd_user_generator_path}
|
||||
|
||||
systemd_sleep_dir=${root_prefix}/lib/systemd/system-sleep
|
||||
systemdsleepdir=${systemd_sleep_dir}
|
||||
|
||||
systemd_shutdown_dir=${root_prefix}/lib/systemd/system-shutdown
|
||||
systemdshutdowndir=${systemd_shutdown_dir}
|
||||
|
||||
tmpfiles_dir=${prefix}/lib/tmpfiles.d
|
||||
tmpfilesdir=${tmpfiles_dir}
|
||||
|
||||
sysusers_dir=${prefix}/lib/sysusers.d
|
||||
sysusersdir=${sysusers_dir}
|
||||
|
||||
sysctl_dir=${prefix}/lib/sysctl.d
|
||||
sysctldir=${sysctl_dir}
|
||||
|
||||
binfmt_dir=${prefix}/lib/binfmt.d
|
||||
binfmtdir=${binfmt_dir}
|
||||
|
||||
modules_load_dir=${prefix}/lib/modules-load.d
|
||||
modulesloaddir=${modules_load_dir}
|
||||
|
||||
catalog_dir=${prefix}/lib/systemd/catalog
|
||||
catalogdir=${catalog_dir}
|
||||
|
||||
system_uid_max=@systemuidmax@
|
||||
systemuidmax=${system_uid_max}
|
||||
system_gid_max=@systemgidmax@
|
||||
systemgidmax=${system_gid_max}
|
||||
|
||||
dynamic_uid_min=@dynamicuidmin@
|
||||
dynamicuidmin=${dynamic_uid_min}
|
||||
dynamic_uid_max=@dynamicuidmax@
|
||||
dynamicuidmax=${dynamic_uid_max}
|
||||
|
||||
container_uid_base_min=@containeruidbasemin@
|
||||
containeruidbasemin=${container_uid_base_min}
|
||||
container_uid_base_max=@containeruidbasemax@
|
||||
containeruidbasemax=${container_uid_base_max}
|
||||
|
||||
Name: systemd
|
||||
Description: systemd System and Service Manager
|
||||
|
|
|
@ -20,7 +20,7 @@ static int environment_dirs(char ***ret) {
|
|||
return -ENOMEM;
|
||||
|
||||
/* ~/.config/systemd/environment.d */
|
||||
r = sd_path_home(SD_PATH_USER_CONFIGURATION, "environment.d", &c);
|
||||
r = sd_path_lookup(SD_PATH_USER_CONFIGURATION, "environment.d", &c);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "sd-dhcp-lease.h"
|
||||
|
||||
#include "conf-parser.h"
|
||||
#include "def.h"
|
||||
#include "set.h"
|
||||
#include "strv.h"
|
||||
|
||||
|
@ -66,5 +65,3 @@ int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t
|
|||
|
||||
/* It is not necessary to add deserialize_dhcp_option(). Use unhexmem() instead. */
|
||||
int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t size);
|
||||
|
||||
#define NETWORK_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/network"))
|
||||
|
|
|
@ -697,3 +697,9 @@ global:
|
|||
sd_event_source_send_child_signal;
|
||||
sd_journal_open_namespace;
|
||||
} LIBSYSTEMD_243;
|
||||
|
||||
LIBSYSTEMD_246 {
|
||||
global:
|
||||
sd_path_lookup;
|
||||
sd_path_lookup_strv;
|
||||
} LIBSYSTEMD_245;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
#include "path-lookup.h"
|
||||
#include "path-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
|
@ -318,32 +319,122 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
|
|||
|
||||
case SD_PATH_USER_DESKTOP:
|
||||
return from_user_dir("XDG_DESKTOP_DIR", buffer, ret);
|
||||
|
||||
case SD_PATH_SYSTEMD_UTIL_DIR:
|
||||
*ret = ROOTPREFIX "lib/systemd";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SYSTEM_UNIT_DIR:
|
||||
*ret = SYSTEM_DATA_UNIT_PATH;
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SYSTEM_PRESET_DIR:
|
||||
*ret = ROOTPREFIX "lib/systemd/system-preset";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_USER_UNIT_DIR:
|
||||
*ret = USER_DATA_UNIT_DIR;
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_USER_PRESET_DIR:
|
||||
*ret = ROOTPREFIX "lib/systemd/user-preset";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SYSTEM_CONF_DIR:
|
||||
*ret = SYSTEM_CONFIG_UNIT_DIR;
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_USER_CONF_DIR:
|
||||
*ret = USER_CONFIG_UNIT_DIR;
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SYSTEM_GENERATOR_DIR:
|
||||
*ret = SYSTEM_GENERATOR_DIR;
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_USER_GENERATOR_DIR:
|
||||
*ret = USER_GENERATOR_DIR;
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SLEEP_DIR:
|
||||
*ret = ROOTPREFIX "lib/systemd/system-sleep";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSTEMD_SHUTDOWN_DIR:
|
||||
*ret = ROOTPREFIX "lib/systemd/system-shutdown";
|
||||
return 0;
|
||||
|
||||
/* FIXME: systemd.pc uses ${prefix}, but CONF_PATHS_NULSTR doesn't.
|
||||
* Should ${prefix} use in systemd.pc be removed? */
|
||||
case SD_PATH_TMPFILES_DIR:
|
||||
*ret = "/usr/lib/tmpfiles.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSUSERS_DIR:
|
||||
*ret = "/usr/lib/sysusers.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_SYSCTL_DIR:
|
||||
*ret = "/usr/lib/sysctl.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_BINFMT_DIR:
|
||||
*ret = "/usr/lib/binfmt.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_MODULES_LOAD_DIR:
|
||||
*ret = "/usr/lib/modules-load.d";
|
||||
return 0;
|
||||
|
||||
case SD_PATH_CATALOG_DIR:
|
||||
*ret = "/usr/lib/systemd/catalog";
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
_public_ int sd_path_home(uint64_t type, const char *suffix, char **path) {
|
||||
static int get_path_alloc(uint64_t type, const char *suffix, char **path) {
|
||||
_cleanup_free_ char *buffer = NULL;
|
||||
char *buffer2 = NULL;
|
||||
const char *ret;
|
||||
char *cc;
|
||||
int r;
|
||||
|
||||
assert(path);
|
||||
|
||||
r = get_path(type, &buffer, &ret);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (suffix) {
|
||||
suffix += strspn(suffix, "/");
|
||||
buffer2 = path_join(ret, suffix);
|
||||
if (!buffer2)
|
||||
return -ENOMEM;
|
||||
} else if (!buffer) {
|
||||
buffer = strdup(ret);
|
||||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
*path = buffer2 ?: TAKE_PTR(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ int sd_path_lookup(uint64_t type, const char *suffix, char **path) {
|
||||
int r;
|
||||
|
||||
assert_return(path, -EINVAL);
|
||||
|
||||
if (IN_SET(type,
|
||||
SD_PATH_SEARCH_BINARIES,
|
||||
SD_PATH_SEARCH_BINARIES_DEFAULT,
|
||||
SD_PATH_SEARCH_LIBRARY_PRIVATE,
|
||||
SD_PATH_SEARCH_LIBRARY_ARCH,
|
||||
SD_PATH_SEARCH_SHARED,
|
||||
SD_PATH_SEARCH_CONFIGURATION_FACTORY,
|
||||
SD_PATH_SEARCH_STATE_FACTORY,
|
||||
SD_PATH_SEARCH_CONFIGURATION)) {
|
||||
r = get_path_alloc(type, suffix, path);
|
||||
if (r != -EOPNOTSUPP)
|
||||
return r;
|
||||
|
||||
/* Fall back to sd_path_lookup_strv */
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
char *buffer;
|
||||
|
||||
r = sd_path_search(type, suffix, &l);
|
||||
r = sd_path_lookup_strv(type, suffix, &l);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
@ -351,31 +442,7 @@ _public_ int sd_path_home(uint64_t type, const char *suffix, char **path) {
|
|||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
|
||||
*path = TAKE_PTR(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = get_path(type, &buffer, &ret);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!suffix) {
|
||||
if (!buffer) {
|
||||
buffer = strdup(ret);
|
||||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
*path = TAKE_PTR(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
suffix += strspn(suffix, "/");
|
||||
cc = path_join(ret, suffix);
|
||||
if (!cc)
|
||||
return -ENOMEM;
|
||||
|
||||
*path = TAKE_PTR(cc);
|
||||
*path = buffer;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -454,6 +521,7 @@ static int search_from_environment(
|
|||
#endif
|
||||
|
||||
static int get_search(uint64_t type, char ***list) {
|
||||
int r;
|
||||
|
||||
assert(list);
|
||||
|
||||
|
@ -536,58 +604,69 @@ static int get_search(uint64_t type, char ***list) {
|
|||
"/etc",
|
||||
NULL);
|
||||
|
||||
case SD_PATH_SEARCH_BINARIES_DEFAULT: {
|
||||
char **t;
|
||||
case SD_PATH_SEARCH_BINARIES_DEFAULT:
|
||||
return strv_from_nulstr(list, DEFAULT_PATH_NULSTR);
|
||||
|
||||
t = strv_split_nulstr(DEFAULT_PATH_NULSTR);
|
||||
case SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH:
|
||||
case SD_PATH_SYSTEMD_USER_UNIT_PATH: {
|
||||
_cleanup_(lookup_paths_free) LookupPaths lp = {};
|
||||
const UnitFileScope scope = type == SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH ?
|
||||
UNIT_FILE_SYSTEM : UNIT_FILE_USER;
|
||||
|
||||
r = lookup_paths_init(&lp, scope, 0, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
*list = TAKE_PTR(lp.search_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
case SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH:
|
||||
case SD_PATH_SYSTEMD_USER_GENERATOR_PATH: {
|
||||
char **t;
|
||||
const UnitFileScope scope = type == SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH ?
|
||||
UNIT_FILE_SYSTEM : UNIT_FILE_USER;
|
||||
|
||||
t = generator_binary_paths(scope);
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
|
||||
*list = t;
|
||||
return 0;
|
||||
}}
|
||||
}
|
||||
|
||||
case SD_PATH_SYSTEMD_NETWORK_PATH:
|
||||
return strv_from_nulstr(list, NETWORK_DIRS_NULSTR);
|
||||
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
_public_ int sd_path_search(uint64_t type, const char *suffix, char ***paths) {
|
||||
char **i, **j;
|
||||
_public_ int sd_path_lookup_strv(uint64_t type, const char *suffix, char ***paths) {
|
||||
_cleanup_strv_free_ char **l = NULL, **n = NULL;
|
||||
int r;
|
||||
|
||||
assert_return(paths, -EINVAL);
|
||||
|
||||
if (!IN_SET(type,
|
||||
SD_PATH_SEARCH_BINARIES,
|
||||
SD_PATH_SEARCH_BINARIES_DEFAULT,
|
||||
SD_PATH_SEARCH_LIBRARY_PRIVATE,
|
||||
SD_PATH_SEARCH_LIBRARY_ARCH,
|
||||
SD_PATH_SEARCH_SHARED,
|
||||
SD_PATH_SEARCH_CONFIGURATION_FACTORY,
|
||||
SD_PATH_SEARCH_STATE_FACTORY,
|
||||
SD_PATH_SEARCH_CONFIGURATION)) {
|
||||
r = get_search(type, &l);
|
||||
if (r == -EOPNOTSUPP) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
char *p;
|
||||
|
||||
r = sd_path_home(type, suffix, &p);
|
||||
r = get_path_alloc(type, suffix, &t);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
l = new(char*, 2);
|
||||
if (!l) {
|
||||
free(p);
|
||||
if (!l)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
l[0] = p;
|
||||
l[0] = TAKE_PTR(t);
|
||||
l[1] = NULL;
|
||||
|
||||
*paths = TAKE_PTR(l);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = get_search(type, &l);
|
||||
if (r < 0)
|
||||
} else if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!suffix) {
|
||||
|
@ -599,7 +678,7 @@ _public_ int sd_path_search(uint64_t type, const char *suffix, char ***paths) {
|
|||
if (!n)
|
||||
return -ENOMEM;
|
||||
|
||||
j = n;
|
||||
char **i, **j = n;
|
||||
STRV_FOREACH(i, l) {
|
||||
*j = path_join(*i, suffix);
|
||||
if (!*j)
|
||||
|
@ -607,8 +686,8 @@ _public_ int sd_path_search(uint64_t type, const char *suffix, char ***paths) {
|
|||
|
||||
j++;
|
||||
}
|
||||
|
||||
*j = NULL;
|
||||
|
||||
*paths = TAKE_PTR(n);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "network-internal.h"
|
||||
#include "networkd-manager.h"
|
||||
#include "nlmon.h"
|
||||
#include "path-lookup.h"
|
||||
#include "siphash24.h"
|
||||
#include "stat-util.h"
|
||||
#include "string-table.h"
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "networkd-network-bus.h"
|
||||
#include "networkd-speed-meter.h"
|
||||
#include "ordered-set.h"
|
||||
#include "path-lookup.h"
|
||||
#include "path-util.h"
|
||||
#include "set.h"
|
||||
#include "signal-util.h"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "networkd-manager.h"
|
||||
#include "networkd-network.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-lookup.h"
|
||||
#include "set.h"
|
||||
#include "socket-util.h"
|
||||
#include "stat-util.h"
|
||||
|
|
|
@ -58,6 +58,31 @@ static const char* const path_table[_SD_PATH_MAX] = {
|
|||
[SD_PATH_SEARCH_CONFIGURATION_FACTORY] = "search-configuration-factory",
|
||||
[SD_PATH_SEARCH_STATE_FACTORY] = "search-state-factory",
|
||||
[SD_PATH_SEARCH_CONFIGURATION] = "search-configuration",
|
||||
|
||||
[SD_PATH_SYSTEMD_UTIL_DIR] = "systemd-util-dir",
|
||||
[SD_PATH_SYSTEMD_SYSTEM_UNIT_DIR] = "systemd-system-unit-dir",
|
||||
[SD_PATH_SYSTEMD_SYSTEM_PRESET_DIR] = "systemd-system-preset-dir",
|
||||
[SD_PATH_SYSTEMD_USER_UNIT_DIR] = "systemd-user-unit-dir",
|
||||
[SD_PATH_SYSTEMD_USER_PRESET_DIR] = "systemd-user-preset-dir",
|
||||
[SD_PATH_SYSTEMD_SYSTEM_CONF_DIR] = "systemd-system-conf-dir",
|
||||
[SD_PATH_SYSTEMD_USER_CONF_DIR] = "systemd-user-conf-dir",
|
||||
[SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH] = "systemd-system-unit-path",
|
||||
[SD_PATH_SYSTEMD_USER_UNIT_PATH] = "systemd-user-unit-path",
|
||||
[SD_PATH_SYSTEMD_SYSTEM_GENERATOR_DIR] = "systemd-system-generator-dir",
|
||||
[SD_PATH_SYSTEMD_USER_GENERATOR_DIR] = "systemd-user-generator-dir",
|
||||
[SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH] = "systemd-system-generator-path",
|
||||
[SD_PATH_SYSTEMD_USER_GENERATOR_PATH] = "systemd-user-generator-path",
|
||||
[SD_PATH_SYSTEMD_SLEEP_DIR] = "systemd-sleep-dir",
|
||||
[SD_PATH_SYSTEMD_SHUTDOWN_DIR] = "systemd-shutdown-dir",
|
||||
|
||||
[SD_PATH_TMPFILES_DIR] = "tmpfiles-dir",
|
||||
[SD_PATH_SYSUSERS_DIR] = "sysusers-dir",
|
||||
[SD_PATH_SYSCTL_DIR] = "sysctl-dir",
|
||||
[SD_PATH_BINFMT_DIR] = "binfmt-dir",
|
||||
[SD_PATH_MODULES_LOAD_DIR] = "modules-load-dir",
|
||||
[SD_PATH_CATALOG_DIR] = "catalog-dir",
|
||||
|
||||
[SD_PATH_SYSTEMD_NETWORK_PATH] = "systemd-network-path",
|
||||
};
|
||||
|
||||
static int list_homes(void) {
|
||||
|
@ -68,11 +93,11 @@ static int list_homes(void) {
|
|||
_cleanup_free_ char *p = NULL;
|
||||
int q;
|
||||
|
||||
q = sd_path_home(i, arg_suffix, &p);
|
||||
if (q == -ENXIO)
|
||||
continue;
|
||||
q = sd_path_lookup(i, arg_suffix, &p);
|
||||
if (q < 0) {
|
||||
log_error_errno(r, "Failed to query %s: %m", path_table[i]);
|
||||
log_full_errno(q == -ENXIO ? LOG_DEBUG : LOG_ERR,
|
||||
q, "Failed to query %s: %m", path_table[i]);
|
||||
if (q != -ENXIO)
|
||||
r = q;
|
||||
continue;
|
||||
}
|
||||
|
@ -91,7 +116,7 @@ static int print_home(const char *n) {
|
|||
if (streq(path_table[i], n)) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
r = sd_path_home(i, arg_suffix, &p);
|
||||
r = sd_path_lookup(i, arg_suffix, &p);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to query %s: %m", n);
|
||||
|
||||
|
@ -126,7 +151,6 @@ static int help(void) {
|
|||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
enum {
|
||||
ARG_VERSION = 0x100,
|
||||
ARG_SUFFIX,
|
||||
|
|
|
@ -160,8 +160,6 @@ shared_sources = files('''
|
|||
output-mode.h
|
||||
pager.c
|
||||
pager.h
|
||||
path-lookup.c
|
||||
path-lookup.h
|
||||
pe-header.h
|
||||
pkcs11-util.c
|
||||
pkcs11-util.h
|
||||
|
|
|
@ -12,6 +12,7 @@ _systemd_headers = '''
|
|||
sd-journal.h
|
||||
sd-login.h
|
||||
sd-messages.h
|
||||
sd-path.h
|
||||
'''.split()
|
||||
|
||||
# https://github.com/mesonbuild/meson/issues/1633
|
||||
|
@ -30,7 +31,6 @@ _not_installed_headers = '''
|
|||
sd-ndisc.h
|
||||
sd-netlink.h
|
||||
sd-network.h
|
||||
sd-path.h
|
||||
sd-radv.h
|
||||
sd-resolve.h
|
||||
sd-utf8.h
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef struct {
|
|||
} sd_bus_error;
|
||||
|
||||
typedef struct {
|
||||
const char* name;
|
||||
const char *name;
|
||||
int code;
|
||||
} sd_bus_error_map;
|
||||
|
||||
|
@ -180,10 +180,10 @@ int sd_bus_start(sd_bus *bus);
|
|||
int sd_bus_try_close(sd_bus *bus) _sd_deprecated_; /* deprecated */
|
||||
void sd_bus_close(sd_bus *bus);
|
||||
|
||||
sd_bus *sd_bus_ref(sd_bus *bus);
|
||||
sd_bus *sd_bus_unref(sd_bus *bus);
|
||||
sd_bus *sd_bus_close_unref(sd_bus *bus);
|
||||
sd_bus *sd_bus_flush_close_unref(sd_bus *bus);
|
||||
sd_bus* sd_bus_ref(sd_bus *bus);
|
||||
sd_bus* sd_bus_unref(sd_bus *bus);
|
||||
sd_bus* sd_bus_close_unref(sd_bus *bus);
|
||||
sd_bus* sd_bus_flush_close_unref(sd_bus *bus);
|
||||
|
||||
void sd_bus_default_flush_close(void);
|
||||
|
||||
|
@ -216,7 +216,7 @@ void* sd_bus_get_current_userdata(sd_bus *bus);
|
|||
|
||||
int sd_bus_attach_event(sd_bus *bus, sd_event *e, int priority);
|
||||
int sd_bus_detach_event(sd_bus *bus);
|
||||
sd_event *sd_bus_get_event(sd_bus *bus);
|
||||
sd_event* sd_bus_get_event(sd_bus *bus);
|
||||
|
||||
int sd_bus_get_n_queued_read(sd_bus *bus, uint64_t *ret);
|
||||
int sd_bus_get_n_queued_write(sd_bus *bus, uint64_t *ret);
|
||||
|
@ -240,8 +240,8 @@ sd_bus_slot* sd_bus_slot_ref(sd_bus_slot *slot);
|
|||
sd_bus_slot* sd_bus_slot_unref(sd_bus_slot *slot);
|
||||
|
||||
sd_bus* sd_bus_slot_get_bus(sd_bus_slot *slot);
|
||||
void *sd_bus_slot_get_userdata(sd_bus_slot *slot);
|
||||
void *sd_bus_slot_set_userdata(sd_bus_slot *slot, void *userdata);
|
||||
void* sd_bus_slot_get_userdata(sd_bus_slot *slot);
|
||||
void* sd_bus_slot_set_userdata(sd_bus_slot *slot, void *userdata);
|
||||
int sd_bus_slot_set_description(sd_bus_slot *slot, const char *description);
|
||||
int sd_bus_slot_get_description(sd_bus_slot *slot, const char **description);
|
||||
int sd_bus_slot_get_floating(sd_bus_slot *slot);
|
||||
|
@ -251,7 +251,7 @@ int sd_bus_slot_get_destroy_callback(sd_bus_slot *s, sd_bus_destroy_t *callback)
|
|||
|
||||
sd_bus_message* sd_bus_slot_get_current_message(sd_bus_slot *slot);
|
||||
sd_bus_message_handler_t sd_bus_slot_get_current_handler(sd_bus_slot *slot);
|
||||
void *sd_bus_slot_get_current_userdata(sd_bus_slot *slot);
|
||||
void* sd_bus_slot_get_current_userdata(sd_bus_slot *slot);
|
||||
|
||||
/* Message object */
|
||||
|
||||
|
@ -278,21 +278,21 @@ int sd_bus_message_get_expect_reply(sd_bus_message *m);
|
|||
int sd_bus_message_get_auto_start(sd_bus_message *m);
|
||||
int sd_bus_message_get_allow_interactive_authorization(sd_bus_message *m);
|
||||
|
||||
const char *sd_bus_message_get_signature(sd_bus_message *m, int complete);
|
||||
const char *sd_bus_message_get_path(sd_bus_message *m);
|
||||
const char *sd_bus_message_get_interface(sd_bus_message *m);
|
||||
const char *sd_bus_message_get_member(sd_bus_message *m);
|
||||
const char *sd_bus_message_get_destination(sd_bus_message *m);
|
||||
const char *sd_bus_message_get_sender(sd_bus_message *m);
|
||||
const sd_bus_error *sd_bus_message_get_error(sd_bus_message *m);
|
||||
const char* sd_bus_message_get_signature(sd_bus_message *m, int complete);
|
||||
const char* sd_bus_message_get_path(sd_bus_message *m);
|
||||
const char* sd_bus_message_get_interface(sd_bus_message *m);
|
||||
const char* sd_bus_message_get_member(sd_bus_message *m);
|
||||
const char* sd_bus_message_get_destination(sd_bus_message *m);
|
||||
const char* sd_bus_message_get_sender(sd_bus_message *m);
|
||||
const sd_bus_error* sd_bus_message_get_error(sd_bus_message *m);
|
||||
int sd_bus_message_get_errno(sd_bus_message *m);
|
||||
|
||||
int sd_bus_message_get_monotonic_usec(sd_bus_message *m, uint64_t *usec);
|
||||
int sd_bus_message_get_realtime_usec(sd_bus_message *m, uint64_t *usec);
|
||||
int sd_bus_message_get_seqnum(sd_bus_message *m, uint64_t* seqnum);
|
||||
int sd_bus_message_get_seqnum(sd_bus_message *m, uint64_t *seqnum);
|
||||
|
||||
sd_bus* sd_bus_message_get_bus(sd_bus_message *m);
|
||||
sd_bus_creds *sd_bus_message_get_creds(sd_bus_message *m); /* do not unref the result */
|
||||
sd_bus_creds* sd_bus_message_get_creds(sd_bus_message *m); /* do not unref the result */
|
||||
|
||||
int sd_bus_message_is_signal(sd_bus_message *m, const char *interface, const char *member);
|
||||
int sd_bus_message_is_method_call(sd_bus_message *m, const char *interface, const char *member);
|
||||
|
@ -387,8 +387,8 @@ int sd_bus_match_signal_async(sd_bus *bus, sd_bus_slot **ret, const char *sender
|
|||
/* Credential handling */
|
||||
|
||||
int sd_bus_creds_new_from_pid(sd_bus_creds **ret, pid_t pid, uint64_t creds_mask);
|
||||
sd_bus_creds *sd_bus_creds_ref(sd_bus_creds *c);
|
||||
sd_bus_creds *sd_bus_creds_unref(sd_bus_creds *c);
|
||||
sd_bus_creds* sd_bus_creds_ref(sd_bus_creds *c);
|
||||
sd_bus_creds* sd_bus_creds_unref(sd_bus_creds *c);
|
||||
uint64_t sd_bus_creds_get_mask(const sd_bus_creds *c);
|
||||
uint64_t sd_bus_creds_get_augmented_mask(const sd_bus_creds *c);
|
||||
|
||||
|
@ -486,8 +486,8 @@ sd_bus_track* sd_bus_track_ref(sd_bus_track *track);
|
|||
sd_bus_track* sd_bus_track_unref(sd_bus_track *track);
|
||||
|
||||
sd_bus* sd_bus_track_get_bus(sd_bus_track *track);
|
||||
void *sd_bus_track_get_userdata(sd_bus_track *track);
|
||||
void *sd_bus_track_set_userdata(sd_bus_track *track, void *userdata);
|
||||
void* sd_bus_track_get_userdata(sd_bus_track *track);
|
||||
void* sd_bus_track_set_userdata(sd_bus_track *track, void *userdata);
|
||||
|
||||
int sd_bus_track_add_sender(sd_bus_track *track, sd_bus_message *m);
|
||||
int sd_bus_track_remove_sender(sd_bus_track *track, sd_bus_message *m);
|
||||
|
|
|
@ -78,11 +78,38 @@ enum {
|
|||
SD_PATH_SEARCH_STATE_FACTORY,
|
||||
SD_PATH_SEARCH_CONFIGURATION,
|
||||
|
||||
/* Various systemd paths, generally mirroring systemd.pc */
|
||||
SD_PATH_SYSTEMD_UTIL_DIR,
|
||||
SD_PATH_SYSTEMD_SYSTEM_UNIT_DIR,
|
||||
SD_PATH_SYSTEMD_SYSTEM_PRESET_DIR,
|
||||
SD_PATH_SYSTEMD_USER_UNIT_DIR,
|
||||
SD_PATH_SYSTEMD_USER_PRESET_DIR,
|
||||
SD_PATH_SYSTEMD_SYSTEM_CONF_DIR,
|
||||
SD_PATH_SYSTEMD_USER_CONF_DIR,
|
||||
SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH,
|
||||
SD_PATH_SYSTEMD_USER_UNIT_PATH,
|
||||
SD_PATH_SYSTEMD_SYSTEM_GENERATOR_DIR,
|
||||
SD_PATH_SYSTEMD_USER_GENERATOR_DIR,
|
||||
SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH,
|
||||
SD_PATH_SYSTEMD_USER_GENERATOR_PATH,
|
||||
SD_PATH_SYSTEMD_SLEEP_DIR,
|
||||
SD_PATH_SYSTEMD_SHUTDOWN_DIR,
|
||||
|
||||
SD_PATH_TMPFILES_DIR,
|
||||
SD_PATH_SYSUSERS_DIR,
|
||||
SD_PATH_SYSCTL_DIR,
|
||||
SD_PATH_BINFMT_DIR,
|
||||
SD_PATH_MODULES_LOAD_DIR,
|
||||
SD_PATH_CATALOG_DIR,
|
||||
|
||||
/* systemd-networkd search paths */
|
||||
SD_PATH_SYSTEMD_NETWORK_PATH,
|
||||
|
||||
_SD_PATH_MAX,
|
||||
};
|
||||
|
||||
int sd_path_home(uint64_t type, const char *suffix, char **path);
|
||||
int sd_path_search(uint64_t type, const char *suffix, char ***paths);
|
||||
int sd_path_lookup(uint64_t type, const char *suffix, char **path);
|
||||
int sd_path_lookup_strv(uint64_t type, const char *suffix, char ***paths);
|
||||
|
||||
_SD_END_DECLARATIONS;
|
||||
|
||||
|
|
|
@ -778,6 +778,10 @@ tests += [
|
|||
[],
|
||||
[]],
|
||||
|
||||
[['src/test/test-sd-path.c'],
|
||||
[],
|
||||
[]],
|
||||
|
||||
[['src/test/test-local-addresses.c'],
|
||||
[],
|
||||
[]],
|
||||
|
|
|
@ -55,7 +55,7 @@ static void test_basic_mask_and_enable(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/dev/null"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/a.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/a.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
|
@ -74,7 +74,7 @@ static void test_basic_mask_and_enable(const char *root) {
|
|||
assert_se(unit_file_unmask(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_UNLINK);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/a.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/a.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -83,7 +83,7 @@ static void test_basic_mask_and_enable(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -102,7 +102,7 @@ static void test_basic_mask_and_enable(const char *root) {
|
|||
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_UNLINK);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -123,7 +123,7 @@ static void test_basic_mask_and_enable(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -138,7 +138,7 @@ static void test_basic_mask_and_enable(const char *root) {
|
|||
assert_se(unit_file_reenable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("b.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 2);
|
||||
assert_se(changes[0].type == UNIT_FILE_UNLINK);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/a.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/a.service"));
|
||||
|
@ -196,7 +196,7 @@ static void test_linked_units(const char *root) {
|
|||
p = strjoina(root, "/usr/lib/systemd/system/linked2.service");
|
||||
assert_se(symlink("/opt/linked2.service", p) >= 0);
|
||||
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked3.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked3.service");
|
||||
assert_se(symlink("/opt/linked3.service", p) >= 0);
|
||||
|
||||
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "linked.service", &state) == -ENOENT);
|
||||
|
@ -208,7 +208,7 @@ static void test_linked_units(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/opt/linked.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -219,7 +219,7 @@ static void test_linked_units(const char *root) {
|
|||
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_UNLINK);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -229,8 +229,8 @@ static void test_linked_units(const char *root) {
|
|||
/* Now, let's not just link it, but also enable it */
|
||||
assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 2);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/linked.service");
|
||||
q = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service");
|
||||
q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
|
||||
for (i = 0 ; i < n_changes; i++) {
|
||||
assert_se(changes[i].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[i].source, "/opt/linked.service"));
|
||||
|
@ -251,8 +251,8 @@ static void test_linked_units(const char *root) {
|
|||
/* And let's unlink it again */
|
||||
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 2);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/linked.service");
|
||||
q = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service");
|
||||
q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
|
||||
for (i = 0; i < n_changes; i++) {
|
||||
assert_se(changes[i].type == UNIT_FILE_UNLINK);
|
||||
|
||||
|
@ -271,8 +271,8 @@ static void test_linked_units(const char *root) {
|
|||
|
||||
assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("linked2.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 2);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/linked2.service");
|
||||
q = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/linked2.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked2.service");
|
||||
q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked2.service");
|
||||
for (i = 0 ; i < n_changes; i++) {
|
||||
assert_se(changes[i].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[i].source, "/opt/linked2.service"));
|
||||
|
@ -325,7 +325,7 @@ static void test_default(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/test-default-real.target"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH "/" SPECIAL_DEFAULT_TARGET);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR "/" SPECIAL_DEFAULT_TARGET);
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -355,7 +355,7 @@ static void test_add_dependency(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/real-add-dependency-test-service.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/real-add-dependency-test-target.target.wants/real-add-dependency-test-service.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/real-add-dependency-test-target.target.wants/real-add-dependency-test-service.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -396,7 +396,7 @@ static void test_template_enable(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/template@def.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@def.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -427,7 +427,7 @@ static void test_template_enable(const char *root) {
|
|||
assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/template@foo.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@foo.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -460,7 +460,7 @@ static void test_template_enable(const char *root) {
|
|||
assert_se(unit_file_enable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("template-symlink@quux.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/template@quux.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@quux.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -506,7 +506,7 @@ static void test_indirect(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/indirectb.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/indirectb.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -518,7 +518,7 @@ static void test_indirect(const char *root) {
|
|||
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_UNLINK);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/indirectb.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -559,7 +559,7 @@ static void test_preset_and_list(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/preset-yes.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/preset-yes.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -570,7 +570,7 @@ static void test_preset_and_list(const char *root) {
|
|||
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_UNLINK);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/preset-yes.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -590,7 +590,7 @@ static void test_preset_and_list(const char *root) {
|
|||
|
||||
assert_se(n_changes > 0);
|
||||
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/preset-yes.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service");
|
||||
|
||||
for (i = 0; i < n_changes; i++) {
|
||||
|
||||
|
@ -655,7 +655,7 @@ static void test_revert(const char *root) {
|
|||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/xx.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/xx.service");
|
||||
assert_se(write_string_file(p, "# Empty override\n", WRITE_STRING_FILE_CREATE) >= 0);
|
||||
|
||||
/* Revert the override file */
|
||||
|
@ -666,7 +666,7 @@ static void test_revert(const char *root) {
|
|||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/xx.service.d/dropin.conf");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/xx.service.d/dropin.conf");
|
||||
assert_se(mkdir_parents(p, 0755) >= 0);
|
||||
assert_se(write_string_file(p, "# Empty dropin\n", WRITE_STRING_FILE_CREATE) >= 0);
|
||||
|
||||
|
@ -676,7 +676,7 @@ static void test_revert(const char *root) {
|
|||
assert_se(changes[0].type == UNIT_FILE_UNLINK);
|
||||
assert_se(streq(changes[0].path, p));
|
||||
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/xx.service.d");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/xx.service.d");
|
||||
assert_se(changes[1].type == UNIT_FILE_UNLINK);
|
||||
assert_se(streq(changes[1].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
|
@ -715,7 +715,7 @@ static void test_preset_order(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/prefix-1.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/prefix-1.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/prefix-1.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -777,7 +777,7 @@ static void test_with_dropin(const char *root) {
|
|||
|
||||
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-1.service", &state) >= 0 && state == UNIT_FILE_DISABLED);
|
||||
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-2.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service");
|
||||
assert_se(write_string_file(p,
|
||||
"[Install]\n"
|
||||
"WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0);
|
||||
|
@ -795,7 +795,7 @@ static void test_with_dropin(const char *root) {
|
|||
"[Install]\n"
|
||||
"WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0);
|
||||
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-3.service.d/dropin.conf");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-3.service.d/dropin.conf");
|
||||
assert_se(mkdir_parents(p, 0755) >= 0);
|
||||
assert_se(write_string_file(p,
|
||||
"[Install]\n"
|
||||
|
@ -808,7 +808,7 @@ static void test_with_dropin(const char *root) {
|
|||
"[Install]\n"
|
||||
"WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0);
|
||||
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-4a.service.d/dropin.conf");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-4a.service.d/dropin.conf");
|
||||
assert_se(mkdir_parents(p, 0755) >= 0);
|
||||
assert_se(write_string_file(p,
|
||||
"[Install]\n"
|
||||
|
@ -829,9 +829,9 @@ static void test_with_dropin(const char *root) {
|
|||
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1.service"));
|
||||
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-1.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-1.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-1.service");
|
||||
assert_se(streq(changes[1].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -841,11 +841,11 @@ static void test_with_dropin(const char *root) {
|
|||
assert_se(n_changes == 2);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-2.service"));
|
||||
assert_se(streq(changes[1].source, SYSTEM_CONFIG_UNIT_PATH"/with-dropin-2.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-2.service");
|
||||
assert_se(streq(changes[0].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service"));
|
||||
assert_se(streq(changes[1].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-2.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-2.service");
|
||||
assert_se(streq(changes[1].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -857,9 +857,9 @@ static void test_with_dropin(const char *root) {
|
|||
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3.service"));
|
||||
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-3.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-3.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-3.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-3.service");
|
||||
assert_se(streq(changes[1].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -871,9 +871,9 @@ static void test_with_dropin(const char *root) {
|
|||
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-4a.service"));
|
||||
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-4b.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-4a.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-4a.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-4b.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-4b.service");
|
||||
assert_se(streq(changes[1].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -941,9 +941,9 @@ static void test_with_dropin_template(const char *root) {
|
|||
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1@.service"));
|
||||
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1@.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-1@instance-1.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1@instance-1.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-1@instance-1.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-1@instance-1.service");
|
||||
assert_se(streq(changes[1].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -954,9 +954,9 @@ static void test_with_dropin_template(const char *root) {
|
|||
assert_se(changes[1].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
|
||||
assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-2@instance-1.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-1.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/graphical.target.wants/with-dropin-2@instance-1.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-2@instance-1.service");
|
||||
assert_se(streq(changes[1].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -965,7 +965,7 @@ static void test_with_dropin_template(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-2@instance-2.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-2.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -974,7 +974,7 @@ static void test_with_dropin_template(const char *root) {
|
|||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3@.service"));
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/with-dropin-3@instance-2.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3@instance-2.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -1014,7 +1014,7 @@ static void test_preset_multiple_instances(const char *root) {
|
|||
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "foo@bar0.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
|
||||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_SYMLINK);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/foo@bar0.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -1022,7 +1022,7 @@ static void test_preset_multiple_instances(const char *root) {
|
|||
assert_se(unit_file_disable(UNIT_FILE_SYSTEM, 0, root, STRV_MAKE("foo@bar0.service"), &changes, &n_changes) >= 0);
|
||||
assert_se(n_changes == 1);
|
||||
assert_se(changes[0].type == UNIT_FILE_UNLINK);
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/multi-user.target.wants/foo@bar0.service");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service");
|
||||
assert_se(streq(changes[0].path, p));
|
||||
unit_file_changes_free(changes, n_changes);
|
||||
changes = NULL; n_changes = 0;
|
||||
|
@ -1214,7 +1214,7 @@ int main(int argc, char *argv[]) {
|
|||
p = strjoina(root, "/usr/lib/systemd/system/");
|
||||
assert_se(mkdir_p(p, 0755) >= 0);
|
||||
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_PATH"/");
|
||||
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/");
|
||||
assert_se(mkdir_p(p, 0755) >= 0);
|
||||
|
||||
p = strjoina(root, "/run/systemd/system/");
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include "sd-path.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "tests.h"
|
||||
|
||||
static void test_sd_path_lookup(void) {
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
for (uint64_t i = 0; i < _SD_PATH_MAX; i++) {
|
||||
_cleanup_free_ char *t = NULL, *s = NULL;
|
||||
int r;
|
||||
|
||||
r = sd_path_lookup(i, NULL, &t);
|
||||
if (i == SD_PATH_USER_RUNTIME && r == -ENXIO)
|
||||
continue;
|
||||
assert_se(r == 0);
|
||||
assert_se(t);
|
||||
log_info("%02"PRIu64": \"%s\"", i, t);
|
||||
|
||||
assert_se(sd_path_lookup(i, "suffix", &s) == 0);
|
||||
assert_se(s);
|
||||
log_info("%02"PRIu64": \"%s\"", i, s);
|
||||
assert_se(endswith(s, "/suffix"));
|
||||
}
|
||||
|
||||
char *tt;
|
||||
assert_se(sd_path_lookup(_SD_PATH_MAX, NULL, &tt) == -EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static void test_sd_path_lookup_strv(void) {
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
for (uint64_t i = 0; i < _SD_PATH_MAX; i++) {
|
||||
_cleanup_strv_free_ char **t = NULL, **s = NULL;
|
||||
char **item;
|
||||
int r;
|
||||
|
||||
r = sd_path_lookup_strv(i, NULL, &t);
|
||||
if (i == SD_PATH_USER_RUNTIME && r == -ENXIO)
|
||||
continue;
|
||||
assert_se(r == 0);
|
||||
assert_se(t);
|
||||
log_info("%02"PRIu64":", i);
|
||||
STRV_FOREACH(item, t)
|
||||
log_debug(" %s", *item);
|
||||
|
||||
assert_se(sd_path_lookup_strv(i, "suffix", &s) == 0);
|
||||
assert_se(s);
|
||||
log_info("%02"PRIu64":", i);
|
||||
STRV_FOREACH(item, s) {
|
||||
assert_se(endswith(*item, "/suffix"));
|
||||
log_debug(" %s", *item);
|
||||
}
|
||||
}
|
||||
|
||||
char *tt;
|
||||
assert_se(sd_path_lookup(_SD_PATH_MAX, NULL, &tt) == -EOPNOTSUPP);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
test_sd_path_lookup();
|
||||
test_sd_path_lookup_strv();
|
||||
}
|
|
@ -244,7 +244,7 @@ static int specifier_directory(char specifier, const void *data, const void *use
|
|||
i = PTR_TO_UINT(data);
|
||||
assert(i < ELEMENTSOF(paths_system));
|
||||
|
||||
return sd_path_home(paths[i].type, paths[i].suffix, ret);
|
||||
return sd_path_lookup(paths[i].type, paths[i].suffix, ret);
|
||||
}
|
||||
|
||||
static int log_unresolvable_specifier(const char *filename, unsigned line) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "netlink-util.h"
|
||||
#include "network-internal.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-lookup.h"
|
||||
#include "path-util.h"
|
||||
#include "proc-cmdline.h"
|
||||
#include "random-util.h"
|
||||
|
|
|
@ -2,4 +2,5 @@ Name: udev
|
|||
Description: udev
|
||||
Version: @PROJECT_VERSION@
|
||||
|
||||
udevdir=@udevlibexecdir@
|
||||
udev_dir=@udevlibexecdir@
|
||||
udevdir=${udev_dir}
|
||||
|
|
|
@ -13,10 +13,10 @@ REPO_ROOT=${REPO_ROOT:-$(pwd)}
|
|||
sudo bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse' >>/etc/apt/sources.list"
|
||||
sudo apt-get update -y
|
||||
sudo apt-get build-dep systemd -y
|
||||
sudo apt-get install -y ninja-build python3-pip python3-setuptools
|
||||
sudo apt-get install -y python3-pip python3-setuptools
|
||||
# The following should be dropped when debian packaging has been updated to include them
|
||||
sudo apt-get install -y libfdisk-dev libp11-kit-dev libssl-dev libpwquality-dev
|
||||
pip3 install meson
|
||||
pip3 install ninja meson
|
||||
|
||||
cd $REPO_ROOT
|
||||
export PATH="$HOME/.local/bin/:$PATH"
|
||||
|
|
Loading…
Reference in New Issue