bwtmps.3c (2010 09)

b
bwtmps(3C) bwtmps(3C)
NAME
bwtmps: bwtmpname(), updatebwdb(), getbwent(), setbwent(), endbwent() - access and update routines
for the wtmps and btmps databases
SYNOPSIS
#include <utmps.h>
void bwtmpname(char *file);
int updatebwdb(struct utmps *utmps, size_t size);
struct utmps * getbwent(size_t size);
void setbwent(void);
void endbwent(void);
DESCRIPTION
getbwent() returns a pointer to a utmps structure. The key members of
utmps structure are :
char ut_user[] User login name
char ut_id[] Unique Id to distinguish an entry
char ut_line[] Device name
pid_t ut_pid Process Id
short ut_type Type of Entry
struct ut_exit The exit status of a process
struct timeval ut_tv Time entry was made
char ut_host[] Host name, if remote
uint8_t ut_addr[] Internet Address of the Host,
if remote
short ut_addr_type Flag to identify type of address
in ut_addr
Routines
The following routines are provided:
bwtmpname() Allows the user to set the database being examined to either WTMPS_FILE or
BTMPS_FILE. bwtmpname() does not open the database -- it merely closes
the old file if it is currently open, and saves the new file name. WTMPS_FILE
and BTMPS_FILE are macros defined in <utmps.h> header file, which refer to
/var/adm/wtmps and /var/adm/btmps
files respectively .
getbwent() Reads in the next entry from either WTMPS_FILE or BTMPS_FILE depending
on the previous call to bwtmpname(). If the database is not already open,
getbwent() opens it. If it reaches end of file, getbwent() fails.
updatebwdb() Appends the utmps structure pointed to by utmps to either BTMPS_FILE or
WTMPS_FILE as set by the previous call to bwtmpname().
setbwent() Resets the requests for getbwent() to begin from the start of the database, as
specified by a previous call to bwtmpname().
endbwent() Closes the handle of the currently open database.
RETURN VALUE
getbwent() returns pointer to structure of type struct utmps on success. If size is not one of the
supported utmps structure sizes , getbwent() returns NULL and sets errno to [EINVAL]. On reach-
ing end of database, getbwent returns NULL.
updatebwdb() returns 0 if append to the database is successful. updatebwdb() returns -1 on failure
to append to database.
ERRORS
[EINVAL] The size parameter passed to the bwtmps (3C) functions does not match any of the
utmps structure sizes supported .
WARNINGS
Applications should not access the
wtmps and btmps databases directly, but should use these functions
as the structure written to these databases is a superset of the utmps structure. updatebwdb() does
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (2 pages)