summaryrefslogtreecommitdiff
path: root/src/sysctl
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* binfmt,sysctl,sysuers,tmpfiles: add auto-paging for --cat-config commandsLennart Poettering2018-06-131-0/+13
| | | | | The output of these commands is really long, and already enriched with color. Let's add auto-paging to make this easier to digest.
* Eliminate config_dirs vars which hold a static strvZbigniew Jędrzejewski-Szmek2018-05-071-4/+2
|
* sysctl: add --cat-configZbigniew Jędrzejewski-Szmek2018-04-271-7/+26
|
* 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: use path_hash_ops instead of string_hash_ops whenever we key by a ↵Lennart Poettering2018-02-121-4/+4
| | | | | | path Let's make use of our new hash_ops!
* Use read_line() and LONG_LINE_MAX to read values configuration files.Tiago Salem Herrmann2017-12-131-7/+7
|
* 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.
* exec-util,conf-files: skip non-executable files in execute_directories()Lennart Poettering2017-09-131-1/+1
| | | | Fixes: #6787
* tree-wide: use path_startswith() rather than startswith() where ever that's ↵Lennart Poettering2017-08-091-1/+1
| | | | | | | appropriate When checking path prefixes we really should use the right APIs, just in case people add multiple slashes to their paths...
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* sysctl: minor simplificationLennart Poettering2016-11-021-2/+2
| | | | Let's place only one ternary operator.
* sysctl: no need to check for eof twiceLennart Poettering2016-11-021-1/+1
| | | | | Let's only check for eof once after the fgets(). There's no point in checking EOF before the first read, and twice in each loop.
* sysctl: when failing to process a config line, show line nrLennart Poettering2016-11-021-2/+5
|
* sysctl: split out condition check into its own functionLennart Poettering2016-11-021-12/+20
| | | | This way, we can get rid of a label/goto.
* sysctl: do not fail systemd-sysctl.service if /proc/sys is mounted read-onlyLennart Poettering2016-11-021-5/+12
| | | | | | | | | | Let's make missing write access to /proc/sys non-fatal to the sysctl service. This is a follow-up to 411e869f497c7c7bd0688f1e3500f9043bc56e48 which altered the condition for running the sysctl service to check for /proc/sys/net being writable, accepting that /proc/sys might be read-only. In order to ensure the boot-up stays clean in containers lower the log level for the EROFS errors generated due to this.
* sysctl: configure kernel parameters in the order they occur in each sysctl ↵HATAYAMA Daisuke2016-09-241-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | configuration files (#4205) Currently, systemd-sysctl command configures kernel parameters in each sysctl configuration files in random order due to characteristics of iterator of Hashmap. However, kernel parameters need to be configured in the order they occur in each sysctl configuration files. - For example, consider fs.suid_coredump and kernel.core_pattern. If fs.suid_coredump=2 is configured before kernel.core_pattern= whose default value is "core", then kernel outputs the following message: Unsafe core_pattern used with suid_dumpable=2. Pipe handler or fully qualified core dump path required. Note that the security issue mentioned in this message has already been fixed on recent kernels, so this is just a warning message on such kernels. But it's still confusing to users that this message is output on some boot and not output on another boot. - I don't know but there could be other kernel parameters that are significant in the order they are configured. - The legacy sysctl command configures kernel parameters in the order they occur in each sysctl configuration files. Although I didn't find any official specification explaining this behavior of sysctl command, I don't think there is any meaningful reason to change this behavior, in particular, to the random one. This commit does the change by simply using OrderedHashmap instead of Hashmap.
* 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.
* defs: rework CONF_DIRS_NULSTR() macroLennart Poettering2015-11-101-1/+1
| | | | | | | | | | | | The macro is generically useful for putting together search paths, hence let's make it truly generic, by dropping the implicit ".d" appending it does, and leave that to the caller. Also rename it from CONF_DIRS_NULSTR() to CONF_PATHS_NULSTR(), since it's not strictly about dirs that way, but any kind of file system path. Also, mark CONF_DIR_SPLIT_USR() as internal macro by renaming it to _CONF_PATHS_SPLIT_USR() so that the leading underscore indicates that it's internal.
* treewide: apply errno.cocciMichal Schmidt2015-11-091-2/+1
| | | | with small manual cleanups for style.
* util-lib: move CONF_DIRS_NULSTR definition to def.hLennart Poettering2015-11-031-0/+1
| | | | | | After all, this is not some compiler or C magic, but something very specific to how systemd works, hence let's move it into def.h, and out of macro.h
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* 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-14/+11
| | | | | | 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.
* sysctl: reword warning message a bitLennart Poettering2015-08-051-1/+1
| | | | | Let's make this less dramatic, in order to not confuse people too much making them think that this was something to actually fix.
* sysctl: bump loglevel when attempting to write invalid valuesJan Synacek2015-08-051-1/+1
|
* sysctl: don't propagate ENOENT sysctl optionsLennart Poettering2015-04-241-7/+7
| | | | | | | We shouldn't fail the sysctl service if an option is missing. Previously the warning about this was already downgraded to LOG_DEBUG, but we really shouldn't propagate such errors either.
* sysctl: tweak debug messageZbigniew Jędrzejewski-Szmek2015-03-141-1/+1
|
* sysctl: move property handling to shared/Kay Sievers2015-03-111-55/+11
|
* sysctl: downgrade message about sysctl overrides to debugZbigniew Jędrzejewski-Szmek2015-02-261-1/+1
| | | | | Printing it at info level was tedious. We don't do that for any other overrides.
* sysctl: consider --prefix while parsing the filesUmut Tezduyar Lindskog2015-02-071-16/+14
| | | | | | | | | | | not while applying the parsed sysctl values. Otherwise info "Overwriting earlier assignment of %s in file %s" is visible many times even though the given --prefix doesn't try to set the overridden value. This also optimizes the startup tiny bit since we have udev rules running on network devices and setting sysctl through the rules.
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-1/+1
| | | | | | | | | | | 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: a few more log_*_errno + return simplificationsMichal Schmidt2014-11-281-2/+1
| | | | The one in tmpfiles.c:create_item() even looks like it fixes a bug.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-3/+3
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-281-3/+3
| | | | | | | | | | | | | 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().
* Introduce CONF_DIRS_NULSTR helper to define standard conf dirsJosh Triplett2014-11-261-9/+1
| | | | | | | Several different systemd tools define a nulstr containing a standard series of configuration file directories, in /etc, /run, /usr/local/lib, /usr/lib, and (#ifdef HAVE_SPLIT_USR) /lib. Factor that logic out into a new helper macro, CONF_DIRS_NULSTR.
* sysctl: make --prefix allow all kinds of sysctl pathsDavid Herrmann2014-09-171-6/+14
| | | | | | | | | | | | | | | | | | Currently, we save arguments passed as --prefix directly and compare them later to absolute sysctl file-system paths. That is, you are required to specify arguments to --prefix with leading /proc/sys/. This is kinda uselesss. Furthermore, we replace dots by slashes in the name, which makes it impossible to match on specific sysfs paths that have dots in their name (like netdev names). The intention of this argument is clear, but it never worked as expected. This patch modifies --prefix to accept any kind of sysctl paths. It supports paths prefixed with /proc/sys for compatibility (but drops the erroneous dot->slash conversion), but instead applies normalize_sysctl() which turns any name or path into a proper path. It then appends /proc/sys/ so we can properly use it in matches. Thanks to Jan Synacek <jsynacek@redhat.com> for catching this!
* 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.
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-031-9/+6
| | | | | | | | | | | | | | | | getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
* sysctl: replaces some slashes with dotsZbigniew Jędrzejewski-Szmek2014-04-161-2/+16
| | | | | | | It turns out that plain sysctl understands a.b/c syntax to write to /proc/sys/a/b.c. Support this for compatibility. https://bugs.freedesktop.org/show_bug.cgi?id=77466
* Use strlen even for constant stringsJosh Triplett2014-03-161-1/+1
| | | | | | | | | | | GCC optimizes strlen("string constant") to a constant, even with -O0. Thus, replace patterns like sizeof("string constant")-1 with strlen("string constant") where possible, for clarity. In particular, for expressions intended to add up the lengths of components going into a string, this often makes it clearer that the expression counts the trailing '\0' exactly once, by putting the +1 for the '\0' at the end of the expression, rather than hidden in a sizeof in the middle of the expression.
* shared: add root argument to search_and_fopenMichael Marineau2014-03-141-1/+1
| | | | | | | This adds the same root argument to search_and_fopen that conf_files_list already has. Tools that use those two functions as a pair can now be easily modified to load configuration files from an alternate root filesystem tree.
* Remove unused variablesZbigniew Jędrzejewski-Szmek2014-01-051-1/+0
|
* strv: multiple cleanupsSimon Peeters2014-01-051-5/+1
| | | | | | | | | | - turn strv_merge into strv_extend_strv. appending strv b to the end of strv a instead of creating a new strv - strv_append: remove in favor of strv_extend and strv_push. - strv_remove: write slightly more elegant - strv_remove_prefix: remove unused function - strv_overlap: use strv_contains - strv_printf: STRV_FOREACH handles NULL correctly
* log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering2013-12-241-1/+1
| | | | including it in the log strings
* Remove duplicate includesKarel Zak2013-11-181-1/+0
|
* clients: unify how we invoke getopt_long()Lennart Poettering2013-11-061-4/+11
| | | | | Among other things this makes sure we always expose a --version command and show it in the help texts.
* sysctl: allow overwriting of values specified in "later" filesKay Sievers2013-08-151-8/+8
|
* fileio: in envfiles, do not skip lines following empty linesZbigniew Jędrzejewski-Szmek2013-04-131-1/+1
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=63477