lkml.org 
[lkml]   [2001]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How can I know the number of current users in the system?
On 6 Nov 2001, Terje Eggestad wrote:

> Absolutly true.
>
> You can get a 90% solution by testing for tty and for proces that has a
> connection to a tcp port between 6000 and 6100 somewhere or has a unix
> socket to /tmp/.X11-unix/X0 (or whereever X chooses to place the unix
> socket).
>
> But thats definitly not good enough to base your scheduling on.
>
> TJ

If you don't mind having your Web-Server with 1000 connections/second
be a "single user", just scan for all the unique UID/GID pairs.
All the root processes are one "user", the lpd is another user,
Apache is another user, login-joe is another user, etc. The total
number of tasks is the number of directories that represent digits
in /proc.


Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

I was going to compile a list of innovations that could be
attributed to Microsoft. Once I realized that Ctrl-Alt-Del
was handled in the BIOS, I found that there aren't any.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:12    [W:0.029 / U:2.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site