This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Socket Handles duplicated twice after fork


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]