[PATCH 2/5] um: Remove unused os_process_parent
Benjamin Berg
benjamin at sipsolutions.net
Fri Sep 13 06:35:59 PDT 2024
From: Benjamin Berg <benjamin.berg at intel.com>
The function is not used anywhere.
---
arch/um/include/shared/os.h | 1 -
arch/um/os-Linux/process.c | 39 -------------------------------------
2 files changed, 40 deletions(-)
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index c8c1a93c8d2c..4bdd4fb5dd80 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -199,7 +199,6 @@ extern int create_mem_file(unsigned long long len);
extern void report_enomem(void);
/* process.c */
-extern int os_process_parent(int pid);
extern void os_alarm_process(int pid);
extern void os_stop_process(int pid);
extern void os_kill_process(int pid, int reap_child);
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 6b74a8d91e06..b25c226c5491 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -18,45 +18,6 @@
#include <longjmp.h>
#include <os.h>
-#define FAILURE_PID -1
-
-#define STAT_PATH_LEN sizeof("/proc/#######/stat\0")
-#define COMM_SCANF "%*[^)])"
-
-int os_process_parent(int pid)
-{
- char stat[STAT_PATH_LEN];
- char data[256];
- int parent = FAILURE_PID, n, fd;
-
- if (pid == -1)
- return parent;
-
- snprintf(stat, sizeof(stat), "/proc/%d/stat", pid);
- fd = open(stat, O_RDONLY, 0);
- if (fd < 0) {
- printk(UM_KERN_ERR "Couldn't open '%s', errno = %d\n", stat,
- errno);
- return parent;
- }
-
- CATCH_EINTR(n = read(fd, data, sizeof(data)));
- close(fd);
-
- if (n < 0) {
- printk(UM_KERN_ERR "Couldn't read '%s', errno = %d\n", stat,
- errno);
- return parent;
- }
-
- parent = FAILURE_PID;
- n = sscanf(data, "%*d " COMM_SCANF " %*c %d", &parent);
- if (n != 1)
- printk(UM_KERN_ERR "Failed to scan '%s'\n", data);
-
- return parent;
-}
-
void os_alarm_process(int pid)
{
kill(pid, SIGALRM);
--
2.46.0
More information about the linux-um
mailing list