libexplain  1.4.D001
Functions
libexplain/linkat_or_die.c File Reference
#include <libexplain/ac/errno.h>
#include <libexplain/ac/unistd.h>
#include <libexplain/linkat.h>
#include <libexplain/output.h>

Go to the source code of this file.

Functions

void explain_linkat_or_die (int old_fildes, const char *old_path, int new_fildes, const char *new_path, int flags)
int explain_linkat_on_error (int old_fildes, const char *old_path, int new_fildes, const char *new_path, int flags)

Function Documentation

int explain_linkat_on_error ( int  old_fildes,
const char *  old_path,
int  new_fildes,
const char *  new_path,
int  flags 
)

The explain_linkat_on_error function is used to call the linkat(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_linkat(3) function.

Parameters:
old_fildesThe old_fildes, exactly as to be passed to the linkat(2) system call.
old_pathThe old_path, exactly as to be passed to the linkat(2) system call.
new_fildesThe new_fildes, exactly as to be passed to the linkat(2) system call.
new_pathThe new_path, exactly as to be passed to the linkat(2) system call.
flagsThe flags, exactly as to be passed to the linkat(2) system call.
Returns:
The value returned by the wrapped linkat(2) system call.
Example:
This function is intended to be used in a fashion similar to the following example:
 if (explain_linkat_on_error(old_fildes, old_path, new_fildes, new_path,
     flags) < 0)
 {
     ...cope with error
     ...no need to print error message
 }

Definition at line 39 of file linkat_or_die.c.

void explain_linkat_or_die ( int  old_fildes,
const char *  old_path,
int  new_fildes,
const char *  new_path,
int  flags 
)

The explain_linkat_or_die function is used to call the linkat(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_linkat(3) function, and then the process terminates by calling exit(EXIT_FAILURE).

Parameters:
old_fildesThe old_fildes, exactly as to be passed to the linkat(2) system call.
old_pathThe old_path, exactly as to be passed to the linkat(2) system call.
new_fildesThe new_fildes, exactly as to be passed to the linkat(2) system call.
new_pathThe new_path, exactly as to be passed to the linkat(2) system call.
flagsThe flags, exactly as to be passed to the linkat(2) system call.
Returns:
This function only returns on success, see linkat(2) for more information. On failure, prints an explanation and exits, it does not return.
Example:
This function is intended to be used in a fashion similar to the following example:
 explain_linkat_or_die(old_fildes, old_path, new_fildes, new_path, flags);

Definition at line 27 of file linkat_or_die.c.