diff --git a/Makefile b/Makefile index a397522..d79b523 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ TARGET = procfs -OBJS = procfs.o netfs.o procfs_dir.o \ +OBJS = procfs.o netfs.o procfs_dir.o cpuinfo.o\ process.o proclist.o rootdir.o dircat.o main.o -LIBS = -lnetfs -lps +LIBS = -lnetfs -lps -lfshelp CC = gcc -CFLAGS = -Wall -g +CFLAGS = -Wall -g `pkg-config --cflags glib-2.0` CPPFLAGS = LDFLAGS = diff --git a/rootdir.c b/rootdir.c index 1fa71b0..ecb3aed 100644 --- a/rootdir.c +++ b/rootdir.c @@ -32,6 +32,7 @@ #include "procfs.h" #include "procfs_dir.h" #include "main.h" +#include "cpuinfo.h" /* This implements a directory node with the static files in /proc. NB: the libps functions for host information return static storage; @@ -397,6 +398,14 @@ rootdir_gc_fakeself (void *hook, char **contents, ssize_t *contents_len) return 0; } +static error_t +rootdir_gc_cpuinfo (void *hook, char **contents, ssize_t *contents_len) +{ + CpuInfo cpuinfo; + init_cpuinfo(&cpuinfo); + cpuinfo_string(contents,contents_len,cpuinfo); + return 0; +} /* Glue logic and entries table */ @@ -480,6 +489,13 @@ static const struct procfs_dir_entry rootdir_entries[] = { .cleanup_contents = procfs_cleanup_contents_with_free, }, }, + { + .name = "cpuinfo", + .hook = & (struct procfs_node_ops) { + .get_contents = rootdir_gc_cpuinfo, + .cleanup_contents = procfs_cleanup_contents_with_free, + }, + }, #ifdef PROFILE /* In order to get a usable gmon.out file, we must apparently use exit(). */ {