From owner-freebsd-questions Thu Jul 2 02:25:56 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA13675 for freebsd-questions-outgoing; Thu, 2 Jul 1998 02:25:56 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from lorax.ubergeeks.com (lorax.ubergeeks.com [206.205.41.241]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA13667 for ; Thu, 2 Jul 1998 02:25:53 -0700 (PDT) (envelope-from adrian@lorax.ubergeeks.com) Received: from localhost (adrian@localhost) by lorax.ubergeeks.com (8.8.8/8.8.8) with SMTP id FAA08228; Thu, 2 Jul 1998 05:24:41 -0400 (EDT) (envelope-from adrian@lorax.ubergeeks.com) Date: Thu, 2 Jul 1998 05:24:41 -0400 (EDT) From: ADRIAN Filipi-Martin Reply-To: Adrian Filipi-Martin To: Donn Miller cc: questions@FreeBSD.ORG Subject: Re: FreeBSD equiv. of /proc/loadavg In-Reply-To: <359B13F0.82AF7F1B@bellatlantic.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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