libexplain  1.4.D001
Functions
libexplain/getaddrinfo_or_die.c File Reference
#include <libexplain/ac/assert.h>
#include <libexplain/ac/errno.h>
#include <libexplain/ac/netdb.h>
#include <libexplain/getaddrinfo.h>
#include <libexplain/output.h>

Go to the source code of this file.

Functions

void explain_getaddrinfo_or_die (const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)

Function Documentation

void explain_getaddrinfo_or_die ( const char *  node,
const char *  service,
const struct addrinfo *  hints,
struct addrinfo **  res 
)

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

This function is intended to be used in a fashion similar to the following example:

 explain_getaddrinfo_or_die(node, service, hints, res);
Parameters:
nodeThe node, exactly as to be passed to the getaddrinfo(3) system call.
serviceThe service, exactly as to be passed to the getaddrinfo(3) system call.
hintsThe hints, exactly as to be passed to the getaddrinfo(3) system call.
resThe res, exactly as to be passed to the getaddrinfo(3) system call.
Returns:
This function only returns on success. On failure, prints an explanation and exits, it does not return.

Definition at line 28 of file getaddrinfo_or_die.c.