1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #include <selinux/avc.h> 5 6 main(int argc,char * argv[])7int main(int argc __attribute__ ((unused)), 8 char* argv[] __attribute__ ((unused))) { 9 int rc; 10 11 /* 12 * Do not use netlink as fallback, since selinux_status_policyload(3) 13 * works only after a first message has been received. 14 */ 15 rc = selinux_status_open(/*fallback=*/0); 16 if (rc < 0) { 17 fprintf(stderr, "%s: failed to open SELinux status map: %m\n", argv[0]); 18 return EXIT_FAILURE; 19 } 20 21 rc = selinux_status_policyload(); 22 if (rc < 0) 23 fprintf(stderr, "%s: failed to read policyload from SELinux status page: %m\n", argv[0]); 24 else 25 printf("%d\n", rc); 26 27 selinux_status_close(); 28 29 return (rc < 0) ? EXIT_FAILURE : EXIT_SUCCESS; 30 } 31