process-util: introduce proc_set_comm() helper

This operation is done at a bunch of places, let's add a type-safe
helper for it.
This commit is contained in:
Lennart Poettering
2026-07-13 15:39:16 +02:00
parent d3c0348c8b
commit 0e077d3eea
6 changed files with 16 additions and 10 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sched.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -64,7 +63,7 @@ int asynchronous_fsync(int fd, PidRef *ret_pid) {
static int close_func(void *p) {
unsigned v = PTR_TO_UINT(p);
(void) prctl(PR_SET_NAME, (unsigned long*) "(sd-close)");
(void) proc_set_comm("(sd-close)");
/* Note: 💣 This function is invoked in a child process created via glibc's clone() wrapper. In such
* children memory allocation is not allowed, since glibc does not release malloc mutexes in