Socket Handles duplicated twice after fork

Corinna Vinschen corinna-cygwin@cygwin.com
Mon May 13 04:39:00 GMT 2002


On Wed, May 08, 2002 at 11:42:54AM -0400, David E Euresti wrote:
> #include <unistd.h>
> #include <io.h>
> #include <sys/socket.h>
> #include <stdio.h>
> 
> int main() {
>   int fds[2];
>   int pid;
> 
>   socketpair (AF_UNIX, SOCK_STREAM, 0, fds);
> 
>   pid = fork ();
>   if (pid == 0) {
>     printf("Child: Sockets are 0x%x 0x%x\n",
> 	   get_osfhandle(fds[0]), get_osfhandle(fds[1]));
>     sleep(300);
>   }
>   else {
>     printf("Parent: Sockets are 0x%x 0x%x\n",
> 	   get_osfhandle(fds[0]), get_osfhandle(fds[1]));
>     sleep(300);
>   }
> }

Could you please send an `strace -f' output running the above
code to the list?

Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list