process-util: add pidref_is_kernel_thread()
This commit is contained in:
@@ -389,7 +389,7 @@ int namespace_get_leader(pid_t pid, NamespaceType type, pid_t *ret) {
|
||||
}
|
||||
}
|
||||
|
||||
int is_kernel_thread(pid_t pid) {
|
||||
int pid_is_kernel_thread(pid_t pid) {
|
||||
_cleanup_free_ char *line = NULL;
|
||||
unsigned long long flags;
|
||||
size_t l, i;
|
||||
@@ -447,6 +447,23 @@ int is_kernel_thread(pid_t pid) {
|
||||
return !!(flags & PF_KTHREAD);
|
||||
}
|
||||
|
||||
int pidref_is_kernel_thread(const PidRef *pid) {
|
||||
int result, r;
|
||||
|
||||
if (!pidref_is_set(pid))
|
||||
return -ESRCH;
|
||||
|
||||
result = pid_is_kernel_thread(pid->pid);
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
r = pidref_verify(pid); /* Verify that the PID wasn't reused since */
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int get_process_capeff(pid_t pid, char **ret) {
|
||||
const char *p;
|
||||
int r;
|
||||
|
||||
Reference in New Issue
Block a user