Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linprocfs/linprocfs.c
| Show First 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | linprocfs_domtab(PFS_FILL_ARGS) | ||||
| size_t count; | size_t count; | ||||
| /* resolve symlinks etc. in the emulation tree prefix */ | /* resolve symlinks etc. in the emulation tree prefix */ | ||||
| NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td); | NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td); | ||||
| flep = NULL; | flep = NULL; | ||||
| error = namei(&nd); | error = namei(&nd); | ||||
| lep = linux_emul_path; | lep = linux_emul_path; | ||||
| if (error == 0) { | if (error == 0) { | ||||
| if (vn_fullpath(td, nd.ni_vp, &dlep, &flep) == 0) | if (vn_fullpath(td, nd.ni_vp, 0, &dlep, &flep) == 0) | ||||
| lep = dlep; | lep = dlep; | ||||
| vrele(nd.ni_vp); | vrele(nd.ni_vp); | ||||
| } | } | ||||
| lep_len = strlen(lep); | lep_len = strlen(lep); | ||||
| buf = NULL; | buf = NULL; | ||||
| error = kern_getfsstat(td, &buf, SIZE_T_MAX, &count, | error = kern_getfsstat(td, &buf, SIZE_T_MAX, &count, | ||||
| UIO_SYSSPACE, MNT_WAIT); | UIO_SYSSPACE, MNT_WAIT); | ||||
| ▲ Show 20 Lines • Show All 527 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) | ||||
| { | { | ||||
| char *fullpath = "unknown"; | char *fullpath = "unknown"; | ||||
| char *freepath = NULL; | char *freepath = NULL; | ||||
| vn_fullpath(td, p->p_fd->fd_cdir, &fullpath, &freepath); | vn_fullpath(td, p->p_fd->fd_cdir, 0, &fullpath, &freepath); | ||||
| sbuf_printf(sb, "%s", fullpath); | sbuf_printf(sb, "%s", fullpath); | ||||
| if (freepath) | if (freepath) | ||||
| free(freepath, M_TEMP); | free(freepath, M_TEMP); | ||||
| 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 vnode *rvp; | struct vnode *rvp; | ||||
| char *fullpath = "unknown"; | char *fullpath = "unknown"; | ||||
| char *freepath = NULL; | char *freepath = NULL; | ||||
| rvp = jailed(p->p_ucred) ? p->p_fd->fd_jdir : p->p_fd->fd_rdir; | rvp = jailed(p->p_ucred) ? p->p_fd->fd_jdir : p->p_fd->fd_rdir; | ||||
| vn_fullpath(td, rvp, &fullpath, &freepath); | vn_fullpath(td, rvp, 0, &fullpath, &freepath); | ||||
| sbuf_printf(sb, "%s", fullpath); | sbuf_printf(sb, "%s", fullpath); | ||||
| if (freepath) | if (freepath) | ||||
| free(freepath, M_TEMP); | free(freepath, M_TEMP); | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| /* | /* | ||||
| * Filler function for proc/pid/cmdline | * Filler function for proc/pid/cmdline | ||||
| ▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | if (lobj) { | ||||
| vp = NULL; | vp = NULL; | ||||
| if (lobj != obj) | if (lobj != obj) | ||||
| VM_OBJECT_RUNLOCK(lobj); | VM_OBJECT_RUNLOCK(lobj); | ||||
| flags = obj->flags; | flags = obj->flags; | ||||
| ref_count = obj->ref_count; | ref_count = obj->ref_count; | ||||
| shadow_count = obj->shadow_count; | shadow_count = obj->shadow_count; | ||||
| VM_OBJECT_RUNLOCK(obj); | VM_OBJECT_RUNLOCK(obj); | ||||
| if (vp) { | if (vp) { | ||||
| vn_fullpath(td, vp, &name, &freename); | vn_fullpath(td, vp, 0, &name, &freename); | ||||
| vn_lock(vp, LK_SHARED | LK_RETRY); | vn_lock(vp, LK_SHARED | LK_RETRY); | ||||
| VOP_GETATTR(vp, &vat, td->td_ucred); | VOP_GETATTR(vp, &vat, td->td_ucred); | ||||
| ino = vat.va_fileid; | ino = vat.va_fileid; | ||||
| vput(vp); | vput(vp); | ||||
| } | } | ||||
| } else { | } else { | ||||
| flags = 0; | flags = 0; | ||||
| ref_count = 0; | ref_count = 0; | ||||
| ▲ Show 20 Lines • Show All 412 Lines • Show Last 20 Lines | |||||