Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

reentrant(3)

cuserid(3S)

getgrent(3C)

getpwent(3C)

utmp(4)



getlogin(3C)                   DG/UX R4.11MU05                  getlogin(3C)


NAME
       getlogin, getlogin_r - get login name

SYNOPSIS
       #include <stdlib.h>

       char *getlogin (void);

       char *getlogin_r (char *name, int namelen);

DESCRIPTION
       getlogin and getlogin_r return a pointer to the login name as found
       in /etc/utmp.  Instead of returning static data, getlogin_r returns
       the login name into the location pointed to by name. The return value
       from getlogin_r is  the same value as name.  namelen is the maximum
       number of characters in name.  If getlogin_r detects an error, a NULL
       is returned and errno is set to indicate the error.  Both functions
       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 or getlogin_r are called within a process that is not
       attached to a terminal, both return a null pointer.  This is the case
       for processes started at the system console.  The correct procedure
       for determining the login name is to call cuserid, or to call
       getlogin or getlogin_r and if it fails to call getpwuid.


   Considerations for Threads Programming
                    +-----------+-----------------------------+
                    |           |                      async- |
                    |function   | reentrant   cancel   cancel |
                    |           |             point     safe  |
                    +-----------+-----------------------------+
                    |getlogin   |     N         -        -    |
                    |getlogin_r |     Y         Y        N    |
                    +-----------+-----------------------------+

FILES
       /etc/utmp

SEE ALSO
       reentrant(3), cuserid(3S), getgrent(3C), getpwent(3C), utmp(4).

DIAGNOSTICS
       Both functions return a null pointer if the login name is not found.

   Errors
       If the following condition occurs, getlogin_r returns a NULL
        and sets errno to the corresponding value:

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

NOTES
       The function getlogin_r is available only in the library, libc.so.

       getlogin returns a pointer to static data whose content is
       overwritten by each call.


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026