chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Questions/nitpicks about Posix I/O


From: John Cowan
Subject: Re: [Chicken-users] Questions/nitpicks about Posix I/O
Date: Fri, 6 Sep 2013 16:01:38 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

Scripsi:

> The two fds are not really independent: in particular, they share
> any locks, and it doesn't surprise me too much that they share the
> same append flag.

Indeed, that's implied by the wording of Posix fcntl():

    The new file descriptor shall refer to the same open file
    description as the original file descriptor, and shall share
    any locks.

So they'd share the same file position as well.  The main reason to
duplicate a fd at all is to cause a particular open file to become
standard input, output, or error:  you close 0, 1, or 2 as the case may
be, and then immediately duplicate the fd you have, which is compelled
to use the lowest free fd.

-- 
John Cowan    http://www.ccil.org/~cowan   <address@hidden>
    "Any legal document draws most of its meaning from context.  A telegram
    that says 'SELL HUNDRED THOUSAND SHARES IBM SHORT' (only 190 bits in
    5-bit Baudot code plus appropriate headers) is as good a legal document
    as any, even sans digital signature." --me



reply via email to

[Prev in Thread] Current Thread [Next in Thread]