143f8178fSAlex Hornung.\" $NetBSD: getlastlogx.3,v 1.1 2003/08/26 17:37:51 wiz Exp $ 243f8178fSAlex Hornung.\" 343f8178fSAlex Hornung.\" Copyright (c) 2003 The NetBSD Foundation, Inc. 443f8178fSAlex Hornung.\" All rights reserved. 543f8178fSAlex Hornung.\" 643f8178fSAlex Hornung.\" This code is derived from software contributed to The NetBSD Foundation 743f8178fSAlex Hornung.\" by Thomas Klausner. 843f8178fSAlex Hornung.\" 943f8178fSAlex Hornung.\" Redistribution and use in source and binary forms, with or without 1043f8178fSAlex Hornung.\" modification, are permitted provided that the following conditions 1143f8178fSAlex Hornung.\" are met: 1243f8178fSAlex Hornung.\" 1. Redistributions of source code must retain the above copyright 1343f8178fSAlex Hornung.\" notice, this list of conditions and the following disclaimer. 1443f8178fSAlex Hornung.\" 2. Redistributions in binary form must reproduce the above copyright 1543f8178fSAlex Hornung.\" notice, this list of conditions and the following disclaimer in the 1643f8178fSAlex Hornung.\" documentation and/or other materials provided with the distribution. 1743f8178fSAlex Hornung.\" 1843f8178fSAlex Hornung.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1943f8178fSAlex Hornung.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2043f8178fSAlex Hornung.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2143f8178fSAlex Hornung.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2243f8178fSAlex Hornung.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2343f8178fSAlex Hornung.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2443f8178fSAlex Hornung.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2543f8178fSAlex Hornung.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2643f8178fSAlex Hornung.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2743f8178fSAlex Hornung.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2843f8178fSAlex Hornung.\" POSSIBILITY OF SUCH DAMAGE. 2943f8178fSAlex Hornung.\" 30*e2e9821dSSascha Wildner.Dd September 10, 2019 3143f8178fSAlex Hornung.Dt GETLASTLOGX 3 3243f8178fSAlex Hornung.Os 3343f8178fSAlex Hornung.Sh NAME 3443f8178fSAlex Hornung.Nm getlastlogx , 3543f8178fSAlex Hornung.Nm updlastlogx , 3643f8178fSAlex Hornung.Nm updwtmpx , 37bdb02cd9SAlex Hornung.Nm _updwtmpx , 3843f8178fSAlex Hornung.Nm utmpxname 3943f8178fSAlex Hornung.Nd user accounting database functions 4043f8178fSAlex Hornung.Sh LIBRARY 4143f8178fSAlex Hornung.Lb libc 4243f8178fSAlex Hornung.Sh SYNOPSIS 4343f8178fSAlex Hornung.In utmpx.h 4443f8178fSAlex Hornung.Ft struct lastlogx * 4543f8178fSAlex Hornung.Fn getlastlogx "const char *fname" "uid_t uid" "struct lastlogx *ll" 4643f8178fSAlex Hornung.Ft int 4743f8178fSAlex Hornung.Fn updlastlogx "const char *fname" "uid_t uid" "struct lastlogx *ll" 48bdb02cd9SAlex Hornung.Ft void 4943f8178fSAlex Hornung.Fn updwtmpx "const char *file" "const struct utmpx *utx" 5043f8178fSAlex Hornung.Ft int 51bdb02cd9SAlex Hornung.Fn _updwtmpx "const char *file" "const struct utmpx *utx" 52bdb02cd9SAlex Hornung.Ft int 5343f8178fSAlex Hornung.Fn utmpxname "const char *fname" 5443f8178fSAlex Hornung.Sh DESCRIPTION 5543f8178fSAlex HornungThe 5643f8178fSAlex Hornung.Fn getlastlogx 5743f8178fSAlex Hornungfunction looks up the entry for the user with user id 5843f8178fSAlex Hornung.Fa uid 5943f8178fSAlex Hornungin the 6043f8178fSAlex Hornung.Xr lastlogx 5 6143f8178fSAlex Hornungfile given by 6243f8178fSAlex Hornung.Fa fname 6343f8178fSAlex Hornungand returns it in 6443f8178fSAlex Hornung.Fa \&ll . 6543f8178fSAlex HornungIf the provided 6643f8178fSAlex Hornung.Fa \&ll 6743f8178fSAlex Hornungis 6843f8178fSAlex Hornung.Dv NULL , 6943f8178fSAlex Hornungthe necessary space will be allocated by 7043f8178fSAlex Hornung.Fn getlastlogx 7143f8178fSAlex Hornungand should be 7243f8178fSAlex Hornung.Fn free Ns d 7343f8178fSAlex Hornungby the caller. 7443f8178fSAlex Hornung.Pp 7543f8178fSAlex HornungThe 7643f8178fSAlex Hornung.Fn updlastlogx 7743f8178fSAlex Hornungfunction tries to update the information for the user with the user id 7843f8178fSAlex Hornung.Fa uid 7943f8178fSAlex Hornungin the 8043f8178fSAlex Hornung.Xr lastlogx 5 8143f8178fSAlex Hornungfile given by 8243f8178fSAlex Hornung.Fa fname 8343f8178fSAlex Hornungwith the data supplied in 8443f8178fSAlex Hornung.Fa \&ll . 8543f8178fSAlex HornungA 8643f8178fSAlex Hornung.Ft struct lastlogx 8743f8178fSAlex Hornungis defined like this: 8843f8178fSAlex Hornung.Bd -literal 8943f8178fSAlex Hornungstruct lastlogx { 9043f8178fSAlex Hornung struct timeval ll_tv; /* time entry was created */ 9143f8178fSAlex Hornung char ll_line[_UTX_LINESIZE]; /* tty name */ 9243f8178fSAlex Hornung char ll_host[_UTX_HOSTSIZE]; /* host name */ 9343f8178fSAlex Hornung struct sockaddr_storage ll_ss; /* address where entry was made from */ 9443f8178fSAlex Hornung}; 9543f8178fSAlex Hornung.Ed 9643f8178fSAlex HornungAll the fields should be filled out by the caller. 9743f8178fSAlex Hornung.Pp 9843f8178fSAlex HornungThe 9943f8178fSAlex Hornung.Fn updwtmpx 100bdb02cd9SAlex Hornungand 101bdb02cd9SAlex Hornung.Fn _updwtmpx 102bdb02cd9SAlex Hornungfunctions update the 10343f8178fSAlex Hornung.Xr wtmpx 5 10443f8178fSAlex Hornungfile 10543f8178fSAlex Hornung.Fa file 10643f8178fSAlex Hornungwith the 10743f8178fSAlex Hornung.Xr utmpx 5 10843f8178fSAlex Hornungentry 10943f8178fSAlex Hornung.Fa utx . 11043f8178fSAlex Hornung.Pp 11143f8178fSAlex HornungThe 11243f8178fSAlex Hornung.Fn utmpxname 11343f8178fSAlex Hornungfunction sets the default 11443f8178fSAlex Hornung.Xr utmpx 5 11543f8178fSAlex Hornungdatabase file name to 11643f8178fSAlex Hornung.Fa fname . 11743f8178fSAlex Hornung.Sh RETURN VALUES 11843f8178fSAlex Hornung.Fn getlastlogx 11943f8178fSAlex Hornungreturns the found entry on success, or 12043f8178fSAlex Hornung.Dv NULL 12143f8178fSAlex Hornungif it could not open the database, could not find an entry matching 12243f8178fSAlex Hornung.Fa uid 12343f8178fSAlex Hornungin there, or could not allocate the necessary space (in case 12443f8178fSAlex Hornung.Fa \&ll 12543f8178fSAlex Hornungwas 12643f8178fSAlex Hornung.Dv NULL ) . 12743f8178fSAlex Hornung.Pp 12843f8178fSAlex Hornung.Fn utmpxname 12943f8178fSAlex Hornungreturns 1 on success, or 0 if the supplied file name was too long or 13043f8178fSAlex Hornungdid not end with 13143f8178fSAlex Hornung.Sq x . 13243f8178fSAlex Hornung.Pp 13343f8178fSAlex Hornung.Fn updlastlogx 13443f8178fSAlex Hornungand 135bdb02cd9SAlex Hornung.Fn _updwtmpx 13643f8178fSAlex Hornungreturn 0 on success, or \-1 in case the database or file respectively 13743f8178fSAlex Hornungcould not be opened or the data not written into it. 13843f8178fSAlex Hornung.Sh SEE ALSO 13943f8178fSAlex Hornung.Xr endutxent 3 , 14043f8178fSAlex Hornung.Xr loginx 3 , 14143f8178fSAlex Hornung.Xr utmpx 5 14243f8178fSAlex Hornung.Sh HISTORY 14343f8178fSAlex HornungThe functions 14443f8178fSAlex Hornung.Fn updwtmpx , 145bdb02cd9SAlex Hornung.Fn _updwtmpx 14643f8178fSAlex Hornungand 14743f8178fSAlex Hornung.Fn utmpxname 14843f8178fSAlex Hornungfirst appeared in 14943f8178fSAlex Hornung.Tn Solaris . 15043f8178fSAlex Hornung.Nm getlastlogx 15143f8178fSAlex Hornungand 15243f8178fSAlex Hornung.Nm updlastlogx 15343f8178fSAlex Hornungfirst appeared in 15443f8178fSAlex Hornung.Nx 2.0 . 155