00001 /* 00002 * Copyright (C) 2004-2007, 2013 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 2000, 2001 Internet Software Consortium. 00004 * 00005 * Permission to use, copy, modify, and/or distribute this software for any 00006 * purpose with or without fee is hereby granted, provided that the above 00007 * copyright notice and this permission notice appear in all copies. 00008 * 00009 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00010 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00011 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00012 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00013 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00014 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00015 * PERFORMANCE OF THIS SOFTWARE. 00016 */ 00017 00018 /* $Id: stdio.h,v 1.13 2007/06/19 23:47:18 tbox Exp $ */ 00019 00020 #ifndef ISC_STDIO_H 00021 #define ISC_STDIO_H 1 00022 00023 /*! \file isc/stdio.h */ 00024 00025 /*% 00026 * These functions are wrappers around the corresponding stdio functions. 00027 * 00028 * They return a detailed error code in the form of an an isc_result_t. ANSI C 00029 * does not guarantee that stdio functions set errno, hence these functions 00030 * must use platform dependent methods (e.g., the POSIX errno) to construct the 00031 * error code. 00032 */ 00033 00034 #include <stdio.h> 00035 00036 #include <isc/lang.h> 00037 #include <isc/result.h> 00038 00039 ISC_LANG_BEGINDECLS 00040 00041 /*% Open */ 00042 isc_result_t 00043 isc_stdio_open(const char *filename, const char *mode, FILE **fp); 00044 00045 /*% Close */ 00046 isc_result_t 00047 isc_stdio_close(FILE *f); 00048 00049 /*% Seek */ 00050 isc_result_t 00051 isc_stdio_seek(FILE *f, off_t offset, int whence); 00052 00053 /*% Tell */ 00054 isc_result_t 00055 isc_stdio_tell(FILE *f, off_t *offsetp); 00056 00057 /*% Read */ 00058 isc_result_t 00059 isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f, 00060 size_t *nret); 00061 00062 /*% Write */ 00063 isc_result_t 00064 isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f, 00065 size_t *nret); 00066 00067 /*% Flush */ 00068 isc_result_t 00069 isc_stdio_flush(FILE *f); 00070 00071 isc_result_t 00072 isc_stdio_sync(FILE *f); 00073 /*%< 00074 * Invoke fsync() on the file descriptor underlying an stdio stream, or an 00075 * equivalent system-dependent operation. Note that this function has no 00076 * direct counterpart in the stdio library. 00077 */ 00078 00079 ISC_LANG_ENDDECLS 00080 00081 #endif /* ISC_STDIO_H */