Re: O_SAFER (was: fcntl module)

2009-08-24 Thread Bruno Haible
Eric Blake wrote: > For that matter, proposing an O_SAFER to the glibc folks might be worthwhile. Yes, but better call it O_NONSTD. The term "safer" will confuse people who care about security, I think, and is not specific. The term should make clear that it won't return any STD*_FILENO. > At whi

Re: fcntl module

2009-08-24 Thread Bruno Haible
Eric Blake wrote: > most users go via > "unistd--.h" which can adjust the #define appropriately. Good point. So we can go with a generic primitive under the hood, and don't need to provide the *_safer variant as a function - as a macro it is enough. > /* Duplicate FD into a new file descriptor,

Re: fcntl module

2009-08-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 8/23/2009 8:37 PM: > For that matter, proposing an > O_SAFER to the glibc folks might be worthwhile. With kernel support for O_SAFER, our *_safer paradigms could even be more efficient (no fd_safer after the fact, so fewer k

Re: fcntl module

2009-08-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 8/23/2009 6:01 PM: > Now that we have pipe2, accept4, the next step is to combine them with > the *-safer functionality. This overlaps with F_DUPFD and F_DUPFD_CLOEXEC. > So, the actual better primitives are > dup_ex (i

Re: fcntl module

2009-08-23 Thread Bruno Haible
Eric Blake wrote: > So maybe at this point I will regroup a bit and figure out how to replace > broken fcntl on Unix-y systems, and focus on F_DUPFD_CLOEXEC first. Now that we have pipe2, accept4, the next step is to combine them with the *-safer functionality. This overlaps with F_DUPFD and F_DUP

Re: fcntl module

2009-08-23 Thread Paolo Bonzini
On 08/22/2009 06:36 PM, Bruno Haible wrote: Paolo Bonzini wrote: Also, actually the flags can be accessed; it's undocumented but it can be found. See for example these files, taken from Perl and Ruby respectively: http://downloads.activestate.com/contrib.old/ntsock.cpp http://www.google.com/co

Re: fcntl module

2009-08-22 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 8/22/2009 5:59 AM: > Hi Eric, > >> First order of business - we need two modules based on the fcntl name, one >> for the header ... and one for the function. > > Yes, absolutely. > > Your 3 patches look all fine, except

Re: fcntl module

2009-08-22 Thread Bruno Haible
Eric Blake wrote: > What's the difference between dup2_ex and dup3, other than the set of > valid flags accepted? It's the same as dup3. I woke up a bit late on this thread. Bruno

Re: fcntl module

2009-08-22 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 8/22/2009 5:59 AM: > I therefore think that instead of offering the POSIXy fcntl call, > gnulib should offer functions like dup, dup2, dup_safer, fd_safer, > that take a flags argument as additional parameter. > int dup_e

Re: fcntl module

2009-08-22 Thread Bruno Haible
Paolo Bonzini wrote: > Also, actually the flags can be accessed; it's undocumented but it can > be found. See for example these files, taken from Perl and Ruby > respectively: > > http://downloads.activestate.com/contrib.old/ntsock.cpp > http://www.google.com/codesearch/p#-ImLthoNrik/ruby-1.8.6

Re: fcntl module

2009-08-22 Thread Paolo Bonzini
On 08/22/2009 01:59 PM, Bruno Haible wrote: But the flags stored inside MSVCRT for fd cannot be directly accessed. Ah okay now I understand the other message. I think we're safe if we only support _setting_ the flag, and not clearing it. Most of the use cases are like this. Also, actually

Re: fcntl module (was: O_CLOEXEC support)

2009-08-22 Thread Bruno Haible
Hi Eric, > First order of business - we need two modules based on the fcntl name, one > for the header ... and one for the function. Yes, absolutely. Your 3 patches look all fine, except for the mingw replacement of fcntl(). +static int +dupfd (int fd, int desired_fd) +{ + /* Although this loo

Re: fcntl module

2009-08-22 Thread Paolo Bonzini
I name the fnctl(2) replacement module? On the other hand, why not rename the header module to fcntl-h, and re-purpose the fcntl module name to cover the function? My preference is the latter, given that we already have a gettext/gettext-h module doing a similar job. Agreed. Additionally

fcntl module (was: O_CLOEXEC support)

2009-08-21 Thread Eric Blake
d other fcntl(2) items), and one for the function. If we keep the existing fcntl name as the header, then what should I name the fnctl(2) replacement module? On the other hand, why not rename the header module to fcntl-h, and re-purpose the fcntl module name to cover the function? My preferenc

Re: make fcntl module detect O_NOATIME, O_NOFOLLOW on GNU/Linux

2009-04-14 Thread Bruno Haible
Ben Pfaff wrote: > >> Make fcntl module detect O_NOATIME, O_NOFOLLOW on GNU/Linux. > > > > Looks correct to me. > > Thanks, I pushed this to master. Fine. I'm adding a comment and also a dependency in the module (needed if an autoconf < 2.62 is in use)

Re: make fcntl module detect O_NOATIME, O_NOFOLLOW on GNU/Linux

2009-04-13 Thread Ben Pfaff
s needed to define those >> constants. >> >> Anyone object to me pushing this? >> >> Make fcntl module detect O_NOATIME, O_NOFOLLOW on GNU/Linux. > > Looks correct to me. Thanks, I pushed this to master. -- "There's only one thing that will

Re: make fcntl module detect O_NOATIME, O_NOFOLLOW on GNU/Linux

2009-04-13 Thread Eric Blake
CE is needed to define those > constants. > > Anyone object to me pushing this? > > Make fcntl module detect O_NOATIME, O_NOFOLLOW on GNU/Linux. Looks correct to me. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -BEGI

make fcntl module detect O_NOATIME, O_NOFOLLOW on GNU/Linux

2009-04-12 Thread Ben Pfaff
s? commit b9ea9d8163fc97ad8940cfa681a6c4ceb0fc531c Author: Ben Pfaff Date: Sun Apr 12 16:31:16 2009 -0700 Make fcntl module detect O_NOATIME, O_NOFOLLOW on GNU/Linux. diff --git a/ChangeLog b/ChangeLog index 80aed98..400685b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-12 Ben Pfaff + + Make fcntl mod