Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > B

bwtmps(3C)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

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 reaching 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 not update /var/adm/wtmp and /var/adm/btmp files.

bwtmps(3C) interfaces load shared library libuseracct.so.1/libuseracct.1.

Compile/link for Archive Applications (PA-RISC only)

If you use bwtmps(3C) interfaces and compile/link your application archive, please note that bwtmps(3C) interfaces have a dependency on libdld.sl that will require a change to the compile/link command:

Compile :

cc -Wl,-a,archive -Wl,-E -Wl,+n -l:libdld.sl -o outfile source

Or compile with CCOPTS and LDOPTS:

  • export CCOPTS="-Wl,-a,archive options -Wl,-E -l:libdld.sl"

  • export LDOPTS="options -E +n -l:libdld.sl"

    cc -o outfile source

The option -Wl,-a,archive is positionally dependent and should occur at the beginning of the compile line. For optimum compatibility in future releases, you should avoid using archive libc with other shared libraries except for libdld.sl as needed above.

AUTHOR

The bwtmps routines were developed by Hewlett-Packard Company.

FILES

/var/adm/wtmps /var/adm/btmps

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.