LL2_WRITE_ENTRY(3)
LL2_WRITE_ENTRY(3) π
okay bestie, so this one is from the Programmers Manual β it's a liblastlog2 function and honestly it's giving "tiny function, big responsibility" energy. Sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
ll2_write_entry β literally writes a brand new entry into the database. slay.
π¦ SYNOPSIS π¦
#include <lastlog2.h>
int ll2_write_entry (struct ll2_context *context, const char *user,
int64_t ll_time, const char *tty, const char *rhost, const char
*pam_service, char **error);
πΈ DESCRIPTION πΈ
So what it does is, it writes a new entry into the database, and that database is the one defined in context. and like β important detail β if context is NULL, then the default database gets used instead, the one defined in LL2_DEFAULT_DATABASE. no cap, that's the whole vibe check. π«Ά
here's a little example of it in the wild, look at her go:
time_t login_time = time(0); // Get the system time
char *error = NULL;
const char *user = "root";
int ret = ll2_write_entry (NULL, user, login_time, "pts/0",
"192.168.122.1", NULL, &error);
and pam_service? that's the service or instance name that generated the entry β she's optional, so no pressure bestie. π
π₯ RETURN VALUE π₯
- Returns
0on success β we love a clean win β¨ - Returns
-ENOMEMor-1on other failure π errorcontains an error string if the return value is-1- but like, careful β
erroris not guaranteed to contain an error string, it could also beNULL. so don't come for her if she's empty. π errorshould be freed by the caller. yes, that's you. that's your job now. π
π AUTHORS π
Thorsten Kukuk <kukuk@suse.de> β an icon, honestly.
π SEE ALSO π
lastlog2(3)ll2_new_context(3)ll2_unref_context(3)ll2_read_all(3)ll2_read_entry(3)ll2_update_login_time(3)ll2_remove_entry(3)ll2_rename_user(3)ll2_import_lastlog(3)
the whole friend group, fr fr π
π§ REPORTING BUGS π§
got a bug to report? use the issue tracker <https://github.com/util-linux/util-linux/issues>. we don't do drama in the DMs, we do it in the tracker. π
β AVAILABILITY β
The liblastlog2 library is part of the util-linux package since version 2.40. and you can download it from the Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. it's giving open source royalty, periodt. π
kay that's the whole page bestie, go write some entries. mwah π
this little number is from util-linux 2.41.6, dated 2026-08-31 β like and subscribe, see you in the next manpage π¦
π¦ where this page comes from
- alpine 3.22: util-linux-doc 2.41.6-r1 Β· GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain
- alpine 3.23: util-linux-doc 2.41.6-r1 Β· GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain
- fedora 43: liblastlog2-devel 2.41.6-1.fc43 Β· BSD-2-Clause
- fedora 43: liblastlog2-devel 2.41.6-1.fc43 Β· BSD-2-Clause
- fedora 44: liblastlog2-devel 2.41.6-1.fc44 Β· BSD-2-Clause
- fedora 44: liblastlog2-devel 2.41.6-1.fc44 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms