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

NAME

6       explain_vfork - explain vfork(2) errors
7

SYNOPSIS

9       #include <libexplain/vfork.h>
10       const char *explain_vfork(void);
11       const char *explain_errno_vfork(int errnum, void);
12       void explain_message_vfork(char *message, int message_size, void);
13       void explain_message_errno_vfork(char *message, int message_size, int
14       errnum, void);
15

DESCRIPTION

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

SEE ALSO

163       vfork(2)
164               create a child process and block parent
165
166       explain_vfork_or_die(3)
167               create a child process and block parent and report errors
168
170       libexplain version 1.4
171       Copyright (C) 2009 Peter Miller
172
173
174
175                                                              explain_vfork(3)
Impressum