mirror of
https://github.com/systemd/systemd
synced 2024-10-06 16:21:34 +00:00
Merge pull request #32097 from keszybz/sd-notify-cleanups
Small cleanups to sd_notify docs
This commit is contained in:
commit
2aef0ac819
|
@ -41,10 +41,7 @@ static int notify(const char *message) {
|
|||
_cleanup_(closep) int fd = -1;
|
||||
const char *socket_path;
|
||||
|
||||
socket_path = getenv("NOTIFY_SOCKET");
|
||||
if (!socket_path)
|
||||
return 0; /* Not running under systemd? Nothing to do */
|
||||
|
||||
/* Verify the argument first */
|
||||
if (!message)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -52,6 +49,11 @@ static int notify(const char *message) {
|
|||
if (message_length == 0)
|
||||
return -EINVAL;
|
||||
|
||||
/* If the variable is not set, the protocol is a noop */
|
||||
socket_path = getenv("NOTIFY_SOCKET");
|
||||
if (!socket_path)
|
||||
return 0; /* Not set? Nothing to do */
|
||||
|
||||
/* Only AF_UNIX is supported, with path or abstract sockets */
|
||||
if (socket_path[0] != '/' && socket_path[0] != '@')
|
||||
return -EAFNOSUPPORT;
|
||||
|
|
|
@ -944,7 +944,7 @@ manpages = [
|
|||
['systemd-hibernate-resume-generator', '8', [], 'ENABLE_HIBERNATE'],
|
||||
['systemd-hibernate-resume.service',
|
||||
'8',
|
||||
['systemd-hibernate-resume', 'systemd-hibernate-clear.service'],
|
||||
['systemd-hibernate-clear.service', 'systemd-hibernate-resume'],
|
||||
'ENABLE_HIBERNATE'],
|
||||
['systemd-homed.service', '8', ['systemd-homed'], 'ENABLE_HOMED'],
|
||||
['systemd-hostnamed.service', '8', ['systemd-hostnamed'], 'ENABLE_HOSTNAMED'],
|
||||
|
|
|
@ -533,8 +533,8 @@
|
|||
|
||||
<programlisting>
|
||||
sd_notifyf(0, "READY=1\n"
|
||||
"STATUS=Processing requests…\n"
|
||||
"MAINPID=%lu",
|
||||
"STATUS=Processing requests…\n"
|
||||
"MAINPID=%lu",
|
||||
(unsigned long) getpid());</programlisting>
|
||||
</example>
|
||||
|
||||
|
@ -545,7 +545,7 @@ sd_notifyf(0, "READY=1\n"
|
|||
|
||||
<programlisting>
|
||||
sd_notifyf(0, "STATUS=Failed to start up: %s\n"
|
||||
"ERRNO=%i",
|
||||
"ERRNO=%i",
|
||||
strerror_r(errnum, (char[1024]){}, 1024),
|
||||
errnum);</programlisting>
|
||||
</example>
|
||||
|
|
Loading…
Reference in a new issue