NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |ERRORS |LINKING |SEE ALSO |COLOPHON | |
RECURSIVE_KEY_SCAN(3) Linux Key Utility CallsRECURSIVE_KEY_SCAN(3)recursive_key_scan, recursive_session_key_scan - apply a function to all keys in a keyring tree
#include <keyutils.h>typedef int (*recursive_key_scanner_t)(key_serial_tparent,key_serial_tkey, char *desc, intdesc_len, void *data);long recursive_key_scan(key_serial_tkeyring,recursive_key_scanner_tfunc, void *data);long recursive_session_key_scan(recursive_key_scanner_tfunc,void *data);
recursive_key_scan() performs a depth-first recursive scan of the specifiedkeyring tree and appliesfunc to every link found in the accessible keyrings in that tree.data is passed to each invocation of func. The return values offunc are summed and returned as the overall return value. Errors are ignored. Inaccessible keyrings are not scanned, but links to them are still passed to func.recursive_session_key_scan() works exactly likerecursive_key_scan() with the caller's session keyring specified as the starting keyring. The callback function is called for each link found in all the keyrings in the nominated tree and so may be called multiple times for a particular key if that key has multiple links to it. The callback function is passed the following parameters:parentThe keyring containing the link or 0 for the initial key.keyThe key to which the link points.descanddesc_len A pointer to the raw description and its length as retrieved withkeyctl_describe_alloc(). These will be NULL and -1 respectively if the description couldn't be retrieved anderrno will retain the error fromkeyctl_describe_alloc().dataThe data passed to the scanner function.
These functions return the sum of the results of the callback functions they invoke.
Ignored.
When linking,-lkeyutilsshould be specified to the linker.
keyctl(3),keyctl_describe_alloc(3),keyrings(7)
This page is part of thekeyutils (key management utilities) project. Information about the project can be found at [unknown -- if you know, please contact man-pages@man7.org] If you have a bug report for this manual page, send it to keyrings@linux-nfs.org. This page was obtained from the project's upstream Git repository ⟨http://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2023-03-20.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgLinux 10 Mar 2011RECURSIVE_KEY_SCAN(3)Pages that refer to this page:keyctl(2), keyctl(3)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |