This is the mail archive of the
cygwin
mailing list for the Cygwin project.
history (was Re: base-files: LOGNAME)
- From: Cyrille Lefevre <cyrille dot lefevre-lists at laposte dot net>
- To: cygwin at cygwin dot com
- Date: Sat, 26 Jun 2010 02:44:33 +0200
- Subject: history (was Re: base-files: LOGNAME)
- References: <4C021FA8.4030403@users.sourceforge.net> <AANLkTilUfdSyZF6bVEKHCqImBF62vIu8aV2SNq2cx6xI@mail.gmail.com> <20100531081825.GF16885@calimero.vinschen.de> <AANLkTikWtsAkY6ZasbF3ihfjtLVXBxkHDNN-Zj3AhQoL@mail.gmail.com>
Le 31/05/2010 13:22, Andy Koppe a Ãcrit :
<snip>
Posix defines LOGNAME, but regarding USER it only says that it is
"unwise to conflict with certain variables that are frequently
exported by widely used command interpreters and applications".
(http://opengroup.org/onlinepubs/007908799/xbd/envvar.html)
FYI only, in short :
historically, USER is the bsd variant of the sysv LOGNAME.
long...
sunos, login(1) both set USER and LOGNAME using pwd->pw_name
also, logname(1) uses cuserid(3) instead of getlogin(3)
cuserid(3) does getpwuid(geteuid()) || getlogin() || NULL
funny, logname(3) does getenv("LOGNAME") in libxpg !
solaris, login(1) only set LOGNAME
logname(1) does getlogin(3)
in both case, getlogin(3) does an utmp lookup using
a kind of ttyslot() * sizeof(struct utmp) || NULL
sys5r4, same as solaris, but
getlogin(3) does an utmp lookup using a kind
of a while getsid(0) != utmp.ut_pid loop
cuserid(3) does a getlogin(3) || getpwuid(getuid()) || NULL
irix, login(1) and logname(1) does as sunos
getlogin(2) does an utmp lookup using a kind
of a while ttyname(0||1||2) == utmp.ut_line
cuserid(3) does as sys5r4
osf1, login(1) does as sunos, logname(1) as solaris
getlogin(1) does a syscall _getlogin(2)
cuserid(3) does as getpwuid(getuid()) || NULL
Regards,
Cyrille Lefevre
--
mailto:Cyrille.Lefevre-lists@laposte.net
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple