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

NAME

6       explain_shmctl - explain shmctl(2) errors
7

SYNOPSIS

9       #include <libexplain/shmctl.h>
10       const char *explain_shmctl(int shmid, int command, struct shmid_ds
11       *data);
12       const char *explain_errno_shmctl(int errnum, int shmid, int command,
13       struct shmid_ds *data);
14       void explain_message_shmctl(char *message, int message_size, int shmid,
15       int command, struct shmid_ds *data);
16       void explain_message_errno_shmctl(char *message, int message_size, int
17       errnum, int shmid, int command, struct shmid_ds *data);
18

DESCRIPTION

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

SEE ALSO

204       shmctl(2)
205               shared memory control
206
207       explain_shmctl_or_die(3)
208               shared memory control and report errors
209
211       libexplain version 1.4
212       Copyright (C) 2011 Peter Miller
213
214
215
216                                                             explain_shmctl(3)
Impressum