Compare commits
1 Commits
52f3688616
...
51ee6f426e
Author | SHA1 | Date |
---|---|---|
Alex Feyerke | 51ee6f426e |
|
@ -10,7 +10,6 @@
|
||||||
- [Custom Sphinx Extensions](#custom-sphinx-extensions)
|
- [Custom Sphinx Extensions](#custom-sphinx-extensions)
|
||||||
- [directive_roles.py (90% done)](#directive_rolespy-90-done)
|
- [directive_roles.py (90% done)](#directive_rolespy-90-done)
|
||||||
- [external_man_links.py](#external_man_linkspy)
|
- [external_man_links.py](#external_man_linkspy)
|
||||||
- [Includes](#includes)
|
|
||||||
- [Todo:](#todo)
|
- [Todo:](#todo)
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
@ -120,43 +119,7 @@ This is used to create custom sphinx roles to handle external links for man page
|
||||||
`:die-net:`refentrytitle(manvolnum)` will lead to 'http://linux.die.net/man/{manvolnum}/{refentrytitle}'
|
`:die-net:`refentrytitle(manvolnum)` will lead to 'http://linux.die.net/man/{manvolnum}/{refentrytitle}'
|
||||||
a full list of these roles can be found in [external_man_links](source/_ext/external_man_links.py).
|
a full list of these roles can be found in [external_man_links](source/_ext/external_man_links.py).
|
||||||
|
|
||||||
#### Includes
|
## Todo:
|
||||||
|
|
||||||
1. Versions
|
|
||||||
In the Docbook files you may find lines like these: `<xi:include href="version-info.xml" xpointer="v205"/>` which would render into `Added in version 205` in the docs. This is now archived with the existing [sphinx directive ".. versionadded::"](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-versionadded) and represented as `.. versionadded:: 205` in the rst file
|
|
||||||
|
|
||||||
2. Code Snippets
|
|
||||||
These can be included with the [literalinclude directive](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-literalinclude) when living in their own file.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```rst
|
|
||||||
.. literalinclude:: ./check-os-release-simple.py
|
|
||||||
:language: python
|
|
||||||
```
|
|
||||||
|
|
||||||
There is also the option to include a [code block](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-code-block) directly in the rst file.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```rst
|
|
||||||
.. code-block:: sh
|
|
||||||
|
|
||||||
a{sv} 3 One s Eins Two u 2 Yes b true
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Text Snippets
|
|
||||||
|
|
||||||
There are a few xml files were sections of these files are reused in multiple other files. While it is no problem to include a whole other rst file the concept of only including a part of that file is a bit more tricky. You can choose to include text partial that starts after a specific text and also to stop before reaching another text. So we decided it would be best to add start and stop markers to define the section in these source files. These markers are: `.. inclusion-marker-do-not-remove` / ``So that a`<xi:include href="standard-options.xml" xpointer="no-pager" />` turns into:
|
|
||||||
|
|
||||||
```rst
|
|
||||||
.. include:: ./standard-options.rst
|
|
||||||
:start-after: .. inclusion-marker-do-not-remove no-pager
|
|
||||||
:end-before: .. inclusion-end-marker-do-not-remove no-pager
|
|
||||||
```
|
|
||||||
|
|
||||||
## Todo
|
|
||||||
|
|
||||||
An incomplete list.
|
An incomplete list.
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
# Array of XML filenames
|
# Array of XML filenames
|
||||||
files=("sd_journal_get_data" "busctl" "systemd" "journalctl" "os-release")
|
files=("busctl" "systemd" "journalctl" "os-release")
|
||||||
|
|
||||||
# Directory paths
|
# Directory paths
|
||||||
input_dir="../man"
|
input_dir="../man"
|
||||||
|
|
|
@ -315,11 +315,14 @@ def refnamediv(el):
|
||||||
def refsynopsisdiv(el):
|
def refsynopsisdiv(el):
|
||||||
# return '**Synopsis** \n\n' + _make_title(_join_children(el, ' '), 3)
|
# return '**Synopsis** \n\n' + _make_title(_join_children(el, ' '), 3)
|
||||||
s = ""
|
s = ""
|
||||||
s += _make_title('Synopsis', 2, 3)
|
s += '.. only:: html\n\n' + _make_title(_join_children(el, ' — '), 3, 3)
|
||||||
s += '\n\n'
|
s += '\n\n'
|
||||||
s += _join_children(el, ', ')
|
s += '.. only:: man\n\n' + _make_title('Synopsis', 3, 3)
|
||||||
|
s += '\n\n'
|
||||||
|
s += _join_children(el, ' — ')
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
def refname(el):
|
def refname(el):
|
||||||
_has_only_text(el)
|
_has_only_text(el)
|
||||||
return "%s" % el.text
|
return "%s" % el.text
|
||||||
|
@ -432,6 +435,8 @@ def constant(el):
|
||||||
|
|
||||||
|
|
||||||
filename = command
|
filename = command
|
||||||
|
function = command
|
||||||
|
|
||||||
|
|
||||||
def optional(el):
|
def optional(el):
|
||||||
return "[%s]" % _concat(el).strip()
|
return "[%s]" % _concat(el).strip()
|
||||||
|
@ -690,34 +695,6 @@ def screen(el):
|
||||||
def synopsis(el):
|
def synopsis(el):
|
||||||
return _indent(el, 3, "::\n\n", False) + "\n\n"
|
return _indent(el, 3, "::\n\n", False) + "\n\n"
|
||||||
|
|
||||||
def funcsynopsis(el):
|
|
||||||
return _concat(el)
|
|
||||||
|
|
||||||
def funcsynopsisinfo(el):
|
|
||||||
return "``%s``" % _concat(el)
|
|
||||||
|
|
||||||
def funcprototype(el):
|
|
||||||
funcdef = ''.join(el.find('.//funcdef').itertext())
|
|
||||||
params = el.findall('.//paramdef')
|
|
||||||
param_list = [''.join(param.itertext()) for param in params]
|
|
||||||
s = ".. code-block:: \n\n "
|
|
||||||
s += f"{funcdef}("
|
|
||||||
s += ",\n\t".join(param_list)
|
|
||||||
s += ");"
|
|
||||||
return s
|
|
||||||
|
|
||||||
def paramdef(el):
|
|
||||||
return el
|
|
||||||
|
|
||||||
def funcdef(el):
|
|
||||||
return el
|
|
||||||
|
|
||||||
def function(el):
|
|
||||||
return _concat(el).strip()
|
|
||||||
|
|
||||||
def parameter(el):
|
|
||||||
return el
|
|
||||||
|
|
||||||
|
|
||||||
def userinput(el):
|
def userinput(el):
|
||||||
return _indent(el, 3, "\n\n")
|
return _indent(el, 3, "\n\n")
|
||||||
|
|
|
@ -3,16 +3,9 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import argparse
|
import argparse
|
||||||
from typing import List
|
from typing import List, Tuple
|
||||||
from db2rst import convert_xml_to_rst
|
from db2rst import convert_xml_to_rst
|
||||||
|
|
||||||
FILES_USED_FOR_INCLUDES = [
|
|
||||||
'sd_journal_get_data.xml', 'standard-options.xml', 'user-system-options.xml',
|
|
||||||
'common-variables.xml', 'standard-conf.xml', 'libsystemd-pkgconfig.xml', 'threads-aware.xml'
|
|
||||||
]
|
|
||||||
|
|
||||||
INCLUDES_DIR = "includes"
|
|
||||||
|
|
||||||
|
|
||||||
def load_files_from_json(json_path: str) -> List[str]:
|
def load_files_from_json(json_path: str) -> List[str]:
|
||||||
"""
|
"""
|
||||||
|
@ -57,12 +50,8 @@ def process_xml_files_in_directory(dir: str, output_dir: str, specific_file: str
|
||||||
errored (bool, optional): Flag to process only files listed in errors.json. Defaults to False.
|
errored (bool, optional): Flag to process only files listed in errors.json. Defaults to False.
|
||||||
unhandled_only (bool, optional): Flag to process only files listed in successes_with_unhandled_tags.json. Defaults to False.
|
unhandled_only (bool, optional): Flag to process only files listed in successes_with_unhandled_tags.json. Defaults to False.
|
||||||
"""
|
"""
|
||||||
files_output_dir = os.path.join(output_dir, "files")
|
files_output_dir = os.path.join(output_dir, "")
|
||||||
includes_output_dir = os.path.join(output_dir, INCLUDES_DIR)
|
|
||||||
os.makedirs(files_output_dir, exist_ok=True)
|
os.makedirs(files_output_dir, exist_ok=True)
|
||||||
os.makedirs(includes_output_dir, exist_ok=True)
|
|
||||||
|
|
||||||
files_to_process = []
|
|
||||||
|
|
||||||
if errored:
|
if errored:
|
||||||
errors_json_path = os.path.join(output_dir, "errors.json")
|
errors_json_path = os.path.join(output_dir, "errors.json")
|
||||||
|
@ -77,41 +66,29 @@ def process_xml_files_in_directory(dir: str, output_dir: str, specific_file: str
|
||||||
if not files_to_process:
|
if not files_to_process:
|
||||||
print("No files to process from successes_with_unhandled_tags.json. Exiting.")
|
print("No files to process from successes_with_unhandled_tags.json. Exiting.")
|
||||||
return
|
return
|
||||||
elif specific_file:
|
|
||||||
specific_file_path = os.path.join(dir, specific_file)
|
|
||||||
if os.path.isfile(specific_file_path):
|
|
||||||
files_to_process = [specific_file]
|
|
||||||
else:
|
|
||||||
print(f"Error: The file '{
|
|
||||||
specific_file}' does not exist in the directory '{dir}'.")
|
|
||||||
return
|
|
||||||
else:
|
else:
|
||||||
files_to_process = [f for f in os.listdir(dir) if f.endswith(".xml")]
|
if specific_file:
|
||||||
|
print('hi specific file')
|
||||||
errors_json_path = os.path.join(output_dir, "errors.json")
|
specific_file_path = os.path.join(dir, specific_file)
|
||||||
unhandled_json_path = os.path.join(
|
if os.path.isfile(specific_file_path):
|
||||||
output_dir, "successes_with_unhandled_tags.json")
|
files_to_process = [specific_file]
|
||||||
|
else:
|
||||||
existing_errors = []
|
print(f"Error: The file '{
|
||||||
existing_unhandled = []
|
specific_file}' does not exist in the directory '{dir}'.")
|
||||||
|
return
|
||||||
if os.path.exists(errors_json_path):
|
else:
|
||||||
with open(errors_json_path, 'r') as json_file:
|
files_to_process = [f for f in os.listdir(
|
||||||
existing_errors = json.load(json_file)
|
dir) if f.endswith(".xml")]
|
||||||
|
|
||||||
if os.path.exists(unhandled_json_path):
|
|
||||||
with open(unhandled_json_path, 'r') as json_file:
|
|
||||||
existing_unhandled = json.load(json_file)
|
|
||||||
|
|
||||||
updated_errors = []
|
updated_errors = []
|
||||||
updated_successes_with_unhandled_tags = []
|
updated_successes_with_unhandled_tags = []
|
||||||
|
|
||||||
for filename in files_to_process:
|
for filename in files_to_process:
|
||||||
filepath = os.path.join(dir, filename)
|
filepath = os.path.join(dir, filename)
|
||||||
output_subdir = includes_output_dir if filename in FILES_USED_FOR_INCLUDES else files_output_dir
|
|
||||||
print('converting file: ', filename)
|
print('converting file: ', filename)
|
||||||
try:
|
try:
|
||||||
unhandled_tags, error = convert_xml_to_rst(filepath, output_subdir)
|
unhandled_tags, error = convert_xml_to_rst(
|
||||||
|
filepath, files_output_dir)
|
||||||
if error:
|
if error:
|
||||||
result = {
|
result = {
|
||||||
"file": filename,
|
"file": filename,
|
||||||
|
@ -129,12 +106,6 @@ def process_xml_files_in_directory(dir: str, output_dir: str, specific_file: str
|
||||||
}
|
}
|
||||||
if len(unhandled_tags) > 0:
|
if len(unhandled_tags) > 0:
|
||||||
updated_successes_with_unhandled_tags.append(result)
|
updated_successes_with_unhandled_tags.append(result)
|
||||||
|
|
||||||
existing_errors = [
|
|
||||||
entry for entry in existing_errors if entry['file'] != filename]
|
|
||||||
existing_unhandled = [
|
|
||||||
entry for entry in existing_unhandled if entry['file'] != filename]
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
result = {
|
result = {
|
||||||
"file": filename,
|
"file": filename,
|
||||||
|
@ -144,15 +115,27 @@ def process_xml_files_in_directory(dir: str, output_dir: str, specific_file: str
|
||||||
}
|
}
|
||||||
updated_errors.append(result)
|
updated_errors.append(result)
|
||||||
|
|
||||||
if not errored:
|
if not specific_file:
|
||||||
updated_errors += existing_errors
|
if not errored:
|
||||||
|
errors_file_path = os.path.join(output_dir, "errors.json")
|
||||||
|
if os.path.exists(errors_file_path):
|
||||||
|
with open(errors_file_path, 'r') as json_file:
|
||||||
|
existing_errors = json.load(json_file)
|
||||||
|
updated_errors += [
|
||||||
|
entry for entry in existing_errors if entry['file'] not in files_to_process]
|
||||||
|
update_json_file(errors_file_path, updated_errors)
|
||||||
|
|
||||||
if not unhandled_only:
|
if not unhandled_only:
|
||||||
updated_successes_with_unhandled_tags += existing_unhandled
|
successes_with_unhandled_tags_file_path = os.path.join(
|
||||||
|
output_dir, "successes_with_unhandled_tags.json")
|
||||||
update_json_file(errors_json_path, updated_errors)
|
if os.path.exists(successes_with_unhandled_tags_file_path):
|
||||||
update_json_file(unhandled_json_path,
|
with open(successes_with_unhandled_tags_file_path, 'r') as json_file:
|
||||||
updated_successes_with_unhandled_tags)
|
existing_successes_with_unhandled_tags = json.load(
|
||||||
|
json_file)
|
||||||
|
updated_successes_with_unhandled_tags += [
|
||||||
|
entry for entry in existing_successes_with_unhandled_tags if entry['file'] not in files_to_process]
|
||||||
|
update_json_file(successes_with_unhandled_tags_file_path,
|
||||||
|
updated_successes_with_unhandled_tags)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -161,7 +144,7 @@ def main():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--dir", type=str, help="Path to the directory containing XML files.", default="../man")
|
"--dir", type=str, help="Path to the directory containing XML files.", default="../man")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--output", type=str, help="Path to the output directory for results and log files.", default="in-progress")
|
"--output", type=str, help="Path to the output directory for results and log files.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--file", type=str, help="If provided, the script will only process the specified file.", default=None)
|
"--file", type=str, help="If provided, the script will only process the specified file.", default=None)
|
||||||
parser.add_argument("--errored", action='store_true',
|
parser.add_argument("--errored", action='store_true',
|
||||||
|
|
|
@ -15,8 +15,15 @@ busctl(1)
|
||||||
busctl — Introspect the bus
|
busctl — Introspect the bus
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
|
.. only:: html
|
||||||
|
|
||||||
|
``busctl`` [OPTIONS...] [COMMAND] [<NAME>...]
|
||||||
|
=============================================
|
||||||
|
|
||||||
|
.. only:: man
|
||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
########
|
========
|
||||||
|
|
||||||
``busctl`` [OPTIONS...] [COMMAND] [<NAME>...]
|
``busctl`` [OPTIONS...] [COMMAND] [<NAME>...]
|
||||||
|
|
||||||
|
|
|
@ -1,315 +0,0 @@
|
||||||
.. SPDX-License-Identifier: LGPL-2.1-or-later:
|
|
||||||
|
|
||||||
:title: sd_journal_get_data
|
|
||||||
|
|
||||||
:manvolnum: 3
|
|
||||||
|
|
||||||
.. _sd_journal_get_data(3):
|
|
||||||
|
|
||||||
======================
|
|
||||||
sd_journal_get_data(3)
|
|
||||||
======================
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
sd_journal_get_data — sd_journal_enumerate_data — sd_journal_enumerate_available_data — sd_journal_restart_data — SD_JOURNAL_FOREACH_DATA — sd_journal_set_data_threshold — sd_journal_get_data_threshold — Read data fields from the current journal entry
|
|
||||||
###########################################################################################################################################################################################################################################################
|
|
||||||
|
|
||||||
Synopsis
|
|
||||||
########
|
|
||||||
|
|
||||||
``#include <systemd/sd-journal.h>``
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
int sd_journal_get_data(sd_journal *j,
|
|
||||||
const char *field,
|
|
||||||
const void **data,
|
|
||||||
size_t *length);
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
int sd_journal_enumerate_data(sd_journal *j,
|
|
||||||
const void **data,
|
|
||||||
size_t *length);
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
int sd_journal_enumerate_available_data(sd_journal *j,
|
|
||||||
const void **data,
|
|
||||||
size_t *length);
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
void sd_journal_restart_data(sd_journal *j);
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
SD_JOURNAL_FOREACH_DATA(sd_journal *j,
|
|
||||||
const void *data,
|
|
||||||
size_t length);
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
int sd_journal_set_data_threshold(sd_journal *j,
|
|
||||||
size_t sz);
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
int sd_journal_get_data_threshold(sd_journal *j,
|
|
||||||
size_t *sz);
|
|
||||||
|
|
||||||
Description
|
|
||||||
===========
|
|
||||||
|
|
||||||
sd_journal_get_data() gets the data object associated with a specific field
|
|
||||||
from the current journal entry. It takes four arguments: the journal context object, a string with the
|
|
||||||
field name to request, plus a pair of pointers to pointer/size variables where the data object and its
|
|
||||||
size shall be stored in. The field name should be an entry field name. Well-known field names are listed in
|
|
||||||
:ref:`systemd.journal-fields(7)`,
|
|
||||||
but any field can be specified. The returned data is in a read-only memory map and is only valid until
|
|
||||||
the next invocation of sd_journal_get_data(),
|
|
||||||
sd_journal_enumerate_data(),
|
|
||||||
sd_journal_enumerate_available_data(), or when the read pointer is altered. Note
|
|
||||||
that the data returned will be prefixed with the field name and "=". Also note that, by
|
|
||||||
default, data fields larger than 64K might get truncated to 64K. This threshold may be changed and turned
|
|
||||||
off with sd_journal_set_data_threshold() (see below).
|
|
||||||
|
|
||||||
sd_journal_enumerate_data() may be used
|
|
||||||
to iterate through all fields of the current entry. On each
|
|
||||||
invocation the data for the next field is returned. The order of
|
|
||||||
these fields is not defined. The data returned is in the same
|
|
||||||
format as with sd_journal_get_data() and also
|
|
||||||
follows the same life-time semantics.
|
|
||||||
|
|
||||||
sd_journal_enumerate_available_data() is similar to
|
|
||||||
sd_journal_enumerate_data(), but silently skips any fields which may be valid, but
|
|
||||||
are too large or not supported by current implementation.
|
|
||||||
|
|
||||||
sd_journal_restart_data() resets the
|
|
||||||
data enumeration index to the beginning of the entry. The next
|
|
||||||
invocation of sd_journal_enumerate_data()
|
|
||||||
will return the first field of the entry again.
|
|
||||||
|
|
||||||
Note that the SD_JOURNAL_FOREACH_DATA() macro may be used as a handy wrapper
|
|
||||||
around sd_journal_restart_data() and
|
|
||||||
sd_journal_enumerate_available_data().
|
|
||||||
|
|
||||||
Note that these functions will not work before
|
|
||||||
:ref:`sd_journal_next(3)`
|
|
||||||
(or related call) has been called at least once, in order to
|
|
||||||
position the read pointer at a valid entry.
|
|
||||||
|
|
||||||
sd_journal_set_data_threshold() may be
|
|
||||||
used to change the data field size threshold for data returned by
|
|
||||||
sd_journal_get_data(),
|
|
||||||
sd_journal_enumerate_data() and
|
|
||||||
sd_journal_enumerate_unique(). This threshold
|
|
||||||
is a hint only: it indicates that the client program is interested
|
|
||||||
only in the initial parts of the data fields, up to the threshold
|
|
||||||
in size — but the library might still return larger data objects.
|
|
||||||
That means applications should not rely exclusively on this
|
|
||||||
setting to limit the size of the data fields returned, but need to
|
|
||||||
apply an explicit size limit on the returned data as well. This
|
|
||||||
threshold defaults to 64K by default. To retrieve the complete
|
|
||||||
data fields this threshold should be turned off by setting it to
|
|
||||||
0, so that the library always returns the complete data objects.
|
|
||||||
It is recommended to set this threshold as low as possible since
|
|
||||||
this relieves the library from having to decompress large
|
|
||||||
compressed data objects in full.
|
|
||||||
|
|
||||||
sd_journal_get_data_threshold() returns
|
|
||||||
the currently configured data field size threshold.
|
|
||||||
|
|
||||||
Return Value
|
|
||||||
============
|
|
||||||
|
|
||||||
sd_journal_get_data() returns 0 on success or a negative errno-style error
|
|
||||||
code. sd_journal_enumerate_data() and
|
|
||||||
sd_journal_enumerate_available_data() return a positive integer if the next field
|
|
||||||
has been read, 0 when no more fields remain, or a negative errno-style error code.
|
|
||||||
sd_journal_restart_data() doesn't return anything.
|
|
||||||
sd_journal_set_data_threshold() and sd_journal_get_threshold()
|
|
||||||
return 0 on success or a negative errno-style error code.
|
|
||||||
|
|
||||||
Errors
|
|
||||||
------
|
|
||||||
|
|
||||||
Returned errors may indicate the following problems:
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove EINVAL
|
|
||||||
|
|
||||||
.. option:: -EINVAL
|
|
||||||
|
|
||||||
One of the required parameters is ``NULL`` or invalid.
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove EINVAL
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove ECHILD
|
|
||||||
|
|
||||||
.. option:: -ECHILD
|
|
||||||
|
|
||||||
The journal object was created in a different process, library or module instance.
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove ECHILD
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove EADDRNOTAVAIL
|
|
||||||
|
|
||||||
.. option:: -EADDRNOTAVAIL
|
|
||||||
|
|
||||||
The read pointer is not positioned at a valid entry;
|
|
||||||
:ref:`sd_journal_next(3)`
|
|
||||||
or a related call has not been called at least once.
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove EADDRNOTAVAIL
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove ENOENT
|
|
||||||
|
|
||||||
.. option:: -ENOENT
|
|
||||||
|
|
||||||
The current entry does not include the specified field.
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove ENOENT
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove ENOMEM
|
|
||||||
|
|
||||||
.. option:: -ENOMEM
|
|
||||||
|
|
||||||
Memory allocation failed.
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove ENOMEM
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove ENOBUFS
|
|
||||||
|
|
||||||
.. option:: -ENOBUFS
|
|
||||||
|
|
||||||
A compressed entry is too large.
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove ENOBUFS
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove E2BIG
|
|
||||||
|
|
||||||
.. option:: -E2BIG
|
|
||||||
|
|
||||||
The data field is too large for this computer architecture (e.g. above 4 GB on a
|
|
||||||
32-bit architecture).
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove E2BIG
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove EPROTONOSUPPORT
|
|
||||||
|
|
||||||
.. option:: -EPROTONOSUPPORT
|
|
||||||
|
|
||||||
The journal is compressed with an unsupported method or the journal uses an
|
|
||||||
unsupported feature.
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove EPROTONOSUPPORT
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove EBADMSG
|
|
||||||
|
|
||||||
.. option:: -EBADMSG
|
|
||||||
|
|
||||||
The journal is corrupted (possibly just the entry being iterated over).
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove EBADMSG
|
|
||||||
|
|
||||||
.. inclusion-marker-do-not-remove EIO
|
|
||||||
|
|
||||||
.. option:: -EIO
|
|
||||||
|
|
||||||
An I/O error was reported by the kernel.
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. versionadded:: 246
|
|
||||||
|
|
||||||
.. inclusion-end-marker-do-not-remove EIO
|
|
||||||
|
|
||||||
Notes
|
|
||||||
=====
|
|
||||||
|
|
||||||
.. include:: ../includes/threads-aware.rst
|
|
||||||
:start-after: .. inclusion-marker-do-not-remove strict
|
|
||||||
:end-before: .. inclusion-end-marker-do-not-remove strict
|
|
||||||
|
|
||||||
.. include:: ../includes/libsystemd-pkgconfig.rst
|
|
||||||
:start-after: .. inclusion-marker-do-not-remove pkgconfig-text
|
|
||||||
:end-before: .. inclusion-end-marker-do-not-remove pkgconfig-text
|
|
||||||
|
|
||||||
Examples
|
|
||||||
========
|
|
||||||
|
|
||||||
See
|
|
||||||
:ref:`sd_journal_next(3)`
|
|
||||||
for a complete example how to use
|
|
||||||
sd_journal_get_data().
|
|
||||||
|
|
||||||
Use the
|
|
||||||
SD_JOURNAL_FOREACH_DATA() macro to
|
|
||||||
iterate through all fields of the current journal
|
|
||||||
entry:
|
|
||||||
|
|
||||||
.. code-block:: sh
|
|
||||||
|
|
||||||
…
|
|
||||||
int print_fields(sd_journal *j) {
|
|
||||||
const void *data;
|
|
||||||
size_t length;
|
|
||||||
SD_JOURNAL_FOREACH_DATA(j, data, length)
|
|
||||||
printf("%.*s\n", (int) length, data);
|
|
||||||
}
|
|
||||||
…
|
|
||||||
|
|
||||||
History
|
|
||||||
=======
|
|
||||||
|
|
||||||
sd_journal_get_data(),
|
|
||||||
sd_journal_enumerate_data(),
|
|
||||||
sd_journal_restart_data(), and
|
|
||||||
SD_JOURNAL_FOREACH_DATA() were added in version 187.
|
|
||||||
|
|
||||||
sd_journal_set_data_threshold() and
|
|
||||||
sd_journal_get_data_threshold() were added in version 196.
|
|
||||||
|
|
||||||
sd_journal_enumerate_available_data() was added in version 246.
|
|
||||||
|
|
||||||
See Also
|
|
||||||
========
|
|
||||||
|
|
||||||
:ref:`systemd(1)`, :ref:`systemd.journal-fields(7)`, :ref:`sd-journal(3)`, :ref:`sd_journal_open(3)`, :ref:`sd_journal_next(3)`, :ref:`sd_journal_get_realtime_usec(3)`, :ref:`sd_journal_query_unique(3)`
|
|
|
@ -15,8 +15,15 @@ journalctl(1)
|
||||||
journalctl — Print log entries from the systemd journal
|
journalctl — Print log entries from the systemd journal
|
||||||
#######################################################
|
#######################################################
|
||||||
|
|
||||||
|
.. only:: html
|
||||||
|
|
||||||
|
``journalctl`` [OPTIONS...] [MATCHES...]
|
||||||
|
========================================
|
||||||
|
|
||||||
|
.. only:: man
|
||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
########
|
========
|
||||||
|
|
||||||
``journalctl`` [OPTIONS...] [MATCHES...]
|
``journalctl`` [OPTIONS...] [MATCHES...]
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,15 @@ os-release(5)
|
||||||
os-release — initrd-release — extension-release — Operating system identification
|
os-release — initrd-release — extension-release — Operating system identification
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
|
.. only:: html
|
||||||
|
|
||||||
|
``/etc/os-release`` ``/usr/lib/os-release`` ``/etc/initrd-release`` ``/usr/lib/extension-release.d/extension-release.<IMAGE>``
|
||||||
|
==============================================================================================================================
|
||||||
|
|
||||||
|
.. only:: man
|
||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
########
|
========
|
||||||
|
|
||||||
``/etc/os-release``
|
``/etc/os-release``
|
||||||
``/usr/lib/os-release``
|
``/usr/lib/os-release``
|
||||||
|
@ -559,7 +566,7 @@ Reading ``os-release`` in :die-net:`python(1)` (versions >= 3.10)
|
||||||
.. literalinclude:: /code-examples/py/check-os-release-simple.py
|
.. literalinclude:: /code-examples/py/check-os-release-simple.py
|
||||||
:language: python
|
:language: python
|
||||||
|
|
||||||
See docs for `platform.freedesktop_os_release <https://docs.python.org/3/library/platform.html#platform.freedesktop_os_release>`_ for more details.
|
See docs for ```platform.freedesktop_os_release`` <https://docs.python.org/3/library/platform.html#platform.freedesktop_os_release>`_ for more details.
|
||||||
|
|
||||||
Reading ``os-release`` in :die-net:`python(1)` (any version)
|
Reading ``os-release`` in :die-net:`python(1)` (any version)
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|
|
@ -15,10 +15,17 @@ systemd(1)
|
||||||
systemd — init — systemd system and service manager
|
systemd — init — systemd system and service manager
|
||||||
###################################################
|
###################################################
|
||||||
|
|
||||||
Synopsis
|
.. only:: html
|
||||||
########
|
|
||||||
|
|
||||||
``/usr/lib/systemd/systemd`` [OPTIONS...], ``init`` [OPTIONS...] {COMMAND}
|
``/usr/lib/systemd/systemd`` [OPTIONS...] — ``init`` [OPTIONS...] {COMMAND}
|
||||||
|
===========================================================================
|
||||||
|
|
||||||
|
.. only:: man
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
========
|
||||||
|
|
||||||
|
``/usr/lib/systemd/systemd`` [OPTIONS...] — ``init`` [OPTIONS...] {COMMAND}
|
||||||
|
|
||||||
Description
|
Description
|
||||||
===========
|
===========
|
||||||
|
@ -323,7 +330,7 @@ The service listens to various UNIX process signals that can be used to request
|
||||||
asynchronously. The signal handling is enabled very early during boot, before any further processes are
|
asynchronously. The signal handling is enabled very early during boot, before any further processes are
|
||||||
invoked. However, a supervising container manager or similar that intends to request these operations via
|
invoked. However, a supervising container manager or similar that intends to request these operations via
|
||||||
this mechanism must take into consideration that this functionality is not available during the earliest
|
this mechanism must take into consideration that this functionality is not available during the earliest
|
||||||
initialization phase. An sd_notify() notification message carrying the
|
initialization phase. An ``sd_notify()`` notification message carrying the
|
||||||
``X_SYSTEMD_SIGNALS_LEVEL=2`` field is emitted once the signal handlers are enabled, see
|
``X_SYSTEMD_SIGNALS_LEVEL=2`` field is emitted once the signal handlers are enabled, see
|
||||||
below. This may be used to schedule submission of these signals correctly.
|
below. This may be used to schedule submission of these signals correctly.
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ systemd — System and Service Manager
|
||||||
docs/os-release
|
docs/os-release
|
||||||
docs/systemd
|
docs/systemd
|
||||||
docs/systemD-directives
|
docs/systemD-directives
|
||||||
docs/includes/sd_journal_get_data
|
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
==================
|
==================
|
||||||
|
|
|
@ -760,9 +760,8 @@ sensor:modalias:i2c:bmc150_accel:dmi:*:svnLENOVO:*:pvrLenovoYoga300-11IBR:*
|
||||||
sensor:modalias:acpi:ACCL0001*:dmi:*:svnLENOVO:pn60072:pvr851*:*
|
sensor:modalias:acpi:ACCL0001*:dmi:*:svnLENOVO:pn60072:pvr851*:*
|
||||||
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
|
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
|
||||||
|
|
||||||
# IdeaPad Duet 3 10IGL5 (82AT) and 10IGL5-LTE (82HK)
|
# IdeaPad Duet 3 10IGL5 (82AT)
|
||||||
sensor:modalias:acpi:SMO8B30*:dmi:*:svnLENOVO*:pn82AT:*
|
sensor:modalias:acpi:SMO8B30*:dmi:*:svnLENOVO*:pn82AT:*
|
||||||
sensor:modalias:acpi:SMO8B30*:dmi:*:svnLENOVO*:pn82HK:*
|
|
||||||
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
|
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
|
|
|
@ -593,6 +593,8 @@ node /org/freedesktop/systemd1 {
|
||||||
|
|
||||||
<!--method GetJobBefore is not documented!-->
|
<!--method GetJobBefore is not documented!-->
|
||||||
|
|
||||||
|
<!--method SetShowStatus is not documented!-->
|
||||||
|
|
||||||
<!--method ListUnitsFiltered is not documented!-->
|
<!--method ListUnitsFiltered is not documented!-->
|
||||||
|
|
||||||
<!--method ListUnitsByPatterns is not documented!-->
|
<!--method ListUnitsByPatterns is not documented!-->
|
||||||
|
@ -671,6 +673,8 @@ node /org/freedesktop/systemd1 {
|
||||||
|
|
||||||
<!--property ConfirmSpawn is not documented!-->
|
<!--property ConfirmSpawn is not documented!-->
|
||||||
|
|
||||||
|
<!--property ShowStatus is not documented!-->
|
||||||
|
|
||||||
<!--property DefaultStandardOutput is not documented!-->
|
<!--property DefaultStandardOutput is not documented!-->
|
||||||
|
|
||||||
<!--property DefaultStandardError is not documented!-->
|
<!--property DefaultStandardError is not documented!-->
|
||||||
|
@ -1358,24 +1362,6 @@ node /org/freedesktop/systemd1 {
|
||||||
|
|
||||||
<para><function>ResetFailedUnit()</function> resets the "failed" state of a specific unit.</para>
|
<para><function>ResetFailedUnit()</function> resets the "failed" state of a specific unit.</para>
|
||||||
|
|
||||||
<para><function>SetShowStatus()</function> configures the display of status messages during bootup and
|
|
||||||
shutdown. The <varname>mode</varname> parameter can be set to any value that's valid for the
|
|
||||||
<varname>systemd.show_status</varname> kernel parameter. For more information about
|
|
||||||
<varname>systemd.show_status</varname>, see
|
|
||||||
<citerefentry project="man-pages"><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
|
|
||||||
The <varname>mode</varname> parameter can also be set to an empty string. When <varname>mode</varname>
|
|
||||||
is set to an empty string, <function>SetShowStatus()</function> will reset
|
|
||||||
<varname>ShowStatus</varname> back to its original value. You can use
|
|
||||||
<function>SetShowStatus()</function> create a service that does something like this:
|
|
||||||
<orderedlist>
|
|
||||||
<listitem><para>Send a D-Bus message that will turn off status messages.</para></listitem>
|
|
||||||
<listitem><para>Block until a reply to that message is received.</para></listitem>
|
|
||||||
<listitem><para>Print multiples lines without being interrupted by status messages.</para></listitem>
|
|
||||||
<listitem><para>Send a D-Bus message that will reset <varname>ShowStatus</varname> back to its
|
|
||||||
original value.</para></listitem>
|
|
||||||
</orderedlist>
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para><function>ResetFailed()</function> resets the "failed" state of all units.</para>
|
<para><function>ResetFailed()</function> resets the "failed" state of all units.</para>
|
||||||
|
|
||||||
<para><function>ListUnits()</function> returns an array of all currently loaded units. Note that
|
<para><function>ListUnits()</function> returns an array of all currently loaded units. Note that
|
||||||
|
@ -1802,12 +1788,6 @@ node /org/freedesktop/systemd1 {
|
||||||
<para><varname>Environment</varname> encodes the environment block passed to all executed services. It
|
<para><varname>Environment</varname> encodes the environment block passed to all executed services. It
|
||||||
may be altered with bus calls such as <function>SetEnvironment()</function> (see above).</para>
|
may be altered with bus calls such as <function>SetEnvironment()</function> (see above).</para>
|
||||||
|
|
||||||
<para><varname>ShowStatus</varname> encodes systemd's current policy for displaying status messages
|
|
||||||
during bootup and shutdown. Its value can be any valid value for the
|
|
||||||
<varname>systemd.show_status</varname> kernel parameter (see
|
|
||||||
<citerefentry project="man-pages"><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
|
|
||||||
It may be altered using <function>SetShowStatus()</function> (see above).</para>
|
|
||||||
|
|
||||||
<para><varname>UnitPath</varname> encodes the currently active unit file search path. It is an array of
|
<para><varname>UnitPath</varname> encodes the currently active unit file search path. It is an array of
|
||||||
file system paths encoded as strings.</para>
|
file system paths encoded as strings.</para>
|
||||||
|
|
||||||
|
|
|
@ -483,18 +483,18 @@
|
||||||
<term><varname>ExcludeFiles=</varname></term>
|
<term><varname>ExcludeFiles=</varname></term>
|
||||||
<term><varname>ExcludeFilesTarget=</varname></term>
|
<term><varname>ExcludeFilesTarget=</varname></term>
|
||||||
|
|
||||||
<listitem><para>Takes one or more absolute paths, separated by whitespace, each referring to a
|
<listitem><para>Takes an absolute file system path referring to a source file or directory on the
|
||||||
source file or directory on the host. This setting may be used to exclude files or directories from
|
host. This setting may be used to exclude files or directories from the host from being copied into
|
||||||
the host from being copied into the file system when <varname>CopyFiles=</varname> is used. This
|
the file system when <varname>CopyFiles=</varname> is used. This option may be used multiple times to
|
||||||
option may be used multiple times to exclude multiple files or directories from host from being
|
exclude multiple files or directories from host from being copied into the newly formatted file
|
||||||
copied into the newly formatted file system.</para>
|
system.</para>
|
||||||
|
|
||||||
<para>If the path is a directory and ends with <literal>/</literal>, only the directory's
|
<para>If the path is a directory and ends with <literal>/</literal>, only the directory's
|
||||||
contents are excluded but not the directory itself. If the path is a directory and does not end with
|
contents are excluded but not the directory itself. If the path is a directory and does not end with
|
||||||
<literal>/</literal>, both the directory and its contents are excluded.</para>
|
<literal>/</literal>, both the directory and its contents are excluded.</para>
|
||||||
|
|
||||||
<para><varname>ExcludeFilesTarget=</varname> is like <varname>ExcludeFiles=</varname> except that
|
<para><varname>ExcludeFilesTarget=</varname> is like <varname>ExcludeFiles=</varname> except that
|
||||||
instead of excluding the path on the host from being copied into the partition, it exclude any files
|
instead of excluding the path on the host from being copied into the partition, we exclude any files
|
||||||
and directories from being copied into the given path in the partition.</para>
|
and directories from being copied into the given path in the partition.</para>
|
||||||
|
|
||||||
<para>When
|
<para>When
|
||||||
|
@ -922,9 +922,9 @@
|
||||||
target for some other supplement definition. A target cannot have more than one supplement partition
|
target for some other supplement definition. A target cannot have more than one supplement partition
|
||||||
associated with it.</para>
|
associated with it.</para>
|
||||||
|
|
||||||
<para>For example, distributions can use this to implement <varname>$BOOT</varname> as defined in
|
<para>For example, distributions can use this to implement <variable>$BOOT</variable> as defined in
|
||||||
the <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification/">Boot Loader
|
the <ulink url="https://uapi-group.org/specifications/specs/boot_loader_specification/">Boot Loader
|
||||||
Specification</ulink>. Distributions may prefer to use the ESP as <varname>$BOOT</varname> whenever
|
Specification</ulink>. Distributions may prefer to use the ESP as <variable>$BOOT</variable> whenever
|
||||||
possible, but to adhere to the spec XBOOTLDR must sometimes be used instead. So, they should create
|
possible, but to adhere to the spec XBOOTLDR must sometimes be used instead. So, they should create
|
||||||
two definitions: the first defining an ESP big enough to hold just the bootloader, and a second for
|
two definitions: the first defining an ESP big enough to hold just the bootloader, and a second for
|
||||||
the XBOOTLDR that's sufficiently large to hold kernels and configured as a supplement for the ESP.
|
the XBOOTLDR that's sufficiently large to hold kernels and configured as a supplement for the ESP.
|
||||||
|
|
|
@ -3001,12 +3001,7 @@ SystemCallErrorNumber=EPERM</programlisting>
|
||||||
|
|
||||||
<para><option>tty</option> connects standard output to a tty (as configured via <varname>TTYPath=</varname>,
|
<para><option>tty</option> connects standard output to a tty (as configured via <varname>TTYPath=</varname>,
|
||||||
see below). If the TTY is used for output only, the executed process will not become the controlling process of
|
see below). If the TTY is used for output only, the executed process will not become the controlling process of
|
||||||
the terminal, and will not fail or wait for other processes to release the terminal. Note: if a unit
|
the terminal, and will not fail or wait for other processes to release the terminal.</para>
|
||||||
tries to print multiple lines to a TTY during bootup or shutdown, then there's a chance that those
|
|
||||||
lines will be broken up by status messages. <function>SetShowStatus()</function> can be used to
|
|
||||||
prevent this problem. See
|
|
||||||
<citerefentry project="man-pages"><refentrytitle>org.freedesktop.systemd1</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
|
||||||
for details.</para>
|
|
||||||
|
|
||||||
<para><option>journal</option> connects standard output with the journal, which is accessible via
|
<para><option>journal</option> connects standard output with the journal, which is accessible via
|
||||||
<citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. Note
|
<citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. Note
|
||||||
|
|
|
@ -568,11 +568,7 @@
|
||||||
<listitem><para>Enables display of status messages on the
|
<listitem><para>Enables display of status messages on the
|
||||||
console, as controlled via
|
console, as controlled via
|
||||||
<varname>systemd.show_status=1</varname> on the kernel command
|
<varname>systemd.show_status=1</varname> on the kernel command
|
||||||
line.</para>
|
line.</para></listitem>
|
||||||
<para>You may want to use <function>SetShowStatus()</function> instead of
|
|
||||||
<constant>SIGRTMIN+20</constant> in order to prevent race conditions. See
|
|
||||||
<citerefentry project="man-pages"><refentrytitle>org.freedesktop.systemd1</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -583,11 +579,7 @@
|
||||||
controlled via
|
controlled via
|
||||||
<varname>systemd.show_status=0</varname>
|
<varname>systemd.show_status=0</varname>
|
||||||
on the kernel command
|
on the kernel command
|
||||||
line.</para>
|
line.</para></listitem>
|
||||||
<para>You may want to use <function>SetShowStatus()</function> instead of
|
|
||||||
<constant>SIGRTMIN+21</constant> in order to prevent race conditions. See
|
|
||||||
<citerefentry project="man-pages"><refentrytitle>org.freedesktop.systemd1</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|
|
@ -4169,7 +4169,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||||
* detect when the cgroup becomes empty. Note that the control process is always
|
* detect when the cgroup becomes empty. Note that the control process is always
|
||||||
* our child so it's pointless to watch all other processes. */
|
* our child so it's pointless to watch all other processes. */
|
||||||
if (!control_pid_good(s))
|
if (!control_pid_good(s))
|
||||||
if (!s->main_pid_known || s->main_pid_alien || unit_cgroup_delegate(u))
|
if (!s->main_pid_known || s->main_pid_alien)
|
||||||
(void) unit_enqueue_rewatch_pids(u);
|
(void) unit_enqueue_rewatch_pids(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -404,16 +404,15 @@ static int context_set_path_strv(Context *c, char* const* strv, const char *sour
|
||||||
|
|
||||||
static int context_set_plugins(Context *c, const char *s, const char *source) {
|
static int context_set_plugins(Context *c, const char *s, const char *source) {
|
||||||
_cleanup_strv_free_ char **v = NULL;
|
_cleanup_strv_free_ char **v = NULL;
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(c);
|
assert(c);
|
||||||
|
|
||||||
if (c->plugins || !s)
|
if (c->plugins || !s)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = strv_split_full(&v, s, NULL, EXTRACT_UNQUOTE);
|
v = strv_split(s, NULL);
|
||||||
if (r < 0)
|
if (!v)
|
||||||
return log_error_errno(r, "Failed to parse plugin paths from %s: %m", source);
|
return log_oom();
|
||||||
|
|
||||||
return context_set_path_strv(c, v, source, "plugins", &c->plugins);
|
return context_set_path_strv(c, v, source, "plugins", &c->plugins);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,13 +46,7 @@ echo 'DTBDTBDTBDTB' >"$D/sources/subdir/whatever.dtb"
|
||||||
|
|
||||||
export KERNEL_INSTALL_CONF_ROOT="$D/sources"
|
export KERNEL_INSTALL_CONF_ROOT="$D/sources"
|
||||||
# We "install" multiple plugins, but control which ones will be active via install.conf.
|
# We "install" multiple plugins, but control which ones will be active via install.conf.
|
||||||
KERNEL_INSTALL_PLUGINS="'${loaderentry_install}' '${uki_copy_install}'"
|
export KERNEL_INSTALL_PLUGINS="${ukify_install} ${loaderentry_install} ${uki_copy_install}"
|
||||||
if [[ -n "$ukify_install" ]]; then
|
|
||||||
# shellcheck disable=SC2089
|
|
||||||
KERNEL_INSTALL_PLUGINS="'${ukify_install}' $KERNEL_INSTALL_PLUGINS"
|
|
||||||
fi
|
|
||||||
# shellcheck disable=SC2090
|
|
||||||
export KERNEL_INSTALL_PLUGINS
|
|
||||||
export BOOT_ROOT="$D/boot"
|
export BOOT_ROOT="$D/boot"
|
||||||
export BOOT_MNT="$D/boot"
|
export BOOT_MNT="$D/boot"
|
||||||
export MACHINE_ID='3e0484f3634a418b8e6a39e8828b03e3'
|
export MACHINE_ID='3e0484f3634a418b8e6a39e8828b03e3'
|
||||||
|
|
|
@ -1742,9 +1742,8 @@ static int config_parse_exclude_files(
|
||||||
const char *rvalue,
|
const char *rvalue,
|
||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
_cleanup_free_ char *resolved = NULL;
|
||||||
char ***exclude_files = ASSERT_PTR(data);
|
char ***exclude_files = ASSERT_PTR(data);
|
||||||
const char *p = ASSERT_PTR(rvalue);
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
if (isempty(rvalue)) {
|
||||||
|
@ -1752,34 +1751,20 @@ static int config_parse_exclude_files(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
r = specifier_printf(rvalue, PATH_MAX-1, system_and_tmp_specifier_table, arg_root, NULL, &resolved);
|
||||||
_cleanup_free_ char *word = NULL, *resolved = NULL;
|
if (r < 0) {
|
||||||
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
"Failed to expand specifiers in ExcludeFiles= path, ignoring: %s", rvalue);
|
||||||
if (r == -ENOMEM)
|
return 0;
|
||||||
return log_oom();
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", p);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
r = specifier_printf(word, PATH_MAX-1, system_and_tmp_specifier_table, arg_root, NULL, &resolved);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
|
||||||
"Failed to expand specifiers in %s path, ignoring: %s", lvalue, word);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = path_simplify_and_warn(resolved, PATH_CHECK_ABSOLUTE|PATH_KEEP_TRAILING_SLASH, unit, filename, line, lvalue);
|
|
||||||
if (r < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (strv_consume(exclude_files, TAKE_PTR(resolved)) < 0)
|
|
||||||
return log_oom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r = path_simplify_and_warn(resolved, PATH_CHECK_ABSOLUTE|PATH_KEEP_TRAILING_SLASH, unit, filename, line, lvalue);
|
||||||
|
if (r < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (strv_consume(exclude_files, TAKE_PTR(resolved)) < 0)
|
||||||
|
return log_oom();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ _unused_ static void test_compress_stream(const char *compression,
|
||||||
ASSERT_OK(compress(src, dst, -1, &uncompressed_size));
|
ASSERT_OK(compress(src, dst, -1, &uncompressed_size));
|
||||||
|
|
||||||
if (cat) {
|
if (cat) {
|
||||||
assert_se(asprintf(&cmd, "%s %s | diff '%s' -", cat, pattern, srcfile) > 0);
|
assert_se(asprintf(&cmd, "%s %s | diff %s -", cat, pattern, srcfile) > 0);
|
||||||
assert_se(system(cmd) == 0);
|
assert_se(system(cmd) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ _unused_ static void test_compress_stream(const char *compression,
|
||||||
r = decompress(dst, dst2, st.st_size);
|
r = decompress(dst, dst2, st.st_size);
|
||||||
assert_se(r == 0);
|
assert_se(r == 0);
|
||||||
|
|
||||||
assert_se(asprintf(&cmd2, "diff '%s' %s", srcfile, pattern2) > 0);
|
assert_se(asprintf(&cmd2, "diff %s %s", srcfile, pattern2) > 0);
|
||||||
assert_se(system(cmd2) == 0);
|
assert_se(system(cmd2) == 0);
|
||||||
|
|
||||||
log_debug("/* test faulty decompression */");
|
log_debug("/* test faulty decompression */");
|
||||||
|
|
|
@ -52,8 +52,7 @@ static void test_event_spawn_self(const char *self, const char *arg, bool with_p
|
||||||
|
|
||||||
log_debug("/* %s(%s, %s) */", __func__, arg, yes_no(with_pidfd));
|
log_debug("/* %s(%s, %s) */", __func__, arg, yes_no(with_pidfd));
|
||||||
|
|
||||||
/* 'self' may contain spaces, hence needs to be quoted. */
|
assert_se(cmd = strjoin(self, " ", arg));
|
||||||
assert_se(cmd = strjoin("'", self, "' ", arg));
|
|
||||||
|
|
||||||
test_event_spawn_core(with_pidfd, cmd, result_buf, BUF_SIZE);
|
test_event_spawn_core(with_pidfd, cmd, result_buf, BUF_SIZE);
|
||||||
|
|
||||||
|
|
|
@ -4,32 +4,32 @@ set -e
|
||||||
|
|
||||||
ANALYZE="${1:-systemd-analyze}"
|
ANALYZE="${1:-systemd-analyze}"
|
||||||
|
|
||||||
"$ANALYZE" compare-versions 1 lt 2
|
$ANALYZE compare-versions 1 lt 2
|
||||||
"$ANALYZE" compare-versions 1 '<' 2
|
$ANALYZE compare-versions 1 '<' 2
|
||||||
"$ANALYZE" compare-versions 1 le 2
|
$ANALYZE compare-versions 1 le 2
|
||||||
"$ANALYZE" compare-versions 1 '<=' 2
|
$ANALYZE compare-versions 1 '<=' 2
|
||||||
"$ANALYZE" compare-versions 1 ne 2
|
$ANALYZE compare-versions 1 ne 2
|
||||||
"$ANALYZE" compare-versions 1 '!=' 2
|
$ANALYZE compare-versions 1 '!=' 2
|
||||||
( ! "$ANALYZE" compare-versions 1 ge 2 )
|
( ! $ANALYZE compare-versions 1 ge 2 )
|
||||||
( ! "$ANALYZE" compare-versions 1 '>=' 2 )
|
( ! $ANALYZE compare-versions 1 '>=' 2 )
|
||||||
( ! "$ANALYZE" compare-versions 1 eq 2 )
|
( ! $ANALYZE compare-versions 1 eq 2 )
|
||||||
( ! "$ANALYZE" compare-versions 1 '==' 2 )
|
( ! $ANALYZE compare-versions 1 '==' 2 )
|
||||||
( ! "$ANALYZE" compare-versions 1 gt 2 )
|
( ! $ANALYZE compare-versions 1 gt 2 )
|
||||||
( ! "$ANALYZE" compare-versions 1 '>' 2 )
|
( ! $ANALYZE compare-versions 1 '>' 2 )
|
||||||
|
|
||||||
test "$("$ANALYZE" compare-versions 1 2)" = '1 < 2'
|
test "$($ANALYZE compare-versions 1 2)" = '1 < 2'
|
||||||
test "$("$ANALYZE" compare-versions 2 2)" = '2 == 2'
|
test "$($ANALYZE compare-versions 2 2)" = '2 == 2'
|
||||||
test "$("$ANALYZE" compare-versions 2 1)" = '2 > 1'
|
test "$($ANALYZE compare-versions 2 1)" = '2 > 1'
|
||||||
test "$("$ANALYZE" compare-versions '' '')" = "'' == ''"
|
test "$($ANALYZE compare-versions '' '')" = "'' == ''"
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
"$ANALYZE" compare-versions 1 2; ret1=$?
|
$ANALYZE compare-versions 1 2; ret1=$?
|
||||||
"$ANALYZE" compare-versions 2 2; ret2=$?
|
$ANALYZE compare-versions 2 2; ret2=$?
|
||||||
"$ANALYZE" compare-versions 2 1; ret3=$?
|
$ANALYZE compare-versions 2 1; ret3=$?
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
test "$ret1" == 12
|
test $ret1 == 12
|
||||||
test "$ret2" == 0
|
test $ret2 == 0
|
||||||
test "$ret3" == 11
|
test $ret3 == 11
|
||||||
|
|
|
@ -44,9 +44,9 @@ test_one() (
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${input##*/}" =~ \.fstab\.input ]]; then
|
if [[ "${input##*/}" =~ \.fstab\.input ]]; then
|
||||||
SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD="$initrd" SYSTEMD_SYSFS_CHECK=no SYSTEMD_PROC_CMDLINE="fstab=yes root=fstab" SYSTEMD_FSTAB="$input" SYSTEMD_SYSROOT_FSTAB="/dev/null" "$generator" "$out" "$out" "$out"
|
SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD="$initrd" SYSTEMD_SYSFS_CHECK=no SYSTEMD_PROC_CMDLINE="fstab=yes root=fstab" SYSTEMD_FSTAB="$input" SYSTEMD_SYSROOT_FSTAB="/dev/null" $generator "$out" "$out" "$out"
|
||||||
else
|
else
|
||||||
SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD="$initrd" SYSTEMD_SYSFS_CHECK=no SYSTEMD_PROC_CMDLINE="fstab=no $(cat "$input")" "$generator" "$out" "$out" "$out"
|
SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD="$initrd" SYSTEMD_SYSFS_CHECK=no SYSTEMD_PROC_CMDLINE="fstab=no $(cat "$input")" $generator "$out" "$out" "$out"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The option x-systemd.growfs creates symlink to system's systemd-growfs@.service in .mount.wants directory.
|
# The option x-systemd.growfs creates symlink to system's systemd-growfs@.service in .mount.wants directory.
|
||||||
|
|
|
@ -53,7 +53,7 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
|
||||||
echo "*** Running $f"
|
echo "*** Running $f"
|
||||||
prepare_testdir "${f%.input}"
|
prepare_testdir "${f%.input}"
|
||||||
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
|
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
|
||||||
"$SYSUSERS" --root="$TESTDIR"
|
$SYSUSERS --root="$TESTDIR"
|
||||||
|
|
||||||
compare "${f%.*}" ""
|
compare "${f%.*}" ""
|
||||||
done
|
done
|
||||||
|
@ -62,7 +62,7 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
|
||||||
echo "*** Running $f on stdin"
|
echo "*** Running $f on stdin"
|
||||||
prepare_testdir "${f%.input}"
|
prepare_testdir "${f%.input}"
|
||||||
touch "$TESTDIR/etc/sysusers.d/test.conf"
|
touch "$TESTDIR/etc/sysusers.d/test.conf"
|
||||||
"$SYSUSERS" --root="$TESTDIR" - <"$f"
|
$SYSUSERS --root="$TESTDIR" - <"$f"
|
||||||
|
|
||||||
compare "${f%.*}" "on stdin"
|
compare "${f%.*}" "on stdin"
|
||||||
done
|
done
|
||||||
|
@ -72,9 +72,9 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
|
||||||
prepare_testdir "${f%.input}"
|
prepare_testdir "${f%.input}"
|
||||||
touch "$TESTDIR/etc/sysusers.d/test.conf"
|
touch "$TESTDIR/etc/sysusers.d/test.conf"
|
||||||
# this overrides test.conf which is masked on disk
|
# this overrides test.conf which is masked on disk
|
||||||
"$SYSUSERS" --root="$TESTDIR" --replace=/etc/sysusers.d/test.conf - <"$f"
|
$SYSUSERS --root="$TESTDIR" --replace=/etc/sysusers.d/test.conf - <"$f"
|
||||||
# this should be ignored
|
# this should be ignored
|
||||||
"$SYSUSERS" --root="$TESTDIR" --replace=/usr/lib/sysusers.d/test.conf - <"$SOURCE/test-1.input"
|
$SYSUSERS --root="$TESTDIR" --replace=/usr/lib/sysusers.d/test.conf - <"$SOURCE/test-1.input"
|
||||||
|
|
||||||
compare "${f%.*}" "on stdin with --replace"
|
compare "${f%.*}" "on stdin with --replace"
|
||||||
done
|
done
|
||||||
|
@ -84,9 +84,9 @@ echo "*** Testing --inline"
|
||||||
prepare_testdir "$SOURCE/inline"
|
prepare_testdir "$SOURCE/inline"
|
||||||
# copy a random file to make sure it is ignored
|
# copy a random file to make sure it is ignored
|
||||||
cp "$f" "$TESTDIR/etc/sysusers.d/confuse.conf"
|
cp "$f" "$TESTDIR/etc/sysusers.d/confuse.conf"
|
||||||
"$SYSUSERS" --root="$TESTDIR" --inline \
|
$SYSUSERS --root="$TESTDIR" --inline \
|
||||||
"u u1 222 - - /bin/zsh" \
|
"u u1 222 - - /bin/zsh" \
|
||||||
"g g1 111"
|
"g g1 111"
|
||||||
|
|
||||||
compare "$SOURCE/inline" "(--inline)"
|
compare "$SOURCE/inline" "(--inline)"
|
||||||
|
|
||||||
|
@ -95,19 +95,19 @@ echo "*** Testing --inline with --replace"
|
||||||
prepare_testdir "$SOURCE/inline"
|
prepare_testdir "$SOURCE/inline"
|
||||||
# copy a random file to make sure it is ignored
|
# copy a random file to make sure it is ignored
|
||||||
cp "$f" "$TESTDIR/etc/sysusers.d/confuse.conf"
|
cp "$f" "$TESTDIR/etc/sysusers.d/confuse.conf"
|
||||||
"$SYSUSERS" --root="$TESTDIR" \
|
$SYSUSERS --root="$TESTDIR" \
|
||||||
--inline \
|
--inline \
|
||||||
--replace=/etc/sysusers.d/confuse.conf \
|
--replace=/etc/sysusers.d/confuse.conf \
|
||||||
"u u1 222 - - /bin/zsh" \
|
"u u1 222 - - /bin/zsh" \
|
||||||
"g g1 111"
|
"g g1 111"
|
||||||
|
|
||||||
compare "$SOURCE/inline" "(--inline --replace=…)"
|
compare "$SOURCE/inline" "(--inline --replace=…)"
|
||||||
|
|
||||||
echo "*** Testing --inline with no /etc"
|
echo "*** Testing --inline with no /etc"
|
||||||
rm -rf "${TESTDIR:?}/etc"
|
rm -rf "${TESTDIR:?}/etc"
|
||||||
"$SYSUSERS" --root="$TESTDIR" --inline \
|
$SYSUSERS --root="$TESTDIR" --inline \
|
||||||
"u u1 222 - - /bin/zsh" \
|
"u u1 222 - - /bin/zsh" \
|
||||||
"g g1 111"
|
"g g1 111"
|
||||||
|
|
||||||
compare "$SOURCE/inline" "(--inline)"
|
compare "$SOURCE/inline" "(--inline)"
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
|
||||||
echo "*** Running $f (with login.defs)"
|
echo "*** Running $f (with login.defs)"
|
||||||
prepare_testdir "${f%.input}"
|
prepare_testdir "${f%.input}"
|
||||||
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
|
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
|
||||||
"$SYSUSERS" --root="$TESTDIR"
|
$SYSUSERS --root="$TESTDIR"
|
||||||
|
|
||||||
# shellcheck disable=SC2050
|
# shellcheck disable=SC2050
|
||||||
[ @ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES@ = 1 ] && bound=555 || bound=$system_guid_max
|
[ @ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES@ = 1 ] && bound=555 || bound=$system_guid_max
|
||||||
|
@ -152,7 +152,7 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
|
||||||
echo "*** Running $f (with login.defs symlinked)"
|
echo "*** Running $f (with login.defs symlinked)"
|
||||||
prepare_testdir "${f%.input}"
|
prepare_testdir "${f%.input}"
|
||||||
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
|
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
|
||||||
"$SYSUSERS" --root="$TESTDIR"
|
$SYSUSERS --root="$TESTDIR"
|
||||||
|
|
||||||
# shellcheck disable=SC2050
|
# shellcheck disable=SC2050
|
||||||
[ @ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES@ = 1 ] && bound=555 || bound=$system_guid_max
|
[ @ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES@ = 1 ] && bound=555 || bound=$system_guid_max
|
||||||
|
@ -166,7 +166,7 @@ for f in $(find "$SOURCE"/unhappy-*.input | sort -V); do
|
||||||
echo "*** Running test $f"
|
echo "*** Running test $f"
|
||||||
prepare_testdir "${f%.input}"
|
prepare_testdir "${f%.input}"
|
||||||
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
|
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
|
||||||
SYSTEMD_LOG_LEVEL=info "$SYSUSERS" --root="$TESTDIR" 2>&1 | tail -n1 | sed -r 's/^[^:]+:[^:]+://' >"$TESTDIR/err"
|
SYSTEMD_LOG_LEVEL=info $SYSUSERS --root="$TESTDIR" 2>&1 | tail -n1 | sed -r 's/^[^:]+:[^:]+://' >"$TESTDIR/err"
|
||||||
if ! diff -u "$TESTDIR/err" "${f%.*}.expected-err"; then
|
if ! diff -u "$TESTDIR/err" "${f%.*}.expected-err"; then
|
||||||
echo >&2 "**** Unexpected error output for $f"
|
echo >&2 "**** Unexpected error output for $f"
|
||||||
cat >&2 "$TESTDIR/err"
|
cat >&2 "$TESTDIR/err"
|
||||||
|
|
Loading…
Reference in New Issue