xref: /minix/external/bsd/bind/dist/lib/isc/include/isc/stdio.h (revision bb9622b5)
1 /*	$NetBSD: stdio.h,v 1.5 2014/12/10 04:38:00 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004-2007, 2013  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 2000, 2001  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* Id: stdio.h,v 1.13 2007/06/19 23:47:18 tbox Exp  */
21 
22 #ifndef ISC_STDIO_H
23 #define ISC_STDIO_H 1
24 
25 /*! \file isc/stdio.h */
26 
27 /*%
28  * These functions are wrappers around the corresponding stdio functions.
29  *
30  * They return a detailed error code in the form of an an isc_result_t.  ANSI C
31  * does not guarantee that stdio functions set errno, hence these functions
32  * must use platform dependent methods (e.g., the POSIX errno) to construct the
33  * error code.
34  */
35 
36 #include <stdio.h>
37 
38 #include <isc/lang.h>
39 #include <isc/result.h>
40 
41 ISC_LANG_BEGINDECLS
42 
43 /*% Open */
44 isc_result_t
45 isc_stdio_open(const char *filename, const char *mode, FILE **fp);
46 
47 /*% Close */
48 isc_result_t
49 isc_stdio_close(FILE *f);
50 
51 /*% Seek */
52 isc_result_t
53 isc_stdio_seek(FILE *f, off_t offset, int whence);
54 
55 /*% Tell */
56 isc_result_t
57 isc_stdio_tell(FILE *f, off_t *offsetp);
58 
59 /*% Read */
60 isc_result_t
61 isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f,
62 	       size_t *nret);
63 
64 /*% Write */
65 isc_result_t
66 isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f,
67 		size_t *nret);
68 
69 /*% Flush */
70 isc_result_t
71 isc_stdio_flush(FILE *f);
72 
73 isc_result_t
74 isc_stdio_sync(FILE *f);
75 /*%<
76  * Invoke fsync() on the file descriptor underlying an stdio stream, or an
77  * equivalent system-dependent operation.  Note that this function has no
78  * direct counterpart in the stdio library.
79  */
80 
81 ISC_LANG_ENDDECLS
82 
83 #endif /* ISC_STDIO_H */
84