1explain_gethostname_or_die(3L)ibrary Functions Manuaelxplain_gethostname_or_die(3)
2
3
4

NAME

6       explain_gethostname_or_die - get/set hostname and report errors
7

SYNOPSIS

9       #include <libexplain/gethostname.h>
10       void explain_gethostname_or_die(char *data, size_t data_size);
11       intexplain_gethostname_on_error(char *data, size_t data_size);
12

DESCRIPTION

14       The  explain_gethostname_or_die  function  is used to call the gethost‐
15       name(2) system call. On failure  an  explanation  will  be  printed  to
16       stderr, obtained from the explain_gethostname(3) function, and then the
17       process terminates by calling exit(EXIT_FAILURE).
18
19       The explain_gethostname_on_error function is used to call the  gethost‐
20       name(2)  system  call.  On  failure  an  explanation will be printed to
21       stderr, obtained from the explain_gethostname(3)  function,  but  still
22       returns to the caller.
23
24       data    The  data, exactly as to be passed to the gethostname(2) system
25               call.
26
27       data_size
28               The data_size, exactly as to be passed  to  the  gethostname(2)
29               system call.
30

RETURN VALUE

32       The  explain_gethostname_or_die  function  only returns on success, see
33       gethostname(2) for more information. On failure, prints an  explanation
34       and exits, it does not return.
35
36       The  explain_gethostname_on_error  function  always  returns  the value
37       return by the wrapped gethostname(2) system call.
38

EXAMPLE

40       The explain_gethostname_or_die function is intended to  be  used  in  a
41       fashion similar to the following example:
42              explain_gethostname_or_die(data, data_size);
43

SEE ALSO

45       gethostname(2)
46               get/set hostname
47
48       explain_gethostname(3)
49               explain gethostname(2) errors
50
51       exit(2) terminate the calling process
52
54       libexplain version 1.4
55       Copyright (C) 2009 Peter Miller
56
57
58
59                                                 explain_gethostname_or_die(3)
Impressum