From owner-freebsd-hackers Thu Jul 2 11:40:01 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA14604 for freebsd-hackers-outgoing; Thu, 2 Jul 1998 11:40:01 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from iconmail.bellatlantic.net (iconmail.bellatlantic.net [199.173.162.30]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA14565; Thu, 2 Jul 1998 11:39:45 -0700 (PDT) (envelope-from dmm125@bellatlantic.net) Received: from bellatlantic.net (client201-122-36.bellatlantic.net [151.201.122.36]) by iconmail.bellatlantic.net (IConNet Sendmail) with ESMTP id OAA25846; Thu, 2 Jul 1998 14:36:55 -0400 (EDT) Message-ID: <359B9B21.6DE01652@bellatlantic.net> Date: Thu, 02 Jul 1998 14:37:21 +0000 From: Donn Miller X-Mailer: Mozilla 4.05 [en] (X11; I; FreeBSD 2.2.6-RELEASE i386) MIME-Version: 1.0 To: Mike Smith CC: questions@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: FreeBSD equiv. of /proc/loadavg References: <199807021826.LAA01241@antipodes.cdrom.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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