loglevel.c (637B)
1#include "cachepc/uapi.h" 2 3#include <sys/ioctl.h> 4#include <fcntl.h> 5#include <err.h> 6#include <fcntl.h> 7#include <unistd.h> 8#include <string.h> 9#include <stdio.h> 10#include <stdint.h> 11#include <stdlib.h> 12 13int 14main(int argc, const char **argv) 15{ 16 uint32_t arg; 17 int fd, ret; 18 19 fd = open("/dev/kvm", O_RDONLY); 20 if (fd < 0) err(1, "open"); 21 22 if (argc > 1 && !strcmp(argv[1], "debug")) 23 arg = CPC_LOGLVL_DBG; 24 else if (argc > 1 && !strcmp(argv[1], "info")) 25 arg = CPC_LOGLVL_INFO; 26 else 27 arg = 0; 28 29 printf("loglevel: %i\n", arg); 30 ret = ioctl(fd, KVM_CPC_LOGLEVEL, &arg); 31 if (ret == -1) err(1, "ioctl KVM_CPC_LOGLEVEL"); 32 33 close(fd); 34}