chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
service: watch main pid even in final states
[elogind.git]
/
src
/
shared
/
util.c
diff --git
a/src/shared/util.c
b/src/shared/util.c
index 80dbf73c947d4f501503b2cc3626f28c8afff289..f59897105a6354e1cea1c7261517e2a556c660ce 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-3469,7
+3469,7
@@
int wait_for_terminate_and_warn(const char *name, pid_t pid) {
return -EPROTO;
}
return -EPROTO;
}
-
_noreturn_
void freeze(void) {
+
noreturn
void freeze(void) {
/* Make sure nobody waits for us on a socket anymore */
close_all_fds(NULL, 0);
/* Make sure nobody waits for us on a socket anymore */
close_all_fds(NULL, 0);
@@
-6088,3
+6088,13
@@
int namespace_enter(int pidns_fd, int mntns_fd, int root_fd) {
return 0;
}
return 0;
}
+
+bool pid_valid(pid_t pid) {
+ if (pid <= 0)
+ return false;
+
+ if (kill(pid, 0) >= 0)
+ return true;
+
+ return errno != ESRCH;
+}