Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tektronix!sequent!jackg
From: jackg@sequent.UUCP (Jack Griffith)
Newsgroups: comp.sys.sequent
Subject: Re: why does who not show rlogin-users
Message-ID: <22295@sequent.UUCP>
Date: 26 Sep 89 20:46:03 GMT
References: <964@maestro.htsa.aha.nl> <2400057@kailand>
Reply-To: jackg@sequent.UUCP (Jack Griffith)
Organization: Sequent Computer Systems, Inc
Lines: 46


I wanted to respond to some much earlier discussion regarding number of
users as indicated by utmp and the # of users allowed to login to the
system.  I've recently run across an implementation of an undocumented
library routine that will add the utmp entries for you.

The "logic" with which init counts the number of users is to
consider all of those with NULL host entries as direct tty ports
and an individual user.  Those with the same non-NULL host entry
and user name will be counted as one user.  Window SW needs to adhere
to this in order to add new users without init thinking that you've
gone beyond the user limit and bringing you down to single user
(what Patrick Wolfe referred to as the panic regarding this).

It is obviously prudent, given the drastic course that init
takes, to checking your number of users against the limit before
you go to try to add a new user.  login does this as well as Sequent's
flavor of xterm in S-Windows.

The "preferred" method of this is to use add_utmp(3) which is
currently undocumented (which has been recorded as a bug).
It has the magic to check the number of user's in it and
to return -1 when you've exceeded the usrlimit rather than
getting "nailed" by init.

add_utmp takes two params ...slot is the tty slot (pseudotty slot
that you just acquired) to add and up is the utmp entry that you
wish to add (stuff and play).

/*
 * add_utmp
 *	Add utmp entry to utmp file
 *	Return 0 for success, -1 for error or usr limit reached
 */
add_utmp(slot, up)
	int	slot;
	struct	utmp *up;

________________________

Jack Griffith
Customer Service
Sequent Computer Systems
uunet!sequent!jackg
(800) 854-9969
_________________________