SunOS5 load average

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: exim-users
Subject: SunOS5 load average
Thanks to Chris Thompson, I have been made aware of a potential problem
in SunOS5 (Solaris 2) concerned with load averages. To obtain the load
average on this system you have to call kvm_open() as root. You can they
subsequently use kvm_read() under any uid. Now, kvm_open() opens (behind
your back) various files, including /dev/ksysms. Looking at the man page
for /dev/ksyms one finds

Avoid keeping the /dev/ksysms file open for extended periods of time,
either by using kvm_open(3K) of the default namelist file or with a
direct open.

and it them goes on to tell you why this is a bad idea (concerned with
locking loaded kernel modules and dynamic reconfiguration).

This means that the Exim daemon cannot just call kvm_open() as root when
it starts up and leave it open for evermore. The only way I can see to
resolve this problem is to run the daemon as root all the time, and only
setuid inside the subprocess that is forked off to handle an incoming
call. I don't think this is too much of a loss, but it is a shame that
it is necessary.

I got the code for reading load averages by reading the code used by GNU
"make". I believe this code is also used in emacs. As far as I can tell,
on SunOS5 the code calls kvm_open() the first time and leaves it open
thereafter. This would seem to be a bad thing to do for long-running
emacs sessions...

Does any Solaris expert out there know anything that disagrees with the
above?

--
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714