pidref: now that we have the cached pidfdid of our own process, use it
Note that this drops a lot of "const" qualifiers on PidRef arguments. That's because pidref_is_self() suddenly might end changing the PidRef because it acquires the pidfd ID. We had this previously already with pidfd_equal(), but this amplifies the problem. I guess we C's "const" doesn't really work for stuff that contains caches, that is just conceptually constant, but not actually.
This commit is contained in:
@@ -1120,7 +1120,7 @@ int getenv_for_pid(pid_t pid, const char *field, char **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pidref_is_my_child(const PidRef *pid) {
|
||||
int pidref_is_my_child(PidRef *pid) {
|
||||
int r;
|
||||
|
||||
if (!pidref_is_set(pid))
|
||||
@@ -1150,7 +1150,7 @@ int pid_is_my_child(pid_t pid) {
|
||||
return pidref_is_my_child(&PIDREF_MAKE_FROM_PID(pid));
|
||||
}
|
||||
|
||||
int pidref_is_unwaited(const PidRef *pid) {
|
||||
int pidref_is_unwaited(PidRef *pid) {
|
||||
int r;
|
||||
|
||||
/* Checks whether a PID is still valid at all, including a zombie */
|
||||
|
||||
Reference in New Issue
Block a user