Main Page | File List

src/libproc/libproc-utils.h

00001 /* 00002 *libproc 00003 * 00004 *common utilities needed to process /proc. 00005 * 00006 *A library interface for finding process information from /proc. 00007 *This is also an interface into various things which haven't yet been integrated into sysfs, 00008 * as appropriate. 00009 00010 Copyright (C) 2004 Joseph Pingenot 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later 00016 version. 00017 00018 This library is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 Lesser General Public License for more details. 00022 00023 You should have received a copy of the GNU Lesser General Public 00024 License along with this library; if not, write to the Free Software 00025 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 00027 */ 00028 00029 00030 /*This reads in the file requested, and it then outputs a pointer to the head 00031 * of a singly-linked list which is used in subsequent operations. This pointer 00032 * is cast to null, and the interior data structure never revealed; this allows 00033 * the internals to be monkeyed with without breaking anything. 00034 */ 00035 void *readfile_init(const char *file, int *err); 00036 00037 /*This grabs the appropriate line and returns the value for that line 00038 * as a string. If there are multiple appropriate lines, this returns the 00039 * first instance. 00040 */ 00041 char *readfile_getline(void *handle, const char *line, int *err); 00042 00043 /*This grabs the nth value in the list*/ 00044 char *readfile_get_valuen(void *handle, unsigned int line, int *err); 00045 /*Just like the one above, but it returns the line, not the value*/ 00046 char *readfile_get_linen(void *handle, unsigned int line, int *err); 00047 00048 /*This grabs the line number of the specified line.*/ 00049 int readfile_getlinenum(void *handle, const char* line, int *err); 00050 00051 /*This frees the list when you're done with it. 00052 *NOTE: this will also free the strings!!! You'd better have backed them up before 00053 * you call this puppy! 00054 */ 00055 void readfile_end(void *handle); 00056 00057 /*Convenience functions.*/ 00058 int readfile_getline_int(void *handle, const char *line, int *err); 00059 long int readfile_getline_lint(void *handle, const char *line, int *err); 00060 float readfile_getline_float(void *handle, const char *line, int *err); 00061 double readfile_getline_double(void *handle, const char *line, int *err);

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