History log of /seL4-camkes-master/projects/musllibc/src/stdio/fmemopen.c
Revision Date Author Comments
# 1b0cdc87 16-Jun-2015 Rich Felker <dalias@aerifal.cx>

refactor stdio open file list handling, move it out of global libc struct

functions which open in-memory FILE stream variants all shared a tail
with __fdopen, adding the FILE structure to stdio's open file list.
replacing this common tail with a function call reduces code size and
duplication of logic. the list is also partially encapsulated now.

function signatures were chosen to facilitate tail call optimization
and reduce the need for additional accessor functions.

with these changes, static linked programs that do not use stdio no
longer have an open file list at all.


# dc059f03 09-Nov-2012 Rich Felker <dalias@aerifal.cx>

always add memory streams to stdio open file list

per interpretation for austin group issue #626, fflush(0) and exit()
must block waiting for a lock if another thread has locked a memory
stream with flockfile. this adds some otherwise-unnecessary
synchronization cost to use of memory streams, but there was already a
synchronization cost calling malloc anyway.

previously the stream was only added to the open file list in
single-threaded programs, so that upon subsequent call to
pthread_create, locking could be turned on for the stream.


# 835f9f95 08-Nov-2012 Rich Felker <dalias@aerifal.cx>

clean up stdio_impl.h

this header evolved to facilitate the extremely lazy practice of
omitting explicit includes of the necessary headers in individual
stdio source files; not only was this sloppy, but it also increased
build time.

now, stdio_impl.h is only including the headers it needs for its own
use; any further headers needed by source files are included directly
where needed.


# 400c5e5c 06-Sep-2012 Rich Felker <dalias@aerifal.cx>

use restrict everywhere it's required by c99 and/or posix 2008

to deal with the fact that the public headers may be used with pre-c99
compilers, __restrict is used in place of restrict, and defined
appropriately for any supported compiler. we also avoid the form
[restrict] since older versions of gcc rejected it due to a bug in the
original c99 standard, and instead use the form *restrict.


# d2e061a2 04-Sep-2011 Rich Felker <dalias@aerifal.cx>

more fmemopen null termination fixes

null termination is only added when current size grows.
in update modes, null termination is not added if it does not fit
(i.e. it is not allowed to clobber data).

these rules make very little sense, but that's how it goes..


# e72ee578 04-Sep-2011 Rich Felker <dalias@aerifal.cx>

fix some fmemopen behaviors

read should not be allowed past "current size".
append mode should write at "current size", not buffer size.
null termination should not be written except when "current size" grows.


# 22e45423 04-Sep-2011 Rich Felker <dalias@aerifal.cx>

fmemopen: fix eof handling, hopefully right this time


# f81279ff 04-Sep-2011 Rich Felker <dalias@aerifal.cx>

fmemopen fixes

disallow seek past end of buffer (per posix)
fix position accounting to include data buffered for read
don't set eof flag when no data was requested


# d4fa6f0e 03-Sep-2011 Rich Felker <dalias@aerifal.cx>

implement fmemopen

testing so far has been minimal. may need further work.


# 9dd7d7e3 14-Mar-2011 Rich Felker <dalias@aerifal.cx>

partially-written draft of fmemopen, still in #if 0


# 0b44a031 11-Feb-2011 Rich Felker <dalias@aerifal.cx>

initial check-in, version 0.5.0