Ignore:
Timestamp:
Apr 19, 2010, 10:51:58 PM (10 years ago)
Author:
Sam Hocevar
Message:

New operating mode "copy". It uses temporary files instead of preloading
libzzuf into the process.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/myfork.c

    r4291 r4393  
    7070#endif
    7171
    72 static int run_process(struct opts *, int[][2]);
     72static int run_process(struct child *child, struct opts *, int[][2]);
    7373
    7474#if defined HAVE_WINDOWS_H
     
    101101    }
    102102
    103     pid = run_process(opts, pipes);
     103    pid = run_process(child, opts, pipes);
    104104    if(pid < 0)
    105105    {
    106106        /* FIXME: close pipes */
    107         fprintf(stderr, "error launching `%s'\n", opts->newargv[0]);
     107        fprintf(stderr, "error launching `%s'\n", child->newargv[0]);
    108108        return -1;
    109109    }
     
    133133#endif
    134134
    135 static int run_process(struct opts *opts, int pipes[][2])
     135static int run_process(struct child *child, struct opts *opts, int pipes[][2])
    136136{
    137137    char buf[64];
     
    242242    }
    243243
    244     setenv(PRELOAD, libpath, 1);
     244    /* Only preload the library in preload mode */
     245    if (opts->opmode == OPMODE_PRELOAD)
     246        setenv(PRELOAD, libpath, 1);
    245247    free(libpath);
    246248
    247     if(execvp(opts->newargv[0], opts->newargv))
    248     {
    249         perror(opts->newargv[0]);
     249    if(execvp(child->newargv[0], child->newargv))
     250    {
     251        perror(child->newargv[0]);
    250252        exit(EXIT_FAILURE);
    251253    }
     
    266268                    &sinfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS);
    267269    sinfo.dwFlags = STARTF_USESTDHANDLES;
    268     ret = CreateProcess(NULL, opts->newargv[0], NULL, NULL, FALSE,
     270    ret = CreateProcess(NULL, child->newargv[0], NULL, NULL, FALSE,
    269271                        CREATE_SUSPENDED, NULL, NULL, &sinfo, &pinfo);
    270272    if(!ret)
     
    272274
    273275    /* Get the child process's entry point address */
    274     epaddr = (void *)get_entry_point(opts->newargv[0],
     276    epaddr = (void *)get_entry_point(child->newargv[0],
    275277                                     pinfo.dwProcessId);
    276278    if(!epaddr)
Note: See TracChangeset for help on using the changeset viewer.