delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/04/05:37:21

Date: Wed, 4 Feb 1998 11:36:54 +0100 (CET)
Message-Id: <199802041036.LAA29383@login-2.eunet.no>
From: "Gisle Vanem" <giva AT bgnett DOT no>
To: djgpp AT delorie DOT com
cc: eliz AT is DOT elta DOT co DOT il
Subject: Re: FSEXT handles
MIME-Version: 1.0

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> said:

> > Lets say I create an handle X with socket() and install an extension
> > using __FSEXT_set_function (handle, func_parser). Note, socket() don't
> > use __FSEXT_add_open_handler().
> >
> > At the same time I have an open DOS file with handle Y=X.
>
> I don't understand how did you get that handle Y which is equal to X.
> A file handle is not just an integer variable with an arbitrary
> value.  Its value can only be produced by certain library functions
> which call DOS.

I meant that handle X came from a home-brew socket() function that
returns handles without knowing anything about DOS-handles or other
handles. Maybe there is a global array somewhere which could tell me
what handle are allocated and avoid returning them from socket() ?

> If both `socket' and the other code which gave
> you handle Y used one of these functions, you can never have two
> different handles which have the same value, unless they are used to
> access the same file or device.

Since `socket' doesn't call _open(), there is a chance that X=Y.
Maybe I have to allocate the socket() handle using __FSEXT_alloc_fd() 
after all?

Gisle V.

- Raw text -


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