00001 #include <stdio.h> 00002 #include <stdlib.h> 00003 #include <unistd.h> 00004 00005 #include <aquosa/qres_lib.h> 00006 00007 extern char **environ; 00008 00009 int main(int argc, char *argv[]) 00010 { 00011 int i; 00012 char **my_args; 00013 qres_params_t params; 00014 qres_sid_t sid; 00015 00016 if (argc < 5) { 00017 printf("Usage: %s Q Q_min P <command>\n", argv[0]); 00018 return -1; 00019 } 00020 00021 qos_chk_ok_exit(qres_init()); 00022 00023 params.Q = atoi(argv[1]); 00024 params.Q_min = atoi(argv[2]); 00025 params.P = atoi(argv[3]); 00026 params.flags = 0; 00027 qos_chk_ok_exit(qres_create_server(¶ms, &sid)); 00028 qos_chk_ok_exit(qres_attach_thread(sid, 0, 0)); 00029 00030 my_args = malloc(sizeof(char *) * (argc - 3)); 00031 for (i = 4; i < argc; i++) { 00032 printf("Setting argv[%d] = %s\n", i - 4, argv[i]); 00033 my_args[i - 4] = argv[i]; 00034 } 00035 my_args[argc - 4] = NULL; 00036 00037 qres_cleanup(); 00038 00039 execve(argv[4], my_args, environ); 00040 00041 perror("ExecVE Failed:"); 00042 00043 return -1; 00044 }