explain_mkdir(3)
π explain_mkdir β a libexplain page, bestie edition π
okay so this is explain_mkdir(3), a Library Functions Manual moment, and if you've ever had a mkdir(2) call flop and just wanted someone to tell you why β hi, that's literally this. π
β¨ NAME β¨
explain_mkdir β explain mkdir(2) errors π«Ά
πΈ SYNOPSIS πΈ
#include <libexplain/mkdir.h>
const char *explain_mkdir(const char *pathname);
const char *explain_errno_mkdir(int errnum, const char *pathname);
void explain_message_mkdir(char *message, int message_size, const char
*pathname);
void explain_message_errno_mkdir(char *message, int message_size, int
errnum, const char *pathname);
π DESCRIPTION π
These functions are your emotional support besties for when mkdir(2) returns an error. They hand you back explanations for those errors. no cap. π
π explain_mkdir
const char *explain_mkdir(const char *pathname);
The explain_mkdir function gets you an explanation of an error that mkdir(2) returned. The absolute least the message will contain is the value of strerror(errno) β but bestie, usually it does way better than that and points at the actual underlying cause in more detail. it's giving thorough. β¨
The errno global variable is what gets used to obtain the error value to be decoded.
This function is meant to be used in a fashion similar to this example:
if (mkdir(pathname) < 0)
{
fprintf(stderr, "%s\n", explain_mkdir(pathname));
exit(EXIT_FAILURE);
}
- pathname β the original pathname, exactly as passed to the
mkdir(2)system call. don't go editing it, it wants the real one. π¦
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 will be overwritten by the next call to any libexplain function that shares this buffer, including other threads. so like. it's a communal water bottle. don't be surprised. π
Note: this function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. π
π§ explain_errno_mkdir
const char *explain_errno_mkdir(int errnum, const char *pathname);
The explain_errno_mkdir function gets you an explanation of an error returned by the mkdir(2) system call. The least the message will contain is the value of strerror(errnum), but usually it does much better and indicates the underlying cause in more detail. obsessed. π₯
This function is meant to be used in a fashion similar to this example:
if (mkdir(pathname) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_mkdir(err, pathname));
exit(EXIT_FAILURE);
}
- 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. grab it early, bestie, it moves fast. πββοΈ - pathname β the original pathname, exactly as passed to the
mkdir(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_mkdir
void explain_message_mkdir(char *message, int message_size, const char
*pathname);
The explain_message_mkdir function may be used to obtain an explanation of an error returned by the mkdir(2) 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. she ate. π
The errno global variable will be used to obtain the error value to be decoded.
This function is meant to be used in a fashion similar to this example:
if (mkdir(pathname) < 0)
{
char message[3000];
explain_message_mkdir(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. look at her go, being all safe and responsible. π
- 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
mkdir(2)system call.
β explain_message_errno_mkdir
void explain_message_errno_mkdir(char *message, int message_size, int
errnum, const char *pathname);
The explain_message_errno_mkdir function may be used to obtain an explanation of an error returned by the mkdir(2) 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. main character energy fr fr. π
This function is meant to be used in a fashion similar to this example:
if (mkdir(pathname) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_mkdir(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. (yes we said this already, it's IMPORTANT okay. π€) - pathname β the original pathname, exactly as passed to the
mkdir(2)system call.
π SEE ALSO π
mkdir(2)β create a directoryexplain_mkdir_or_die(3)β create a directory and report errors
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2008 Peter Miller
okay that's the whole page, bestie, you're officially fluent in explain_mkdir(3) πΈπ¦β¨
and for the record β this page is explain_mkdir(3) from the Library Functions Manual, libexplain version 1.4, Copyright (C) 2008 Peter Miller. love that for us. 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) 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