Lines Matching defs:error

182 	int error;
191 if ((error = namei(&nd)) != 0)
192 return (error);
198 error = vfs_busy(mp, 0);
200 if (error) {
202 return (error);
204 error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg);
220 return (error);
282 int error;
284 error = kern_statfs(td, uap->path, UIO_USERSPACE, &sf);
285 if (error == 0)
286 error = copyout(&sf, uap->buf, sizeof(sf));
287 return (error);
297 int error;
302 error = namei(&nd);
303 if (error)
304 return (error);
310 error = vfs_busy(mp, 0);
312 if (error) {
314 return (error);
317 error = mac_mount_check_stat(td->td_ucred, mp);
318 if (error)
328 error = VFS_STATFS(mp, sp);
329 if (error)
341 return (error);
362 int error;
364 error = kern_fstatfs(td, uap->fd, &sf);
365 if (error == 0)
366 error = copyout(&sf, uap->buf, sizeof(sf));
367 return (error);
378 int error;
381 error = getvnode(td->td_proc->p_fd, fd, CAP_FSTATFS, &fp);
382 if (error)
383 return (error);
396 error = EBADF;
399 error = vfs_busy(mp, 0);
401 if (error) {
403 return (error);
406 error = mac_mount_check_stat(td->td_ucred, mp);
407 if (error)
417 error = VFS_STATFS(mp, sp);
418 if (error)
431 return (error);
471 int error;
524 (error = VFS_STATFS(mp, sp))) {
540 error = copyout(sp, sfsp, sizeof(*sp));
541 if (error) {
544 return (error);
585 int error;
587 error = kern_statfs(td, uap->path, UIO_USERSPACE, &sf);
588 if (error)
589 return (error);
613 int error;
615 error = kern_fstatfs(td, uap->fd, &sf);
616 if (error)
617 return (error);
644 int error;
648 error = kern_getfsstat(td, &buf, size, UIO_SYSSPACE, uap->flags);
652 while (count > 0 && error == 0) {
654 error = copyout(&osb, uap->buf, sizeof(osb));
661 return (error);
684 int error;
686 error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t));
687 if (error)
688 return (error);
689 error = kern_fhstatfs(td, fh, &sf);
690 if (error)
691 return (error);
751 int error;
754 if ((error = getvnode(fdp, uap->fd, CAP_FCHDIR, &fp)) != 0)
755 return (error);
762 error = change_dir(vp, td);
763 while (!error && (mp = vp->v_mountedhere) != NULL) {
768 error = VFS_ROOT(mp, LK_SHARED, &tdp);
770 if (error) {
779 if (error) {
782 return (error);
819 int error;
826 if ((error = namei(&nd)) != 0)
827 return (error);
829 if ((error = change_dir(nd.ni_vp, td)) != 0) {
833 return (error);
903 int error;
907 error = priv_check(td, PRIV_VFS_CHROOT);
908 if (error)
909 return (error);
912 error = namei(&nd);
913 if (error)
914 goto error;
916 if ((error = change_dir(nd.ni_vp, td)) != 0)
919 if ((error = mac_vnode_check_chroot(td->td_ucred, nd.ni_vp)))
923 error = change_root(nd.ni_vp, td);
927 return (error);
931 error:
933 return (error);
945 int error;
951 error = mac_vnode_check_chdir(td->td_ucred, vp);
952 if (error)
953 return (error);
955 error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
956 return (error);
972 int error;
979 error = chroot_refuse_vdir_fds(fdp);
980 if (error) {
982 return (error);
1092 int type, indx = -1, error, error_open;
1117 error = falloc_noinstall(td, &nfp);
1118 if (error)
1119 return (error);
1128 error = vn_open(&nd, &flags, cmode, fp);
1129 if (error) {
1135 if (error == ENXIO && fp->f_ops != &badfileops)
1148 (error == ENODEV || error == ENXIO) &&
1151 error_open = error;
1152 if ((error = finstall(td, fp, &indx, flags)) != 0)
1154 if ((error = dupfdopen(td, fdp, indx, td->td_dupfd,
1166 return (error);
1201 if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf,
1207 error = fo_truncate(fp, 0, td->td_ucred, td);
1208 if (error)
1223 if ((error = kern_capwrap(td, fp, nd.ni_baserights,
1228 if ((error = finstall(td, fp, &indx, flags)) != 0)
1247 return (error);
1328 int error;
1338 error = priv_check(td, PRIV_VFS_MKNOD_DEV);
1341 error = priv_check(td, PRIV_VFS_MKNOD_BAD);
1344 error = priv_check(td, PRIV_VFS_MKNOD_WHT);
1351 error = EINVAL;
1354 if (error)
1355 return (error);
1361 if ((error = namei(&nd)) != 0)
1362 return (error);
1402 if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
1403 return (error);
1407 if (error == 0 && !whiteout)
1408 error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp,
1411 if (!error) {
1413 error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, CREATE);
1415 error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp,
1417 if (error == 0)
1425 return (error);
1477 int error;
1486 if ((error = namei(&nd)) != 0)
1487 return (error);
1503 if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
1504 return (error);
1511 error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd,
1513 if (error)
1516 error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
1517 if (error == 0)
1526 return (error);
1587 int error;
1592 error = VOP_GETATTR(vp, &va, cred);
1593 if (error != 0)
1594 return (error);
1597 error = priv_check_cred(cred, PRIV_VFS_LINK, 0);
1598 if (error)
1599 return (error);
1603 error = priv_check_cred(cred, PRIV_VFS_LINK, 0);
1604 if (error)
1605 return (error);
1627 int error;
1633 if ((error = namei(&nd)) != 0)
1634 return (error);
1643 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
1646 return (error);
1650 if ((error = namei(&nd)) == 0) {
1658 error = EEXIST;
1659 } else if ((error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY))
1661 error = can_hardlink(vp, td->td_ucred);
1662 if (error == 0)
1664 error = mac_vnode_check_link(td->td_ucred,
1666 if (error == 0)
1668 error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
1678 return (error);
1731 int error;
1739 if ((error = copyinstr(path1, syspath, MAXPATHLEN, NULL)) != 0)
1747 if ((error = namei(&nd)) != 0)
1758 error = EEXIST;
1765 if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
1773 error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd,
1775 if (error)
1778 error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, syspath);
1779 if (error == 0)
1791 return (error);
1804 int error;
1813 error = namei(&nd);
1814 if (error)
1815 return (error);
1833 if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
1834 return (error);
1837 error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, DELETE);
1842 return (error);
1900 int error;
1909 if ((error = namei(&nd)) != 0)
1910 return (error == EINVAL ? EPERM : error);
1914 error = EPERM; /* POSIX */
1916 ((error = vn_stat(vp, &sb, td->td_ucred, NOCRED, td)) == 0) &&
1918 error = EIDRM; /* Identifier removed */
1926 error = EBUSY;
1928 if (error == 0) {
1937 if ((error = vn_start_write(NULL, &mp,
1939 return (error);
1943 error = mac_vnode_check_unlink(td->td_ucred, nd.ni_dvp, vp,
1945 if (error)
1949 error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd);
1962 return (error);
1991 int error, noneg;
1995 if ((error = fget(td, uap->fd, CAP_SEEK, &fp)) != 0)
1996 return (error);
2011 error = EOVERFLOW;
2018 error = VOP_GETATTR(vp, &vattr, cred);
2020 if (error)
2034 error = EOVERFLOW;
2042 error = fo_ioctl(fp, FIOSEEKDATA, &offset, cred, td);
2045 error = fo_ioctl(fp, FIOSEEKHOLE, &offset, cred, td);
2048 error = EINVAL;
2050 if (error == 0 && noneg && offset < 0)
2051 error = EINVAL;
2052 if (error != 0)
2059 foffset_unlock(fp, offset, error != 0 ? FOF_NOUPDATE : 0);
2060 return (error);
2121 int error;
2125 error = 0;
2135 error = mac_vnode_check_access(cred, vp, accmode);
2136 if (error)
2137 return (error);
2139 if ((accmode & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
2140 error = VOP_ACCESS(vp, accmode, cred, td);
2142 return (error);
2199 int error;
2216 if ((error = namei(&nd)) != 0)
2221 error = vn_access(vp, mode, tmpcred, td);
2230 return (error);
2281 int error;
2283 error = kern_stat(td, uap->path, UIO_USERSPACE, &sb);
2284 if (error)
2285 return (error);
2287 error = copyout(&osb, uap->ub, sizeof (osb));
2288 return (error);
2310 int error;
2312 error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb);
2313 if (error)
2314 return (error);
2316 error = copyout(&osb, uap->ub, sizeof (osb));
2317 return (error);
2369 int error;
2371 error = kern_stat(td, uap->path, UIO_USERSPACE, &sb);
2372 if (error == 0)
2373 error = copyout(&sb, uap->ub, sizeof (sb));
2374 return (error);
2389 int error;
2391 error = kern_statat(td, uap->flag, uap->fd, uap->path,
2393 if (error == 0)
2394 error = copyout(&sb, uap->buf, sizeof (sb));
2395 return (error);
2420 int error, vfslocked;
2429 if ((error = namei(&nd)) != 0)
2430 return (error);
2432 error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td);
2433 if (!error) {
2443 if (error)
2444 return (error);
2471 int error;
2473 error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb);
2474 if (error == 0)
2475 error = copyout(&sb, uap->ub, sizeof (sb));
2476 return (error);
2530 int error;
2532 error = kern_stat(td, uap->path, UIO_USERSPACE, &sb);
2533 if (error)
2534 return (error);
2536 error = copyout(&nsb, uap->ub, sizeof (nsb));
2537 return (error);
2559 int error;
2561 error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb);
2562 if (error)
2563 return (error);
2565 error = copyout(&nsb, uap->ub, sizeof (nsb));
2566 return (error);
2613 int error, vfslocked;
2617 if ((error = namei(&nd)) != 0)
2618 return (error);
2626 error = VOP_PATHCONF(nd.ni_vp, name, td->td_retval);
2629 return (error);
2687 int error;
2697 if ((error = namei(&nd)) != 0)
2698 return (error);
2703 error = mac_vnode_check_readlink(td->td_ucred, vp);
2704 if (error) {
2707 return (error);
2711 error = EINVAL;
2722 error = VOP_READLINK(vp, &auio, td->td_ucred);
2727 return (error);
2739 int error;
2754 error = priv_check(td, PRIV_VFS_CHFLAGS_DEV);
2755 if (error)
2756 return (error);
2759 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
2760 return (error);
2765 error = mac_vnode_check_setflags(td->td_ucred, vp, vattr.va_flags);
2766 if (error == 0)
2768 error = VOP_SETATTR(vp, &vattr, td->td_ucred);
2771 return (error);
2791 int error;
2798 if ((error = namei(&nd)) != 0)
2799 return (error);
2802 error = setfflags(td, nd.ni_vp, uap->flags);
2805 return (error);
2819 int error;
2826 if ((error = namei(&nd)) != 0)
2827 return (error);
2830 error = setfflags(td, nd.ni_vp, uap->flags);
2833 return (error);
2855 int error;
2859 if ((error = getvnode(td->td_proc->p_fd, uap->fd, CAP_FCHFLAGS,
2861 return (error);
2868 error = setfflags(td, fp->f_vnode, uap->flags);
2871 return (error);
2884 int error;
2888 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
2889 return (error);
2894 error = mac_vnode_check_setmode(cred, vp, vattr.va_mode);
2895 if (error == 0)
2897 error = VOP_SETATTR(vp, &vattr, cred);
2900 return (error);
2980 int error;
2989 if ((error = namei(&nd)) != 0)
2990 return (error);
2993 error = setfmode(td, td->td_ucred, nd.ni_vp, mode);
2996 return (error);
3012 int error;
3017 error = fget(td, uap->fd, CAP_FCHMOD, &fp);
3018 if (error != 0)
3019 return (error);
3020 error = fo_chmod(fp, uap->mode, td->td_ucred, td);
3022 return (error);
3036 int error;
3040 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
3041 return (error);
3047 error = mac_vnode_check_setowner(cred, vp, vattr.va_uid,
3049 if (error == 0)
3051 error = VOP_SETATTR(vp, &vattr, cred);
3054 return (error);
3115 int error, vfslocked, follow;
3122 if ((error = namei(&nd)) != 0)
3123 return (error);
3126 error = setfown(td, td->td_ucred, nd.ni_vp, uid, gid);
3129 return (error);
3184 int error;
3188 error = fget(td, uap->fd, CAP_FCHOWN, &fp);
3189 if (error != 0)
3190 return (error);
3191 error = fo_chown(fp, uap->uid, uap->gid, td->td_ucred, td);
3193 return (error);
3207 int error;
3216 if ((error = copyin(usrtvp, tv, sizeof(tv))) != 0)
3217 return (error);
3241 int error, setbirthtime;
3245 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
3246 return (error);
3262 error = mac_vnode_check_setutimes(td->td_ucred, vp, vattr.va_atime,
3265 if (error == 0)
3266 error = VOP_SETATTR(vp, &vattr, td->td_ucred);
3269 return (error);
3323 int error, vfslocked;
3325 if ((error = getutimes(tptr, tptrseg, ts)) != 0)
3326 return (error);
3330 if ((error = namei(&nd)) != 0)
3331 return (error);
3334 error = setutimes(td, nd.ni_vp, ts, 2, tptr == NULL);
3337 return (error);
3367 int error;
3371 if ((error = getutimes(tptr, tptrseg, ts)) != 0)
3372 return (error);
3374 if ((error = namei(&nd)) != 0)
3375 return (error);
3378 error = setutimes(td, nd.ni_vp, ts, 2, tptr == NULL);
3381 return (error);
3412 int error;
3415 if ((error = getutimes(tptr, tptrseg, ts)) != 0)
3416 return (error);
3417 if ((error = getvnode(td->td_proc->p_fd, fd, CAP_FUTIMES, &fp))
3419 return (error);
3426 error = setutimes(td, fp->f_vnode, ts, 2, tptr == NULL);
3429 return (error);
3463 int error, vfslocked;
3468 if ((error = namei(&nd)) != 0)
3469 return (error);
3473 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
3477 return (error);
3482 error = EISDIR;
3484 else if ((error = mac_vnode_check_write(td->td_ucred, NOCRED, vp))) {
3487 else if ((error = vn_writechk(vp)) == 0 &&
3488 (error = VOP_ACCESS(vp, VWRITE, td->td_ucred, td)) == 0) {
3491 error = VOP_SETATTR(vp, &vattr, td->td_ucred);
3498 return (error);
3571 int error, lock_flags;
3574 if ((error = getvnode(td->td_proc->p_fd, uap->fd, CAP_FSYNC,
3576 return (error);
3579 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
3594 error = VOP_FSYNC(vp, MNT_WAIT, td);
3601 return (error);
3658 int error;
3669 if ((error = namei(&fromnd)) != 0)
3670 return (error);
3674 error = mac_vnode_check_rename_from(td->td_ucred, fromnd.ni_dvp,
3681 if (error == 0)
3682 error = vn_start_write(fvp, &mp, V_WAIT | PCATCH);
3683 if (error != 0) {
3694 if ((error = namei(&tond)) != 0) {
3695 /* Translate error code for rename("dir1", "dir2/."). */
3696 if (error == EISDIR && fvp->v_type == VDIR)
3697 error = EINVAL;
3709 error = ENOTDIR;
3712 error = EISDIR;
3717 error = EINVAL;
3725 error = -1;
3728 error = mac_vnode_check_rename_to(td->td_ucred, tdvp,
3732 if (!error) {
3733 error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
3756 if (error == -1)
3758 return (error);
3810 int error;
3820 if ((error = namei(&nd)) != 0)
3821 return (error);
3843 if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
3844 return (error);
3851 error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd,
3853 if (error)
3856 error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
3862 if (!error)
3866 return (error);
3900 int error;
3908 if ((error = namei(&nd)) != 0)
3909 return (error);
3913 error = ENOTDIR;
3920 error = EINVAL;
3927 error = EBUSY;
3931 error = mac_vnode_check_unlink(td->td_ucred, nd.ni_dvp, vp,
3933 if (error)
3944 if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
3945 return (error);
3949 error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
3959 return (error);
3978 int error;
3980 error = kern_ogetdirentries(td, uap, &loff);
3981 if (error == 0)
3982 error = copyout(&loff, uap->basep, sizeof(long));
3983 return (error);
3996 int error, eofflag, readcnt, vfslocked;
4003 if ((error = getvnode(td->td_proc->p_fd, uap->fd, CAP_READ,
4005 return (error);
4031 error = mac_vnode_check_readdir(td->td_ucred, vp);
4032 if (error) {
4037 return (error);
4042 error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag,
4054 error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag,
4057 if (error == 0) {
4082 error = EIO;
4087 error = uiomove(dirbuf, readcnt, &auio);
4091 if (error) {
4096 return (error);
4116 if (error == 0)
4118 return (error);
4144 int error;
4146 error = kern_getdirentries(td, uap->fd, uap->buf, uap->count, &base);
4147 if (error)
4148 return (error);
4150 error = copyout(&base, uap->basep, sizeof(long));
4151 return (error);
4164 int error, eofflag;
4171 if ((error = getvnode(td->td_proc->p_fd, fd, CAP_READ | CAP_SEEK,
4173 return (error);
4184 error = EINVAL;
4198 error = mac_vnode_check_readdir(td->td_ucred, vp);
4199 if (error == 0)
4201 error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL,
4204 if (error) {
4229 return (error);
4299 int error;
4305 if ((error = namei(&nd)) != 0)
4306 return (error);
4311 error = EINVAL;
4315 error = mac_vnode_check_revoke(td->td_ucred, vp);
4316 if (error)
4319 error = VOP_GETATTR(vp, &vattr, td->td_ucred);
4320 if (error)
4323 error = priv_check(td, PRIV_VFS_ADMIN);
4324 if (error)
4332 return (error);
4348 int error;
4350 error = 0;
4359 error = cap_funwrap(fp, rights, &fp_fromcap);
4360 if (error) {
4362 return (error);
4410 int error;
4412 error = priv_check(td, PRIV_VFS_GETFH);
4413 if (error)
4414 return (error);
4417 error = namei(&nd);
4418 if (error)
4419 return (error);
4425 error = VOP_VPTOFH(vp, &fh.fh_fid);
4428 if (error)
4429 return (error);
4430 error = copyout(&fh, uap->fhp, sizeof (fh));
4431 return (error);
4449 int error;
4451 error = priv_check(td, PRIV_VFS_GETFH);
4452 if (error)
4453 return (error);
4456 error = namei(&nd);
4457 if (error)
4458 return (error);
4464 error = VOP_VPTOFH(vp, &fh.fh_fid);
4467 if (error)
4468 return (error);
4469 error = copyout(&fh, uap->fhp, sizeof (fh));
4470 return (error);
4503 int fmode, error, type;
4509 error = priv_check(td, PRIV_VFS_FHOPEN);
4510 if (error)
4511 return (error);
4516 error = copyin(uap->u_fhp, &fhp, sizeof(fhp));
4517 if (error)
4518 return(error);
4525 error = VFS_FHTOVP(mp, &fhp.fh_fid, LK_EXCLUSIVE, &vp);
4527 if (error)
4532 * any error that causes an abort must vput(vp)
4533 * just set error = err and 'goto bad;'.
4540 error = EMLINK;
4544 error = EOPNOTSUPP;
4548 error = ENOTDIR;
4554 error = EISDIR;
4557 error = vn_writechk(vp);
4558 if (error)
4567 error = mac_vnode_check_open(td->td_ucred, vp, accmode);
4568 if (error)
4572 error = VOP_ACCESS(vp, accmode, td->td_ucred, td);
4573 if (error)
4579 if ((error = vn_start_write(NULL, &mp, V_WAIT | PCATCH)) != 0) {
4591 error = mac_vnode_check_write(td->td_ucred, td->td_ucred, vp);
4592 if (error == 0) {
4596 error = VOP_SETATTR(vp, vap, td->td_ucred);
4601 if (error)
4604 error = VOP_OPEN(vp, fmode, td->td_ucred, td, NULL);
4605 if (error)
4615 if ((error = falloc(td, &nfp, &indx, fmode)) != 0) {
4636 if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf,
4665 return (error);
4690 int error;
4692 error = priv_check(td, PRIV_VFS_FHSTAT);
4693 if (error)
4694 return (error);
4695 error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t));
4696 if (error)
4697 return (error);
4701 error = VFS_FHTOVP(mp, &fh.fh_fid, LK_EXCLUSIVE, &vp);
4703 if (error) {
4705 return (error);
4707 error = vn_stat(vp, &sb, td->td_ucred, NOCRED, td);
4710 if (error)
4711 return (error);
4712 error = copyout(&sb, uap->sb, sizeof(sb));
4713 return (error);
4735 int error;
4737 error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t));
4738 if (error)
4739 return (error);
4740 error = kern_fhstatfs(td, fh, &sf);
4741 if (error)
4742 return (error);
4753 int error;
4755 error = priv_check(td, PRIV_VFS_FHSTATFS);
4756 if (error)
4757 return (error);
4761 error = VFS_FHTOVP(mp, &fh.fh_fid, LK_EXCLUSIVE, &vp);
4762 if (error) {
4765 return (error);
4768 error = prison_canseemount(td->td_ucred, mp);
4769 if (error)
4772 error = mac_mount_check_stat(td->td_ucred, mp);
4773 if (error)
4783 error = VFS_STATFS(mp, sp);
4784 if (error == 0)
4789 return (error);
4799 int error, vfslocked;
4803 error = fget(td, fd, CAP_WRITE, &fp);
4804 if (error != 0)
4812 error = ESPIPE;
4815 error = ENODEV;
4819 error = EBADF;
4824 error = ENODEV;
4828 error = EINVAL;
4833 error = EFBIG;
4845 error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
4846 if (error != 0) {
4850 error = vn_lock(vp, LK_EXCLUSIVE);
4851 if (error != 0) {
4857 error = mac_vnode_check_write(td->td_ucred, fp->f_cred, vp);
4858 if (error == 0)
4860 error = VOP_ALLOCATE(vp, &offset, &len);
4869 if (error != 0 || len == 0)
4877 return (error);
4903 int error;
4922 error = fget(td, fd, 0, &fp);
4923 if (error != 0)
4931 error = ESPIPE;
4934 error = ENODEV;
4939 error = ENODEV;
5010 error = VOP_ADVISE(vp, offset, end, advice);
5017 return (error);