This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix BZ#16374 -- don't use mmap for FILE buffers


I believe we've reached a consensus in -- using
mmap to allocate FILE buffers is really not a good idea.

Attached patch replaces mmap()s with calloc()s. Doing this revealed a
few cleanup bugs: wide stream and input-only buffers were not cleaned
up under some conditions.

Tested on Linux/x86_64 with no new failures.

2015-02-16  Paul Pluzhnikov  <>

        [BZ #16374]
        * NEWS: mention 16374
        * libio/filedoalloc.c (_IO_file_doallocate,
_IO_default_doallocate): Use calloc instead of ALLOC_BUF
        (_IO_setb, _IO_default_finish): Use free instead of FREE_BUF
        (_IO_default_finish): Likewise. Fix cleanup bugs.
        (libc_freeres_fn): Clean up wide stream buffers.
        * libio/libio.h (struct _IO_FILE_complete): Delete
_freeres_size, add _freeres_wbuf
        * libio/libioP.h (ROUND_TO_PAGE, FREE_BUF, ALLOC_BUF,
        * libio/wfiledoalloc.c (_IO_wfile_doallocate): Use calloc
instead of ALLOC_WBUF
        * libio/wgenops.c (_IO_wdefault_doallocate): Likewise
        (_IO_wsetb, _IO_wdefault_finish): Use free instead of FREE_BUF

Paul Pluzhnikov

Attachment: bz16734.patch5.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]