COHERENT manpages

This page displays the COHERENT manpage for getutid() [Find a record in login logging file by login identifier].

List of available manpages
Index


getutid() -- General Function (libc)

Find a record in login logging file by login identifier
#include <utmp.h>
struct utmp *getutid(id)
struct utmp *id;

Function getutid() searches a login file for a record with a given type, or
for a user with a given login identifier.

id is the address of an object type utmp, which is a structure whose fields
describe a login event.  (For a detailed description of this structure, see
the Lexicon  entry for utmp.h). Before you  call getutid(), initialize id's
fields as follows:

-> Set field  id.ut_type to the type  of record you wish  to retrieve.  The
   type can be one of the following:

        EMPTY          An empty entry
        RUN_LVL        Run level
        BOOT_TIME      Boot time
        OLD_TIME
        NEW_TIME
        INIT_PROCESS   Process spawned by init
        LOGIN_PROCESS  A getty waiting for a login
        USER_PROCESS   A user process
        DEAD_PROCESS
        ACCOUNTING

-> If  you  initialize  field  id.ut_type to  INIT_PROCESS,  LOGIN_PROCESS,
   USER_PROCESS,  or   DEAD_PROCESS,  initialize  field   id.ut_id  to  the
   identifier of  the user  whose login event  you are seeking.   Note that
   this  must  be  the  identifier  as  set by  /etc/init,  not  the  login
   identifier that the user types to log into your system.

If   you   initialize  field   ut_type   to  INIT_PROCESS,   LOGIN_PROCESS,
USER_PROCESS,  or  DEAD_PROCESS,  getutid()  seeks  the first  record  that
matches  both the  type  and the  identifier  that you  set in  id. If  you
initialize field ut_type to any other  type, it seeks the first record that
matches the type you requested.

If it finds a record that  matches your request, getutid() copies it into a
static  portion of  memory  and returns  the  address of  that memory.   It
returns NULL if it fails to  find a record of the type you requested, or if
it cannot open the login file.

By default,  getutid() reads  records from /etc/utmp.  If you wish  to read
records from another file, call utmpname() before you call getutid().

See Also

libc,
utmp.h