From owner-svn-src-all@FreeBSD.ORG Wed Nov 5 19:35:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15DC61065691; Wed, 5 Nov 2008 19:35:44 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 048A98FC0A; Wed, 5 Nov 2008 19:35:44 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mA5JZhqD035468; Wed, 5 Nov 2008 19:35:43 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mA5JZh6l035466; Wed, 5 Nov 2008 19:35:43 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <200811051935.mA5JZh6l035466@svn.freebsd.org> From: Craig Rodrigues Date: Wed, 5 Nov 2008 19:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184697 - head/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2008 19:35:44 -0000 Author: rodrigc Date: Wed Nov 5 19:35:43 2008 New Revision: 184697 URL: http://svn.freebsd.org/changeset/base/184697 Log: Merge latest DTrace changes from Perforce. Update libproc API to reflect new changes. Approved by: jb Modified: head/lib/libproc/libproc.h head/lib/libproc/proc_create.c Modified: head/lib/libproc/libproc.h ============================================================================== --- head/lib/libproc/libproc.h Wed Nov 5 19:35:09 2008 (r184696) +++ head/lib/libproc/libproc.h Wed Nov 5 19:35:43 2008 (r184697) @@ -33,6 +33,8 @@ struct proc_handle; +typedef void (*proc_child_func)(void *); + /* Values returned by proc_state(). */ #define PS_IDLE 1 #define PS_STOP 2 @@ -55,7 +57,8 @@ int proc_addr2sym(struct proc_handle *, int proc_attach(pid_t pid, int flags, struct proc_handle **pphdl); int proc_continue(struct proc_handle *); int proc_clearflags(struct proc_handle *, int); -int proc_create(const char *, char * const *, struct proc_handle **); +int proc_create(const char *, char * const *, proc_child_func *, void *, + struct proc_handle **); int proc_detach(struct proc_handle *); int proc_getflags(struct proc_handle *); int proc_name2sym(struct proc_handle *, const char *, const char *, GElf_Sym *); Modified: head/lib/libproc/proc_create.c ============================================================================== --- head/lib/libproc/proc_create.c Wed Nov 5 19:35:09 2008 (r184696) +++ head/lib/libproc/proc_create.c Wed Nov 5 19:35:43 2008 (r184697) @@ -90,7 +90,8 @@ proc_attach(pid_t pid, int flags, struct } 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 * con 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);