Changeset 1403 for trunk/lang/tcl
- Timestamp:
- Apr 17, 2009, 10:18:03 AM (15 years ago)
- Location:
- trunk/lang/tcl/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lang/tcl/src/Makefile.in
r1383 r1403 31 31 32 32 INCLUDES = -I$(srcdir) \ 33 -I../../../src/core \ 33 34 -I$(srcdir)/../../../src/core \ 34 35 -I$(includedir) -
trunk/lang/tcl/src/RpSysinfo.c
r1327 r1403 13 13 * ====================================================================== 14 14 */ 15 #include "config.h" 15 16 #include <tcl.h> 16 17 #include <stdlib.h> 17 18 #include <stddef.h> 18 19 #include <string.h> 20 21 static Tcl_CmdProc RpSysinfoCmd; 22 23 24 /* 25 * ------------------------------------------------------------------------ 26 * RpSysinfo_Init() 27 * 28 * Called in Rappture_Init() to initialize the commands defined 29 * in this file. 30 * ------------------------------------------------------------------------ 31 */ 32 int 33 RpSysinfo_Init(interp) 34 Tcl_Interp *interp; /* interpreter being initialized */ 35 { 36 /* install the sysinfo command */ 37 Tcl_CreateCommand(interp, "::Rappture::sysinfo", RpSysinfoCmd, 38 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 39 40 return TCL_OK; 41 } 42 43 #ifndef HAVE_SYSINFO 44 45 static int 46 RpSysinfoCmd(cdata, interp, argc, argv) 47 ClientData cdata; /* not used */ 48 Tcl_Interp *interp; /* interpreter handling this request */ 49 int argc; /* number of command line args */ 50 CONST84 char *argv[]; /* strings for command line args */ 51 { 52 Tcl_SetResult(interp, "command not implemented: no sysinfo", TCL_STATIC); 53 return TCL_ERROR; 54 } 55 56 #else 57 58 #ifdef HAVE_SYS_SYSINFO_H 19 59 #include <sys/sysinfo.h> 20 21 static Tcl_CmdProc RpSysinfoCmd; 22 static Tcl_Obj* RpSysinfoValue _ANSI_ARGS_((struct sysinfo *sinfo, 23 int idx)); 60 #endif /* HAVE_SYS_SYSINFO_H */ 24 61 25 62 #define RP_SLOT_LONG 1 … … 27 64 #define RP_SLOT_USHORT 3 28 65 #define RP_SLOT_LOAD 4 66 67 struct rpSysinfoList { 68 const char *name; /* Name of this system parameter */ 69 int type; /* Parameter type (long, unsigned long, 70 * etc.) */ 71 int offset; /* Offset into sysinfo struct */ 72 }; 29 73 30 74 #ifdef offsetof … … 34 78 #endif 35 79 36 static struct rpSysinfoList { 37 const char *name; /* Name of this system parameter */ 38 int type; /* Parameter type (long, unsigned long, 39 * etc.) */ 40 int offset; /* Offset into sysinfo struct */ 41 } RpSysinfoList [] = { 80 static struct rpSysinfoList RpSysinfoList [] = { 42 81 {"freeram", RP_SLOT_ULONG, Offset(struct sysinfo, freeram)}, 43 82 {"freeswap", RP_SLOT_ULONG, Offset(struct sysinfo, freeswap)}, … … 52 91 }; 53 92 54 /* 55 * ------------------------------------------------------------------------ 56 * RpSysinfo_Init() 57 * 58 * Called in Rappture_Init() to initialize the commands defined 59 * in this file. 60 * ------------------------------------------------------------------------ 61 */ 62 int 63 RpSysinfo_Init(interp) 64 Tcl_Interp *interp; /* interpreter being initialized */ 65 { 66 /* install the sysinfo command */ 67 Tcl_CreateCommand(interp, "::Rappture::sysinfo", RpSysinfoCmd, 68 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 69 70 return TCL_OK; 71 } 93 static Tcl_Obj* RpSysinfoValue(struct sysinfo *sinfo, int idx); 72 94 73 95 /* … … 187 209 return NULL; 188 210 } 211 212 #endif /*HAVE_SYSINFO*/
Note: See TracChangeset
for help on using the changeset viewer.