Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linprocfs/linprocfs.c
Show First 20 Lines • Show All 1,022 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Filler function for proc/pid/cwd | * Filler function for proc/pid/cwd | ||||
*/ | */ | ||||
static int | static int | ||||
linprocfs_doproccwd(PFS_FILL_ARGS) | linprocfs_doproccwd(PFS_FILL_ARGS) | ||||
{ | { | ||||
struct filedesc *fdp; | struct pwd *pwd; | ||||
struct vnode *vp; | |||||
char *fullpath = "unknown"; | char *fullpath = "unknown"; | ||||
char *freepath = NULL; | char *freepath = NULL; | ||||
fdp = p->p_fd; | pwd = pwd_hold(td); | ||||
FILEDESC_SLOCK(fdp); | vn_fullpath(td, pwd->pwd_cdir, &fullpath, &freepath); | ||||
vp = fdp->fd_cdir; | |||||
if (vp != NULL) | |||||
VREF(vp); | |||||
FILEDESC_SUNLOCK(fdp); | |||||
vn_fullpath(td, vp, &fullpath, &freepath); | |||||
if (vp != NULL) | |||||
vrele(vp); | |||||
sbuf_printf(sb, "%s", fullpath); | sbuf_printf(sb, "%s", fullpath); | ||||
if (freepath) | if (freepath) | ||||
free(freepath, M_TEMP); | free(freepath, M_TEMP); | ||||
pwd_drop(pwd); | |||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Filler function for proc/pid/root | * Filler function for proc/pid/root | ||||
*/ | */ | ||||
static int | static int | ||||
linprocfs_doprocroot(PFS_FILL_ARGS) | linprocfs_doprocroot(PFS_FILL_ARGS) | ||||
{ | { | ||||
struct filedesc *fdp; | struct pwd *pwd; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
char *fullpath = "unknown"; | char *fullpath = "unknown"; | ||||
char *freepath = NULL; | char *freepath = NULL; | ||||
fdp = p->p_fd; | pwd = pwd_hold(td); | ||||
FILEDESC_SLOCK(fdp); | vp = jailed(p->p_ucred) ? pwd->pwd_jdir : pwd->pwd_rdir; | ||||
vp = jailed(p->p_ucred) ? fdp->fd_jdir : fdp->fd_rdir; | |||||
if (vp != NULL) | |||||
VREF(vp); | |||||
FILEDESC_SUNLOCK(fdp); | |||||
vn_fullpath(td, vp, &fullpath, &freepath); | vn_fullpath(td, vp, &fullpath, &freepath); | ||||
if (vp != NULL) | |||||
vrele(vp); | |||||
sbuf_printf(sb, "%s", fullpath); | sbuf_printf(sb, "%s", fullpath); | ||||
if (freepath) | if (freepath) | ||||
free(freepath, M_TEMP); | free(freepath, M_TEMP); | ||||
pwd_drop(pwd); | |||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Filler function for proc/pid/cmdline | * Filler function for proc/pid/cmdline | ||||
*/ | */ | ||||
static int | static int | ||||
linprocfs_doproccmdline(PFS_FILL_ARGS) | linprocfs_doproccmdline(PFS_FILL_ARGS) | ||||
▲ Show 20 Lines • Show All 750 Lines • Show Last 20 Lines |