Re: bash: Correct usage of F_SETFD

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

 



On Mon, Nov 22, 2010 at 04:04:46PM -0800, Sukadev Bhattiprolu wrote:
> Eric Blake [eblake@xxxxxxxxxx] 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."
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux