From c62d5ff73ceaad21bb0784ed6098d307a625b10d Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Tue, 17 Aug 2010 20:34:58 +0000 Subject: Add real process nodes * process.c, process.h: New files, implement a process directory with cmdline and environ files. * Makefile: Add the process module. * proclist.c: Replace stub pid files with the real thing. --- proclist.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'proclist.c') diff --git a/proclist.c b/proclist.c index e009ebdd..148e4bc3 100644 --- a/proclist.c +++ b/proclist.c @@ -4,8 +4,7 @@ #include #include #include "procfs.h" -#include "procfs_file.h" -#include "procfs_dir.h" +#include "process.h" #define PID_STR_SIZE (3 * sizeof (pid_t) + 1) @@ -49,7 +48,15 @@ proclist_get_contents (void *hook, void **contents, size_t *contents_len) static error_t proclist_lookup (void *hook, const char *name, struct node **np) { - *np = procfs_file_make_node ("Ceci n'est pas un processus\n", -1, NULL); + struct proclist_node *pl = hook; + char *endp; + pid_t pid; + + pid = strtol (name, &endp, 10); + if (name[0] == '0' || !name[0] || *endp) + return ENOENT; + + *np = process_make_node (pl->process, pid); return *np ? 0 : ENOMEM; } -- cgit v1.2.3