summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorcem <cem@FreeBSD.org>2016-05-11 14:38:27 +0000
committercem <cem@FreeBSD.org>2016-05-11 14:38:27 +0000
commit97a44a849e7f06367a2f6bcf955631c6747a1c2e (patch)
treeef3e872e8311fe76a4880b6ec63e08f1a14167d3 /include
parentd45728b896474b7c0ddfdbe7b20c3e4f4a0926be (diff)
downloadFreeBSD-src-97a44a849e7f06367a2f6bcf955631c6747a1c2e.zip
FreeBSD-src-97a44a849e7f06367a2f6bcf955631c6747a1c2e.tar.gz
libc: Add fopencookie(3) wrapper around funopen(3)
Reviewed by: jhb, oshogbo Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6282
Diffstat (limited to 'include')
-rw-r--r--include/stdio.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/stdio.h b/include/stdio.h
index f55aaf7..7241386 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -58,6 +58,11 @@ typedef __ssize_t ssize_t;
#endif
#endif
+#ifndef _OFF64_T_DECLARED
+#define _OFF64_T_DECLARED
+typedef __off_t off64_t;
+#endif
+
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#ifndef _VA_LIST_DECLARED
typedef __va_list va_list;
@@ -427,6 +432,18 @@ FILE *funopen(const void *,
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
+typedef ssize_t (cookie_read_function_t)(void *, char *, size_t);
+typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
+typedef int (cookie_seek_function_t)(void *, off64_t *, int);
+typedef int (cookie_close_function_t)(void *);
+typedef struct {
+ cookie_read_function_t *read;
+ cookie_write_function_t *write;
+ cookie_seek_function_t *seek;
+ cookie_close_function_t *close;
+} cookie_io_functions_t;
+FILE *fopencookie(void *, const char *, cookie_io_functions_t);
+
/*
* Portability hacks. See <sys/types.h>.
*/
OpenPOWER on IntegriCloud