Debian Codegraph @

liblastlog2/man/ll2_new_context.3

raw
1 '\" t
2 .\" Title: ll2_new_context
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_NEW_CONTEXT" "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_new_context \- Allocates context which defines the lastlog2 environment.
32 .SH "SYNOPSIS"
33 .sp
34 \fB#include <lastlog2.h>\fP
35 .sp
36 *ll2_context * ll2_new_context(const char *\fIdb_path\fP);
37 .SH "DESCRIPTION"
38 .sp
39 Defines lastlog2 context e.g. database file, which will be used for
40 any other lastlog2 call. If \fIdb_path\fP is NULL, the default path defined
41 in \fILL2_DEFAULT_DATABASE\fP will be taken.
42 .sp
43 .if n .RS 4
44 .nf
45 .fam C
46 const char *db_path = "/var/lib/lastlog/lastlog2.db";
47 ll2_context *context = ll2_new_context(db_path);
48 .fam
49 .fi
50 .if n .RE
51 .SH "RETURN VALUE"
52 .sp
53 Returns context which will be used for all other lastlog2 library calls.
54 This context should be released with \fIll2_unref_context\fP when it is not
55 needed anymore.
56 Returns NULL on an error.
57 .SH "AUTHORS"
58 .sp
59 .MTO "kukuk\(atsuse.de" "Thorsten Kukuk" ""
60 .SH "SEE ALSO"
61 .sp
62 \fBlastlog2\fP(3),
63 \fBll2_unref_context\fP(3),
64 \fBll2_read_all\fP(3),
65 \fBll2_write_entry\fP(3),
66 \fBll2_read_entry\fP(3),
67 \fBll2_remove_entry\fP(3),
68 \fBll2_update_login_time\fP(3),
69 \fBll2_import_lastlog\fP(3)
70 .SH "REPORTING BUGS"
71 .sp
72 For bug reports, use the \c
73 .URL "https://github.com/util\-linux/util\-linux/issues" "issue tracker" "."
74 .SH "AVAILABILITY"
75 .sp
76 The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c
77 .URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."