01-18-07 12:28 PM
2007-01-17, 17:41(-08), K-mart Cashier:
> I have the following users on my who list:
> kye p0 85.132.8.116 Tue06AM 13:11 -bash (bash)
> casper p2 frau.triohost.co Thu08PM 43 less -R -E -X
> -Q -r -d
> cdalten p4 eecs.berkeley.edu 8:33PM - w
> chocnut p5 pc8008.temp.co.l 7:06PM 6
> /usr/local/bin/real/ly
> najib p6 magnifix.com.my 1:38AM 18:06 mutt
> marcotap p7 dsl-189-133-6-33 8:16PM 17 -bash (bash)
>
>
> The problem is that some of them have a controlling terminal (ie their
> terminal is written to utmp)
Controlling terminals are not related to utmp. A controlling
terminal is the terminal that sends you a SIGINT when the user
types CTRL-C and you are in its foreground process group or what
sends you a SIGTTIN when you try to read from it and are not in
its foreground process group.
You can know it with:
tty_of() { # arg: <pid>
if tty=$(ps -p "$1" -o tty=); then
case $tty in
("" | "?") return 1;;
(*) printf '/dev/%s\n' "$tty";;
esac
return 0
fi
return 1
}
--
Stéphane
[ Post a follow-up to this message ]
|