1 | @c |
---|
2 | @c COPYRIGHT (c) 1988-1998. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
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_close} - Close a Configuration Space |
---|
34 | @end itemize |
---|
35 | |
---|
36 | @section Background |
---|
37 | |
---|
38 | @subsection Configuration Nodes |
---|
39 | |
---|
40 | @subsection Configuration Space |
---|
41 | |
---|
42 | @section Operations |
---|
43 | |
---|
44 | @subsection Mount and Unmounting |
---|
45 | |
---|
46 | @subsection Creating a Configuration Node |
---|
47 | |
---|
48 | @subsection Removing a Configuration Node |
---|
49 | |
---|
50 | @subsection Manipulating a Configuration Node |
---|
51 | |
---|
52 | @subsection Traversing a Configuration Space |
---|
53 | |
---|
54 | @section Directives |
---|
55 | |
---|
56 | This section details the configuration space manager's directives. |
---|
57 | A subsection is dedicated to each of this manager's directives |
---|
58 | and describes the calling sequence, related constants, usage, |
---|
59 | and status codes. |
---|
60 | |
---|
61 | @page |
---|
62 | @subsection cfg_mount - Mount a Configuration Space |
---|
63 | |
---|
64 | @subheading CALLING SEQUENCE: |
---|
65 | |
---|
66 | @ifset is-C |
---|
67 | @example |
---|
68 | int cfg_mount( |
---|
69 | const char *file, |
---|
70 | const char *cfgpath, |
---|
71 | log_facility_t notification, |
---|
72 | ); |
---|
73 | @end example |
---|
74 | @end ifset |
---|
75 | |
---|
76 | @ifset is-Ada |
---|
77 | @end ifset |
---|
78 | |
---|
79 | @subheading STATUS CODES: |
---|
80 | |
---|
81 | @table @b |
---|
82 | @item EPERM |
---|
83 | The caller does not have the appropriate privilege. |
---|
84 | |
---|
85 | @item EACCES |
---|
86 | Search permission is denied for a component of the path prefix. |
---|
87 | |
---|
88 | @item EEXIST |
---|
89 | The file specified by the file argument does not exist |
---|
90 | |
---|
91 | @item ENAMETOOLONG |
---|
92 | A component of a pathname exceeded @code{NAME_MAX} characters, |
---|
93 | or an entire path name exceed @code{PATH_MAX} characters while |
---|
94 | @code{_POSIX_NO_TRUNC} is in effect. |
---|
95 | |
---|
96 | @item ENOENT |
---|
97 | A component of cfgpath does not exist. |
---|
98 | |
---|
99 | @item ENOTDIR |
---|
100 | A component of the file path prefix is not a directory. |
---|
101 | |
---|
102 | @item EBUSY |
---|
103 | The configuration space defined by file is already mounted. |
---|
104 | |
---|
105 | @item EINVAL |
---|
106 | The notification argument specifies an invalid log facility. |
---|
107 | |
---|
108 | @end table |
---|
109 | |
---|
110 | @subheading DESCRIPTION: |
---|
111 | |
---|
112 | The @code{cfg_mount} function maps a configuration space defined |
---|
113 | by the file identified by the the @code{file} argument. The |
---|
114 | distinguished node of the mapped configuration space shall be |
---|
115 | mounted in the active space at the point identified by the |
---|
116 | @code{cfgpath} configuration pathname. |
---|
117 | |
---|
118 | The @code{notification} argument specifies how changes to the |
---|
119 | mapped configuration space shall be communicated to the application. |
---|
120 | If the @code{notification} argument is NULL, no notification shall |
---|
121 | be performed for the mapped configuration space. If the Event |
---|
122 | Logging option is defined, the notification argument defines the |
---|
123 | facility to which changes in the mapped configuration space shall |
---|
124 | be logged. Otherwise, the @code{notification} argument shall |
---|
125 | specify an implementation defined method of notifying the application |
---|
126 | of changes to the mapped configuration space. |
---|
127 | |
---|
128 | @subheading NOTES: |
---|
129 | |
---|
130 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
131 | this service is available. |
---|
132 | |
---|
133 | @page |
---|
134 | @subsection cfg_unmount - Unmount a Configuration Space |
---|
135 | |
---|
136 | @subheading CALLING SEQUENCE: |
---|
137 | |
---|
138 | @ifset is-C |
---|
139 | @example |
---|
140 | int cfg_unmount( |
---|
141 | const char *cfgpath |
---|
142 | ); |
---|
143 | @end example |
---|
144 | @end ifset |
---|
145 | |
---|
146 | @ifset is-Ada |
---|
147 | @end ifset |
---|
148 | |
---|
149 | @subheading STATUS CODES: |
---|
150 | |
---|
151 | @table @b |
---|
152 | @item EPERM |
---|
153 | The caller does not have the appropriate privileges. |
---|
154 | |
---|
155 | @item EACCES |
---|
156 | Search permission is denied for a component of the path prefix. |
---|
157 | |
---|
158 | @item ENOENT |
---|
159 | A component of cfgpath does not exist. |
---|
160 | |
---|
161 | @item ENAMETOOLONG |
---|
162 | A component of a pathname exceeded @code{NAME_MAX} characters, |
---|
163 | or an entire path name exceed @code{PATH_MAX} characters while |
---|
164 | @code{_POSIX_NO_TRUNC} is in effect. |
---|
165 | |
---|
166 | @item EINVAL |
---|
167 | The requested node is not the distinguished node of a mounted |
---|
168 | configuration space. |
---|
169 | |
---|
170 | @item EBUSY |
---|
171 | One or more processes has an open configuration traversal |
---|
172 | stream for the configuration space whose distinguished node is |
---|
173 | referenced by the cfgpath argument. |
---|
174 | |
---|
175 | @item ELOOP |
---|
176 | A node appears more than once in the path specified by the |
---|
177 | cfg_path argument |
---|
178 | |
---|
179 | @item ELOOP |
---|
180 | More than @code{SYMLOOP_MAX} symbolic links were encountered during |
---|
181 | resolution of the cfgpath argument |
---|
182 | |
---|
183 | @end table |
---|
184 | |
---|
185 | @subheading DESCRIPTION: |
---|
186 | |
---|
187 | The @code{cfg_umount} function unmaps the configuration space whose |
---|
188 | distinguished node is mapped in the active space at the location defined |
---|
189 | by @code{cfgpath} configuration pathname. All system resources |
---|
190 | allocated for this configuration space should be deallocated. |
---|
191 | |
---|
192 | @subheading NOTES: |
---|
193 | |
---|
194 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
195 | this service is available. |
---|
196 | |
---|
197 | @page |
---|
198 | @subsection cfg_mknod - Create a Configuration Node |
---|
199 | |
---|
200 | @subheading CALLING SEQUENCE: |
---|
201 | |
---|
202 | @ifset is-C |
---|
203 | @example |
---|
204 | int cfg_mknod( |
---|
205 | const char *cfgpath, |
---|
206 | mode_t mode, |
---|
207 | cfg_type_t type |
---|
208 | ); |
---|
209 | @end example |
---|
210 | @end ifset |
---|
211 | |
---|
212 | @ifset is-Ada |
---|
213 | @end ifset |
---|
214 | |
---|
215 | @subheading STATUS CODES: |
---|
216 | |
---|
217 | @table @b |
---|
218 | @item ENAMETOOLONG |
---|
219 | A component of a pathname exceeded @code{NAME_MAX} characters, |
---|
220 | or an entire path name exceed @code{PATH_MAX} characters while |
---|
221 | @code{_POSIX_NO_TRUNC} is in effect. |
---|
222 | |
---|
223 | @item ENOENT |
---|
224 | A component of the path prefix does not exist. |
---|
225 | |
---|
226 | @item EACCES |
---|
227 | Search permission is denied for a component of the path prefix. |
---|
228 | |
---|
229 | @item ELOOP |
---|
230 | Too many symbolic links were encountered in translating the |
---|
231 | pathname. |
---|
232 | |
---|
233 | @item EPERM |
---|
234 | The calling process does not have the appropriate privilege. |
---|
235 | |
---|
236 | @item EEXIST |
---|
237 | The named node exists. |
---|
238 | |
---|
239 | @item EINVAL |
---|
240 | The value of mode is invalid. |
---|
241 | |
---|
242 | @item EINVAL |
---|
243 | The value of type is invalid. |
---|
244 | |
---|
245 | @item ELOOP |
---|
246 | A node appears more than once in the path specified by the |
---|
247 | cfg_path argument |
---|
248 | |
---|
249 | @item ELOOP |
---|
250 | More than @code{SYMLOOP_MAX} symbolic links were encountered during |
---|
251 | resolution of the cfgpath argument. |
---|
252 | |
---|
253 | @item EROFS |
---|
254 | The named node resides on a read-only configuration space. |
---|
255 | |
---|
256 | @end table |
---|
257 | |
---|
258 | @subheading DESCRIPTION: |
---|
259 | |
---|
260 | The @code{cfg_mknod} function creates a new node in the configuration |
---|
261 | space which contains the pathname prefix of @code{cfgpath}. T he node |
---|
262 | name shall be defined by the pathname suffix of @code{cfgpath}. The |
---|
263 | node name shall be defined by the pathname suffix of @code{cfgpath}. |
---|
264 | The node permissions shall be specified by the value of @code{mode}. |
---|
265 | The node type shall be specified by the value of @code{type}. |
---|
266 | |
---|
267 | @subheading NOTES: |
---|
268 | |
---|
269 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
270 | this service is available. |
---|
271 | |
---|
272 | @page |
---|
273 | @subsection cfg_get - Get Configuration Node Value |
---|
274 | |
---|
275 | @subheading CALLING SEQUENCE: |
---|
276 | |
---|
277 | @ifset is-C |
---|
278 | @example |
---|
279 | int cfg_get( |
---|
280 | const char *cfgpath |
---|
281 | cfg_value_t *value |
---|
282 | ); |
---|
283 | @end example |
---|
284 | @end ifset |
---|
285 | |
---|
286 | @ifset is-Ada |
---|
287 | @end ifset |
---|
288 | |
---|
289 | @subheading STATUS CODES: |
---|
290 | |
---|
291 | @table @b |
---|
292 | @item ENAMETOOLONG |
---|
293 | A component of a pathname exceeded @code{NAME_MAX} characters, |
---|
294 | or an entire path name exceed @code{PATH_MAX} characters while |
---|
295 | @code{_POSIX_NO_TRUNC} is in effect. |
---|
296 | |
---|
297 | @item ENOENT |
---|
298 | A component of cfgpath does not exist. |
---|
299 | |
---|
300 | @item EACCES |
---|
301 | Search permission is denied for a component of the path prefix. |
---|
302 | |
---|
303 | @item EPERM |
---|
304 | The calling process does not have the appropriate privileges. |
---|
305 | |
---|
306 | @item ELOOP |
---|
307 | A node appears more than once in the path specified by the |
---|
308 | cfg_path argument |
---|
309 | |
---|
310 | @item ELOOP |
---|
311 | More than @code{SYMLOOP_MAX} symbolic links were encountered during |
---|
312 | resolution of the cfgpath argument. |
---|
313 | |
---|
314 | @end table |
---|
315 | |
---|
316 | @subheading DESCRIPTION: |
---|
317 | |
---|
318 | The @code{cfg_get} function stores the value attribute of the |
---|
319 | configuration node identified by @code{cfgpath}, into the buffer |
---|
320 | described by the @code{value} pointer. |
---|
321 | |
---|
322 | @subheading NOTES: |
---|
323 | |
---|
324 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
325 | this service is available. |
---|
326 | |
---|
327 | @page |
---|
328 | @subsection cfg_set - Set Configuration Node Value |
---|
329 | |
---|
330 | @subheading CALLING SEQUENCE: |
---|
331 | |
---|
332 | @ifset is-C |
---|
333 | @example |
---|
334 | int cfg_set( |
---|
335 | const char *cfgpath |
---|
336 | cfg_value_t *value |
---|
337 | ); |
---|
338 | @end example |
---|
339 | @end ifset |
---|
340 | |
---|
341 | @ifset is-Ada |
---|
342 | @end ifset |
---|
343 | |
---|
344 | @subheading STATUS CODES: |
---|
345 | |
---|
346 | @table @b |
---|
347 | @item ENAMETOOLONG |
---|
348 | A component of a pathname exceeded @code{NAME_MAX} characters, |
---|
349 | or an entire path name exceed @code{PATH_MAX} characters while |
---|
350 | @code{_POSIX_NO_TRUNC} is in effect. |
---|
351 | |
---|
352 | @item ENOENT |
---|
353 | A component of cfgpath does not exist |
---|
354 | |
---|
355 | @item EACCES |
---|
356 | Search permission is denied for a component of the path prefix. |
---|
357 | |
---|
358 | @item EPERM |
---|
359 | The calling process does not have the appropriate privilege. |
---|
360 | |
---|
361 | @item ELOOP |
---|
362 | A node appears more than once in the path specified by the |
---|
363 | cfg-path argument. |
---|
364 | |
---|
365 | @item ELOOP |
---|
366 | More than @code{SYMLOOP_MAX} symbolic links were encountered during |
---|
367 | resolution of the cfgpath argument. |
---|
368 | |
---|
369 | @end table |
---|
370 | |
---|
371 | @subheading DESCRIPTION: |
---|
372 | |
---|
373 | The @code{cfg_set} function stores the value specified by the |
---|
374 | @code{value} argument in the configuration node defined by the |
---|
375 | @code{cfgpath} argument. |
---|
376 | |
---|
377 | @subheading NOTES: |
---|
378 | |
---|
379 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
380 | this service is available. |
---|
381 | |
---|
382 | @page |
---|
383 | @subsection cfg_link - Create a Configuration Link |
---|
384 | |
---|
385 | @subheading CALLING SEQUENCE: |
---|
386 | |
---|
387 | @ifset is-C |
---|
388 | @example |
---|
389 | int cfg_link( |
---|
390 | const char *src |
---|
391 | const char *dest |
---|
392 | ); |
---|
393 | @end example |
---|
394 | @end ifset |
---|
395 | |
---|
396 | @ifset is-Ada |
---|
397 | @end ifset |
---|
398 | |
---|
399 | @subheading STATUS CODES: |
---|
400 | |
---|
401 | @table @b |
---|
402 | @item ENAMETOOLONG |
---|
403 | A component of a pathname exceeded @code{NAME_MAX} characters, |
---|
404 | or an entire path name exceed @code{PATH_MAX} characters while |
---|
405 | @code{_POSIX_NO_TRUNC} is in effect. |
---|
406 | |
---|
407 | @item ENOENT |
---|
408 | A component of either path prefix does not exist. |
---|
409 | |
---|
410 | @item EACCES |
---|
411 | A component of either path prefix denies search permission. |
---|
412 | |
---|
413 | @item EACCES |
---|
414 | The requested link requires writing in a node with a mode that |
---|
415 | denies write permission. |
---|
416 | |
---|
417 | @item ENOENT |
---|
418 | The node named by src does not exist. |
---|
419 | |
---|
420 | @item EEXIST |
---|
421 | The node named by dest does exist. |
---|
422 | |
---|
423 | @item EPERM |
---|
424 | The calling process does not have the appropriate privilege to |
---|
425 | modify the node indicated by the src argument. |
---|
426 | |
---|
427 | @item EXDEV |
---|
428 | The link named by dest and the node named by src are from different |
---|
429 | configuration spaces. |
---|
430 | |
---|
431 | @item ENOSPC |
---|
432 | The node in which the entry for the new link is being placed |
---|
433 | cannot be extended because there is no space left on the |
---|
434 | configuration space containing the node. |
---|
435 | |
---|
436 | @item EIO |
---|
437 | An I/O error occurred while reading from or writing to the |
---|
438 | configuration space to make the link entry. |
---|
439 | |
---|
440 | @item EROFS |
---|
441 | The requested link requires writing in a node on a read-only |
---|
442 | configuration space. |
---|
443 | |
---|
444 | @item ELOOP |
---|
445 | A node appears more than once in the path specified by the |
---|
446 | cfg-path argument. |
---|
447 | |
---|
448 | @item ELOOP |
---|
449 | More than @code{SYMLOOP_MAX} symbolic links were encountered during |
---|
450 | resolution of the cfgpath argument. |
---|
451 | |
---|
452 | @end table |
---|
453 | |
---|
454 | @subheading DESCRIPTION: |
---|
455 | |
---|
456 | The @code{src} and @code{dest}arguments point to pathnames which |
---|
457 | name existing nodes. The @code{cfg_link} function shall atomically |
---|
458 | create a link between specified nodes, and increment by one the link |
---|
459 | count of the node specified by the @code{src} argument. |
---|
460 | |
---|
461 | If the @code{cfg_link} function fails, no link shall be created, and |
---|
462 | the link count of the node shall remain unchanged by this function |
---|
463 | call. |
---|
464 | |
---|
465 | This implementation may require that the calling process has permission |
---|
466 | to access the specified nodes. |
---|
467 | |
---|
468 | @subheading NOTES: |
---|
469 | |
---|
470 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
471 | this service is available. |
---|
472 | |
---|
473 | @page |
---|
474 | @subsection cfg_unlink - Remove a Configuration Link |
---|
475 | |
---|
476 | @subheading CALLING SEQUENCE: |
---|
477 | |
---|
478 | @ifset is-C |
---|
479 | @example |
---|
480 | int cfg_unlink( |
---|
481 | const char *cfgpath |
---|
482 | ); |
---|
483 | @end example |
---|
484 | @end ifset |
---|
485 | |
---|
486 | @ifset is-Ada |
---|
487 | @end ifset |
---|
488 | |
---|
489 | @subheading STATUS CODES: |
---|
490 | |
---|
491 | @table @b |
---|
492 | @item ENAMETOOLONG |
---|
493 | A component of a pathname exceeded @code{NAME_MAX} characters, |
---|
494 | or an entire path name exceed @code{PATH_MAX} characters. |
---|
495 | |
---|
496 | @item ENOENT |
---|
497 | The named node does not exist. |
---|
498 | |
---|
499 | @item EACCES |
---|
500 | Search permission is denied on the node containing the link to |
---|
501 | be removed. |
---|
502 | |
---|
503 | @item EACCES |
---|
504 | Write permission is denied on the node containing the link to |
---|
505 | be removed. |
---|
506 | |
---|
507 | @item ENOENT |
---|
508 | A component of cfgpath does not exist. |
---|
509 | |
---|
510 | @item EPERM |
---|
511 | The calling process does not have the appropriate privilege to |
---|
512 | modify the node indicated by the path prefix of the cfgpath |
---|
513 | argument. |
---|
514 | |
---|
515 | @item EBUSY |
---|
516 | The node to be unlinked is the distinguished node of a mounted |
---|
517 | configuration space. |
---|
518 | |
---|
519 | @item EIO |
---|
520 | An I/O error occurred while deleting the link entry or deallocating |
---|
521 | the node. |
---|
522 | |
---|
523 | @item EROFS |
---|
524 | The named node resides in a read-only configuration space. |
---|
525 | |
---|
526 | @item ELOOP |
---|
527 | A node appears more than once in the path specified by the |
---|
528 | cfg-path argument. |
---|
529 | |
---|
530 | @item ELOOP |
---|
531 | More than @code{SYMLOOP_MAX} symbolic links were encountered during |
---|
532 | resolution of the cfgpath argument. |
---|
533 | |
---|
534 | @end table |
---|
535 | |
---|
536 | @subheading DESCRIPTION: |
---|
537 | |
---|
538 | The @code{cfg_unlink} function removes the link between the node |
---|
539 | specified by the @code{cfgpath} path prefix and the parent node |
---|
540 | specified by @code{cfgpath}, and shall decrement the link count |
---|
541 | of the @code{cfgpath} node. |
---|
542 | |
---|
543 | When the link count of the node becomes zero, the space occupied |
---|
544 | by the node shall be freed and the node shall no longer be accessible. |
---|
545 | |
---|
546 | @subheading NOTES: |
---|
547 | |
---|
548 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
549 | this service is available. |
---|
550 | |
---|
551 | @page |
---|
552 | @subsection cfg_open - Open a Configuration Space |
---|
553 | |
---|
554 | @subheading CALLING SEQUENCE: |
---|
555 | |
---|
556 | @ifset is-C |
---|
557 | @example |
---|
558 | int cfg_open( |
---|
559 | const char *pathnames[], |
---|
560 | int options, |
---|
561 | int (*compar)(const CFGENT **f1, const CFGENT **f2), |
---|
562 | CFG **cfgstream |
---|
563 | ); |
---|
564 | @end example |
---|
565 | @end ifset |
---|
566 | |
---|
567 | @ifset is-Ada |
---|
568 | @end ifset |
---|
569 | |
---|
570 | @subheading STATUS CODES: |
---|
571 | |
---|
572 | @table @b |
---|
573 | @item EACCES |
---|
574 | Search permission is denied for any component of a pathname. |
---|
575 | |
---|
576 | @item ELOOP |
---|
577 | A loop exists in symbolic links encountered during resolution |
---|
578 | of a pathname. |
---|
579 | |
---|
580 | @item ENAMETOOLONG |
---|
581 | The length of a pathname exceeds @code{PATH_MAX}, or a pathname |
---|
582 | component is longer than @code{NAME_MAX} while @code{_POSIX_NO_TRUNC} |
---|
583 | |
---|
584 | @item ENOENT |
---|
585 | The pathname argument is an empty string or the named node |
---|
586 | does not exist. |
---|
587 | |
---|
588 | @item EINVAL |
---|
589 | Either both or neither of CFG_LOGICAL and CFG_PHYSICAL are |
---|
590 | specified by the options argument ??????????? |
---|
591 | |
---|
592 | @item ENOMEM |
---|
593 | Not enough memory is available to create the necessary structures. |
---|
594 | |
---|
595 | @item ELOOP |
---|
596 | More than @code{SYMLOOP_MAX} symbolic links were encountered during |
---|
597 | resolution of the pathnames argument. |
---|
598 | |
---|
599 | @item ENAMETOOLONG |
---|
600 | As a result of encountering a symbolic link in resolution of the |
---|
601 | pathname specified by the pathnames argument, the length of |
---|
602 | the substituted pathname string exceeded @code{PATH_MAX}. |
---|
603 | |
---|
604 | @end table |
---|
605 | |
---|
606 | @subheading DESCRIPTION: |
---|
607 | |
---|
608 | The @code{cfg_open} function shall open a configuration traversal stream |
---|
609 | rooted in the configuration nodes name by the @code{pathnames} argument. |
---|
610 | It shall store a pointer to a CFG object that represents that stream at |
---|
611 | the location identified the @code{cfgstream} pointer. The @code{pathnames} |
---|
612 | argument is an array of character pointers to NULL-terminated strings. |
---|
613 | The last member of this array shall be a NULL pointer. |
---|
614 | |
---|
615 | The value of @code{options} is the bitwise inclusive OR of values from the |
---|
616 | following lists. Applications shall supply exactly one of the first two |
---|
617 | values below in @code{options}. |
---|
618 | |
---|
619 | @table @b |
---|
620 | |
---|
621 | @item CFG_LOGICAL |
---|
622 | When symbolic links referencing existing nodes are |
---|
623 | encountered during the traversal, the @code{cfg_info} |
---|
624 | field of the returned CFGENT structure shall describe |
---|
625 | the target node pointed to by the link instead of the |
---|
626 | link itself, unless the target node does not exist. |
---|
627 | If the target node has children, the pre-order return, |
---|
628 | followed by the return of structures referencing all of |
---|
629 | its descendants, followed by a post-order return, shall |
---|
630 | be done. |
---|
631 | |
---|
632 | @item CFG_PHYSICAL |
---|
633 | When symbolic links are encountered during the traversal, |
---|
634 | the @code{cfg_info} field shall describe the symbolic |
---|
635 | link. |
---|
636 | |
---|
637 | @end table |
---|
638 | |
---|
639 | |
---|
640 | Any combination of the remaining flags can be specified in the value of |
---|
641 | @code{options} |
---|
642 | |
---|
643 | @table @b |
---|
644 | |
---|
645 | @item CFG_COMFOLLOW |
---|
646 | When symbolic links referencing existing nodes are |
---|
647 | specified in the @code{pathnames} argument, the |
---|
648 | @code{cfg_info} field of the returned CFGENT structure |
---|
649 | shall describe the target node pointed to by the link |
---|
650 | instead of the link itself, unless the target node does |
---|
651 | not exist. If the target node has children, the |
---|
652 | pre-order return, followed by the return of structures |
---|
653 | referencing all its descendants, followed by a post-order |
---|
654 | return, shall be done. |
---|
655 | |
---|
656 | @item CFG_XDEV |
---|
657 | The configuration space functions shall not return a |
---|
658 | CFGENT structure for any node in a different configuration |
---|
659 | space than the configuration space of the nodes identified |
---|
660 | by the CFGENT structures for the @code{pathnames} argument. |
---|
661 | |
---|
662 | @end table |
---|
663 | |
---|
664 | The @code{cfg_open} argument @code{compar} shall either be NULL or point |
---|
665 | to a function that shall be called with two pointers to pointers to CFGENT |
---|
666 | structures that shall return less than, equal to , or greater than zero if |
---|
667 | the node referenced by the first argument is considered to be respectively |
---|
668 | less than, equal to, or greater than the node referenced by the second. |
---|
669 | The CFGENT structure fields provided to the comparison routine shall be as |
---|
670 | described with the exception that the contents of the @code{cfg_path} and |
---|
671 | @code{cfg_pathlen} fields are unspecified. |
---|
672 | |
---|
673 | This comparison routine is used to determine the order in which nodes in |
---|
674 | directories encountered during the traversal are returned, and the order |
---|
675 | of traversal when more than one node is specified in the @code{pathnames} |
---|
676 | argument to @code{cfg_open}. If a comparison routine is specified, the |
---|
677 | order of traversal shall be from the least to the greatest. If the |
---|
678 | @code{compar} argument is NULL, the order of traversal shall be as listed |
---|
679 | in the @code{pathnames} argument. |
---|
680 | |
---|
681 | @subheading NOTES: |
---|
682 | |
---|
683 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
684 | this service is available. |
---|
685 | |
---|
686 | @page |
---|
687 | @subsection cfg_read - Read a Configuration Space |
---|
688 | |
---|
689 | @subheading CALLING SEQUENCE: |
---|
690 | |
---|
691 | @ifset is-C |
---|
692 | @example |
---|
693 | int cfg_read( |
---|
694 | CFG *cfgp, |
---|
695 | CFGENT **node |
---|
696 | ); |
---|
697 | @end example |
---|
698 | @end ifset |
---|
699 | |
---|
700 | @ifset is-Ada |
---|
701 | @end ifset |
---|
702 | |
---|
703 | @subheading STATUS CODES: |
---|
704 | |
---|
705 | @table @b |
---|
706 | @item EACCES |
---|
707 | Search permission is denied for any component of a pathname. |
---|
708 | |
---|
709 | @item EBADF |
---|
710 | The cfgp argument does not refer to an open configuration |
---|
711 | space. |
---|
712 | |
---|
713 | @item ELOOP |
---|
714 | A loop exists in symbolic links encountered during resolution |
---|
715 | of a pathname. |
---|
716 | |
---|
717 | @item ENOENT |
---|
718 | A named node does not exist. |
---|
719 | |
---|
720 | @item ENOMEM |
---|
721 | Not enough memory is available to create the necessary structures. |
---|
722 | |
---|
723 | @item ELOOP |
---|
724 | More than @code{SYMLOOP_MAX} symbolic links were encountered during |
---|
725 | resolution of the cfgpath argument. |
---|
726 | |
---|
727 | @item ENAMETOOLONG |
---|
728 | As a result of encountering a symbolic link in resolution of the |
---|
729 | pathname specified by the pathnames argument, the length of the |
---|
730 | substituted pathname string exceeded @code{PATH_MATH}. |
---|
731 | |
---|
732 | @end table |
---|
733 | |
---|
734 | @subheading DESCRIPTION: |
---|
735 | |
---|
736 | The @code{cfg_read} function returns a pointer to a CFGENT structure |
---|
737 | representing a node in the configuration space to which @code{cfgp} |
---|
738 | refers. The returned pointer shall be stored at the location |
---|
739 | indicated by the @code{node} argument. |
---|
740 | |
---|
741 | The child nodes of each node in the configuration tree is returned |
---|
742 | by @code{cfg_read}. If a comparison routine is specified to the |
---|
743 | @code{cfg_open} function, the order of return of the child nodes shall |
---|
744 | be as specified by the routine, from least to greatest. Otherwise |
---|
745 | the order of return is unspecified. |
---|
746 | |
---|
747 | Structures referencing nodes with children shall be returned by the |
---|
748 | function @code{cfg_read} at least twice [unless the application |
---|
749 | specifies otherwise with @code{cfg_mark}]-once immediately before |
---|
750 | the structures representing their descendants, are returned |
---|
751 | (pre-order), and once immediately after structures representing all |
---|
752 | of their descendants, if any, are returned (post-order). The |
---|
753 | CFGENT structure returned in post-order (with the exception of the |
---|
754 | @code{cfg_info} field) shall be identical to that returned in pre-order. |
---|
755 | Structures referencing nodes of other types shall be returned at least |
---|
756 | once. |
---|
757 | |
---|
758 | The fields of the CFGENT structure shall contain the following |
---|
759 | information: |
---|
760 | |
---|
761 | @table @b |
---|
762 | |
---|
763 | @item cfg_parent |
---|
764 | A pointer to the structure returned by the |
---|
765 | @code{cfg_read} function for the node that contains |
---|
766 | the entry for the current node. A @code{cfg_parent} |
---|
767 | structure shall be provided for the node(s) specified |
---|
768 | by the @code{pathnames} argument to the @code{cfg_open} |
---|
769 | function, but the contents of other than its |
---|
770 | @code{cfg_number}, @code{cfg_pointer}, @code{cfg_parent}, |
---|
771 | and @code{cfg_parent}, and @code{cfg_level} fields are |
---|
772 | unspecified. Its @code{cfg_link} field is unspecified. |
---|
773 | |
---|
774 | @item cfg_link |
---|
775 | Upon return from the @code{cfg_children} function, the |
---|
776 | @code{cfg_link} field points to the next CFGENT structure |
---|
777 | in a NULL-terminated linked list of CFGENT structures. |
---|
778 | Otherwise, the content of the @code{cfg_link} field is |
---|
779 | unspecified. |
---|
780 | |
---|
781 | @item cfg_cycle |
---|
782 | If the structure being returned by @code{cfg_read} |
---|
783 | represents a node that appears in the @code{cfg_parent} |
---|
784 | linked list tree, the @code{cfg_cycle} field shall point |
---|
785 | to the structure representing that entry from the |
---|
786 | @code{cfg_parent} linked list. Otherwise the content of |
---|
787 | the @code{cfg_cycle} field is unspecified. |
---|
788 | |
---|
789 | @item cfg_number |
---|
790 | The @code{cfg_number} field is provided for use by the |
---|
791 | application program. It shall be initialized to zero for |
---|
792 | each new node returned by the @code{cfg_read} function, |
---|
793 | but shall not be further modified the configuration space |
---|
794 | routines. |
---|
795 | |
---|
796 | @item cfg_pointer |
---|
797 | The @code{cfg_pointer} field is provided for use by the |
---|
798 | application program. It shall be initialized to NULL for |
---|
799 | each new node returned by the @code{cfg_read} function, |
---|
800 | but shall not be further modified by the configuration |
---|
801 | space routines. |
---|
802 | |
---|
803 | @item cfg_path |
---|
804 | A pathname for the node including and relative to the |
---|
805 | argument supplied to the @code{cfg_open} routine for this |
---|
806 | configuration space. This pathname may be longer than |
---|
807 | @code{PATH_MAX} bytes. This pathname shall be NULL-terminated. |
---|
808 | |
---|
809 | @item cfg_name |
---|
810 | The nodename of the node. |
---|
811 | |
---|
812 | @item cfg_pathlen |
---|
813 | The length of the string pointed at by the @code{cfg_path} |
---|
814 | field when returned by @code{cfg_read}. |
---|
815 | |
---|
816 | @item cfg_namelen |
---|
817 | The length of the string pointed at by the @code{cfg_name} |
---|
818 | field. |
---|
819 | |
---|
820 | @item cfg_level |
---|
821 | The depth of the current entry in the configuration space. |
---|
822 | The @code{cfg_level} field of the @code{cfg_parent} |
---|
823 | structure for each of the node(s) specified in the |
---|
824 | @code{pathnames} argument to the @code{cfg_open} function |
---|
825 | shall be set to 0, and this number shall be incremented for |
---|
826 | for each node level descendant. |
---|
827 | |
---|
828 | @item cfg_info |
---|
829 | This field shall contain one of the values listed below. If |
---|
830 | an object can have more than one info value, the first |
---|
831 | appropriate value listed below shall be returned. |
---|
832 | |
---|
833 | @table @b |
---|
834 | |
---|
835 | @item CFG_D |
---|
836 | The structure represents a node with children in |
---|
837 | pre-order. |
---|
838 | |
---|
839 | @item CFG_DC |
---|
840 | The structure represents a node that is a parent |
---|
841 | of the node most recently returned by @code{cfg_read}. |
---|
842 | The @code{cfg_cycle} field shall reference the |
---|
843 | structure previously returned by @code{cfg_read} that |
---|
844 | is the same as the returned structure. |
---|
845 | |
---|
846 | @item CFG_DEFAULT |
---|
847 | The structure represents a node that is not |
---|
848 | represented by one of the other node types |
---|
849 | |
---|
850 | @item CFG_DNR |
---|
851 | The structure represents a node, not of type symlink, |
---|
852 | that is unreadable. The variable @code{cfg_errno} |
---|
853 | shall be set to the appropriate value. |
---|
854 | |
---|
855 | @item CFG_DP |
---|
856 | The structure represents a node with children in |
---|
857 | post-order. This value shall occur only if CFG_D |
---|
858 | has previously been returned for this entry. |
---|
859 | |
---|
860 | @item CFG_ERR |
---|
861 | The structure represents a node for which an error has |
---|
862 | occurred. The variable @code{cfg_errno} shall be set |
---|
863 | to the appropriate value. |
---|
864 | |
---|
865 | @item CFG_F |
---|
866 | The structure represents a node without children. |
---|
867 | |
---|
868 | @item CFG_SL |
---|
869 | The structure represents a node of type symbolic link. |
---|
870 | |
---|
871 | @item CFG_SLNONET |
---|
872 | The structure represents a node of type symbolic link |
---|
873 | with a target node for which node characteristic |
---|
874 | information cannot be obtained. |
---|
875 | |
---|
876 | @end table |
---|
877 | |
---|
878 | @end table |
---|
879 | |
---|
880 | Structures returned by @code{cfg_read} with a @code{cfg_info} field equal |
---|
881 | to CFG_D shall be accessible until a subsequent call, on the same |
---|
882 | configuration traversal stream, to @code{cfg_close}, or to @code{cfg_read} |
---|
883 | after they have been returned by the @code{cfg_read} function in |
---|
884 | post-order. Structures returned by @code{cfg_read} with an |
---|
885 | @code{cfg_info} field not equal to CFG_D shall be accessible until a |
---|
886 | subsequent call, on the same configuration traversal stream, to |
---|
887 | @code{cfg_close} or @code{cfg_read}. |
---|
888 | |
---|
889 | The content of the @code{cfg_path} field is specified only for the |
---|
890 | structure most recently returned by @code{cfg_read}. |
---|
891 | |
---|
892 | The specified fields in structures in the list representing nodes for |
---|
893 | which structures have previously been returned by @code{cfg_children}, |
---|
894 | shall be identical to those returned by @code{cfg_children}, except that |
---|
895 | the contents of the @code{cfg_path} and @code{cfg_pathlen} fields are |
---|
896 | unspecified. |
---|
897 | |
---|
898 | @subheading NOTES: |
---|
899 | |
---|
900 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
901 | this service is available. |
---|
902 | |
---|
903 | @page |
---|
904 | @subsection cfg_children - Get Node Entries |
---|
905 | |
---|
906 | @subheading CALLING SEQUENCE: |
---|
907 | |
---|
908 | @ifset is-C |
---|
909 | @example |
---|
910 | int cfg_children( |
---|
911 | CFG *cfgp, |
---|
912 | int options, |
---|
913 | CFGENT **children |
---|
914 | ); |
---|
915 | @end example |
---|
916 | @end ifset |
---|
917 | |
---|
918 | @ifset is-Ada |
---|
919 | @end ifset |
---|
920 | |
---|
921 | @subheading STATUS CODES: |
---|
922 | |
---|
923 | @table @b |
---|
924 | @item EACCES |
---|
925 | Search permission is denied for any component of a pathname |
---|
926 | |
---|
927 | @item EBADF |
---|
928 | The cfgp argument does not refer to an open configuration space. |
---|
929 | |
---|
930 | @item ELOOP |
---|
931 | A loop exists in symbolic links encountered during resolution of |
---|
932 | a pathname. |
---|
933 | |
---|
934 | @item ENAMETOOLONG |
---|
935 | The length of a pathname exceeds @code{PATH_MAX}, or a pathname |
---|
936 | component is longer than @code{NAME_MAX} while @code{_POSIX_NO_TRUNC} is |
---|
937 | in effect. |
---|
938 | |
---|
939 | @item EINVAL |
---|
940 | The specified value of the options argument is invalid. |
---|
941 | |
---|
942 | @item ENOENT |
---|
943 | The named node does not exist. |
---|
944 | |
---|
945 | @item ENOMEM |
---|
946 | Not enough memory is available to create the necessary structures. |
---|
947 | |
---|
948 | @end table |
---|
949 | |
---|
950 | @subheading DESCRIPTION: |
---|
951 | |
---|
952 | The first @code{cfg_children} call after a @code{cfg_read} shall |
---|
953 | return information about the first node without children under the |
---|
954 | node returned by @code{cfg_read}. Subsequent calls to |
---|
955 | @code{cfg_children} without the intervening @code{cfg_read} shall |
---|
956 | return information about the remaining nodes without children under |
---|
957 | that same node. |
---|
958 | |
---|
959 | If @code{cfg_read} has not yet been called for the configuration |
---|
960 | traversal stream represented by @code{cfgp}, @code{cfg_children} |
---|
961 | shall return a pointer to the first entry in a list of the nodes |
---|
962 | represented by the @code{pathnames} argument to @code{cfg_open}. |
---|
963 | |
---|
964 | In either case, the list shall be NULL-terminated, ordered by the |
---|
965 | user-specified comparison function, if any, and linked through the |
---|
966 | cfg_link field. |
---|
967 | |
---|
968 | @subheading NOTES: |
---|
969 | |
---|
970 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
971 | this service is available. |
---|
972 | |
---|
973 | @page |
---|
974 | @subsection cfg_mark - Set Configuration Space Options |
---|
975 | |
---|
976 | @subheading CALLING SEQUENCE: |
---|
977 | |
---|
978 | @ifset is-C |
---|
979 | @example |
---|
980 | int cfg_mark( |
---|
981 | CFG *cfgp, |
---|
982 | CFGENT *f, |
---|
983 | int options |
---|
984 | ); |
---|
985 | @end example |
---|
986 | @end ifset |
---|
987 | |
---|
988 | @ifset is-Ada |
---|
989 | @end ifset |
---|
990 | |
---|
991 | @subheading STATUS CODES: |
---|
992 | |
---|
993 | @table @b |
---|
994 | @item EINVAL |
---|
995 | The specified combination of the cfgp and f arguments is not |
---|
996 | supported by the implementation. |
---|
997 | |
---|
998 | @item EINVAL |
---|
999 | The specified value of the options argument is invalid. |
---|
1000 | |
---|
1001 | @end table |
---|
1002 | |
---|
1003 | @subheading DESCRIPTION: |
---|
1004 | |
---|
1005 | The @code{cfg_mark} function modifies the subsequent behavior of |
---|
1006 | the cfg functions with regard to the node referenced by the structure |
---|
1007 | pointed to by the argument @code{f} or the configuration space referenced |
---|
1008 | by the structure pointed to by the argument @code{cfgp}. |
---|
1009 | |
---|
1010 | Exactly one of the @code{f} argument and the @code{cfgp} argument shall |
---|
1011 | be NULL. |
---|
1012 | |
---|
1013 | The value of the @code{options} argument shall be exactly one of the |
---|
1014 | flags specified in the following list: |
---|
1015 | |
---|
1016 | @table @b |
---|
1017 | |
---|
1018 | @item CFG_AGAIN |
---|
1019 | If the @code{cfgp} argument is non-NULL, or the @code{f} |
---|
1020 | argument is NULL, or the structure referenced by @code{f} |
---|
1021 | is not the one most recently returned by @code{cfg_read}, |
---|
1022 | @code{cfg_mark} shall return an error. Otherwise, the next |
---|
1023 | call to the @code{cfg_read} function shall return the |
---|
1024 | structure referenced by @code{f} with the @code{cfg_info} |
---|
1025 | field reinitialized. Subsequent behavior of the @code{cfg} |
---|
1026 | functions shall be based on the reinitialized value of |
---|
1027 | @code{cfg_info}. |
---|
1028 | |
---|
1029 | @item CFG_SKIP |
---|
1030 | If the @code{cfgp} argument is non-NULL, or the @code{f} |
---|
1031 | argument is NULL, or the structure referenced by @code{f} |
---|
1032 | is not one of those specified as accessible, or the structure |
---|
1033 | referenced by @code{f} is not for a node of type pre-order |
---|
1034 | node, @code{cfg_mark} shall return an error. Otherwise, no |
---|
1035 | more structures for the node referenced by @code{f} or its |
---|
1036 | descendants shall be returned by the @code{cfg_read} function. |
---|
1037 | |
---|
1038 | @item CFG_FOLLOW |
---|
1039 | If the @code{cfgp} argument is non-NULL, or the @code{f} |
---|
1040 | argument is NULL, or the structure referenced by @code{f} |
---|
1041 | is not one of those specified as accessible, or the structure |
---|
1042 | referenced by @code{f} is not for a node of type symbolic link, |
---|
1043 | @code{cfg_mark} shall return an error. Otherwise, the next |
---|
1044 | call to the @code{cfg_read} function shall return the structure |
---|
1045 | referenced by @code{f} with the @code{cfg_info} field reset |
---|
1046 | to reflect the target of the symbolic link instead of the |
---|
1047 | symbolic link itself. If the target of the link is node with |
---|
1048 | children, the pre-order return, followed by the return of |
---|
1049 | structures referencing all of its descendants, followed by a |
---|
1050 | post-order return, shall be done. |
---|
1051 | |
---|
1052 | @end table |
---|
1053 | |
---|
1054 | If the target of the symbolic link does not exist, the fields |
---|
1055 | of the structure by @code{cfg_read} shall be unmodified, except |
---|
1056 | that the @code{cfg_info} field shall be reset to @code{CFG_SLNONE}. |
---|
1057 | |
---|
1058 | @subheading NOTES: |
---|
1059 | |
---|
1060 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
1061 | this service is available. |
---|
1062 | |
---|
1063 | @page |
---|
1064 | @subsection cfg_close - Close a Configuration Space |
---|
1065 | |
---|
1066 | @subheading CALLING SEQUENCE: |
---|
1067 | |
---|
1068 | @ifset is-C |
---|
1069 | @example |
---|
1070 | int cfg_close( |
---|
1071 | CFG *cfgp |
---|
1072 | ); |
---|
1073 | @end example |
---|
1074 | @end ifset |
---|
1075 | |
---|
1076 | @ifset is-Ada |
---|
1077 | @end ifset |
---|
1078 | |
---|
1079 | @subheading STATUS CODES: |
---|
1080 | |
---|
1081 | @table @b |
---|
1082 | @item EBADF |
---|
1083 | The cfgp argument does not refer to an open configuration space |
---|
1084 | traversal stream. |
---|
1085 | |
---|
1086 | @end table |
---|
1087 | |
---|
1088 | @subheading DESCRIPTION: |
---|
1089 | |
---|
1090 | The @code{cfg_close} function closes a configuration space transversal |
---|
1091 | stream represented by the CFG structure pointed at by the @code{cfgp} |
---|
1092 | argument. All system resources allocated for this configuration space |
---|
1093 | traversal stream should be deallocated. Upon return, the value of |
---|
1094 | @code{cfgp} need not point to an accessible object of type CFG. |
---|
1095 | |
---|
1096 | @subheading NOTES: |
---|
1097 | |
---|
1098 | The @code{_POSIX_CFG} feature flag is defined to indicate |
---|
1099 | this service is available. |
---|