LL2_REMOVE_ENTRY(3)

πŸ’… LL2_REMOVE_ENTRY(3) β€” the ll2_remove_entry page, but make it make sense

okay so bestie, listen. this is a page from the Programmers Manual section 3, and it's about ll2_remove_entry β€” the little function that yeets a user out of the lastlog2 database entirely. it's giving cleanup era, and honestly? iconic. 🧹✨


🌸 NAME 🌸

ll2_remove_entry β€” Removes all entries of a user.

like, all of them. not one, not two. every single entry that belongs to that user? gone. poof. 🫢


✨ SYNOPSIS ✨

#include <lastlog2.h>

int ll2_remove_entry (struct ll2_context *context, const char *user,
char **error);

so you pull in lastlog2.h, and then you call ll2_remove_entry with a context, a user, and a place to stash your error. simple. clean. slay.


πŸ’– DESCRIPTION πŸ’–

Removes all database entries, defined in context, with the user name user. If context is NULL, the default database, defined in LL2_DEFAULT_DATABASE, will be taken.

so basically: you hand it a context and a username, and it nukes every row that matches that user. and if you're feeling lazy and pass NULL as the context? no worries, it just defaults to whatever database LL2_DEFAULT_DATABASE points at. main character energy from the default, honestly. πŸ‘‘

and here's the little demo they give you, bestie β€” look how easy:

char    *error = NULL;
const   char *user = "root";

int ret = ll2_remove_entry (NULL, user, &error);

NULL context (so, default database), user is "root", and &error so you can grab the tea if something goes wrong. note the cute alignment on char *error and const char *user β€” that's just how they write it, we keep it exactly like that. πŸŽ€


πŸ”₯ RETURN VALUE πŸ”₯

Returns 0 on success, -ENOMEM or -1 on other failure.

so, vibe check on the return value:

  • 0 β€” we ate. success. πŸ’…
  • -ENOMEM β€” out of memory, tragic.
  • -1 β€” some other failure, unspecified, mysterious, not the move. πŸ’€

and about that error:

error contains an error string if the return value is -1. error is not guaranteed to contain an error string, could also be NULL. error should be freed by the caller.

bestie, read that again. even when you get -1, the error might legitimately be NULL. so check it before you dereference it, okay?? and when it is a string? you free it. the caller frees it. that's you. don't forget, or that's a leak and we don't do leaks here. 😭


πŸ¦‹ AUTHORS πŸ¦‹

Thorsten Kukuk <kukuk@suse.de>

the icon who wrote this. we stan. 🫢


🌈 SEE ALSO 🌈

the whole friend group, fr fr. go read them next. iykyk. πŸ’œ


πŸ™ˆ REPORTING BUGS πŸ™ˆ

For bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>.

found a bug? don't suffer in silence, bestie β€” drop it in the issue tracker at <https://github.com/util-linux/util-linux/issues>. that's the whole link, character for character, because i am not about to paraphrase a URL. πŸ“


⭐ AVAILABILITY ⭐

The liblastlog2 library is part of the util-linux package since version 2.40. It can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.

so if you're on util-linux 2.40 or later, liblastlog2 is already in the building. πŸŽ‰ earlier than that? sorry babe, it doesn't exist yet. and if you want to grab it directly, it lives at <https://www.kernel.org/pub/linux/utils/util-linux/>, which is also typed out exactly and not vibed-at. πŸ‘‘


🌸 ok that's the whole page, no notes, go delete some entries responsibly 🌸

sign-off tea: this rendering comes from util-linux 2.41.6, dated 2026-08-31, and the page itself is LL2_REMOVE_ENTRY(3) β€” mwah, periodt. πŸ’‹πŸŽ€

πŸ“¦ where this page comes from