procfs.c (197428) | procfs.c (224915) |
---|---|
1/*- 2 * Copyright (c) 2001 Dag-Erling Sm�rgrav 3 * Copyright (c) 1993 Jan-Simon Pendry 4 * Copyright (c) 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Jan-Simon Pendry. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95 39 * | 1/*- 2 * Copyright (c) 2001 Dag-Erling Sm�rgrav 3 * Copyright (c) 1993 Jan-Simon Pendry 4 * Copyright (c) 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Jan-Simon Pendry. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95 39 * |
40 * $FreeBSD: head/sys/fs/procfs/procfs.c 197428 2009-09-23 12:08:08Z kib $ | 40 * $FreeBSD: head/sys/fs/procfs/procfs.c 224915 2011-08-16 20:13:17Z kib $ |
41 */ 42 43#include <sys/param.h> 44#include <sys/queue.h> 45#include <sys/exec.h> 46#include <sys/lock.h> 47#include <sys/kernel.h> 48#include <sys/malloc.h> --- 13 unchanged lines hidden (view full) --- 62#include <fs/procfs/procfs.h> 63 64/* 65 * Filler function for proc/pid/self 66 */ 67int 68procfs_doprocfile(PFS_FILL_ARGS) 69{ | 41 */ 42 43#include <sys/param.h> 44#include <sys/queue.h> 45#include <sys/exec.h> 46#include <sys/lock.h> 47#include <sys/kernel.h> 48#include <sys/malloc.h> --- 13 unchanged lines hidden (view full) --- 62#include <fs/procfs/procfs.h> 63 64/* 65 * Filler function for proc/pid/self 66 */ 67int 68procfs_doprocfile(PFS_FILL_ARGS) 69{ |
70 char *fullpath = "unknown"; 71 char *freepath = NULL; | 70 char *fullpath; 71 char *freepath; |
72 struct vnode *textvp; | 72 struct vnode *textvp; |
73 int error; |
|
73 | 74 |
75 freepath = NULL; |
|
74 PROC_LOCK(p); 75 textvp = p->p_textvp; 76 vhold(textvp); 77 PROC_UNLOCK(p); | 76 PROC_LOCK(p); 77 textvp = p->p_textvp; 78 vhold(textvp); 79 PROC_UNLOCK(p); |
78 vn_fullpath(td, textvp, &fullpath, &freepath); | 80 error = vn_fullpath(td, textvp, &fullpath, &freepath); |
79 vdrop(textvp); | 81 vdrop(textvp); |
80 sbuf_printf(sb, "%s", fullpath); 81 if (freepath) | 82 if (error == 0) 83 sbuf_printf(sb, "%s", fullpath); 84 if (freepath != NULL) |
82 free(freepath, M_TEMP); | 85 free(freepath, M_TEMP); |
83 return (0); | 86 return (error); |
84} 85 86/* 87 * Filler function for proc/curproc 88 */ 89int 90procfs_docurproc(PFS_FILL_ARGS) 91{ --- 118 unchanged lines hidden --- | 87} 88 89/* 90 * Filler function for proc/curproc 91 */ 92int 93procfs_docurproc(PFS_FILL_ARGS) 94{ --- 118 unchanged lines hidden --- |