Created
March 17, 2014 21:28
-
-
Save danking/9608764 to your computer and use it in GitHub Desktop.
My test program.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/param.h> | |
#include <sys/lock.h> | |
#include <sys/mutex.h> | |
#include <sys/kernel.h> | |
#include <sys/module.h> | |
#include <sys/mman.h> | |
#include <sys/namei.h> | |
#include <sys/ucred.h> | |
#include <sys/queue.h> | |
#include <sys/vnode.h> | |
#include <sys/sysctl.h> | |
#include <sys/syslog.h> | |
#include <vm/uma.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> /* for AF_INET, AF_LOCAL */ | |
#include <sys/mac.h> | |
#include <stdio.h> | |
#include <errno.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
int main() { | |
uint64_t buf[2] = {1, 0}; | |
int err; | |
mac_t init; | |
uint64_t *buf2 = (uint64_t*)malloc(sizeof(uint64_t)*2); | |
buf2[0] = 1; | |
buf2[1] = 0; | |
printf("syscall: %d\n", mac_syscall("shill", 1, buf2)); | |
printf("real error num %d\n", errno); | |
perror("foo"); | |
if (0 != (err = mac_from_text(&init, "shill/init"))) | |
return err; | |
printf("set_proc: %d\n", mac_set_proc(init)); | |
printf("syscall: %d\n", mac_syscall("shill", 1, buf2)); | |
printf("real error num %d\n", errno); | |
perror("foo"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment