All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chet Ramey <chet.ramey@case.edu>
To: sukadev@linux.vnet.ibm.com
Cc: linux-fsdevel@vger.kernel.org, bug-bash@gnu.org, chet@po.cwru.edu
Subject: Re: bash: Correct usage of F_SETFD
Date: Mon, 22 Nov 2010 17:16:40 -0500	[thread overview]
Message-ID: <101122221640.AA32947.SM@caleb.INS.CWRU.Edu> (raw)
In-Reply-To: Message from sukadev@linux.vnet.ibm.com of Mon, 22 Nov 2010 12:16:20 -0800 (id <20101122201620.GA16687@us.ibm.com>)

> 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).

> If kernel ever adds a new flag to the fd, this would end up clearing the
> other new flag right ?
> 
> Shouldn't bash use F_GETFD to get the current flags and set/clear just
> the FD_CLOEXEC bit ?

I suppose it would matter if there are systems that have more than one
flag value.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/

  reply	other threads:[~2010-11-22 22:16 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 [this message]
2010-11-22 22:27   ` Eric Blake
2010-11-23  0:04     ` Sukadev Bhattiprolu
2010-11-23 14:42       ` Matthew Wilcox
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=101122221640.AA32947.SM@caleb.INS.CWRU.Edu \
    --to=chet.ramey@case.edu \
    --cc=bug-bash@gnu.org \
    --cc=chet@po.cwru.edu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.