UTEMPTER_ADD_RECORD(3UTEMPTER) UTEMPTER Library Functions

NAME


utempter_add_record, utempter_remove_added_record,
utempter_remove_record, addToUtmp, removeFromUtmp, removeLineFromUtmp -
utempter compatibility interface

LIBRARY


UTEMPTER Library (libutempter, -lutempter)

SYNOPSIS


#include <utempter.h>

int
utempter_add_record(int fd, const char *host);

int
utempter_remove_added_record(void);

int
utempter_remove_record(int fd);

void
addToUtmp(const char *pty, const char *host, int fd);

void
removeFromUtmp(void);

void
removeLineFromUtmp(const char *pty, int fd);

DESCRIPTION


These functions provide an interface for terminal emulators such as
tmux, screen, and xterm to record user sessions to utmpx(5) database.
Note that they are best effort and may not succeed. If consumers need
to know for certain that they have successfully updated the utmpx(5)
database, these functions should not be used because they cannot
communicate that for compatibility reasons.

The utempter_add_record() and addToUtmp() functions add a login record
to the utmpx(5) database for the TTY belonging to the pseudo-terminal
manager file descriptor fd, using the username corresponding with the
real user ID of the calling process and the optional hostname host,
limited to 256 characters, that is the size of ut_host member of struct
utmpx minus terminating NUL character.

The utempter_remove_record() and removeLineFromUtmp() functions mark
the login session as being closed for the TTY belonging to the pseudo-
terminal manager file descriptor fd.

The utempter_remove_added_record() and removeFromUtmp() functions have
the same properties as the previously mentioned functions, except that
they use an internally cached value of the file descriptor passed to
utempter_add_record() and addToUtmp().

In this implementation, the pty arguments of addToUtmp() and
removeLineFromUtmp() are ignored, and database entries are driven
entirely by the fd argument.

RETURN VALUES


The utempter_add_record(), utempter_remove_added_record() and
utempter_remove_record() functions always return a value of 0.

INTERFACE STABILITY


utempter_add_record(), utempter_remove_added_record(), and
utempter_remove_record() are Committed. addToUtmp(), removeFromUtmp(),
and removeLineFromUtmp() are Obsolete Committed.

MT-LEVEL
Unsafe

SEE ALSO


pututxline(3c), utmpx(3head), utmpx(5)

illumos February 5, 2022 illumos

tribblix@gmail.com :: GitHub :: Privacy