1semanage_iterate(3) Libsemanage API documentation semanage_iterate(3)
2
3
4
6 SELinux Management API
7
8
10 The following iterate function is supported for any semanage record.
11 Replace the function and object name as necessary.
12
13 extern int ITERATE_FUNCTION (
14 semanage_handle_t *handle,
15 int (*handler) (
16 const semanage_OBJECT_t *object,
17 void *varg),
18 void *handler_arg);
19
20
22 Behavior:
23 The iterate function will execute the specified handler over all
24 objects in the selected location. An arbitrary argument can be
25 passed into the handler function along with each object.
26
27 The object passed in is property of the libsemanage library, and
28 may not be modified or preserved - use semanage_OBJECT_clone if
29 that is necessary.
30
31 The handler code may not invoke any semanage write requests for
32 the same object type (i.e. modifying the underlying store is not
33 allowed). The iterate function is reentrant only while inside a
34 transaction (see semanage_begin_transaction ). It is not safe to
35 execute other semanage read or write requests within iterate if
36 not inside a transaction. The handler may return -1 to signal
37 error exit, 0 to signal continue, and 1 to signal successful
38 exit early (the iterate function will stop accordingly).
39
40
41 Parameters:
42 The handle is used to track persistent state across semanage
43 calls, and for error reporting. The handler is the function to
44 execute, with handler_arg as its second parameter, and each
45 object as its first parameter.
46
47
48 Requirements:
49 This function requires an semanage connection to be established
50 (see semanage_connect(3) )
51
52
54 In case of failure, -1 is returned, and the semanage error callback is
55 invoked, describing the error. Otherwise a non-negative integer is
56 returned (a commit number). The same number will be returned by all
57 other semanage object read calls until the next commit.
58
59
61 semanage_handle_create(3), semanage_connect(3),
62
63
64
65ivg2@cornell.edu 15 March 2006 semanage_iterate(3)