This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: new methods in gnu.java.net.Plain(Datagram)SocketImpl ?
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Sat, 20 Sep 2003 15:09:45 +0200
- Subject: Patch: new methods in gnu.java.net.Plain(Datagram)SocketImpl ?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I would like to add one new method to PlainDatagramSocketImpl and
PlainSocketImpl called getNativeFD:
public int getNativeFD();
This method should return the native file description of the the
socket. There is imho no security concern about this an user
application can only get file descriptors of self created socket
objects. Neither java.net nor java.nio allow the access to socket
implementation objects after the the creation of sockets or socket
channels.
Any Comments ? Ok to commit to trunk ?
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/bFGbWSOgCCdjSDsRAvjWAKCa5ER3LmDMcom1YaOVdfeevF1r9wCghNcB
k/4I8I+ChYE7965hGB06akA=
=FW18
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2161
diff -u -b -B -r1.2161 ChangeLog
--- ChangeLog 19 Sep 2003 21:12:56 -0000 1.2161
+++ ChangeLog 20 Sep 2003 12:59:36 -0000
@@ -1,3 +1,11 @@
+2003-09-20 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/net/PlainDatagramSocketImpl.java
+ (finalize): Moved to directly after constructor.
+ (getNativeFD): New method.
+ * gnu/java/net/PlainSocketImpl.java
+ (getNativeFD): New method.
+
2003-09-19 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/NIODatagramSocket.java,
Index: gnu/java/net/PlainDatagramSocketImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/PlainDatagramSocketImpl.java,v
retrieving revision 1.1
diff -u -b -B -r1.1 PlainDatagramSocketImpl.java
--- gnu/java/net/PlainDatagramSocketImpl.java 10 Sep 2003 17:39:20 -0000 1.1
+++ gnu/java/net/PlainDatagramSocketImpl.java 20 Sep 2003 12:59:36 -0000
@@ -112,6 +112,21 @@
{
}
+ protected void finalize() throws Throwable
+ {
+ synchronized (this)
+ {
+ if (fnum != -1)
+ close();
+ }
+ super.finalize();
+ }
+
+ public int getNativeFD()
+ {
+ return fnum;
+ }
+
/**
* Binds this socket to a particular port and interface
*
@@ -266,15 +281,5 @@
throws IOException
{
mcastGrp(((InetSocketAddress)mcastaddr).getAddress(), netIf, false);
- }
-
- protected void finalize() throws Throwable
- {
- synchronized (this)
- {
- if (fnum != -1)
- close();
- }
- super.finalize();
}
}
Index: gnu/java/net/PlainSocketImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/PlainSocketImpl.java,v
retrieving revision 1.1
diff -u -b -B -r1.1 PlainSocketImpl.java
--- gnu/java/net/PlainSocketImpl.java 10 Sep 2003 17:39:20 -0000 1.1
+++ gnu/java/net/PlainSocketImpl.java 20 Sep 2003 12:59:36 -0000
@@ -142,6 +142,11 @@
super.finalize();
}
+ public int getNativeFD()
+ {
+ return fnum;
+ }
+
/**
* Sets the specified option on a socket to the passed in object. For
* options that take an integer argument, the passed in object is an