From owner-svn-src-stable@FreeBSD.ORG Tue Jan 6 21:34:54 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41385106566B; Tue, 6 Jan 2009 21:34:54 +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 2D1CD8FC16; Tue, 6 Jan 2009 21:34:54 +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 n06LYrom042501; Tue, 6 Jan 2009 21:34:53 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n06LYrKW042499; Tue, 6 Jan 2009 21:34:53 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <200901062134.n06LYrKW042499@svn.freebsd.org> From: Craig Rodrigues Date: Tue, 6 Jan 2009 21:34:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186840 - in stable/7/sys: . contrib/pf dev/cxgb kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jan 2009 21:34:55 -0000 Author: rodrigc Date: Tue Jan 6 21:34:53 2009 New Revision: 186840 URL: http://svn.freebsd.org/changeset/base/186840 Log: MFC 184700: Add DTrace probes for process execution. This covers cases tested by the DTrace test suite. Approved by: jb Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/kern_exec.c stable/7/sys/kern/vfs_syscalls.c stable/7/sys/sys/copyright.h (props changed) Modified: stable/7/sys/kern/kern_exec.c ============================================================================== --- stable/7/sys/kern/kern_exec.c Tue Jan 6 21:16:42 2009 (r186839) +++ stable/7/sys/kern/kern_exec.c Tue Jan 6 21:34:53 2009 (r186840) @@ -363,8 +363,6 @@ do_execve(td, args, mac_p) imgp->image_header = NULL; - SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); - /* * Translate the file name. namei() returns a vnode pointer * in ni_vp amoung other things. @@ -376,6 +374,8 @@ do_execve(td, args, mac_p) NDINIT(ndp, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME | MPSAFE | AUDITVNODE1, UIO_SYSSPACE, args->fname, td); + SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); + interpret: error = namei(ndp); if (error) @@ -749,6 +749,7 @@ interpret: vfs_mark_atime(imgp->vp, td); + SDT_PROBE(proc, kernel, , exec_success, args->fname, 0, 0, 0, 0); done1: /* * Free any resources malloc'd earlier that we didn't use. @@ -760,8 +761,6 @@ done1: crfree(newcred); VOP_UNLOCK(imgp->vp, 0, td); - SDT_PROBE(proc, kernel, , exec_success, args->fname, 0, 0, 0, 0); - /* * Handle deferred decrement of ref counts. */ Modified: stable/7/sys/kern/vfs_syscalls.c ============================================================================== --- stable/7/sys/kern/vfs_syscalls.c Tue Jan 6 21:16:42 2009 (r186839) +++ stable/7/sys/kern/vfs_syscalls.c Tue Jan 6 21:34:53 2009 (r186840) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" +#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_mac.h" @@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -82,6 +84,14 @@ __FBSDID("$FreeBSD$"); #include #include +SDT_PROVIDER_DEFINE(vfs); +SDT_PROBE_DEFINE(vfs, , stat, mode); +SDT_PROBE_ARGTYPE(vfs, , stat, mode, 0, "char *"); +SDT_PROBE_ARGTYPE(vfs, , stat, mode, 1, "int"); +SDT_PROBE_DEFINE(vfs, , stat, reg); +SDT_PROBE_ARGTYPE(vfs, , stat, reg, 0, "char *"); +SDT_PROBE_ARGTYPE(vfs, , stat, reg, 1, "int"); + static int chroot_refuse_vdir_fds(struct filedesc *fdp); static int getutimes(const struct timeval *, enum uio_seg, struct timespec *); static int setfown(struct thread *td, struct vnode *, uid_t, gid_t); @@ -2114,6 +2124,11 @@ kern_stat(struct thread *td, char *path, return (error); vfslocked = NDHASGIANT(&nd); error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td); + if (!error) { + SDT_PROBE(vfs, , stat, mode, path, sb.st_mode, 0, 0, 0); + if (S_ISREG(sb.st_mode)) + SDT_PROBE(vfs, , stat, reg, path, pathseg, 0, 0, 0); + } NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked);