Re: How can I know the number of current users in the system?

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Tue Nov 06 2001 - 09:40:28 EST


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/



This archive was generated by hypermail 2b29 : Wed Nov 07 2001 - 21:00:30 EST