summaryrefslogtreecommitdiff
path: root/proclist.c
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-08-17 20:34:58 +0000
committerJeremie Koenig <jk@jk.fr.eu.org>2010-08-30 14:14:49 +0200
commitc62d5ff73ceaad21bb0784ed6098d307a625b10d (patch)
treed0998f7ffedb97bee2fe4f06bb6541a28bed4d20 /proclist.c
parentba139824fa06a97f2a3b1cc4c6085d10a83ec2b9 (diff)
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.
Diffstat (limited to 'proclist.c')
-rw-r--r--proclist.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/proclist.c b/proclist.c
index e009ebd..148e4bc 100644
--- a/proclist.c
+++ b/proclist.c
@@ -4,8 +4,7 @@
#include <mach.h>
#include <hurd/process.h>
#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;
}