diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-04-07 23:43:21 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-04-07 23:47:38 +0200 |
commit | e0886e0780fc1f3ce1c80d0692c11adf3b68f682 (patch) | |
tree | 662ee84dfa4c708a3c703493929755d3d779ad50 /doc | |
parent | 254d313a21f06739930032062678ff5360d248fd (diff) | |
download | guile-e0886e0780fc1f3ce1c80d0692c11adf3b68f682.tar.gz |
Change `sendfile' to loop until everything has been sent.
* libguile/filesys.c (scm_sendfile)[HAVE_SYS_SENDFILE_H &&
HAVE_SENDFILE]: Compare RESULT with C_COUNT. Loop until C_COUNT bytes
have been sent.
* doc/ref/posix.texi (File System): Update the description. Explain the
new semantics.
* test-suite/tests/filesys.test ("sendfile"): Rewrite using
`pass-if-equal'. Check the return value for all the tests.
["file with offset past the end", "file with offset near the end"]:
New tests.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ref/posix.texi | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi index 45f320f45..b3a6a048f 100644 --- a/doc/ref/posix.texi +++ b/doc/ref/posix.texi @@ -806,9 +806,10 @@ The return value is unspecified. @deffn {Scheme Procedure} sendfile out in count [offset] @deffnx {C Function} scm_sendfile (out, in, count, offset) Send @var{count} bytes from @var{in} to @var{out}, both of which -are either open file ports or file descriptors. When +must be either open file ports or file descriptors. When @var{offset} is omitted, start reading from @var{in}'s current -position; otherwise, start reading at @var{offset}. +position; otherwise, start reading at @var{offset}. Return +the number of bytes actually sent. When @var{in} is a port, it is often preferable to specify @var{offset}, because @var{in}'s offset as a port may be different from the offset of @@ -824,6 +825,12 @@ In some cases, the @code{sendfile} libc function may return @code{EINVAL} or @code{ENOSYS}. In that case, Guile's @code{sendfile} procedure automatically falls back to doing a series of @code{read} and @code{write} calls. + +In other cases, the libc function may send fewer bytes than +@var{count}---for instance because @var{out} is a slow or limited +device, such as a pipe. When that happens, Guile's @code{sendfile} +automatically retries until exactly @var{count} bytes were sent or an +error occurs. @end deffn @findex rename |