summaryrefslogtreecommitdiff
path: root/src/shared
Commit message (Collapse)AuthorAge
* delta: diff returns 1 when files differ, ignore thisZbigniew Jędrzejewski-Szmek2014-11-29
| | | | https://bugs.debian/org/771397
* shared: install - report error if mask symlink can not be marked for removalTom Gundersen2014-11-29
|
* shared: time-dst - ensure nulstr is null terminatedTom Gundersen2014-11-29
| | | | Fixes CID #1237772.
* treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1Lennart Poettering2014-11-28
|
* treewide: another round of simplificationsMichal Schmidt2014-11-28
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | 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-28
| | | | The one in tmpfiles.c:create_item() even looks like it fixes a bug.
* treewide: yet more log_*_errno + return simplificationsMichal Schmidt2014-11-28
| | | | | | | | | | | | | 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.
* systemctl: append default suffix only if none presentZbigniew Jędrzejewski-Szmek2014-11-28
| | | | | | | | Simplify unit_name_mangle() and unit_name_mangle_with_suffix() to always behave the same, and only append a suffix if there is no type suffix. If a user says 'isolate blah.device' it is better to return an error that the type cannot be isolated, than to try to isolate blah.device.target.
* treewide: more log_*_errno() conversions, multiline callsMichal Schmidt2014-11-28
| | | | | | | | | | | | 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.
* sd-bus: rename default bus address constants, they aren't "paths" but ↵Lennart Poettering2014-11-28
| | | | "addresses"
* treewide: more log_*_errno() conversionsMichal Schmidt2014-11-28
|
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | 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().
* 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
|