mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-12 00:55:03 +00:00
ec35d1d802
Introduce a helper binary to print the number of policy reloads on the running system. Print only a single number to ease the usage by scripts. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: James Carter <jwcart2@gmail.com>
31 lines
713 B
C
31 lines
713 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include <selinux/avc.h>
|
|
|
|
|
|
int main(int argc __attribute__ ((unused)),
|
|
char* argv[] __attribute__ ((unused))) {
|
|
int rc;
|
|
|
|
/*
|
|
* Do not use netlink as fallback, since selinux_status_policyload(3)
|
|
* works only after a first message has been received.
|
|
*/
|
|
rc = selinux_status_open(/*fallback=*/0);
|
|
if (rc < 0) {
|
|
fprintf(stderr, "%s: failed to open SELinux status map: %m\n", argv[0]);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
rc = selinux_status_policyload();
|
|
if (rc < 0)
|
|
fprintf(stderr, "%s: failed to read policyload from SELinux status page: %m\n", argv[0]);
|
|
else
|
|
printf("%d\n", rc);
|
|
|
|
selinux_status_close();
|
|
|
|
return (rc < 0) ? EXIT_FAILURE : EXIT_SUCCESS;
|
|
}
|