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>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
------=_NextPart_000_000B_01C0A557.C6D9BC70
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
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.
------=_NextPart_000_000B_01C0A557.C6D9BC70
Content-Type: application/octet-stream;
name="commapi.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="commapi.patch"
*** orig/FreeBSD_CommAPI/src/org/freebsd/io/comm/libSerial.c Mon Jul 19 =
11:45:04 1999=0A=
--- FreeBSD_CommAPI/src/org/freebsd/io/comm/libSerial.c Mon Mar 5 =
17:21:42 2001=0A=
***************=0A=
*** 38,43 ****=0A=
--- 38,44 ----=0A=
#include <errno.h>=0A=
#include <string.h>=0A=
#include <sys/ioctl.h>=0A=
+ #include <poll.h>=0A=
#include <fcntl.h>=0A=
#include <termios.h>=0A=
#include <sys/time.h>=0A=
***************=0A=
*** 579,588 ****=0A=
{ =0A=
int state,old_state;=0A=
int fd;=0A=
- fd_set rfds;=0A=
- struct timeval sleep;=0A=
int size;=0A=
int ret;=0A=
=0A=
jfieldID jfield; =0A=
jmethodID method, interrupt;=0A=
--- 580,588 ----=0A=
{ =0A=
int state,old_state;=0A=
int fd;=0A=
int size;=0A=
int ret;=0A=
+ struct pollfd pf;=0A=
=0A=
jfieldID jfield; =0A=
jmethodID method, interrupt;=0A=
***************=0A=
*** 595,613 ****=0A=
jthread =3D (*env)->FindClass( env, "java/lang/Thread" );=0A=
interrupt =3D (*env)->GetStaticMethodID( env, jthread, =
"interrupted", "()Z" );=0A=
=
=0A=
! FD_ZERO( &rfds );=0A=
! FD_SET( fd, &rfds );=0A=
! sleep.tv_sec =3D 1; /* Check every 1 second, or on receive =
data */=0A=
! sleep.tv_usec =3D 0;=0A=
=0A=
/* Initialization of the current tty state */=0A=
ioctl( fd, TIOCMGET, &old_state); =
=0A=
=0A=
while( !interrupted ) =0A=
{=0A=
do =0A=
{=0A=
! ret=3Dselect( fd + 1, &rfds, NULL, NULL, &sleep );=0A=
} =0A=
while ( (ret < 0) && (errno=3D=3DEINTR));=0A=
=0A=
--- 595,615 ----=0A=
jthread =3D (*env)->FindClass( env, "java/lang/Thread" );=0A=
interrupt =3D (*env)->GetStaticMethodID( env, jthread, =
"interrupted", "()Z" );=0A=
=
=0A=
! pf.fd =3D fd;=0A=
! pf.events =3D POLLIN;=0A=
! pf.revents =3D POLLIN;=0A=
=0A=
/* Initialization of the current tty state */=0A=
ioctl( fd, TIOCMGET, &old_state); =
=0A=
=0A=
while( !interrupted ) =0A=
{=0A=
+ /*=0A=
+ * Let other threads do their work.=0A=
+ */=0A=
do =0A=
{=0A=
! ret =3D poll (&pf, 1, 1000);=0A=
} =0A=
while ( (ret < 0) && (errno=3D=3DEINTR));=0A=
=0A=
------=_NextPart_000_000B_01C0A557.C6D9BC70--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000e01c0a547$04859be0$0e05a8c0>
