summaryrefslogtreecommitdiff
path: root/src/notify
Commit message (Collapse)AuthorAgeFilesLines
* parse-util: make parse_fd() return -EBADFYu Watanabe2023-05-081-2/+0
| | | | | | | | The previous error code -ERANGE is slightly ambiguous, and use more specific one. This also drops unnecessary error handlings. Follow-up for 754d8b9c330150fdb3767491e24975f7dfe2a203 and e652663a043cb80936bb12ad5c87766fc5150c24.
* tree-wide: use parse_fd()David Tardon2023-05-051-4/+4
|
* sd-daemon: add sd_pid_notify_barrier() call and use it in systemd-notifyLennart Poettering2023-05-031-1/+1
| | | | | Previously we'd honour --pid= from the main notification we send, but not from the barrier. This is confusing at best. Let's fix that.
* notify: don't send EXIT_STATUS= notify message from systemd-notifyLennart Poettering2023-05-031-0/+5
| | | | | | | | | | | | | | | | | | | In 623a00020f116d8e9c70608a9e4f7cc978342441 code was added that our various programs send a notification message with their exit status on exit. This is great, but it becomes utterly confusing in systemd-notify, whose primary purpose is to send such messages after all, and sending an implicit one in addition to the primary one is particularly confusing, when debugging things. Let's hence just drop the implicit message. systemd-notify's exit status is after all indicative primarily because sd_notify() failed, and hence it's pretty pointless to then send that fact as another sd_notify() message. (Primary reason for this patch is simply that it confused the hell out of me, when debugging sd_notify() issues) Follow-up for: 623a00020f116d8e9c70608a9e4f7cc978342441
* notify: add support for sending fds with notification messagesLennart Poettering2023-03-291-4/+105
| | | | | This exposes the fd passing we support via sd_pid_notify_with_fds() also via the command line tool systemd-notify.
* notify: add new --exec switch for chaining other commands to systemd-notifyLennart Poettering2023-02-171-3/+56
| | | | | This is useful in tests, so that we can first send a READY message and then continue doing something else without changing PID.
* notify: add --stopping + --reloading switchesLennart Poettering2023-01-101-4/+35
| | | | | | | These wrap RELOADING=1 and STOPPING=1 messages. The former is particularly useful, since we want to insert the MONOTONIC_USEC= field into the message automatically, which is easy from C but harder from shell.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
|
* notify: remove spurious whitespaceLennart Poettering2022-04-011-1/+1
|
* Add implicit sentinel to strv_env_merge()Zbigniew Jędrzejewski-Szmek2021-08-111-1/+1
| | | | Just to make it a tiny bit nicer to use.
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* systemd-notify: Fix return value of --bootedJoerg Behrmann2021-04-011-3/+10
|
* tree-wide: use UINT64_MAX or friendsYu Watanabe2021-03-051-2/+2
|
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-5/+5
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* Introduce sd_notify_barrierKumar Kartikeya Dwivedi2020-05-011-0/+19
| | | | | | | | | | | | | | | This adds the sd_notify_barrier function, to allow users to synchronize against the reception of sd_notify(3) status messages. It acts as a synchronization point, and a successful return gurantees that all previous messages have been consumed by the manager. This can be used to eliminate race conditions where the sending process exits too early for systemd to associate its PID to a cgroup and attribute the status message to a unit correctly. systemd-notify now uses this function for proper notification delivery and be useful for NotifyAccess=all units again in user mode, or in cases where it doesn't have a control process as parent. Fixes: #2739
* notify: beef up --pid= logicLennart Poettering2020-04-301-6/+49
| | | | Prompted by the discussions on #15547.
* notify: add color to --helpLennart Poettering2019-11-281-2/+4
| | | | We do that for most tools now, do so here now, too.
* tree-wide: get rid of strappend()Lennart Poettering2019-07-121-1/+1
| | | | | It's a special case of strjoin(), so no need to keep both. In particular as typing strjoin() is even shoert than strappend().
* Merge pull request #12411 from keszybz/pr/12394Lennart Poettering2019-05-081-0/+1
|\ | | | | run: when emitting the calendarspec warning, use red
| * Enable log colors for most of tools in /usr/binZbigniew Jędrzejewski-Szmek2019-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | When emitting the calendarspec warning we want to see some color. Follow-up for 04220fda5c. Exceptions: - systemctl, because it has a lot hand-crafted coloring - tmpfiles, sysusers, stdio-bridge, etc, because they are also used in services and I'm not sure if this wouldn't mess up something.
* | codespell: fix spelling errorsBen Boeckel2019-04-291-1/+1
|/
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-8/+6
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-1/+1
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* util-lib: move main() definition macros to its own header fileLennart Poettering2018-11-191-0/+1
| | | | | | | | | This way, we can extend the macro a bit with stuff pulled in from other headers without this affecting everything which pulls in macro.h, which is one of our most basic headers. This is just refactoring, no change in behaviour, in prepartion for later changes.
* notify: define main through macroZbigniew Jędrzejewski-Szmek2018-11-171-40/+25
|
* Merge pull request #9783 from poettering/get-user-creds-flagsZbigniew Jędrzejewski-Szmek2018-08-211-1/+1
|\ | | | | beef up get_user_creds() a bit and other improvements
| * user-util: rework get_user_creds()Lennart Poettering2018-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's fold get_user_creds_clean() into get_user_creds(), and introduce a flags argument for it to select "clean" behaviour. This flags parameter also learns to other new flags: - USER_CREDS_SYNTHESIZE_FALLBACK: in this mode the user records for root/nobody are only synthesized as fallback. Normally, the synthesized records take precedence over what is in the user database. With this flag set this is reversed, and the user database takes precedence, and the synthesized records are only used if they are missing there. This flag should be set in cases where doing NSS is deemed safe, and where there's interest in knowing the correct shell, for example if the admin changed root's shell to zsh or suchlike. - USER_CREDS_ALLOW_MISSING: if set, and a UID/GID is specified by numeric value, and there's no user/group record for it accept it anyway. This allows us to fix #9767 This then also ports all users to set the most appropriate flags. Fixes: #9767 [zj: remove one isempty() call]
* | tree-wide: add clickable man page link to all --help textsLennart Poettering2018-08-201-5/+17
|/ | | | | | | | | | This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* notify: add new --uid= commandLennart Poettering2018-01-111-2/+36
| | | | | | | | The new --uid= switch allows selecting the UID from which the notificaiton messages shall originate. This is primarily useful for testing purposes, but might have other uses.
* tree-wide: use !strv_isempty() instead of strv_length() > 0Yu Watanabe2017-12-191-1/+1
|
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* Rename formats-util.h to format-util.hZbigniew Jędrzejewski-Szmek2016-11-071-1/+1
| | | | | | We don't have plural in the name of any other -util files and this inconsistency trips me up every time I try to type this file name from memory. "formats-util" is even hard to pronounce.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-0/+1
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* util: introduce common version() implementation and use it everywhereLennart Poettering2015-09-291-4/+1
| | | | | | This also allows us to drop build.h from a ton of files, hence do so. Since we touched the #includes of those files, let's order them properly according to CODING_STYLE.
* notify: sort header files, follow CODING_STYLELennart Poettering2015-09-221-7/+7
|
* systemd-notify: Always pass a valid pid to sd_pid_notifyBenjamin Robin2015-09-201-1/+1
| | | | | | | | | | If the option --pid was used, take the pid from this option, unless take the parend pid. Using 0 as pid (ucred of systemd-notify) will result 99% of the time in a failure with this error: "Cannot find unit for notify message of PID" Shouldn't we use always the ppid, since the MAINPID is something else ? Signed-off-by: Benjamin Robin <dev@benjarobin.fr>
* notify: log error when sd_pid_notify() == 0Evgeny Vereshchagin2015-09-091-3/+3
|
* shared: add formats-util.hRonny Chevalier2015-04-101-0/+1
|
* tree-wide: there is no ENOTSUP on linuxDavid Herrmann2015-03-131-1/+1
| | | | Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-1/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* notify,firstboot,analyze,run: trim --help output to 80 linesZbigniew Jędrzejewski-Szmek2015-01-271-6/+6
|
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-1/+1
| | | | It corrrectly handles both positive and negative errno values.