United States-English |
|
|
HP-UX Reference > Ggetuts(3C)HP-UX 11i Version 3: February 2007 |
|
NAMEgetuts: endutsent(), getutsent(), getutsid(), getutsline(), pututsline(), setutsent(), ENDUTSENT(), GETUTSENT(), GETUTSID(), GETUTSLINE(), PUTUTSLINE(), SETUTSENT(), — access and update routines for user-accounting database maintained by utmpd SYNOPSIS#include <utmps.h> struct utmps * getutsent(size_t utmps_size): struct utmps * getutsid(const struct utmps *id, size_t utmps_size): struct utmps * getutsline(const struct utmps *line, size_t utmps_size): struct utmps * pututsline(const struct utmps *utmps, size_t utmps_size): struct utmps * getutspid( pid_t pid, size_t utmps_size): void setutsent(void): void endutsent(void): RemarksThe size of the utmps structure (for example sizeof(struct utmps)) is passed as utmps_size parameter in the above calls. A macro equivalent exists for each of the above function calls. These macros provide a shorthand way of calling getuts(3C) functions, by implicitly passing the utmps_size parameter to the corresponding getuts(3C) function. struct utmps * GETUTSENT(): struct utmps * GETUTSID(const struct utmps *id): struct utmps * GETUTSLINE(const struct utmps *line): struct utmps * PUTUTSLINE(const struct utmps * utmps): struct utmps * GETUTSPID( pid_t pid): void SETUTSENT(void): void ENDUTSENT(void): DESCRIPTIONgetutsent(), getutsid(), and getutsline() each return a pointer to a utmps structure, the key elements of the 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 specific calling convention of passing the expected data structure size is used in order to allow for future expansion of the interface, and the utmps structure while preserving backward compatibility for programs written using the getuts(3C) interfaces. The interfaces encode the version information of the utmps structure in the utmps_size parameter. Should the utmps structure change in a future release, utmpd(1M) and libc interfaces detect the version of the utmps structure the application was compiled with based on the utmps_size parameter and return the appropriate utmps structure. The getuts(3C) interfaces use /etc/utmps file only when the utmpd(1M) is not running. This feature may be discontinued in a future release. The ut_addr field in the utmps structure can hold a 16 byte IPv6 address. In case applications want to write a four byte IPv4 address into this field, they must initialize the ut_addr_type field to IPV4_ADDRESS and use the last four bytes of the ut_addr field. Applications which write an IPv6 address into the ut_addr field must initialize the ut_addr_type to IPV6_ADDRESS. IPV4_ADDRESS and IPV6_ADDRESS are macros defined in utmps.h header file. RETURN VALUEgetutsent(), getutsid(), getutsline(), pututsline(), and getutspid() return a pointer to static utmps structure on success. On failure they return NULL. ERRORS
WARNINGSIf the size of a member of the utmps structure changes in a future release, applications compiled with older version of the utmps structure will get truncated information for the structure fields that have expanded. To get the complete information, the applications have to be re-compiled. The value returned by getutsent(), getutsid(), getutsline(), pututsline(), and getutspid() points to a single static area that is overwritten by each call to any of the functions, so it must be copied if it is to be saved. |
Printable version | ||
|