From: Matthew Wilcox <matthew@wil.cx>
To: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Eric Blake <eblake@redhat.com>,
chet.ramey@case.edu, linux-fsdevel@vger.kernel.org,
bug-bash@gnu.org, chet@po.cwru.edu
Subject: Re: bash: Correct usage of F_SETFD
Date: Tue, 23 Nov 2010 07:42:39 -0700 [thread overview]
Message-ID: <20101123144239.GL6178@parisc-linux.org> (raw)
In-Reply-To: <20101123000446.GA24667@us.ibm.com>
On Mon, Nov 22, 2010 at 04:04:46PM -0800, Sukadev Bhattiprolu wrote:
> Eric Blake [eblake@redhat.com] wrote:
> | On 11/22/2010 03:16 PM, Chet Ramey wrote:
> | >> include/filecntl.h in bash-4.1 has following:
> | >>
> | >> #define SET_CLOSE_ON_EXEC(fd) (fcntl ((fd), F_SETFD, FD_CLOEXEC))
> | >>
> | >> Is that really the correct/intended usage of F_SETFD ?
> | >
> | > F_SETFD Set the close-on-exec flag associated with fildes to
> | > the low order bit of arg (0 or 1 as above).
>
> Is that the POSIX definition ? Following man page does not limit F_SETFD to
> FD_CLOEXEC:
>
> http://www.kernel.org/doc/man-pages/online/pages/man2/fcntl.2.html
>
> F_SETFD (long)
> Set the file descriptor flags to the value specified by arg.
The POSIX definition can be found here:
http://www.opengroup.org/onlinepubs/009695399/functions/fcntl.html
> | In practice, there aren't any such systems; but POSIX warns that current
> | practice is no indicator of future systems, and that read-modify-write
> | is the only way to use F_SETFD.
>
> Yes, that seems to make more sense.
I think future flags will be created such that they default to off,
and bash would have to affirmitively set them in order to use them.
So if bash is the one creating its file descriptors, there's no need to
use R/M/W since it knows what the state of them are.
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
next prev parent reply other threads:[~2010-11-23 14:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-22 20:16 bash: Correct usage of F_SETFD Sukadev Bhattiprolu
2010-11-22 22:16 ` Chet Ramey
2010-11-22 22:27 ` Eric Blake
2010-11-23 0:04 ` Sukadev Bhattiprolu
2010-11-23 14:42 ` Matthew Wilcox [this message]
2010-11-23 14:51 ` Eric Blake
2010-11-23 17:51 ` Sukadev Bhattiprolu
2010-11-24 1:17 ` Jamie Lokier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101123144239.GL6178@parisc-linux.org \
--to=matthew@wil.cx \
--cc=bug-bash@gnu.org \
--cc=chet.ramey@case.edu \
--cc=chet@po.cwru.edu \
--cc=eblake@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).