*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> getlogin (3c)              
Title
Content
Arch
Section
 

Contents


getlogin(3C)							  getlogin(3C)


NAME    [Toc]    [Back]

     getlogin, getlogin_r - get	login name

SYNOPSIS    [Toc]    [Back]

     #include <unistd.h>

     char *getlogin (void);

     int getlogin_r (char *name, size_t	namelen);

DESCRIPTION    [Toc]    [Back]

     getlogin returns a	pointer	to the login name as found in /var/adm/utmp.
     It	may be used in conjunction with	getpwnam to locate the correct
     password file entry when the same user id is shared by several login
     names.

     If	getlogin is called within a process that is not	attached to a
     terminal, it returns a null pointer.  The correct procedure for
     determining the login name	is to call cuserid, or to call getlogin	and if
     it	fails to call getpwuid.

     getlogin_r	is a reentrant version of getlogin.  The login name is copied
     into the character	array pointed to by name.  The array is	namelen	long
     and should	have space for the name	and the	terminating null character.
     The maximum size of the login name	is {LOGIN_NAME_MAX}.  sysconf(3C) may
     be	used to	determine this value.

     The following error can be	returned by getlogin_r:

     ERANGE	    The	value of namelen is smaller than the length of the
		    string to be returned.

FILES    [Toc]    [Back]

     /var/adm/utmp

SEE ALSO    [Toc]    [Back]

      
      
     cuserid(3S), getgrent(3C),	getpwent(3C), sysconf(3C), utmp(4)

DIAGNOSTICS    [Toc]    [Back]

     getlogin returns a	null pointer if	the login name is not found.
     getlogin_r	returns	0 on success or	a an error number on failure.

NOTES    [Toc]    [Back]

     The return	values point to	static data whose content is overwritten by
     each call.


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
auth_ttyok FreeBSD functions for checking login class based login restrictions
login_ok FreeBSD functions for checking login class based login restrictions
auth_timeok FreeBSD functions for checking login class based login restrictions
auth_hostok FreeBSD functions for checking login class based login restrictions
setlogin NetBSD get/set login name
getlogin FreeBSD get/set login name
setlogin FreeBSD get/set login name
getlogin OpenBSD get/set login name
getlogin_r FreeBSD get/set login name
getlogin NetBSD get/set login name
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service