Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


HVM capability enhancement: asynchronous upcalls to ROS userspace
[palacios.git] / linux_usr / v3_syscall.c
index feead06..149e644 100644 (file)
 #include <string.h>
 
 #include "iface-syscall.h"
+#include "v3_ctrl.h"
 
 #define CMD_MAX 10
 #define SYSCALL_MAX 256
 
-static void usage () {
-       fprintf(stderr, "\nusage: v3_syscall <vm device> <syscall_nr> <on|off|status>\n");
-       exit(0);
+static void usage (char * argv[]) {
+        v3_usage("<vm device> <syscall_nr> <on|off|status>\n");
 }
 
-
 int main (int argc, char * argv[]) {
 
-       int vm_fd, ret, syscall_nr;
+       int ret, syscall_nr;
        char * vm_dev = NULL;
        struct v3_syscall_cmd syscall_cmd;
 
        if (argc < 4 || argc > 4) {
                fprintf(stderr, "Invalid number of arguments.\n");
-               usage();
+                usage(argv);
        }
 
        vm_dev = argv[1];
@@ -46,7 +45,7 @@ int main (int argc, char * argv[]) {
                syscall_cmd.cmd = SYSCALL_STAT;
        } else {
                fprintf(stderr, "Invalid command.\n");
-               usage();
+               usage(argv);
        }
 
     if (syscall_nr < 0 || syscall_nr > SYSCALL_MAX) {
@@ -56,14 +55,7 @@ int main (int argc, char * argv[]) {
 
     syscall_cmd.syscall_nr = syscall_nr;
 
-       vm_fd = open(vm_dev, O_RDONLY);
-
-       if (vm_fd < 0) { 
-               fprintf(stderr, "Error opening VM device: %s\n", vm_dev);
-               return -1;
-       }
-
-       ret = ioctl(vm_fd, V3_VM_SYSCALL_CTRL, &syscall_cmd);
+        ret = v3_vm_ioctl(vm_dev, V3_VM_SYSCALL_CTRL, &syscall_cmd);
 
     if (ret < 0) {
         fprintf(stderr, "Error with syscall control\n");