explain_rmdir(3)
π explain_rmdir(3) β Library Functions Manual π
okay bestie, sit down, hydrate, because we're about to make rmdir(2) errors make sense. This is explain_rmdir, a little library page from the Library Functions Manual, and it's literally just here to translate your directory-deletion disasters into actual human sentences. no cap. π¦
β¨ NAME β¨
explain_rmdir β explain rmdir(2) errors
πΈ SYNOPSIS πΈ
#include <libexplain/rmdir.h>
const char *explain_rmdir(const char *pathname);
const char *explain_errno_rmdir(int errnum, const char pathname);
void explain_message_rmdir(char *message, int message_size, const char
*pathname);
void explain_message_errno_rmdir(char *message, int message_size, int
errnum, const char *pathname);
π DESCRIPTION π
These functions are your little translators π«Ά β you use them to get explanations for errors that the rmdir(2) system call hands back to you. it's giving "error message but make it make sense".
π explain_rmdir
const char *explain_rmdir(const char *pathname);
The explain_rmdir function describes errors that come back from the rmdir() system call. the bare minimum it'll give you is the value of strerror(errno) β but usually it pops off way harder than that and points at the actual underlying cause in more detail. π
The errno global variable is the one it reads to grab the error value it's gonna decode.
This function is meant to be used kinda like this, bestie:
if (rmdir(pathname) < 0)
{
fprintf(stderr, "%s\n", explain_rmdir(pathname));
exit(EXIT_FAILURE);
}
pathname
- The original pathname, exactly as passed to the
rmdir(2)system call.
Returns:
- The message explaining the error. This message buffer is shared by all libexplain functions that don't supply a buffer in their argument list. It'll get overwritten by the next call to any libexplain function that shares this buffer β including calls from other threads. π
Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library do too. π
π explain_errno_rmdir
const char *explain_errno_rmdir(int errnum, const char *pathname);
The explain_errno_rmdir function describes errors returned by the rmdir() system call. the least the message will contain is the value of strerror(errnum), but usually it does so much better and points at the underlying cause in more detail. β¨
This function is intended to be used in a fashion similar to the following example:
if (rmdir(pathname) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_rmdir(err, pathname));
exit(EXIT_FAILURE);
}
errnum
- The error value to be decoded, usually grabbed from the
errnoglobal variable right before this function is called. You need this if you have to run any code between the system call being explained and this function β because so many libc functions will mess with the value oferrno. π
pathname
- The original pathname, exactly as passed to the
rmdir(2)system call.
Returns:
- The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. π
Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. π
π¦ explain_message_rmdir
void explain_message_rmdir(char *message, int message_size, const char
*pathname);
The explain_message_rmdir function describes errors returned by the rmdir() system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. π
The errno global variable will be used to obtain the error value to be decoded.
This function is intended to be used in a fashion similar to the following example:
if (rmdir(pathname) < 0)
{
char message[3000];
explain_message_rmdir(message, sizeof(message), pathname);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
message
- The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. π«Ά
message_size
- The size in bytes of the location in which to store the returned message.
pathname
- The original pathname, exactly as passed to the
rmdir(2)system call.
π explain_message_errno_rmdir
void explain_message_errno_rmdir(char *message, int message_size, int
errnum, const char *pathname);
The explain_message_errno_rmdir function describes errors returned by the rmdir() system call. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. π₯
This function is intended to be used in a fashion similar to the following example:
if (rmdir(pathname) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_rmdir(message, sizeof(message), err, pathname);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
message
- The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. π«Ά
message_size
- The size in bytes of the location in which to store the returned message.
errnum
- The error value to be decoded, usually obtained from the
errnoglobal variable just before this function is called. This is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value oferrno. π
pathname
- The original pathname, exactly as passed to the
rmdir(2)system call.
π SEE ALSO π
rmdirβ delete a directoryexplain_rmdir_or_dieβ delete a directory and report errors
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2008 Peter Miller
and that's the whole vibe check, bestie β every function, every buffer warning, every "not thread safe" scream, all of it. go forth and delete directories with main character energy. mwah π π
signing off from explain_rmdir(3), brought to you by libexplain version 1.4, Copyright (C) 2008 Peter Miller πβ¨
π¦ 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) 2008, 2009, 2011 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms