utmpx.h(7POSIX)

πŸ‘‘ utmpx.h β€” user accounting database definitions πŸ’–

okay bestie, so this is utmpx.h(7POSIX), straight outta the POSIX Programmer's Manual. it's a header page, it's giving "the blueprint of who's logged in and what's happening on the system" and honestly? iconic. let's get into it 🫢


🌸 PROLOG 🌸

so before we even start β€” this manual page is part of the POSIX Programmer's Manual. quick heads up tho: the Linux implementation of this interface may differ, so if you're on Linux pls pls pls go consult the corresponding Linux manual page for the deets on Linux behavior. or… the interface might not even be implemented on Linux at all. vibe check: always check your platform first, no cap πŸ’…


✨ NAME ✨

utmpx.h β€” user accounting database definitions. yes bestie, it's literally the header that defines all the shapes your system uses to keep track of users and sessions. main character energy fr fr 🌟


πŸŽ€ SYNOPSIS πŸŽ€

#include <utmpx.h>

that's it. one include. so clean. so slay. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first things first: the <utmpx.h> header shall define the utmpx structure, and that structure shall include at least these members:

char            ut_user[]  User login name.
char            ut_id[]    Unspecified initialization process identifier.
char            ut_line[]  Device name.
pid_t           ut_pid     Process ID.
short           ut_type    Type of entry.
struct timeval  ut_tv      Time entry was made.

like… look at her. a whole little snapshot of a session. the way that ut_user holds the login name and ut_line holds the device name? obsessed 😭

the <utmpx.h> header shall define the pid_t type through typedef, as described in <sys/types.h>. πŸ’œ

the <utmpx.h> header shall define the timeval structure as described in <sys/time.h>. πŸ•

also β€” sneaky lil detail β€” inclusion of the <utmpx.h> header may also make visible all symbols from <sys/time.h>. so don't be shocked if extra stuff shows up, she's just like that πŸ™ˆ


πŸ’« the ut_type constants πŸ’«

the <utmpx.h> header shall define the following symbolic constants as possible values for the ut_type member of the utmpx structure:

  • EMPTY β€” no valid user accounting information. literally nothing to see here, moving on πŸ’€
  • BOOT_TIME β€” identifies time of system boot. the system woke up and chose violence πŸ”₯
  • OLD_TIME β€” identifies time when system clock changed. the before pic ⏰
  • NEW_TIME β€” identifies time after system clock changed. the glow-up pic ✨
  • USER_PROCESS β€” identifies a process. a whole user doing their thing 🫢
  • INIT_PROCESS β€” identifies a process spawned by the init process. init said "i made this" πŸ‘‘
  • LOGIN_PROCESS β€” identifies the session leader of a logged-in user. leader behavior only πŸ’…
  • DEAD_PROCESS β€” identifies a session leader who has exited. rip bestie, gone but not forgotten 😭

🌈 the functions 🌈

the following shall be declared as functions, and they may also be defined as macros. function prototypes shall be provided:

void          endutxent(void);
struct utmpx *getutxent(void);
struct utmpx *getutxid(const struct utmpx *);
struct utmpx *getutxline(const struct utmpx *);
struct utmpx *pututxline(const struct utmpx *);
void          setutxent(void);

six functions, one little family, all serving looks. getutxent() is the one you call to walk the entries, setutxent() rewinds, endutxent() closes up shop, and the getutxid() / getutxline() / pututxline() trio does the targeted searching and writing. periodt πŸ’–

also note: the following sections are informative. so like, they're context, not rules. still cute tho.

πŸ“ APPLICATION USAGE πŸ“

None.

(yeah bestie, literally none. the application usage section said "i have nothing to add" and honestly? respect πŸ™ˆ)


πŸ’œ RATIONALE πŸ’œ

None.

(nothing here either. the rationale is giving minimalist. it's a vibe. we move. πŸ’…)


⭐ FUTURE DIRECTIONS ⭐

None.

(no future plans announced. she's living in the present, as she should 🌸)


🧚 SEE ALSO 🧚

  • <sys_time.h>
  • <sys_types.h>

and also β€” The System Interfaces volume of POSIX.1‐2017, endutxent() πŸ‘‘

go read those if you wanna go deeper, iykyk πŸ“š


okay so legally speaking, bestie, here's the whole thing:

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page!! πŸ’–βœ¨πŸ¦‹πŸŒΈπŸŽ€πŸ«Ά

this lil masterpiece came to you courtesy of IEEE/The Open Group, dated 2017, and it lives at utmpx.h(7POSIX). ty for reading bestie, go log in somewhere and be the session leader you were always meant to be πŸ‘‘πŸ’