Added missing files

svn path=/trunk/; revision=2580
This commit is contained in:
Benoît Dejean
2007-05-13 14:28:50 +00:00
parent 785b30aeb6
commit eee0cad2b6
4 changed files with 328 additions and 0 deletions

31
examples/wd.c Normal file
View File

@@ -0,0 +1,31 @@
#include <glibtop.h>
#include <glibtop/procwd.h>
#include <glib.h>
#include <unistd.h>
int main(int argc, char **argv)
{
pid_t pid;
glibtop_proc_wd buf;
char **dirs, **dir;
if (argc < 2 || !(pid = strtoul(argv[1], NULL, 0)))
pid = getpid();
dirs = glibtop_get_proc_wd(&buf, pid);
g_print("Process %u:\n"
" - root: '%s'\n"
" - exe: '%s'\n"
" - working directories:\n",
(unsigned)pid, buf.root, buf.exe);
for (dir = dirs; *dir; ++dir)
g_print(" - '%s'\n", *dir);
g_strfreev(dirs);
return 0;
}