delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/07/19:31:46

Message-ID: <03ef01c2b6a3$1b81efa0$0600000a@broadpark.no>
From: "Gisle Vanem" <giva AT bgnett DOT no>
To: <djgpp-workers AT delorie DOT com>
References: <015901c2b663$31c29b10$0600000a AT broadpark DOT no> <3E1B05D3 DOT 89AC0847 AT phekda DOT freeserve DOT co DOT uk>
Subject: Re: fd_props, what is it?
Date: Wed, 8 Jan 2003 00:18:37 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Reply-To: djgpp-workers AT delorie DOT com

"Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk> said:
 
> The code for FSEXT and fd_props in is in src/libc/fsext and src/libc/dos/io.
> There's not much of it and it's worth reading.  You should be able to use
> fd_props for FSEXT-allocated handles. You may want to ensure that no
> filesystem functions end up handling your file descriptor, though, by making
> the FSEXT handler function just fail for any functions you're not hooking.

I do that except when the fd isn't a socket or creat() or an unknown __FSEXT_xx
func was called. 

> > Can it be used (or extended) to make some sort of virtual dir-list of
> > "/dev/socket/"?
> 
> You can support /dev/socket/* by adding an FSEXT open handler. See:
> 
>     info libc alpha __FSEXT_add_open_handler


Was just a thought for something cool things to do with the new functions
in 2.04. I really don't need such functionallity since socket()  creates the 
fd.

> If you have a copy of DJGPP CVS (what will become 2.04 someday), take a look
> at the code to support /dev/zero and /dev/full in src/libc/fsext/fse_zero.c.
> This copes with multiple references to /dev/zero and /dev/full. Maybe this
> will help.

Thanks alot. I'll have a look.
 
> I'd decrease the reference count in the per-socket block. If the count reaches
> zero, do the socket clean-up.

That's excactly what I'm doing now.

> I don't think FILE_DESC_TEMPORARY does what you want either. This is for
> removing physical files on close. OTOH if you have a remove handler for the
> socket, you can do what you want. (close will call remove for file descriptors
> with FILE_DESC_TEMPORARY set in fd_props.)
> 
> Hope that helps.

Thanks for the consise explanation.

BTW. I became aware of Salford C/C++ today. Look at what amasing runtime
checks can be done with this compiler. Have a look this folks:
  http://www.polyhedron.co.uk/salford/whitepapers/check.html

The DOSX version is shelved some years ago. I'm in contact with them for 
releasing it as freeware. Another port for Watt-32...

Gisle V.

# echo 'GET /laid HTTP/1.0' | /bin/nc www.hotsluts.com 80
/bin/nc: Host is down (EHOSTDOWN)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019