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