Main Page | File List

src/libproc/libproc.h

00001 /* 00002 *libproc 00003 * 00004 *A library interface for finding process information from /proc. 00005 *This is also an interface into various things which haven't yet been integrated into sysfs, 00006 * as appropriate. 00007 00008 Copyright (C) 2004 Joseph Pingenot 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Lesser General Public 00012 License as published by the Free Software Foundation; either 00013 version 2.1 of the License, or (at your option) any later 00014 version. 00015 00016 This library is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public 00022 License along with this library; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 00025 */ 00026 00027 #include "acpi.h" 00028 00029 #ifndef LIBPROC_H_DKAFH4U3AG9Q0JRIOEQAIJ 00030 #define LIBPROC_H_DKAFH4U3AG9Q0JRIOEQAIJ 00031 00032 #define LIBPROC_ERRLEN 1024 00033 00034 /*Get loadavg information*/ 00035 struct libproc_loadavg { 00036 float one; 00037 float two; 00038 float three; 00039 long unsigned int running; 00040 long unsigned int total; 00041 long unsigned int lastproc; 00042 }; 00043 struct libproc_loadavg *libproc_getloadavg(); 00044 void libproc_destroy_loadavg(struct libproc_loadavg *la); 00045 00046 00047 00048 /*multistring list. This is a linked list of multiple strings. 00049 *The fields are self-explanatory. 00050 *NOTE: the buffer must be freed before the struct can be freed!! 00051 * OTHERWISE YOU GET A MEMORY LEAK 00052 */ 00053 struct libproc_list_multistring { 00054 long unsigned int len; 00055 char *buffer; 00056 struct libproc_list_multistring *next; 00057 }; 00058 00059 struct libproc_list_environ { 00060 long unsigned int varnamelen; 00061 char *varname; 00062 long unsigned int varcontentlen; 00063 char *varcontent; 00064 struct libproc_list_environ *next; 00065 }; 00066 00067 struct libproc_list_fds { 00068 unsigned int fd; 00069 unsigned long int filelen; 00070 char *file; 00071 struct libproc_list_fds *next; 00072 }; 00073 00074 struct libproc_list_mmap { 00075 unsigned long int start; 00076 unsigned long int stop; 00077 unsigned int mode; 00078 struct libproc_list_mmap *next; 00079 }; 00080 00081 struct libproc_list_mount { 00082 unsigned long int devlen; 00083 char *dev; 00084 unsigned long int mountpointlen; 00085 char *mountpoint; 00086 unsigned long int fslen; 00087 char *fs; 00088 unsigned int flags; 00089 unsigned int dump; 00090 unsigned int pass; 00091 }; 00092 00093 struct libproc_stats { 00094 }; 00095 00096 struct libproc_mstats { 00097 }; 00098 00099 struct libproc_group { 00100 gid_t gid; 00101 struct libproc_grouplist *next; 00102 } 00103 00104 struct libproc_status { 00105 char *name; 00106 char state; 00107 short int sleepavg; 00108 gid_t tgid; 00109 pid_t pid; 00110 pid_t ppid; 00111 pid_t tracer; 00112 uid_t uid0; 00113 uid_t uid1; 00114 uid_t uid2; 00115 uid_t uid3; 00116 gid_t gid0; 00117 gid_t gid1; 00118 gid_t gid2; 00119 gid_t gid3; 00120 int fdsize; 00121 struct libproc_group *groups; 00122 long int vmsize; 00123 long int vmlck; 00124 long int vmrss; 00125 long int vmdata; 00126 long int vmstck; 00127 long int vmexe; 00128 long int vmlib; 00129 long int threads; 00130 long int sigpnd; 00131 long int shdpnd; 00132 long int sigblk; 00133 long int sigign; 00134 long int sigcgt; 00135 long int capinh; 00136 long int capprm; 00137 long int capeff; 00138 }; 00139 00140 struct libproc_list_thread { 00141 }; 00142 00143 /*We provide all of the available process information at once, for the off chance that 00144 * the process magically changes underneath us. IF we were to just let it go, 00145 * the process might change between invocations. 00146 *NOTE: you must free the strings here, or you'll have a memory leak! 00147 */ 00148 struct libproc_process { 00149 /*The command line for the process*/ 00150 struct libproc_list_multistring *cmdline; 00151 /*Current Working Directory*/ 00152 unsigned long int cwdlen; 00153 char *cwd; 00154 /*Process's environment*/ 00155 struct libproc_list_environ *environ; 00156 /*File descriptors it has open*/ 00157 struct libproc_list_fds *fds; 00158 /*Memory map*/ 00159 struct libproc_list_mmap *mmap; 00160 /*Mounts*/ 00161 struct libproc_list_mount *mounts; 00162 /*Root directory*/ 00163 unsigned long int rootlen; 00164 char *root; 00165 /*Stats*/ 00166 struct libproc_stats stats; 00167 /*M Stats*/ 00168 struct libproc_mstats mstats; 00169 /*Status*/ 00170 struct libproc_status status; 00171 /*Threads*/ 00172 struct libproc_list_thread *threads; 00173 /*wchan*/ 00174 unsigned long int wchanlen; 00175 char wchan; 00176 /*These can be linked together to get an atomic state*/ 00177 struct libproc_process *next; 00178 }; 00179 00180 00181 #endif //LIBPROC_H_DKAFH4U3AG9Q0JRIOEQAIJ

Generated on Thu Dec 30 21:48:53 2004 for The Versatile Governor by doxygen 1.3.8