1 .\" Copyright (c) 2016, EMC / Isilon Storage Division
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
14 .\" IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 .\" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
17 .\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 .\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 .\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 .\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 .Fn (*cookie_read_function_t) "void *cookie" "char *buf" "size_t size"
40 .Fn (*cookie_write_function_t) "void *cookie" "const char *buf" "size_t size"
42 .Fn (*cookie_seek_function_t) "void *cookie" "off64_t *offset" "int whence"
44 .Fn (*cookie_close_function_t) "void *cookie"
47 cookie_read_function_t *read;
48 cookie_write_function_t *write;
49 cookie_seek_function_t *seek;
50 cookie_close_function_t *close;
51 } cookie_io_functions_t;
54 .Fn fopencookie "void *cookie" "const char *mode" "cookie_io_functions_t io_funcs"
59 associates a stream with up to four
60 .Dq Tn I/O No functions .
63 functions will be used to read, write, seek and
66 In general, omitting a function means that any attempt to perform the
67 associated operation on the resulting stream will fail.
68 If the write function is omitted, data written to the stream is discarded.
69 If the close function is omitted, closing the stream will flush
70 any buffered output and then succeed.
72 The calling conventions of
77 must match those, respectively, of
82 with the single exception that they are passed the
86 in place of the traditional file descriptor argument.
89 function updates the current stream offset using
95 is non-NULL, it updates
97 with the current stream offset.
100 is implemented as a thin shim around the
103 Limitations, possibilities, and requirements of that interface apply to
106 Upon successful completion,
113 is returned and the global variable
115 is set to indicate the error.
129 for any of the errors
144 functions first appeared in
148 function first appeared in
153 function is a nonstandard glibc extension and may not be portable to systems