WIN-28: fix POSIX file descriptor numbering assumptions

Adam Megacz gcj@lists.megacz.com
Fri Mar 1 21:19:00 GMT 2002


Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:
> How about putting the initialization of in/out/err into a native method 
> and calling it from a static initializer, ie:
>
> static
> {
>   initNative();
> }

I tried this -- unfortunately java.lang.System's <clinit> runs first,
and it read the not-yet-initialized values out of
FileDescriptor.{in|out|err} and crash trying to build a 'new
PrintStream(null)'.

If you initialize to 'new FileDescriptor(getFdFOO())', the compiler
figures out that it has to execute that code before it lets
System.java access the variable. I don't know why this happens.


> Also, you should add a fixme in the win32 code about how wrong it is to 
> store the file handle as an int!

Gotcha, I will.

Ok to commit with the FIXME?

  - a


-- 
"If I put copyrighted material into the 'chewy nougat center', I can
 claim the crunchy chocolate coating is an 'Access Control
 Mechanism'."                                     --lynx_user_abroad

Why Windows NT/2k/XP is unreliable: www.zappadoodle.com



More information about the Java-patches mailing list