summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/read.2
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1996-01-22 00:02:33 +0000
committerjulian <julian@FreeBSD.org>1996-01-22 00:02:33 +0000
commit619b731f5bb5e09dcf1eaf1fbd96383ca64398fd (patch)
treea89c7f50ec371cef4418259b9dccdd31ebb2f61f /lib/libc/sys/read.2
parent663b14fb2f3198fb0bfb62ae16b6b56c2a4dd055 (diff)
downloadFreeBSD-src-619b731f5bb5e09dcf1eaf1fbd96383ca64398fd.zip
FreeBSD-src-619b731f5bb5e09dcf1eaf1fbd96383ca64398fd.tar.gz
Reviewed by: julian and (hsu?)
Submitted by: John Birrel(L?) changes for threadsafe operations
Diffstat (limited to 'lib/libc/sys/read.2')
-rw-r--r--lib/libc/sys/read.247
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/libc/sys/read.2 b/lib/libc/sys/read.2
index b94341a..ea428fd 100644
--- a/lib/libc/sys/read.2
+++ b/lib/libc/sys/read.2
@@ -107,6 +107,53 @@ The system guarantees to read the number of bytes requested if
the descriptor references a normal file that has that many bytes left
before the end-of-file, but in no other case.
.Pp
+.Sh IMPLEMENTATION NOTES
+.Pp
+In the non-threaded library
+.Fn read
+is implemented as the
+.Va read
+syscall.
+.Pp
+In the threaded library, the
+.Va read
+syscall is assembled to
+.Fn _thread_sys_read
+and
+.Fn read
+is implemented as a function which locks
+.Va d
+for read, then calls
+.Fn _thread_sys_read .
+If the call to
+.Fn _thread_sys_read
+would block, a context switch is performed. Before returning,
+.Fn read
+unlocks
+.Va d .
+.Pp
+In the non-threaded library
+.Fn readv
+is implemented as the
+.Va readv
+syscall.
+.Pp
+In the threaded library, the
+.Va readv
+syscall is assembled to
+.Fn _thread_sys_readv
+and
+.Fn readv
+is implemented as a function which locks
+.Va d
+for read, then calls
+.Fn _thread_sys_readv .
+If the call to
+.Fn _thread_sys_readv
+would block, a context switch is performed. Before returning,
+.Fn readv
+unlocks
+.Va d .
.Sh RETURN VALUES
If successful, the
number of bytes actually read is returned. Upon reading end-of-file,
OpenPOWER on IntegriCloud