HP-UX Reference (11i v2 03/08) - 3 Library Functions A-M (vol 6)
g
getut(3C) getut(3C)
(TO BE OBSOLETED)
NAME
getutent( ), getutid( ), getutline(), pututline( ), _pututline( ), setutent( ), endutent( ), utmpname( ) - access
utmp file entry
SYNOPSIS
#include <utmp.h>
struct utmp *getutent(void);
struct utmp *getutid(const struct utmp *id);
struct utmp *getutline(const struct utmp *line);
struct utmp *_pututline(const struct utmp *utmp);
void pututline(const struct utmp *utmp);
void setutent(void);
void endutent(void);
int utmpname(const char *file);
Obsolescent Interfaces
int getutent_r(struct utmp **utmp, struct utmp_data *ud);
int getutid_r(
struct utmp *id,
struct utmp **utmp,
struct utmp_data *ud);
int getutline_r(
struct utmp *line,
struct utmp **utmp,
struct utmp_data *ud);
int pututline_r(const struct utmp *utmp, struct utmp_data *ud);
void setutent_r(struct utmp_data *ud);
void endutent_r(struct utmp_data *ud);
int utmpname_r(const char *file);
DESCRIPTION
getutent(), getutid(), and getutline() each return a pointer to a structure of the following
type:
struct utmp {
char ut_user[8]; /* User login name */
char ut_id[4]; /* /etc/inittab id (usually line #) */
char ut_line[12]; /* device name (console, lnxx) */
pid_t ut_pid; /* process id */
short ut_type; /* type of entry */
struct exit_status {
short e_termination; /* Process termination status */
short e_exit; /* Process exit status */
} ut_exit; /* The exit status of a process */
/* marked as DEAD_PROCESS. */
unsigned short ut_reserved1; /* Reserved for future use */
time_t ut_time; /* time entry was made */
char ut_host[16]; /* host name, if remote;NOTSUPPORTED*/
unsigned long ut_addr; /* Internet addr of host, if remote */
};
getutent() Reads in the next entry from a utmp-like file. If the file is not already open,
getutent() opens it. If it reaches the end of the file, getutent() fails.
getutid() Searches forward from the current point in the utmp 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,orNEW_TIME. If the type specified in id is INIT_PROCESS,
HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−429