history (was Re: base-files: LOGNAME)

Cyrille Lefevre cyrille.lefevre-lists@laposte.net
Sat Jun 26 00:44:00 GMT 2010


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



More information about the Cygwin mailing list