Date: Tue, 22 Oct 2002 04:53:15 -0700 (PDT) From: huang wen hui <hwh@ns.gddsn.org.cn> To: freebsd-gnats-submit@FreeBSD.org Subject: java/44380: patch for java-commapi-freebsd Message-ID: <200210221153.g9MBrF9d045944@www.freebsd.org>
index | next in thread | raw e-mail
>Number: 44380
>Category: java
>Synopsis: patch for java-commapi-freebsd
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-java
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Oct 22 05:00:11 PDT 2002
>Closed-Date:
>Last-Modified:
>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 <termios.h>
#include <sys/time.h>
#include <sys/ttycom.h>
+ #include <poll.h>
#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:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210221153.g9MBrF9d045944>
