about summary refs log tree commit diff
path: root/src/stdio/getchar_unlocked.c
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2017-12-05 16:04:43 -0500
committerRich Felker <dalias@aerifal.cx>2017-12-06 13:11:48 -0500
commit061843340fbf2493bb615e20e66f60c5d1ef0455 (patch)
tree0613a9ef9b70c5bd3653617b56cf7ca1a615325a /src/stdio/getchar_unlocked.c
parent4000b0107ddd7fe733fa31d4f078c6fcd35851d6 (diff)
downloadmusl-061843340fbf2493bb615e20e66f60c5d1ef0455.tar.gz
musl-061843340fbf2493bb615e20e66f60c5d1ef0455.tar.xz
musl-061843340fbf2493bb615e20e66f60c5d1ef0455.zip
implement the fopencookie extension to stdio
notes added by maintainer:

this function is a GNU extension. it was chosen over the similar BSD
function funopen because the latter depends on fpos_t being an
arithmetic type as part of its public API, conflicting with our
definition of fpos_t and with the intent that it be an opaque type. it
was accepted for inclusion because, despite not being widely used, it
is usually very difficult to extricate software using it from the
dependency on it.

calling pattern for the read and write callbacks is not likely to
match glibc or other implementations, but should work with any
reasonable callbacks. in particular the read function is never called
without at least one byte being needed to satisfy its caller, so that
spurious blocking is not introduced.

contracts for what callbacks called from inside libc/stdio can do are
always complicated, and at some point still need to be specified
explicitly. at the very least, the callbacks must return or block
indefinitely (they cannot perform nonlocal exits) and they should not
make calls to stdio using their own FILE as an argument.
Diffstat (limited to 'src/stdio/getchar_unlocked.c')
0 files changed, 0 insertions, 0 deletions