summaryrefslogtreecommitdiffstats
path: root/src/basic/signal-util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* signal-util: use common definitions for ignore + default "struct sigaction"Lennart Poettering2024-07-121-5/+11
| | | | | | | | | | We use this at various places, let's unify this in one global constant. This changes flags in crash-handler.c in a tiny irrelevant way: we ask syscalls to be continued on signal arrival, which we previously didn't. But that shouldn't change anything, the only thing we'll do in the relevant process is call raise(), and that's it, hence there definitely are no syscalls to restart or not to restart.
* various: move const ptr indicator to return valueZbigniew Jędrzejewski-Szmek2024-06-191-1/+1
|
* signal-util: make struct timespec constMike Yuan2024-04-031-1/+1
|
* signal-util: imply sentinel -1 in sigprocmask_many() + sigset_add_many() ↵Lennart Poettering2024-02-231-2/+2
| | | | args list
* signal-util: use RET_NERRNO() + RET_GATHER() moreLennart Poettering2024-02-231-15/+9
|
* signal-util: align tableYu Watanabe2023-12-191-29/+29
|
* Include <threads.h> if possible to get thread_local definitionCristian Rodríguez2023-03-061-0/+1
| | | | | | | | | | | | IN C23, thread_local is a reserved keyword and we shall therefore do nothing to redefine it. glibc has it defined for older standard version with the right conditions. v2 by Yu Watanabe: Move the definition to missing_threads.h like the way we define e.g. missing syscalls or missing definitions, and include it by the users. Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
* signal-util: add common implementation for propagating a signalLennart Poettering2022-11-171-0/+18
| | | | | | | i.e. let's add a common logic to be called from a signal handler to raise the passed signal again. Follow-up for: #25399
* tree-wide: use new RET_NERRNO() helper at various placesLennart Poettering2021-11-161-9/+3
|
* signal-util: don't introduce symbols with double underscoresLennart Poettering2021-10-111-4/+4
| | | | | | | | | ANSI C reserves identifiers beginning with an underscore for compiler internal stuff. We already invade that namespace plenty and probably should not. But even going for the doubly underscore prefixed namespace is a bit too much. Let's just rename the offending table as "static_signal_table[]", since it lists the static defined signals rather than the "dynamic" RTSIGMIN/RTSIGMAX signals.
* signal-util: fix typoLennart Poettering2021-07-301-1/+1
| | | | Noticed by @behrmann: https://github.com/systemd/systemd/pull/20156#discussion_r667451006
* signal-util: add helper pop_pending_signal()Lennart Poettering2021-07-081-0/+35
|
* signal-util: make -1 termination of ignore_signals() argument list unnecessaryLennart Poettering2021-02-251-46/+6
| | | | | | | | | | Clean up ignore_signals() + default_signals() + sigaction_many() a bit: make it unnecessary to explicitly terminate the signal list with -1. Merge all three calls into a single function that is just called with slightly different parameters. And eliminate an unnecessary extra iteration in its inner for() loop. No change in behaviour.
* basic/signal-util: drop unneeded extra byte from bufferZbigniew Jędrzejewski-Szmek2021-02-151-1/+1
| | | | | DECIMAL_STR_MAX() already returns +1 for NULL, so no need to do it a second time.
* treewide: tighten variable scope in loops (#18372)Susant Sahani2021-01-271-2/+2
| | | | Also use _cleanup_free_ in one more place.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* signal-util: make sigaction_many_ap a little more conciseRasmus Villemoes2020-11-031-10/+1
| | | | | There's no reason to duplicate the stop condition sig < 0, nor the sigaction() call.
* signal-util: add new helper signal_is_blocked()Lennart Poettering2019-12-041-0/+15
|
* Merge pull request #13936 from keszybz/format-table-uninhibitedAnita Zhang2019-11-061-1/+1
|\ | | | | Output tables at full width if piped
| * basic/signal-util: drop unnecessary parensZbigniew Jędrzejewski-Szmek2019-11-021-1/+1
| |
* | tree-wide: drop stdio.h when stdio-util.h is includedYu Watanabe2019-11-031-1/+0
|/
* 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.
* util: rename signal_from_string_try_harder() to signal_from_string()Yu Watanabe2018-05-031-17/+10
| | | | | Also this makes the new `signal_from_string()` function reject e.g, `SIG3` or `SIG+5`.
* util: make signal_from_string() accept RTMIN, RTMAX, and RTMAX-nYu Watanabe2018-05-031-9/+45
| | | | | | | | | | Before this, `signal_from_string()` accepts simple signal name or RTMIN+n. This makes the function also accept RTMIN, RTMAX, and RTMAX-n. Note that RTMIN+0 is equivalent to RTMIN, and RTMAX-0 is to RTMAX. This also fixes the integer overflow reported by oss-fuzz #8064. https://oss-fuzz.com/v2/testcase-detail/5648573352902656
* 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.
* tree-wide: make use of new STRLEN() macro everywhere (#7639)Lennart Poettering2017-12-141-1/+1
| | | | | Let's employ coccinelle to do this for us. Follow-up for #7625.
* 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.
* tree-wide: use IN_SET where possibleAndreas Rammhold2017-10-021-1/+1
| | | | | In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
* tree-wide: add new SIGNAL_VALID() macro-like function that validates signal ↵Lennart Poettering2016-04-121-1/+1
| | | | | | numbers And port all code over to use it.
* 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.
* tree-wide: use xsprintf() where applicableDaniel Mack2016-01-121-2/+3
| | | | Also add a coccinelle receipt to help with such transitions.
* basic: re-sort includesThomas Hindoe Paaboel Andersen2015-12-011-1/+1
| | | | | My previous patch to only include what we use accidentially placed the added inlcudes in non-sorted order.
* basic: include only what we useThomas Hindoe Paaboel Andersen2015-11-301-1/+5
| | | | | This is a cleaned up result of running iwyu but without forward declarations on src/basic.
* util-lib: move string table stuff into its own string-table.[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-2/+6
|
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-0/+2
| | | | | | | | | | | | | | 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.
* signal-util: fix incorrect argument of va_startRonny Chevalier2015-06-161-1/+1
| | | | | | The last argument of the function before the vargs is "old" not "how". warning: second parameter of ‘va_start’ not last named argument
* everywhere: port everything to sigprocmask_many() and friendsLennart Poettering2015-06-151-2/+2
| | | | | | | | | | | This ports a lot of manual code over to sigprocmask_many() and friends. Also, we now consistly check for sigprocmask() failures with assert_se(), since the call cannot realistically fail unless there's a programming error. Also encloses a few sd_event_add_signal() calls with (void) when we ignore the return values for it knowingly.
* build-sys: split internal basic/ library from shared/Kay Sievers2015-06-111-0/+268
basic/ can be used by everything cannot use anything outside of basic/ libsystemd/ can use basic/ cannot use shared/ shared/ can use libsystemd/