summaryrefslogtreecommitdiff
path: root/src/remount-fs
Commit message (Collapse)AuthorAgeFilesLines
* remount-fs: split out common pattern out to a functionZbigniew Jędrzejewski-Szmek2019-01-031-37/+33
|
* remount-fs: optionally remount / writable, if we are told through an env varLennart Poettering2018-12-181-30/+60
|
* remount-fs: split code for tracking PIDs in hashmapLennart Poettering2018-12-181-18/+29
| | | | Just some refactoring, no change in behaviour.
* remount-fs: use PATH_IN_SET() at one more placeLennart Poettering2018-12-181-2/+1
|
* tree-wide: use FORK_RLIMIT_NOFILE_SAFE wherever possibleLennart Poettering2018-12-011-1/+1
| | | | | | | Similar to the previous commit: in many cases no further fd processing needs to be done in forked of children before execve() or any of its flavours are called. In those case we can use FORK_RLIMIT_NOFILE_SAFE instead.
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-4/+3
| | | | | | | | | | | 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.
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* 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.
* remount-fs: configure logging before use and define main through macroZbigniew Jędrzejewski-Szmek2018-11-171-44/+31
|
* 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.
* process-util: add another fork_safe() flag for enabling LOG_ERR/LOG_WARN loggingLennart Poettering2018-01-041-4/+2
|
* tree-wide: introduce new safe_fork() helper and port everything overLennart Poettering2017-12-251-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new safe_fork() wrapper around fork() and makes use of it everywhere. The new wrapper does a couple of things we previously did manually and separately in a safer, more correct and automatic way: 1. Optionally resets signal handlers/mask in the child 2. Sets a name on all processes we fork off right after forking off (and the patch assigns useful names for all processes we fork off now, following a systematic naming scheme: always enclosed in () – in order to indicate that these are not proper, exec()ed processes, but only forked off children, and if the process is long-running with only our own code, without execve()'ing something else, it gets am "sd-" prefix.) 3. Optionally closes all file descriptors in the child 4. Optionally sets a PR_SET_DEATHSIG to SIGTERM in the child, in a safe way so that the parent dying before this happens being handled safely. 5. Optionally reopens the logs 6. Optionally connects stdin/stdout/stderr to /dev/null 7. Debug logs about the forked off processes.
* 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
* tree-wide: always invoke setmntent() with "re" modeLennart Poettering2016-12-201-1/+1
| | | | Let's make sure O_CLOEXEC is set for the file descriptor.
* core: when determining whether a process exit status is clean, consider ↵Lennart Poettering2016-10-101-1/+1
| | | | | | | | | | | | | | whether it is a command or a daemon SIGTERM should be considered a clean exit code for daemons (i.e. long-running processes, as a daemon without SIGTERM handler may be shut down without issues via SIGTERM still) while it should not be considered a clean exit code for commands (i.e. short-running processes). Let's add two different clean checking modes for this, and use the right one at the appropriate places. Fixes: #4275
* 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.
* remount-fs: modernize coding style a bitLennart Poettering2015-11-171-36/+26
| | | | | | | | | | | | | | | | | | | | a) Use _cleanup_ where it makes sense b) Uniformly use negative errno-style errors internally, convert to EXIT_FAILURE/EXIT_SUCCESS only when actually exiting. c) Use log_oom() where appropriate d) Fix minor memory leak in hashmap addition error path. e) Don't pretend we could continue sensibly on OOM or fork() failure f) Use PR_SET_PDEATHSIG to make sure clients we don't kill on error are cleaned up. g) Make use of STRV_MAKE() where it's pretty to do so. h) Simplify error paths.
* tree-wide: use right cast macros for UIDs, GIDs and PIDsLennart Poettering2015-11-171-2/+2
|
* tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-2/+2
| | | | Sort the includes accoding to the new coding style.
* util-lib: move mount related utility calls to mount-util.[ch]Lennart Poettering2015-10-271-3/+4
|
* tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering2015-06-101-0/+3
| | | | | | | | | | mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
* util: split out signal-util.[ch] from util.[ch]Lennart Poettering2015-05-291-0/+1
| | | | No functional changes.
* Default to /usr/bin/u?mount, configurable, rather than hard-coded /bin/u?mount.Dimitri John Ledkov2015-05-131-5/+5
|
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-2/+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.
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-4/+4
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-1/+1
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-281-1/+1
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt2014-09-151-1/+1
| | | | | | | | | It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
* Introduce _cleanup_endmntent_Zbigniew Jędrzejewski-Szmek2013-10-031-9/+4
|
* Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek2013-04-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
* service: add options RestartPreventExitStatus and SuccessExitStatusLukas Nykryn2012-08-141-1/+1
| | | | | | | | | In some cases, like wrong configuration, restarting after error does not help, so administrator can specify statuses by RestartPreventExitStatus which will not cause restart of a service. Sometimes you have non-standart exit status, so this can be specified by SuccessfulExitStatus.
* log.h: new log_oom() -> int -ENOMEM, use itShawn Landden2012-07-261-1/+1
| | | | | | also a number of minor fixups and bug fixes: spelling, oom errors that didn't print errors, not properly forwarding error codes, few more consistency issues, et cetera
* remount-fs: also remount /usr according to fstabLennart Poettering2012-06-291-2/+3
|
* util: split-out path-util.[ch]Kay Sievers2012-05-081-0/+1
|
* remount: consolidate remount-api-vfs and remount-rootfs into oneLennart Poettering2012-04-242-0/+169
This has the advantage of removing a confusing warning by mount if the root directory is not listed in fstab.