libexplain  1.4.D001
Functions
libexplain/buffer/errno/fopen.c File Reference
#include <libexplain/ac/errno.h>
#include <libexplain/ac/fcntl.h>
#include <libexplain/ac/string.h>
#include <libexplain/ac/unistd.h>
#include <libexplain/buffer/enomem.h>
#include <libexplain/buffer/errno/fopen.h>
#include <libexplain/buffer/errno/open.h>
#include <libexplain/buffer/pointer.h>
#include <libexplain/explanation.h>
#include <libexplain/string_buffer.h>
#include <libexplain/string_flags.h>

Go to the source code of this file.

Functions

static void explain_buffer_errno_fopen_system_call (explain_string_buffer_t *sb, int errnum, const char *pathname, const char *flags_string)
void explain_buffer_errno_fopen_explanation (explain_string_buffer_t *sb, int errnum, const char *syscall_name, const char *pathname, const char *flags)
void explain_buffer_errno_fopen (explain_string_buffer_t *sb, int errnum, const char *pathname, const char *flags_string)
void explain_string_flags_einval (const explain_string_flags_t *sf, explain_string_buffer_t *sb, const char *caption)

Function Documentation

void explain_buffer_errno_fopen ( explain_string_buffer_t sb,
int  errnum,
const char *  path,
const char *  mode 
)

The explain_buffer_errno_fopen function is used to obtain an explanation of an error returned by the fopen(3) function. 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.

Parameters:
sbThe string buffer in which the message is being constructed. If a safe buffer s specified, this function is thread safe.
errnumThe error value to be decoded, usually obtain from the errno global 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 of errno.
pathThe original path, exactly has passed to the fopen(3) system call.
modeThe original mode, exactly has passed to the fopen(3) system call.

Definition at line 114 of file fopen.c.

void explain_buffer_errno_fopen_explanation ( explain_string_buffer_t sb,
int  errnum,
const char *  syscall_name,
const char *  path,
const char *  mode 
)

The explain_buffer_errno_fopen_explanation function is used by the explain_buffer_errno_fopen function (and others) to print the extended "because..." part of the explanation.

Parameters:
sbThe string buffer in which the message is being constructed.
errnumThe error value to be decoded.
syscall_nameThe name of the offending system call.
pathThe original path, exactly has passed to the fopen(3) system call.
modeThe original mode, exactly has passed to the fopen(3) system call.

Definition at line 55 of file fopen.c.

static void explain_buffer_errno_fopen_system_call ( explain_string_buffer_t sb,
int  errnum,
const char *  pathname,
const char *  flags_string 
) [static]

Definition at line 35 of file fopen.c.

void explain_string_flags_einval ( const explain_string_flags_t sf,
explain_string_buffer_t sb,
const char *  caption 
)

The explain_string_flags_einval function may be used to print an expanation for an EINVAL error relating to the given string flags.

Parameters:
sfThe string flags of interest.
sbThe string buffer to print into.
captionThe name of th offending system call argument.

Definition at line 140 of file fopen.c.