To: "Eli Zaretskii" Date: Sat, 26 Feb 2000 00:07:15 -0800 From: "Ken Yap" Message-ID: Mime-Version: 1.0 Cc: djgpp AT delorie DOT com X-Sent-Mail: off X-Mailer: MailCity Service Subject: Re: why isn't the FSEXT hook implemented for dup in 2.03? X-Sender-Ip: 165.228.129.12 Organization: My Deja Email (http://www.my-deja.com:80) Content-Type: text/plain; charset=us-ascii Content-Language: en Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com >> 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.