Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_linker.c
Show First 20 Lines • Show All 1,962 Lines • ▼ Show 20 Lines | for (cpp = linker_ext_list; *cpp; cpp++) { | ||||
*/ | */ | ||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, result); | NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, result); | ||||
flags = FREAD; | flags = FREAD; | ||||
error = vn_open(&nd, &flags, 0, NULL); | error = vn_open(&nd, &flags, 0, NULL); | ||||
if (error == 0) { | if (error == 0) { | ||||
NDFREE_PNBUF(&nd); | NDFREE_PNBUF(&nd); | ||||
type = nd.ni_vp->v_type; | type = nd.ni_vp->v_type; | ||||
if (vap) | if (vap) | ||||
VOP_GETATTR(nd.ni_vp, vap, td->td_ucred); | VOP_GETATTR(nd.ni_vp, 0, vap, td->td_ucred); | ||||
VOP_UNLOCK(nd.ni_vp); | VOP_UNLOCK(nd.ni_vp); | ||||
vn_close(nd.ni_vp, FREAD, td->td_ucred, td); | vn_close(nd.ni_vp, FREAD, td->td_ucred, td); | ||||
if (type == VREG) | if (type == VREG) | ||||
return (result); | return (result); | ||||
} | } | ||||
} | } | ||||
free(result, M_LINKER); | free(result, M_LINKER); | ||||
return (NULL); | return (NULL); | ||||
Show All 35 Lines | linker_hints_lookup(const char *path, int pathlen, const char *modname, | ||||
flags = FREAD; | flags = FREAD; | ||||
error = vn_open(&nd, &flags, 0, NULL); | error = vn_open(&nd, &flags, 0, NULL); | ||||
if (error) | if (error) | ||||
goto bad; | goto bad; | ||||
NDFREE_PNBUF(&nd); | NDFREE_PNBUF(&nd); | ||||
if (nd.ni_vp->v_type != VREG) | if (nd.ni_vp->v_type != VREG) | ||||
goto bad; | goto bad; | ||||
best = cp = NULL; | best = cp = NULL; | ||||
error = VOP_GETATTR(nd.ni_vp, &vattr, cred); | error = VOP_GETATTR(nd.ni_vp, 0, &vattr, cred); | ||||
if (error) | if (error) | ||||
goto bad; | goto bad; | ||||
/* | /* | ||||
* XXX: we need to limit this number to some reasonable value | * XXX: we need to limit this number to some reasonable value | ||||
*/ | */ | ||||
if (vattr.va_size > LINKER_HINTS_MAX) { | if (vattr.va_size > LINKER_HINTS_MAX) { | ||||
printf("linker.hints file too large %ld\n", (long)vattr.va_size); | printf("linker.hints file too large %ld\n", (long)vattr.va_size); | ||||
goto bad; | goto bad; | ||||
▲ Show 20 Lines • Show All 397 Lines • Show Last 20 Lines |