1 |
1026 |
ivang |
@c
|
2 |
|
|
@c COPYRIGHT (c) 1988-2002.
|
3 |
|
|
@c On-Line Applications Research Corporation (OAR).
|
4 |
|
|
@c All rights reserved.
|
5 |
|
|
@c
|
6 |
|
|
@c confspace.t,v 1.19 2002/01/17 21:47:45 joel Exp
|
7 |
|
|
@c
|
8 |
|
|
|
9 |
|
|
@chapter Configuration Space Manager
|
10 |
|
|
|
11 |
|
|
@section Introduction
|
12 |
|
|
|
13 |
|
|
The configuration space manager provides a portable
|
14 |
|
|
interface for manipulating configuration data.
|
15 |
|
|
The capabilities in this manager were defined in the POSIX
|
16 |
|
|
1003.1h/D3 proposed standard titled @b{Services for Reliable,
|
17 |
|
|
Available, and Serviceable Systems}.
|
18 |
|
|
|
19 |
|
|
The directives provided by the configuration space manager are:
|
20 |
|
|
|
21 |
|
|
@itemize @bullet
|
22 |
|
|
@item @code{cfg_mount} - Mount a Configuration Space
|
23 |
|
|
@item @code{cfg_unmount} - Unmount a Configuration Space
|
24 |
|
|
@item @code{cfg_mknod} - Create a Configuration Node
|
25 |
|
|
@item @code{cfg_get} - Get Configuration Node Value
|
26 |
|
|
@item @code{cfg_set} - Set Configuration Node Value
|
27 |
|
|
@item @code{cfg_link} - Create a Configuration Link
|
28 |
|
|
@item @code{cfg_unlink} - Remove a Configuration Link
|
29 |
|
|
@item @code{cfg_open} - Open a Configuration Space
|
30 |
|
|
@item @code{cfg_read} - Read a Configuration Space
|
31 |
|
|
@item @code{cfg_children} - Get Node Entries
|
32 |
|
|
@item @code{cfg_mark} - Set Configuration Space Option
|
33 |
|
|
@item @code{cfg_readdir} - Reads a directory
|
34 |
|
|
@item @code{cfg_umask} - Sets a file creation mask
|
35 |
|
|
@item @code{cfg_chmod} - Changes file mode
|
36 |
|
|
@item @code{cfg_chown} - Changes the owner and/or group of a file
|
37 |
|
|
@end itemize
|
38 |
|
|
|
39 |
|
|
@section Background
|
40 |
|
|
|
41 |
|
|
@subsection Configuration Nodes
|
42 |
|
|
|
43 |
|
|
@subsection Configuration Space
|
44 |
|
|
|
45 |
|
|
@subsection Format of a Configuration Space File
|
46 |
|
|
|
47 |
|
|
@section Operations
|
48 |
|
|
|
49 |
|
|
@subsection Mount and Unmounting
|
50 |
|
|
|
51 |
|
|
@subsection Creating a Configuration Node
|
52 |
|
|
|
53 |
|
|
@subsection Removing a Configuration Node
|
54 |
|
|
|
55 |
|
|
@subsection Manipulating a Configuration Node
|
56 |
|
|
|
57 |
|
|
@subsection Traversing a Configuration Space
|
58 |
|
|
|
59 |
|
|
@section Directives
|
60 |
|
|
|
61 |
|
|
This section details the configuration space manager's directives.
|
62 |
|
|
A subsection is dedicated to each of this manager's directives
|
63 |
|
|
and describes the calling sequence, related constants, usage,
|
64 |
|
|
and status codes.
|
65 |
|
|
|
66 |
|
|
@page
|
67 |
|
|
@subsection cfg_mount - Mount a Configuration Space
|
68 |
|
|
|
69 |
|
|
@subheading CALLING SEQUENCE:
|
70 |
|
|
|
71 |
|
|
@ifset is-C
|
72 |
|
|
@example
|
73 |
|
|
#include
|
74 |
|
|
|
75 |
|
|
int cfg_mount(
|
76 |
|
|
const char *file,
|
77 |
|
|
const char *cfgpath,
|
78 |
|
|
log_facility_t notification,
|
79 |
|
|
);
|
80 |
|
|
@end example
|
81 |
|
|
@end ifset
|
82 |
|
|
|
83 |
|
|
@ifset is-Ada
|
84 |
|
|
@end ifset
|
85 |
|
|
|
86 |
|
|
@subheading STATUS CODES:
|
87 |
|
|
|
88 |
|
|
A successful call to @code{cfg_mount()} returns a value of zero
|
89 |
|
|
and an unsuccessful call returns the @code{errno}.
|
90 |
|
|
|
91 |
|
|
@table @b
|
92 |
|
|
@item EPERM
|
93 |
|
|
The caller does not have the appropriate privilege.
|
94 |
|
|
|
95 |
|
|
@item EACCES
|
96 |
|
|
Search permission is denied for a component of the path prefix.
|
97 |
|
|
|
98 |
|
|
@item EEXIST
|
99 |
|
|
The file specified by the @code{file} argument does not exist
|
100 |
|
|
|
101 |
|
|
@item ENAMETOOLONG
|
102 |
|
|
A component of a pathname exceeded @code{NAME_MAX} characters,
|
103 |
|
|
or an entire path name exceed @code{PATH_MAX} characters while
|
104 |
|
|
@code{_POSIX_NO_TRUNC} is in effect.
|
105 |
|
|
|
106 |
|
|
@item ENOENT
|
107 |
|
|
A component of @code{cfgpath} does not exist.
|
108 |
|
|
|
109 |
|
|
@item ENOTDIR
|
110 |
|
|
A component of the @code{file} path prefix is not a directory.
|
111 |
|
|
|
112 |
|
|
@item EBUSY
|
113 |
|
|
The configuration space defined by @code{file} is already mounted.
|
114 |
|
|
|
115 |
|
|
@item EINVAL
|
116 |
|
|
The notification argument specifies an invalid log facility.
|
117 |
|
|
|
118 |
|
|
@end table
|
119 |
|
|
|
120 |
|
|
@subheading DESCRIPTION:
|
121 |
|
|
|
122 |
|
|
The @code{cfg_mount()} function maps a configuration space defined
|
123 |
|
|
by the file identified by the the @code{file} argument. The
|
124 |
|
|
distinguished node of the mapped configuration space is
|
125 |
|
|
mounted in the active space at the point identified by the
|
126 |
|
|
@code{cfgpath} configuration pathname.
|
127 |
|
|
|
128 |
|
|
The @code{notification} argument specifies how changes to the
|
129 |
|
|
mapped configuration space are communicated to the application.
|
130 |
|
|
If the @code{notification} argument is NULL, no notification will be
|
131 |
|
|
be performed for the mapped configuration space. If the Event
|
132 |
|
|
Logging option is defined, the notification argument defines the
|
133 |
|
|
facility to which changes in the mapped configuration space are
|
134 |
|
|
logged. Otherwise, the @code{notification} argument specifies
|
135 |
|
|
an implementation defined method of notifying the application
|
136 |
|
|
of changes to the mapped configuration space.
|
137 |
|
|
|
138 |
|
|
@subheading NOTES:
|
139 |
|
|
|
140 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
141 |
|
|
this service is available.
|
142 |
|
|
|
143 |
|
|
@page
|
144 |
|
|
@subsection cfg_unmount - Unmount a Configuration Space
|
145 |
|
|
|
146 |
|
|
@subheading CALLING SEQUENCE:
|
147 |
|
|
|
148 |
|
|
@ifset is-C
|
149 |
|
|
@example
|
150 |
|
|
#include
|
151 |
|
|
|
152 |
|
|
int cfg_unmount(
|
153 |
|
|
const char *cfgpath
|
154 |
|
|
);
|
155 |
|
|
@end example
|
156 |
|
|
@end ifset
|
157 |
|
|
|
158 |
|
|
@ifset is-Ada
|
159 |
|
|
@end ifset
|
160 |
|
|
|
161 |
|
|
@subheading STATUS CODES:
|
162 |
|
|
|
163 |
|
|
A successful call to @code{cfg_umount()} returns a value of zero
|
164 |
|
|
and an unsuccessful call returns the @code{errno}.
|
165 |
|
|
|
166 |
|
|
@table @b
|
167 |
|
|
@item EPERM
|
168 |
|
|
The caller does not have the appropriate privileges.
|
169 |
|
|
|
170 |
|
|
@item EACCES
|
171 |
|
|
Search permission is denied for a component of the path prefix.
|
172 |
|
|
|
173 |
|
|
@item ENOENT
|
174 |
|
|
A component of @code{cfgpath} does not exist.
|
175 |
|
|
|
176 |
|
|
@item ENAMETOOLONG
|
177 |
|
|
A component of a pathname exceeded @code{NAME_MAX} characters,
|
178 |
|
|
or an entire path name exceed @code{PATH_MAX} characters while
|
179 |
|
|
@code{_POSIX_NO_TRUNC} is in effect.
|
180 |
|
|
|
181 |
|
|
@item EINVAL
|
182 |
|
|
The requested node is not the distinguished node of a mounted
|
183 |
|
|
configuration space.
|
184 |
|
|
|
185 |
|
|
@item EBUSY
|
186 |
|
|
One or more processes has an open configuration traversal
|
187 |
|
|
stream for the configuration space whose distinguished node is
|
188 |
|
|
referenced by the cfgpath argument.
|
189 |
|
|
|
190 |
|
|
@item ELOOP
|
191 |
|
|
A node appears more than once in the path specified by the
|
192 |
|
|
@code{cfgpath} argument
|
193 |
|
|
|
194 |
|
|
@item ELOOP
|
195 |
|
|
More than @code{SYMLOOP_MAX} symbolic links were encountered during
|
196 |
|
|
resolution of the cfgpath argument
|
197 |
|
|
|
198 |
|
|
@end table
|
199 |
|
|
|
200 |
|
|
@subheading DESCRIPTION:
|
201 |
|
|
|
202 |
|
|
The @code{cfg_umount()} function unmaps the configuration space whose
|
203 |
|
|
distinguished node is mapped in the active space at the location defined
|
204 |
|
|
by @code{cfgpath} configuration pathname. All system resources
|
205 |
|
|
allocated for this configuration space should be deallocated.
|
206 |
|
|
|
207 |
|
|
@subheading NOTES:
|
208 |
|
|
|
209 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
210 |
|
|
this service is available.
|
211 |
|
|
|
212 |
|
|
@page
|
213 |
|
|
@subsection cfg_mknod - Create a Configuration Node
|
214 |
|
|
|
215 |
|
|
@subheading CALLING SEQUENCE:
|
216 |
|
|
|
217 |
|
|
@ifset is-C
|
218 |
|
|
@example
|
219 |
|
|
#include
|
220 |
|
|
|
221 |
|
|
int cfg_mknod(
|
222 |
|
|
const char *cfgpath,
|
223 |
|
|
mode_t mode,
|
224 |
|
|
cfg_type_t type
|
225 |
|
|
);
|
226 |
|
|
@end example
|
227 |
|
|
@end ifset
|
228 |
|
|
|
229 |
|
|
@ifset is-Ada
|
230 |
|
|
@end ifset
|
231 |
|
|
|
232 |
|
|
@subheading STATUS CODES:
|
233 |
|
|
|
234 |
|
|
A successful call to @code{cfg_mknod()} returns a value of zero
|
235 |
|
|
and an unsuccessful call returns the @code{errno}.
|
236 |
|
|
|
237 |
|
|
@table @b
|
238 |
|
|
@item ENAMETOOLONG
|
239 |
|
|
A component of a pathname exceeded @code{NAME_MAX} characters,
|
240 |
|
|
or an entire path name exceed @code{PATH_MAX} characters while
|
241 |
|
|
@code{_POSIX_NO_TRUNC} is in effect.
|
242 |
|
|
|
243 |
|
|
@item ENOENT
|
244 |
|
|
A component of the path prefix does not exist.
|
245 |
|
|
|
246 |
|
|
@item EACCES
|
247 |
|
|
Search permission is denied for a component of the path prefix.
|
248 |
|
|
|
249 |
|
|
|
250 |
|
|
@item EPERM
|
251 |
|
|
The calling process does not have the appropriate privilege.
|
252 |
|
|
|
253 |
|
|
@item EEXIST
|
254 |
|
|
The named node exists.
|
255 |
|
|
|
256 |
|
|
@item EINVAL
|
257 |
|
|
The value of @code{mode} is invalid.
|
258 |
|
|
|
259 |
|
|
@item EINVAL
|
260 |
|
|
The value of @code{type} is invalid.
|
261 |
|
|
|
262 |
|
|
@item ELOOP
|
263 |
|
|
A node appears more than once in the path specified by the
|
264 |
|
|
@code{cfg_path} argument
|
265 |
|
|
|
266 |
|
|
@item ELOOP
|
267 |
|
|
More than @code{SYMLOOP_MAX} symbolic links were encountered during
|
268 |
|
|
resolution of the @code{cfgpath} argument.
|
269 |
|
|
|
270 |
|
|
@item EROFS
|
271 |
|
|
The named @code{node} resides on a read-only configuration space.
|
272 |
|
|
|
273 |
|
|
@end table
|
274 |
|
|
|
275 |
|
|
@subheading DESCRIPTION:
|
276 |
|
|
|
277 |
|
|
The @code{cfg_mknod()} function creates a new node in the configuration
|
278 |
|
|
space which contains the pathname prefix of @code{cfgpath}. The node
|
279 |
|
|
name is defined by the pathname suffix of @code{cfgpath}. The node
|
280 |
|
|
permissions are specified by the value of @code{mode}. The node type
|
281 |
|
|
is specified by the value of @code{type}.
|
282 |
|
|
|
283 |
|
|
@subheading NOTES:
|
284 |
|
|
|
285 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
286 |
|
|
this service is available.
|
287 |
|
|
|
288 |
|
|
@page
|
289 |
|
|
@subsection cfg_get - Get Configuration Node Value
|
290 |
|
|
|
291 |
|
|
@subheading CALLING SEQUENCE:
|
292 |
|
|
|
293 |
|
|
@ifset is-C
|
294 |
|
|
@example
|
295 |
|
|
#include
|
296 |
|
|
|
297 |
|
|
int cfg_get(
|
298 |
|
|
const char *cfgpath
|
299 |
|
|
cfg_value_t *value
|
300 |
|
|
);
|
301 |
|
|
@end example
|
302 |
|
|
@end ifset
|
303 |
|
|
|
304 |
|
|
@ifset is-Ada
|
305 |
|
|
@end ifset
|
306 |
|
|
|
307 |
|
|
@subheading STATUS CODES:
|
308 |
|
|
|
309 |
|
|
A successful call to @code{cfg_get()} returns a value of zero
|
310 |
|
|
and an unsuccessful call returns the @code{errno}.
|
311 |
|
|
|
312 |
|
|
@table @b
|
313 |
|
|
@item ENAMETOOLONG
|
314 |
|
|
A component of a pathname exceeded @code{NAME_MAX} characters,
|
315 |
|
|
or an entire path name exceed @code{PATH_MAX} characters while
|
316 |
|
|
@code{_POSIX_NO_TRUNC} is in effect.
|
317 |
|
|
|
318 |
|
|
@item ENOENT
|
319 |
|
|
A component of @code{cfgpath} does not exist.
|
320 |
|
|
|
321 |
|
|
@item EACCES
|
322 |
|
|
Search permission is denied for a component of the path prefix.
|
323 |
|
|
|
324 |
|
|
@item EPERM
|
325 |
|
|
The calling process does not have the appropriate privileges.
|
326 |
|
|
|
327 |
|
|
@item ELOOP
|
328 |
|
|
A node appears more than once in the path specified by the
|
329 |
|
|
@code{cfgpath} argument
|
330 |
|
|
|
331 |
|
|
@item ELOOP
|
332 |
|
|
More than @code{SYMLOOP_MAX} symbolic links were encountered during
|
333 |
|
|
resolution of the @code{cfgpath} argument.
|
334 |
|
|
|
335 |
|
|
@end table
|
336 |
|
|
|
337 |
|
|
@subheading DESCRIPTION:
|
338 |
|
|
|
339 |
|
|
The @code{cfg_get()} function stores the value attribute of the
|
340 |
|
|
configuration node identified by @code{cfgpath}, into the buffer
|
341 |
|
|
described by the @code{value} pointer.
|
342 |
|
|
|
343 |
|
|
@subheading NOTES:
|
344 |
|
|
|
345 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
346 |
|
|
this service is available.
|
347 |
|
|
|
348 |
|
|
@page
|
349 |
|
|
@subsection cfg_set - Set Configuration Node Value
|
350 |
|
|
|
351 |
|
|
@subheading CALLING SEQUENCE:
|
352 |
|
|
|
353 |
|
|
@ifset is-C
|
354 |
|
|
@example
|
355 |
|
|
#include
|
356 |
|
|
|
357 |
|
|
int cfg_set(
|
358 |
|
|
const char *cfgpath
|
359 |
|
|
cfg_value_t *value
|
360 |
|
|
);
|
361 |
|
|
@end example
|
362 |
|
|
@end ifset
|
363 |
|
|
|
364 |
|
|
@ifset is-Ada
|
365 |
|
|
@end ifset
|
366 |
|
|
|
367 |
|
|
@subheading STATUS CODES:
|
368 |
|
|
|
369 |
|
|
A successful call to @code{cfg_set()} returns a value of zero
|
370 |
|
|
and an unsuccessful call returns the @code{errno}.
|
371 |
|
|
|
372 |
|
|
@table @b
|
373 |
|
|
@item ENAMETOOLONG
|
374 |
|
|
A component of a pathname exceeded @code{NAME_MAX} characters,
|
375 |
|
|
or an entire path name exceed @code{PATH_MAX} characters while
|
376 |
|
|
@code{_POSIX_NO_TRUNC} is in effect.
|
377 |
|
|
|
378 |
|
|
@item ENOENT
|
379 |
|
|
A component of @code{cfgpath} does not exist
|
380 |
|
|
|
381 |
|
|
@item EACCES
|
382 |
|
|
Search permission is denied for a component of the path prefix.
|
383 |
|
|
|
384 |
|
|
@item EPERM
|
385 |
|
|
The calling process does not have the appropriate privilege.
|
386 |
|
|
|
387 |
|
|
@item ELOOP
|
388 |
|
|
A node appears more than once in the path specified by the
|
389 |
|
|
@code{cfgpath} argument.
|
390 |
|
|
|
391 |
|
|
@item ELOOP
|
392 |
|
|
More than @code{SYMLOOP_MAX} symbolic links were encountered during
|
393 |
|
|
resolution of the cfgpath argument.
|
394 |
|
|
|
395 |
|
|
@end table
|
396 |
|
|
|
397 |
|
|
@subheading DESCRIPTION:
|
398 |
|
|
|
399 |
|
|
The @code{cfg_set()} function stores the value specified by the
|
400 |
|
|
@code{value} argument in the configuration node defined by the
|
401 |
|
|
@code{cfgpath} argument.
|
402 |
|
|
|
403 |
|
|
@subheading NOTES:
|
404 |
|
|
|
405 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
406 |
|
|
this service is available.
|
407 |
|
|
|
408 |
|
|
@page
|
409 |
|
|
@subsection cfg_link - Create a Configuration Link
|
410 |
|
|
|
411 |
|
|
@subheading CALLING SEQUENCE:
|
412 |
|
|
|
413 |
|
|
@ifset is-C
|
414 |
|
|
@example
|
415 |
|
|
#include
|
416 |
|
|
|
417 |
|
|
int cfg_link(
|
418 |
|
|
const char *src
|
419 |
|
|
const char *dest
|
420 |
|
|
);
|
421 |
|
|
@end example
|
422 |
|
|
@end ifset
|
423 |
|
|
|
424 |
|
|
@ifset is-Ada
|
425 |
|
|
@end ifset
|
426 |
|
|
|
427 |
|
|
@subheading STATUS CODES:
|
428 |
|
|
|
429 |
|
|
A successful call to @code{cfg_link()} returns a value of zero
|
430 |
|
|
and an unsuccessful call returns the @code{errno}.
|
431 |
|
|
|
432 |
|
|
@table @b
|
433 |
|
|
@item ENAMETOOLONG
|
434 |
|
|
A component of a pathname exceeded @code{NAME_MAX} characters,
|
435 |
|
|
or an entire path name exceed @code{PATH_MAX} characters while
|
436 |
|
|
@code{_POSIX_NO_TRUNC} is in effect.
|
437 |
|
|
|
438 |
|
|
@item ENOENT
|
439 |
|
|
A component of either path prefix does not exist.
|
440 |
|
|
|
441 |
|
|
@item EACCES
|
442 |
|
|
A component of either path prefix denies search permission.
|
443 |
|
|
|
444 |
|
|
@item EACCES
|
445 |
|
|
The requested link requires writing in a node with a mode that
|
446 |
|
|
denies write permission.
|
447 |
|
|
|
448 |
|
|
@item ENOENT
|
449 |
|
|
The node named by @code{src} does not exist.
|
450 |
|
|
|
451 |
|
|
@item EEXIST
|
452 |
|
|
The node named by @code{dest} does exist.
|
453 |
|
|
|
454 |
|
|
@item EPERM
|
455 |
|
|
The calling process does not have the appropriate privilege to
|
456 |
|
|
modify the node indicated by the @code{src} argument.
|
457 |
|
|
|
458 |
|
|
@item EXDEV
|
459 |
|
|
The link named by @code{dest} and the node named by @code{src} are from different
|
460 |
|
|
configuration spaces.
|
461 |
|
|
|
462 |
|
|
@item ENOSPC
|
463 |
|
|
The node in which the entry for the new link is being placed
|
464 |
|
|
cannot be extended because there is no space left on the
|
465 |
|
|
configuration space containing the node.
|
466 |
|
|
|
467 |
|
|
@item EIO
|
468 |
|
|
An I/O error occurred while reading from or writing to the
|
469 |
|
|
configuration space to make the link entry.
|
470 |
|
|
|
471 |
|
|
@item EROFS
|
472 |
|
|
The requested link requires writing in a node on a read-only
|
473 |
|
|
configuration space.
|
474 |
|
|
|
475 |
|
|
@end table
|
476 |
|
|
|
477 |
|
|
@subheading DESCRIPTION:
|
478 |
|
|
|
479 |
|
|
The @code{src} and @code{dest} arguments point to pathnames which
|
480 |
|
|
name existing nodes. The @code{cfg_link()} function atomically creates
|
481 |
|
|
a link between specified nodes, and increment by one the link count
|
482 |
|
|
of the node specified by the @code{src} argument.
|
483 |
|
|
|
484 |
|
|
If the @code{cfg_link()} function fails, no link is created, and the
|
485 |
|
|
link count of the node remains unchanged by this function call.
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
@subheading NOTES:
|
489 |
|
|
|
490 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
491 |
|
|
this service is available.
|
492 |
|
|
|
493 |
|
|
@page
|
494 |
|
|
@subsection cfg_unlink - Remove a Configuration Link
|
495 |
|
|
|
496 |
|
|
@subheading CALLING SEQUENCE:
|
497 |
|
|
|
498 |
|
|
@ifset is-C
|
499 |
|
|
@example
|
500 |
|
|
#include
|
501 |
|
|
|
502 |
|
|
int cfg_unlink(
|
503 |
|
|
const char *cfgpath
|
504 |
|
|
);
|
505 |
|
|
@end example
|
506 |
|
|
@end ifset
|
507 |
|
|
|
508 |
|
|
@ifset is-Ada
|
509 |
|
|
@end ifset
|
510 |
|
|
|
511 |
|
|
@subheading STATUS CODES:
|
512 |
|
|
|
513 |
|
|
A successful call to @code{cfg_unlink()} returns a value of zero
|
514 |
|
|
and an unsuccessful call returns the @code{errno}.
|
515 |
|
|
|
516 |
|
|
@table @b
|
517 |
|
|
@item ENAMETOOLONG
|
518 |
|
|
A component of a pathname exceeded @code{NAME_MAX} characters,
|
519 |
|
|
or an entire path name exceed @code{PATH_MAX} characters.
|
520 |
|
|
|
521 |
|
|
@item EACCES
|
522 |
|
|
Search permission is denied on the node containing the link to
|
523 |
|
|
be removed.
|
524 |
|
|
|
525 |
|
|
@item EACCES
|
526 |
|
|
Write permission is denied on the node containing the link to
|
527 |
|
|
be removed.
|
528 |
|
|
|
529 |
|
|
@item ENOENT
|
530 |
|
|
A component of @code{cfgpath} does not exist.
|
531 |
|
|
|
532 |
|
|
@item EPERM
|
533 |
|
|
The calling process does not have the appropriate privilege to
|
534 |
|
|
modify the node indicated by the path prefix of the @code{cfgpath}
|
535 |
|
|
argument.
|
536 |
|
|
|
537 |
|
|
@item EBUSY
|
538 |
|
|
The node to be unlinked is the distinguished node of a mounted
|
539 |
|
|
configuration space.
|
540 |
|
|
|
541 |
|
|
@item EIO
|
542 |
|
|
An I/O error occurred while deleting the link entry or deallocating
|
543 |
|
|
the node.
|
544 |
|
|
|
545 |
|
|
@item EROFS
|
546 |
|
|
The named node resides in a read-only configuration space.
|
547 |
|
|
|
548 |
|
|
@item ELOOP
|
549 |
|
|
A node appears more than once in the path specified by the
|
550 |
|
|
@code{cfgpath} argument.
|
551 |
|
|
|
552 |
|
|
@item ELOOP
|
553 |
|
|
More than @code{SYMLOOP_MAX} symbolic links were encountered during
|
554 |
|
|
resolution of the cfgpath argument.
|
555 |
|
|
|
556 |
|
|
@end table
|
557 |
|
|
|
558 |
|
|
@subheading DESCRIPTION:
|
559 |
|
|
|
560 |
|
|
The @code{cfg_unlink()} function removes the link between the node
|
561 |
|
|
specified by the @code{cfgpath} path prefix and the parent node
|
562 |
|
|
specified by @code{cfgpath}, and decrements the link count
|
563 |
|
|
of the @code{cfgpath} node.
|
564 |
|
|
|
565 |
|
|
When the link count of the node becomes zero, the space occupied
|
566 |
|
|
by the node is freed and the node is no longer be accessible.
|
567 |
|
|
|
568 |
|
|
@subheading NOTES:
|
569 |
|
|
|
570 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
571 |
|
|
this service is available.
|
572 |
|
|
|
573 |
|
|
@page
|
574 |
|
|
@subsection cfg_open - Open a Configuration Space
|
575 |
|
|
|
576 |
|
|
@subheading CALLING SEQUENCE:
|
577 |
|
|
|
578 |
|
|
@ifset is-C
|
579 |
|
|
@example
|
580 |
|
|
#include
|
581 |
|
|
|
582 |
|
|
int cfg_open(
|
583 |
|
|
const char *pathnames[],
|
584 |
|
|
int options,
|
585 |
|
|
int (*compar)(const CFGENT **f1, const CFGENT **f2),
|
586 |
|
|
CFG **cfgstream
|
587 |
|
|
);
|
588 |
|
|
@end example
|
589 |
|
|
@end ifset
|
590 |
|
|
|
591 |
|
|
@ifset is-Ada
|
592 |
|
|
@end ifset
|
593 |
|
|
|
594 |
|
|
@subheading STATUS CODES:
|
595 |
|
|
|
596 |
|
|
A successful call to @code{cfg_open()} returns a value of zero
|
597 |
|
|
and an unsuccessful call returns the @code{errno}.
|
598 |
|
|
|
599 |
|
|
@table @b
|
600 |
|
|
@item EACCES
|
601 |
|
|
Search permission is denied for any component of a pathname.
|
602 |
|
|
|
603 |
|
|
@item ELOOP
|
604 |
|
|
A loop exists in symbolic links encountered during resolution
|
605 |
|
|
of a pathname.
|
606 |
|
|
|
607 |
|
|
@item ENAMETOOLONG
|
608 |
|
|
The length of a pathname exceeds @code{PATH_MAX}, or a pathname
|
609 |
|
|
component is longer than @code{NAME_MAX} while @code{_POSIX_NO_TRUNC}
|
610 |
|
|
|
611 |
|
|
@item ENOENT
|
612 |
|
|
The pathname argument is an empty string or the named node
|
613 |
|
|
does not exist.
|
614 |
|
|
|
615 |
|
|
@item EINVAL
|
616 |
|
|
Either both or neither of @code{CFG_LOGICAL} and @code{CFG_PHYSICAL} are
|
617 |
|
|
specified by the @code{options} argument
|
618 |
|
|
|
619 |
|
|
@item ENOMEM
|
620 |
|
|
Not enough memory is available to create the necessary structures.
|
621 |
|
|
|
622 |
|
|
@item ELOOP
|
623 |
|
|
More than @code{SYMLOOP_MAX} symbolic links were encountered during
|
624 |
|
|
resolution of the @code{pathnames} argument.
|
625 |
|
|
|
626 |
|
|
@item ENAMETOOLONG
|
627 |
|
|
As a result of encountering a symbolic link in resolution of the
|
628 |
|
|
pathname specified by the @code{pathnames} argument, the length of
|
629 |
|
|
the substituted pathname string exceeded @code{PATH_MAX}.
|
630 |
|
|
|
631 |
|
|
@end table
|
632 |
|
|
|
633 |
|
|
@subheading DESCRIPTION:
|
634 |
|
|
|
635 |
|
|
The @code{cfg_open()} function opens a configuration traversal stream
|
636 |
|
|
rooted in the configuration nodes name by the @code{pathnames} argument.
|
637 |
|
|
It stores a pointer to a CFG object that represents that stream at
|
638 |
|
|
the location identified the @code{cfgstream} pointer. The @code{pathnames}
|
639 |
|
|
argument is an array of character pointers to NULL-terminated strings.
|
640 |
|
|
The last member of this array is a NULL pointer.
|
641 |
|
|
|
642 |
|
|
The value of @code{options} is the bitwise inclusive OR of values from the
|
643 |
|
|
following lists. Applications supply exactly one of the first two values
|
644 |
|
|
below in @code{options}.
|
645 |
|
|
|
646 |
|
|
@table @b
|
647 |
|
|
|
648 |
|
|
@item CFG_LOGICAL
|
649 |
|
|
When symbolic links referencing existing nodes are
|
650 |
|
|
encountered during the traversal, the @code{cfg_info}
|
651 |
|
|
field of the returned CFGENT structure describes the
|
652 |
|
|
target node pointed to by the link instead of the
|
653 |
|
|
link itself, unless the target node does not exist.
|
654 |
|
|
If the target node has children, the pre-order return,
|
655 |
|
|
followed by the return of structures referencing all of
|
656 |
|
|
its descendants, followed by a post-order return, is done.
|
657 |
|
|
|
658 |
|
|
@item CFG_PHYSICAL
|
659 |
|
|
When symbolic links are encountered during the traversal,
|
660 |
|
|
the @code{cfg_info} field is used to describe the symbolic
|
661 |
|
|
link.
|
662 |
|
|
|
663 |
|
|
@end table
|
664 |
|
|
|
665 |
|
|
|
666 |
|
|
Any combination of the remaining flags can be specified in the value of
|
667 |
|
|
@code{options}
|
668 |
|
|
|
669 |
|
|
@table @b
|
670 |
|
|
|
671 |
|
|
@item CFG_COMFOLLOW
|
672 |
|
|
When symbolic links referencing existing nodes are
|
673 |
|
|
specified in the @code{pathnames} argument, the
|
674 |
|
|
@code{cfg_info} field of the returned CFGENT structure
|
675 |
|
|
describes the target node pointed to by the link
|
676 |
|
|
instead of the link itself, unless the target node does
|
677 |
|
|
not exist. If the target node has children, the
|
678 |
|
|
pre-order return, followed by the return of structures
|
679 |
|
|
referencing all its descendants, followed by a post-order
|
680 |
|
|
return, is done.
|
681 |
|
|
|
682 |
|
|
@item CFG_XDEV
|
683 |
|
|
The configuration space functions do not return a
|
684 |
|
|
CFGENT structure for any node in a different configuration
|
685 |
|
|
space than the configuration space of the nodes identified
|
686 |
|
|
by the CFGENT structures for the @code{pathnames} argument.
|
687 |
|
|
|
688 |
|
|
@end table
|
689 |
|
|
|
690 |
|
|
The @code{cfg_open()} argument @code{compar} is either a NULL or point
|
691 |
|
|
to a function that is called with two pointers to pointers to CFGENT
|
692 |
|
|
structures that returns less than, equal to , or greater than zero if
|
693 |
|
|
the node referenced by the first argument is considered to be respectively
|
694 |
|
|
less than, equal to, or greater than the node referenced by the second.
|
695 |
|
|
The CFGENT structure fields provided to the comparison routine is as
|
696 |
|
|
described with the exception that the contents of the @code{cfg_path} and
|
697 |
|
|
@code{cfg_pathlen} fields are unspecified.
|
698 |
|
|
|
699 |
|
|
This comparison routine is used to determine the order in which nodes in
|
700 |
|
|
directories encountered during the traversal are returned, and the order
|
701 |
|
|
of traversal when more than one node is specified in the @code{pathnames}
|
702 |
|
|
argument to @code{cfg_open()}. If a comparison routine is specified, the
|
703 |
|
|
order of traversal is from the least to the greatest. If the @code{compar}
|
704 |
|
|
argument is NULL, the order of traversal shall is listed in the
|
705 |
|
|
@code{pathnames} argument.
|
706 |
|
|
|
707 |
|
|
@subheading NOTES:
|
708 |
|
|
|
709 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
710 |
|
|
this service is available.
|
711 |
|
|
|
712 |
|
|
@page
|
713 |
|
|
@subsection cfg_read - Read a Configuration Space
|
714 |
|
|
|
715 |
|
|
@subheading CALLING SEQUENCE:
|
716 |
|
|
|
717 |
|
|
@ifset is-C
|
718 |
|
|
@example
|
719 |
|
|
#include
|
720 |
|
|
|
721 |
|
|
int cfg_read(
|
722 |
|
|
CFG *cfgp,
|
723 |
|
|
CFGENT **node
|
724 |
|
|
);
|
725 |
|
|
@end example
|
726 |
|
|
@end ifset
|
727 |
|
|
|
728 |
|
|
@ifset is-Ada
|
729 |
|
|
@end ifset
|
730 |
|
|
|
731 |
|
|
@subheading STATUS CODES:
|
732 |
|
|
|
733 |
|
|
A successful call to @code{cfg_read()} returns a value of zero
|
734 |
|
|
and an unsuccessful call returns the @code{errno}.
|
735 |
|
|
|
736 |
|
|
@table @b
|
737 |
|
|
@item EACCES
|
738 |
|
|
Search permission is denied for any component of a pathname.
|
739 |
|
|
|
740 |
|
|
@item EBADF
|
741 |
|
|
The @code{cfgp} argument does not refer to an open configuration
|
742 |
|
|
space.
|
743 |
|
|
|
744 |
|
|
@item ELOOP
|
745 |
|
|
A loop exists in symbolic links encountered during resolution
|
746 |
|
|
of a pathname.
|
747 |
|
|
|
748 |
|
|
@item ENOENT
|
749 |
|
|
A named @code{node} does not exist.
|
750 |
|
|
|
751 |
|
|
@item ENOMEM
|
752 |
|
|
Not enough memory is available to create the necessary structures.
|
753 |
|
|
|
754 |
|
|
@item ELOOP
|
755 |
|
|
More than @code{SYMLOOP_MAX} symbolic links were encountered during
|
756 |
|
|
resolution of the cfgpath argument.
|
757 |
|
|
|
758 |
|
|
@item ENAMETOOLONG
|
759 |
|
|
As a result of encountering a symbolic link in resolution of the
|
760 |
|
|
pathname specified by the pathnames argument, the length of the
|
761 |
|
|
substituted pathname string exceeded @code{PATH_MATH}.
|
762 |
|
|
|
763 |
|
|
@end table
|
764 |
|
|
|
765 |
|
|
@subheading DESCRIPTION:
|
766 |
|
|
|
767 |
|
|
The @code{cfg_read()} function returns a pointer to a CFGENT structure
|
768 |
|
|
representing a node in the configuration space to which @code{cfgp}
|
769 |
|
|
refers. The returned pointer is stored at the location indicated
|
770 |
|
|
by the @code{node} argument.
|
771 |
|
|
|
772 |
|
|
The child nodes of each node in the configuration tree is returned
|
773 |
|
|
by @code{cfg_read()}. If a comparison routine was specified to the
|
774 |
|
|
@code{cfg_open()} function, the order of return of the child nodes is
|
775 |
|
|
as specified by the @code{compar} routine, from least to greatest.
|
776 |
|
|
Otherwise, the order of return is unspecified.
|
777 |
|
|
|
778 |
|
|
Structures referencing nodes with children is returned by the
|
779 |
|
|
function @code{cfg_read()} at least twice [unless the application
|
780 |
|
|
specifies otherwise with @code{cfg_mark()}]-once immediately before
|
781 |
|
|
the structures representing their descendants, are returned
|
782 |
|
|
(pre-order), and once immediately after structures representing all
|
783 |
|
|
of their descendants, if any, are returned (post-order). The
|
784 |
|
|
CFGENT structure returned in post-order (with the exception of the
|
785 |
|
|
@code{cfg_info} field) is identical to that returned in pre-order.
|
786 |
|
|
Structures referencing nodes of other types is returned at least
|
787 |
|
|
once.
|
788 |
|
|
|
789 |
|
|
The fields of the CFGENT structure contains the following
|
790 |
|
|
information:
|
791 |
|
|
|
792 |
|
|
@table @b
|
793 |
|
|
|
794 |
|
|
@item cfg_parent
|
795 |
|
|
A pointer to the structure returned by the
|
796 |
|
|
@code{cfg_read()} function for the node that contains
|
797 |
|
|
the entry for the current node. A @code{cfg_parent}
|
798 |
|
|
structure is provided for the node(s) specified by
|
799 |
|
|
the @code{pathnames} argument to the @code{cfg_open()}
|
800 |
|
|
function, but the contents of other than its
|
801 |
|
|
@code{cfg_number}, @code{cfg_pointer}, @code{cfg_parent},
|
802 |
|
|
and @code{cfg_parent}, and @code{cfg_level} fields are
|
803 |
|
|
unspecified. Its @code{cfg_link} field is unspecified.
|
804 |
|
|
|
805 |
|
|
@item cfg_link
|
806 |
|
|
Upon return from the @code{cfg_children()} function, the
|
807 |
|
|
@code{cfg_link} field points to the next CFGENT structure
|
808 |
|
|
in a NULL-terminated linked list of CFGENT structures.
|
809 |
|
|
Otherwise, the content of the @code{cfg_link} field is
|
810 |
|
|
unspecified.
|
811 |
|
|
|
812 |
|
|
@item cfg_cycle
|
813 |
|
|
If the structure being returned by @code{cfg_read()}
|
814 |
|
|
represents a node that appears in the @code{cfg_parent}
|
815 |
|
|
linked list tree, the @code{cfg_cycle} field shall point
|
816 |
|
|
to the structure representing that entry from the
|
817 |
|
|
@code{cfg_parent} linked list. Otherwise the content of
|
818 |
|
|
the @code{cfg_cycle} field is unspecified.
|
819 |
|
|
|
820 |
|
|
@item cfg_number
|
821 |
|
|
The @code{cfg_number} field is provided for use by the
|
822 |
|
|
application program. It is initialized to zero for
|
823 |
|
|
each new node returned by the @code{cfg_read()} function,
|
824 |
|
|
but is not further modified by the configuration space
|
825 |
|
|
routines.
|
826 |
|
|
|
827 |
|
|
@item cfg_pointer
|
828 |
|
|
The @code{cfg_pointer} field is provided for use by the
|
829 |
|
|
application program. It is initialized to NULL for
|
830 |
|
|
each new node returned by the @code{cfg_read()} function,
|
831 |
|
|
but is not further modified by the configuration
|
832 |
|
|
space routines.
|
833 |
|
|
|
834 |
|
|
@item cfg_path
|
835 |
|
|
A pathname for the node including and relative to the
|
836 |
|
|
argument supplied to the @code{cfg_open()} routine for this
|
837 |
|
|
configuration space. This pathname may be longer than
|
838 |
|
|
@code{PATH_MAX} bytes. This pathname is NULL-terminated.
|
839 |
|
|
|
840 |
|
|
@item cfg_name
|
841 |
|
|
The nodename of the node.
|
842 |
|
|
|
843 |
|
|
@item cfg_pathlen
|
844 |
|
|
The length of the string pointed at by the @code{cfg_path}
|
845 |
|
|
field when returned by @code{cfg_read()}.
|
846 |
|
|
|
847 |
|
|
@item cfg_namelen
|
848 |
|
|
The length of the string pointed at by the @code{cfg_name}
|
849 |
|
|
field.
|
850 |
|
|
|
851 |
|
|
@item cfg_level
|
852 |
|
|
The depth of the current entry in the configuration space.
|
853 |
|
|
The @code{cfg_level} field of the @code{cfg_parent}
|
854 |
|
|
structure for each of the node(s) specified in the
|
855 |
|
|
@code{pathnames} argument to the @code{cfg_open()} function
|
856 |
|
|
is set to 0, and this number is incremented for each
|
857 |
|
|
node level descendant.
|
858 |
|
|
|
859 |
|
|
@item cfg_info
|
860 |
|
|
This field contains one of the values listed below. If
|
861 |
|
|
an object can have more than one info value, the first
|
862 |
|
|
appropriate value listed below is returned.
|
863 |
|
|
|
864 |
|
|
@table @b
|
865 |
|
|
|
866 |
|
|
@item CFG_D
|
867 |
|
|
The structure represents a node with children in
|
868 |
|
|
pre-order.
|
869 |
|
|
|
870 |
|
|
@item CFG_DC
|
871 |
|
|
The structure represents a node that is a parent
|
872 |
|
|
of the node most recently returned by @code{cfg_read()}.
|
873 |
|
|
The @code{cfg_cycle} field references the structure
|
874 |
|
|
previously returned by @code{cfg_read} that is the
|
875 |
|
|
same as the returned structure.
|
876 |
|
|
|
877 |
|
|
@item CFG_DEFAULT
|
878 |
|
|
The structure represents a node that is not
|
879 |
|
|
represented by one of the other node types
|
880 |
|
|
|
881 |
|
|
@item CFG_DNR
|
882 |
|
|
The structure represents a node, not of type symlink,
|
883 |
|
|
that is unreadable. The variable @code{cfg_errno}
|
884 |
|
|
is set to the appropriate value.
|
885 |
|
|
|
886 |
|
|
@item CFG_DP
|
887 |
|
|
The structure represents a node with children in
|
888 |
|
|
post-order. This value occurs only if CFG_D
|
889 |
|
|
has previously been returned for this entry.
|
890 |
|
|
|
891 |
|
|
@item CFG_ERR
|
892 |
|
|
The structure represents a node for which an error has
|
893 |
|
|
occurred. The variable @code{cfg_errno} is set to the
|
894 |
|
|
appropriate value.
|
895 |
|
|
|
896 |
|
|
@item CFG_F
|
897 |
|
|
The structure represents a node without children.
|
898 |
|
|
|
899 |
|
|
@item CFG_SL
|
900 |
|
|
The structure represents a node of type symbolic link.
|
901 |
|
|
|
902 |
|
|
@item CFG_SLNONET
|
903 |
|
|
The structure represents a node of type symbolic link
|
904 |
|
|
with a target node for which node characteristic
|
905 |
|
|
information cannot be obtained.
|
906 |
|
|
|
907 |
|
|
@end table
|
908 |
|
|
|
909 |
|
|
@end table
|
910 |
|
|
|
911 |
|
|
Structures returned by @code{cfg_read()} with a @code{cfg_info} field equal
|
912 |
|
|
to CFG_D is accessible until a subsequent call, on the same
|
913 |
|
|
configuration traversal stream, to @code{cfg_close()}, or to @code{cfg_read()}
|
914 |
|
|
after they have been returned by the @code{cfg_read} function in
|
915 |
|
|
post-order. Structures returned by @code{cfg_read()} with an
|
916 |
|
|
@code{cfg_info} field not equal to CFG_D is accessible until a subsequent
|
917 |
|
|
call, on the same configuration traversal stream, to @code{cfg_close()}
|
918 |
|
|
or @code{cfg_read()}.
|
919 |
|
|
|
920 |
|
|
The content of the @code{cfg_path} field is specified only for the
|
921 |
|
|
structure most recently returned by @code{cfg_read()}.
|
922 |
|
|
|
923 |
|
|
The specified fields in structures in the list representing nodes for
|
924 |
|
|
which structures have previously been returned by @code{cfg_children()},
|
925 |
|
|
is identical to those returned by @code{cfg_children()}, except that
|
926 |
|
|
the contents of the @code{cfg_path} and @code{cfg_pathlen} fields are
|
927 |
|
|
unspecified.
|
928 |
|
|
|
929 |
|
|
@subheading NOTES:
|
930 |
|
|
|
931 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
932 |
|
|
this service is available.
|
933 |
|
|
|
934 |
|
|
@page
|
935 |
|
|
@subsection cfg_children - Get Node Entries
|
936 |
|
|
|
937 |
|
|
@subheading CALLING SEQUENCE:
|
938 |
|
|
|
939 |
|
|
@ifset is-C
|
940 |
|
|
@example
|
941 |
|
|
#include
|
942 |
|
|
|
943 |
|
|
int cfg_children(
|
944 |
|
|
CFG *cfgp,
|
945 |
|
|
int options,
|
946 |
|
|
CFGENT **children
|
947 |
|
|
);
|
948 |
|
|
@end example
|
949 |
|
|
@end ifset
|
950 |
|
|
|
951 |
|
|
@ifset is-Ada
|
952 |
|
|
@end ifset
|
953 |
|
|
|
954 |
|
|
@subheading STATUS CODES:
|
955 |
|
|
|
956 |
|
|
A successful call to @code{cfg_children()} returns a value of zero
|
957 |
|
|
and an unsuccessful call returns the @code{errno}.
|
958 |
|
|
|
959 |
|
|
@table @b
|
960 |
|
|
@item EACCES
|
961 |
|
|
Search permission is denied for any component of a pathname
|
962 |
|
|
|
963 |
|
|
@item EBADF
|
964 |
|
|
The @code{cfgp} argument does not refer to an open configuration space.
|
965 |
|
|
|
966 |
|
|
@item ELOOP
|
967 |
|
|
A loop exists in symbolic links encountered during resolution of
|
968 |
|
|
a pathname.
|
969 |
|
|
|
970 |
|
|
@item ENAMETOOLONG
|
971 |
|
|
The length of a pathname exceeds @code{PATH_MAX}, or a pathname
|
972 |
|
|
component is longer than @code{NAME_MAX} while @code{_POSIX_NO_TRUNC} is
|
973 |
|
|
in effect.
|
974 |
|
|
|
975 |
|
|
@item EINVAL
|
976 |
|
|
The specified value of the @code{options} argument is invalid.
|
977 |
|
|
|
978 |
|
|
@item ENOENT
|
979 |
|
|
The named node does not exist.
|
980 |
|
|
|
981 |
|
|
@item ENOMEM
|
982 |
|
|
Not enough memory is available to create the necessary structures.
|
983 |
|
|
|
984 |
|
|
@end table
|
985 |
|
|
|
986 |
|
|
@subheading DESCRIPTION:
|
987 |
|
|
|
988 |
|
|
The first @code{cfg_children()} call after a @code{cfg_read()} returns
|
989 |
|
|
information about the first node without children under the node
|
990 |
|
|
returned by @code{cfg_read()}. Subsequent calls to @code{cfg_children()}
|
991 |
|
|
without the intervening @code{cfg_read()} shall return information
|
992 |
|
|
about the remaining nodes without children under that same node.
|
993 |
|
|
|
994 |
|
|
If @code{cfg_read()} has not yet been called for the configuration
|
995 |
|
|
traversal stream represented by @code{cfgp}, @code{cfg_children()}
|
996 |
|
|
returns a pointer to the first entry in a list of the nodes
|
997 |
|
|
represented by the @code{pathnames} argument to @code{cfg_open()}.
|
998 |
|
|
|
999 |
|
|
In either case, the list is NULL-terminated, ordered by the
|
1000 |
|
|
user-specified comparison function, if any, and linked through the
|
1001 |
|
|
@code{cfg_link} field.
|
1002 |
|
|
|
1003 |
|
|
@subheading NOTES:
|
1004 |
|
|
|
1005 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
1006 |
|
|
this service is available.
|
1007 |
|
|
|
1008 |
|
|
@page
|
1009 |
|
|
@subsection cfg_mark - Set Configuration Space Options
|
1010 |
|
|
|
1011 |
|
|
@subheading CALLING SEQUENCE:
|
1012 |
|
|
|
1013 |
|
|
@ifset is-C
|
1014 |
|
|
@example
|
1015 |
|
|
#include
|
1016 |
|
|
|
1017 |
|
|
int cfg_mark(
|
1018 |
|
|
CFG *cfgp,
|
1019 |
|
|
CFGENT *f,
|
1020 |
|
|
int options
|
1021 |
|
|
);
|
1022 |
|
|
@end example
|
1023 |
|
|
@end ifset
|
1024 |
|
|
|
1025 |
|
|
@ifset is-Ada
|
1026 |
|
|
@end ifset
|
1027 |
|
|
|
1028 |
|
|
@subheading STATUS CODES:
|
1029 |
|
|
|
1030 |
|
|
A successful call to @code{cfg_mark()} returns a value of zero
|
1031 |
|
|
and an unsuccessful call returns the @code{errno}.
|
1032 |
|
|
|
1033 |
|
|
@table @b
|
1034 |
|
|
@item EINVAL
|
1035 |
|
|
The specified combination of the @code{cfgp} and @code{f} arguments is not
|
1036 |
|
|
supported by the implementation.
|
1037 |
|
|
|
1038 |
|
|
@item EINVAL
|
1039 |
|
|
The specified value of the @code{options} argument is invalid.
|
1040 |
|
|
|
1041 |
|
|
@end table
|
1042 |
|
|
|
1043 |
|
|
@subheading DESCRIPTION:
|
1044 |
|
|
|
1045 |
|
|
The @code{cfg_mark()} function modifies the subsequent behavior of
|
1046 |
|
|
the @code{cfg} functions with regard to the node referenced by the structure
|
1047 |
|
|
pointed to by the argument @code{f} or the configuration space referenced
|
1048 |
|
|
by the structure pointed to by the argument @code{cfgp}.
|
1049 |
|
|
|
1050 |
|
|
Exactly one of the @code{f} argument and the @code{cfgp} argument is NULL.
|
1051 |
|
|
|
1052 |
|
|
The value of the @code{options} argument is exactly one of the flags
|
1053 |
|
|
specified in the following list:
|
1054 |
|
|
|
1055 |
|
|
@table @b
|
1056 |
|
|
|
1057 |
|
|
@item CFG_AGAIN
|
1058 |
|
|
If the @code{cfgp} argument is non-NULL, or the @code{f}
|
1059 |
|
|
argument is NULL, or the structure referenced by @code{f}
|
1060 |
|
|
is not the one most recently returned by @code{cfg_read()},
|
1061 |
|
|
@code{cfg_mark()} returns an error. Otherwise, the next
|
1062 |
|
|
call to the @code{cfg_read()} function returns the structure
|
1063 |
|
|
referenced by @code{f} with the @code{cfg_info} field
|
1064 |
|
|
reinitialized. Subsequent behavior of the @code{cfg}
|
1065 |
|
|
functions are based on the reinitialized value of
|
1066 |
|
|
@code{cfg_info}.
|
1067 |
|
|
|
1068 |
|
|
@item CFG_SKIP
|
1069 |
|
|
If the @code{cfgp} argument is non-NULL, or the @code{f}
|
1070 |
|
|
argument is NULL, or the structure referenced by @code{f}
|
1071 |
|
|
is not one of those specified as accessible, or the structure
|
1072 |
|
|
referenced by @code{f} is not for a node of type pre-order
|
1073 |
|
|
node, @code{cfg_mark()} returns an error. Otherwise, no
|
1074 |
|
|
more structures for the node referenced by @code{f} or its
|
1075 |
|
|
descendants are returned by the @code{cfg_read()} function.
|
1076 |
|
|
|
1077 |
|
|
@item CFG_FOLLOW
|
1078 |
|
|
If the @code{cfgp} argument is non-NULL, or the @code{f}
|
1079 |
|
|
argument is NULL, or the structure referenced by @code{f}
|
1080 |
|
|
is not one of those specified as accessible, or the structure
|
1081 |
|
|
referenced by @code{f} is not for a node of type symbolic link,
|
1082 |
|
|
@code{cfg_mark()} returns an error. Otherwise, the next
|
1083 |
|
|
call to the @code{cfg_read()} function returns the structure
|
1084 |
|
|
referenced by @code{f} with the @code{cfg_info} field reset
|
1085 |
|
|
to reflect the target of the symbolic link instead of the
|
1086 |
|
|
symbolic link itself. If the target of the link is node with
|
1087 |
|
|
children, the pre-order return, followed by the return of
|
1088 |
|
|
structures referencing all of its descendants, followed by a
|
1089 |
|
|
post-order return, shall be done.
|
1090 |
|
|
|
1091 |
|
|
@end table
|
1092 |
|
|
|
1093 |
|
|
If the target of the symbolic link does not exist, the fields
|
1094 |
|
|
of the structure by @code{cfg_read()} shall be unmodified, except
|
1095 |
|
|
that the @code{cfg_info} field shall be reset to @code{CFG_SLNONE}.
|
1096 |
|
|
|
1097 |
|
|
@subheading NOTES:
|
1098 |
|
|
|
1099 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
1100 |
|
|
this service is available.
|
1101 |
|
|
|
1102 |
|
|
@page
|
1103 |
|
|
@subsection cfg_close - Close a Configuration Space
|
1104 |
|
|
|
1105 |
|
|
@subheading CALLING SEQUENCE:
|
1106 |
|
|
|
1107 |
|
|
@ifset is-C
|
1108 |
|
|
@example
|
1109 |
|
|
#include
|
1110 |
|
|
|
1111 |
|
|
int cfg_close(
|
1112 |
|
|
CFG *cfgp
|
1113 |
|
|
);
|
1114 |
|
|
@end example
|
1115 |
|
|
@end ifset
|
1116 |
|
|
|
1117 |
|
|
@ifset is-Ada
|
1118 |
|
|
@end ifset
|
1119 |
|
|
|
1120 |
|
|
@subheading STATUS CODES:
|
1121 |
|
|
|
1122 |
|
|
A successful call to @code{cfg_close()} returns a value of zero
|
1123 |
|
|
and an unsuccessful call returns the @code{errno}.
|
1124 |
|
|
|
1125 |
|
|
@table @b
|
1126 |
|
|
@item EBADF
|
1127 |
|
|
The @code{cfgp} argument does not refer to an open configuration space
|
1128 |
|
|
traversal stream.
|
1129 |
|
|
|
1130 |
|
|
@end table
|
1131 |
|
|
|
1132 |
|
|
@subheading DESCRIPTION:
|
1133 |
|
|
|
1134 |
|
|
The @code{cfg_close()} function closes a configuration space transversal
|
1135 |
|
|
stream represented by the CFG structure pointed at by the @code{cfgp}
|
1136 |
|
|
argument. All system resources allocated for this configuration space
|
1137 |
|
|
traversal stream should be deallocated. Upon return, the value of
|
1138 |
|
|
@code{cfgp} need not point to an accessible object of type CFG.
|
1139 |
|
|
|
1140 |
|
|
@subheading NOTES:
|
1141 |
|
|
|
1142 |
|
|
The @code{_POSIX_CFG} feature flag is defined to indicate
|
1143 |
|
|
this service is available.
|
1144 |
|
|
|
1145 |
|
|
@page
|
1146 |
|
|
@subsection cfg_readdir - Reads a directory
|
1147 |
|
|
|
1148 |
|
|
@subheading CALLING SEQUENCE:
|
1149 |
|
|
|
1150 |
|
|
@ifset is-C
|
1151 |
|
|
@example
|
1152 |
|
|
#include
|
1153 |
|
|
#include
|
1154 |
|
|
|
1155 |
|
|
struct dirent *cfg_readdir(
|
1156 |
|
|
DIR *dirp
|
1157 |
|
|
);
|
1158 |
|
|
@end example
|
1159 |
|
|
@end ifset
|
1160 |
|
|
|
1161 |
|
|
@ifset is-Ada
|
1162 |
|
|
@end ifset
|
1163 |
|
|
|
1164 |
|
|
@subheading STATUS CODES:
|
1165 |
|
|
|
1166 |
|
|
@table @b
|
1167 |
|
|
@item EBADF
|
1168 |
|
|
Invalid file descriptor
|
1169 |
|
|
|
1170 |
|
|
@end table
|
1171 |
|
|
|
1172 |
|
|
@subheading DESCRIPTION:
|
1173 |
|
|
|
1174 |
|
|
The @code{cfg_readdir()} function returns a pointer to a structure @code{dirent}
|
1175 |
|
|
representing the next directory entry from the directory stream pointed to
|
1176 |
|
|
by @code{dirp}. On end-of-file, NULL is returned.
|
1177 |
|
|
|
1178 |
|
|
The @code{cfg_readdir()} function may (or may not) return entries for . or .. Your
|
1179 |
|
|
program should tolerate reading dot and dot-dot but not require them.
|
1180 |
|
|
|
1181 |
|
|
The data pointed to be @code{cfg_readdir()} may be overwritten by another call to
|
1182 |
|
|
@code{readdir()} for the same directory stream. It will not be overwritten by
|
1183 |
|
|
a call for another directory.
|
1184 |
|
|
|
1185 |
|
|
@subheading NOTES:
|
1186 |
|
|
|
1187 |
|
|
If @code{ptr} is not a pointer returned by @code{malloc()}, @code{calloc()}, or
|
1188 |
|
|
@code{realloc()} or has been deallocated with @code{free()} or @code{realloc()},
|
1189 |
|
|
the results are not portable and are probably disastrous.
|
1190 |
|
|
|
1191 |
|
|
This function is not defined in the POSIX specification. It is an extension
|
1192 |
|
|
provided by this implementation.
|
1193 |
|
|
|
1194 |
|
|
@page
|
1195 |
|
|
@subsection cfg_umask - Sets a file creation mask.
|
1196 |
|
|
|
1197 |
|
|
@subheading CALLING SEQUENCE:
|
1198 |
|
|
|
1199 |
|
|
@ifset is-C
|
1200 |
|
|
@example
|
1201 |
|
|
#include
|
1202 |
|
|
#include
|
1203 |
|
|
|
1204 |
|
|
mode_t cfg_umask(
|
1205 |
|
|
mode_t cmask
|
1206 |
|
|
);
|
1207 |
|
|
@end example
|
1208 |
|
|
@end ifset
|
1209 |
|
|
|
1210 |
|
|
@ifset is-Ada
|
1211 |
|
|
@end ifset
|
1212 |
|
|
|
1213 |
|
|
@subheading STATUS CODES:
|
1214 |
|
|
|
1215 |
|
|
@subheading DESCRIPTION:
|
1216 |
|
|
|
1217 |
|
|
The @code{cfg_umask()} function sets the process node creation mask to @code{cmask}.
|
1218 |
|
|
The file creation mask is used during @code{open()}, @code{creat()}, @code{mkdir()},
|
1219 |
|
|
@code{mkfifo()} calls to turn off permission bits in the @code{mode} argument.
|
1220 |
|
|
Bit positions that are set in @code{cmask} are cleared in the mode of the
|
1221 |
|
|
created file.
|
1222 |
|
|
|
1223 |
|
|
The file creation mask is inherited across @code{fork()} and @code{exec()} calls.
|
1224 |
|
|
This makes it possible to alter the default permission bits of created files.
|
1225 |
|
|
|
1226 |
|
|
@subheading NOTES: None
|
1227 |
|
|
|
1228 |
|
|
The @code{cmask} argument should have only permission bits set. All other
|
1229 |
|
|
bits should be zero.
|
1230 |
|
|
|
1231 |
|
|
@page
|
1232 |
|
|
@subsection cfg_chmod - Changes file mode.
|
1233 |
|
|
|
1234 |
|
|
@subheading CALLING SEQUENCE:
|
1235 |
|
|
|
1236 |
|
|
@ifset is-C
|
1237 |
|
|
@example
|
1238 |
|
|
#include
|
1239 |
|
|
#include
|
1240 |
|
|
|
1241 |
|
|
int cfg_chmod(
|
1242 |
|
|
const char *path,
|
1243 |
|
|
mode_t mode
|
1244 |
|
|
);
|
1245 |
|
|
@end example
|
1246 |
|
|
@end ifset
|
1247 |
|
|
|
1248 |
|
|
@ifset is-Ada
|
1249 |
|
|
@end ifset
|
1250 |
|
|
|
1251 |
|
|
@subheading STATUS CODES:
|
1252 |
|
|
|
1253 |
|
|
A successful call to @code{cfg_chmod()} returns a value of zero
|
1254 |
|
|
and an unsuccessful call returns the @code{errno}.
|
1255 |
|
|
|
1256 |
|
|
@table @b
|
1257 |
|
|
@item EACCES
|
1258 |
|
|
Search permission is denied for a directory in a file's path prefix
|
1259 |
|
|
@item ENAMETOOLONG
|
1260 |
|
|
Length of a filename string exceeds PATH_MAX and _POSIX_NO_TRUNC is in
|
1261 |
|
|
effect.
|
1262 |
|
|
@item ENOENT
|
1263 |
|
|
A file or directory does not exist.
|
1264 |
|
|
@item ENOTDIR
|
1265 |
|
|
A component of the specified pathname was not a directory when a directory
|
1266 |
|
|
was expected.
|
1267 |
|
|
@item EPERM
|
1268 |
|
|
Operation is not permitted. Process does not have the appropriate priviledges
|
1269 |
|
|
or permissions to perform the requested operations.
|
1270 |
|
|
@item EROFS
|
1271 |
|
|
Read-only file system.
|
1272 |
|
|
|
1273 |
|
|
@end table
|
1274 |
|
|
|
1275 |
|
|
@subheading DESCRIPTION:
|
1276 |
|
|
|
1277 |
|
|
Set the file permission bits, the set user ID bit, and the set group ID bit
|
1278 |
|
|
for the file named by @code{path} to @code{mode}. If the effective user ID
|
1279 |
|
|
does not match the owner of the node and the calling process does not have
|
1280 |
|
|
the appropriate privileges, @code{cfg_chmod()} returns -1 and sets @code{errno} to
|
1281 |
|
|
@code{EPERM}.
|
1282 |
|
|
|
1283 |
|
|
@subheading NOTES:
|
1284 |
|
|
|
1285 |
|
|
@page
|
1286 |
|
|
@subsection cfg_chown - Changes the owner and/or group of a file.
|
1287 |
|
|
|
1288 |
|
|
@subheading CALLING SEQUENCE:
|
1289 |
|
|
|
1290 |
|
|
@ifset is-C
|
1291 |
|
|
@example
|
1292 |
|
|
#include
|
1293 |
|
|
#include
|
1294 |
|
|
|
1295 |
|
|
int cfg_chown(
|
1296 |
|
|
const char *path,
|
1297 |
|
|
uid_t owner,
|
1298 |
|
|
gid_t group
|
1299 |
|
|
);
|
1300 |
|
|
@end example
|
1301 |
|
|
@end ifset
|
1302 |
|
|
|
1303 |
|
|
@ifset is-Ada
|
1304 |
|
|
@end ifset
|
1305 |
|
|
|
1306 |
|
|
@subheading STATUS CODES:
|
1307 |
|
|
|
1308 |
|
|
A successful call to @code{cfg_chown()} returns a value of zero
|
1309 |
|
|
and an unsuccessful call returns the @code{errno}.
|
1310 |
|
|
|
1311 |
|
|
@table @b
|
1312 |
|
|
@item EACCES
|
1313 |
|
|
Search permission is denied for a directory in a file's path prefix
|
1314 |
|
|
@item EINVAL
|
1315 |
|
|
Invalid argument
|
1316 |
|
|
@item ENAMETOOLONG
|
1317 |
|
|
Length of a filename string exceeds PATH_MAX and _POSIX_NO_TRUNC is in
|
1318 |
|
|
effect.
|
1319 |
|
|
@item ENOENT
|
1320 |
|
|
A file or directory does not exist.
|
1321 |
|
|
@item ENOTDIR
|
1322 |
|
|
A component of the specified pathname was not a directory when a directory
|
1323 |
|
|
was expected.
|
1324 |
|
|
@item EPERM
|
1325 |
|
|
Operation is not permitted. Process does not have the appropriate priviledges
|
1326 |
|
|
or permissions to perform the requested operations.
|
1327 |
|
|
@item EROFS
|
1328 |
|
|
Read-only file system.
|
1329 |
|
|
|
1330 |
|
|
@end table
|
1331 |
|
|
|
1332 |
|
|
@subheading DESCRIPTION:
|
1333 |
|
|
|
1334 |
|
|
The user ID and group ID of the file named by @code{path} are set to
|
1335 |
|
|
@code{owner} and @code{path}, respectively.
|
1336 |
|
|
|
1337 |
|
|
For regular files, the set group ID (S_ISGID) and set user ID (S_ISUID)
|
1338 |
|
|
bits are cleared.
|
1339 |
|
|
|
1340 |
|
|
Some systems consider it a security violation to allow the owner of a file to
|
1341 |
|
|
be changed, If users are billed for disk space usage, loaning a file to
|
1342 |
|
|
another user could result in incorrect billing. The @code{cfg_chown()} function
|
1343 |
|
|
may be restricted to privileged users for some or all files. The group ID can
|
1344 |
|
|
still be changed to one of the supplementary group IDs.
|
1345 |
|
|
|
1346 |
|
|
@subheading NOTES:
|
1347 |
|
|
|
1348 |
|
|
This function may be restricted for some file. The @code{pathconf} function
|
1349 |
|
|
can be used to test the _PC_CHOWN_RESTRICTED flag.
|
1350 |
|
|
|
1351 |
|
|
|