diff --git a/share/man/man9/MD5.9 b/share/man/man9/MD5.9 index df0f84bcff0c..a84c8fbc296c 100644 --- a/share/man/man9/MD5.9 +++ b/share/man/man9/MD5.9 @@ -1,73 +1,74 @@ .\" $OpenBSD: md5.9,v 1.1 1996/04/17 21:40:14 mickey Exp $ .\" .\" Copyright (c) 1996 Michael Shalayeff .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by Michael Shalayeff .\" 3. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .Dd April 17, 1996 .Dt MD5 9 .Os OpenBSD .Sh NAME .Nm MD5 , .Nm MD5Init , .Nm MD5Transform .Nd message digest routines .Sh SYNOPSIS -.Fd #include +.Fd #include +.Fd #include .Ft void .Fn MD5Init "MD5_CTX *buf" .Ft void .Fn MD5Transform "u_int32_t buf[4]" "const unsigned char block[64]" .Sh DESCRIPTION The .Nm module implements the RSA Data Security, Inc. MD5 Message-Digest Algorithm (MD5). It produces 128-bit MD5 Digest of data. .Pp .Bl -hang -width MD5Transformxxx .It Pa MD5Init must be called just before .Fn MD5Transform will be used to produce a digest. The .Fa buf argument is the storage for the digest being produced on subsequent calls to the .Fn MD5Transform routine. .It Pa MD5Transform is the core of the MD5 algorithm, this alters an existing MD5 hash kept in .Fa buf to reflect the addition of 64 characters of new data passed in .Fa block argument. .Sh COPYRIGHTS The code for MD5 transform was taken from Colin Plumb's implementation, which has been placed in the public domain. The MD5 cryptographic checksum was devised by Ronald Rivest, and is documented in RFC 1321, "The MD5 Message Digest Algorithm". diff --git a/share/man/man9/VFS_INIT.9 b/share/man/man9/VFS_INIT.9 index 2934b360c7af..8e49c7ffdf45 100644 --- a/share/man/man9/VFS_INIT.9 +++ b/share/man/man9/VFS_INIT.9 @@ -1,52 +1,53 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VFS_INIT.9,v 1.1 1997/03/03 17:59:53 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VFS_INIT 9 .Sh NAME .Nm VFS_INIT .Nd initialise a filesystem .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VFS_INIT .Sh DESCRIPTION This function is called once to allow a filesystem to initialise any global data structures that it might have. It is either called when the operating system boots or, for dynamically loaded filesystems, when the kernel module containing the filesystem is loaded. .Sh SEE ALSO .Xr vnode 9 , .Xr VFS 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_ABORTOP.9 b/share/man/man9/VOP_ABORTOP.9 index 4e8d7dbff5b1..534b7fef4c38 100644 --- a/share/man/man9/VOP_ABORTOP.9 +++ b/share/man/man9/VOP_ABORTOP.9 @@ -1,71 +1,72 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_ABORTOP.9,v 1.1 1997/03/03 18:00:00 dfr Exp $ +.\" $Id: VOP_ABORTOP.9,v 1.2 1997/03/04 10:02:01 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_ABORTOP 9 .Sh NAME .Nm VOP_ABORTOP .Nd abort a directory operation .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_ABORTOP "struct vnode *dvp" "struct componentname *cnp" .Sh DESCRIPTION This is called after .Xr namei 9 when a .Dv CREATE / .Dv DELETE isn't actually done. If a buffer has been saved in anticipation of a .Dv CREATE , delete it. .Bl -tag -width dvp .It Ar dvp the vnode of the directory .It Ar cnp pathname information for the aborted operation .El .Sh PSEUDOCODE .Bd -literal int vop_abortop(struct vnode *dvp, struct componentname *cnp) { if ((cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) free(cnp->cn_pnbuf, M_NAMEI); return 0; } .Ed .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_ACCESS.9 b/share/man/man9/VOP_ACCESS.9 index 8e4046070ebb..ee08a3759a21 100644 --- a/share/man/man9/VOP_ACCESS.9 +++ b/share/man/man9/VOP_ACCESS.9 @@ -1,146 +1,147 @@ .\" -*- nroff -*- .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_ACCESS.9,v 1.2 1997/03/04 06:20:41 mpp Exp $ +.\" $Id: VOP_ACCESS.9,v 1.3 1997/03/07 03:32:19 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_ACCESS 9 .Sh NAME .Nm VOP_ACCESS .Nd check access permissions of a file or Unix domain socket .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_ACCESS "struct vnode *vp" "int mode" "struct ucred *cred" "struct proc *p" .Sh DESCRIPTION This entry point checks the access permissions of the file against the given credentials. .Pp Its arguments are: .Bl -tag -width mode .It Ar vp the vnode of the file to check .It Ar mode the type of access required .It Ar cred the user credentials to check .It Ar p the process which is checking .El .Pp The .Fa mode is a mask which can contain .Dv VREAD , .Dv VWRITE or .Dv VEXEC. .Sh LOCKS The vnode should be locked on entry. .Sh RETURN VALUES If the file is accessible in the specified way, then zero is returned, otherwise an appropriate error code is returned. .Sh PSEUDOCODE .Bd -literal int vop_access(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) { int error; /* * Disallow write attempts on read-only file systems; * unless the file is a socket, fifo, or a block or * character device resident on the file system. */ if (mode & VWRITE) { switch (vp->v_type) { case VDIR: case VLNK: case VREG: if (vp->v_mount->mnt_flag & MNT_RDONLY) return EROFS; break; } } /* If immutable bit set, nobody gets to write it. */ if ((mode & VWRITE) && vp has immutable bit set) return EPERM; /* Otherwise, user id 0 always gets access. */ if (cred->cr_uid == 0) return 0; mask = 0; /* Otherwise, check the owner. */ if (cred->cr_uid == owner of vp) { if (mode & VEXEC) mask |= S_IXUSR; if (mode & VREAD) mask |= S_IRUSR; if (mode & VWRITE) mask |= S_IWUSR; return (((mode of vp) & mask) == mask ? 0 : EACCES); } /* Otherwise, check the groups. */ for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++) if (group of vp == *gp) { if (mode & VEXEC) mask |= S_IXGRP; if (mode & VREAD) mask |= S_IRGRP; if (mode & VWRITE) mask |= S_IWGRP; return (((mode of vp) & mask) == mask ? 0 : EACCES); } /* Otherwise, check everyone else. */ if (mode & VEXEC) mask |= S_IXOTH; if (mode & VREAD) mask |= S_IROTH; if (mode & VWRITE) mask |= S_IWOTH; return (((mode of vp) & mask) == mask ? 0 : EACCES); } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er EPERM An attempt was made to change an immutable file .It Bq Er EACCES Permission denied .El .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_ADVLOCK.9 b/share/man/man9/VOP_ADVLOCK.9 index 6dd65d375f6c..ed8eb741993d 100644 --- a/share/man/man9/VOP_ADVLOCK.9 +++ b/share/man/man9/VOP_ADVLOCK.9 @@ -1,69 +1,70 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_ADVLOCK.9,v 1.1 1997/03/03 18:00:05 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_ADVLOCK 9 .Sh NAME .Nm VOP_ADVLOCK .Nd advisory record locking .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_ADVLOCK "struct vnode *vp" "caddr_t id" "int op" "struct flock *fl" "int flags" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width flags .It Ar vp the vnode being manipulated .It Ar id the process changing the lock .It Ar op the operation to perform .It Ar fl description of the lock .It Ar flags ??? .El .Pp This entry point manipulates advisory record locks on the file. Most filesystems delegate the work for this call to .Xr lf_advlock 9 . .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO .Xr vnode 9 , .Xr flock 2 , .Xr fcntl 2 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_ATTRIB.9 b/share/man/man9/VOP_ATTRIB.9 index 202432ea5615..109d746660ed 100644 --- a/share/man/man9/VOP_ATTRIB.9 +++ b/share/man/man9/VOP_ATTRIB.9 @@ -1,149 +1,150 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_ATTRIB.9,v 1.3 1997/03/07 03:16:52 mpp Exp $ +.\" $Id: VOP_ATTRIB.9,v 1.4 1997/03/07 03:32:21 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_ATTRIB 9 .Sh NAME .Nm VOP_GETATTR , .Nm VOP_SETATTR .Nd get and set attributes on a file or directory .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_GETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred" "struct proc *p" .Ft int .Fn VOP_SETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred" "struct proc *p" .Sh DESCRIPTION These entry points manipulate various attributes of a file or directory, including file permissions, owner, group, size, access time and modification time. .Pp The arguments are: .Bl -tag -width cred .It Ar vp the vnode of the file .It Ar vpp the attributes of the file .It Ar cred the user credentials of the calling process .It Ar p the process .El .Pp Attributes which are not being modified by .Xr VOP_SETATTR 9 should be set to the value .Dv VNOVAL . .Sh LOCKS The file should not be locked on entry. .Sh RETURN VALUES .Xr VOP_GETATTR 9 returns information about the file in .Fa *vap . .Xr VOP_SETATTR 9 returns zero if the attributes were changed successfully, otherwise an appropriate error is returned. .Sh PSEUDOCODE .Bd -literal int vop_getattr(struct vnode *vp, struct vattr *vpp, struct ucred *cred, struct proc *p) { /* * Fill in the contents of *vpp with information from * the filesystem. */ ...; return 0; } int vop_setattr(struct vnode *vp, struct vattr *vpp, struct ucred *cred, struct proc *p) { /* * Check for unsettable attributes. */ if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) || (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) || (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) || ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) { return (EINVAL); } if (vap->va_flags != VNOVAL) { /* * Set the immutable and append flags of the file. */ } if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) { /* * Change owner and/or group of the file. */ } if (vap->va_size != VNOVAL) { /* * Truncate the file to the specified size. */ } if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) { /* * Change access and/or modification time of file. */ } if (vap->va_mode != (mode_t)VNOVAL) { /* * Change permissions of file. */ } return 0; } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er EPERM The file is immutable .It Bq Er EACCES Permission denied .It Bq Er EROFS The filesystem is readonly .El .Sh SEE ALSO .Xr vnode 9 , .Xr VOP_ACCESS 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_BLKATOFF.9 b/share/man/man9/VOP_BLKATOFF.9 index 143a52439ebf..178f634d08e6 100644 --- a/share/man/man9/VOP_BLKATOFF.9 +++ b/share/man/man9/VOP_BLKATOFF.9 @@ -1,71 +1,72 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_BLKATOFF.9,v 1.1 1997/03/03 18:00:11 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_BLKATOFF 9 .Sh NAME .Nm VOP_BLKATOFF .Nd return a filesystem buffer for part of a file .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_BLKATOFF "struct vnode *vp" "off_t offset" "char **res" "struct buf **bpp" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width offset .It Ar vp The vnode representing the file. .It Ar offset The byte offset into the file where the buffer should start. .It Ar res Return parameter for a pointer to the last valid byte in the buffer. .It Ar bpp Return parameter for the buffer. .El .Pp Return buffer with the contents of block .Fa offset from the beginning of file .Fa ip . .Fa res is non-zero, fill it in with a pointer to the remaining space in the directory. .Pp This call is only used internally by the UFS filesystem. .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO .Xr vnode 9 , .Xr buf 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_BWRITE.9 b/share/man/man9/VOP_BWRITE.9 index 6ed435d3912a..3e8ae2e71d19 100644 --- a/share/man/man9/VOP_BWRITE.9 +++ b/share/man/man9/VOP_BWRITE.9 @@ -1,57 +1,58 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_BWRITE.9,v 1.1 1997/03/03 18:00:13 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_BWRITE 9 .Sh NAME .Nm VOP_BWRITE .Nd write a filesystem buffer .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_BWRITE "struct buf *bp" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width bp .It Ar bp the buffer to be written .El .Pp Most filesystems use the default implementation of this, .Fn vn_bwrite . .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_CREATE.9 b/share/man/man9/VOP_CREATE.9 index 5b237b88f78f..eeb0ac85f094 100644 --- a/share/man/man9/VOP_CREATE.9 +++ b/share/man/man9/VOP_CREATE.9 @@ -1,195 +1,197 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_CREATE.9,v 1.2 1997/03/04 10:02:07 dfr Exp $ +.\" $Id: VOP_CREATE.9,v 1.3 1997/03/07 03:32:22 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_CREATE 9 .Sh NAME .Nm VOP_CREATE , .Nm VOP_MKNOD , .Nm VOP_MKDIR , .Nm VOP_SYMLINK .Nd create a file, socket, fifo, device, directory or symlink .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_CREATE "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" .Ft int .Fn VOP_MKNOD "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" .Ft int .Fn VOP_MKDIR "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" +.Ft int .Fn VOP_SYMLINK "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" "char *target" .Sh DESCRIPTION These entry points create a new file, socket, fifo, device, directory or symlink in a given directory. .Pp The arguments are: .Bl -tag -width target .It Ar dvp the locked vnode of the directory .It Ar vpp the address of a variable where the resulting locked vnode should be stored .It Ar cnp the pathname component created .It Ar vap the attributes that the new object should be created with .It Ar target the pathname of the target of the symlink .El .Pp These entry points are called after .Xr VOP_LOOKUP 9 when an object is being created. Normally, .Xr VOP_LOOKUP 9 will have set the .Dv SAVENAME flag in .Fa cnp->cn_flags to keep the memory pointed to by .Fa cnp->cn_pnbuf valid. If an error is detected when creating the file, then this memory will be freed. If the file is created successfully, then it will be freed unless the .Dv SAVESTART flag is specified in .Fa cnp . .Sh LOCKS The directory, .Fa dvp should be locked on entry and will be unlocked and released on exit. If the call is successful, the new object will be returned locked, unless the call is .Xr VOP_MKNOD 9 or .Xr VOP_SYMLINK 9 in which case the new object is not returned at all. It is not clear why .Xr VOP_MKNOD 9 and .Xr VOP_SYMLINK 9 need a .Fa *vpp argument at all. .Sh RETURN VALUES If successful, the vnode for the new object is placed in .Fa *vpp and zero is returned. Otherwise, an appropriate error is returned. .Sh PSEUDOCODE .Bd -literal int vop_create(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp struct vattr *vap) { int mode = MAKEIMODE(vap->va_type, vap->va_mode); struct vnode *vp; int error; *vpp = NULL; if ((mode & IFMT) == 0) mode |= IFREG; error = VOP_VALLOC(dvp, mode, cnp->cn_cred, &vp); if (error) { free(cnp->cn_pnbuf, M_NAMEI); vput(dvp); return error; } /* * Update the permissions for the new vnode, including * copying the group from the directory. */ ...; #ifdef QUOTA /* * Possibly check quota information. */ ...; #endif /* * Enter new vnode in directory, taking care that the vnode * hits the disk before the directory contents are changed. */ error = ...; if (error) goto bad; if ((cnp->cn_flags & SAVESTART) == 0) free(cnp->cn_pnbuf, M_NAMEI); vput(dvp); *vpp = vp; return 0; bad: /* * Write error occurred trying to update the inode * or the directory so must deallocate the inode. */ free(cnp->cn_pnbuf, M_NAMEI); vput(vp); /* * Deallocate filesystem resources for vp. */ ...; vput(dvp); return error; } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er ENOSPC The filesystem is full. .It Bq Er EDQUOT Quota exceeded. .El .Sh SEE ALSO .Xr VOP_LOOKUP 9 , .Xr VOP_VALLOC 9 .Sh HISTORY The function .Nm appeared in .Bx 4.3 . .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_FSYNC.9 b/share/man/man9/VOP_FSYNC.9 index 56e0e0cb2e8b..9a9361971e5f 100644 --- a/share/man/man9/VOP_FSYNC.9 +++ b/share/man/man9/VOP_FSYNC.9 @@ -1,140 +1,141 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_FSYNC.9,v 1.2 1997/03/04 10:02:10 dfr Exp $ +.\" $Id: VOP_FSYNC.9,v 1.3 1997/03/07 03:32:24 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_FSYNC 9 .Sh NAME .Nm VOP_FSYNC .Nd flush filesystem buffers for a file .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_FSYNC "struct vnode *vp" "struct ucred *cred" "int waitfor" "struct proc *p" .Sh DESCRIPTION This call flushes any dirty filesystem buffers for the file. It is used to implement the .Xr sync 2 and .Xr fsync 2 system calls. .Pp Its arguments are: .Bl -tag -width waitfor .It Ar vp the vnode of the file .It Ar cred the caller's credentials .It Ar waitfor whether the function should wait for I/O to complete .It Ar p the calling process .El .Pp The argument .Fa waitfor is either .Dv MNT_WAIT or .Dv MNT_NOWAIT and specifies whether or not the function should wait for the writes to finish before returning. .Sh LOCKS The file should be locked on entry. .Sh RETURN VALUES Zero is returned if the call is successful, otherwise an appropriate error code is returned. .Sh PSEUDOCODE .Bd -literal int vop_fsync(struct vnode *vp, struct ucred *cred, int waitfor, struct proc *p) { struct buf *bp; struct buf *nbp; struct timeval tv; int s; loop: s = splbio(); for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = nbp) { nbp = bp->b_vnbufs.le_next; /* * Ignore buffers which are already being written. */ if (bp->b_flags & B_BUSY) continue; /* * Make sure the buffer is dirty. */ if ((bp->b_flags & B_DELWRI) == 0) panic("vop_fsync: not dirty"); vfs_bio_awrite(bp); splx(s); goto loop; } splx(s); if (waitfor == MNT_WAIT) { s = splbio(); while (vp->v_numoutput) { vp->v_flag |= VBWAIT; tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "vopfsn"); } splx(s); #ifdef DIAGNOSTIC if (vp->v_dirtyblkhd.lh_first) { vprint("vop_fsync: dirty", vp); goto loop; } #endif } /* * Write out the on-disc version of the vnode. */ tv = time; return VOP_UPDATE(vp, &tv, &tv, waitfor == MNT_WAIT); } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er ENOSPC The filesystem is full. .It Bq Er EDQUOT Quota exceeded. .El .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_GETPAGES.9 b/share/man/man9/VOP_GETPAGES.9 index a161e41107d9..b734554fa5e5 100644 --- a/share/man/man9/VOP_GETPAGES.9 +++ b/share/man/man9/VOP_GETPAGES.9 @@ -1,72 +1,73 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_GETPAGES.9,v 1.1 1997/03/03 18:00:18 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_GETPAGES 9 .Sh NAME .Nm VOP_GETPAGES , .Nm VOP_PUTPAGES .Nd read or write VM pages from a file .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *m" "int count" "int reqpage" "vm_ooffset_t offset" .Ft int .Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *m" "int count" "int sync" "int *rtvals" "vm_ooffset_t offset" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width reqpage .It Ar vp The file to access. .It Ar m A page ??? .It Ar count How many pages to access. .It Ar sync Nonzero if the write should be synchronous. .It Ar rtvals ??? .It Ar reqpage ??? .It Ar offset Offset in the file to start accessing. .El .Pp Not quite sure about this one. .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_LINK.9 b/share/man/man9/VOP_LINK.9 index 095647e89eb7..5f6dd28397e4 100644 --- a/share/man/man9/VOP_LINK.9 +++ b/share/man/man9/VOP_LINK.9 @@ -1,124 +1,125 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_LINK.9,v 1.1 1997/03/03 18:00:23 dfr Exp $ +.\" $Id: VOP_LINK.9,v 1.2 1997/03/07 03:32:25 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_LINK 9 .Sh NAME .Nm VOP_LINK .Nd create a new name for a file .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_LINK "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp" .Sh DESCRIPTION This links a new name in the specified directory to an existing file. .Pp Its arguments are: .Bl -tag -width 8X .It Ar dvp the vnode of the directory .It At vp the vnode of the file to be linked .It Ar cnp pathname information about the file .El .Pp The directory vnode is unlocked and released on exit. .Sh LOCKS The directory, .Fa dvp should be locked on entry and will be unlocked and released on exit. The file .Fa vp should not be locked. .Sh RETURN VALUES Zero is returned if the file was linked successfully, otherwise an error is returned. .Sh PSEUDOCODE .Bd -literal int vop_link(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) { int error = 0; if (vp->v_mount != dvp->v_mount) { VOP_ABORTOP(dvp, cnp); error = EXDEV; goto out2; } if (vp != dvp && (error = VOP_LOCK(vp))) { VOP_ABORTOP(dvp, cnp); goto out2; } if (vp would have too many links) { VOP_ABORTOP(dvp, cnp); error = EMLINK; goto out1; } if (vp is immutable) { VOP_ABORTOP(dvp, cnp); error = EPERM; goto out1; } /* * Increment link count of vp and write back the on-disc version of it. */ ...; if (!error) { /* * Add the new name to the directory. */ ...; } free(cnp->cn_pnbuf, M_NAMEI); out1: if (vp != dvp) VOP_UNLOCK(vp); out2: vput(dvp); return error; } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er EPERM the file is immutable .El .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_LOOKUP.9 b/share/man/man9/VOP_LOOKUP.9 index 45e0c1996404..e4de66a12a4d 100644 --- a/share/man/man9/VOP_LOOKUP.9 +++ b/share/man/man9/VOP_LOOKUP.9 @@ -1,448 +1,449 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_LOOKUP.9,v 1.2 1997/03/04 06:20:43 mpp Exp $ +.\" $Id: VOP_LOOKUP.9,v 1.3 1997/03/07 03:32:26 mpp Exp $ .\" .Dd July 24, 1996 .Os FreeBSD .Dt VOP_LOOKUP 9 .Sh NAME .Nm VOP_LOOKUP .Nd lookup a component of a pathname .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_LOOKUP "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" .Sh DESCRIPTION This VFS entry point looks up a single pathname component in a given directory. .Pp Its arguments are: .Bl -tag -width vpp .It Ar dvp the locked vnode of the directory to search .It Ar vpp the address of a variable where the resulting locked vnode should be stored .It Ar cnp the pathname component to be searched for .El .Pp .Fa Cnp is a pointer to a componentname structure defined as follows: .Bd -literal struct componentname { /* * Arguments to lookup. */ u_long cn_nameiop; /* namei operation */ u_long cn_flags; /* flags to namei */ struct proc *cn_proc; /* process requesting lookup */ struct ucred *cn_cred; /* credentials */ /* * Shared between lookup and commit routines. */ char *cn_pnbuf; /* pathname buffer */ char *cn_nameptr; /* pointer to looked up name */ long cn_namelen; /* length of looked up component */ u_long cn_hash; /* hash value of looked up name */ long cn_consume; /* chars to consume in lookup() */ }; .Ed .Pp Convert a component of a pathname into a pointer to a locked vnode. This is a very central and rather complicated routine. If the file system is not maintained in a strict tree hierarchy, this can result in a deadlock situation. .Pp The .Fa cnp->cn_nameiop argument is .Dv LOOKUP , .Dv CREATE , .Dv RENAME , or .Dv DELETE depending on the intended use of the object. When .Dv CREATE , .Dv RENAME , or .Dv DELETE is specified, information usable in creating, renaming, or deleting a directory entry may be calculated. .Pp Overall outline of VOP_LOOKUP: .Bd -filled -offset indent Check accessibility of directory. Look for name in cache, if found, then return name. Search for name in directory, goto to found or notfound as appropriate. .Ed .Pp notfound: .Bd -filled -offset indent If creating or renaming and at end of pathname, return .Dv EJUSTRETURN , leaving info on available slots else return .Dv ENOENT . .Ed .Pp found: .Bd -filled -offset indent If at end of path and deleting, return information to allow delete. If at end of path and renaming, lock target inode and return info to allow rename. If not at end, add name to cache; if at end and neither creating nor deleting, add name to cache. .Ed .Sh LOCKS The directory, .Fa dvp should be locked on entry. If an error (note: the return value .Dv EJUSTRETURN is not considered an error) is detected, it will be returned locked. Otherwise, it will be unlocked unless both .Dv LOCKPARENT and .Dv ISLASTCN are specified in .Fa cnp->cn_flags . If an entry is found in the directory, it will be returned locked. .Sh RETURN VALUES Zero is returned with .Fa *vpp set to the locked vnode of the file if the component is found. If the component being searched for is ".", then the vnode just has an extra reference added to it with .Xr vref 9 . The caller must take care to release the locks appropriately in this case. .Pp If the component is not found and the operation is .Dv CREATE or .Dv RENAME , the flag .Dv ISLASTCN is specified and the operation would succeed, the special return value .Dv EJUSTRETURN is returned. Otherwise, an appropriate error code is returned. .Sh PSEUDOCODE .Bd -literal int vop_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) { int error; int nameiop = cnp->cn_nameiop; int flags = cnp->cn_flags; int lockparent = flags & LOCKPARENT; int islastcn = flags & ISLASTCN; struct vnode *vp = NULL; /* * Check accessibility of directory. */ if (dvp->v_type != VDIR) return ENOTDIR; error = VOP_ACCESS(dvp, VEXEC, cred, cnp->cn_proc); if (error) return (error); if (islastcn && (dvp->v_mount->mnt_flag & MNT_RDONLY) && (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) return (EROFS); /* * Check name cache for directory/name pair. This returns ENOENT * if the name is known not to exist, -1 if the name was found, or * zero if not. */ error = cache_lookup(dvp, vpp, cnp); if (error) { int vpid; if (error = ENOENT) return error; vp = *vpp; if (dvp == vp) { /* lookup on "." */ VREF(vp); error = 0; } else if (flags & ISDOTDOT) { /* * We need to unlock the directory before getting * the locked vnode for ".." to avoid deadlocks. */ VOP_UNLOCK(dvp); error = vget(vp, 1); if (!error) { if (lockparent && islastcn) error = VOP_LOCK(dvp); } } else { error = vget(vp, 1); if (error || !(lockparent && islastcn)) { VOP_UNLOCK(dvp); } } /* * Check that the capability number did not change * while we were waiting for the lock. */ if (!error) { if (vpid == vp->v_id) { /* * dvp is locked if lockparent && islastcn. * vp is locked. */ return (0); } vput(vp); if (dvp != vp && lockparent && islastcn) VOP_UNLOCK(pdp); } /* * Re-lock dvp for the directory search below. */ error = VOP_LOCK(dvp); if (error) { return (error); } *vpp = NULL; } /* * Search dvp for the component cnp->cn_nameptr. */ ...; if (!found) { if ((nameiop == CREATE || nameiop == RENAME) && islastcn && directory dvp has not been removed) { /* * Check for write access on directory. */ /* * Possibly record the position of a slot in the directory * large enough for the new component name. This can be * recorded in the vnode private data for dvp. * Set the SAVENAME flag to hold onto the pathname for use * later in VOP_CREATE or VOP_RENAME. */ cnp->cn_flags |= SAVENAME; if (!lockparent) /* * Note that the extra data recorded above is only * useful if lockparent is specified. */ VOP_UNLOCK(dvp); return EJUSTRETURN; } /* * Consider inserting name into cache. */ if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) cache_enter(dvp, NULL, cnp); return ENOENT; } else { /* * If deleting, and at end of pathname, return parameters * which can be used to remove file. If the wantparent flag * isn't set, we return only the directory, otherwise we go on * and lock the inode, being careful with ".". */ if (nameiop == DELETE && islastcn) { /* * Check for write access on directory. */ error = VOP_ACCESS(dvp, VWRITE, cred, cnp->cn_proc); if (error) return (error); if (found entry is same as dvp) { VREF(dvp); *vpp = dvp; return 0; } error = VFS_VGET(dvp->v_mount, ..., &vp); if (error) return error; if (directory is sticky && cred->cr_uid != 0 && cred->cr_uid != owner of dvp && owner of vp != cred->cr_uid) { vput(vp); return EPERM; } *vpp = vp; if (!lockparent) VOP_UNLOCK(dvp); return 0; } /* * If rewriting (RENAME), return the inode and the * information required to rewrite the present directory * Must get inode of directory entry to verify it's a * regular file, or empty directory. */ if (nameiop == RENAME && wantparent && islastcn) { error = VOP_ACCESS(dvp, VWRITE, cred, cnp->cn_proc); if (error) return (error); /* * Check for "." */ if (found entry is same as dvp) return EISDIR; error = VFS_VGET(dvp->v_mount, ..., &vp); if (error) return error; *vpp = vp; /* * Save the name for use in VOP_RENAME later. */ cnp->cn_flags |= SAVENAME; if (!lockparent) VOP_UNLOCK(dvp); return 0; } /* * Step through the translation in the name. We do not `vput' the * directory because we may need it again if a symbolic link * is relative to the current directory. Instead we save it * unlocked as "pdp". We must get the target inode before unlocking * the directory to insure that the inode will not be removed * before we get it. We prevent deadlock by always fetching * inodes from the root, moving down the directory tree. Thus * when following backward pointers ".." we must unlock the * parent directory before getting the requested directory. * There is a potential race condition here if both the current * and parent directories are removed before the VFS_VGET for the * inode associated with ".." returns. We hope that this occurs * infrequently since we cannot avoid this race condition without * implementing a sophisticated deadlock detection algorithm. * Note also that this simple deadlock detection scheme will not * work if the file system has any hard links other than ".." * that point backwards in the directory structure. */ if (flags & ISDOTDOT) { VOP_UNLOCK(dvp); /* race to get the inode */ error = VFS_VGET(dvp->v_mount, ..., &vp); if (error) { VOP_LOCK(dvp); return (error); } if (lockparent && islastcn) { error = VOP_LOCK(dvp); if (error) { vput(vp); return error; } } *vpp = vp; } else if (found entry is same as dvp) { VREF(dvp); /* we want ourself, ie "." */ *vpp = dvp; } else { error = VFS_VGET(dvp->v_mount, ..., &vp); if (error) return (error); if (!lockparent || !islastcn) VOP_UNLOCK(dvp); *vpp = vp; } /* * Insert name into cache if appropriate. */ if (cnp->cn_flags & MAKEENTRY) cache_enter(dvp, *vpp, cnp); return (0); } } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er ENOTDIR The vnode .Fa dvp does not represent a directory. .It Bq Er ENOENT The component .Fa dvp was not found in this directory. .It Bq Er EACCESS access for the specified operation is denied. .It Bq Er EJUSTRETURN a .Dv CREATE or .Dv RENAME operation would be successful .El .Sh SEE ALSO .Xr VOP_ACCESS 9 , .Xr VOP_CREATE 9 , .Xr VOP_MKNOD 9 , .Xr VOP_MKDIR 9 , .Xr VOP_SYMLINK 9 , .Xr VOP_RENAME 9 , .Xr VOP_ABORTOP 9 .Sh HISTORY The function .Nm appeared in .Bx 4.3 . .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson, with some text from comments in ufs_lookup.c. diff --git a/share/man/man9/VOP_MMAP.9 b/share/man/man9/VOP_MMAP.9 index 9f51aa54f782..8465fa61c5a8 100644 --- a/share/man/man9/VOP_MMAP.9 +++ b/share/man/man9/VOP_MMAP.9 @@ -1,70 +1,71 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_MMAP.9,v 1.1 1997/03/03 18:00:27 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_MMAP 9 .Sh NAME .Nm VOP_MMAP .Nd map a file into memory .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_MMAP "struct vnode *vp" "int fflags" "struct ucred *cred" "struct proc *p" .Sh DESCRIPTION Map the contents of a file into memory using the VM system. .Pp Its arguments are: .Bl -tag -width fflags .It Ar vp the vnode of the file .It Ar fflags some flags ??? .It Ar cred the caller's credentials .It Ar p the calling process .El .Pp Most filesystems do not implement this entry point. .Sh PSEUDOCODE .Bd -literal int vop_mmap(struct vnode *vp, int fflags, struct ucred *cred, struct proc *p) { return EINVAL; } .Ed .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_OPENCLOSE.9 b/share/man/man9/VOP_OPENCLOSE.9 index 6b9350109d03..39b4d37916aa 100644 --- a/share/man/man9/VOP_OPENCLOSE.9 +++ b/share/man/man9/VOP_OPENCLOSE.9 @@ -1,91 +1,92 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_OPENCLOSE.9,v 1.1 1997/03/03 18:00:28 dfr Exp $ +.\" $Id: VOP_OPENCLOSE.9,v 1.2 1997/03/04 10:02:15 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_OPEN 9 .Sh NAME .Nm VOP_OPEN , .Nm VOP_CLOSE .Nd open or close a file .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_OPEN "struct vnode *vp" "int mode" "struct ucred *cred" "struct proc *p" .Ft int .Fn VOP_CLOSE "struct vnode *vp" "int mode" "struct ucred *cred" "struct proc *p" .Sh DESCRIPTION The .Xr VOP_OPEN 9 entry point is called before a file is accessed by a process and the .Xr VOP_CLOSE 9 entry point is called after a file is finished with by the process. .Pp The arguments are: .Bl -tag -width mode .It Ar vp the vnode of the file .It Ar mode the access mode required by the calling process .It Ar p the process which is accessing the file .El .Pp The access mode is a set of flags, including .Dv FREAD , .Dv FWRITE , .Dv O_NONBLOCK , .Dv O_APPEND . .Sh LOCKS The vnode .Fa vp should be locked on entry and will still be locked on exit for .Xr VOP_OPEN 9 and unlocked on entry and exit for .Xr VOP_CLOSE 9 . .Sh RETURN VALUES Zero is returned on success, otherwise an error code is returned. .Sh PSEUDOCODE .Bd -literal int vop_open(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) { /* * Most filesystems don't do much here. */ return 0; } .Ed .Sh SEE ALSO .Xr vnode 9 , .Xr VOP_LOOKUP 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_PATHCONF.9 b/share/man/man9/VOP_PATHCONF.9 index a1810ee178d7..c613f7b378f5 100644 --- a/share/man/man9/VOP_PATHCONF.9 +++ b/share/man/man9/VOP_PATHCONF.9 @@ -1,88 +1,89 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_PATHCONF.9,v 1.1 1997/03/03 18:00:29 dfr Exp $ +.\" $Id: VOP_PATHCONF.9,v 1.2 1997/03/04 06:20:45 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_PATHCONF 9 .Sh NAME .Nm VOP_PATHCONF .Nd return POSIX pathconf information .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_PATHCONF "struct vnode *vp" "int name" "int *retval" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width retval .It Ar vp the vnode to get information about .It Ar name the type of information to return .It Ar retval the place to return the information .El .Pp The value of .Fa name specifies what should be returned: .Bl -tag -width _PC_CHOWN_RESTRICTED .It Dv _PC_LINK_MAX The maximum number of links to a file. .It Dv _PC_NAME_MAX The maximum number of bytes in a file name. .It Dv _PC_PATH_MAX The maximum number of bytes in a pathname. .It Dv _PC_PIPE_BUF The maximum number of bytes which will be written atomically to a pipe. .It Dv _PC_CHOWN_RESTRICTED Return 1 if appropriate privileges are required for the .Xr chown 2 system call, otherwise 0. .It Dv _PC_NO_TRUNC Return 1 if file names longer than .Dv KERN_NAME_MAX are truncated. .El .Sh RETURN VALUES If .Fa name is recognized, .Fa *retval is set to the specified value and zero is returned, otherwise .Dv EINVAL is returned. .Sh SEE ALSO .Xr vnode 9 , .Xr pathconf 2 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_PRINT.9 b/share/man/man9/VOP_PRINT.9 index 42fec12c84fb..498d754d534a 100644 --- a/share/man/man9/VOP_PRINT.9 +++ b/share/man/man9/VOP_PRINT.9 @@ -1,54 +1,55 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_PRINT.9,v 1.1 1997/03/03 18:00:30 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_PRINT 9 .Sh NAME .Nm VOP_PRINT .Nd print debugging information .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_PRINT "struct vnode *vp" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width bp .It Ar vp the vnode to print .El .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_RDWR.9 b/share/man/man9/VOP_RDWR.9 index 5680b0c475dd..39072c9b586d 100644 --- a/share/man/man9/VOP_RDWR.9 +++ b/share/man/man9/VOP_RDWR.9 @@ -1,226 +1,227 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_RDWR.9,v 1.3 1997/03/04 10:02:18 dfr Exp $ +.\" $Id: VOP_RDWR.9,v 1.4 1997/03/07 03:32:27 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_RDWR 9 .Sh NAME .Nm VOP_READ , .Nm VOP_WRITE .Nd read or write a file .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_READ "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred" .Ft int .Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred" .Sh DESCRIPTION These entry points read or write the contents of a file .Pp The arguments are: .Bl -tag -width ioflag .It Ar vp the vnode of the file .It Ar uio the location of the data to be read or written .It Ar ioflag various flags .It Ar cnp the credentials of the caller .El .Pp The .Fa ioflag argument is a bit mask which can contain the following flags: .Bl -tag -width IO_NODELOCKED .It Dv IO_UNIT do I/O as atomic unit .It Dv IO_APPEND append write to end .It Dv IO_SYNC do I/O synchronously .It Dv IO_NODELOCKED underlying node already locked .It Dv IO_NDELAY .Dv FNDELAY flag set in file table .It Dv IO_VMIO data already in VMIO space .El .Sh LOCKS The file should be locked on entry and will still be locked on exit. .Sh RETURN VALUES Zero is returned on success, otherwise an error code is returned. .Sh PSEUDOCODE .Bd -literal int vop_read(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) { struct buf *bp; off_t bytesinfile; daddr_t lbn, nextlbn; long size, xfersize, blkoffset; int error; size = block size of filesystem; for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { bytesinfile = size of file - uio->uio_offset; if (bytesinfile <= 0) break; lbn = uio->uio_offset / size; blkoffset = uio->uio_offset - lbn * size; xfersize = size - blkoffset; if (uio->uio_resid < xfersize) xfersize = uio->uio_resid; if (bytesinfile < xfersize) xfersize = bytesinfile; error = bread(vp, lbn, size, NOCRED, &bp); if (error) { brelse(bp); bp = NULL; break; } /* * We should only get non-zero b_resid when an I/O error * has occurred, which should cause us to break above. * However, if the short read did not cause an error, * then we want to ensure that we do not uiomove bad * or uninitialized data. */ size -= bp->b_resid; if (size < xfersize) { if (size == 0) break; xfersize = size; } error = uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); if (error) break; bqrelse(bp); } if (bp != NULL) bqrelse(bp); return error; } int vop_write(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) { struct buf *bp; off_t bytesinfile; daddr_t lbn, nextlbn; off_t osize; long size, resid, xfersize, blkoffset; int flags; int error; osize = size of file; size = block size of filesystem; resid = uio->uio_resid; if (ioflag & IO_SYNC) flags = B_SYNC; else flags = 0; for (error = 0; uio->uio_resid > 0;) { lbn = uio->uio_offset / size; blkoffset = uio->uio_offset - lbn * size; xfersize = size - blkoffset; if (uio->uio_resid < xfersize) xfersize = uio->uio_resid; if (uio->uio_offset + xfersize > size of file) vnode_pager_setsize(vp, uio->uio_offset + xfersize); if (size > xfersize) flags |= B_CLRBUF; else flags &= ~B_CLRBUF; error = find_block_in_file(vp, lbn, blkoffset + xfersize, cred, &bp, flags); if (error) break; if (uio->uio_offset + xfersize > size of file) set size of file to uio->uio_offset + xfersize; error = uiomove((char *)bp->b_data + blkoffset, (int) xfersize, uio); /* XXX ufs does not check the error here. Why? */ if (ioflag & IO_VMIO) bp->b_flags |= B_RELBUF; /* ??? */ if (ioflag & IO_SYNC) bwrite(bp); else if (xfersize + blkoffset == size) bawrite(bp); else bdwrite(bp); if (error || xfersize == 0) break; } if (error) { if (ioflag & IO_UNIT) { VOP_TRUNCATE(vp, osize, ioflag & IO_SYNC, cred, uio->uio_procp); uio->uio_offset -= resid - uio->uio_resid; uio->uio_resid = resid; } } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { struct timeval tv; error = VOP_UPDATE(vp, &tv, &tv, 1); /* XXX what does this do? */ } return error; } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er ENOSPC The filesystem is full. .El .Sh SEE ALSO .Xr vnode 9 , .Xr uiomove 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_READLINK.9 b/share/man/man9/VOP_READLINK.9 index 59ee91e8a99f..f4498da9a754 100644 --- a/share/man/man9/VOP_READLINK.9 +++ b/share/man/man9/VOP_READLINK.9 @@ -1,80 +1,81 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_READLINK.9,v 1.2 1997/03/04 10:02:31 dfr Exp $ +.\" $Id: VOP_READLINK.9,v 1.3 1997/03/07 03:32:29 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_READLINK 9 .Sh NAME .Nm VOP_READLINK .Nd read the target of a symbolic link .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_READLINK "struct vnode *vp" "struct uio *uio" "struct ucred *cred" .Sh DESCRIPTION This reads the target pathname of a symbolic link .Bl -tag -width uio .It Ar vp the vnode of the symlink .It Ar uio the location of the data to be read or written .It Ar cnp the credentials of the caller .El .Sh LOCKS The vnode should be locked on entry and will still be locked on exit. .Sh RETURN VALUES Zero is returned on success, otherwise an error code is returned. .Sh PSEUDOCODE .Bd -literal int vop_readlink(struct vnode *vp, struct uio *uio, struct ucred *cred) { int error = 0; /* * Read the target of the symlink. */ ...; return error; } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er EIO a read error occurred while reading the contents of the symlink .El .Sh SEE ALSO .Xr vnode 9 , .Xr uiomove 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_REALLOCBLKS.9 b/share/man/man9/VOP_REALLOCBLKS.9 index 75571a18f79c..f21a020efb8d 100644 --- a/share/man/man9/VOP_REALLOCBLKS.9 +++ b/share/man/man9/VOP_REALLOCBLKS.9 @@ -1,60 +1,61 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_REALLOCBLKS.9,v 1.1 1997/03/03 18:00:35 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_REALLOCBLKS 9 .Sh NAME .Nm VOP_REALLOCBLKS .Nd rearrange blocks in a file to be contiguous .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_REALLOCBLKS "struct vnode *vp" "struct cluster_save *buflist" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width buflist .It Ar vp the file to manipulate .It Ar buflist a list of buffers to rearrange .El .Pp This seems to be part of a work in progress. .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO .Xr vnode 9 , .Xr buf 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_REMOVE.9 b/share/man/man9/VOP_REMOVE.9 index 3a87da2f2000..958100f58d91 100644 --- a/share/man/man9/VOP_REMOVE.9 +++ b/share/man/man9/VOP_REMOVE.9 @@ -1,107 +1,108 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_REMOVE.9,v 1.2 1997/03/04 10:02:36 dfr Exp $ +.\" $Id: VOP_REMOVE.9,v 1.3 1997/03/07 03:32:29 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_REMOVE 9 .Sh NAME .Nm VOP_REMOVE , .Nm VOP_RMDIR .Nd remove a file or directory .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_REMOVE "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp" .Ft int .Fn VOP_RMDIR "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp" .Sh DESCRIPTION These entry points remove files and directories respectively. .Pp The arguments are: .Bl -tag -width dvp .It Ar dvp the vnode of the directory .It Ar vp the vnode of the file to be removed .It Ar cnp pathname information about the file .El .Sh LOCKS Both .Fa dvp and .Fa vp should be locked on entry and are unlocked and released on exit. .Sh RETURN VALUES Zero is returned on success, otherwise an error code is returned. .Sh PSEUDOCODE .Bd -literal int vop_remove(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) { int error = 0; if (vp is immutable) { error = EPERM; goto out; } /* * Remove name cnp->cn_nameptr from directory and update link count * of vp. */ ...; /* * Careful about trying to remove ".". XXX this should be handled * higher up. */ if (dvp == vp) vrele(vp); else vput(vp); vput(dvp); return error; } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er EPERM the file is immutable .It Bq Er ENOTEMPTY attempt to remove a directory which is not empty .El .Sh SEE ALSO .Xr vnode 9 , .Xr VOP_LOOKUP 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_RENAME.9 b/share/man/man9/VOP_RENAME.9 index cab2d6548220..460d6b74462d 100644 --- a/share/man/man9/VOP_RENAME.9 +++ b/share/man/man9/VOP_RENAME.9 @@ -1,306 +1,307 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_RENAME.9,v 1.3 1997/03/04 10:02:40 dfr Exp $ +.\" $Id: VOP_RENAME.9,v 1.4 1997/03/07 03:32:30 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_RENAME 9 .Sh NAME .Nm VOP_RENAME .Nd rename a file .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_RENAME "struct vnode *fdvp" "struct vnode *fvp" "struct componentname *fcnp" "struct vnode *tdvp" "struct vnode *tvp" "struct componentname *tcnp" .Sh DESCRIPTION This renames a file and possibly changes its parent directory. If the destination object exists, it will be removed first. .Pp Its arguments are: .Bl -tag -width fdvp .It Ar fdvp the vnode of the old parent directory .It Ar fvp the vnode of the file to be renamed .It Ar fcnp pathname information about the file's current name .It Ar tdvp the vnode of the new parent directory .It Ar tvp the vnode of the target file (if it exists) .It Ar tcnp pathname information about the file's new name .El .Sh LOCKS The destination directory and file (if it exists) should be locked on entry. The source directory and file will be released on exit. The destination directory and file (if it exists) will be unlocked and released on exit. .Sh PSEUDOCODE .Bd -literal int vop_rename(struct vnode *fdvp, struct vnode *fvp, struct componentname *fcnp, struct vnode *tdvp, struct vnode *tvp, struct componentname *tcnp) { int doingdirectory = 0; int error = 0; /* * Check for cross-device rename. */ if (fvp->v_mount != tdvp->v_mount) { error = EXDEV; abortit: VOP_ABORTOP(tdvp, tcnp); if (tdvp == tvp) vrele(tdvp); else vput(tdvp); if (tvp) vput(tvp); VOP_ABORTOP(fdvp, fcnp); vrele(fdvp); vrele(fvp); return error; } if (tvp exists and is immutable) { error = EPERM; goto abortit; } /* * Check if just deleting a link name. */ if (fvp == tvp) { if (fvp->v_type == VDIR) { error = EINVAL; goto abortit; } /* * Release destination. */ VOP_ABORTOP(tdvp, tcnp); vput(tdvp); vput(tvp); /* * Delete source. Pretty bizarre stuff. */ vrele(fdvp); vrele(fvp); fcnp->cn_flags &= ~MODMASK; fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; fcnp->cn_nameiop = DELETE; VREF(fdvp); error = relookup(fdvp, &fvp, fcnp); if (error == 0) vrele(fdvp); return VOP_REMOVE(fdvp, fvp, fcnp); } if (fvp is immutable) { error = EPERM; goto abortit; } error = VOP_LOCK(fvp); if (error) goto abortit; if (vp is a directory) { /* * Avoid ".", "..", and aliases of "." for obvious reasons. */ if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') || fdvp == fvp || ((fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT)) { VOP_UNLOCK(fvp); error = EINVAL; goto abortit; } doingdirectory = 1; } vrele(fdvp); /* * Bump link count on fvp while we are moving stuff around. If we * crash before completing the work, the link count may be wrong * but correctable. */ ...; /* * If ".." must be changed (ie the directory gets a new * parent) then the source directory must not be in the * directory hierarchy above the target, as this would * orphan everything below the source directory. Also * the user must have write permission in the source so * as to be able to change "..". */ error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc); VOP_UNLOCK(fvp); if (doingdirectory && fdvp != tdvp) { /* * Check for pathname conflict. */ ...; } /* * If the target doesn't exist, link the target to the source and * unlink the source. Otherwise, rewrite the target directory to * reference the source and remove the original entry. */ if (tvp == NULL) { /* * Account for ".." in new directory. */ if (doingdirectory && fdvp != tdvp) { /* * Increase link count of tdvp. */ ...; } /* * Add name in new directory. */ ...; if (error) { if (doingdirectory && fdvp != tdvp) { /* * Decrease link count if tdvp. */ ...; } goto bad; } vput(tdvp); } else { /* * Target must be empty if a directory and have no links * to it. Also, ensure source and target are compatible * (both directories, or both not directories). */ if (tvp is a directory) { if (tvp is not empty) { error = ENOTEMPTY; goto bad; } if (!doingdirectory) { error = ENOTDIR; goto bad; } /* * Update name cache since directory is going away. */ cache_purge(tdvp); } else if (doingdirectory) { error = ENOTDIR; goto bad; } /* * Change name tcnp in tdvp to point at fvp. */ ...; /* * If the target directory is in same directory as the source * directory, decrement the link count on the parent of the * target directory. This accounts for the fact that a * directory links back to its parent with "..". */ if (doingdirectory && fdvp == tdvp) { /* * Decrement link count of tdvp. */ ...; } vput(tdvp); /* * Decrement the link count of tvp since the directory no * longer points at it. */ ...; if (doingdirectory) { /* * Clean up the old directory tvp. */ ...; } vput(tvp); } /* * Unlink the source. If a directory was moved to a new parent, * update its ".." entry. Gobs of ugly UFS code omitted here. */ ...; bad: if (tvp) vput(tvp); vput(tdvp); out: if (VOP_LOCK(fvp) == 0) { /* * Decrement link count of fvp. */ ...; vput(fvp); } else vrele(fvp); return error; } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er EPERM the file is immutable .It Bq Er EXDEV cross device move .It Bq Er EINVAL illegal directory rename .It Bq Er ENOTDIR attempt to rename a directory to a file or vice versa .It Bq Er ENOTEMPTY attempt to remove a directory which is not empty .El .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_SEEK.9 b/share/man/man9/VOP_SEEK.9 index 2f9e51fd2997..90b2240af159 100644 --- a/share/man/man9/VOP_SEEK.9 +++ b/share/man/man9/VOP_SEEK.9 @@ -1,72 +1,73 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_SEEK.9,v 1.1 1997/03/03 18:00:40 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_SEEK .Sh NAME .Nm VOP_SEEK .Nd seek to a given location in a file .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_SEEK "struct vnode *vp" "off_t oldoff" "off_t newoff" "struct ucred *cred" .Sh DESCRIPTION This seeks to a given location in a file, possibly extending the file. Most filesystems do not implement this entry point and automatically extend the file when it is written to. In fact, the only place in the entire kernel where this is called is from the union filesystem and then only to implement its own VOP_SEEK entry point. .Pp Its arguments are: .Bl -tag -width 8X .It Ar vp the vnode of the file .It Ar oldoff an offset .It Ar newoff another offset .It Ar cred the caller's credentials .El .Sh PSEUDOCODE .Bd -literal int vop_seek(struct vnode *vp, off_t oldoff, off_t newoff, struct ucred *cred) { return 0; } .Ed .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_SELECT.9 b/share/man/man9/VOP_SELECT.9 index f627a0ba4362..07f9b528d976 100644 --- a/share/man/man9/VOP_SELECT.9 +++ b/share/man/man9/VOP_SELECT.9 @@ -1,77 +1,78 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: VOP_SELECT.9,v 1.2 1997/03/04 10:02:44 dfr Exp $ +.\" $Id: VOP_SELECT.9,v 1.3 1997/03/07 03:32:31 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_SELECT 9 .Sh NAME .Nm VOP_SELECT .Nd wait for I/O to be possible .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_SELECT "struct vnode *vp" "int which" "int fflags" "struct ucred *cred" "struct proc *p" .Sh DESCRIPTION Wait until I/O is possible on a file. .Pp Its arguments are: .Bl -tag -width fflags .It Ar vp the vnode of the file .It Ar which the type of I/O to wait for .It Ar fflags some flags ??? .It Ar cred the caller's credentials .It Ar p the calling process .El .Sh PSEUDOCODE .Bd -literal int vop_select(struct vnode *vp, int which, int fflags, struct ucred *cred, struct proc *p) { return 1; } .Ed .Sh ERRORS .Bl -tag -width Er .It Bq Er ENOSPC The filesystem is full. .It Bq Er EDQUOT Quota exceeded. .El .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_STRATEGY.9 b/share/man/man9/VOP_STRATEGY.9 index 1ce3dac31321..daff69338543 100644 --- a/share/man/man9/VOP_STRATEGY.9 +++ b/share/man/man9/VOP_STRATEGY.9 @@ -1,59 +1,60 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_STRATEGY.9,v 1.1 1997/03/03 18:00:45 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_STRATEGY 9 .Sh NAME .Nm VOP_STRATEGY .Nd read or write a filesystem buffer .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft int .Fn VOP_STRATEGY "struct buf *bp" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width bp .It Ar bp the buffer to be read or written .El .Pp This call either reads or writes data from a file, depending on the value of .Fa bp->b_flags . .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO .Xr vnode 9 , .Xr buf 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_TRUNCATE.9 b/share/man/man9/VOP_TRUNCATE.9 index db6b8e5914ae..45253ccdf93c 100644 --- a/share/man/man9/VOP_TRUNCATE.9 +++ b/share/man/man9/VOP_TRUNCATE.9 @@ -1,77 +1,78 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_TRUNCATE.9,v 1.1 1997/03/03 18:00:47 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_TRUNCATE 9 .Sh NAME .Nm VOP_TRUNCATE .Nd truncate a file .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_TRUNCATE "struct vnode *vp" "off_t length" "int flags" "struct ucred *cred" "struct proc *p" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width length .It Ar vp The file to truncate. .It Ar length The desired new length of the file. .It Ar flags Flags controlling I/O. .It Ar cred Credentials of the caller. .It Ar p Current process. .El .Pp The size of file .Fa vp is set to .Fa length . The file can be both truncated and extended by this call. If .Fa flags contains the value .Dv IO_SYNC then all writes to the filesystem should complete before the call returns. This call is used internally by the UFS filesystem as part of its implementation of .Xr VOP_SETATTR 9 . .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO .Xr vnode 9 , .Xr VOP_SETATTR 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_UPDATE.9 b/share/man/man9/VOP_UPDATE.9 index b2e6fa26946a..9dc8a7f88a1c 100644 --- a/share/man/man9/VOP_UPDATE.9 +++ b/share/man/man9/VOP_UPDATE.9 @@ -1,65 +1,66 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_UPDATE.9,v 1.1 1997/03/03 18:00:50 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_UPDATE 9 .Sh NAME .Nm VOP_UPDATE .Nd update the on-disc version of a vnode .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_UPDATE "struct vnode *vp" "struct timeval *access" "struct timeval *modify" "int waitfor" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width waitfor .It Ar vp The file to update. .It Ar access The new accessed time for the file. .It Ar modify The new modified time for the file. .It Ar waitfor Wait for I/O to complete if true. .El .Pp The accessed and modified of the file are set and the on-disc version of the vnode is updated. This call is used internally by the UFS filesystem. .Sh RETURN VALUES Zero is returned on success, otherwise an error is returned. .Sh SEE ALSO .Xr vnode 9 , .Xr VOP_SETATTR 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_VALLOC.9 b/share/man/man9/VOP_VALLOC.9 index f9feaa9e59e3..90c822bd012a 100644 --- a/share/man/man9/VOP_VALLOC.9 +++ b/share/man/man9/VOP_VALLOC.9 @@ -1,63 +1,64 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: VOP_VALLOC.9,v 1.1 1997/03/03 18:00:52 dfr Exp $ .\" .Dd July 24, 1996 .Os .Dt VOP_VALLOC 9 .Sh NAME .Nm VOP_VALLOC , .Nm VOP_VFREE .Nd Allocate a new inode in the filesystem. .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int .Fn VOP_VALLOC "struct vnode *pvp" "int mode" "struct ucred *cred" "struct vnode **vpp" .Ft int .Fn VOP_VFREE "struct vnode *pvp" "ino_t ino" "int mode" .Sh DESCRIPTION .Pp The arguments are: .Bl -tag -width mdoe .It Ar pvp The parent directory of the new vnode. .It Ar mode The mode and type of the new vnode. .It Ar cred The credentials of the caller. .It Ar vpp Return parameter for the new vnode. .El .Pp These calls are used internally by the UFS filesystem to allocate and free filesystem resources. .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/at_exit.9 b/share/man/man9/at_exit.9 index 30ce0c438d00..10cc298b8a5b 100644 --- a/share/man/man9/at_exit.9 +++ b/share/man/man9/at_exit.9 @@ -1,79 +1,80 @@ .\" .\" Copyright (c) 1996 Julian Elischer .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: at_exit.9,v 1.6 1997/02/22 13:26:21 peter Exp $ .\" " .Dd August 15, 1996 .Os .Dt AT_EXIT 9 .Sh NAME .Nm at_exit , .Nm rm_at_exit .Nd ask that a function be run at exit. .Sh SYNOPSIS +.Fd #include .Fd #include .Ft typedef void \*(lp*exitlist_fn\*(rp \*(lpstruct proc *\*(rp; .Ft int .Fn at_exit "exitlist_fn func" .Ft int .Fn rm_at_exit "exitlist_fn func" .Sh DESCRIPTION The .Nm at_exit facility allows a kernel module to ensure that it is notified at any process exit. The function .Fa func is called with the a pointer to the exiting process's proc structure. .Pp If the requirement for notification is removed, then the function .Fn rm_at_exit must be called with the exact .Fa func argument as the corresponding call to .Fn at_exit . .Pp .Sh RETURN VALUES The .Fa at_exit function returns an errno, 0 meaning success. The .Fn rm_at_exit function returns the number of items removed (should be 0 or 1). .Sh SEE ALSO .Xr _exit 2 .Sh HISTORY The .Fn at_exit function appeared in .Fx 2.2 . .Sh BUGS Since the exit queue is not sorted and items are added to the head, order of execution is reversed to that of insertion. .Sh AUTHORS The function was written by .ie Julian Elischer (julian@freebsd.org) .el Julian Elischer (julian@freebsd.org) diff --git a/share/man/man9/at_fork.9 b/share/man/man9/at_fork.9 index 608936595de7..5e176461f859 100644 --- a/share/man/man9/at_fork.9 +++ b/share/man/man9/at_fork.9 @@ -1,81 +1,82 @@ .\" .\" Copyright (c) 1996 Julian Elischer .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: at_fork.9,v 1.5 1997/02/22 13:26:22 peter Exp $ .\" " .Dd August 15, 1996 .Os .Dt AT_FORK 9 .Sh NAME .Nm at_fork , .Nm rm_at_fork .Nd ask that a function be run at fork. .Sh SYNOPSIS +.Fd #include .Fd #include .Ft typedef void \*(lp*forklist_fn\*(rp \*(lpstruct proc*, struct proc*, int\*(rp; -.Ft void +.Ft int .Fn at_fork "forklist_fn func" -.Ft void +.Ft int .Fn rm_at_fork "forklist_fn func" .Sh DESCRIPTION The .Nm at_fork facility allows a kernel module to ensure that it is notified at any process fork. The function .Fa func is called with the a pointer to the forking process's proc structure, a pointer to the child's process structure and a flag word, as used in .Xr rfork 2 to indicate the type of fork. .Pp If the requirement for notification is removed, then the function .Fn rm_at_fork must be called with the exact .Fa func argument as the corresponding call to .Fn at_fork . .Pp .Sh RETURN VALUES .Fn at_fork returns an errno, 0 meaning success. .Fn rm_at_fork returns the number of items removed (should be 0 or 1). .Sh SEE ALSO .Xr fork 2 .Sh HISTORY The .Fn at_fork function appeared in .Fx 2.2 . .Sh BUGS Since the fork queue is not sorted and items are added to the head, order of execution is reversed to that of insertion. .Sh AUTHORS The function was written by .ie Julian Elischer (julian@freebsd.org) .el Julian Elischer (julian@freebsd.org) diff --git a/share/man/man9/at_shutdown.9 b/share/man/man9/at_shutdown.9 index 733961243936..08463702dc7f 100644 --- a/share/man/man9/at_shutdown.9 +++ b/share/man/man9/at_shutdown.9 @@ -1,98 +1,98 @@ .\" .\" Copyright (c) 1996 Julian Elischer .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: at_shutdown.9,v 1.9 1997/02/22 13:26:23 peter Exp $ .\" " .Dd August 15, 1996 .Os .Dt AT_SHUTDOWN 9 .Sh NAME .Nm at_shutdown , .Nm rm_at_shutdown .Nd ask that a function be run at shutdown. .Sh SYNOPSIS -.Fd #include +.Fd #include .Fd #include .Fd #include .Ft typedef void \*(lp*bootlist_fn\*(rp\*(lpint howto, void *arg\*(rp .Ft int .Fn at_shutdown "bootlist_fn func" "void *arg" "int when" .Ft int .Fn rm_at_shutdown "bootlist_fn func" "void *arg" .Sh DESCRIPTION The .Nm at_shutdown facility allows a kernel module to ensure that it is notified at system shutdown. The function .Fa func is called with the flags indicating boot type, and the opaque argument .Fa arg when the system is shut down. .Pp If the requirement for notification is removed, then the function .Fn rm_at_shutdown must be called with the exact .Fa func and .Fa arg arguments as the corresponding call to .Fn at_shutdown . There are two shutdown queues, one run before the final sync and one after. The last argument to .Fa at_shutdown should be one of .Dv SHUTDOWN_PRE_SYNC or .Dv SHUTDOWN_POST_SYNC to specify which queue should be used. .Fn rm_at_shutdown will remove an entry from either queue. .Pp .Sh RETURN VALUES .Fn at_shutdown returns an error code, 0 meaning success. .Fn rm_at_shutdown returns the number of items removed (should be 0 or 1). .Sh SEE ALSO .Xr reboot 2 , .Xr boot 9 .Sh HISTORY The .Fn at_shutdown and .Fn rm_shutdown functions appeared in .Fx 2.2 . .Sh BUGS Since the shutdown queue is not sorted and items are added to the head, order of execution is reversed to that of insertion. .Sh AUTHORS The function was written by .ie t Julian Elischer (julian@freebsd.org) .el Julian Elischer (julian@freebsd.org) diff --git a/share/man/man9/copy.9 b/share/man/man9/copy.9 index c8c57c31e8f3..8f80a14c57a8 100644 --- a/share/man/man9/copy.9 +++ b/share/man/man9/copy.9 @@ -1,130 +1,130 @@ .\" $NetBSD: copy.9,v 1.2 1996/01/09 03:23:04 thorpej Exp $ .\" .\" Copyright (c) 1996 Jason R. Thorpe. .\" All rights reserved. .\" .\" This code is derived from software contributed by Kenneth Stailey. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed for the NetBSD Project .\" by Jason R. Thorpe. .\" 4. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .Dd Jan 7, 1996 .Dt COPY 9 .Os FreeBSD .Sh NAME .Nm copy , .Nm copyin , .Nm copyout , .Nm copystr , .Nm copyinstr .Nd kernel copy functions .Sh SYNOPSIS .Fd #include .Fd #include .Ft int -.Fn copyin "void *uaddr" "void *kaddr" "size_t len" +.Fn copyin "const void *uaddr" "void *kaddr" "size_t len" .Ft int -.Fn copyout "void *kaddr" "void *uaddr" "size_t len" +.Fn copyout "const void *kaddr" "void *uaddr" "size_t len" .Ft int -.Fn copystr "void *kfaddr" "void *kdaddr" "size_t len" "size_t *done" +.Fn copystr "const void *kfaddr" "void *kdaddr" "size_t len" "size_t *done" .Ft int -.Fn copyinstr "void *uaddr" "void *kaddr" "size_t len" "size_t *done" +.Fn copyinstr "const void *uaddr" "void *kaddr" "size_t len" "size_t *done" .\" .Ft int -.\" .Fn copyoutstr "void *kaddr" "void *uaddr" "size_t len" "size_t *done" +.\" .Fn copyoutstr "const void *kaddr" "void *uaddr" "size_t len" "size_t *done" .Sh DESCRIPTION The .Nm functions are designed to copy contiguous data from one address to another. All but .Fn copystr copy data from user-space to kernel-space or vice-versa. .Pp The .Nm routines provide the following functionality: .Bl -tag -width "copyoutstr()" .It Fn copyin Copies .Pa len bytes of data from the user-space address .Pa uaddr to the kernel-space address .Pa kaddr . .It Fn copyout Copies .Pa len bytes of data from the kernel-space address .Pa kaddr to the user-space address .Pa uaddr . .It Fn copystr Copies a NULL-terminated string, at most .Pa len bytes long, from kernel-space address .Pa kfaddr to kernel-space address .Pa kdaddr . The number of bytes actually copied, including the terminating NULL, is returned in .Pa *done . .It Fn copyinstr Copies a NULL-terminated string, at most .Pa len bytes long, from user-space address .Pa uaddr to kernel-space address .Pa kaddr . The number of bytes actually copied, including the terminating NULL, is returned in .Pa *done . .\" .It Fn copyoutstr .\" Copies a NULL-terminated string, at most .\" bytes long, from kernel-space address .\" .Pa kaddr .\" to user-space address .\" .Pa uaddr . .\" The number of bytes actually copied, including the terminating .\" NULL, is returned in .\" .Pa *done . .El .Sh RETURN VALUES The .Nm functions return 0 on success or EFAULT if a bad address is encountered. In addition, the .Fn copystr , and .Fn copyinstr .\" .Fn copyinstr , .\" and .\" .Fn copyoutstr functions return ENAMETOOLONG if the string is longer than .Pa len bytes. .Sh SEE ALSO .Xr fetch 9 , .Xr store 9 . diff --git a/share/man/man9/devfs_add_devswf.9 b/share/man/man9/devfs_add_devswf.9 index 7b29ce973f9e..7199b9985113 100644 --- a/share/man/man9/devfs_add_devswf.9 +++ b/share/man/man9/devfs_add_devswf.9 @@ -1,77 +1,78 @@ .\" .\" Copyright (c) 1995 Joerg Wunsch .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: devfs_add_devswf.9,v 1.4 1997/02/22 13:26:23 peter Exp $ .\" .Dd December 31, 1995 .Os FreeBSD .Dt DEVFS_ADD_DEVSWF 9 .Sh NAME .Nm devfs_add_devswf .Nd wire device into devswitch table .Sh SYNOPSIS +.Fd #include .Fd #include .Ft void * -.Fn devfs_add_devswf "void *devsw" "int minor" "int chrblk" "uid_t uid" "gid_t gid" "int perms" "char *fmt" "..." +.Fn devfs_add_devswf "void *devsw" "int minor" "int chrblk" "uid_t uid" "gid_t gid" "int perms" "char *fmt" ... .Sh DESCRIPTION The call that adds an entry into devfs is .Nm devfs_add_devswf . .Pp It's arguments are: .Bl -tag -width 8X .It Ar devsw the address of the devsw entry the name should access .It Ar minor the minor number .It Ar chrblk whether the device is CHAR or BLK .It Ar uid Owner UID .It Ar gid Owner GID .It Ar perms Permissions (e.g. rwxr--r-- = 0744) .It Ar fmt Formatted string including name, and, if applicable, path to device within DEVFS .El .Sh RETURN VALUES It returns a token that can be used to link another name to the same device .Pq see Xr devfs_link 9 , or destroy the device. .Sh SEE ALSO .Xr devfs_link 9 .Sh HISTORY The function .Nm appeared in .Fx 2.2 . .Sh AUTHORS This man page has been written by .if t J\(:org Wunsch .if n Joerg Wunsch after a description from Julian Elischer. diff --git a/share/man/man9/devfs_link.9 b/share/man/man9/devfs_link.9 index 2812dd8efe38..2d4c84b10029 100644 --- a/share/man/man9/devfs_link.9 +++ b/share/man/man9/devfs_link.9 @@ -1,62 +1,62 @@ .\" .\" Copyright (c) 1995 Joerg Wunsch .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: devfs_link.9,v 1.6 1997/02/22 13:26:24 peter Exp $ .\" .Dd December 31, 1995 .Os FreeBSD .Dt DEVFS_LINK 9 .Sh NAME .Nm devfs_link .Nd make a hard link for a devfs entry .Sh SYNOPSIS .Fd #include .Ft void * -.Fn devfs_link "void *original" "char *fmt" "..." +.Fn devfs_link "void *original" "char *fmt" ... .Sh DESCRIPTION The function .Nm takes a token from a previous call to .Fn devfs_add_devswf or .Fn devfs_link as argument, and links it to an alias location denoted by .Ar fmt string. .Sh RETURN VALUES It returns a token for the newly linked devfs entry. .Sh SEE ALSO .Xr devfs_add_devswf 9 .Sh HISTORY The function .Nm appeared in .Fx 2.2 . .Sh AUTHORS This man page has been written by .if t J\(:org Wunsch. .if n Joerg Wunsch. diff --git a/share/man/man9/fetch.9 b/share/man/man9/fetch.9 index 6e9ab58ef1b4..96dde020aa0f 100644 --- a/share/man/man9/fetch.9 +++ b/share/man/man9/fetch.9 @@ -1,85 +1,86 @@ .\" $NetBSD: fetch.9,v 1.2 1996/01/09 21:59:24 perry Exp $ .\" .\" Copyright (c) 1996 Jason R. Thorpe. .\" All rights reserved. .\" .\" This code is derived from software contributed by Kenneth Stailey. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed for the NetBSD Project .\" by Jason R. Thorpe. .\" 4. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .Dd Jan 7, 1996 .Dt FETCH 9 .Os FreeBSD .Sh NAME .Nm fetch , .Nm fubyte , .Nm fusword , .Nm fuswintr , .Nm fuword .Nd fetch data from user-space .Sh SYNOPSIS .Fd #include .Fd #include +.Fd #include .Ft int -.Fn fubyte "void *base" +.Fn fubyte "const void *base" .Ft int .Fn fusword "void *base" .Ft int .Fn fuswintr "void *base" .Ft int -.Fn fuword "void *base" +.Fn fuword "const void *base" .Sh DESCRIPTION The .Nm functions are designed to copy small amounts of data from user-space. .Pp The .Nm routines provide the following functionality: .Bl -tag -width "fuswintr()" .It Fn fubyte Fetches a byte of data from the user-space address .Pa base . .It Fn fusword Fetches a short word of data from the user-space address .Pa base . .It Fn fuswintr Fetches a short word of data from the user-space address .Pa base . This function is safe to call during an interrupt context. .It Fn fuword Fetches a word of data from the user-space address .Pa base . .El .Sh RETURN VALUES The .Nm functions return the data fetched or -1 on failure. .Sh SEE ALSO .Xr copy 9 , .Xr store 9 . diff --git a/share/man/man9/inittodr.9 b/share/man/man9/inittodr.9 index a4a9b5bf5316..eddb8eec173e 100644 --- a/share/man/man9/inittodr.9 +++ b/share/man/man9/inittodr.9 @@ -1,119 +1,121 @@ .\" $NetBSD: inittodr.9,v 1.2 1996/03/27 21:16:06 jtc Exp $ .\" .\" Copyright (c) 1994 Christopher G. Demetriou .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by Christopher G. Demetriou .\" for the NetBSD Project. .\" 3. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .Dd March 22, 1997 .Dt INITTODR 9 .Os FreeBSD .Sh NAME .Nm inittodr .Nd initialize system time .Sh SYNOPSIS +.Fd #include +.Fd #include .Ft void .Fn inittodr "time_t base" .Sh DESCRIPTION The .Fn inittodr function determines the time and sets the system clock. It tries to pick the correct time using a set of heuristics that examine the system's battery backed clock and the time obtained from the root file system, as given in .Fa base . How the .Fa base value is obtained will vary depending on the root file system type. The heuristics used include: .Bl -bullet .It If the battery-backed clock has a valid time, it is used. .\" .It .\" If the battery-backed clock does not have a valid time, and .\" the time provided in .\" .Fa base .\" is within reason, .\" .Fa base .\" is used as the current time. .\" .It .\" If the battery-backed clock appears invalid, and .\" .Fa base .\" appears non-sensical or was not provided (was given as zero), .\" a arbitrary base (typically some time in the late 1970s) .\" will be used. .It If the battery-backed clock does not have a valid time, the time provided in .Fa base will be used. .El .Pp Once a system time has been determined, it is stored in the .Va time variable. .Sh DIAGNOSTICS The .Fn inittodr function prints diagnostic messages if it has trouble figuring out the system time. Conditions that can cause diagnostic messages to be printed include: .Bl -bullet .It The battery-backed clock's time appears nonsensical. .\" .It .\" The .\" .Fa base .\" time appears nonsensical. .\" .It .\" The .\" .Fa base .\" time and the battery-backed clock's time differ by a large amount. .El .Sh SEE ALSO .Xr resettodr 9 , .Xr time 9 .Sh BUGS On many systems, .Fn inittodr has to convert from a time expressed in terms of year, month, day, hours, minutes, and seconds to .Va time , expressed in seconds. Many of the implementations could share code, but do not. .Pp Each system's heuristics for picking the correct time are slightly different. .Pp The .Tn FreeBSD implementation should do a better job of validating the time provided in .Fa base when the battery-backed clock is unusable. Currently it unconditionally sets the system clock to this value. diff --git a/share/man/man9/kernacc.9 b/share/man/man9/kernacc.9 index 03bbd7bde2f9..cd0abb5d5941 100644 --- a/share/man/man9/kernacc.9 +++ b/share/man/man9/kernacc.9 @@ -1,81 +1,84 @@ .\" $NetBSD: access.9,v 1.1 1996/06/16 10:38:35 pk Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation .\" by Paul Kranenburg. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the NetBSD .\" Foundation, Inc. and its contributors. .\" 4. Neither the name of The NetBSD Foundation nor the names of its .\" contributors may be used to endorse or promote products derived .\" from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd June 16, 1996 .Dt KERNACC 9 .Os FreeBSD .Sh NAME .Nm kernacc , .Nm useracc .Nd check memory regions for accessibility .Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include .Ft int .Fn kernacc "caddr_t addr" "int len" "int rw" .Ft int .Fn useracc "caddr_t addr" "int len" "int rw" .Sh DESCRIPTION The .Fn kernacc and .Fn useracc functions check whether operations of the type specified in .Fa rw are permitted in the range of virtual addresses given by .Fa addr and .Fa len . The possible values of .Fa rw are .Dv B_READ and .Dv B_WRITE . .Fn kernacc checks addresses in the kernel address space, while .Fn useracc considers .Fa addr to represent an user space address. The process context to use for this operation is taken from the global variable .Va curproc . .Pp .Sh RETURN VALUES Both functions return 1 if the type of access specified by .Fa rw is permitted. Otherwise 0 is returned. .Pp .Sh BUGS The process pointer should be passed in as an argument. diff --git a/share/man/man9/mi_switch.9 b/share/man/man9/mi_switch.9 index 103a7c5bdf4c..1a69c96ba058 100644 --- a/share/man/man9/mi_switch.9 +++ b/share/man/man9/mi_switch.9 @@ -1,141 +1,143 @@ .\" $NetBSD: ctxsw.9,v 1.2 1996/12/02 00:11:31 tls Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation .\" by Paul Kranenburg. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the NetBSD .\" Foundation, Inc. and its contributors. .\" 4. Neither the name of The NetBSD Foundation nor the names of its .\" contributors may be used to endorse or promote products derived .\" from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd Nov 24, 1996 .Dt MI_SWITCH 9 .Os FreeBSD .Sh NAME .Nm mi_switch , .Nm cpu_switch .Nd switch to another process context .Sh SYNOPSIS +.Fd #include +.Fd #include .Ft void .Fn mi_switch "void" .Ft void -.Fn cpu_switch "void" +.Fn cpu_switch "struct proc *p" .Sh DESCRIPTION The .Fn mi_switch function implements the machine independent prelude to a process context switch. It is called from only a few distinguished places in the kernel code as a result of the principle of non-preemtable kernel mode execution. The three major uses of .Nm can be enumerated as follows: .Bl -enum -offset indent .It from within .Xr sleep 9 , and .Xr tsleep 9 when the current process voluntarily relinquishes the CPU to wait for some resource to become available. .It after handling a trap .Pq e.g. a system call, device interrupt when the kernel prepares a return to user-mode execution. This case is typically handled by machine dependent trap-handling code after detection of a change in the signal disposition of the current process, or when a higher priority process might be available to run. The latter event is communicated by the machine independent scheduling routines by calling the machine defined -.Fn need_resched "void" . +.Fn need_resched . .It in the signal handling code .Pq see Xr issignal 9 if a signal is delivered that causes a process to stop. .El .Pp .Fn mi_switch records the amount of time the current process has been running in the process structure and checks this value against the CPU time limits allocated to the process .Pq see Xr getrlimit 2 . Exceeding the soft limit results in a .Dv SIGXCPU signal to be posted to the process, while exceeding the hard limit will cause a .Dv SIGKILL . After these administrative tasks are done, .Fn mi_switch hands over control to the machine dependent routine -.Fn cpu_switch "void" , +.Fn cpu_switch , which will perform the actual process context switch. .Pp .Fn cpu_switch will make a choice amongst the processes which are ready to run from a priority queue data-structure. The priority queue consists of an array .Va qs[NQS] of queue header structures each of which identifies a list of runnable processes of equal priority .Pq see Fa . A single word .Va whichqs containing a bit mask identifying non-empty queues assists in selecting a process quickly. .Fn cpu_switch must remove the first process from the list on the queue with the highest priority .Po lower indices in Va sq indicate higher priority .Pc , and assign the address of its process structure to the global variable .Dv curproc . If no processes are available on the run queues, .Fn cpu_switch shall go into an .Dq idle loop. The idle loop must allow interrupts to be taken that will eventually cause processes to appear again on the run queues. The variable .Va curproc should be .Dv NULL while .Fn cpu_switch waits for this to happen. .Pp Note that .Fn mi_switch and thus .Fn cpu_switch should be called at splhigh(). .Pp .Sh SEE ALSO .Xr issignal 9 , .Xr spl 9 , .Xr tsleep 9 , .Xr wakeup 9 .Pp diff --git a/share/man/man9/physio.9 b/share/man/man9/physio.9 index 0a633792108d..e372b90f4ac0 100644 --- a/share/man/man9/physio.9 +++ b/share/man/man9/physio.9 @@ -1,137 +1,139 @@ .\" $NetBSD: physio.9,v 1.2 1996/11/11 00:05:12 lukem Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation .\" by Paul Kranenburg. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the NetBSD .\" Foundation, Inc. and its contributors. .\" 4. Neither the name of The NetBSD Foundation nor the names of its .\" contributors may be used to endorse or promote products derived .\" from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd June 15, 1996 .Dt PHYSIO 9 .Os FreeBSD .Sh NAME .Nm physio .Nd initiate I/O on raw devices .Sh SYNOPSIS +.Fd #include +.Fd #include .Ft int -.Fo "physio" -.Fa "(*strategy)(struct buf *)" +.Fo physio +.Fa "void (*strategy)(struct buf *)" .Fa "struct buf *bp" .Fa "dev_t dev" .Fa "int flags" -.Fa "(*minphys)(struct buf *)" +.Fa "u_int (*minphys)(struct buf *)" .Fa "struct uio *uio" .Fc .Sh DESCRIPTION The .Fn physio is a helper function typically called from character device read and write routines to start I/O on a user process buffer. It calls back on the provided .Fa strategy routine one or more times to complete the transfer described by .Fa uio . The maximum amount of data to transfer with each call to .Fa strategy is determined by the .Fa minphys routine. Since .Fa uio normally describes user space addresses, .Fn physio needs to lock the process into memory. This is done by setting the .Dv P_PHYSIO flag on the process. .Fn physio always awaits the completion of the entire requested transfer before returning, unless an error condition is detected earlier. In all cases, the buffer passed in .Fa bp is locked (marked as .Dq busy ) for the duration of the entire transfer. .Pp A break-down of the arguments follows: .Bl -tag -width indent .It Fa strategy The device strategy routine to call for each chunk of data to initiate device I/O. .It Fa bp The buffer to use with the strategy routine. The buffer flags will have .Dv B_BUSY , and .Dv B_PHYS set when passed to the strategy routine. If .Dv NULL , a buffer is allocated from a system pool. .It Fa dev The device number identifying the device to interact with. .It Fa flags Direction of transfer; the only valid settings are .Dv B_READ or .Dv B_WRITE . .It Fa minphys A device specific routine called to determine the maximum transfer size that the device's strategy routine can handle. .It Fa uio The description of the entire transfer as requested by the user process. Currently, the results of passing a .Fa uio structure with the .Sq uio_segflg set to anything other than .Dv UIO_USERSPACE , are undefined. .El .Pp .Sh RETURN VALUES If successful .Fn physio returns 0. .Er EFAULT is returned if the address range described by .Fa uio is not accessible by the requesting process. .Fn physio will return any error resulting from calls to the device strategy routine, by examining the .Dv B_ERROR buffer flag and the .Va b_error field. Note that the actual transfer size may be less than requested by .Fa uio if the device signals an .Dq end of file condition. .Sh SEE ALSO .Xr read 2 , .Xr write 2 diff --git a/share/man/man9/rtalloc.9 b/share/man/man9/rtalloc.9 index db997e4b6808..f97ca51c6737 100644 --- a/share/man/man9/rtalloc.9 +++ b/share/man/man9/rtalloc.9 @@ -1,201 +1,202 @@ .\" .\" Copyright 1996 Massachusetts Institute of Technology .\" .\" Permission to use, copy, modify, and distribute this software and .\" its documentation for any purpose and without fee is hereby .\" granted, provided that both the above copyright notice and this .\" permission notice appear in all copies, that both the above .\" copyright notice and this permission notice appear in all .\" supporting documentation, and that the name of M.I.T. not be used .\" in advertising or publicity pertaining to distribution of the .\" software without specific, written prior permission. M.I.T. makes .\" no representations about the suitability of this software for any .\" purpose. It is provided "as is" without express or implied .\" warranty. .\" .\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS .\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT .\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF .\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: rtalloc.9,v 1.5 1997/02/22 13:26:25 peter Exp $ .Dd October 8, 1996 .Os .Dt RTALLOC 9 .Sh NAME .Nm rtalloc , .Nm rtalloc_ign , .Nm rtalloc1 .Nd look up a route in the kernel routing table .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Ft void .Fn rtalloc "struct route *ro" .Ft void .Fn rtalloc_ign "struct route *ro" "u_long flags" .Ft "struct rtentry *" .Fn rtalloc1 "struct sockaddr *sa" "int report" "u_long flags" .Sh DESCRIPTION The kernel uses a radix tree structure to manage routes for the networking subsystem. The .Fn rtalloc family of routines is used by protocols to query this structure for a route corresponding to a particular end-node address, and to cause certain protocol\- and interface-specific actions to take place. .\" XXX - -mdoc should contain a standard request for getting em and \" en dashes. .Pp When a route with the flag .Dv RTF_CLONING or .Dv RTF_PRCLONING is retrieved, and the action of those flags is not masked, the .Nm rtalloc facility automatically generates a new route using information in the old route as a template, and in the case of .Dv RTF_CLONING , sends an .Dv RTM_RESOLVE message to the appropriate interface-address route-management routine .Pq Fn ifa->ifa_rtrequest . .Dv RTF_PRCLONING routes are assumed to be managed by the protocol family and no resolution requests are made, but all routes generated by the cloning process retain a reference to the route from which they were generated. If the .Dv RTF_XRESOLVE flag is set, then the .Dv RTM_RESOLVE message is sent instead on the .Xr route 4 socket interface, requesting that an external program resolve the address in question and modify the route appropriately. .Pp The default interface is .Fn rtalloc . Its only argument is .Ar ro , a pointer to a .Dq Li "struct route" , which is defined as follows: .Bd -literal -offset indent struct route { struct sockaddr ro_dst; struct rtentry *ro_rt; }; .Ed Thus, this function can only be used for address families which are smaller than the default .Dq Li "struct sockaddr" . Before calling .Fn rtalloc for the first time, callers should ensure that unused bits of the structure are set to zero. On subsequent calls, .Fn rtalloc returns without performing a lookup if .Ar ro->ro_rt is non-null and the .Dv RTF_UP flag is set in the route's .Li rt_flags field. .Pp The .Fn rtalloc_ign interface can be used when the default actions of .Fn rtalloc in the presence of the .Dv RTF_CLONING and .Dv RTF_PRCLONING flags are undesired. The .Ar ro argument is the same as .Fn rtalloc , but there is additionally a .Ar flags argument, which lists the flags in the route which are to be .Em ignored (ordinarily, one or both of .Dv RTF_CLONING or .Dv RTF_PRCLONING ) . .Pp The .Fn rtalloc1 function is the most general form of .Fn rtalloc (and both of the other forms are implemented as calls to rtalloc1). It does not use the .Dq Li "struct route" , and is therefore suitable for address families which require more space than is in a traditional .Dq Li "struct sockaddr" . Instead, it takes a .Dq Li "struct sockaddr *" directly as the .Ar sa argument. The second argument, .Ar report , controls whether .Dv RTM_RESOLVE requests are sent to the lower layers when an .Dv RTF_CLONING or .Dv RTF_PRCLONING route is cloned. Ordinarily a value of one should be passed, except in the processing of those lower layers which use the cloning facility. The third argument, .Ar flags , is a set of flags to ignore, as in .Fn rtalloc_ign . .Sh RETURN VALUES The .Fn rtalloc and .Fn rtalloc_ign functions do not return a value. The .Fn rtalloc1 function returns a pointer to a routing-table entry if it succeeds, otherwise a null pointer. Lack of a route should in most cases be translated to the .Xr errno 2 value .Er EHOSTUNREACH . .Sh SEE ALSO .Xr route 4 , .Xr rtentry 9 .Sh HISTORY The .Nm rtalloc facility first appeared in .Bx 4.2 , although with much different internals. The .Fn rtalloc_ign function and the .Ar flags argument to .Fn rtalloc1 first appeared in .Fx 2.0 . .Sh AUTHOR This manual page was written by Garrett Wollman, as were the changes to implement .Dv RTF_PRCLONING and the .Fn rtalloc_ign function and the .Ar flags argument to .Fn rtalloc1 . diff --git a/share/man/man9/rtentry.9 b/share/man/man9/rtentry.9 index 848ee7b81559..c97dc446701c 100644 --- a/share/man/man9/rtentry.9 +++ b/share/man/man9/rtentry.9 @@ -1,287 +1,288 @@ .\" .\" Copyright 1996 Massachusetts Institute of Technology .\" .\" Permission to use, copy, modify, and distribute this software and .\" its documentation for any purpose and without fee is hereby .\" granted, provided that both the above copyright notice and this .\" permission notice appear in all copies, that both the above .\" copyright notice and this permission notice appear in all .\" supporting documentation, and that the name of M.I.T. not be used .\" in advertising or publicity pertaining to distribution of the .\" software without specific, written prior permission. M.I.T. makes .\" no representations about the suitability of this software for any .\" purpose. It is provided "as is" without express or implied .\" warranty. .\" .\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS .\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT .\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF .\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: rtentry.9,v 1.5 1997/02/22 13:26:26 peter Exp $ .Dd October 8, 1996 .Os .Dt RTENTRY 9 .Sh NAME .Nm rtentry .Nd structure of an entry in the kernel routing table .Sh SYNOPSIS +.Fd #include .Fd #include .Fd #include .Sh DESCRIPTION The kernel provides a common mechanism by which all protocols can store and retrieve entries from a central table of routes. Parts of this mechanism are also used to interact with user-level processes by means of a socket in the .Xr route 4 pseudo-protocol family. The .Aq Pa net/route.h header file defines the structures and manifest constants used in this facility. .Pp The basic structure a route is defined by .Dq Li struct rtentry , which includes the following fields: .Bl -tag -offset indent -width 6n .It Li "struct radix_node rt_nodes[2];" Glue used by the radix-tree routines. These members also include in their substructure the key (i.e., destination address) and mask used when the route was created. The .Fn rt_key \&rt and .Fn rt_mask \&rt macros can be used to extract this information (in the form of a .Dq Li "struct sockaddr *" ) given a .Li "struct rtentry *" . .It Li "struct sockaddr *rt_gateway;" The .Dq target of the route, which can either represent a destination in its own right (some protocols will put a link-layer address here), or some intermediate stop on the way to that destination (if the .Dv RTF_GATEWAY flag is set). .It Li "short rt_refcnt;" Route entries are reference-counted; this field indicates the number of external (to the radix tree) references. If the .Dv RTF_UP flag is not present, the .Fn rtfree function will delete the route from the radix tree when the last reference drops. .It Li "u_long rt_flags;" See below. .It Li "struct ifnet *rt_ifp;" .It Li "struct ifaddr *rt_ifa;" These two fields represent the .Dq answer , as it were, to the question posed by a route lookup; that is, they name the interface and interface address to be used in sending a packet to the destination or set of destinations which this route represents. .It Li "struct sockaddr *rt_genmask;" When the .Fn rtalloc family of functions performs a cloning operation as requested by the .Dv RTF_CLONING or .Dv RTF_PRCLONING flag, this field is used as the mask for the new route which is inserted into the table. If this field is a null pointer, then a host route is generated. .It Li "caddr_t rt_llinfo;" When the .Dv RTF_LLINFO flag is set, this field contains information specific to the link layer represented by the named interface address. (It is normally managed by the .Fn rt_ifa->ifa_rtrequest routine.) Protocols such as .Xr arp 4 use this field to reference per-destination state internal to that protocol. .It Li "struct rt_metrics rt_rmx;" See below. .It Li "struct rtentry *rt_gwroute;" This member is a reference to a route whose destination is .Li rt_gateway . It is only used for .Dv RTF_GATEWAY routes. .\" .It Dv "int (*rt_output)();" .\" See below. .It Dv "struct rtentry *rt_parent;" A reference to the route from which this route was cloned, or a null pointer if this route was not generated by cloning. See also the .Dv RTF_WASCLONED flag. .El .Pp The following flag bits are defined: .Bl -tag -offset indent -width RTF_CHAINDELETE -compact .It Dv RTF_UP The route is not deleted. .It Dv RTF_GATEWAY The route points to an intermediate destination and not the ultimate recipient; the .Li rt_gateway and .Li rt_gwroute fields name that destination. .It Dv RTF_HOST This is a host route. .It Dv RTF_REJECT The destination is presently unreachable. This should result in an .Er EHOSTUNREACH error from output routines. .It Dv RTF_DYNAMIC This route was created dynamically by .Fn rtredirect . .It Dv RTF_MODIFIED This route was modified by .Fn rtredirect . .It Dv RTF_DONE Used only in the .Xr route 4 protocol, indicating that the request was executed. .It Dv RTF_CLONING When this route is returned as a result of a lookup, automatically create a new route using this one as a template and .Li rt_genmask (if present) as a mask. .It Dv RTF_XRESOLVE When this route is returned as a result of a lookup, send a report on the .Xr route 4 interface requesting that an external process perform resolution for this route. (Used in conjunction with .Dv RTF_CLONING . ) .It Dv RTF_LLINFO Indicates that this route represents information being managed by a link layer's adaptation layer (e.g., .Tn ARP ) . .It Dv RTF_STATIC Indicates that this route was manually added by means of the .Xr route 8 command. .It Dv RTF_BLACKHOLE Requests that output sent via this route be discarded. .It Dv RTF_PROTO1 .It Dv RTF_PROTO2 .It Dv RTF_PROTO3 Protocol-specific. .It Dv RTF_PRCLONING Like .Dv RTF_CLONING , only managed by an entire protocol. (E.g., .Tn IP uses this flag to manage a per-host cache integrated with the routing table, for those destinations which do not have a link layer performing this function.) .It Dv RTF_WASCLONED Indicates that this route was generated as a result of cloning requested by the .Dv RTF_CLONING or .Dv RTF_PRCLONING flag. When set, the .Li rt_parent field indicates the route from which this one was generated. .It Dv RTF_PINNED (Reserved for future use to indicate routes which are not to be modified by a routing protocol.) .It Dv RTF_LOCAL Indicates that the destination of this route is an address configured as belonging to this system. .It Dv RTF_BROADCAST Indicates that the destination is a broadcast address. .It Dv RTF_MULTICAST Indicates that the destination is a multicast address. .El .Pp Every route has associated with it a set of metrics, defined by .Li struct rt_metrics : .Bl -tag -offset indent -width 6n .It Li "u_long rmx_locks;" Flag bits indicating which metrics the kernel is not permitted to dynamically modify. .It Li "u_long rmx_mtu;" MTU for this path. .It Li "u_long rmx_hopcount;" Number of intermediate systems on the path to this destination. .It Li "u_long rmx_expire;" The time (\*(aga la .Xr time 2 ) at which this route should expire, or zero if it should never expire. It is the responsibility of individual protocol suites to ensure that routes are actually deleted once they expire. .It Li "u_long rmx_recvpipe;" Nominally, the bandwidth-delay product for the path .Em from the destination .Em to this system. In practice, this value is used to set the size of the receive buffer (and thus the window in sliding-window protocols like .Tn TCP ) . .It Li "u_long rmx_sendpipe;" As before, but in the opposite direction. .It Li "u_long rmx_ssthresh;" The slow-start threshold used in .Tn TCP congestion-avoidance. .It Li "u_long rmx_rtt;" The round-trip time to this destination, in units of .Dv RMX_RTTUNIT per second. .It Li "u_long rmx_rttvar;" The average deviation of the round-type time to this destination, in units of .Dv RMX_RTTUNIT per second. .It Li "u_long rmx_pksent;" A count of packets successfully sent via this route. .It Li "u_long rmx_filler[4];" .\" XXX badly named Empty space available for protocol-specific information. .El .Sh SEE ALSO .Xr route 4 , .Xr route 8 , .Xr rtalloc 9 .Sh HISTORY The .Nm rtentry structure first appeared in .Bx 4.2 . The radix-tree representation of the routing table and the .Nm rt_metrics structure first appeared in .Bx 4.3 reno . The .Nm RTF_PRCLONING mechanism first appeared in .Fx 2.0 . .Sh BUGS There are a number of historical relics remaining in this interface. The .Li rt_gateway and .Li rmx_filler fields could be named better. .Pp There is some disagreement over whether it is legitimate for .Dv RTF_LLINFO to be set by any process other than .Fn rt_ifa->ifa_rtrequest . .Sh AUTHOR This manual page was written by Garrett Wollman. diff --git a/share/man/man9/scsiconf.9 b/share/man/man9/scsiconf.9 index 53948f8dbb37..064f703372e9 100644 --- a/share/man/man9/scsiconf.9 +++ b/share/man/man9/scsiconf.9 @@ -1,166 +1,166 @@ .\" Copyright (c) 1997 .\" John-Mark Gurney. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the author nor the names of any co-contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY John-Mark Gurney AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: scsiconf.9,v 1.4 1997/03/07 02:53:36 jmg Exp $ .\" .Dd January 29, 1997 .Dt SCSICONF 9 .Os FreeBSD .Sh NAME .Nm scsiconf .Nd define how certain scsi devices behave .Sh SYNOPSIS -.Fd #include +.Fd #include .Fd #include .Dv static struct scsidevs knowndevs[] = .Em ... .Sh DESCRIPTION The .Dv struct scsidevs knowndevs contains information about scsi devices that are known to have problems or require special flags. .Bd -literal -offset indent struct scsidevs { u_int32_t type; u_int32_t driver; /* normally the same as type */ boolean removable; char *manufacturer; char *model; char *version; char *devname; char flags; /* see below */ u_int16_t quirks; void *devmodes; }; #define SC_SHOWME ... #define SC_ONE_LU ... #define SC_MORE_LUS ... .Ed .Pp Matching is based first on device type, then on the manufacturer, model, and revision strings returned by the device. The returned strings are fixed lengths of 8, 16 and 4 bytes respectively. In the matching pattern, a question mark .Pq So ? Sc matches any single character and a trailing asterisk .Pq So * Sc matches remaining characters. For patterns shorter than their respective fields, trailing spaces are implied. .Bl -tag -width manufacturer .It Va type This is the type of device that is returned by the device. Look in .Pa /sys/scsi/scsi_all.h for the list of available types .Pq look for the Dv T_xxx macros . .It Va driver This specifies the driver to assign to the devices that match this entry. It usually has the same value as .Va type , unless a particular device is lying about its identity. .It Va removable This specifies wether the device is removable .Pq Dv T_REMOV or fixed .Pq Dv T_FIXED . .It Va manufacturer This is the string to match against the vendor identification returned by the device. .It Va model This is the string to match against the product identification returned by the device. .It Va version This is the string to match against the product revision level returned by the device. .It Va devname The device name of the driver to attach to this scsi device. .It Va flags This is set to possible flags that are use when probing this device. The values are: .Bl -tag -width "SC_MORE_LUSXX" -compact .It Dv SC_SHOWME Be verbose about the decisions made when considering this entry at device probe time. .It Dv SC_ONE_LU Probe only the first LUN if device matches this entry; used for broken devices that erroneously respond on more than a single LUN. .It Dv SC_MORE_LUS The opposite, probe for all possible LUNs. This is the default, but can be used if a quirk entry is required for other purposes, like overriding a type-specific default that would restrict probing to only one LUN. .El .It Va quirks This field specifies device specific flags. See the device-specific man pages in section 9 for more info on these flags. .It Va devmodes This is a pointer to a device specific struct. Currently only used by .Xr st 4 to set initial modes. .El .Sh FILES .Bl -tag -width /sys/scsi/scsiconf.c -compact .It Pa /sys/scsi/scsi_all.h Lists the possible scsi devices .It Pa /sys/scsi/scsiconf.h Lists possible flags for both .Va flags and .Va quirks .It Pa /sys/scsi/scsiconf.c Contains the .Va knowndevs data structure .El .Sh SEE ALSO .Xr cd 4 , .Xr ch 4 , .Xr pt 4 , .Xr scsi 4 , .Xr sd 4 , .Xr st 4 , .Xr su 4 , .Xr uk 4 , .Xr cd 9 , .Xr sd 9 , .Xr st 9 .Sh HISTORY The .Nm manual page first appeared in .Fx 2.2 . .Sh AUTHOR This manual page was written by John-Mark Gurney .Aq gurney_j@efn.org . .Sh BUGS This isn't a complete description of what .Pa /sys/scsi/scsiconf.c contains, but the remaining functions there are internal to the SCSI subsystem and thus of little interest for driver writers. diff --git a/share/man/man9/spl.9 b/share/man/man9/spl.9 index 5da0009c237a..b30bacc50270 100644 --- a/share/man/man9/spl.9 +++ b/share/man/man9/spl.9 @@ -1,201 +1,201 @@ .\" .\" Copyright (c) 1996 Joerg Wunsch .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: spl.9,v 1.3 1997/02/22 13:26:27 peter Exp $ +.\" $Id: spl.9,v 1.4 1997/03/21 20:14:14 mpp Exp $ .\" " .Dd July 21, 1996 .Os .Dt SPL 9 .Sh NAME .Nm splbio, .Nm splclock, .Nm splhigh, .Nm splimp, .Nm splnet, .Nm splsoftclock, .Nm splsofttty, .Nm splstatclock, .Nm spltty, .Nm splvm, .Nm spl0, .Nm splx .Nd manipulate interrupt priorities .Sh SYNOPSIS -.Fd #include +.Fd #include .Fd #include .Ft int .Fn splbio "void" .Ft int .Fn splclock "void" .Ft int .Fn splhigh "void" .Ft int .Fn splimp "void" .Ft int .Fn splnet "void" .Ft int .Fn splsoftclock "void" .Ft int .Fn splsofttty "void" .Ft int .Fn splstatclock "void" .Ft int .Fn spltty "void" .Ft void .Fn spl0 "void" .Ft void .Fn splx "int ipl" .Sh DESCRIPTION The .Fn spl function family sets the interrupt priority .Dq level of the CPU. This prevents interrupt handlers of the blocked priority level from being run. This is used in the .Dq synchronous part of a driver (the part that runs on behalf of the user process) to examine or modify data areas that might be examined or modified by interrupt handlers. .Pp Each driver that uses interrupts is normally assigned to an interrupt priority group by a keyword in its config line. For example: .Bd -literal -offset indent device foo0 at isa? port 0x0815 irq 12 tty vector foointr .Ed .Pp assigns interrupt 12 to the .Dq tty priority group. The system automatically arranges for interrupts in the .Em xxx group to be called at a priority >= .Ns spl Ns Em xxx \&(). .Pp The function .Fn splx sets the interrupt priority to an absolute value. The intent is that the value returned by the other functions should be saved in a local variable, and later passed to .Fn splx in order to restore the previous priority. .Pp The function .Fn spl0 lowers the priority to a value where all interrupt handlers are unblocked, but ASTs (asynchronous system traps) remain blocked until the system is about to return to user mode. .Pp The traditional assignment of the various device drivers to the interrupt priority groups can be roughly classified as: .Bl -tag -width Fn splnet .It Fn splnet All network interface drivers. .It Fn splbio All .Em buffered IO (i.e., disk and the like) drivers. .It Fn spltty Basically, all non-network communications devices, but effectively used for all drivers that are neither network nor disks. .El .Sh RETURN VALUES All functions except .Fn splx and .Fn spl0 return the previous priority value. .Sh EXAMPLES This is a typical example demonstrating the usage: .Bd -literal struct foo_softc { ... int flags; #define FOO_ASLEEP 1 #define FOO_READY 2 } foo_softc[NFOO]; int foowrite(...) { struct foo_softc *sc; int s, error; ... s = spltty(); if (!(sc->flags & FOO_READY)) { /* Not ready, must sleep on resource. */ sc->flags |= FOO_ASLEEP; error = tsleep(sc, PZERO, "foordy", 0); sc->flags &= ~FOO_ASLEEP; } sc->flags &= ~FOO_READY; splx(s); ... } void foointr(...) { struct foo_softc *sc; ... sc->flags |= FOO_READY; if (sc->flags & FOO_ASLEEP) /* Somebody was waiting for us, awake him. */ wakeup(sc); ... } .Ed Note that the interrupt handler should .Em never reduce the priority level. It is automatically called as it had raised the interrupt priority to its own level, i.e. further interrupts of the same group are being blocked. .Sh HISTORY The interrupt priority levels appeared in a very early version of Unix. They have been traditionally known by number instead of by names, and were inclusive up to higher priority levels (i.e., priority 5 has been blocking everything up to level 5). This is no longer the case in .Tn FreeBSD . The traditional name .Ql level for them is still reflected in the letter .Ql l of the respective functions and variables, although they are not really levels anymore, but rather different (partially inclusive) sets of functions to be blocked during some periods of the life of the system. The historical number scheme can be considered as a simple linearly ordered set of interrupt priority groups. .Sh AUTHORS This man page was written by .ie t J\(:org Wunsch. .el Joerg Wunsch. diff --git a/share/man/man9/timeout.9 b/share/man/man9/timeout.9 index d13a9148cfae..11331625305f 100644 --- a/share/man/man9/timeout.9 +++ b/share/man/man9/timeout.9 @@ -1,89 +1,89 @@ .\" .\" Copyright (c) 1996 Joerg Wunsch .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: timeout.9,v 1.3 1997/02/22 13:26:29 peter Exp $ +.\" $Id: timeout.9,v 1.4 1997/03/19 03:18:01 bde Exp $ .\" " .Dd April 13, 1996 .Os .Dt TIMEOUT 9 .Sh NAME .Nm timeout , .Nm untimeout .Nd schedule timer events .Sh SYNOPSIS -.Fd #include +.Fd #include .Fd #include .Ft typedef void timeout_t \*(lpvoid *\*(rp; .Ft void .Fn timeout "timeout_t *func" "void *arg" "int ticks" .Ft void .Fn untimeout "timeout_t *func" "void *arg" .Sh DESCRIPTION The .Nm timeout facility allows the execution of a function after a specified amount of time. The function .Ar func is being called with the opaque argument .Ar arg after .Ar ticks timer ticks have been elapsed. It's often convenient to use the external variable .Dv hz to compute the amount of .Ar ticks to wait. .Pp If the timeout event should be removed before the timer expires, .Nm untimeout must be called with the exact .Ar func and .Ar arg arguments as the corresponding call to .Fn timeout . .Pp Unlike the functions of .Xr sleep 9 , .Fn timeout and .Fn untimeout can be called from within an interrupt context. .Sh SEE ALSO .Xr sleep 9 .Sh HISTORY The .Nm timeout facility is very old. .Sh BUGS Since the timer queue is sorted and uses time differences rather than absolute times, inserting and removing timer events can be costly if it is done too frequently. .Sh AUTHORS This man page has been written by .ie t J\(:org Wunsch. .el Joerg Wunsch. diff --git a/share/man/man9/uio.9 b/share/man/man9/uio.9 index 406b1870e98d..290fa10dd318 100644 --- a/share/man/man9/uio.9 +++ b/share/man/man9/uio.9 @@ -1,175 +1,174 @@ .\" .\" Copyright (c) 1997 Joerg Wunsch .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: uio.9,v 1.3 1997/02/22 13:26:29 peter Exp $ .\" " .Dd February 2, 1997 .Os .Dt UIO 9 .Sh NAME .Nm uio , .Nm uiomove .Nd device driver IO routines .Sh SYNOPSIS .Fd #include -.Fd #include .Fd #include .Pp .Bd -literal struct uio { struct iovec *uio_iov; int uio_iovcnt; off_t uio_offset; int uio_resid; enum uio_seg uio_segflg; enum uio_rw uio_rw; struct proc *uio_procp; }; .Ed .Ft int .Fn uiomove "caddr_t buf" "int howmuch" "struct uio *uiop" .Sh DESCRIPTION The function .Fn uiomove is used to handle transfer of data between buffers and IO vectors that might possibly also cross the user/kernel space boundary. .Pp As a result of any .Xr read 2 , .Xr write 2 , .Xr readv 2 , or .Xr writev 2 system call that is being passed to a character-device driver, the appropriate driver .Em read or .Em write entry will be called with a pointer to a .Fa "struct uio" being passed. The transfer request is encoded in this structure. The driver itself should use .Fn uiomove to get at the data in this structure. .Pp The fields in the uio structure are: .Bl -tag -width "uio_iovcntXXXX" -compact .It Dv uio_iov The array of IO vectors to be processed. In the case of scatter/gather IO, this will be more than one vector. .It Dv uio_iovcnt The number of IO vectors present. .It Dv uio_offset The offset into the device. .It Dv uio_resid The number of bytes to process. .It Dv uio_segflg One of the following flags: .Bl -tag -width "UIO_USERISPACEX" -compact .It Dv UIO_USERSPACE The IO vector points into a process's address space. .It Dv UIO_SYSSPACE The IO vector points into the kernel address space. .It Dv UIO_USERISPACE The IO vector points into the instruction area of a process's address space. .It Dv UIO_NOCOPY Don't copy, already in object. .El .It Dv uio_rw uio_rw The direction of the desired transfer, either .Dv UIO_READ , or .Dv UIO_WRITE . .It Dv uio_procp The pointer to a .Li struct proc for the associated process; used if .Dv uio_segflg indicates that the transfer is to be made from/to a process's address space. .El .Sh EXAMPLES The idea is that the driver maintains a private buffer for its data, and processes the request in chunks of maximal the size of this buffer. Note that the buffer handling below is very simplified and won't work (the buffer pointer is not being advanced in case of a partial read), it's just here to demonstrate the uio handling. .Bd -literal /* MIN() can be found there: */ #include #define BUFSIZE 512 static char buffer[BUFSIZE]; static int data_available; /* amount of data that can be read */ static int fooread(dev_t dev, struct uio *uio, int flag) { int rv, amnt; while (uio->uio_resid > 0) { if (data_available > 0) { amnt = MIN(uio->uio_resid, data_available); if ((rv = uiomove((caddr_t)buffer, amnt, uio)) != 0) goto error; data_available -= amnt; } else { tsleep(...); /* wait for a better time */ } } return 0; error: /* do error cleanup here */ return rv; } .Ed .Sh RETURN VALUES .Fn uiomove can return .Er EFAULT from the invoked .Xr copyin 9 or .Xr copyout 9 in case the transfer was to/from a process's address space. .Sh SEE ALSO .Xr read 2 , .Xr readv 2 , .Xr write 2 , .Xr writev 2 , .Xr copyin 9 , .Xr copyout 9 , .Xr sleep 9 .Sh HISTORY The uio mechanism appeared in some early version of .Ux . .Sh AUTHORS This man page has been written by .ie t J\(:org Wunsch. .el Joerg Wunsch. diff --git a/share/man/man9/vget.9 b/share/man/man9/vget.9 index e9945d1a1616..3df41f1420db 100644 --- a/share/man/man9/vget.9 +++ b/share/man/man9/vget.9 @@ -1,68 +1,69 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: vget.9,v 1.1 1997/03/03 18:00:55 dfr Exp $ +.\" $Id: vget.9,v 1.2 1997/03/22 22:47:30 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VGET 9 .Sh NAME .Nm vget .Nd get a vnode from the free list .Sh SYNOPSIS +.Fd #include .Fd #include .Ft int -.Fn vget "struct vnode *vp" "int lockflag" +.Fn vget "struct vnode *vp" "int lockflag" "struct proc *p" .Sh DESCRIPTION Get a vnode from the free list and increment its reference count. .Bl -tag -width lockflag .It Ar vp the vnode to remove from the free list .It Ar lockflag if non-zero, the vnode will also be locked .El .Pp When not in use, vnodes are kept on a free list. The vnodes still reference valid files but may be reused to refer to a new file at any time. Often, these vnodes are also held in caches in the system, such as the name cache. .Pp When a vnode which is on the free list is used again, for instance if the vnode was found in the name cache as a result of a call to .Xr VOP_LOOKUP 9 then the new user must call .Xr vget 9 to increment the reference count and remove it from the free list. .Sh SEE ALSO .Xr vnode 9 , .Xr vput 9 , .Xr vref 9 , .Xr vrele 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/vnode.9 b/share/man/man9/vnode.9 index 131dd0a7cf8a..c97dbc606009 100644 --- a/share/man/man9/vnode.9 +++ b/share/man/man9/vnode.9 @@ -1,178 +1,179 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: vnode.9,v 1.1 1997/03/03 18:00:57 dfr Exp $ +.\" $Id: vnode.9,v 1.2 1997/03/22 22:47:31 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VNODE 9 .Sh NAME .Nm vnode .Nd internal representation of a file or directory .Sh SYNOPSIS +.Fd #include .Fd #include .Pp .Bd -literal /* * Vnode types. VNON means no type. */ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; /* * Vnode tag types. * These are for the benefit of external programs only (e.g., pstat) * and should NEVER be inspected by the kernel. */ enum vtagtype { VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, VT_UNION, VT_MSDOSFS, VT_DEVFS }; /* * Each underlying filesystem allocates its own private area and hangs * it from v_data. If non-null, this area is freed in getnewvnode(). */ LIST_HEAD(buflists, buf); typedef int vop_t __P((void *)); struct vnode { u_long v_flag; /* vnode flags (see below) */ int v_usecount; /* reference count of users */ int v_writecount; /* reference count of writers */ int v_holdcnt; /* page & buffer references */ daddr_t v_lastr; /* last read (read-ahead) */ u_long v_id; /* capability identifier */ struct mount *v_mount; /* ptr to vfs we are in */ vop_t **v_op; /* vnode operations vector */ TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */ LIST_ENTRY(vnode) v_mntvnodes; /* vnodes for mount point */ struct buflists v_cleanblkhd; /* clean blocklist head */ struct buflists v_dirtyblkhd; /* dirty blocklist head */ long v_numoutput; /* num of writes in progress */ enum vtype v_type; /* vnode type */ union { struct mount *vu_mountedhere;/* ptr to mounted vfs (VDIR) */ struct socket *vu_socket; /* unix ipc (VSOCK) */ struct specinfo *vu_specinfo; /* device (VCHR, VBLK) */ struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */ } v_un; struct nqlease *v_lease; /* Soft reference to lease */ daddr_t v_lastw; /* last write (write cluster) */ daddr_t v_cstart; /* start block of cluster */ daddr_t v_lasta; /* last allocation */ int v_clen; /* length of current cluster */ int v_ralen; /* Read-ahead length */ int v_usage; /* Vnode usage counter */ daddr_t v_maxra; /* last readahead block */ void *v_object; /* Place to store VM object */ enum vtagtype v_tag; /* type of underlying data */ void *v_data; /* private data for fs */ }; #define v_mountedhere v_un.vu_mountedhere #define v_socket v_un.vu_socket #define v_specinfo v_un.vu_specinfo #define v_fifoinfo v_un.vu_fifoinfo /* * Vnode flags. */ #define VROOT 0x0001 /* root of its file system */ #define VTEXT 0x0002 /* vnode is a pure text prototype */ #define VSYSTEM 0x0004 /* vnode being used by kernel */ #define VOLOCK 0x0008 /* vnode is locked waiting for an object */ #define VOWANT 0x0010 /* a process is waiting for VOLOCK */ #define VXLOCK 0x0100 /* vnode is locked to change underlying type */ #define VXWANT 0x0200 /* process is waiting for vnode */ #define VBWAIT 0x0400 /* waiting for output to complete */ #define VALIASED 0x0800 /* vnode has an alias */ #define VDIROP 0x1000 /* LFS: vnode is involved in a directory op */ #define VVMIO 0x2000 /* VMIO flag */ #define VNINACT 0x4000 /* LFS: skip ufs_inactive() in lfs_vunref */ #define VAGE 0x8000 /* Insert vnode at head of free list */ .Ed .Sh DESCRIPTION The vnode is the focus of all file activity in UNIX. There is a unique vnode allocated for each active file, each current directory, each mounted-on file, text file, and the root. .Pp Each vnode has two reference counts, .Dv v_usecount and .Dv v_writecount . The first is the number of clients within the kernel which are using this vnode. This count is maintained by .Xr vref 9 , .Xr vrele 9 and .Xr vput 9 . When the .Dv v_usecount of a vnode reaches zero then the vnode may be reused for another file, possibly in another filesystem. The second is a count of the number of clients which are writing into the file. It is maintained by the .Xr open 2 and .Xr close 2 system calls. .Pp Any call which returns a vnode (e.g. .Xr VFS_GET 9 , .Xr VOP_LOOKUP 9 etc.) will increase the .Dv v_usecount of the vnode by one. When the caller is finished with the vnode, it should release this reference by calling .Xr vrele 9 (or .Xr vput 9 if the vnode is locked). .Pp Other commonly used members of the vnode structure are .Dv v_id which is used to maintain consistency in the name cache, .Dv v_mount which points at the filesystem which owns the vnode, .Dv v_type which contains the type of object the vnode represents and .Dv v_data which is used by filesystems to store filesystem specific data with the vnode. The .Dv v_op field is used by the .Dv VOP_* macros to call functions in the filesystem which implement the vnode's functionality. .Sh SEE ALSO .Xr VFS 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/vput.9 b/share/man/man9/vput.9 index b7209e20e6df..a198e9ba6556 100644 --- a/share/man/man9/vput.9 +++ b/share/man/man9/vput.9 @@ -1,61 +1,62 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: vput.9,v 1.1 1997/03/03 18:00:58 dfr Exp $ +.\" $Id: vput.9,v 1.2 1997/03/22 22:47:32 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VPUT 9 .Sh NAME .Nm vput .Nd decrement the use count for a vnode and unlock it .Sh SYNOPSIS +.Fd #include .Fd #include -.Ft int +.Ft void .Fn vput "struct vnode *vp" .Sh DESCRIPTION Decrement the .Dv v_usecount field of a vnode and unlock the vnode. .Bl -tag -width vp .It Ar vp the vnode to decrement .El .Pp This operation is functionally equivalent to calling .Xr VOP_UNLOCK 9 followed by .Xr vrele 9 . .Sh SEE ALSO .Xr vnode 9 , .Xr vref 9 , .Xr vrele 9 , .Xr VOP_UNLOCK 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/vref.9 b/share/man/man9/vref.9 index 74a200cbe770..96be77123dea 100644 --- a/share/man/man9/vref.9 +++ b/share/man/man9/vref.9 @@ -1,65 +1,66 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: vref.9,v 1.1 1997/03/03 18:01:00 dfr Exp $ +.\" $Id: vref.9,v 1.2 1997/03/22 22:47:33 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VREF 9 .Sh NAME .Nm vref .Nd increment the use count for a vnode .Sh SYNOPSIS +.Fd #include .Fd #include -.Ft int +.Ft void .Fn vref "struct vnode *vp" .Sh DESCRIPTION Increment the .Dv v_usecount field of a vnode. .Bl -tag -width vp .It Ar vp the vnode to increment .El .Pp Each vnode maintains a reference count of how many parts of the system are using the vnode. This allows the system to detect when a vnode is no longer being used and can be safely recycled for a different file. .Pp Any code in the system which is using a vnode (e.g. during the operation of some algorithm or to store in a data structure) should call .Xr vref 9 . .Sh SEE ALSO .Xr vnode 9 , .Xr vget 9 , .Xr vput 9 , .Xr vrele 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/vrele.9 b/share/man/man9/vrele.9 index 049bfd0b21bf..10f5c0a35be2 100644 --- a/share/man/man9/vrele.9 +++ b/share/man/man9/vrele.9 @@ -1,63 +1,64 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: vrele.9,v 1.1 1997/03/03 18:01:01 dfr Exp $ +.\" $Id: vrele.9,v 1.2 1997/03/22 22:47:34 mpp Exp $ .\" .Dd July 24, 1996 .Os .Dt VRELE 9 .Sh NAME .Nm vrele .Nd decrement the use count for a vnode .Sh SYNOPSIS +.Fd #include .Fd #include -.Ft int +.Ft void .Fn vrele "struct vnode *vp" .Sh DESCRIPTION Decrement the .Dv v_usecount field of a vnode. .Bl -tag -width vp .It Ar vp the vnode to decrement .El .Pp Any code in the system which is using a vnode should call .Xr vrele 9 when it is finished with the vnode. If the .Dv v_usecount field of the vnode reaches zero, then it will be placed on the free list. .Sh SEE ALSO .Xr vnode 9 , .Xr vget 9 , .Xr vput 9 , .Xr vref 9 .Sh AUTHORS This man page was written by Doug Rabson. diff --git a/share/man/man9/vslock.9 b/share/man/man9/vslock.9 index 0b99942bbf54..e73155f765a9 100644 --- a/share/man/man9/vslock.9 +++ b/share/man/man9/vslock.9 @@ -1,70 +1,73 @@ .\" $NetBSD: vslock.9,v 1.1 1996/06/15 20:47:29 pk Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation .\" by Paul Kranenburg. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the NetBSD .\" Foundation, Inc. and its contributors. .\" 4. Neither the name of The NetBSD Foundation nor the names of its .\" contributors may be used to endorse or promote products derived .\" from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd Jun 15, 1996 .Dt VSLOCK 9 .Os FreeBSD .Sh NAME .Nm vslock , .Nm vsunlock .Nd lock/unlock user space addresses in memory .Sh SYNOPSIS +.Fd #include +.Fd #include +.Fd #include .Ft void .Fn vslock "caddr_t addr" "u_int len" .Ft void -.Fn vsunlock "caddr_t addr" "u_int len" +.Fn vsunlock "caddr_t addr" "u_int len" "int dirtied" .Sh DESCRIPTION The .Fn vslock and .Fn vsunlock functions respectively lock and unlock a range of addresses belonging to the currently running process into memory. The actual amount of memory locked is a multiple of the machine's page size. The starting page number is computed by truncating .Fa addr to the nearest preceding page boundary, and by rounding up .Fa addr + .Fa len to the next page boundary. The process context to use for this operation is taken from the global variable .Va curproc . .Pp .\" .Sh SEE ALSO .\" .Xr physio 9 .Sh BUGS The process pointer should be passed in as an argument.