summaryrefslogtreecommitdiffstats
path: root/src/fsck (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Undeprecate commandline params forcequotacheck, fastboot, and forcefsckZbigniew Jędrzejewski-Szmek8 days1-7/+2
| | | | | | | | | Those are historical names, but there is nothing wrong with them. The files on / (/fastboot, /forcefsck, and /forcequotacheck) are problematic because they require a modification of the root file system. But the commandline params work fine. They have the obvious advantage compared to our "modern" option that they are much easier to type without looking up the spelling in the docs. Undeprecate them to avoid unnecessary churn.
* tree-wide: use SPECIAL_BASIC_TARGETAntonio Alvarez Feijoo2024-01-041-1/+1
|
* fsck: use correct errnoMike Yuan2023-12-151-1/+1
|
* process-util: add new FORK_DEATHSIG_SIGKILL flag, rename FORK_DEATHSIG → ↵Lennart Poettering2023-11-021-1/+1
| | | | | | | | | | | | | | | | | | FORK_DEATHSIG_SIGTERM Sometimes it makes sense to hard kill a client if we die. Let's hence add a third FORK_DEATHSIG flag for this purpose: FORK_DEATHSIG_SIGKILL. To make things less confusing this also renames FORK_DEATHSIG to FORK_DEATHSIG_SIGTERM to make clear it sends SIGTERM. We already had FORK_DEATHSIG_SIGINT, hence this makes things nicely symmetric. A bunch of users are switched over for FORK_DEATHSIG_SIGKILL where we know it's safe to abort things abruptly. This should make some kernel cases more robust, since we cannot get confused by signal masks or such. While we are at it, also fix a bunch of bugs where we didn't take FORK_DEATHSIG_SIGINT into account in safe_fork()
* fd-uitl: rename PIPE_EBADF → EBADF_PAIR, and add EBADF_TRIPLETLennart Poettering2023-10-261-1/+1
| | | | | | | | We use it for more than just pipe() arrays. For example also for socketpair(). Hence let's give it a generic name. Also add EBADF_TRIPLET to mirror this for things like stdin/stdout/stderr arrays, which we use a bunch of times.
* meson: move declarations of fsck, firstboot, machine-id-setup, and remount-fsYu Watanabe2023-08-011-0/+8
|
* fsck: use execv_p_ and execl_p_Florian Klink2023-04-171-9/+2
| | | | | Instead of invoking find_executable on our own, use the variants of exec provided by glibc which does this for us.
* fsck: look for fsck binary not just in /sbinFlorian Klink2023-04-151-1/+8
| | | | | | | | | This removes remaining hardcoded occurences of `/sbin/fsck`, and instead uses `find_executable` to find `fsck`. We also use `fsck_exists_for_fstype` to check for the `fsck.*` executable, which also checks in `$PATH`, so it's fair to assume fsck itself is also available.
* src: changed instances of sd_bus_call_method() to bus_call_method() (#26819)OMOJOLA JOSHUA2023-03-151-8/+2
| | | * src: changed instances of sd_bus_call_method() to bus_call_method()
* tree-wide: set FORK_RLIMIT_NOFILE_SAFE flagYu Watanabe2023-02-071-4/+1
| | | | No functional changes, just refactoring.
* tree-wide: introduce PIPE_EBADF macroYu Watanabe2022-12-201-1/+1
|
* tree-wide: use -EBADF also in pipe initializersZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | In some places, initialization is dropped when unnecesary.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* generator: skip fsck if fsck command is missingJonas Kümmerlin2022-09-301-1/+9
| | | | | | | | | | | This is useful for systems which don't have any fsck. We already skip emitting the fsck dependency when the fsck.$fstype helper is missing, but fstab-generator doesn't necessarily know the fstype when handling the root= parameter. Previously, systemd-fsck was started for these mounts and then exited immediately because it couldn't find the fsck.$fstype helper.
* various: reword messageZbigniew Jędrzejewski-Szmek2022-07-221-1/+1
|
* fsck,sulogin: fix cargo-culted commentZbigniew Jędrzejewski-Szmek2022-07-151-1/+1
|
* tree-wide: port various users over to connect_unix_path()Lennart Poettering2022-05-131-8/+5
| | | | Let's make use of our new helper, and thus allow longer paths.
* fsck: no emergency.target on nofail mountsScott Lamb2021-11-101-5/+2
| | | | | Also describe failure behavior more precisely in the manpage. Fixes #20237.
* tree-wide: use sd_device_new_from_stat_rdev() whereever appropriateLennart Poettering2021-02-221-1/+1
|
* tree-wide: fix typoYu Watanabe2021-02-151-1/+1
|
* fsck: make sure we don't read an unitialized variableZbigniew Jędrzejewski-Szmek2021-02-111-8/+7
| | | | | | | | | This use on %n was completely unnecessary: fprintf returns the number of characters written. And the issue was that if fprintf failed for whatever reason, it would not process the %n and m would be unitialized. Rework the code a bit to simplify it. Coverity CID#1444708.
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-01-311-1/+1
| | | | It may be useful when debugging daemons.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: assorted coccinelle fixesFrantisek Sumsal2020-10-091-8/+7
|
* tree-wide: drop stdio.h when stdio-util.h is includedYu Watanabe2019-11-031-1/+0
|
* systemd-fsck: fix systemd-fsck/fsck pipe bad closureBenjamin Bouvier2019-10-181-9/+10
| | | | | | | | | | | | Currently, when console is disabled but progress is tracked, pipe opened for communication between systemd-fsck and fsck may be closed inadvertently (when opening of /dev/console return in error). That lead to finish fsck prematurely (because it receives a SIGPIPE) and so fsck may not check correctly filesystems and do not have time to fix memory corruptions. This commit changes the opening of /dev/console to be done previously to pipe creation and so fix the bug described just above.
* fsck: add logging and fix error codes where appropriateLennart Poettering2019-08-201-6/+5
|
* fsck: split out fsck return code definitions into a header file of its ownLennart Poettering2019-07-041-12/+1
| | | | | This way we can make use of it from other components too, such as systemd-homed.
* fsck: copy out device argument from argv[] before forkingLennart Poettering2019-03-291-1/+6
| | | | | | | | | | | | | | | | | | We nowadays rename our child processes, hence argv[] will be clobbered, let's hence copy the device path to dynamic memory before forking. This is fall-out from 60ffa37a65a96c3af857a3dfc4a6fd47b20cc90e since we now a lot more often end up overriding the argv[] buffer than before, simple because we know what to override. These kind of bugs kinda suck. THere are only two options here: stop overriding argv[] for all cases (or just these cases) or explicitly copying out everything we need in child processes before forking. With this patch I opt for the latter, though I am not 100% convinced this is a great solution. Just a better solution than everything else, i.e. allowing argv[] to remain out of sync with what others see. Fixes: #12135
* fsck: use symbolic names where we have themLennart Poettering2019-01-071-1/+1
|
* tree-wide: Remove O_CLOEXEC from fdopenChris Down2018-12-121-1/+1
| | | | | | | | | | | | fdopen doesn't accept "e", it's ignored. Let's not mislead people into believing that it actually sets O_CLOEXEC. From `man 3 fdopen`: > e (since glibc 2.7): > Open the file with the O_CLOEXEC flag. See open(2) for more information. This flag is ignored for fdopen() As mentioned by @jlebon in #11131.
* tree-wide: invoke rlimit_nofile_safe() before various exec{v,ve,l}() invocationsLennart Poettering2018-12-011-0/+3
| | | | | | | | | | | | | | | | Whenever we invoke external, foreign code from code that has RLIMIT_NOFILE's soft limit bumped to high values, revert it to 1024 first. This is a safety precaution for compatibility with programs using select() which cannot operate with fds > 1024. This commit adds the call to rlimit_nofile_safe() to all invocations of exec{v,ve,l}() and friends that either are in code that we know runs with RLIMIT_NOFILE bumped up (which is PID 1 and all journal code for starters) or that is part of shared code that might end up there. The calls are placed as early as we can in processes invoking a flavour of execve(), but after the last time we do fd manipulations, so that we can still take benefit of the high fd limits for that.
* basic/main-func: propagate all positive return valuesZbigniew Jędrzejewski-Szmek2018-11-201-1/+1
| | | | | | | | | | | | | | | | | | This changes DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE() to propagate positive return values as they were, i.e. stops mapping them all to EXIT_FAILURE. This was suggested in review, but I thought that we only ever return EXIT_FAILURE, so we don't need to propagate multiple return values. I was wrong. Turns out that we already *do* have multiple positive return values, when we call external binaries and propagate the result. systemd-inhibit is one example, and b453c447e0fb4a1e9eccd42120731c1700220b21 actually broke this propagation. This commit fixes it. In systemd-fsck we have the opposite case: we have only one failure value, and the code needs to be adjusted, so that it keeps returning EXIT_FAILURE. All other users of DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE() return <= 1, and are unaffected by this change.
* 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.
* fsck: configure logging before use and define main through macroZbigniew Jędrzejewski-Szmek2018-11-171-60/+36
| | | | | | | There's a slight change in logic: before, when rebooting the machine, we could also request quotacheck (by touching /run/systemd/quotacheck) if the fsck helper set FSCK_ERROR_CORRECTED. This is just a race, and doesn't matter much in practice.
* fsck: use log_device_*()Yu Watanabe2018-10-231-3/+3
|
* tree-wide: port various users over to sockaddr_un_set_path()Lennart Poettering2018-10-151-8/+5
| | | | | CID 1396140 CID 1396141
* tree-wide: do not assign unused return valuesYu Watanabe2018-09-231-2/+1
|
* fsck: use our usual syntax for defining bit masksLennart Poettering2018-08-101-8/+8
|
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-1/+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.
* tree-wide: make use of wait_for_terminate_and_check() at various placesLennart Poettering2018-01-041-21/+12
| | | | | | Using wait_for_terminate_and_check() instead of wait_for_terminate() let's us simplify, shorten and unify the return value checking and logging of waitid(). Hence, let's use it all over the place.
* 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-8/+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.
* 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.