Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jul 1998 05:24:41 -0400 (EDT)
From:      ADRIAN Filipi-Martin <adrian@ubergeeks.com>
To:        Donn Miller <dmm125@bellatlantic.net>
Cc:        questions@FreeBSD.ORG
Subject:   Re: FreeBSD equiv. of /proc/loadavg
Message-ID:  <Pine.BSF.3.96.980702051947.8213B-100000@lorax.ubergeeks.com>
In-Reply-To: <359B13F0.82AF7F1B@bellatlantic.net>

next in thread | previous in thread | raw e-mail | index | archive | help

	Well, I don't know how cleanly this can be done, but I'd take a
look at both the sysctl(2) manpage and the w/uptime(1) sources.  It looks
like you will need to put a layer between the goal, getting the stat, and
the implementation, using fread/sysctl. 

	Adrian
--
[ adrian@ubergeeks.com -- Ubergeeks Consulting -- http://www.ubergeeks.com/ ]

On Thu, 2 Jul 1998, Donn Miller wrote:

> ADRIAN Filipi-Martin wrote:
> > 
> > On Thu, 2 Jul 1998, Donn Miller wrote:
> > 
> > >
> > > Am looking for the FreeBSD equivalent of the Linux file /proc/loadavg.  I
> > > want to use this instead of using getloadavg().
> > >
> > > I'm also looking for the equivalent of these.  This is what I think they
> > > are:
> > >
> > > Linux         FreeBSD
> > > =====         =======
> > > /proc/meminfo /proc/curproc/mem
> > > /proc/stat    /proc/curproc/status
> > > /proc/loadavg ??? (probably /kernel)
> > > /proc/uptime  ??? (probably /kernel)
> > 
> >         Hope I'm not missing the point, but what's wrong with uptime(1)?
> > There has been talk of a /kernelfs, but I doubt that will be happening
> > anytime soon.
> > 
> 
> Well, I'm was looking to port some Linux apps that make system calls
> like:
> 
> FILE    *fp_meminfo;
> FILE    *fp_stat;
> FILE    *fp_loadavg;
> 
> 
> /*.....*/
>  fp = fopen("/proc/uptime", "r");  
>         fp_meminfo = fopen("/proc/meminfo", "r");
>         fp_loadavg = fopen("/proc/loadavg", "r");
>         fp_stat = fopen("/proc/stat", "r");
> 
> And I needed some FreeBSD equivalent files to open in /proc.  An example
> would be
> 
>  fp_stat = fopen("/proc/stat", "r"); /*Linux*/
> 
>  fp_stat = fopen("/proc/curproc/status", "r"); /*FreeBSD*/
> 
> And the /proc/uptime probably has no equivalent /proc entry in FreeBSD,
> so would likely have to use /kernel instead.
> 
> Another example is the line:
> 
> fp_meminfo = fopen("/proc/meminfo", "r"); /*Linux*/
> fp_meminfo = fopen("/proc/curproc/mem", "r"); /*FreeBSD*/
> 
> etc.  I just needed some FreeBSD equivalent files for porting from Linux
> to FreeBSD, like for wine, some load ave. utilities in WindowMaker, etc.
> 
> --Donn
> 

	Adrian
--
[ adrian@ubergeeks.com -- Ubergeeks Consulting -- http://www.ubergeeks.com/ ]


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980702051947.8213B-100000>