mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-22 05:33:45 -04:00
utmp: rewrite utmp logging
This patch generalizes the utmp support, to not only support libutempter, but also ulog (and in the future, even more interfaces). * Rename config option main.utempter to main.utmp-helper * Add meson option -Dutmp-backend=none|libutempter|ulog|auto * Rename meson option -Ddefault-utempter-path to -Dutmp-default-helper-path * utmp is no longer detected at compile time, but at runtime instead. Meson will configure the following pre-processor macros, based on the selected utmp backend: * UTMP_ADD - argument to pass to utmp helper when adding a record (starting foot) * UTMP_DEL - argument to pass to utmp helper when removing a record (exiting foot) * UTMP_DEL_HAVE_ARGUMENT - if defined, UTMP_DEL expects an extra argument ($WAYLAND_DISPLAY) * UTMP_DEFAULT_HELPER_PATH - path to the default utmp helper binary The documentation has been updated to mention which arguments are passed to the helper binary. Closes #1314
This commit is contained in:
parent
a2f765b72a
commit
e78319fccd
11 changed files with 159 additions and 58 deletions
24
terminal.c
24
terminal.c
|
|
@ -207,25 +207,41 @@ fdm_ptmx_out(struct fdm *fdm, int fd, int events, void *data)
|
|||
static bool
|
||||
add_utmp_record(const struct config *conf, struct reaper *reaper, int ptmx)
|
||||
{
|
||||
#if defined(UTMP_ADD)
|
||||
if (ptmx < 0)
|
||||
return true;
|
||||
if (conf->utempter_path == NULL)
|
||||
if (conf->utmp_helper_path == NULL)
|
||||
return true;
|
||||
|
||||
char *const argv[] = {conf->utempter_path, "add", getenv("WAYLAND_DISPLAY"), NULL};
|
||||
char *const argv[] = {conf->utmp_helper_path, UTMP_ADD, getenv("WAYLAND_DISPLAY"), NULL};
|
||||
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
del_utmp_record(const struct config *conf, struct reaper *reaper, int ptmx)
|
||||
{
|
||||
#if defined(UTMP_DEL)
|
||||
if (ptmx < 0)
|
||||
return true;
|
||||
if (conf->utempter_path == NULL)
|
||||
if (conf->utmp_helper_path == NULL)
|
||||
return true;
|
||||
|
||||
char *const argv[] = {conf->utempter_path, "del", getenv("WAYLAND_DISPLAY"), NULL};
|
||||
char *del_argument =
|
||||
#if defined(UTMP_DEL_HAVE_ARGUMENT)
|
||||
getenv("WAYLAND_DISPLAY")
|
||||
#else
|
||||
NULL
|
||||
#endif
|
||||
;
|
||||
|
||||
char *const argv[] = {conf->utmp_helper_path, UTMP_DEL, del_argument, NULL};
|
||||
return spawn(reaper, NULL, argv, ptmx, ptmx, -1, NULL);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if PTMX_TIMING
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue