1.\" $OpenBSD: VOP_LOOKUP.9,v 1.22 2010/09/07 00:10:12 thib Exp $ 2.\" 3.\" Copyright (c) 2003 Ted Unangst 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" 26.Dd $Mdocdate: September 7 2010 $ 27.Dt VOP_LOOKUP 9 28.Os 29.Sh NAME 30.Nm VOP_LOOKUP 31.Nd vnode operations 32.Sh SYNOPSIS 33.Fd #include <sys/vnode.h> 34.Ft int 35.Fo VOP_ABORTOP 36.Fa "struct vnode *dvp" 37.Fa "struct componentname *cnp" 38.Fc 39.Ft int 40.Fo VOP_ACCESS 41.Fa "struct vnode *vp" 42.Fa "int mode" 43.Fa "struct ucred *cred" 44.Fa "struct proc *p" 45.Fc 46.Ft int 47.Fo VOP_ADVLOCK 48.Fa "struct vnode *vp" 49.Fa "void *id" 50.Fa "int op" 51.Fa "struct flock *fl" 52.Fa "int flags" 53.Fc 54.Ft int 55.Fo VOP_BMAP 56.Fa "struct vnode *vp" 57.Fa "daddr64_t bn" 58.Fa "struct vnode **vpp" 59.Fa "daddr64_t *bnp" 60.Fa "int *runp" 61.Fc 62.Ft int 63.Fo VOP_BWRITE 64.Fa "struct buf *bp" 65.Fc 66.Ft int 67.Fo VOP_CLOSE 68.Fa "struct vnode *vp" 69.Fa "int fflag" 70.Fa "struct ucred *cred" 71.Fa "struct proc *p" 72.Fc 73.Ft int 74.Fo VOP_CREATE 75.Fa "struct vnode *dvp" 76.Fa "struct vnode **vpp" 77.Fa "struct componentname *cnp" 78.Fa "struct vattr *vap" 79.Fc 80.Ft int 81.Fo VOP_FSYNC 82.Fa "struct vnode *vp" 83.Fa "struct ucred *cred" 84.Fa "int waitfor" 85.Fa "struct proc *p" 86.Fc 87.Ft int 88.Fo VOP_GETATTR 89.Fa "struct vnode *vp" 90.Fa "struct vattr *vap" 91.Fa "struct ucred *cred" 92.Fa "struct proc *p" 93.Fc 94.Ft int 95.Fo VOP_INACTIVE 96.Fa "struct vnode *vp" 97.Fa "struct proc *p" 98.Fc 99.Ft int 100.Fo VOP_IOCTL 101.Fa "struct vnode *vp" 102.Fa "u_long command" 103.Fa "void *data" 104.Fa "int fflag" 105.Fa "struct ucred *cred" 106.Fa "struct proc *p" 107.Fc 108.Ft int 109.Fo VOP_ISLOCKED 110.Fa "struct vnode *vp" 111.Fc 112.Ft int 113.Fo VOP_KQFILTER 114.Fa "struct vnode *vp" 115.Fa "struct knote *kn" 116.Fc 117.Ft int 118.Fo VOP_LINK 119.Fa "struct vnode *dvp" 120.Fa "struct vnode *vp" 121.Fa "struct componentname *cnp" 122.Fc 123.Ft int 124.Fo VOP_LOCK 125.Fa "struct vnode *vp" 126.Fa "int flags" 127.Fa "struct proc *p" 128.Fc 129.Ft int 130.Fo VOP_LOOKUP 131.Fa "struct vnode *dvp" 132.Fa "struct vnode **vpp" 133.Fa "struct componentname *cnp" 134.Fc 135.Ft int 136.Fo VOP_MKDIR 137.Fa "struct vnode *dvp" 138.Fa "struct vnode **vpp" 139.Fa "struct componentname *cnp" 140.Fa "struct vattr *vap" 141.Fc 142.Ft int 143.Fo VOP_MKNOD 144.Fa "struct vnode *dvp" 145.Fa "struct vnode **vpp" 146.Fa "struct componentname *cnp" 147.Fa "struct vattr *vap" 148.Fc 149.Ft int 150.Fo VOP_OPEN 151.Fa "struct vnode *vp" 152.Fa "int mode" 153.Fa "struct ucred *cred" 154.Fa "struct proc *p" 155.Fc 156.Ft int 157.Fo VOP_PATHCONF 158.Fa "struct vnode *vp" 159.Fa "int name" 160.Fa "register_t *retval" 161.Fc 162.Ft int 163.Fo VOP_POLL 164.Fa "struct vnode *vp" 165.Fa "int events" 166.Fa "struct proc *p" 167.Fc 168.Ft int 169.Fo VOP_PRINT 170.Fa "struct vnode *vp" 171.Fc 172.Ft int 173.Fo VOP_READ 174.Fa "struct vnode *vp" 175.Fa "struct uio *uio" 176.Fa "int ioflag" 177.Fa "struct ucred *cred" 178.Fc 179.Ft int 180.Fo VOP_READDIR 181.Fa "struct vnode *vp" 182.Fa "struct uio *uio" 183.Fa "struct ucred *cred" 184.Fa "int *eofflag" 185.Fa "int *ncookies" 186.Fa "u_long **cookies" 187.Fc 188.Ft int 189.Fo VOP_READLINK 190.Fa "struct vnode *vp" 191.Fa "struct uio *uio" 192.Fa "struct ucred *cred" 193.Fc 194.Ft int 195.Fo VOP_REALLOCBLKS 196.Fa "struct vnode *vp" 197.Fa "struct cluster_save *buflist" 198.Fc 199.Ft int 200.Fo VOP_RECLAIM 201.Fa "struct vnode *vp" 202.Fa "struct proc *p" 203.Fc 204.Ft int 205.Fo VOP_REMOVE 206.Fa "struct vnode *dvp" 207.Fa "struct vnode *vp" 208.Fa "struct componentname *cnp" 209.Fc 210.Ft int 211.Fo VOP_RENAME 212.Fa "struct vnode *fdvp" 213.Fa "struct vnode *fvp" 214.Fa "struct componentname *fcnp" 215.Fa "struct vnode *tdvp" 216.Fa "struct vnode *tvp" 217.Fa "struct componentname *tcnp" 218.Fc 219.Ft int 220.Fo VOP_REVOKE 221.Fa "struct vnode *vp" 222.Fa "int flags" 223.Fc 224.Ft int 225.Fo VOP_RMDIR 226.Fa "struct vnode *dvp" 227.Fa "struct vnode *vp" 228.Fa "struct componentname *cnp" 229.Fc 230.Ft int 231.Fo VOP_SETATTR 232.Fa "struct vnode *vp" 233.Fa "struct vattr *vap" 234.Fa "struct ucred *cred" 235.Fa "struct proc *p" 236.Fc 237.Ft int 238.Fo VOP_STRATEGY 239.Fa "struct buf *bp" 240.Fc 241.Ft int 242.Fo VOP_SYMLINK 243.Fa "struct vnode *dvp" 244.Fa "struct vnode **vpp" 245.Fa "struct componentname *cnp" 246.Fa "struct vattr *vap" 247.Fa "char *target" 248.Fc 249.Ft int 250.Fo VOP_UNLOCK 251.Fa "struct vnode *vp" 252.Fa "int flags" 253.Fa "struct proc *p" 254.Fc 255.Ft int 256.Fo VOP_WRITE 257.Fa "struct vnode *vp" 258.Fa "struct uio *uio" 259.Fa "int ioflag" 260.Fa "struct ucred *cred" 261.Fc 262.Sh DESCRIPTION 263The 264.Nm VOP 265functions implement a generic way to perform operations on vnodes. 266The VOP function called passes the arguments to the correct file system 267specific function. 268Not all file systems implement all operations, in which case a generic 269method will be used. 270These functions exist to provide an abstract method to invoke vnode 271operations without needing to know anything about the underlying file system. 272Many system calls map directly to a specific VOP function. 273.Pp 274The arguments for each VOP 275function consist of one or more vnode pointers along with other data 276needed to perform the operation. 277Care must be taken to obey the vnode locking discipline when using 278VOP functions. 279Many VOP calls take a 280.Vt struct proc *p 281argument. 282This should be the current process. 283VOP calls are not safe to call in an interrupt context. 284.Pp 285The following sections comment on the VOP functions from the consumer's 286perspective. 287.Pp 288.Bl -tag -width Ds -compact 289.It Fn VOP_ABORTOP dvp cnp 290Abort any asynchronous operations pending on the vnode 291.Fa dvp 292associated with the path name 293.Fa cnp . 294This is mostly used by internal VFS code and should not be needed by 295file system implementors. 296.Pp 297.It Fn VOP_ACCESS vp mode cred p 298Determine if the locked vnode 299.Fa vp 300can be accessed by the calling process 301.Fa p 302with credentials 303.Fa cred 304for the given access 305.Fa mode . 306.Pp 307.Fa mode 308may contain any of the following values: 309.Pp 310.Bl -tag -width Ds -compact -offset indent 311.It Dv VWRITE 312check writeability 313.It Dv VREAD 314check readability 315.It Dv VEXEC 316check executability 317.El 318.Pp 319If the access check succeeds, zero is returned; otherwise, an 320appropriate error code is returned. 321.Pp 322.It Fn VOP_ADVLOCK vp id op fl flags 323Perform advisory locking on the vnode 324.Fa vp 325according to the operation 326.Fa op 327and lock specification 328.Fa fl . 329.Fa id 330identifies the resource holding the lock 331(typically a pointer to the holding process). 332.Pp 333.Fa op 334may be one of the following operations: 335.Pp 336.Bl -tag -width F_GETLK -compact -offset indent 337.It Dv F_GETLK 338Get the first lock that would block a lock request. 339.It Dv F_SETLK 340Set a lock. 341.It Dv F_UNLCK 342Release a lock. 343.El 344.Pp 345.Fa flags 346may contain the following flags: 347.Pp 348.Bl -tag -width F_POSIX -compact -offset indent 349.It Dv F_WAIT 350If required, block waiting to obtain an exclusive lock. 351.It Dv F_POSIX 352Follow 353.Tn POSIX 354locking semantics; see 355.Xr fcntl 2 . 356.It Dv F_FLOCK 357Follow 358.Xr flock 2 359locking semantics. 360.El 361.Pp 362Upon success, zero is returned; otherwise, an appropriate error code is 363returned. 364.Pp 365.It Fn VOP_BMAP vp bn vpp bnp runp 366Convert the logical block number 367.Fa bn 368of the file the locked vnode 369.Fa vp 370is associated with to its physical number on-disk. 371The physical block number is stored in 372.Fa *bnp 373on return. 374.Fa vpp , 375if 376.No non- Ns Dv NULL , 377will be updated to point to the vnode of the block device of which 378.Fa vp 379is associated. 380.Fa runp , 381if 382.No non- Ns Dv NULL , 383will be updated to the number of contiguous disk blocks following 384.Fa *bnp . 385Upon success, zero is returned; otherwise, an appropriate error code is 386returned. 387.Pp 388.It Fn VOP_BWRITE bp 389Write a file system buffer to disk. 390Upon success, zero is returned; otherwise, an appropriate error code is 391returned. 392.Pp 393.It Fn VOP_CLOSE vp fflag cred p 394Close the file associated with the locked vnode 395.Fa vp 396with file flags 397.Fa fflag 398by the calling process 399.Fa p 400with credentials 401.Fa cred . 402This operation should be performed only when the file is no longer being 403used. 404Upon success, zero is returned; otherwise, an appropriate error code is 405returned. 406.Pp 407.It Fn VOP_CREATE dvp vpp cnp vap 408Create a new directory entry for a regular file in the directory 409.Fa dvp 410and return a locked, referenced vnode in 411.Fa vpp . 412The file name is in 413.Fa cnp 414and its permissions will be 415.Fa vap . 416.Pp 417.It Fn VOP_FSYNC vp cred waitfor p 418Flush any dirty buffers associated with 419.Fa vp 420to disk. 421The vnode is locked on entry and exit. 422.Fa waitfor 423can be set to 424.Dv MNT_WAIT 425to indicate that 426.Fn VOP_FSYNC 427should not return until all data is written. 428.Pp 429.It Fn VOP_GETATTR vp vap cred p 430.It Fn VOP_SETATTR vp vap cred p 431Access the vnode attributes 432.Fa vap 433of the vnode 434.Fa vp 435by the calling process 436.Fa p 437with credentials 438.Fa cred . 439.Fn VOP_SETATTR 440requires that 441.Fa vp 442be locked. 443A field value for any member of 444.Fa vap 445of 446.Dv VNOVAL 447represents that the information could not be obtained by 448.Fn VOP_GETATTR 449or should not be changed by 450.Fn VOP_SETATTR . 451Upon success of obtaining or changing the attributes, zero is returned; 452otherwise, an appropriate error code is returned. 453.Pp 454.It Fn VOP_INACTIVE vp p 455Notify the underlying file system that the locked vnode 456.Fa vp 457is no longer in use. 458The vnode will be unlocked upon return. 459.Fa p 460specifies the calling process. 461This may happen when the vnode reference count reaches zero or 462when the underlying file system has disappeared or has been forcibly 463unmounted. 464.Pp 465Typically, the underlying file system will write any buffers associated 466with 467.Fa vp 468to disk or delete the file entry, if need be. 469The underlying file system may not necessarily release any buffers 470associated with 471.Fa vp 472so that it can be immediately reactivated in case the file is used again. 473Upon success, zero is returned; otherwise, an appropriate error code is 474returned. 475.Pp 476.It Fn VOP_IOCTL vp command data fflag cred p 477Perform the control operation 478.Fa command 479with additional information 480.Fa data 481on the vnode 482.Fa vp , 483normally associated with a device, 484with file flags 485.Fa fflag 486by the calling process 487.Fa p 488with credentials 489.Fa cred . 490Upon success, zero is returned; otherwise, an appropriate error code is 491returned. 492.Pp 493.It Fn VOP_ISLOCKED vp 494.It Fn VOP_LOCK vp flags p 495.It Fn VOP_UNLOCK vp flags p 496.Fn VOP_LOCK 497is used internally by 498.Xr vn_lock 9 499to lock a vnode. 500It should not be used by other file system code. 501.Fn VOP_UNLOCK 502unlocks a vnode. 503.Fa flags 504should be zero in most cases. 505.Fn VOP_ISLOCKED 506returns 1 if 507.Fa vp 508is locked and 0 if not. 509It should be used cautiously, as not all file systems implement locks 510effectively. 511Note the asymmetry between 512.Xr vn_lock 9 513and 514.Fn VOP_UNLOCK . 515.Pp 516.It Fn VOP_KQFILTER vp kn 517Register the 518.Xr knote 9 519filtering information 520.Fa kn 521for the vnode 522.Fa vp . 523Only filters for 524.Dv EVFILT_READ , 525.Dv EVFILT_WRITE , 526and 527.Dv EVFILT_VNODE 528will invoke this operation. 529Upon success, zero is returned; otherwise, a non-zero value is returned. 530.Pp 531.It Fn VOP_LINK dvp vp cnp 532Increase the link count for the vnode 533.Fa vp . 534A new entry with name 535.Fa cnp 536should be added to the directory 537.Fa dvp . 538.Fa dvp 539is locked on entry and unlocked on exit. 540.Pp 541.It Fn VOP_LOOKUP dvp vpp cnp 542Find the file corresponding to the name 543.Fa cnp 544in the directory 545.Fa dvp 546and return a vnode in 547.Fa vpp . 548.Fa dvp 549is locked on entry and exit, and 550.Fa vpp 551is locked upon a successful return. 552.Fa vpp 553will be 554.Dv NULL 555on error, and 556.Fa cnp->cn_flags 557will be set to 558.Dv PDIRUNLOCK 559if 560.Fa dvp 561has been unlocked for an unsuccessful return. 562.Pp 563.It Fn VOP_MKDIR dvp vpp cnp vap 564Create a new directory named by 565.Fa cnp 566with permissions 567.Fa vattr 568in the directory 569.Fa dvp . 570On success, the new vnode is returned locked in 571.Fa vpp . 572.Fa dvp 573must be locked on entry and is unlocked on exit. 574.Pp 575.It Fn VOP_MKNOD dvp vpp cnp vap 576Create a device special file with name 577.Fa cnp 578and attributes 579.Fa vap 580in the directory associated with the locked vnode 581.Fa dvp . 582.Fa dvp 583will be unlocked on return (see 584.Xr vput 9 ) . 585A pointer to the new, locked vnode will be returned in 586.Fa *vpp 587if 588.Fa vpp 589is not 590.Dv NULL . 591Upon success, zero is returned; otherwise, an appropriate error code is 592returned. 593.Pp 594.It Fn VOP_OPEN vp mode cred p 595Open the file associated with the vnode 596.Fa vp 597with the access modes 598.Fa mode 599by the calling process 600.Fa p 601with credentials 602.Fa cred . 603.Fa mode 604takes the flags described in 605.Xr open 2 . 606.Pp 607For some underlying file systems, access permissions for the file by the 608process are checked; for others, this is a no-op. 609In any case, this must be called before a process can access the file. 610Upon success, zero is returned; otherwise, an appropriate error code is 611returned. 612.Pp 613.It Fn VOP_PATHCONF vp name retval 614Obtain the value of the applicable 615.Tn POSIX 616configurable pathname variable (see 617.Xr pathconf 2 ) 618specified by 619.Fa name 620from the locked vnode 621.Fa vp . 622The result is placed in 623.Fa *retval . 624Upon success, zero is returned; otherwise, an appropriate error code is 625returned. 626.Pp 627.It Fn VOP_POLL vp events p 628Determine whether the vnode 629.Fa vp 630is ready to perform the operations specified by 631.Fa events 632(see 633.Xr poll 2 ) 634for the calling process 635.Fa p . 636The 637.Fn selrecord 638routine may be used to detect selection collisions for multiple 639processes sleeping on the same file, waiting for 640.Tn I/O 641to become possible, although all file systems currently assume that 642.Tn I/O 643is always possible. 644The return value specifies which operations from 645.Fa events 646were found to be ready, which may be performed without the need for 647blocking. 648.Pp 649.It Fn VOP_PRINT vp 650Print information about the vnode to the kernel message buffer. 651It is not used normally, but exists only for debugging purposes. 652.Pp 653.It Fn VOP_READ vp uio ioflag cred 654Copy data from the locked vnode 655.Fa vp 656to the buffers specified by 657.Fa uio 658with calling process credentials 659.Fa cred . 660.Pp 661.Fa ioflag 662may contain the following flags: 663.Pp 664.Bl -tag -width IO_APPEND -offset indent -compact 665.It Dv IO_NDELAY 666Non-blocking I/O. 667.It Dv IO_UNIT 668Do I/O as an atomic unit. 669.El 670.Pp 671Upon success, zero is returned; otherwise, an appropriate error code is 672returned. 673.Pp 674.It Fn VOP_READDIR vp uio cred eofflag ncookies cookies 675Read the contents of the directory associated with the locked vnode 676.Fa vp , 677usually via 678.Fn VOP_READ , 679and convert its file-system-specific format to that expected by the 680.Xr getdirentries 2 681system call, storing the result into the buffers specified by 682.Fa uio . 683.Fa cred 684specifies the credentials of the calling process. 685.Fa *eofflag 686is set to a non-zero value on return once successful end-of-file for the 687directory contents has been reached. 688.Pp 689.Fa ncookies 690and 691.Fa cookies , 692if not 693.Dv NULL , 694are used for keeping track of directory seeking. 695This is used by some file systems, such as 696.Tn NFS , 697to allow sequential chunks of the directory contents to be obtained. 698.Pp 699Upon success, zero is returned; otherwise, an appropriate error code is 700returned. 701.Pp 702.It Fn VOP_READLINK vp uio cred 703Read a symbolic link and return the target's name in 704.Fa uio . 705.Fa vp 706is locked on entry and exit and must be a symlink. 707.Pp 708.It Fn VOP_REALLOCBLKS vp buflist 709Called by the VFS write clustering code. 710It gives the file system an opportunity to rearrange the on-disk blocks 711for a file to reduce fragmentation. 712.Fa vp 713is the locked vnode for the file, and 714.Fa buflist 715is a cluster of the outstanding buffers about to be written. 716Currently, only FFS implements this call. 717.Pp 718.It Fn VOP_RECLAIM vp p 719Used by 720.Xr vclean 9 721so that the file system has an opportunity to free memory 722and perform any other cleanup activity related to 723.Fa vp . 724.Fa vp 725is unlocked on entry and exit. 726.Fn VOP_RECLAIM 727should not be used by generic code. 728.Pp 729.It Fn VOP_REMOVE dvp vp cnp 730Remove the link named 731.Fa cnp 732from the directory 733.Fa dvp . 734This file corresponds to the vnode 735.Fa vp . 736Both 737.Fa dvp 738and 739.Fa vp 740are locked on entry and unlocked on exit, and 741each has its reference count decremented by one. 742.Fn VOP_REMOVE 743does not delete the file from disk unless its link count 744becomes zero (for file systems which support multiple links). 745.Pp 746.It Fn VOP_RENAME fdvp fvp fcnp tdvp tvp tcnp 747Remove the link to the file with associated vnode 748.Fa fvp 749and name 750.Fa fcnp 751in the directory with associated vnode 752.Fa fdvp , 753and create a new link to the file with name 754.Fa tcnp 755(and associated locked vnode 756.Fa tvp , 757if the file already exists) residing in the directory with the 758associated locked vnode 759.Fa tdvp . 760.Fa fdvp , 761.Fa fvp , 762and 763.Fa tvp 764(if not 765.Dv NULL ) 766will be released (see 767.Xr vrele 9 ) 768and 769.Fa tdvp 770will have its reference count decremented (see 771.Xr vput 9 ) 772on return. 773If not 774.Dv NULL , 775.Fa tvp 776will be locked on return as well. 777Upon success, zero is returned; otherwise, an appropriate error code is 778returned. 779.Pp 780.It Fn VOP_REVOKE vp flags 781Used by the 782.Xr revoke 2 783system call to prevent any further access to a vnode. 784The vnode ops will be changed to those of deadfs, which returns only 785errors. 786.Ar vp 787must be unlocked. 788.Pp 789.It Fn VOP_RMDIR dvp vp cnp 790Remove the directory 791.Fa vp 792from the directory 793.Fa dvp . 794Both are locked on entry and unlocked on exit. 795The name of the directory for removal is additionally contained in 796.Fa cnp . 797.Pp 798.It Fn VOP_STRATEGY bp 799Call the appropriate strategy function for the device backing the 800buffer's vnode. 801.Pp 802.It Fn VOP_SYMLINK dvp vpp cnp vap target 803Create a symbolic link with name 804.Fa cnp 805in the directory 806.Fa dvp 807with mode 808.Fa vap . 809The link will point to 810.Fa target 811and a vnode for it is returned in 812.Fa vpp . 813The directory vnode is locked on entry and unlocked on exit. 814Note that unlike most VOP calls returning a vnode, 815.Fn VOP_SYMLINK 816does not lock or reference 817.Fa vpp . 818.Pp 819.It Fn VOP_WRITE vp uio ioflag cred 820Copy data from the buffers specified by 821.Fa uio 822to the locked vnode 823.Fa vp 824with calling process credentials 825.Fa cred . 826.Pp 827.Fa ioflag 828may contain the following flags: 829.Pp 830.Bl -tag -width IO_APPEND -offset indent -compact 831.It Dv IO_APPEND 832Perform write at the end of file. 833.It Dv IO_NDELAY 834Non-blocking I/O. 835.It Dv IO_SYNC 836Wait for I/O to complete. 837.It Dv IO_UNIT 838Do I/O as an atomic unit. 839.El 840.Pp 841Upon success, zero is returned; otherwise, an appropriate error code is 842returned. 843.El 844.Sh RETURN VALUES 845The 846.Nm VOP 847functions return 0 to indicate success and a non-zero error code 848to indicate failure. 849.Sh SEE ALSO 850.Xr errno 2 , 851.Xr uio 9 , 852.Xr vfs 9 , 853.Xr vn_lock 9 , 854.Xr vnode 9 855.Sh AUTHORS 856This man page was written by Ted Unangst for 857.Ox . 858.Sh BUGS 859The locking discipline is too complex. 860Refer to 861.Xr vn_lock 9 . 862