www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/06/01/02:28:38

Date: Tue, 1 Jun 1999 09:25:53 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "Mark E." <snowball3 AT bigfoot DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Re: enhancements to fcntl.c
In-Reply-To: <199905311824.SAA72470@out2.ibm.net>
Message-ID: <Pine.SUN.3.91.990601092349.19912E-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 31 May 1999, Mark E. wrote:

> From experimentation, it seems the no-inherit bit is stored with the
> file mode instead of the device info word.

It works for me both ways (see the test programs in my other mail).
That is, both the device info word at offset 5 in the SFT and the file
mode.  I think the reason that you don't find the no-inherit bit at
offset 5 is because you access it as a byte, not as a word:

> unsigned char sft_entry[64];
[snip]
>   printf("Testing device info byte for no-inherit flag... ");
>   if (sft_entry[5] & (1<<12))
>     printf("found!\n");

You need to cast sft_entry[5] to a short, like this:

    if (*(unsigned short *)&sft_entry[5] & (1<<12))

Also note that using `open' with the O_NOINHERIT bit will currently
only work on LFN platforms, since the non-LFN code of `_open' calls
function 3Dh which doesn't support that bit.  I used a modified
version of `_open' that calls function 6Ch on non-LFN systems to test
this (also included with test programs in my other mail).

> I'd be interested to know if this is also true with Win NT.

It seems to work, at least as far as the no-inherit bit is concerned, but 
only in the device info word at offset 5. Tested on NT v4.00SP3.

- Raw text -


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