explain_chroot_or_die(3)
π NAME π
explain_chroot_or_die β bestie, this is the one that changes your root directory and then tells you all about it if it goes wrong β¨
π SYNOPSIS π
#include <libexplain/chroot.h>
void explain_chroot_or_die(const char *pathname);
int explain_chroot_on_error(const char *pathname))
(yes the second one really has two closing parens at the end, that's the actual signature, iykyk π )
πΈ DESCRIPTION πΈ
okay so, the explain_chroot_or_die function is your girl for calling the chroot(2) system call. but here's the thing β if it fails, it doesn't just ghost you π it prints an explanation to stderr, grabbed straight from the explain_chroot(3) function, and then the process terminates by calling exit(EXIT_FAILURE). like, it's done, it's over, it's not coming back. periodt π
the explain_chroot_on_error function also calls the chroot(2) system call. on failure it prints an explanation to stderr β same deal, that explanation comes from explain_chroot(3) β but this one is way more chill: it still returns to the caller. no dramatic exit, no goodbye, just vibes π¦
π pathname
the pathname, exactly as to be passed to the chroot(2) system call. exactly. character for character. don't get creative with it, bestie π
β¨ RETURN VALUE β¨
the explain_chroot_or_die function only returns on success β and if you want more on what success even means here, go read chroot(2). on failure it prints an explanation and exits. it does not return. not even a little. π
the explain_chroot_on_error function always returns the value returned by the wrapped chroot(2) system call. always. every time. that's the whole point, that's the assignment, and it ate π
π EXAMPLE π
the explain_chroot_or_die function is intended to be used in a fashion similar to the following example:
explain_chroot_or_die(pathname);
that's it. that's the whole moment. iconic π
π¦ SEE ALSO π¦
chroot(2)β change root directoryexplain_chroot(3)β explainchroot(2)errorsexit(2)β terminate the calling process
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2009 Peter Miller
and that's the whole page, bestie π«Ά this was explain_chroot_or_die(3) from the Library Functions Manual, running on libexplain version 1.4, with copyright vibes dating all the way back to 2009 Peter Miller β go forth and chroot responsibly, mwah ππ
π¦ where this page comes from
- debian bookworm: libexplain-dev 1.4.D001-12+b1 Β· LGPL-3.0-or-later
- debian trixie: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- ubuntu jammy: libexplain-dev 1.4.D001-12 Β· LGPL-3.0-or-later
- ubuntu noble: libexplain-dev 1.4.D001-13 Β· LGPL-3.0-or-later
- ubuntu resolute: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- Copyright (C) 2009, 2011 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms