Mail Archives: djgpp-workers/1999/06/03/14:37:10
--Message-Boundary-11428
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
>
> On Tue, 1 Jun 1999, Mark E. wrote:
>
> > But when the no-inherit bit is set in the SFT, the child
> > does not inherit the handle.
>
> Sorry, I think I misunderstood the meaning of what you've said. Does
> the above mean that you tried to poke the bits in the SFT, and managed
> to get the handle's inherit properties changed accordingly?
>
Correct. I've attached an updated version of fcntl.c. I included the 18
handle inheritance limit comment in the CVS fcntl.c Also attached is
inherit.c so the F_SETFD feature in the updated fcntl.c can be tested.
Remember to link in the custom fcntl so you don't get bogus results.
F_SETFL should also work, but I haven't tested it yet. Note that
changes to the access mode (O_RDONLY, O_WRONLY, O_RDWR)
are ignored to obey the online Unix spec. The limitation may have been
derived from the Posix spec, but I don't have a Posix spec to check to
be certain.
---
Mark Elbrecht, snowball3 AT bigfoot DOT com
http://snowball.frogspace.net/
--Message-Boundary-11428
Content-type: text/plain; charset=US-ASCII
Content-disposition: inline
Content-description: Attachment information.
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.
---- File information -----------
File: fcntl.c
Date: 3 Jun 1999, 14:23
Size: 7171 bytes.
Type: Program-source
--Message-Boundary-11428
Content-type: Application/Octet-stream; name="fcntl.c"; type=Program-source
Content-disposition: attachment; filename="fcntl.c"
Content-transfer-encoding: BASE64
LyogQ29weXJpZ2h0IChDKSAxOTk5IERKIERlbG9yaWUsIHNlZSBDT1BZSU5HLkRKIGZvciBk
ZXRhaWxzICovDQovKiBDb3B5cmlnaHQgKEMpIDE5OTYgREogRGVsb3JpZSwgc2VlIENPUFlJ
TkcuREogZm9yIGRldGFpbHMgKi8NCi8qIENvcHlyaWdodCAoQykgMTk5NSBESiBEZWxvcmll
LCBzZWUgQ09QWUlORy5ESiBmb3IgZGV0YWlscyAqLw0KI2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g0KICAgICAgLyogSWdub3JlIHJlYWQgbG9ja3MgYmVj
YXVzZSBET1MvV2luZG93cyBzdXBwb3J0IG9ubHkgd3JpdGUgbG9ja3MNCiAgICAgICAgIGZv
ciByZWNvcmQgbG9ja2luZy4gICovDQogICAgICBpZiAobG9ja19yZXEtPmxfdHlwZSA9PSBG
X1VOTENLKQ0KICAgICAgew0KICAgICAgICByZXQgPSBfZG9zX3VubG9jayhmZCwgcG9zLCBs
ZW4pOw0KICAgICAgfQ0KICAgICAgZWxzZSBpZiAobG9ja19yZXEtPmxfdHlwZSA9PSBGX1dS
TENLKQ0KICAgICAgew0KICAgICAgICByZXQgPSBfZG9zX2xvY2soZmQsIHBvcywgbGVuKTsN
CiAgICAgICAgaWYgKHJldCA9PSAwICYmIGNtZCA9PSBGX0dFVExLKQ0KICAgICAgICAgIF9k
b3NfdW5sb2NrKGZkLCBwb3MsIGxlbik7DQogICAgICB9DQogICAgICBpZiAocmV0IDwgMCkN
CiAgICAgICAgZXJybm8gPSBFTk9TWVM7DQoNCiAgICAgIHJldHVybiByZXQ7DQogICAgfQ0K
ICB9DQogIGVycm5vID0gRU5PU1lTOw0KICByZXR1cm4gLTE7DQp9DQoNCg==
--Message-Boundary-11428
Content-type: text/plain; charset=US-ASCII
Content-disposition: inline
Content-description: Attachment information.
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.
---- File information -----------
File: inherit.c
Date: 3 Jun 1999, 14:13
Size: 1034 bytes.
Type: Program-source
--Message-Boundary-11428
Content-type: Application/Octet-stream; name="inherit.c"; type=Program-source
Content-disposition: attachment; filename="inherit.c"
Content-transfer-encoding: BASE64
I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8ZmNudGwuaD4NCiNpbmNsdWRlIDxwcm9j
ZXNzLmg+DQoNCmludCBtYWluKGludCBhcmd2LCBjaGFyICoqYX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