1258945Sroberto/* 2258945Sroberto * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") 3258945Sroberto * Copyright (C) 2000, 2001 Internet Software Consortium. 4258945Sroberto * 5258945Sroberto * Permission to use, copy, modify, and/or distribute this software for any 6258945Sroberto * purpose with or without fee is hereby granted, provided that the above 7258945Sroberto * copyright notice and this permission notice appear in all copies. 8258945Sroberto * 9258945Sroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10258945Sroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11258945Sroberto * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12258945Sroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13258945Sroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14258945Sroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15258945Sroberto * PERFORMANCE OF THIS SOFTWARE. 16258945Sroberto */ 17258945Sroberto 18258945Sroberto/* $Id: stdio.h,v 1.13 2007/06/19 23:47:18 tbox Exp $ */ 19258945Sroberto 20258945Sroberto#ifndef ISC_STDIO_H 21258945Sroberto#define ISC_STDIO_H 1 22258945Sroberto 23258945Sroberto/*! \file isc/stdio.h */ 24258945Sroberto 25258945Sroberto/*% 26258945Sroberto * These functions are wrappers around the corresponding stdio functions. 27258945Sroberto * 28258945Sroberto * They return a detailed error code in the form of an an isc_result_t. ANSI C 29258945Sroberto * does not guarantee that stdio functions set errno, hence these functions 30258945Sroberto * must use platform dependent methods (e.g., the POSIX errno) to construct the 31258945Sroberto * error code. 32258945Sroberto */ 33258945Sroberto 34258945Sroberto#include <stdio.h> 35258945Sroberto 36258945Sroberto#include <isc/lang.h> 37258945Sroberto#include <isc/result.h> 38258945Sroberto 39258945SrobertoISC_LANG_BEGINDECLS 40258945Sroberto 41258945Sroberto/*% Open */ 42258945Srobertoisc_result_t 43258945Srobertoisc_stdio_open(const char *filename, const char *mode, FILE **fp); 44258945Sroberto 45258945Sroberto/*% Close */ 46258945Srobertoisc_result_t 47258945Srobertoisc_stdio_close(FILE *f); 48258945Sroberto 49258945Sroberto/*% Seek */ 50258945Srobertoisc_result_t 51258945Srobertoisc_stdio_seek(FILE *f, long offset, int whence); 52258945Sroberto 53258945Sroberto/*% Read */ 54258945Srobertoisc_result_t 55258945Srobertoisc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f, 56258945Sroberto size_t *nret); 57258945Sroberto 58258945Sroberto/*% Write */ 59258945Srobertoisc_result_t 60258945Srobertoisc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f, 61258945Sroberto size_t *nret); 62258945Sroberto 63258945Sroberto/*% Flush */ 64258945Srobertoisc_result_t 65258945Srobertoisc_stdio_flush(FILE *f); 66258945Sroberto 67258945Srobertoisc_result_t 68258945Srobertoisc_stdio_sync(FILE *f); 69258945Sroberto/*%< 70258945Sroberto * Invoke fsync() on the file descriptor underlying an stdio stream, or an 71258945Sroberto * equivalent system-dependent operation. Note that this function has no 72258945Sroberto * direct counterpart in the stdio library. 73258945Sroberto */ 74258945Sroberto 75258945SrobertoISC_LANG_ENDDECLS 76258945Sroberto 77258945Sroberto#endif /* ISC_STDIO_H */ 78