summaryrefslogtreecommitdiff
path: root/src/shared
Commit message (Collapse)AuthorAge
* shared: fix log_emergency_errno macroMichal Schmidt2014-11-28
| | | | It was not passing the error argument.
* log: change log_xyz_errno() calls to always return the negative errorLennart Poettering2014-11-28
| | | | | | | | | | | | | | | | This enables us to write things like this: int open_some_file(void) { fd = open("/dev/foobar", O_RDWR|O_CLOEXEC); if (fd < 0) return log_error_errno(errno, "Failed to reboot: %m"); return fd; } Which is function that returns -errno on failure, as well as printing an error message, all in one line.
* log: make socket address structs static constLennart Poettering2014-11-28
|
* log: also set errno to the passed error code before processing format string ↵Lennart Poettering2014-11-28
| | | | | | in log_struct() That way the caller may use %m to print the specified error.
* log: allow negative errno valuesLennart Poettering2014-11-28
| | | | | sd_bus_error_set_errno() allows negative errors too, hence, be equally nice.
* log: fix order of log_unit_struct() to match other logging callsLennart Poettering2014-11-28
| | | | | Also, while we are at it, introduce some syntactic sugar for creating ERRNO= and MESSAGE= structured logging fields.
* kdbus: set kernel attach mask before creating the first busLennart Poettering2014-11-27
|
* log: rearrange log function namingLennart Poettering2014-11-27
| | | | | | | | | | - 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: be a bit less wasteful when allocating buffersLennart Poettering2014-11-27
|
* log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering2014-11-27
| | | | | | | | | | | | | | | | | | | | 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");
* resolve: fix NULL deref on strv comparisonDavid Herrmann2014-11-27
| | | | | | | | A strv might be NULL if it is empty. The txt.strings comparison doesn't take that into account. Introduce strv_equal() to provide a proper helper for this and fix resolve to use it. Thanks to Stanisław Pitucha <viraptor@gmail.com> for reporting this!
* unit-name: fix escaping logic in unit_name_mangle_with_suffix()Ivan Shapovalov2014-11-27
| | | | | | | | | | Make screened character set consistent with unit_name_mangle() by splitting off the escaping loop into a separate function. Before this fix, unit names such as `foo@bar.target` would get transformed into `foo\x40bar.target` when unit_name_mangle_with_suffix() is used. https://bugs.freedesktop.org/show_bug.cgi?id=86711
* util: add function getting proc environJakub Filak2014-11-27
| | | | | On the contrary of env, the added function returns all characters cescaped, because it improves reproducibility.
* logind: Support logind.conf.d directories in the usual search pathsJosh Triplett2014-11-26
| | | | | | | | | | | This makes it possible to drop in logind configuration snippets from a package or other configuration management mechanism. Add documentation to the header of /etc/logind.conf pointing the user at /etc/logind.conf.d/*.conf. Introduce a new helper, conf_parse_many, to parse configuration files in a search path.
* Introduce CONF_DIRS_NULSTR helper to define standard conf dirsJosh Triplett2014-11-26
| | | | | | | 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.
* manager: log some fatal errors at emergency levelZbigniew Jędrzejewski-Szmek2014-11-26
| | | | | | This adds a new log_emergency() function, which is equivalent to log_error() for non-PID-1, and logs at the highest priority for PID 1. Some messages which occur before freezing are converted to use it.
* util: mark page_size() as pureLennart Poettering2014-11-25
|
* util: skip incomplete ucred information in getpeersec()Lennart Poettering2014-11-25
|
* smack: introduce new SmackProcessLabel optionWaLyong Cho2014-11-24
| | | | | | | | | | | | | | | | | In service file, if the file has some of special SMACK label in ExecStart= and systemd has no permission for the special SMACK label then permission error will occurred. To resolve this, systemd should be able to set its SMACK label to something accessible of ExecStart=. So introduce new SmackProcessLabel. If label is specified with SmackProcessLabel= then the child systemd will set its label to that. To successfully execute the ExecStart=, accessible label should be specified with SmackProcessLabel=. Additionally, by SMACK policy, if the file in ExecStart= has no SMACK64EXEC then the executed process will have given label by SmackProcessLabel=. But if the file has SMACK64EXEC then the SMACK64EXEC label will be overridden. [zj: reword man page]
* Do not check for existence of remote binariesZbigniew Jędrzejewski-Szmek2014-11-22
| | | | | | | | | | | | | | systemd-run would fail when run with -M or -H and an absolute path, if this path did not exists locally. Allow it to continue, since we don't have a nice way of checking if the binary exists remotely. The case where -M or -H is used and a local path is unchanged, and we still iterate over $PATH to find the binary. We need to convert to an absolute path, and we don't have a nice mechanism to check remotely, so we assume that the binary will be located in the same place locally and remotely. http://lists.freedesktop.org/archives/systemd-devel/2014-November/025418.html
* missing: add IFLA_BRPORT_LEARNING and friendsZbigniew Jędrzejewski-Szmek2014-11-22
| | | | | IFLA_BRPORT_LEARNING was added in v3.10-rc4-583-g9ba18891f7, and IFLA_BRPORT_UNICAST_FLOOD in v3.10-rc4-584-g867a59436f.
* missing: add __NR_getrandom for a few more archsZbigniew Jędrzejewski-Szmek2014-11-22
| | | | | | Mips has getrandom() too, but there's just too many variants for me too care. Either someone who cares does it, or they get compile-time warnings with old kernel headers.
* util: add functions getting proc cwd and rootJakub Filak2014-11-21
| | | | | | | /proc/[pid]/cwd and /proc/[pid]/root are symliks to corresponding directories The added functions returns values of that symlinks.
* set: make set_consume() actually free the allocated string if the string ↵Lennart Poettering2014-11-20
| | | | already is in the set
* log: unchecked return value from librarySusant Sahani2014-11-17
| | | | fix 1237557 Unchecked return value from library
* busctl: add new "call" command to invoke methods on a serviceLennart Poettering2014-11-14
|
* sd-bus: sync with kdbus upstream (ABI break)Daniel Mack2014-11-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kdbus has seen a larger update than expected lately, most notably with kdbusfs, a file system to expose the kdbus control files: * Each time a file system of this type is mounted, a new kdbus domain is created. * The layout inside each mount point is the same as before, except that domains are not hierarchically nested anymore. * Domains are therefore also unnamed now. * Unmounting a kdbusfs will automatically also detroy the associated domain. * Hence, the action of creating a kdbus domain is now as privileged as mounting a filesystem. * This way, we can get around creating dev nodes for everything, which is last but not least something that is not limited by 20-bit minor numbers. The kdbus specific bits in nspawn have all been dropped now, as nspawn can rely on the container OS to set up its own kdbus domain, simply by mounting a new instance. A new set of mounts has been added to mount things *after* the kernel modules have been loaded. For now, only kdbus is in this set, which is invoked with mount_setup_late().
* strv: rework strv_split_quoted() to use unquote_first_word()Lennart Poettering2014-11-10
| | | | This should make the unquoting scheme a bit less naive.
* shared: explicitly ignore the return value of wait_for_terminateRonny Chevalier2014-11-10
| | | | | | CID#1237532 CID#1237523 CID#1237522
* shared/install: when unit contains only Also=, report 'indirect'Jan Synacek2014-11-10
| | | | | | | If a unit contains only Also=, with no Alias= or WantedBy=, it shouldn't be reported as static. New 'indirect' status shall be introduced. https://bugzilla.redhat.com/show_bug.cgi?id=864298
* shared: add readlink_valueTom Gundersen2014-11-07
| | | | Reads the basename of the target of a symlink.
* utf8: when looking at the next unichar, honour the size parameter, in ↵Lennart Poettering2014-11-07
| | | | utf8_is_printable_newline()
* log: explicitly ignore return value of parse_proc_cmdline()Lennart Poettering2014-11-07
| | | | CID# 1251162
* util: simplify normalize_env_assignment() a bitLennart Poettering2014-11-07
|
* util: file_is_priv_sticky() is used internally in util.c only nowadays, make ↵Lennart Poettering2014-11-07
| | | | it static
* util: rework /proc/cmdline parser to use unquote_first_word()Lennart Poettering2014-11-07
|
* util: simplify proc_cmdline() to reuse get_process_cmdline()Lennart Poettering2014-11-07
| | | | Also, make all parsing of the kernel cmdline non-fatal.
* fileio: simplify write_string_file_atomic() by reusing write_string_stream()Lennart Poettering2014-11-07
|
* copy: change error code when hitting copy limit to EFBIGLennart Poettering2014-11-07
| | | | | After all, this is about files, not arguments, hence EFBIG is more appropriate than E2BIG
* copy: teach copy_bytes() sendfile() support, and then replace ↵Lennart Poettering2014-11-07
| | | | sendfile_full() by it
* util: make use of isempty() where appropriateLennart Poettering2014-11-07
|
* switch-root: explain why we don't care about base_filesystem_create() failingLennart Poettering2014-11-06
|
* shared: create files even if the SELinux policy has no context for themMichal Schmidt2014-11-06
| | | | | | | | | | | | | The SELinux policy defines no context for some files. E.g.: $ matchpathcon /run/lock/subsys /dev/mqueue /run/lock/subsys <<none>> /dev/mqueue <<none>> We still need to be able to create them. In this case selabel_lookup_raw() returns ENOENT. We should then skip setfscreatecon(), but still return success. It was broken since c34255bdb2 ("label: unify code to make directories, symlinks").
* switch_root: do not fail, if base_filesystem_create() failedHarald Hoyer2014-11-06
| | | | | | | | Not all switch roots are like base_filesystem_create() wants them to look like. They might even boot, if they are RO and don't have the FS layout. Just ignore the error and switch_root nevertheless. base_filesystem_create() should have logged, what went wrong.
* shared: rename condition-util.[ch] to condition.[ch]Lennart Poettering2014-11-06
| | | | | Now that we only have one file with condition implementations around, we can drop the -util suffix and simplify things a bit.
* condition: order condition types the same way in man page, enum, tablesLennart Poettering2014-11-06
| | | | Yes, sometimes I develop OCD.
* core: introduce the concept of AssertXYZ= similar to ConditionXYZ=, but ↵Lennart Poettering2014-11-06
| | | | fatal for a start job if not met
* condition: record test state internally and beef it up to be a full enumLennart Poettering2014-11-06
|
* condition: add more test casesLennart Poettering2014-11-06
|
* condition: internalize condition test functionsLennart Poettering2014-11-06
| | | | | Also, implement the negation check inside of condition_test() instead of individually in each test function.