X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_usr%2Fv3_env_inject.c;h=4fc80b1890f2c7eeb63f3462707ed9855b63b40b;hb=2cb41f7db5b9f89113432d6b3daff4807ba8e5f2;hp=f9eb854c9209960b53da8c079deebed17a3db8d8;hpb=b040d5d6eeac8036a6f39905913dcacbac87c6dd;p=palacios.git diff --git a/linux_usr/v3_env_inject.c b/linux_usr/v3_env_inject.c index f9eb854..4fc80b1 100644 --- a/linux_usr/v3_env_inject.c +++ b/linux_usr/v3_env_inject.c @@ -15,15 +15,12 @@ #include #include "iface-env-inject.h" +#include "v3_ctrl.h" -static void usage (char* bin) { - fprintf(stderr, "usage: %s /dev/v3-vm env-file inject-point-exe\n", bin); -} - int main (int argc, char **argv) { char *vm_dev, *env_file, *bin_name; - int vm_fd, err, bytes_read, num_strings; + int err, bytes_read, num_strings; struct stat t_stat; struct env_data env; char * strings[MAX_NUM_STRINGS]; @@ -32,7 +29,10 @@ int main (int argc, char **argv) { FILE * t_fd; if (argc < 4) { - usage(argv[0]); + v3_usage(" \n\n" + "\tenv-file : file containing a list of new-line separated env vars\n\n" + "\tinject-point-exe : if this is an exec-hooked inject, use this executable name\n"); + return -1; } @@ -72,20 +72,13 @@ int main (int argc, char **argv) { strncpy(env.bin_name, bin_name, MAX_STRING_LEN); - vm_fd = open(vm_dev, O_RDONLY); - if (vm_fd == -1) { - fprintf(stderr, "Error opening VM device: %s\n", vm_dev); - return -1; - } - printf("Transferring control to Palacios\n"); - err = ioctl(vm_fd, V3_VM_ENV_INJECT, &env); + err = v3_vm_ioctl(vm_dev, V3_VM_ENV_INJECT, &env); if (err < 0) { fprintf(stderr, "Error providing env var data to palacios\n"); return -1; } close(t_fd); - close(vm_fd); return 0; }