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

NAME

6       explain_mkostemp - explain mkostemp(3) errors
7

SYNOPSIS

9       #include <libexplain/mkostemp.h>
10       const char *explain_mkostemp(char *templat, int flags);
11       const char *explain_errno_mkostemp(int errnum, char *templat, int
12       flags);
13       void explain_message_mkostemp(char *message, int message_size, char
14       *templat, int flags);
15       void explain_message_errno_mkostemp(char *message, int message_size,
16       int errnum, char *templat, int flags);
17

DESCRIPTION

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

SEE ALSO

194       mkostemp(3)
195               create a unique temporary file
196
197       explain_mkostemp_or_die(3)
198               create a unique temporary file and report errors
199
201       libexplain version 1.4
202       Copyright (C) 2009 Peter Miller
203
204
205
206                                                           explain_mkostemp(3)
Impressum