Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 28 Sep 2012 17:35:01 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: funopen() from BSD

On Fri, Sep 28, 2012 at 11:01:32PM +0200, Daniel Cegiełka wrote:
> Hi,
> 
> Rich wrote about files/threads locking. I'm trying to implement
> functions funopen() and port it to musl.

A few general comments...

1. musl does not support 32-bit file offsets. All of the 32/64
distinction stuff can be removed. off_t is always 64-bit.

2. The original documentation states that the read/write functions can
call setvbuf on the file to change its buffer. This imposes a huge
restriction on the implementation that's not acceptable to musl. If
that's part of the API, maybe we can look for some kind of workaround
to block attempts to mess with the buffer, but it's hard since legal
buffering changes (i.e. first action after open) should not be
blocked.

3. flockfile/funlockfile are not musl functions, they're POSIX. Since
funopen isn't part of plain ISO C, it's allowable to call them from
funopen stuff, but it's going to impose unnecessary locking. The
locking operations you want are FLOCK() and FUNLOCK() macros in
stdio_impl.h.

I don't see any reason why funopen can't go in, but a little bit of
motivation for why it's needed would be nice since it is mildly messy.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.