summaryrefslogtreecommitdiff
path: root/src/login/logind-inhibit.c
Commit message (Collapse)AuthorAge
* everywhere: actually make use of DUAL_TIMESTAMP_NULL macroLennart Poettering2017-03-14
| | | | Let's use it as initializer where appropriate.
* shared: add formats-util.hRonny Chevalier2017-03-14
|
* util: rework cunescape(), improve error handlingLennart Poettering2017-03-14
| | | | | | | | | Change cunescape() to return a normal error code, so that we can distuingish OOM errors from parse errors. This also adds a flags parameter to control whether "relaxed" or normal parsing shall be done. If set no parse failures are generated, and the only reason why cunescape() can fail is OOM.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | 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: 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().
* Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | | | | | | | | | | | | | | | String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
* Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek2014-05-15
| | | | No functional change expected :)
* util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering2014-03-18
| | | | | | | | | | | | | | | safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
* api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering2014-02-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
* Update some message formatsZbigniew Jędrzejewski-Szmek2014-02-05
| | | | | | | | Use PID_FMT/USEC_FMT/... in more places. Also update logind error messages to print the full path to a file that failed. This should make debugging easier for people who do not know off the top of their head where logind stores it state.
* __thread --> thread_local for C11 compatShawn Landden2013-12-17
| | | | | Also make thread_local available w/o including <threads.h>. (as the latter hasn't been implemented, but this part is trivial)
* Get rid of our reimplementation of basenameZbigniew Jędrzejewski-Szmek2013-12-06
| | | | | | The only problem is that libgen.h #defines basename to point to it's own broken implementation instead of the GNU one. This can be fixed by #undefining basename.
* logind: log which process is delaying suspend and not closing locksLennart Poettering2013-11-27
|
* core: convert PID 1 to libsystemd-busLennart Poettering2013-11-20
| | | | | | | | | | | | | | | | | | | | | | This patch converts PID 1 to libsystemd-bus and thus drops the dependency on libdbus. The only remaining code using libdbus is a test case that validates our bus marshalling against libdbus' marshalling, and this dependency can be turned off. This patch also adds a couple of things to libsystem-bus, that are necessary to make the port work: - Synthesizing of "Disconnected" messages when bus connections are severed. - Support for attaching multiple vtables for the same interface on the same path. This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus calls which used an inappropriate signature. As a side effect we will now generate PropertiesChanged messages which carry property contents, rather than just invalidation information.
* Remove duplicate includesKarel Zak2013-11-18
|
* logind: port logind to libsystemd-busLennart Poettering2013-11-05
|
* Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek2013-04-05
| | | | | | | | | | | | | | | | | | | | | | | Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
* logind: consider key inhibitors that are taken by non-session processes as ↵Lennart Poettering2013-04-05
| | | | | | | global This should allow system services to take over key handling for all sessions, globally.
* honor SELinux labels, when creating and writing config filesHarald Hoyer2013-02-14
| | | | | | | 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
* use strneq instead of strncmpThomas Hindoe Paaboel Andersen2013-02-13
|
* logind: split up HandleSleepKey= into HandleSuspendKey= and HandleHibernateKey=Lennart Poettering2012-09-21
| | | | | The kernel and X11 distuingish these two, and Thinkpad keys have both, hence we really should distinguish them too.
* logind: allow users to override their own suspend/sleep inhibitorsLennart Poettering2012-09-21
|
* logind: properly parse handle-lid-switch inhibitorLennart Poettering2012-09-19
|
* logind: rework power key/suspend key/lid switch handlingLennart Poettering2012-09-19
| | | | | | | | http://lists.freedesktop.org/archives/systemd-devel/2012-September/006604.html https://bugzilla.gnome.org/show_bug.cgi?id=680689 This changes the meaning of the HandlePowerKey=/HandleSleepKey=/HandleLidSwitch= setting of logind.conf
* login: check return of parse_pid and parse_uidLukas Nykryn2012-08-23
|
* mkdir: append _label to all mkdir() calls that explicitly set the selinux ↵Kay Sievers2012-05-31
| | | | context
* logind: optionally handle power, sleep and lid switch eventsLennart Poettering2012-05-30
| | | | | | | | | | | This takes handling of chassis power and sleep keys as well as the lid switch over from acpid. This logic is enabled by default for power and sleep keys, but not for the lid switch. If a graphical session is in the foreground no action is taken under the assumption that the graphical session does this.
* logind: implement suspend/hibernate calls with inhibition logicLennart Poettering2012-05-08
|
* logind: use "sleep" as generic term for "suspend", "hibernate", and later on ↵Lennart Poettering2012-05-08
| | | | "hybrid suspend"
* util: split-out path-util.[ch]Kay Sievers2012-05-08
|
* logind: implement delay inhibitor locks in addition to block inhibitor locksLennart Poettering2012-05-05
| | | | | This is useful to allow applications to synchronously save data before the system is suspended or shut down.
* logind: hook up inhibit logic with idle hint logicLennart Poettering2012-04-16
|
* logind: add shutdown/suspend/idle inhibition frameworkLennart Poettering2012-04-16