Date: Mon, 5 Mar 2001 09:36:38 +0200 From: "Ari Suutari" <ari@suutari.iki.fi> To: "Peter Eccles" <peter@pm.cse.rmit.edu.au>, <freebsd-java@FreeBSD.ORG> Subject: Re: current commmapi native drivers (patches included) Message-ID: <000e01c0a547$04859be0$0e05a8c0@coffee> References: <20010228194546.A58208@mirriwinni.cse.rmit.edu.au>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
Hi again,
> Ive seen messages on this list about patches, but haven't found any
> references to where they might be found.
>
Here are patches for FreeBSD CommAPI that replace
select with poll. They also change serial parameters so
that instead of reading one character at time inter-character
timer is used to bursts of characters (which should be more
efficient).
I have been using this version with native FreeBSD jdk 1.2.2
for some time and it seems to work OK.
Ari S.
[-- Attachment #2 --]
*** orig/FreeBSD_CommAPI/src/org/freebsd/io/comm/libSerial.c Mon Jul 19 11:45:04 1999
--- FreeBSD_CommAPI/src/org/freebsd/io/comm/libSerial.c Mon Mar 5 17:21:42 2001
***************
*** 38,43 ****
--- 38,44 ----
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
+ #include <poll.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/time.h>
***************
*** 579,588 ****
{
int state,old_state;
int fd;
- fd_set rfds;
- struct timeval sleep;
int size;
int ret;
jfieldID jfield;
jmethodID method, interrupt;
--- 580,588 ----
{
int state,old_state;
int fd;
int size;
int ret;
+ struct pollfd pf;
jfieldID jfield;
jmethodID method, interrupt;
***************
*** 595,613 ****
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);
while( !interrupted )
{
do
{
! ret=select( fd + 1, &rfds, NULL, NULL, &sleep );
}
while ( (ret < 0) && (errno==EINTR));
--- 595,615 ----
jthread = (*env)->FindClass( env, "java/lang/Thread" );
interrupt = (*env)->GetStaticMethodID( env, jthread, "interrupted", "()Z" );
! pf.fd = fd;
! pf.events = POLLIN;
! pf.revents = POLLIN;
/* Initialization of the current tty state */
ioctl( fd, TIOCMGET, &old_state);
while( !interrupted )
{
+ /*
+ * Let other threads do their work.
+ */
do
{
! ret = poll (&pf, 1, 1000);
}
while ( (ret < 0) && (errno==EINTR));
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000e01c0a547$04859be0$0e05a8c0>
