Subject: Re: pcvt and TIOCCONS
To: None <current-users@NetBSD.ORG>
From: Ty Sarna <tsarna@endicor.com>
List: current-users
Date: 04/19/1996 04:23:00
In article <4586.829874966@UX2.SP.CS.CMU.EDU>,
Chris G Demetriou <Chris_G_Demetriou@UX2.SP.CS.CMU.EDU> wrote:
> I like gordon's idea a lot better, overall, i think... it seems
> much easier to use, and much easier to implement.
I have a few issues with it:
% Actions to be performed at login and logout time would be controlled
% by two files: /etc/tty_login and /etc/tty_logout respectively. Both
I'd really rather have it all in one file. See below.
% The format could (optionally) be extended to allow multi-line
% commands by continuing onto the next line when a backslash is
% the last character on the line. [ Is this desirable? ]
Yes. I hate that sup won't let me split long lines, and it seems likely
that lines in this file might be long.
% The tty_name would be matched against the name of the current
% tty line so all lines (and only those lines) with he tty_name
% field matching would be processed.
I like cgd's idea about supporting globs here.
% The shell_command field would be run as 'sh -c "shell_command"'
% with the following environment variable guaranteed to be set:
%
% USER=user_name
Also need GROUP for the user's group name.
Might be nice to have TTY as the login tty's name.
% Example /etc/tty_login file:
% # This line just needs one related device chown'ed
% /dev/wsconsole chown ${USER} /dev/wsmouse
% # This line has several related devices, which are
% # handled by the external program /etc/console.sh
% /dev/kdconsole /etc/console.sh login
To get this all in one file (/etc is cluttered enough, and I'd rather
not to have to consult two different files to see what's configured for
a single tty), I propose that a second field be added for the action
name (like my earlier proposal). Let it be glob matched as well,
and add ACTION to the environment too. Example:
# This line just needs one related device chown'ed
/dev/wsconsole login chown ${USER} /dev/wsmouse
/dev/wsconsole logout chown root /dev/wsmouse
# This line has several related devices, which are
# handled by the external program /etc/console.sh
/dev/kdconsole * /etc/console.sh ${ACTION}
% Here is a proposed interface for the new libutil function:
%
% void tty_relatives(char *filepath, char *ttyname, char *username);
int tty_relatives(char *ttyname, char *action, char *username, char *groupname);
Returns the return value of the sh -c (can be ignored, but
the return should be availible).
action would normally be "login" or "logout", but is open for future
expansion.
The file should be /etc/tty_relatives (or maybe /etc/ttyaction, in which
case the routine should be renamed as well).
I repeat my earlier question: Should this file (and the rest of libutil)
have a header? Currently each program that wants libutil stuff declares
its own prototypes.
Also, my proposal had the following advantages, though I don't think
they're significant:
- fbtab backward compatible (doesn't seem hat important)
- common actions (chmod, chown) don't require spawning a new process
(but logins don't happen that often, so the overhead doesn't seem that
critical).
The advantages that are important is a way easily to do things
with the user's group, and the ability to specify login and logout
actions together for maintainability. OTOH, this proposal is simpler
and cleaner. So, I propose the above changes to Gordon's proposal as a
compromise (actually, I think I like it better). Is this agreeable?