uptime()?

uptime()?

Post by Thomas B Bro » Sat, 03 Dec 1994 06:02:42



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?

regards,
tom

 
 
 

uptime()?

Post by Tod McQuill » Sat, 03 Dec 1994 11:33:36




Quote:> 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).

 
 
 

uptime()?

Post by Thomas B Bro » Tue, 06 Dec 1994 09:03:54


thanks to everyone who replied on this question.  the easiest solution
so far has been to use rnusers().

regards,
tom

 
 
 

uptime()?

Post by Jim Re » Wed, 07 Dec 1994 02:23:57




   > 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.

 
 
 

1. Uptime rollover, How to tell real uptime?

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??
Dale
=================================================================

Phone:(916)356-5332                     I speak only for myself
=====================================================================

2. Installing Red Hat on Win98 box

3. How does uptime.netcraft.com know my uptime?

4. SCO 5.0 SUCKS! (OR IS IT JUST SCO?)

5. Segfaults on Server after long uptime using 2.2.x

6. mouse problem

7. longest uptime

8. "execute command" not working?

9. How to check for uptime in KDE ?

10. Longest reported uptime??

11. enable uptime display > 497 days

12. High uptimes

13. How to prevent "apm" from turning off hard drive during uptime?