From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079091516081.tru64-unix-managers.marc@archive.invalid> From: Eyal Rif Date: Wed, 01 Dec 1999 07:50:17 +0000 To: tru64-unix-managers Subject: SUMMERY: how to get kernel variables using c X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079091516081 First of all thanks to everyone who answered this is truely a very good mailing list, I was ammazed by the number of answers and the response time that was very fast. all the answers i got detailed the following system calls/ c functions: Table - a very usefull system call which can get real time details on the system getsysinfo, sysconf, sysinfo - get fixed variables on the system detailed information on this functions can found in man "function" here is a sample program that Paul A Sand sent me: #include #include #include main() { struct tbl_sysinfo stab; struct tbl_loadavg ltab; table(TBL_SYSINFO, 0, &stab, 1, sizeof(struct tbl_sysinfo)); printf("System was booted at %ld\n", stab.si_boottime); printf("System up %0.2f days\n", (time(NULL) - stab.si_boottime)/86400.0); table(TBL_LOADAVG, 0, <ab, 1, sizeof(struct tbl_loadavg)); if (ltab.tl_lscale == 0) { printf("Load averages: %0.2f, %0.2f, %0.2f\n", ltab.tl_avenrun.d[0], ltab.tl_avenrun.d[1], ltab.tl_avenrun.d[2]); } else { printf("Load averages: %0.2f, %0.2f, %0.2f\n", ((double) ltab.tl_avenrun.l[0])/ltab.tl_lscale, ((double) ltab.tl_avenrun.l[1])/ltab.tl_lscale, ((double) ltab.tl_avenrun.l[2])/ltab.tl_lscale); } }