| 1 |
'\" t |
| 2 |
.\" Copyright 1997, Nicolás Lichtmaier <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
.\" |
| 7 |
.TH updwtmp 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
updwtmp, logwtmp \- append an entry to the wtmp file |
| 10 |
.SH LIBRARY |
| 11 |
System utilities library |
| 12 |
.RI ( libutil ,\~ \-lutil ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <utmp.h> |
| 16 |
.P |
| 17 |
.BI "void updwtmp(const char *" wtmp_path ", const struct utmp *" ut ); |
| 18 |
.BI "void logwtmp(const char *" line ", const char *" user \ |
| 19 |
", const char *" host ); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
.BR updwtmp () |
| 23 |
appends the utmp structure |
| 24 |
.I ut |
| 25 |
to the wtmp file. |
| 26 |
.P |
| 27 |
.BR logwtmp () |
| 28 |
constructs a utmp structure using |
| 29 |
.IR line ", " user ", " host , |
| 30 |
current time, and current process ID. |
| 31 |
Then it calls |
| 32 |
.BR updwtmp () |
| 33 |
to append the structure to the wtmp file. |
| 34 |
.SH FILES |
| 35 |
.TP |
| 36 |
.I /var/log/wtmp |
| 37 |
database of past user logins |
| 38 |
.SH ATTRIBUTES |
| 39 |
For an explanation of the terms used in this section, see |
| 40 |
.BR attributes (7). |
| 41 |
.TS |
| 42 |
allbox; |
| 43 |
lbx lb lb |
| 44 |
l l l. |
| 45 |
Interface Attribute Value |
| 46 |
T{ |
| 47 |
.na |
| 48 |
.nh |
| 49 |
.BR updwtmp (), |
| 50 |
.BR logwtmp () |
| 51 |
T} Thread safety MT-Unsafe sig:ALRM timer |
| 52 |
.TE |
| 53 |
.SH VERSIONS |
| 54 |
For consistency with the other "utmpx" functions (see |
| 55 |
.BR getutxent (3)), |
| 56 |
glibc provides (since glibc 2.1): |
| 57 |
.P |
| 58 |
.in +4n |
| 59 |
.EX |
| 60 |
.BR "#define _GNU_SOURCE " "/* See feature_test_macros(7) */" |
| 61 |
.B #include <utmpx.h> |
| 62 |
.BI "void updwtmpx (const char *" wtmpx_path ", const struct utmpx *" utx ); |
| 63 |
.EE |
| 64 |
.in |
| 65 |
.P |
| 66 |
This function performs the same task as |
| 67 |
.BR updwtmp (), |
| 68 |
but differs in that it takes a |
| 69 |
.I utmpx |
| 70 |
structure as its last argument. |
| 71 |
.SH STANDARDS |
| 72 |
None. |
| 73 |
.SH HISTORY |
| 74 |
Solaris, NetBSD. |
| 75 |
.SH SEE ALSO |
| 76 |
.BR getutxent (3), |
| 77 |
.BR wtmp (5) |