UTEMPTER(3)
π UTEMPTER(3) π
okay bestie, pull up a chair, because we're about to talk about the utempter interface β that's section 3 of the manual, the library functions zone, and it's lowkey iconic. this is the little crew of functions that handles login records for pseudo-terminals, and honestly? they ate. β¨
πΈ NAME πΈ
utempter_add_record, utempter_remove_added_record, utempter_remove_record, utempter_set_helper β the utempter interface, aka the whole squad π«Ά
β¨ SYNOPSIS β¨
#include <utempter.h>
int
utempter_add_record(int fd, const char *host);
int
utempter_remove_added_record(void);
int
utempter_remove_record(int fd);
void
utempter_set_helper(const char *pathname);
π¦ DESCRIPTION π¦
so here's the tea on each one of these queens:
utempter_add_record()β this one adds a login record to the database for the TTY that belongs to the pseudo-terminal master file descriptor fd. it uses the username that corresponds with the real user ID of the calling process, plus the optional hostname host. and the way it does this?? it spawns a privileged process to do the actual logging. main character move fr fr. πutempter_remove_record()β this babe marks the login session as closed for the TTY belonging to the pseudo-terminal master file descriptor fd. and yeah, same energy as before: it spawns a privileged process to perform the actual logging. πutempter_remove_added_record()β literally the same properties as the function we just talked about, except it uses an internally cached value of the file descriptor that was passed to the login functions. no fd argument needed, she remembers. πutempter_set_helper()β this one changes the default helper path to the specified value. and listen, this is important: the pointer you pass to this function must remain valid all the time while the utempter interface is in use. like, all the time. no cap. don't let it dangle, bestie. π
β RETURN VALUES β
- on error, zero is returned. π
- on success, a non-zero value is returned. π₯
(yes, that's the reverse of what your gut says. it's giving chaotic but we respect it.)
π NOTES π
during execution of the privileged process spawned by these functions, the SIGCHLD signal handler will be temporarily set to the default action. so heads up on that, because your handler is gonna be on a lil break. π
π SEE ALSO π
go read those too, they're part of the extended universe. iykyk. π¦
π HISTORY π
these functions appeared in ALT Linux Sisyphus in October 2001. vintage!! ancestral!! we love a legacy moment. πΈ
and that's the whole page, bestie β you're officially fluent in utempter. this lil masterpiece came from ALT Linux, dated November 4, 2010. slay, stay hydrated, and don't forget to keep that helper pointer valid. mwah πβ¨
π¦ where this page comes from
- alpine 3.22: libutempter-doc 1.2.3-r0 Β· LGPL-2.1-or-later
- alpine 3.23: libutempter-doc 1.2.3-r0 Β· LGPL-2.1-or-later
- alpine 3.24: libutempter-doc 1.2.3-r1 Β· LGPL-2.1-or-later
- arch rolling: libutempter 1.2.3-1 Β· LGPL-2.1-or-later
- centos-stream 10: libutempter-devel 1.2.1-15.el10 Β· LGPL-2.1-or-later AND LGPL-2.1-only AND BSD-2-Clause
- centos-stream 9: libutempter-devel 1.2.1-6.el9 Β· LGPLv2+
- centos-stream 9: libutempter-devel 1.2.1-6.el9 Β· LGPLv2+
- debian bookworm: libutempter-dev 1.2.1-3 Β· LGPL-2.1-only
- debian trixie: libutempter-dev 1.2.1-4 Β· LGPL-2.1-only
- fedora 43: libutempter-devel 1.2.1-19.fc43 Β· LGPL-2.1-or-later AND LGPL-2.1-only AND BSD-2-Clause
- fedora 43: libutempter-devel 1.2.1-19.fc43 Β· LGPL-2.1-or-later AND LGPL-2.1-only AND BSD-2-Clause
- fedora 44: libutempter-devel 1.2.1-20.fc44 Β· LGPL-2.1-or-later AND LGPL-2.1-only AND BSD-2-Clause
- fedora 44: libutempter-devel 1.2.1-20.fc44 Β· LGPL-2.1-or-later AND LGPL-2.1-only AND BSD-2-Clause
- nixos 26.05: libutempter 1.2.3
- nixpkgs unstable: libutempter 1.2.3
- ubuntu jammy: libutempter-dev 1.2.1-2build2 Β· LGPL-2.1-only
- ubuntu noble: libutempter-dev 1.2.1-3build1 Β· LGPL-2.1-only
- ubuntu questing: libutempter-dev 1.2.1-4
- ubuntu resolute: libutempter-dev 1.2.1-4build1 Β· LGPL-2.1-only
- ubuntu stonking: libutempter-dev 1.2.1-5 Β· LGPL-2.1-only
- Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
- Copyright (c) 2010 Dmitry V. Levin <ldv@altlinux.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms