summaryrefslogtreecommitdiff
path: root/src/basic/process-util.c
Commit message (Collapse)AuthorAge
* process-util: rename char *r to ans and add commentZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | Add a comment about the return value and rename r to ans. r is nowadays reserved for the integer return value, and char *r is confusing.
* util-lib: rework rename_process() to be able to make use of PR_SET_MM_ARG_STARTLennart Poettering2017-07-17
| | | | | | | | | PR_SET_MM_ARG_START allows us to relatively cleanly implement process renaming. However, it's only available with privileges. Hence, let's try to make use of it, and if we can't fall back to the traditional way of overriding argv[0]. This removes size restrictions on the process name shown in argv[] at least for privileged processes.
* basic/process-util: we need to take the shorter of two stringsZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | ==30496== Conditional jump or move depends on uninitialised value(s) ==30496== at 0x489F654: memcmp (vg_replace_strmem.c:1091) ==30496== by 0x49BF203: getenv_for_pid (process-util.c:678) ==30496== by 0x4993ACB: detect_container (virt.c:442) ==30496== by 0x182DFF: test_get_process_comm (test-process-util.c:98) ==30496== by 0x185847: main (test-process-util.c:368) ==30496==
* tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/elogind -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libelogind/sd-bus -I ./src/libelogind/sd-event -I ./src/libelogind/sd-login -I ./src/libelogind/sd-netlink -I ./src/libelogind/sd-network -I ./src/libelogind/sd-hwdb -I ./src/libelogind/sd-device -I ./src/libelogind/sd-id128 -I ./src/libelogind-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.
* Prep v231: Apply missing fixes from upstream (1/6) src/basicSven Eden2017-06-16
|
* util: don't send SIGCONT following a SIGCONT or SIGKILL in kill_and_sigcont()Lennart Poettering2017-06-16
|
* basic: fix whitespaceThomas Hindoe Paaboel Andersen2017-06-16
|
* tree-wide: some work-arounds for gcc false positives regarding uninitialized ↵Lennart Poettering2017-06-16
| | | | variables
* process-util: fix two bugs in get_process_cmdline() (#3555)Lennart Poettering2017-06-16
| | | | | | See: https://github.com/elogind/elogind/pull/3529#issuecomment-226421007
* util-lib: rework get_process_cmdline() (#3529)Lennart Poettering2017-06-16
| | | | | | | | | | | | | | | | | | | | | | This reworks get_process_cmdline() quite substantially, fixing the following: - Fixes: https://github.com/elogind/elogind/pull/3512/commits/a4e3bf4d7ac2de51191ce136ee9361ba319e106c#r66837630 - The passed max_length is also applied to the "comm" name, if comm_fallback is set. - The right thing happens if max_length == 1 is specified - when the cmdline "foobar" is abbreviated to 6 characters the result is not "foobar" instead of "foo...". - trailing whitespace are removed before the ... suffix is appended. The 7 character abbreviation of "foo barz" is hence "foo..." instead of "foo ...". - leading whitespace are suppressed from the cmdline - a comprehensive test case is added
* util-lib: drop trailing non-printable characters from cmdline (#3512)Max Prokhorov2017-06-16
| | | | | | | | | If max_length is equal or greater than cmdline length all trailing non-printable characters are dropped. If max_length is 0 it should do the same. This should also fix cmdline truncation if the last character is not '\0'. Fixes #3469.
* process-util: remove broken support for pid==0Zbigniew Jędrzejewski-Szmek2017-06-16
| | | | | | | | | Our functions that query /proc/pid/ support using pid==0 to mean self. get_process_id also seemed to support that, but it was not implemented correctly: the result should be in *uid, not returned, and also it gave completely bogus result when called from get_process_gid(). But afaict, get_process_{uid,gid} were never called with pid==0, so it's not an actual bug. Remove the broken code to avoid confusion.
* Prep v230: Apply missing upstream fixes and updates (2/8) src/basic.Sven Eden2017-06-16
|
* core,systemctl: add bus API to retrieve processes of a unitLennart Poettering2017-06-16
| | | | | | | | | | | | | | | This adds a new GetProcesses() bus call to the Unit object which returns an array consisting of all PIDs, their process names, as well as their full cgroup paths. This is then used by "systemctl status" to show the per-unit process tree. This has the benefit that the client-side no longer needs to access the cgroupfs directly to show the process tree of a unit. Instead, it now uses this new API, which means it also works if -H or -M are used correctly, as the information from the specific host is used, and not the one from the local system. Fixes: #2945
* util-lib: simplify personality() string matchingLennart Poettering2017-06-16
|
* util-lib: support various ppc archs in personality logicLennart Poettering2017-06-16
|
* util-lib: use the architecture ids from architecture.h for personalitiesLennart Poettering2017-06-16
| | | | We have this ids, hence let's use them universally.
* Prep v229: Add missing fixes from upstream [1/6] src/basicSven Eden2017-05-17
|
* Prep v228: Condense elogind source masks (2/5)Sven Eden2017-04-26
|
* Prep v228: Add remaining updates from upstream (2/3)Sven Eden2017-04-26
| | | | | Apply remaining fixes and the performed move of utility functions into their own foo-util.[hc] files on libbasic.
* process-util: make some minor corrections to PID live detectionLennart Poettering2017-04-26
|
* Prep v227: Clean up various *-util.[hc] filesSven Eden2017-04-09
| | | | | | | | - src/basic/cgroup-util.[hc] - src/basic/memfd-util.[hc] - src/basic/path-util.[hc] - src/basic/process-util.[hc] - src/basic/smack-util.[hc]
* [1/5] Apply missing fixes from upstreamSven Eden2017-03-29
|
* process-util: trivial optimizationLennart Poettering2017-03-14
|
* Prep v225: Applying various fixes and changes to src/basic that got lost ↵Sven Eden2017-03-14
| | | | during git am transfer.
* Prep v224: Major cleanup of unneeded functions and some source files.Sven Eden2017-03-14
|
* Prep v221: Update and clean up build system to sync with upstreamSven Eden2017-03-14
This commit replays the moving around of source files that have been done between systemd-219 and systemd-221. Further the Makefile.am is synchronized with the upstream version and then "re-cleaned". A lot of functions, that are not used anywhere in elogind have been coated into #if 0/#endif directives to further shorten the list of dependencies. All unneeded files have been removed.