(vm/vm.h): Added.
(open): Call vm_abort.
* src/native/vm/cldc1.1/com_sun_cldc_io_j2me_socket_Protocol.c
(unistd.h): Added.
(readByte): New function.
(writeBuf): Likewise.
(available0): Likewise.
(close0): Likewise.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: boehm.c 7355 2007-02-14 10:57:32Z twisti $
+ $Id: boehm.c 7309 2007-02-09 12:51:00Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: gc-common.h 7297 2007-02-07 14:59:56Z twisti $
+ $Id: gc-common.h 7246 2007-01-29 18:49:05Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: memory.c 7370 2007-02-16 18:00:03Z twisti $
+ $Id: memory.c 7369 2007-02-16 17:56:40Z twisti $
*/
Changes: Christian Thalinger
- $Id: memory.h 7356 2007-02-14 11:00:28Z twisti $
+ $Id: memory.h 7338 2007-02-13 00:17:22Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jni.h 7297 2007-02-07 14:59:56Z twisti $
+ $Id: jni.h 7246 2007-01-29 18:49:05Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.c 7486 2007-03-08 13:50:07Z twisti $
+ $Id: native.c 7464 2007-03-06 00:26:31Z edwin $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.h 7356 2007-02-14 11:00:28Z twisti $
+ $Id: native.h 7328 2007-02-11 21:22:07Z twisti $
*/
#include "native/include/java_lang_Object.h"
#include "native/include/java_lang_String.h"
+#include "vm/vm.h" /* REMOVE ME: temporarily */
+
/*
* Class: com/sun/cldc/io/ResourceInputStream
*/
JNIEXPORT java_lang_Object* JNICALL Java_com_sun_cldc_io_ResourceInputStream_open(JNIEnv *env, jclass clazz, java_lang_String *name)
{
- exceptions_throw_outofmemoryerror();
+ vm_abort("Java_com_sun_cldc_io_ResourceInputStream_open: IMPLEMENT ME!");
return NULL;
}
#include <errno.h>
#include <netdb.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "native/jni.h"
#include "vm/global.h"
+#include "vm/vm.h" /* REMOVE ME: temporarily */
/*
/* fill the sockaddr structure */
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_port = htons(port);
+ serv_addr.sin_family = AF_INET;
+ serv_addr.sin_port = htons(port);
- MCOPY(&serv_addr.sin_addr, phostent->h_addr, u1, phostent->h_length);
+ MCOPY(&serv_addr.sin_addr, phostent->h_addr, u1, phostent->h_length);
/* create the socket */
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
+ sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
return -1;
}
+/*
+ * Class: com/sun/cldc/io/j2me/socket/Protocol
+ * Method: readByte
+ * Signature: (I)I
+ */
+JNIEXPORT s4 JNICALL Java_com_sun_cldc_io_j2me_socket_Protocol_readByte(JNIEnv *env, jclass clazz, s4 handle) {
+
+ char byte;
+ ssize_t result;
+
+ /* receive from the socket */
+
+ result = recv(handle, &byte, 1, 0);
+
+ if (result == 0) {
+ /* the peer has performed an orderly shutdown */
+
+ return -1;
+ }
+ else if (result < 0) {
+ /* should throw an IOException */
+
+ vm_abort("Java_com_sun_cldc_io_j2me_socket_Protocol_readByte: recv failed: %s", strerror(errno));
+ }
+
+ return byte;
+}
+
+
+/*
+ * Class: com/sun/cldc/io/j2me/socket/Protocol
+ * Method: writeBuf
+ * Signature: (I[BII)I
+ */
+JNIEXPORT s4 JNICALL Java_com_sun_cldc_io_j2me_socket_Protocol_writeBuf(JNIEnv *env, jclass clazz, s4 handle, java_bytearray* b, s4 off, s4 len) {
+
+ void *buf;
+ ssize_t result;
+
+ /* get pointer to the buffer */
+
+ buf = &(b->data[off]);
+
+ /* send the given byte to the socket */
+
+ result = send(handle, buf, len, 0);
+
+ if (result < 0)
+ /* should throw an IOException */
+
+ vm_abort("Java_com_sun_cldc_io_j2me_socket_Protocol_writeBuf: send failed: %s", strerror(errno));
+
+ return result;
+
+}
+
+
/*
* Class: com/sun/cldc/io/j2me/socket/Protocol
* Method: writeByte
}
+/*
+ * Class: com/sun/cldc/io/j2me/socket/Protocol
+ * Method: available0
+ * Signature: (I)I
+ */
+JNIEXPORT s4 JNICALL Java_com_sun_cldc_io_j2me_socket_Protocol_available0(JNIEnv *env, jclass clazz, s4 handle)
+{
+ /* NOTE: Sun doesn't have an implementation too */
+
+ return 0;
+}
+
+
+/*
+ * Class: com/sun/cldc/io/j2me/socket/Protocol
+ * Method: close0
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_com_sun_cldc_io_j2me_socket_Protocol_close0(JNIEnv *env, jclass clazz, s4 handle)
+{
+ int result;
+
+ /* close the file descriptor */
+
+ result = close(handle);
+
+ if (result < 0)
+ vm_abort("Java_com_sun_cldc_io_j2me_socket_Protocol_close0: close failed: %s", strerror(errno));
+}
+
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: gnu_classpath_VMStackWalker.c 7297 2007-02-07 14:59:56Z twisti $
+ $Id: gnu_classpath_VMStackWalker.c 7246 2007-01-29 18:49:05Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMClassLoader.c 7413 2007-02-27 21:51:17Z twisti $
+ $Id: java_lang_VMClassLoader.c 7408 2007-02-26 22:11:38Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: threads.c 7486 2007-03-08 13:50:07Z twisti $
+ $Id: threads.c 7478 2007-03-08 02:59:31Z michi $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: threads.h 7486 2007-03-08 13:50:07Z twisti $
+ $Id: threads.h 7474 2007-03-07 11:47:45Z michi $
*/
Joseph Wenninger
Christian Thalinger
- $Id: global.h 7413 2007-02-27 21:51:17Z twisti $
+ $Id: global.h 7387 2007-02-21 23:26:24Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 7486 2007-03-08 13:50:07Z twisti $
+ $Id: codegen.c 7448 2007-03-04 14:46:21Z edwin $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: stacktrace.h 7413 2007-02-27 21:51:17Z twisti $
+ $Id: stacktrace.h 7409 2007-02-27 02:07:00Z ajordan $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: signal.c 7486 2007-03-08 13:50:07Z twisti $
+ $Id: signal.c 7471 2007-03-06 17:01:49Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: signallocal.h 7297 2007-02-07 14:59:56Z twisti $
+ $Id: signallocal.h 7286 2007-02-05 01:07:45Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: class.c 7486 2007-03-08 13:50:07Z twisti $
+ $Id: class.c 7464 2007-03-06 00:26:31Z edwin $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: class.h 7355 2007-02-14 10:57:32Z twisti $
+ $Id: class.h 7307 2007-02-09 12:47:10Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: loader.c 7486 2007-03-08 13:50:07Z twisti $
+ $Id: loader.c 7464 2007-03-06 00:26:31Z edwin $
*/