1 #include "poc_test.h"
2 
3 #include <asm/ioctl.h>
4 #include <errno.h>
5 #include <fcntl.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <sys/mman.h>
10 #include <sys/wait.h>
11 #include <unistd.h>
12 
13 #define SIZE 32
14 
main(int argc,char * argv[])15 int main(int argc, char* argv[]) {
16   VtsHostInput host_input = ParseVtsHostFlags(argc, argv);
17   const char* path = host_input.params["path"].c_str();
18   if (strlen(path) == 0) {
19     fprintf(stderr, "path parameter is empty.\n");
20     return POC_TEST_FAIL;
21   }
22 
23   int ret;
24   int fd;
25   char buf[SIZE] = {0};
26 
27   fd = open(path, O_RDWR);
28   if (fd < 0) {
29     perror("open fail");
30     return POC_TEST_FAIL;
31   }
32   printf("open %s succ\n", path);
33 
34   sprintf(buf, "%x %x", 0x1111111, 0x2222222);
35   ret = write(fd, buf, SIZE);
36   if (ret < 0) {
37     perror("write fail");
38     return POC_TEST_FAIL;
39   } else {
40     printf("succ write %d byte\n", ret);
41   }
42   close(fd);
43 
44   return POC_TEST_PASS;
45 }
46