about summary refs log tree commit diff
path: root/src/stdio/__stdio_seek.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-07-16 20:44:22 -0400
committerRich Felker <dalias@aerifal.cx>2014-07-28 00:27:59 -0400
commitcad5e1c8baf0d97d3b4195864c46fa68f0a1b0b6 (patch)
tree56e0fb22d07b210fb145c21d2f84d4971a6877fd /src/stdio/__stdio_seek.c
parentbdd4c57e2588bf3cf273bcc3ff04a7584aa3391c (diff)
downloadmusl-cad5e1c8baf0d97d3b4195864c46fa68f0a1b0b6.tar.gz
musl-cad5e1c8baf0d97d3b4195864c46fa68f0a1b0b6.tar.xz
musl-cad5e1c8baf0d97d3b4195864c46fa68f0a1b0b6.zip
simplify __stdio_exit static linking logic
the purpose of this logic is to avoid linking __stdio_exit unless any
stdio reads (which might require repositioning the file offset at exit
time) or writes (which might require flushing at exit time) could have
been performed.

previously, exit called two wrapper functions for __stdio_exit named
__flush_on_exit and __seek_on_exit. both of these functions actually
performed both tasks (seek and flushing) by calling the underlying
__stdio_exit. in order to avoid doing this twice, an overridable data
object __towrite_used was used to cause __seek_on_exit to act as a nop
when __towrite was linked.

now, exit only makes one call, directly to __stdio_exit. this is
satisfiable by a weak dummy definition in exit.c, but the real
definition is pulled in by either __toread.c or __towrite.c through
their referencing a symbol which is defined only in __stdio_exit.c.

(cherry picked from commit c463e11eda8326aacee2ac1d516954a9574a2dcd)
Diffstat (limited to 'src/stdio/__stdio_seek.c')
0 files changed, 0 insertions, 0 deletions