diff options
author | Benoît Dejean <bdejean@src.gnome.org> | 2007-06-25 17:27:27 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2007-06-25 17:27:27 +0000 |
commit | 6b0bafcafb6a2bbaf9bacad6088bc801b8f070ae (patch) | |
tree | 2d0e827d230a206f2049cffd8043da68e499019d /include | |
parent | c0856a39bd4d13714286aa968e0fe6b14e951a19 (diff) | |
download | libgtop-6b0bafcafb6a2bbaf9bacad6088bc801b8f070ae.tar.gz |
New API : glibtop_get_proc_affinity.
Implemented for linux.
svn path=/trunk/; revision=2609
Diffstat (limited to 'include')
-rw-r--r-- | include/glibtop/Makefile.am | 2 | ||||
-rw-r--r-- | include/glibtop/command.h | 3 | ||||
-rw-r--r-- | include/glibtop/procaffinity.h | 61 | ||||
-rw-r--r-- | include/glibtop/sysdeps.h | 4 | ||||
-rw-r--r-- | include/glibtop/union.h | 2 |
5 files changed, 69 insertions, 3 deletions
diff --git a/include/glibtop/Makefile.am b/include/glibtop/Makefile.am index e7b13360..84359d09 100644 --- a/include/glibtop/Makefile.am +++ b/include/glibtop/Makefile.am @@ -8,7 +8,7 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \ procsignal.h union.h gnuserv.h \ parameter.h mountlist.h fsusage.h procmap.h signal.h \ sysinfo.h ppp.h procargs.h netload.h \ - procwd.h \ + procwd.h procaffinity.h \ netlist.h procopenfiles.h open.h noinst_HEADERS = error.h write.h read_data.h read.h init_hooks.h diff --git a/include/glibtop/command.h b/include/glibtop/command.h index bd9667e8..e0f859e5 100644 --- a/include/glibtop/command.h +++ b/include/glibtop/command.h @@ -58,8 +58,9 @@ G_BEGIN_DECLS #define GLIBTOP_CMND_NETLIST 24 #define GLIBTOP_CMND_PROC_OPEN_FILES 25 #define GLIBTOP_CMND_PROC_WD 26 +#define GLIBTOP_CMND_PROC_AFFINITY 27 -#define GLIBTOP_MAX_CMND 27 +#define GLIBTOP_MAX_CMND 28 #define _GLIBTOP_PARAM_SIZE 16 diff --git a/include/glibtop/procaffinity.h b/include/glibtop/procaffinity.h new file mode 100644 index 00000000..e5733721 --- /dev/null +++ b/include/glibtop/procaffinity.h @@ -0,0 +1,61 @@ +/* Copyright (C) 2007 Benoît Dejean + This file is part of LibGTop 2. + + LibGTop is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + LibGTop is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with LibGTop; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __GLIBTOP_PROCAFFINITY_H__ +#define __GLIBTOP_PROCAFFINITY_H__ + +#include <glibtop.h> +#include <glibtop/global.h> + +G_BEGIN_DECLS + +typedef struct _glibtop_proc_affinity glibtop_proc_affinity; + +#define GLIBTOP_PROC_AFFINITY_NUMBER 0 +#define GLIBTOP_PROC_AFFINITY_ALL 1 + +struct _glibtop_proc_affinity +{ + guint64 flags; + guint32 number; + gboolean all; +}; + + +guint16 * glibtop_get_proc_affinity(glibtop_proc_affinity *buf, pid_t pid); +guint16 * glibtop_get_proc_affinity_l(glibtop *server, glibtop_proc_affinity *buf, pid_t pid); + + +#if GLIBTOP_SUID_PROC_AFFINITY + +#define glibtop_get_proc_affinity_r glibtop_get_proc_affinity_p +void _glibtop_init_proc_affinity_p(glibtop *server); +guint16 * glibtop_get_proc_affinity_p(glibtop *server, glibtop_proc_affinity *buf, pid_t pid); + +#else + +#define glibtop_get_proc_affinity_r glibtop_get_proc_affinity_s +void _glibtop_init_proc_affinity_s(glibtop *server); +guint16 * glibtop_get_proc_affinity_s(glibtop *server, glibtop_proc_affinity *buf, pid_t pid); + +#endif + +G_END_DECLS + +#endif diff --git a/include/glibtop/sysdeps.h b/include/glibtop/sysdeps.h index 40f0b6b2..1060d1c9 100644 --- a/include/glibtop/sysdeps.h +++ b/include/glibtop/sysdeps.h @@ -52,8 +52,9 @@ G_BEGIN_DECLS #define GLIBTOP_SYSDEPS_NETLIST 23 #define GLIBTOP_SYSDEPS_PROC_OPEN_FILES 24 #define GLIBTOP_SYSDEPS_PROC_WD 25 +#define GLIBTOP_SYSDEPS_PROC_AFFINITY 26 -#define GLIBTOP_MAX_SYSDEPS 26 +#define GLIBTOP_MAX_SYSDEPS 27 #define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1) @@ -88,6 +89,7 @@ struct _glibtop_sysdeps guint64 netload; /* glibtop_netload */ guint64 ppp; /* glibtop_ppp */ guint64 proc_wd; /* glibtop_proc_wd */ + guint64 proc_affinity; /* glibtop_proc_affinity */ }; void glibtop_get_sysdeps (glibtop_sysdeps *buf); diff --git a/include/glibtop/union.h b/include/glibtop/union.h index 39da4640..b0eb33de 100644 --- a/include/glibtop/union.h +++ b/include/glibtop/union.h @@ -43,6 +43,7 @@ #include <glibtop/procmap.h> #include <glibtop/procopenfiles.h> #include <glibtop/procwd.h> +#include <glibtop/procaffinity.h> #include <glibtop/mountlist.h> #include <glibtop/fsusage.h> @@ -82,6 +83,7 @@ union _glibtop_union glibtop_ppp ppp; glibtop_proc_open_files proc_open_files; glibtop_proc_wd proc_wd; + glibtop_proc_affinity proc_affinity; }; G_END_DECLS |