Debian Codegraph @

liblastlog2/man/ll2_read_entry.3

raw
1 '\" t
2 .\" Title: ll2_read_entry
3 .\" Author: [see the "AUTHOR(S)" section]
4 .\" Generator: Asciidoctor 2.0.20
5 .\" Date: 2026-04-28
6 .\" Manual: Programmer's Manual
7 .\" Source: util-linux 2.42.1
8 .\" Language: English
9 .\"
10 .TH "LL2_READ_ENTRY" "3" "2026-04-28" "util\-linux 2.42.1" "Programmer\*(Aqs Manual"
11 .ie \n(.g .ds Aq \(aq
12 .el .ds Aq '
13 .ss \n[.ss] 0
14 .nh
15 .ad l
16 .de URL
17 \fI\\$2\fP <\\$1>\\$3
18 ..
19 .als MTO URL
20 .if \n[.g] \{\
21 . mso www.tmac
22 . am URL
23 . ad l
24 . .
25 . am MTO
26 . ad l
27 . .
28 . LINKSTYLE blue R < >
29 .\}
30 .SH "NAME"
31 ll2_read_entry \- Reads one entry from database and returns that.
32 .SH "SYNOPSIS"
33 .sp
34 \fB#include <lastlog2.h>\fP
35 .sp
36 \fBint ll2_read_entry (struct ll2_context *\fIcontext\fP, const char *\fIuser\fP,
37 int64_t *\fIll_time\fP, char \fB\fItty\fP, char \fP\fIrhost\fP,
38 char \fB\fIpam_service\fP, char \fP\fIerror\fP);\fP
39 .SH "DESCRIPTION"
40 .sp
41 Reads the first entry from database, defined in \fIcontext\fP, for user \fIuser\fP.
42 If \fIcontext\fP is NULL, the default database, defined in \fILL2_DEFAULT_DATABASE\fP,
43 will be taken.
44 .sp
45 .if n .RS 4
46 .nf
47 .fam C
48 char *error = NULL;
49 const char *user = "root";
50 int64_t res_time;
51 char *res_tty = NULL;
52 char *res_rhost = NULL;
53 char *res_service = NULL;
54
55 int ret = ll2_read_entry (NULL, user, &res_time, &res_tty, &res_rhost, &res_service, &error);
56 .fam
57 .fi
58 .if n .RE
59 .SH "RETURN VALUE"
60 .sp
61 Returns 0 on success, \-ENOMEM or \-1 on other failure.
62 \fIerror\fP contains an error string if the return value is \-1.
63 \fIerror\fP is not guaranteed to contain an error string, could also be NULL.
64 \fIerror\fP should be freed by the caller.
65 If lastlog2 database does not exist at all, the errno ENOENT is set
66 and can be checked.
67 .sp
68 The evaluated values are returned by \fIll_time\fP, \fItty\fP, \fIrhost\fP and \fIpam_service\fP.
69 .SH "AUTHORS"
70 .sp
71 .MTO "kukuk\(atsuse.de" "Thorsten Kukuk" ""
72 .SH "SEE ALSO"
73 .sp
74 \fBlastlog2\fP(3),
75 \fBll2_new_context\fP(3),
76 \fBll2_unref_context\fP(3),
77 \fBll2_read_all\fP(3),
78 \fBll2_write_entry\fP(3),
79 \fBll2_update_login_time\fP(3),
80 \fBll2_remove_entry\fP(3),
81 \fBll2_rename_user\fP(3),
82 \fBll2_import_lastlog\fP(3)
83 .SH "REPORTING BUGS"
84 .sp
85 For bug reports, use the \c
86 .URL "https://github.com/util\-linux/util\-linux/issues" "issue tracker" "."
87 .SH "AVAILABILITY"
88 .sp
89 The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c
90 .URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."