Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.hawaii.edu!ames!usenet.kornet.nm.kr!usenet.etri.re.kr!news.kreonet.re.kr!news.dacom.co.kr!vyzynz!bofh.dot!newsfeed.concentric.net!cdc2.cdc.net!vixen.cso.uiuc.edu!howland.reston.ans.net!math.ohio-state.edu!jussieu.fr!oleane!francenet.fr!itesec!sidhe.frmug.fr.net!not-for-mail
From: roberto@keltia.freenix.fr (Ollivier Robert)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: How do you use SYSCTL?
Date: 14 May 1996 14:29:14 GMT
Organization: Herve Schauer Consultants
Lines: 28
Message-ID: <4na5bq$3ok@sidhe.hsc.fr>
References: <4n8rvl$ndo@ucsbuxb.ucsb.edu>
NNTP-Posting-Host: sidhe.hsc.fr
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
[courtesy cc of this posting sent to cited author via email]
In article <4n8rvl$ndo@ucsbuxb.ucsb.edu>,
Loren Koss <loren@mcl.ucsb.edu> wrote:
> I'm trying to write a program that checks the load and number of
> processes and makes sure there is enough to do the program. I am having
> trouble using the KERN_FILE and KERN_PROC. I am confused by the
> structure returned.
Look into the sysctl(3) man page:
int mib[2], maxproc;
size_t len;
mib[0] = CTL_KERN;
mib[1] = KERN_MAXPROC;
len = sizeof(maxproc);
sysctl(mib, 2, &maxproc, &len, NULL, 0);
sysctl will use the mib[] array to find which parameter you want. Both
KERN_MAXFILE and KERN_MAXPROC are integer variables.
What I haven't found yet is the way to get multi-level variables (like
net.inet.ip.sourceroute) from within a C program.
--
Ollivier ROBERT -=-=- FreeBSD 2.x FAQ maintainer -=-=- roberto@freebsd.org
-=-=-=-=-=- Support The Free UNIX Systems ! FreeBSD Linux NetBSD -=-=-=-=-=-