Re: [PATCH] paccept, socket, socketpair w/flags

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ulrich Drepper
Date: Monday, April 28, 2008 - 8:13 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Kerrisk wrote:

If the range of the existing parameter can indeed be restricted as
needed for the flags it is the better approach for programmers since all
that is needed for a programmer to do is to write


   fd = socket(PF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0);
   if (fd == -1 && errno == EINVAL)
     {
       fd = socket(PF_INET, SOCK_STREAM, 0);
       if (fd != -1)
         fcntl(fd, F_SETFD, FD_CLOEXEC);
     }

No autoconf code needed to detect the presence of a new function.  You
can even imagine that convenience libraries will do the above
automatically (not libc, though, where you want to recognize this
situation).



Use O_CLOEXEC, normal filesystem operation.


New flag.



Yes, they are all related interfaces.  Using the same name indicates
similarity.


And just to complicate things even more:

if we'd go with sys_indirect we can have single way to specify
close-on-exec for all syscalls.  That would be at the syscall level.  At
the API level we'd still need separate names and possibly values.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFIFemb2ijCOnn/RHQRAjNCAJ0QCvEJoynwbPveUZQqsyVnEAHtmgCZAe0R
jNlcvQFI06n2ckFhEqUcEbE=
=sJhN
-----END PGP SIGNATURE-----
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] paccept, socket, socketpair w/flags, Ulrich Drepper, (Sat Apr 26, 3:24 pm)
Re: [PATCH] paccept, socket, socketpair w/flags, Michael Kerrisk, (Mon Apr 28, 2:52 am)
Re: [PATCH] paccept, socket, socketpair w/flags, Ulrich Drepper, (Mon Apr 28, 7:13 am)
Re: [PATCH] paccept, socket, socketpair w/flags, Michael Kerrisk, (Mon Apr 28, 7:51 am)
Re: [PATCH] paccept, socket, socketpair w/flags, Ulrich Drepper, (Mon Apr 28, 8:13 am)
Re: [PATCH] paccept, socket, socketpair w/flags, Michael Kerrisk, (Mon Apr 28, 8:29 am)