⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apr_file_io.h

📁 Apache官方在今天放出产品系列2.2的最新版本2.2.11的源码包 最流行的HTTP服务器软件之一
💻 H
📖 第 1 页 / 共 3 页
字号:
 * @param pool The pool to allocate the file out of. *  * @remark The only reason that the apr_file_open_std* functions exist * is that you may not always have a stderr/out/in on Windows.  This * is generally a problem with newer versions of Windows and services. *  * @remark The other problem is that the C library functions generally work * differently on Windows and Unix.  So, by using apr_file_open_std* * functions, you can get a handle to an APR struct that works with * the APR functions which are supposed to work identically on all * platforms. */APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile,                                               apr_pool_t *pool);/** * open standard output as an apr file pointer. * @param thefile The apr file to use as stdout. * @param pool The pool to allocate the file out of. *  * @remark See remarks for apr_file_open_stderr. */APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,                                               apr_pool_t *pool);/** * open standard input as an apr file pointer. * @param thefile The apr file to use as stdin. * @param pool The pool to allocate the file out of. *  * @remark See remarks for apr_file_open_stderr. */APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,                                              apr_pool_t *pool);/** * open standard error as an apr file pointer, with flags. * @param thefile The apr file to use as stderr. * @param flags The flags to open the file with. Only the APR_EXCL, *              APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK,  *              APR_SENDFILE_ENABLED and APR_LARGEFILE flags should *              be used. The APR_WRITE flag will be set unconditionally. * @param pool The pool to allocate the file out of. *  * @remark See remarks for apr_file_open_stderr. */APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile,                                                     apr_int32_t flags,                                                     apr_pool_t *pool);/** * open standard output as an apr file pointer, with flags. * @param thefile The apr file to use as stdout. * @param flags The flags to open the file with. Only the APR_EXCL, *              APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK,  *              APR_SENDFILE_ENABLED and APR_LARGEFILE flags should *              be used. The APR_WRITE flag will be set unconditionally. * @param pool The pool to allocate the file out of. *  * @remark See remarks for apr_file_open_stderr. */APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile,                                                     apr_int32_t flags,                                                     apr_pool_t *pool);/** * open standard input as an apr file pointer, with flags. * @param thefile The apr file to use as stdin. * @param flags The flags to open the file with. Only the APR_EXCL, *              APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK,  *              APR_SENDFILE_ENABLED and APR_LARGEFILE flags should *              be used. The APR_READ flag will be set unconditionally. * @param pool The pool to allocate the file out of. *  * @remark See remarks for apr_file_open_stderr. */APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile,                                                     apr_int32_t flags,                                                     apr_pool_t *pool);/** * Read data from the specified file. * @param thefile The file descriptor to read from. * @param buf The buffer to store the data to. * @param nbytes On entry, the number of bytes to read; on exit, the number * of bytes read. * * @remark apr_file_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, all of the available data is read.  The third * argument is modified to reflect the number of bytes read.  If a * char was put back into the stream via ungetc, it will be the first * character returned. * * @remark It is not possible for both bytes to be read and an APR_EOF * or other error to be returned.  APR_EINTR is never returned. */APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf,                                        apr_size_t *nbytes);/** * Write data to the specified file. * @param thefile The file descriptor to write to. * @param buf The buffer which contains the data. * @param nbytes On entry, the number of bytes to write; on exit, the number  *               of bytes written. * * @remark apr_file_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 can.  The third argument is modified to * reflect the * number of bytes written. * * @remark It is possible for both bytes to be written and an error to * be returned.  APR_EINTR is never returned. */APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf,                                         apr_size_t *nbytes);/** * Write data from iovec array to the specified file. * @param thefile The file descriptor to write to. * @param vec The array from which to get the data to write to the file. * @param nvec The number of elements in the struct iovec array. This must  *             be smaller than APR_MAX_IOVEC_SIZE.  If it isn't, the function  *             will fail with APR_EINVAL. * @param nbytes The number of bytes written. * * @remark It is possible for both bytes to be written and an error to * be returned.  APR_EINTR is never returned. * * @remark apr_file_writev is available even if the underlying * operating system doesn't provide writev(). */APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile,                                          const struct iovec *vec,                                          apr_size_t nvec, apr_size_t *nbytes);/** * Read data from the specified file, ensuring that the buffer is filled * before returning. * @param thefile The file descriptor to read from. * @param buf The buffer to store the data to. * @param nbytes The number of bytes to read. * @param bytes_read If non-NULL, this will contain the number of bytes read. * * @remark apr_file_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. * * @remark It is possible for both bytes to be read and an error to be * returned.  And if *bytes_read is less than nbytes, an accompanying * error is _always_ returned. * * @remark APR_EINTR is never returned. */APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf,                                             apr_size_t nbytes,                                             apr_size_t *bytes_read);/** * Write data to the specified file, ensuring that all of the data is * written before returning. * @param thefile The file descriptor to write to. * @param buf The buffer which contains the data. * @param nbytes The number of bytes to write. * @param bytes_written If non-NULL, set to the number of bytes written. *  * @remark apr_file_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. * * @remark It is possible for both bytes to be written and an error to * be returned.  And if *bytes_written is less than nbytes, an * accompanying error is _always_ returned. * * @remark APR_EINTR is never returned. */APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile,                                               const void *buf,                                              apr_size_t nbytes,                                               apr_size_t *bytes_written);/** * Write data from iovec array to the specified file, ensuring that all of the * data is written before returning. * @param thefile The file descriptor to write to. * @param vec The array from which to get the data to write to the file. * @param nvec The number of elements in the struct iovec array. This must  *             be smaller than APR_MAX_IOVEC_SIZE.  If it isn't, the function  *             will fail with APR_EINVAL. * @param nbytes The number of bytes written. * * @remark apr_file_writev_full is available even if the underlying * operating system doesn't provide writev(). */APR_DECLARE(apr_status_t) apr_file_writev_full(apr_file_t *thefile,                                               const struct iovec *vec,                                               apr_size_t nvec,                                               apr_size_t *nbytes);/** * Write a character into the specified file. * @param ch The character to write. * @param thefile The file descriptor to write to */APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile);/** * Read a character from the specified file. * @param ch The character to read into * @param thefile The file descriptor to read from */APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile);/** * Put a character back onto a specified stream. * @param ch The character to write. * @param thefile The file descriptor to write to */APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile);/** * Read a string from the specified file. * @param str The buffer to store the string in.  * @param len The length of the string * @param thefile The file descriptor to read from * @remark The buffer will be NUL-terminated if any characters are stored. */APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len,                                         apr_file_t *thefile);/** * Write the string into the specified file. * @param str The string to write.  * @param thefile The file descriptor to write to */APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile);/** * Flush the file's buffer. * @param thefile The file descriptor to flush */APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile);/** * Duplicate the specified file descriptor. * @param new_file The structure to duplicate into.  * @param old_file The file to duplicate. * @param p The pool to use for the new file. * @remark *new_file must point to a valid apr_file_t, or point to NULL. */         APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,                                       apr_file_t *old_file,                                       apr_pool_t *p);/** * Duplicate the specified file descriptor and close the original * @param new_file The old file that is to be closed and reused * @param old_file The file to duplicate * @param p        The pool to use for the new file * * @remark new_file MUST point at a valid apr_file_t. It cannot be NULL. */APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,                                        apr_file_t *old_file,                                        apr_pool_t *p);/** * Move the specified file descriptor to a new pool * @param new_file Pointer in which to return the new apr_file_t * @param old_file The file to move * @param p        The pool to which the descriptor is to be moved * @remark Unlike apr_file_dup2(), this function doesn't do an *         OS dup() operation on the underlying descriptor; it just *         moves the descriptor's apr_file_t wrapper to a new pool. * @remark The new pool need not be an ancestor of old_file's pool. * @remark After calling this function, old_file may not be used */APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,                                            apr_file_t *old_file,                                            apr_pool_t *p);/** * Give the specified apr file handle a new buffer  * @param thefile  The file handle that is to be modified * @param buffer   The buffer * @param bufsize  The size of the buffer * @remark It is possible to add a buffer to previously unbuffered *         file handles, the APR_BUFFERED flag will be added to *         the file handle's flags. Likewise, with buffer=NULL and *         bufsize=0 arguments it is possible to make a previously *         buffered file handle unbuffered. */APR_DECLARE(apr_status_t) apr_file_buffer_set(apr_file_t *thefile,                                              char * buffer,                                              apr_size_t bufsize);/** * Get the size of any buffer for the specified apr file handle  * @param thefile  The file handle  */APR_DECLARE(apr_size_t) apr_file_buffer_size_get(apr_file_t *thefile);/** * Move the read/write file offset to a specified byte within a file.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -