libexplain  1.4.D001
Functions
libexplain/buffer/errno/lseek.c File Reference
#include <libexplain/ac/errno.h>
#include <libexplain/ac/stdio.h>
#include <libexplain/ac/sys/stat.h>
#include <libexplain/ac/unistd.h>
#include <libexplain/buffer/ebadf.h>
#include <libexplain/buffer/einval.h>
#include <libexplain/buffer/enosys.h>
#include <libexplain/buffer/errno/generic.h>
#include <libexplain/buffer/errno/lseek.h>
#include <libexplain/buffer/fildes.h>
#include <libexplain/buffer/file_type.h>
#include <libexplain/buffer/lseek_whence.h>
#include <libexplain/buffer/off_t.h>
#include <libexplain/explanation.h>

Go to the source code of this file.

Functions

static void explain_buffer_errno_lseek_system_call (explain_string_buffer_t *sb, int errnum, int fildes, off_t offset, int whence)
void explain_buffer_errno_lseek_explanation (explain_string_buffer_t *sb, int errnum, const char *syscall_name, int fildes, off_t offset, int whence)
void explain_buffer_errno_lseek (explain_string_buffer_t *sb, int errnum, int fildes, off_t offset, int whence)

Function Documentation

void explain_buffer_errno_lseek ( struct explain_string_buffer_t sb,
int  errnum,
int  fildes,
off_t  offset,
int  whence 
)

The explain_buffer_errno_lseek function may be used to obtain a human readable explanation of what went wrong in an lseek(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.

Parameters:
sbThe string buffer into which the message is to be written.
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.
fildesThe file descriptor to seek on, exactly as passed to the lseek(2) system call.
offsetexactly as passed to the lseek(2) system call.
whenceexactly as passed to the lseek(2) system call.
Note:
Given a suitably thread safe buffer, this function is thread safe.

Definition at line 319 of file lseek.c.

void explain_buffer_errno_lseek_explanation ( struct explain_string_buffer_t sb,
int  errnum,
const char *  syscall_name,
int  fildes,
off_t  offset,
int  whence 
)

The explain_buffer_errno_lseek_explanation function is called by the explain_buffer_errno_lseek function (and others) to print the explanation, the part after "because..."

Parameters:
sbThe string buffer into which the message is to be written.
errnumThe error value to be decoded.
syscall_nameThe name of the offending system call.
fildesThe file descriptor to seek on, exactly as passed to the lseek(2) system call.
offsetexactly as passed to the lseek(2) system call.
whenceexactly as passed to the lseek(2) system call.
Note:
Given a suitably thread safe buffer, this function is thread safe.

Definition at line 95 of file lseek.c.

static void explain_buffer_errno_lseek_system_call ( explain_string_buffer_t sb,
int  errnum,
int  fildes,
off_t  offset,
int  whence 
) [static]

Definition at line 38 of file lseek.c.