From nobody@FreeBSD.org Tue Oct 22 04:53:17 2002 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B044E37B401 for ; Tue, 22 Oct 2002 04:53:17 -0700 (PDT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D6F743E6A for ; Tue, 22 Oct 2002 04:53:17 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g9MBrF7R045945 for ; Tue, 22 Oct 2002 04:53:15 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.6/8.12.6/Submit) id g9MBrF9d045944; Tue, 22 Oct 2002 04:53:15 -0700 (PDT) Message-Id: <200210221153.g9MBrF9d045944@www.freebsd.org> Date: Tue, 22 Oct 2002 04:53:15 -0700 (PDT) From: huang wen hui To: freebsd-gnats-submit@FreeBSD.org Subject: patch for java-commapi-freebsd X-Send-Pr-Version: www-1.0 >Number: 44380 >Category: java >Synopsis: patch for java-commapi-freebsd >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-java >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Oct 22 05:00:11 PDT 2002 >Closed-Date: Tue Jun 10 09:45:31 PDT 2003 >Last-Modified: Tue Jun 10 09:45:31 PDT 2003 >Originator: huang wen hui >Release: 4.6-STABLE >Organization: gddsn >Environment: FreeBSD wfdb.gddsn.org.cn 4.6-STABLE FreeBSD 4.6-STABLE #4: Sun Jul 21 20:43:12CST 2002 hwh@wfdb.gddsn.org.cn:/usr/obj/usr/src/sys/WFDB i386 >Description: 1. com port could not receive correct data, because patch is wrong 2. ComPort.getName() return null. >How-To-Repeat: Use /usr/ports/comms/java-commapi-freebsd. >Fix: *** libSerial.c.orig Mon Jul 19 11:45:04 1999 --- src/org/freebsd/io/comm/libSerial.c Feb 22 11:19:43 2002 *************** *** 42,47 **** --- 42,48 ---- #include #include #include + #include #define IOEXCEPTION "java/io/IOException" #define USCOEXCEPTION "javax/comm/UnsupportedCommOperationException" *************** *** 420,426 **** jboolean isCopy; bytes = (*env)->GetByteArrayElements (env, b, &isCopy); ! ret = read ((int)sd, bytes, (size_t)length); (*env)->ReleaseByteArrayElements (env, b, bytes, 0); return (ret); } --- 421,427 ---- jboolean isCopy; bytes = (*env)->GetByteArrayElements (env, b, &isCopy); ! ret = read ((int)sd, bytes + offset, (size_t)length); (*env)->ReleaseByteArrayElements (env, b, bytes, 0); return (ret); } *************** *** 438,444 **** jboolean isCopy; bytes = (*env)->GetByteArrayElements (env, b, &isCopy); ! ret = write ((int)sd, bytes, (size_t)length); tcdrain ((int)sd); (*env)->ReleaseByteArrayElements (env, b, bytes, 0); return (ret); --- 439,445 ---- jboolean isCopy; bytes = (*env)->GetByteArrayElements (env, b, &isCopy); ! ret = write ((int)sd, bytes + offset, (size_t)length); tcdrain ((int)sd); (*env)->ReleaseByteArrayElements (env, b, bytes, 0); return (ret); *************** *** 579,586 **** { int state,old_state; int fd; ! fd_set rfds; ! struct timeval sleep; int size; int ret; --- 580,586 ---- { int state,old_state; int fd; ! struct pollfd pollfds; int size; int ret; *************** *** 595,605 **** jthread = (*env)->FindClass( env, "java/lang/Thread" ); interrupt = (*env)->GetStaticMethodID( env, jthread, "interrupted", "()Z" ); ! FD_ZERO( &rfds ); ! FD_SET( fd, &rfds ); ! sleep.tv_sec = 1; /* Check every 1 second, or on receive data */ ! sleep.tv_usec = 0; ! /* Initialization of the current tty state */ ioctl( fd, TIOCMGET, &old_state); --- 595,604 ---- jthread = (*env)->FindClass( env, "java/lang/Thread" ); interrupt = (*env)->GetStaticMethodID( env, jthread, "interrupted", "()Z" ); ! pollfds.fd = fd; ! pollfds.events = POLLIN; ! pollfds.revents = 0; ! /* Initialization of the current tty state */ ioctl( fd, TIOCMGET, &old_state); *************** *** 607,613 **** { do { ! ret=select( fd + 1, &rfds, NULL, NULL, &sleep ); } while ( (ret < 0) && (errno==EINTR)); --- 606,612 ---- { do { ! ret=poll(&pollfds, 1, 1000); } while ( (ret < 0) && (errno==EINTR)); --- src/org/freebsd/io/comm/FreebsdSerial.java.org Tue Oct 22 19:16:52 2002 +++ src/org/freebsd/io/comm/FreebsdSerial.java Tue Oct 22 19:17:15 2002 @@ -47,7 +47,7 @@ private int parity = SerialPort.PARITY_NONE; private int flowcontrol = SerialPort.FLOWCONTROL_NONE; private int sd = -1; - private String name = null; + //private String name = null; private int ibs = 1024; private int obs = 1024; private int framing = -1; >Release-Note: >Audit-Trail: State-Changed-From-To: open->closed State-Changed-By: glewis State-Changed-When: Tue Jun 10 09:44:51 PDT 2003 State-Changed-Why: Problems were fixed as part of the upgrade to 0.2 in PR/48658. Thanks! http://www.freebsd.org/cgi/query-pr.cgi?pr=44380 >Unformatted: