1explain_setdomainname(3)   Library Functions Manual   explain_setdomainname(3)
2
3
4

NAME

6       explain_setdomainname - explain setdomainname(2) errors
7

SYNOPSIS

9       #include <libexplain/setdomainname.h>
10       const char *explain_setdomainname(const char *data, size_t data_size);
11       const char *explain_errno_setdomainname(int errnum, const char *data,
12       size_t data_size);
13       void explain_message_setdomainname(char *message, int message_size,
14       const char *data, size_t data_size);
15       void explain_message_errno_setdomainname(char *message, int mes‐
16       sage_size, int errnum, const char *data, size_t data_size);
17

DESCRIPTION

19       These functions may be used to obtain explanations for errors  returned
20       by the setdomainname(2) system call.
21
22   explain_setdomainname
23       const char *explain_setdomainname(const char *data, size_t data_size);
24
25       The  explain_setdomainname function is used to obtain an explanation of
26       an error returned by the setdomainname(2) system call.  The  least  the
27       message  will  contain  is the value of strerror(errno), but usually it
28       will do much better, and indicate the underlying cause in more detail.
29
30       The errno global variable will be used to obtain the error value to  be
31       decoded.
32
33       data    The  original  data,  exactly as passed to the setdomainname(2)
34               system call.
35
36       data_size
37               The original data_size, exactly as  passed  to  the  setdomain‐
38               name(2) system call.
39
40       Returns:
41               The message explaining the error. This message buffer is shared
42               by all libexplain functions which do not  supply  a  buffer  in
43               their argument list.  This will be overwritten by the next call
44               to any libexplain function which shares this buffer,  including
45               other threads.
46
47       Note: This function is not thread safe, because it shares a return buf‐
48       fer across all threads, and many other functions in this library.
49
50       Example: This function is intended to be used in a fashion  similar  to
51       the following example:
52              if (setdomainname(data, data_size) < 0)
53              {
54                  fprintf(stderr, "%s\n", explain_setdomainname(data,
55                  data_size));
56                  exit(EXIT_FAILURE);
57              }
58
59       The above code example is available pre‐packaged as the  explain_setdo‐
60       mainname_or_die(3) function.
61
62   explain_errno_setdomainname
63       const char *explain_errno_setdomainname(int errnum, const char *data,
64       size_t data_size);
65
66       The explain_errno_setdomainname function is used to obtain an  explana‐
67       tion  of  an  error  returned  by the setdomainname(2) system call. The
68       least the message will contain is the  value  of  strerror(errno),  but
69       usually  it  will  do much better, and indicate the underlying cause in
70       more detail.
71
72       errnum  The error value to be decoded, usually obtained from the  errno
73               global  variable  just  before this function is called. This is
74               necessary if you need to call any code between the system  call
75               to  be explained and this function, because many libc functions
76               will alter the value of errno.
77
78       data    The original data, exactly as passed  to  the  setdomainname(2)
79               system call.
80
81       data_size
82               The  original  data_size,  exactly  as passed to the setdomain‐
83               name(2) system call.
84
85       Returns:
86               The message explaining the error. This message buffer is shared
87               by  all  libexplain  functions  which do not supply a buffer in
88               their argument list.  This will be overwritten by the next call
89               to  any libexplain function which shares this buffer, including
90               other threads.
91
92       Note: This function is not thread safe, because it shares a return buf‐
93       fer across all threads, and many other functions in this library.
94
95       Example:  This  function is intended to be used in a fashion similar to
96       the following example:
97              if (setdomainname(data, data_size) < 0)
98              {
99                  int err = errno;
100                  fprintf(stderr, "%s\n", explain_errno_setdomainname(err,
101                  data, data_size));
102                  exit(EXIT_FAILURE);
103              }
104
105       The  above code example is available pre‐packaged as the explain_setdo‐
106       mainname_or_die(3) function.
107
108   explain_message_setdomainname
109       void explain_message_setdomainname(char *message, int message_size,
110       const char *data, size_t data_size);
111
112       The  explain_message_setdomainname function is used to obtain an expla‐
113       nation of an error returned by the setdomainname(2)  system  call.  The
114       least  the  message  will  contain is the value of strerror(errno), but
115       usually it will do much better, and indicate the  underlying  cause  in
116       more detail.
117
118       The  errno global variable will be used to obtain the error value to be
119       decoded.
120
121       message The location in which to store the returned message. If a suit‐
122               able message return buffer is supplied, this function is thread
123               safe.
124
125       message_size
126               The size in bytes  of  the  location  in  which  to  store  the
127               returned message.
128
129       data    The  original  data,  exactly as passed to the setdomainname(2)
130               system call.
131
132       data_size
133               The original data_size, exactly as  passed  to  the  setdomain‐
134               name(2) system call.
135
136       Example:  This  function is intended to be used in a fashion similar to
137       the following example:
138              if (setdomainname(data, data_size) < 0)
139              {
140                  char message[3000];
141                  explain_message_setdomainname(message, sizeof(message),
142                  data, data_size);
143                  fprintf(stderr, "%s\n", message);
144                  exit(EXIT_FAILURE);
145              }
146
147       The  above code example is available pre‐packaged as the explain_setdo‐
148       mainname_or_die(3) function.
149
150   explain_message_errno_setdomainname
151       void explain_message_errno_setdomainname(char *message, int mes‐
152       sage_size, int errnum, const char *data, size_t data_size);
153
154       The  explain_message_errno_setdomainname  function is used to obtain an
155       explanation of an error returned by the setdomainname(2)  system  call.
156       The least the message will contain is the value of strerror(errno), but
157       usually it will do much better, and indicate the  underlying  cause  in
158       more detail.
159
160       message The location in which to store the returned message. If a suit‐
161               able message return buffer is supplied, this function is thread
162               safe.
163
164       message_size
165               The  size  in  bytes  of  the  location  in  which to store the
166               returned message.
167
168       errnum  The error value to be decoded, usually obtained from the  errno
169               global  variable  just  before this function is called. This is
170               necessary if you need to call any code between the system  call
171               to  be explained and this function, because many libc functions
172               will alter the value of errno.
173
174       data    The original data, exactly as passed  to  the  setdomainname(2)
175               system call.
176
177       data_size
178               The  original  data_size,  exactly  as passed to the setdomain‐
179               name(2) system call.
180
181       Example: This function is intended to be used in a fashion  similar  to
182       the following example:
183              if (setdomainname(data, data_size) < 0)
184              {
185                  int err = errno;
186                  char message[3000];
187                  explain_message_errno_setdomainname(message, sizeof(mes‐
188                  sage), err, data, data_size);
189                  fprintf(stderr, "%s\n", message);
190                  exit(EXIT_FAILURE);
191              }
192
193       The above code example is available pre‐packaged as the  explain_setdo‐
194       mainname_or_die(3) function.
195

SEE ALSO

197       setdomainname(2)
198               set domain name
199
200       explain_setdomainname_or_die(3)
201               set domain name and report errors
202
204       libexplain version 1.4
205       Copyright (C) 2009 Peter Miller
206
207
208
209                                                      explain_setdomainname(3)
Impressum