summaryrefslogtreecommitdiff
path: root/share/man
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-05-06 08:52:18 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-05-06 08:52:18 +0000
commit8f2a148defd52c6da0a494bb438b7a28770e3ab4 (patch)
treed0d876ee42d47875ce530966f76784cffff4c4ab /share/man
parent746365a6fd9d6c01b6c711d8e9cd45287b33deab (diff)
Pass a thread pointer instead of its file descriptor table to getsock(9).
Diff from Vitaliy Makkoveev. Manpage tweak and ok millert@
Diffstat (limited to 'share/man')
-rw-r--r--share/man/man9/file.929
1 files changed, 18 insertions, 11 deletions
diff --git a/share/man/man9/file.9 b/share/man/man9/file.9
index 7ff402aa4b6..0fdad047692 100644
--- a/share/man/man9/file.9
+++ b/share/man/man9/file.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: file.9,v 1.13 2015/04/30 11:46:16 millert Exp $
+.\" $OpenBSD: file.9,v 1.14 2015/05/06 08:52:17 mpi Exp $
.\"
.\" Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
.\" All rights reserved.
@@ -22,7 +22,7 @@
.\" (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 $Mdocdate: April 30 2015 $
+.Dd $Mdocdate: May 6 2015 $
.Dt FILE 9
.Os
.Sh NAME
@@ -42,7 +42,7 @@
.Ft struct file *
.Fn fd_getfile "struct filedesc *fdp" "int fd"
.Ft int
-.Fn getsock "struct filedesc *fdp" "int fd" "struct file **fpp"
+.Fn getsock "struct proc *p" "int fd" "struct file **fpp"
.In sys/file.h
.In sys/filedesc.h
.In sys/vnode.h
@@ -74,21 +74,28 @@ recommended to make complicated kernel APIs that require it.
.Pp
The files are extracted from the file descriptor table using the
functions
-.Fn fd_getfile ,
-.Fn getvnode
+.Fn fd_getfile
and
-.Fn getsock .
+.Fn getvnode .
.Fn fd_getfile
performs all necessary checks to see if the file descriptor number is
within the range of file descriptor table, and if the descriptor is
valid.
-.Fn getsock
-and
.Fn getvnode
-are special cases that besides doing
+is a special case that besides doing
+.Fn fd_getfile
+also checks if the descriptor is a vnode, returns the proper
+errno on error and increases the use count with
+.Fn FREF .
+.Pp
+The files are extracted from the process context using the
+function
+.Fn getsock .
+.Fn getsock
+is a special case that besides doing
.Fn fd_getfile
-also check if the descriptor is a vnode or socket, return the proper
-errno on error and increase the use count with
+also checks if the descriptor is a socket, returns the proper
+errno on error and increases the use count with
.Fn FREF .
.Sh CONCURRENT ACCESS
Since multiple processes can share the same file descriptor table,