summaryrefslogtreecommitdiff
path: root/src/modules-load
Commit message (Collapse)AuthorAgeFilesLines
* 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: move /proc/cmdline parsing code to proc-cmdline.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: move more file I/O related calls into fileio.[ch]Lennart Poettering2015-10-271-0/+1
|
* 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-1/+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.
* ask-password: add support for caching passwords in the kernel keyringLennart Poettering2015-10-071-1/+1
| | | | | | | | | | | | | This adds support for caching harddisk passwords in the kernel keyring if it is available, thus supporting caching without Plymouth being around. This is also useful for hooking up "gdm-auto-login" with the collected boot-time harddisk password, in order to support gnome keyring passphrase unlocking via the HDD password, if it is the same. Any passwords added to the kernel keyring this way have a timeout of 2.5min at which time they are purged from the kernel.
* util: introduce common version() implementation and use it everywhereLennart Poettering2015-09-291-8/+5
| | | | | | 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.
* modules-load: fix memory leakCristian Rodríguez2015-05-131-1/+1
| | | | | | | | | | | | | | | | | | | ================================================================= ==64281==ERROR: LeakSanitizer: detected memory leaks Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7f623c961c4a in malloc (/usr/lib64/libasan.so.2+0x96c4a) #1 0x5651f79ad34e in malloc_multiply (/home/crrodriguez/scm/systemd/systemd-modules-load+0x2134e) #2 0x5651f79b02d6 in strjoin (/home/crrodriguez/scm/systemd/systemd-modules-load+0x242d6) #3 0x5651f79be1f5 in files_add (/home/crrodriguez/scm/systemd/systemd-modules-load+0x321f5) #4 0x5651f79be6a3 in conf_files_list_strv_internal (/home/crrodriguez/scm/systemd/systemd-modules-load+0x326a3) #5 0x5651f79bea24 in conf_files_list_nulstr (/home/crrodriguez/scm/systemd/systemd-modules-load+0x32a24) #6 0x5651f79ad01a in main (/home/crrodriguez/scm/systemd/systemd-modules-load+0x2101a) #7 0x7f623c11586f in __libc_start_main (/lib64/libc.so.6+0x2086f) SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s). This happens due to the wrong cleanup attribute is used (free vs strv_free)
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-4/+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-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: yet more log_*_errno + return simplificationsMichal Schmidt2014-11-281-4/+2
| | | | | | | | | | | | | Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
* treewide: more log_*_errno() conversions, multiline callsMichal Schmidt2014-11-281-2/+1
| | | | | | | | | | | | Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-4/+4
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-281-4/+4
| | | | | | | | | | | | | 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().
* log: rearrange log function namingLennart Poettering2014-11-271-1/+1
| | | | | | | | | | - Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
* log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering2014-11-271-1/+1
| | | | | | | | | | | | | | | | | | | | log_error_errno() as log calls that take error numbers This change has two benefits: - The format string %m will now resolve to the specified error (or to errno if the specified error is 0. This allows getting rid of a ton of strerror() invocations, a function that is not thread-safe. - The specified error can be passed to the journal in the ERRNO= field. Now of course, we just need somebody to convert all cases of this: log_error("Something happened: %s", strerror(-r)); into thus: log_error_errno(-r, "Something happened: %m");
* 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.
* util: simplify proc_cmdline() to reuse get_process_cmdline()Lennart Poettering2014-11-071-2/+3
| | | | Also, make all parsing of the kernel cmdline non-fatal.
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-031-7/+4
| | | | | | | | | | | | | | | | 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.
* 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.
* util: move more intellegince into parse_proc_cmdline()Lennart Poettering2014-03-061-11/+4
| | | | | Already split variable assignments before invoking the callback. And drop "rd." settings if we are not in an initrd.
* macro: introduce a nice macro for disabling -Wformat-nonliteral temporarilyLennart Poettering2014-02-201-3/+3
|
* load-modules: properly return a failing error code if some module fails to loadLennart Poettering2014-02-181-3/+5
| | | | This is the missing part of b857193b1def5172e3641ca1d5bc9e08ae81aac4.
* Extract looping over /proc/cmdline into a shared functionZbigniew Jędrzejewski-Szmek2014-02-171-29/+9
| | | | | | | In cryptsetup-generator automatic cleanup had to be replaced with manual cleanup, and the code gets a bit longer. But existing code had the issue that it returned negative values from main(), which was wrong, so should be reworked anyway.
* 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-2/+2
| | | | including it in the log strings
* trivial coding style clean upsThomas Hindoe Paaboel Andersen2013-12-031-2/+1
| | | | | | | | | | | | | | - Add space between if/for and the opening parentheses - Place the opening brace on same line as the function (not for udev) From the CODING_STYLE Try to use this: void foo() { } instead of this: void foo() { }
* clients: unify how we invoke getopt_long()Lennart Poettering2013-11-061-5/+15
| | | | | Among other things this makes sure we always expose a --version command and show it in the help texts.
* util: unify reading of /proc/cmdlineLennart Poettering2013-11-061-8/+4
| | | | | | Instead of individually checking for containers in each user do this once in a new call proc_cmdline() that read the file only if we are not in a container.
* modules-load: fix error handlingLennart Poettering2013-10-021-2/+2
|
* move _cleanup_ attribute in front of the typeHarald Hoyer2013-04-181-2/+2
| | | | http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
* 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
* modules-load: there's really no point in mentioning that a certain modules ↵Lennart Poettering2013-03-261-1/+1
| | | | | | | is already loaded After all, this runs in parallel to udev, so there's quite a chance it already is....
* honor SELinux labels, when creating and writing config filesHarald Hoyer2013-02-141-0/+1
| | | | | | | Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
* binfmt,tmpfiles,modules-load,sysctl: rework the various early-boot services ↵Lennart Poettering2013-02-111-57/+124
| | | | | | | | | | | | | | | | | | | that work on .d/ directories This unifies much of the logic behind them: - All four will now ofllow the rule that the earlier file and earlier assignment in the .d/ directories wins. Before, sysctl was the only outlier, where the later setting always won. - All four now support getopt() and --help on the command line. - All four can now handle specification of configuration file names on the command line to apply. The tools will automatically find them, and apply them. Previously only tmpfiles could do that. This is useful for %post scripts in RPMs and suchlike. - This fixes various error path issues in conf_files_list()
* shared: conf-files - add root parameterKay Sievers2013-02-081-1/+1
|
* modules-load: fix memory leak when bailing outZbigniew Jędrzejewski-Szmek2012-12-041-15/+8
| | | | Suggested-by: Mauro Dreissig <mukadr@gmail.com>
* modules-load: initalize files to nullVáclav Pavlín2012-09-211-1/+1
|
* log.h: new log_oom() -> int -ENOMEM, use itShawn Landden2012-07-261-8/+4
| | | | | | 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
* use "Out of memory." consistantly (or with "\n")Shawn Landden2012-07-251-2/+2
| | | | | | | | glibc/glib both use "out of memory" consistantly so maybe we should consider that instead of this. Eliminates one string out of a number of binaries. Also fixes extra newline in udev/scsi_id
* modules-load: fix kernel cmdline parsingMichal Schmidt2012-07-251-2/+2
|
* modules load: rename kernel command line option to (rd.)modules-load=Kay Sievers2012-07-021-2/+2
|
* modules-load: use correct va_list logging functionMichal Schmidt2012-06-281-1/+1
|
* modules-load: fix return valueMichal Schmidt2012-06-281-1/+1
|
* modules-load: don't fail on builtin modules, better printsMichal Schmidt2012-06-271-13/+31
| | | | | | | | Distinguish between non-existing modules, builtin modules, already loaded modules, and modules we load. Only the non-existing ones are treated as errors. https://bugzilla.redhat.com/show_bug.cgi?id=817760