Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/types.h>
- #include <inttypes.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <string.h>
- #include <stdarg.h>
- #include <signal.h>
- #include <sys/wait.h>
- #include <locale.h>
- #include <err.h>
- #include <sched.h>
- #include <errno.h>
- #include <time.h>
- #define SIZE 1024
- #define BASE_PATH "/parsec/parsec-3.0/pkgs/apps/"
- #define BIN_PATH "/inst/arm-linux.gcc/bin/"
- //execute the program
- int run_apps(char* executable, char* path_executable) {
- pid_t child;
- child = fork();
- if (!child) {
- //FOLDER
- char path_of_executable[SIZE];
- printf ("%s \n",executable);
- snprintf(path_of_executable, sizeof path_of_executable, "%s%s%s", BASE_PATH,executable,BIN_PATH);
- chdir(path_of_executable);
- char final_executable[SIZE];
- char for_execlp[SIZE];
- snprintf(final_executable, sizeof final_executable, "%s%s%s","./",executable,path_executable);
- snprintf(for_execlp, sizeof for_execlp,"%s%s","./",executable);
- execlp(for_execlp,for_execlp,path_executable, (char *)0);
- // return 127;
- }
- sleep(1);
- printf ("pid - %d\n", child);
- return child;
- }
- /MAIN
- int main(int argc, char **argv)
- {
- int procid;
- char* parsec[] =
- {
- [0] = "blackscholes",
- [1] = NULL,
- };
- char* path[] =
- {
- [0] = " 1 /parsec-3.0/pkgs/apps/blackscholes/run/in_10M.txt prices.txt",
- [1] = NULL
- };
- procid =run_apps(parsec[0],path[0]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement