Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getutmp(3) [v7 man page]

GETUTMP(3)						     Linux Programmer's Manual							GETUTMP(3)

NAME
getutmp, getutmpx - copy utmp structure to utmpx, and vice versa SYNOPSIS
#define _GNU_SOURCE /* See feature_test_macros(7) */ #include <utmpx.h> void getutmp(const struct utmpx *ux, struct utmp *u); void getutmpx(const struct utmp *u, struct utmpx *ux); DESCRIPTION
The getutmp() function copies the fields of the utmpx structure pointed to by ux to the corresponding fields of the utmp structure pointed to by u. The getutmpx() function performs the converse operation. RETURN VALUE
These functions do not return a value. VERSIONS
These functions first appeared in glibc in version 2.1.1. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------------------+---------------+---------+ |Interface | Attribute | Value | +----------------------+---------------+---------+ |getutmp(), getutmpx() | Thread safety | MT-Safe | +----------------------+---------------+---------+ CONFORMING TO
These functions are nonstandard, but appear on a few other systems, such as Solaris and NetBSD. NOTES
These functions exist primarily for compatibility with other systems where the utmp and utmpx structures contain different fields, or the size of corresponding fields differs. On Linux, the two structures contain the same fields, and the fields have the same sizes. SEE ALSO
utmpdump(1), getutent(3), utmp(5) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2015-03-02 GETUTMP(3)

Check Out this Related Man Page

GETLASTLOGX(3)						   BSD Library Functions Manual 					    GETLASTLOGX(3)

NAME
getlastlogx, getlastlogxbyname, getutmp, getutmpx, utmpxname -- user accounting database functions SYNOPSIS
#include <utmpx.h> struct lastlogx * getlastlogx(uid_t uid, struct lastlogx *ll); struct lastlogx * getlastlogxbyname(const char *name, struct lastlogx *ll); void getutmp(const struct utmpx *ux, struct utmp *u); void getutmpx(const struct utmp *u, struct utmpx *ux); int utmpxname(const char *fname); DESCRIPTION
The getlastlogx() function looks up the entry for the user with user id uid and returns it in ll. If the provided ll is NULL, the necessary space will be allocated by getlastlogx() and should be free()d by the caller. The getlastlogxbyname() function is similar to getlastlogx(), except the user name is passed. getutmp() function fills out the entries in the struct utmp u with the data provided in the struct utmpx ux. getutmpx() does the opposite, filling out the entries in the struct utmpx ux with the data provided in the struct utmp u, and initializing all the unknown fields to 0. The sole exception is the ut_type field, which will be initialized to USER_PROCESS. A struct lastlogx is defined like this: struct lastlogx { struct timeval ll_tv; /* time entry was created */ char ll_line[_UTX_LINESIZE]; /* tty name */ char ll_host[_UTX_HOSTSIZE]; /* host name */ }; The utmpxname() function sets the default utmpx(5) database file name to fname. RETURN VALUES
getlastlogx() and getlastlogxbyname() return the found entry on success, or NULL if it could not open the database, could not find an entry matching uid or name, or could not allocate the necessary space (in case ll was NULL). utmpxname() returns 1 on success, or 0 if the supplied file name was too long or did not end with 'x'. SEE ALSO
endutxent(3), utmpx(5) HISTORY
The functions getutmp(), getutmpx(), and utmpxname() first appeared in Solaris. getlastlogx first appeared in NetBSD 2.0. BSD
Dec 26, 2005 BSD
Man Page