diff options
author | gstein <gstein@13f79535-47bb-0310-9956-ffa450edef68> | 2000-07-15 02:07:20 +0000 |
---|---|---|
committer | gstein <gstein@13f79535-47bb-0310-9956-ffa450edef68> | 2000-07-15 02:07:20 +0000 |
commit | 650aa1f5bb559b4a16ff64e8842c0a76cad4d890 (patch) | |
tree | 4c59405c973e5a65c754808744387129f1f91e14 /include/apr_file_io.h | |
parent | e5c2a137885ed4e993f77aaec8a8272e9917e7fb (diff) | |
download | libapr-650aa1f5bb559b4a16ff64e8842c0a76cad4d890.tar.gz |
add ap_full_read() and ap_full_write(). they guarantee to read/write the
full buffer unless an error occurs.
use the new functions in SDBM and DAV. [and Subversion]
Win32 and OS/2 can directly include/use file_io/unix/fullrw.c since it is
written in terms of other APR functions.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60378 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/apr_file_io.h')
-rw-r--r-- | include/apr_file_io.h | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/include/apr_file_io.h b/include/apr_file_io.h index 3b6517061..74c24cf43 100644 --- a/include/apr_file_io.h +++ b/include/apr_file_io.h @@ -281,7 +281,7 @@ B<Write data to the specified file.> arg 1) The file descriptor to write to. arg 2) The buffer which contains the data. arg 3) On entry, the number of bytes to write; on exit, the number - of bytes write. + of bytes written. B<NOTE>: ap_write will write up to the specified number of bytes, but never more. If the OS cannot write that many bytes, it will write as many as it @@ -325,6 +325,58 @@ ap_status_t ap_writev(ap_file_t *thefile, const struct iovec *vec, /* +=head1 ap_status_t ap_full_read(ap_file_t *thefile, void *buf, ap_size_t nbytes, ap_size_t *bytes_read) + +B<Read data from the specified file.> + + arg 1) The file descriptor to read from. + arg 2) The buffer to store the data to. + arg 3) The number of bytes to read. + arg 4) If non-NULL, this will contain the number of bytes read. + +B<NOTE>: ap_read will read up to the specified number of bytes, but never + more. If there isn't enough data to fill that number of bytes, then the + process/thread will block until it is available or EOF is reached. If a + char was put back into the stream via ungetc, it will be the first + character returned. + + It is possible for both bytes to be read and an APR_EOF or other error + to be returned. + + APR_EINTR is never returned. + +=cut + */ +ap_status_t ap_full_read(ap_file_t *thefile, void *buf, ap_size_t nbytes, + ap_size_t *bytes_read); + +/* + +=head1 ap_status_t ap_full_write(ap_file_t *thefile, const void *buf, ap_size_t nbytes, ap_size_t *bytes_written) + +B<Write data to the specified file.> + + arg 1) The file descriptor to write to. + arg 2) The buffer which contains the data. + arg 3) The number of bytes to write. + arg 4) If non-NULL, this will contain the number of bytes written. + +B<NOTE>: ap_write will write up to the specified number of bytes, but never + more. If the OS cannot write that many bytes, the process/thread will + block until they can be written. Exceptional error such as "out of space" + or "pipe closed" will terminate with an error. + + It is possible for both bytes to be written and an error to be returned. + + APR_EINTR is never returned. + +=cut + */ +ap_status_t ap_full_write(ap_file_t *thefile, const void *buf, + ap_size_t nbytes, ap_size_t *bytes_written); + +/* + =head1 ap_status_t ap_putc(char ch, ap_file_t *thefile) B<put a character into the specified file.> |