is there a routine on sunos called uptime()? (as opposed to the shell
command). if not, is there a routine i can call in C to tell me the
number of users on a system?
> is there a routine on sunos called uptime()? (as opposed to the shell
> command). if not, is there a routine i can call in C to tell me the
> number of users on a system?
stat(2) the utmp file. divide the size in bytes by the size of a
struct utmp (see utmp.h).
But this assumes that every active user on the system has exactly one
entry in the utmp file. This isn't necessarily so: some vendors leave
/etc/utmp world writeable! Also, many window systems like to create a
utmp entry for every "shell window" the user opens.
I have a linux system running 1.2.8 gcc 2.6.3 compiled Dec 28 95
According to the var/adm/messages file it was last booted on
Jan. 2, 1996. This would put the uptime at around 800 days.
Somewhere after 460 days the uptime counter must have rolled over
as the uptime given with "w" started again with low numbers.
I know it was not rebooted as there are daemons running that I started
by hand and are not in scripts.
Is there a way to get the real uptime?
Also I plan to shut it down soon as I am getting scared of fire
hazard due to lots of dust. The internal fan went out a year ago
and I have hung another fan on the back for cooling.
Is this maybe a record uptime??
Phone:(916)356-5332 I speak only for myself
12. High uptimes