Mail Archives: djgpp/2000/02/26/03:15:45
>> I found that there is no hook from dup to FSEXT, so I can't dup network
>> sockets in WATT-32. Why isn't the dup hook to FSEXT implemented yet?
>
>Two reasons:
>
> - It's tricky, since FSEXT itself calls dup internally (to produce a
> valid file handle that __FSEXT_alloc_fd returns).
>
> - When this was discussed, it seemed to be rather unnecessary to
> hook dup. Can you explain under what circumstances do you need
> this, and why?
I'm using WATT-32 under DJGPP. WATT-32 implements dup for sockets with a use count. The text mode W3M browser (which I ported to DJGPP recently) uses dup in this way for ftp URLs:
ftprchan = fdopen(fd, "rb");
ftpwchan = fdopen(dup(fd), "wb");
I'm working around this by removing the dup for
DJGPP which means the socket gets closed twice. This is currently harmless as the first close decrements the use count to zero and then the second close does nothing (but returns EBADF).
It's not critical but it would be nice if DJGPP did the right thing for dup.
Cheers, Ken
--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.
- Raw text -