Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 Jul 1998 14:37:21 +0000
From:      Donn Miller <dmm125@bellatlantic.net>
To:        Mike Smith <mike@smith.net.au>
Cc:        questions@FreeBSD.ORG, hackers@FreeBSD.ORG
Subject:   Re: FreeBSD equiv. of /proc/loadavg
Message-ID:  <359B9B21.6DE01652@bellatlantic.net>
References:  <199807021826.LAA01241@antipodes.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Mike Smith wrote:
> 
> >
> > Am looking for the FreeBSD equivalent of the Linux file /proc/loadavg.  I
> > want to use this instead of using getloadavg().
> 
> The obvious question here is "why"?

I just figured that some Linux programs were trying to obtain load
average info that way, and to ease porting, well, I wanted to open the
equivalent FreeBSD file.  I realize now though that if you want to port
some apps with low-level details, you gotta do a little reworking.

I was trying to port wmmon from WindowMaker.  It's just for Linux now. 
In addition, the app tries to obtain loadaverage, uptime, and memory
info about the machine like this: (from wmmon.c)

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");
> 
> > 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
> 
> No.  /proc/meminfo is memory information about the machine, while /proc/
> curproc/mem is the current process' address space.  /proc/stat is
> random junk, while /proc/curproc/stat is the status of the current
> process.
> 
> > /proc/loadavg ??? (probably /kernel)
> 
> sysctlbyname("vm.loadavg", ...)
> 
> > /proc/uptime  ??? (probably /kernel)
> 
> The difference between gettimeofday() and sysctlbyname("kern.boottime", ...)
> 

--Donn

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?359B9B21.6DE01652>