chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
961c23b
)
process-util: add TAKE_PID(), similar to TAKE_PTR/TAKE_FD, but for child process...
author
Lennart Poettering
<lennart@poettering.net>
Tue, 27 Mar 2018 13:01:02 +0000
(15:01 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000
(16:47 +0200)
src/basic/process-util.h
patch
|
blob
|
history
diff --git
a/src/basic/process-util.h
b/src/basic/process-util.h
index eff42d0533201a7dca3fc93b1be3125e4b234af0..ee094932a371b41b68d84859da1961bc86776e84 100644
(file)
--- a/
src/basic/process-util.h
+++ b/
src/basic/process-util.h
@@
-209,3
+209,11
@@
int fork_agent(const char *name, const int except[], unsigned n_except, pid_t *p
#endif
assert_cc(TASKS_MAX <= (unsigned long) PID_T_MAX)
+
+/* Like TAKE_PTR() but for child PIDs, resetting them to 0 */
+#define TAKE_PID(pid) \
+ ({ \
+ pid_t _pid_ = (pid); \
+ (pid) = 0; \
+ _pid_; \
+ })