diff options
author | Benoît Dejean <bdejean@src.gnome.org> | 2007-09-21 22:26:18 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2007-09-21 22:26:18 +0000 |
commit | 771f0848b352f0586ee687077f2548e379745b02 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /examples/openfiles.c | |
parent | fcee021a2d23a8c1d84e1c6411f2d2561514a5aa (diff) | |
download | libgtop-affinity.tar.gz |
Killed branch. SVN SUCKS.affinity
Killed branch.
SVN SUCKS.
svn path=/branches/affinity; revision=2662
Diffstat (limited to 'examples/openfiles.c')
-rw-r--r-- | examples/openfiles.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/examples/openfiles.c b/examples/openfiles.c deleted file mode 100644 index 9811fe0e..00000000 --- a/examples/openfiles.c +++ /dev/null @@ -1,68 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <glibtop.h> -#include <glibtop/procopenfiles.h> - -#include <stdlib.h> - -#include <unistd.h> - -static void show_open_files(pid_t pid) -{ - glibtop_proc_open_files buf; - glibtop_open_files_entry *files; - unsigned i; - - files = glibtop_get_proc_open_files(&buf, pid); - - printf("<%ld>\n", (long)pid); - - for(i = 0; i < buf.number; ++i) - { - printf("\tfd = %d\t", files[i].fd); - - switch(files[i].type) - { - case GLIBTOP_FILE_TYPE_FILE: - printf("file \"%s\"\n", files[i].info.file.name); - break; - - case GLIBTOP_FILE_TYPE_PIPE: - printf("pipe\n"); - break; - - case GLIBTOP_FILE_TYPE_INETSOCKET: - printf("socket %s:%d\n", files[i].info.sock.dest_host, files[i].info.sock.dest_port); - break; - - case GLIBTOP_FILE_TYPE_LOCALSOCKET: - printf("localsocket %s\n", files[i].info.localsock.name); - break; - } - } - - putchar('\n'); - - g_free(files); -} - - -int main(int argc, char **argv) -{ - glibtop_init(); - - show_open_files(getpid()); - - while(*++argv) - { - pid_t pid = strtol(*argv, NULL, 10); - show_open_files(pid); - } - - glibtop_close(); - - return 0; -} - |