diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2008-11-05 19:35:43 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2008-11-05 19:35:43 +0000 |
commit | a7a8ae428de1ce96015914b05370d6d44a57d9ad (patch) | |
tree | d69332bbb39dd0f63dc56c5828db8b10b7e6c27d /lib/libproc/proc_create.c | |
parent | 9f34c4004df81e0f9ef5b1f40c4e24d9c220cf0d (diff) | |
download | FreeBSD-src-a7a8ae428de1ce96015914b05370d6d44a57d9ad.zip FreeBSD-src-a7a8ae428de1ce96015914b05370d6d44a57d9ad.tar.gz |
Merge latest DTrace changes from Perforce.
Update libproc API to reflect new changes.
Approved by: jb
Diffstat (limited to 'lib/libproc/proc_create.c')
-rw-r--r-- | lib/libproc/proc_create.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libproc/proc_create.c b/lib/libproc/proc_create.c index 8648999..1649b47 100644 --- a/lib/libproc/proc_create.c +++ b/lib/libproc/proc_create.c @@ -90,7 +90,8 @@ proc_attach(pid_t pid, int flags, struct proc_handle **pphdl) } int -proc_create(const char *file, char * const *argv, struct proc_handle **pphdl) +proc_create(const char *file, char * const *argv, proc_child_func *pcf, + void *child_arg, struct proc_handle **pphdl) { struct proc_handle *phdl; struct kevent kev; @@ -106,13 +107,16 @@ proc_create(const char *file, char * const *argv, struct proc_handle **pphdl) return (ENOMEM); /* Fork a new process. */ - if ((pid = fork()) == -1) + if ((pid = vfork()) == -1) error = errno; else if (pid == 0) { /* The child expects to be traced. */ if (ptrace(PT_TRACE_ME, 0, 0, 0) != 0) _exit(1); + if (pcf != NULL) + (*pcf)(child_arg); + /* Execute the specified file: */ execvp(file, argv); |