I'm trying to write some code to determine the load average under
Solaris 2. While trying to get this working--and it's harder than it
looks--I discovered that uptime opens /dev/kstat and (I think) gets the
load average from some ioctls to that device. I don't have any
documentation that even mentions /dev/kstat. There is a
/usr/include/kstat.h file that has some interesting things in it, but I
can't tell how to use them.
I'm not sure why uptime would use /dev/kstat (if it does) for the load
average. There is an avenrun in the kernel anyway, although I have to
admit I haven't managed to figure out how to get to it from a C
program. I have code that works under SunOS 4.1.3.
I guess I could always do a popen() uptime, but I'd rather not...