getutx(3C) SDK R4.11 getutx(3C)
NAME
getutx: getutxent, getutxid, getutxline, pututxline, setutxent,
endutxent, utmpxname, getutmp, getutmpx, updwtmp, updwtmpx - access
utmpx file entry
SYNOPSIS
#include <utmpx.h>
struct utmpx *getutxent (void);
struct utmpx *getutxid (const struct utmpx *id);
struct utmpx *getutxline (const struct utmpx *line);
struct utmpx *pututxline (const struct utmpx *utmpx);
void setutxent (void);
void endutxent (void);
int utmpxname (const char *file);
void getutmp (struct utmpx *utmpx, struct utmp *utmp);
void getutmpx (struct utmp *utmp, struct utmpx *utmpx);
void updwtmp (char *wfile, struct utmp *utmp);
void updwtmpx (char *wfilex, struct utmpx *utmpx);
DESCRIPTION
getutxent, getutxid, getutxline, and pututxline each return a pointer
to a utmpx structure (See utmpx(4)).
DG/UX for Intel
getutxent reads in the next entry from UTMPX_FILE. If the file is
not already open, getutxent calls setutxent to open it. If it
reaches the end of the file, it fails.
getutxid searches forward from the current point in UTMPX_FILE until
it finds an entry with a ut_type matching id->ut_type if the type
specified is RUN_LVL, BOOT_TIME, OLD_TIME, or NEW_TIME. If the type
specified in id is INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or
DEAD_PROCESS, then getutxid will return a pointer to the first entry
whose type is one of these four and whose ut_id field matches,
character by character, id->ut_id . If the end of file is reached
without a match, it fails.
getutxline searches forward from the current point in UTMPX_FILE
until it finds an entry of the type LOGIN_PROCESS or USER_PROCESS
that also has a ut_line string matching the line->ut_line string. If
the end of file is reached without a match, it fails.
pututxline writes the supplied utmpx structure into UTMPX_FILE. It
uses getutxid to search forward for the proper place if it finds that
it is not already at the proper place. It is expected that normally
the user of pututxline will have searched for the proper entry using
one of the getutx routines. If so, pututxline will not search. If
pututxline does not find a matching slot for the new entry, it will
add a new entry to the end of the file. It returns a pointer to the
utmpx structure. If UTMP_FILE_UW exists, pututxline will also
convert the utmpx entry into a utmp entry and write it to
UTMP_FILE_UW.
setutxent resets the input stream to the beginning of the file. This
reset should be done before each search for a new entry if it is
desired that the entire file be examined. If the file is not
currently open, setutxent will open it.
endutxent closes the currently open file.
utmpxname allows the user to change the name of the file being
examined by all the getutx interfaces except updwtmp and updwtmpx,
from UTMPX_FILE to any other file. The other file is usually
WTMPX_FILE. If the file does not exist, this is not apparent until
the first attempt to reference the file. utmpxname does not open the
file. It just closes the old file if it is currently open and saves
the new file name. If the file name given does not end with the
``x'' character, or if it is longer than 79 characters, utmpxname
returns 0 and does not change the filename. Otherwise, it returns 1.
getutmp copies the information stored in the fields of the utmpx
structure to the corresponding fields of the utmp structure. If the
information in any field of utmpx does not fit in the corresponding
utmp field, the data is truncated.
getutmpx copies the information stored in the fields of the utmp
structure to the corresponding fields of the utmpx structure.
updwtmp converts utmp to a utmpx entry, and if necessary, appends an
``x'' character to wfile. updwtmp then calls updwmptx, passing the
new filename and utmpx entry as arguments.
updwtmpx creates wfilex if it does not exist. utmpx is then written
to wfilex. If wfilex cannot be opened or created, nothing will
happen. If UTMP_FILE_UW exists, updwtmpx will also convert the utmpx
entry into a utmp entry and write it to WTMP_FILE_UW.
UTMPX_FILE is defined to be /var/adm/utmpx.
WTMPX_FILE is defined to be /var/adm/wtmpx.
UTMP_FILE is defined to be /var/adm/utmpx.
WTMP_FILE is defined to be /var/adm/wtmpx.
UTMP_FILE_UW is defined to be /var/adm/utmp.
WTMP_FILE_UW is defined to be /var/adm/wtmp.
DG/UX for 88K
getutxent calls getutent, converting the utmp entry returned by
getutent into a utmpx entry. getutxent then returns a pointer to the
utmpx entry. If getutent fails, getutxent fails.
getutxid converts id from a utmpx record to a utmp record. It then
calls getutid, passing the converted utmp entry as an argument. The
resulting value from getutid is converted back to a utmpx entry.
getutxid then returns a pointer to the utmpx entry. If getutid
fails, getutxid fails.
getutxline converts line from a utmpx record to a utmp record. It
then calls getutline, passing the converted utmp entry as an
argument. The resulting value from getutline is converted back to a
utmpx entry. getutxline then returns a pointer to the utmpx entry.
If getutline fails, getutxline fails.
pututxline converts utmpx from a utmpx record to a utmp record. It
then calls pututline, passing the converted utmp entry as an
argument. The resulting value from pututline is converted back to a
utmpx entry. pututxline then returns a pointer to the utmpx entry.
If pututline fails, pututxline fails.
setutxent calls setutent.
endutxent calls endutent.
utmpxname removes any trailing ``x'' character from file. It then
calls utmpname, passing the new filename as an argument. If utmpname
fails, then utmpxname fails.
getutmp copies the information stored in the fields of the utmpx
structure to the corresponding fields of the utmp structure. If the
information in a utmpx field does not fit in the corresponding utmp
field, the data is truncated.
getutmpx copies the information stored in the fields of the utmp
structure to the corresponding fields of the utmpx structure.
updwtmp creates wfile if it does not exist. utmp is then written to
wfile. If wfile cannot be opened, or created, nothing will happen.
updwtmpx converts utmpx to a utmp entry, and removes any trailing
``x'' character from wfilex. updwtmpx then calls updwtmp, passing
the new filename and utmp entry as arguments.
UTMPX_FILE is defined to be /var/adm/utmp.
WTMPX_FILE is defined to be /var/adm/wtmp.
UTMP_FILE is defined to be /var/adm/utmp.
WTMP_FILE is defined to be /var/adm/wtmp.
UTMP_FILE_UW is not defined.
WTMP_FILE_UW is not defined.
Considerations for Threads Programming
+-----------+-----------------------------+
| | async- |
|function | reentrant cancel cancel |
| | point safe |
+-----------+-----------------------------+
|endutxent | N - - |
|getutmp | N - - |
|getutmpx | N - - |
|getutxent | N - - |
|getutxid | N - - |
|getutxline | N - - |
|pututxline | N - - |
|setutxent | N - - |
|updwtmp | N - - |
|updwtmpx | N - - |
|utmpxname | N - - |
+-----------+-----------------------------+
FILES
/var/adm/utmpx, /var/adm/utmp
/var/adm/wtmpx, /var/adm/wtmp
SEE ALSO
reentrant(3), getut(3C), ttyslot(3C), utmpx(4), utmp(4).
DIAGNOSTICS
A null pointer is returned upon failure to read, whether for
permissions or having reached the end of file, or upon failure to
write.
NOTES
The most current entry is saved in a static structure. Multiple
accesses require that it be copied before further accesses are made.
On each call to either getutxid or getutxline, the routine examines
the static structure before performing more I/O. If the contents of
the static structure match what it is searching for, it looks no
further. Therefore, to use getutxline to search for multiple
occurrences, you must zero out the static area after each success, or
getutxline just returns the same structure over and over again.
There is one exception to the rule about emptying the structure
before further reads are done. The implicit read done by pututxline
(if it finds that it is not already at the correct place in the file)
will not hurt the contents of the static structure returned by the
getutxent, getutxid or getutxline routines, if the user has just
modified those contents and passed the pointer back to pututxline.
Licensed material--property of copyright holder(s)