This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: java.io.FileDescriptor enhancement
- From: Michael Koch <konqueror at gmx dot de>
- To: tromey at redhat dot com
- Cc: java-patches at gcc dot gnu dot org
- Date: Tue, 1 Apr 2003 10:10:17 +0200
- Subject: Re: java.io.FileDescriptor enhancement
- References: <200303302015.38877.konqueror@gmx.de> <87k7eeyjqq.fsf@fleche.redhat.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Dienstag, 1. April 2003 05:33 schrieb Tom Tromey:
> >>>>> "Michael" == Michael Koch <konqueror at gmx dot de> writes:
>
> Michael> java.io.FileDescriptor in classpath has the
> package-private method Michael> getNativeFd() which returns the
> file descriptor used by the native Michael> implementation.
>
> Michael> I would like to introduce such a method too for the libgcj
> version to Michael> make it easier to use FileDescriptor objects
> (mainly for java.nio).
>
> Michael> What do you think about this ?
>
> First, I thought we hadn't finally decided on the representation of
> the native fd. We've talked at times about making it a RawData.
> `long' would probably work just as well, at least for the
> foreseeable future.
I wondered about the usage of 'long' for the native fd in classpath.
Why not int ? Isnt int big enough for 64 bit archs ? Or is it just to
be on the safe side ?
> Second, is there any way that java.nio can just use FileDescriptor?
> I haven't read about java.nio, so I don't know the issues, but I'm
> concerned about two things: first, that we'll be making the
> platform layer more confusing and harder to maintain; second, that
> we'll end up with problems where both some java.nio object and some
> FileDescriptor object think they own some fd, and one closes it
> while the other thinks it should be open. Sharing the
> FileDescriptor would prevent this sort of thing.
I want to avoid using the native fd directly in java.nio because it
cannot be shared. And the advantage is that it handles close()
correctly when called more then once. With long (int) as fd type we
will have problems.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+iUlqWSOgCCdjSDsRAqaFAKCUOf2xm3q8301n6h07Q6Kv6GKKeACfZOLq
U3Yl7MCWUgSMhvJdj+YQfu8=
=ubAc
-----END PGP SIGNATURE-----