getloadavg and source for /usr/bin/uptime
Hi, I'm running 5.3-RC1 and am trying to develop a (VERY) simple C based tool to retrieve the system loads (as reported by uptime). NB - I don't want to pipe uptime into awk or use a perl script etc, I'd much prefer it to be C based. As I'm dreadful at C I thought I'd look at the source for the uptime program as that uses getloadavg from what I gather and modify it to suit my needs. The problem is, and I'm obviously being a bit stupid here, I can't find the sources for it ... ? I've grep'd and searched the entire source tree a good few times but can't seem to find it. I've googled for things like freebsd uptime or freebsd uptime.c as well as many others but have had no joy, and have read what I believe to be the relevant manpages. If any knows where it's hiding (or why it's not there) I'd be very grateful if you could share it with me. Many thanks, David ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: getloadavg and source for /usr/bin/uptime
On Wed, Oct 27, 2004 at 11:09:46PM +0100, David Jenkins wrote: NB - I don't want to pipe uptime into awk or use a perl script etc, I'd much prefer it to be C based. If you *did* want to do it that way, something like uptime | sed -e 's/.*: \([0-9.]*\).*/\1/' is handy. If any knows where it's hiding (or why it's not there) I'd be very grateful if you could share it with me. Probably because /usr/bin/uptime is a hard link to the /usr/bin/w binary. I think you want the code from /usr/src/usr.bin/w/w.c. -T -- It is not always the same thing to be a good man and a good citizen. -- Nicomachean Ethics, 325 B.C. by Aristotle ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: getloadavg and source for /usr/bin/uptime
On Wed, 27 Oct 2004 16:14:18 -0600, Tillman Hodgson [EMAIL PROTECTED] wrote: Probably because /usr/bin/uptime is a hard link to the /usr/bin/w binary. I think you want the code from /usr/src/usr.bin/w/w.c. D'oh. That's exactly what I'm after. Thanks, David ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]