3.4 Query
You read a token's contents by information class. The generic reader handles any class getxattr-style; typed convenience wrappers cover the common ones.
ssize_t ;
ssize_t ; /* CLASS_USER */
peios_token_queryreads the classinfo_class(KACS_TOKEN_CLASS_*) intobufusing the two-call protocol. Classes that return SID arrays or ACLs are parsed afterward with the<peios/security.h>views — e.g. readCLASS_GROUPSinto a buffer, thenpeios_sid_array_parseit.peios_token_useris the same two-call read specialised to the user SID (CLASS_USER): probe withsid_buf == NULL, cap == 0, then retrieve.
For the common scalar classes there are typed helpers that write through a mandatory non-NULL out-pointer and return 0 / -1:
;
int ; /* CLASS_TYPE */
int ; /* CLASS_SESSION_ID */
int ; /* CLASS_INTEGRITY_LEVEL */
int ; /* CLASS_PRIVILEGES */
peios_token_privileges returns all four privilege words at once: which privileges are present, which are enabled, which are enabled_by_default, and which have been used (the audit trail of privilege use).
Errors (all query calls): EACCES (handle lacks QUERY), EINVAL (unknown class), ERANGE (non-probe buffer too small), EFAULT (bad buffer pointer). The typed helpers add EINVAL (NULL out-pointer, or an unexpected payload shape).