login(3)

login3

Login utility functions (deprecated)

Usage

#include <util.h>

void

login(struct utmp *ut);

int

logout(const char *line);

void

logwtmp(const char *line, const char *name, const char *host);

Overview

The login(), logout(), and logwtmp() functions are DEPRECATED; use pututxline(3) instead.

These functions operate on the database of current users in /var/run/utmpx and the system log file. Superuser permission is required.

The login() function updates the /var/run/utmpx files with user information contained in ut (after converting to a struct utmpx, as described in pututxline(3)).

The logout() function removes the entry from /var/run/utmpx corresponding to the device line.

The logwtmp() function adds an entry to the system log file. Since login() will add the appropriate entry during a login, logwtmp() is usually used for logouts.

Return values

logout() returns non-zero if it was able to find and delete an entry for line, and zero if there is no entry for line in /var/run/utmpx. However, there is no error indication due to lack of permissions.

Files

/dev/∗
/var/run/utmpx

Releases

163 releases since Mac OS X 10.0; the text changed 1 time.

  1. 10.0–10.4.11
  2. 10.5–26.5

From Libc 1752.120.2 in macOS 26.5. Parsed by carta from the page's mdoc source.