1RECURSIVE_KEY_SCAN(3) Linux Key Utility Calls RECURSIVE_KEY_SCAN(3)
2
3
4
6 recursive_key_scan, recursive_session_key_scan - apply a function to
7 all keys in a keyring tree
8
10 #include <keyutils.h>
11
12 typedef int (*recursive_key_scanner_t)(key_serial_t parent,
13 key_serial_t key, char *desc, int desc_len, void *data);
14
15 long recursive_key_scan(key_serial_t keyring,
16 recursive_key_scanner_t func, void *data);
17 long recursive_session_key_scan(recursive_key_scanner_t func,
18 void *data);
19
21 recursive_key_scan() performs a depth-first recursive scan of the spec‐
22 ified keyring tree and applies func to every link found in the accessi‐
23 ble keyrings in that tree. data is passed to each invocation of func.
24
25 The return values of func are summed and returned as the overall return
26 value. Errors are ignored. Inaccessible keyrings are not scanned, but
27 links to them are still passed to func.
28
29 recursive_session_key_scan() works exactly like recursive_key_scan()
30 with the caller's session keyring specified as the starting keyring.
31
32 The callback function is called for each link found in all the keyrings
33 in the nominated tree and so may be called multiple times for a partic‐
34 ular key if that key has multiple links to it.
35
36 The callback function is passed the following parameters:
37
38 parent The keyring containing the link or 0 for the initial key.
39
40 key The key to which the link points.
41
42 desc and desc_len
43 A pointer to the raw description and its length as retrieved
44 with keyctl_describe_alloc(). These will be NULL and -1 respec‐
45 tively if the description couldn't be retrieved and errno will
46 retain the error from keyctl_describe_alloc().
47
48 data The data passed to the scanner function.
49
51 These functions return the sum of the results of the callback functions
52 they invoke.
53
55 Ignored.
56
58 When linking, -lkeyutils should be specified to the linker.
59
61 keyctl(3), keyctl_describe_alloc(3), keyrings(7)
62
63
64
65Linux 10 Mar 2011 RECURSIVE_KEY_SCAN(3)