mirror of
https://github.com/Interlisp/maiko.git
synced 2026-03-17 15:24:44 +00:00
Rework handling of I/O via select() to use correct fd_set type instead of int for fd sets.
Some code that was maintaining an fd_set with only a single fd was replaced
with just the fd as int, which can be added to the global fd_set as needed.
More testing is required for less usual configurations such as host TCP/UDP/IP
and direct ethernet (packet filter or NIT) I/O.
modified: src/common.c
modified: src/ether.c
modified: src/inet.c
modified: src/initkbd.c
modified: src/kbdsubrs.c
modified: src/keyevent.c
modified: src/main.c
modified: src/osmsg.c
modified: src/rawrs232c.c
modified: src/rpc.c
modified: src/rs232c.c
modified: src/tty.c
modified: src/uraid.c
modified: src/xinit.c
This commit is contained in:
@@ -16,6 +16,7 @@ static char *id = "$Id: common.c,v 1.2 1999/01/03 02:06:52 sybalsky Exp $ Copyri
|
|||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h> /* for memset */
|
#include <string.h> /* for memset */
|
||||||
|
#include <sys/select.h> /* for fd_set */
|
||||||
#include "lispemul.h"
|
#include "lispemul.h"
|
||||||
#include "lispmap.h"
|
#include "lispmap.h"
|
||||||
#include "adr68k.h"
|
#include "adr68k.h"
|
||||||
@@ -45,7 +46,8 @@ error
|
|||||||
******************************************************************/
|
******************************************************************/
|
||||||
#define URMAXFXNUM 100
|
#define URMAXFXNUM 100
|
||||||
|
|
||||||
extern unsigned int LispReadFds, LispWindowFd, LispKbdFd;
|
extern fd_set LispReadFds;
|
||||||
|
extern int LispWindowFd, LispKbdFd;
|
||||||
extern struct screen LispScreen;
|
extern struct screen LispScreen;
|
||||||
extern int displaywidth, displayheight;
|
extern int displaywidth, displayheight;
|
||||||
extern DLword *DisplayRegion68k;
|
extern DLword *DisplayRegion68k;
|
||||||
|
|||||||
27
src/ether.c
27
src/ether.c
@@ -27,6 +27,7 @@ static char *id = "$Id: ether.c,v 1.4 2001/12/24 01:09:02 sybalsky Exp $ Copyrig
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#ifndef NOETHER
|
#ifndef NOETHER
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
@@ -73,8 +74,6 @@ static char *id = "$Id: ether.c,v 1.4 2001/12/24 01:09:02 sybalsky Exp $ Copyrig
|
|||||||
#define NIOCSETF PFIOCSETF
|
#define NIOCSETF PFIOCSETF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u_int EtherReadFds;
|
|
||||||
|
|
||||||
int ether_fd = -1; /* file descriptor for ether socket */
|
int ether_fd = -1; /* file descriptor for ether socket */
|
||||||
int ether_intf_type = 0;
|
int ether_intf_type = 0;
|
||||||
u_char ether_host[6] = {0, 0, 0, 0, 0, 0}; /* 48 bit address of this node */
|
u_char ether_host[6] = {0, 0, 0, 0, 0, 0}; /* 48 bit address of this node */
|
||||||
@@ -83,7 +82,7 @@ int ether_bsize = 0; /* if nonzero then a receive is pending */
|
|||||||
u_char *ether_buf; /* address of receive buffer */
|
u_char *ether_buf; /* address of receive buffer */
|
||||||
u_char nit_buf[3000]; /* the current chunk read from NIT (one packet) */
|
u_char nit_buf[3000]; /* the current chunk read from NIT (one packet) */
|
||||||
extern LispPTR *PENDINGINTERRUPT68k;
|
extern LispPTR *PENDINGINTERRUPT68k;
|
||||||
extern u_int LispReadFds;
|
extern fd_set LispReadFds;
|
||||||
|
|
||||||
int ETHEREventCount = 0;
|
int ETHEREventCount = 0;
|
||||||
|
|
||||||
@@ -508,13 +507,13 @@ LispPTR check_ether() {
|
|||||||
|
|
||||||
#ifndef NOETHER
|
#ifndef NOETHER
|
||||||
#ifndef PKTFILTER
|
#ifndef PKTFILTER
|
||||||
static int rfds;
|
fd_set rfds;
|
||||||
int result, fromlen;
|
int result, fromlen;
|
||||||
struct nit_hdr header;
|
struct nit_hdr header;
|
||||||
int posi, i;
|
int posi, i;
|
||||||
#else /* PKTFILTER */
|
#else /* PKTFILTER */
|
||||||
|
|
||||||
static int rfds;
|
fd_set rfds;
|
||||||
int result;
|
int result;
|
||||||
int i;
|
int i;
|
||||||
int plen;
|
int plen;
|
||||||
@@ -522,7 +521,7 @@ LispPTR check_ether() {
|
|||||||
char ctlbuf[2000];
|
char ctlbuf[2000];
|
||||||
#endif /* PKTFILTER */
|
#endif /* PKTFILTER */
|
||||||
|
|
||||||
rfds = EtherReadFds;
|
FD_SET(ether_fd, &rfds);
|
||||||
#ifndef PKTFILTER
|
#ifndef PKTFILTER
|
||||||
i = 2;
|
i = 2;
|
||||||
if (/* select(32, &rfds, NULL, NULL, &EtherTimeout) >= 0 ) */ (1)) {
|
if (/* select(32, &rfds, NULL, NULL, &EtherTimeout) >= 0 ) */ (1)) {
|
||||||
@@ -573,7 +572,7 @@ LispPTR check_ether() {
|
|||||||
if (ether_fd >= 0 && ether_bsize > 0
|
if (ether_fd >= 0 && ether_bsize > 0
|
||||||
/* && select(32, &rfds, NULL, NULL, &EtherTimeout) >= 0
|
/* && select(32, &rfds, NULL, NULL, &EtherTimeout) >= 0
|
||||||
* -- [on '90/02/14: getsignsldata() chech this] */
|
* -- [on '90/02/14: getsignsldata() chech this] */
|
||||||
&& (rfds & (1 << ether_fd))) {
|
&& (FD_ISSET(ether_fd, &rfds))) {
|
||||||
data.maxlen = sizeof(nit_buf);
|
data.maxlen = sizeof(nit_buf);
|
||||||
data.len = 0;
|
data.len = 0;
|
||||||
data.buf = (char *)nit_buf;
|
data.buf = (char *)nit_buf;
|
||||||
@@ -617,13 +616,13 @@ LispPTR check_ether() {
|
|||||||
LispPTR get_packet() {
|
LispPTR get_packet() {
|
||||||
#ifndef NOETHER
|
#ifndef NOETHER
|
||||||
#ifndef PKTFILTER
|
#ifndef PKTFILTER
|
||||||
static int rfds;
|
fd_set rfds;
|
||||||
int result, fromlen;
|
int result, fromlen;
|
||||||
struct nit_hdr header;
|
struct nit_hdr header;
|
||||||
int posi, i;
|
int posi, i;
|
||||||
#else /* PKTFILTER */
|
#else /* PKTFILTER */
|
||||||
|
|
||||||
static int rfds;
|
fd_set rfds;
|
||||||
int result;
|
int result;
|
||||||
int i;
|
int i;
|
||||||
int plen;
|
int plen;
|
||||||
@@ -988,15 +987,12 @@ void init_ether() {
|
|||||||
nioc.nioc_flags = 0;
|
nioc.nioc_flags = 0;
|
||||||
if (ioctl(ether_fd, SIOCSNIT, &nioc) != 0) {
|
if (ioctl(ether_fd, SIOCSNIT, &nioc) != 0) {
|
||||||
printf("init_ether: ioctl failed\n");
|
printf("init_ether: ioctl failed\n");
|
||||||
|
|
||||||
close(ether_fd);
|
close(ether_fd);
|
||||||
ether_fd = -1;
|
ether_fd = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else /* PKTFILTER */
|
#else /* PKTFILTER */
|
||||||
|
|
||||||
EtherReadFds |= (1 << ether_fd);
|
|
||||||
|
|
||||||
/* first and foremost, flush out ether_fd's buffers and filter it */
|
/* first and foremost, flush out ether_fd's buffers and filter it */
|
||||||
/* install packetfilter that rejects everything */
|
/* install packetfilter that rejects everything */
|
||||||
#ifdef USE_DLPI
|
#ifdef USE_DLPI
|
||||||
@@ -1024,7 +1020,6 @@ void init_ether() {
|
|||||||
#endif /* USE_DLPI */
|
#endif /* USE_DLPI */
|
||||||
#endif /* PKTFILTER -- jds 23 sep 96 unmatched if fix */
|
#endif /* PKTFILTER -- jds 23 sep 96 unmatched if fix */
|
||||||
#ifndef PKTFILTER
|
#ifndef PKTFILTER
|
||||||
EtherReadFds |= (1 << ether_fd);
|
|
||||||
if (fcntl(ether_fd, F_SETFL, fcntl(ether_fd, F_GETFL, 0) | FASYNC | FNDELAY) < 0)
|
if (fcntl(ether_fd, F_SETFL, fcntl(ether_fd, F_GETFL, 0) | FASYNC | FNDELAY) < 0)
|
||||||
perror("Ether setup SETFLAGS fcntl");
|
perror("Ether setup SETFLAGS fcntl");
|
||||||
if (fcntl(ether_fd, F_SETOWN, getpid()) < 0) perror("Ether setup SETOWN");
|
if (fcntl(ether_fd, F_SETOWN, getpid()) < 0) perror("Ether setup SETOWN");
|
||||||
@@ -1037,7 +1032,7 @@ void init_ether() {
|
|||||||
if (ioctl(ether_fd, I_FLUSH, (char *)FLUSHR) < 0) { perror("init_ether I_FLUSH"); }
|
if (ioctl(ether_fd, I_FLUSH, (char *)FLUSHR) < 0) { perror("init_ether I_FLUSH"); }
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
int rfds = EtherReadFds;
|
FD_SET(ether_fd, &rfds);
|
||||||
while (select(32, &rfds, NULL, NULL, &EtherTimeout) > 0)
|
while (select(32, &rfds, NULL, NULL, &EtherTimeout) > 0)
|
||||||
read(ether_fd, nit_buf, sizeof(nit_buf));
|
read(ether_fd, nit_buf, sizeof(nit_buf));
|
||||||
}
|
}
|
||||||
@@ -1082,8 +1077,8 @@ void init_ether() {
|
|||||||
#endif /* USE_DLPI */
|
#endif /* USE_DLPI */
|
||||||
#endif /* PKTFILTER */
|
#endif /* PKTFILTER */
|
||||||
|
|
||||||
if (EtherReadFds == 0) error("EtherReadFds is zero, but enet opened??");
|
if (ether_fd < 0) error ("ether_fd is -1, but enet opened??");
|
||||||
LispReadFds |= EtherReadFds;
|
FD_SET(ether_fd, &LispReadFds);
|
||||||
|
|
||||||
DBPRINT(("init_ether: **** Ethernet starts ****\n"));
|
DBPRINT(("init_ether: **** Ethernet starts ****\n"));
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/inet.c
16
src/inet.c
@@ -17,6 +17,7 @@ static char *id = "$Id: inet.c,v 1.3 2001/12/24 01:09:03 sybalsky Exp $ Copyrigh
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <sys/select.h> /* for FD_ fns */
|
||||||
#ifdef ISC
|
#ifdef ISC
|
||||||
#include <sys/fcntl.h>
|
#include <sys/fcntl.h>
|
||||||
#include <sys/bsdtypes.h>
|
#include <sys/bsdtypes.h>
|
||||||
@@ -88,8 +89,9 @@ static char *id = "$Id: inet.c,v 1.3 2001/12/24 01:09:03 sybalsky Exp $ Copyrigh
|
|||||||
#define UDPSendto 130
|
#define UDPSendto 130
|
||||||
#define UDPRecvfrom 131
|
#define UDPRecvfrom 131
|
||||||
|
|
||||||
extern u_int LispIOFds, LispReadFds;
|
|
||||||
extern int *Lisp_errno;
|
extern int *Lisp_errno;
|
||||||
|
extern fd_set LispReadFds;
|
||||||
|
fd_set LispIOFds;
|
||||||
|
|
||||||
LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, LispPTR bufaddr, LispPTR maxlen)
|
LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, LispPTR bufaddr, LispPTR maxlen)
|
||||||
{
|
{
|
||||||
@@ -233,8 +235,8 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li
|
|||||||
|
|
||||||
case TCPclose:
|
case TCPclose:
|
||||||
sock = LispNumToCInt(nameConn);
|
sock = LispNumToCInt(nameConn);
|
||||||
LispIOFds &= ~(1 << sock);
|
FD_CLR(sock, &LispIOFds);
|
||||||
LispReadFds &= ~(1 << sock);
|
FD_CLR(sock, &LispReadFds);
|
||||||
shutdown(sock, 2);
|
shutdown(sock, 2);
|
||||||
close(sock);
|
close(sock);
|
||||||
return (ATOM_T);
|
return (ATOM_T);
|
||||||
@@ -290,8 +292,8 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li
|
|||||||
sigsetmask(oldmask);
|
sigsetmask(oldmask);
|
||||||
#endif /* SYSVSIGNALS */
|
#endif /* SYSVSIGNALS */
|
||||||
}
|
}
|
||||||
LispIOFds |= (1 << result); /* so we get interrupts */
|
FD_SET(result, &LispIOFds); /* so we get interrupts */
|
||||||
LispReadFds |= LispIOFds;
|
FD_SET(result, &LispReadFds);
|
||||||
DBPRINT(("LispIOFds = 0x%x.\n", LispIOFds));
|
DBPRINT(("LispIOFds = 0x%x.\n", LispIOFds));
|
||||||
return (GetSmallp(result));
|
return (GetSmallp(result));
|
||||||
break;
|
break;
|
||||||
@@ -370,8 +372,8 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li
|
|||||||
|
|
||||||
#endif /* RS6000 */
|
#endif /* RS6000 */
|
||||||
|
|
||||||
LispIOFds |= (1 << result); /* so we get interrupts */
|
FD_SET(result, &LispIOFds); /* so we get interrupts */
|
||||||
LispReadFds |= LispIOFds;
|
FD_SET(result, &LispReadFds);
|
||||||
DBPRINT(("LispIOFds = 0x%x.\n", LispIOFds));
|
DBPRINT(("LispIOFds = 0x%x.\n", LispIOFds));
|
||||||
return (GetSmallp(result));
|
return (GetSmallp(result));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ static char *id = "$Id: initkbd.c,v 1.2 1999/01/03 02:07:09 sybalsky Exp $ Copyr
|
|||||||
#endif
|
#endif
|
||||||
#ifndef DOS
|
#ifndef DOS
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#endif /* DOS */
|
#endif /* DOS */
|
||||||
#ifdef SUNDISPLAY
|
#ifdef SUNDISPLAY
|
||||||
#include <sundev/kbd.h>
|
#include <sundev/kbd.h>
|
||||||
@@ -135,7 +136,7 @@ extern int errno;
|
|||||||
int DebugKBD = NIL;
|
int DebugKBD = NIL;
|
||||||
FILE *KBlog;
|
FILE *KBlog;
|
||||||
|
|
||||||
u_int LispReadFds = 0;
|
extern fd_set LispReadFds;
|
||||||
#ifdef SUNDISPLAY
|
#ifdef SUNDISPLAY
|
||||||
struct inputmask LispEventMask;
|
struct inputmask LispEventMask;
|
||||||
#endif /* SUNDISPLAY */
|
#endif /* SUNDISPLAY */
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ static char *id = "$Id: kbdsubrs.c,v 1.2 1999/01/03 02:07:10 sybalsky Exp $ Copy
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#endif /* DOS */
|
#endif /* DOS */
|
||||||
|
|
||||||
#ifdef SUNDISPLAY
|
#ifdef SUNDISPLAY
|
||||||
@@ -32,6 +33,7 @@ static char *id = "$Id: kbdsubrs.c,v 1.2 1999/01/03 02:07:10 sybalsky Exp $ Copy
|
|||||||
#include "kbdsubrsdefs.h"
|
#include "kbdsubrsdefs.h"
|
||||||
#include "commondefs.h"
|
#include "commondefs.h"
|
||||||
#ifdef XWINDOW
|
#ifdef XWINDOW
|
||||||
|
#include "lisp2cdefs.h"
|
||||||
#include "xwinmandefs.h"
|
#include "xwinmandefs.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -65,7 +67,8 @@ extern struct screen LispScreen;
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#endif /* XWINDOW */
|
#endif /* XWINDOW */
|
||||||
|
|
||||||
extern int LispWindowFd, LispReadFds;
|
extern int LispWindowFd;
|
||||||
|
extern fd_set LispReadFds;
|
||||||
|
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
|
||||||
@@ -76,7 +79,7 @@ void KB_enable(LispPTR *args) /* args[0] : ON/OFF flag
|
|||||||
{
|
{
|
||||||
if (args[0] == ATOM_T)
|
if (args[0] == ATOM_T)
|
||||||
#ifdef SUNDISPLAY
|
#ifdef SUNDISPLAY
|
||||||
LispReadFds |= 1 << LispWindowFd;
|
FD_SET(LispWindowFd, &LispReadFds);
|
||||||
#elif XWINDOW
|
#elif XWINDOW
|
||||||
enable_Xkeyboard(currentdsp);
|
enable_Xkeyboard(currentdsp);
|
||||||
#elif DOS
|
#elif DOS
|
||||||
@@ -86,7 +89,7 @@ void KB_enable(LispPTR *args) /* args[0] : ON/OFF flag
|
|||||||
|
|
||||||
else if (args[0] == NIL)
|
else if (args[0] == NIL)
|
||||||
#ifdef SUNDISPLAY
|
#ifdef SUNDISPLAY
|
||||||
LispReadFds &= ~(1 << LispWindowFd);
|
FD_SET(LispWindowFd, &LispReadFds);
|
||||||
#elif XWINDOW
|
#elif XWINDOW
|
||||||
disable_Xkeyboard(currentdsp);
|
disable_Xkeyboard(currentdsp);
|
||||||
#elif DOS
|
#elif DOS
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ static char *id = "$Id: keyevent.c,v 1.3 2001/12/24 01:09:03 sybalsky Exp $ Copy
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <string.h>
|
||||||
#ifndef DOS
|
#ifndef DOS
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#else
|
#else
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -143,20 +145,21 @@ struct pollfd pollfds[33] = {
|
|||||||
extern DLword *EmMouseX68K, *EmMouseY68K, *EmKbdAd068K, *EmRealUtilin68K, *EmUtilin68K;
|
extern DLword *EmMouseX68K, *EmMouseY68K, *EmKbdAd068K, *EmRealUtilin68K, *EmUtilin68K;
|
||||||
extern DLword *EmKbdAd168K, *EmKbdAd268K, *EmKbdAd368K, *EmKbdAd468K, *EmKbdAd568K;
|
extern DLword *EmKbdAd168K, *EmKbdAd268K, *EmKbdAd368K, *EmKbdAd468K, *EmKbdAd568K;
|
||||||
extern u_char *SUNLispKeyMap;
|
extern u_char *SUNLispKeyMap;
|
||||||
extern u_int LispReadFds, LispWindowFd;
|
extern int LispWindowFd;
|
||||||
extern int RS232CReadFds, RS232C_remain_data, XLocked;
|
extern int RS232C_Fd, RS232C_remain_data, XLocked;
|
||||||
|
extern fd_set LispIOFds;
|
||||||
|
fd_set LispReadFds;
|
||||||
int XNeedSignal = 0; /* T if an X interrupt happened while XLOCK asserted */
|
int XNeedSignal = 0; /* T if an X interrupt happened while XLOCK asserted */
|
||||||
|
|
||||||
#ifdef NOETHER
|
#ifdef NOETHER
|
||||||
extern u_int LogFileFd;
|
extern u_int LogFileFd;
|
||||||
#else
|
#else
|
||||||
extern int ether_fd;
|
extern int ether_fd;
|
||||||
extern u_int LogFileFd, EtherReadFds;
|
extern u_int LogFileFd;
|
||||||
#endif /* NOETHER */
|
#endif /* NOETHER */
|
||||||
|
|
||||||
extern DLword *DisplayRegion68k;
|
extern DLword *DisplayRegion68k;
|
||||||
|
|
||||||
u_int LispIOFds = 0;
|
|
||||||
#ifndef DOS
|
#ifndef DOS
|
||||||
static struct timeval SelectTimeout = {0, 0};
|
static struct timeval SelectTimeout = {0, 0};
|
||||||
#endif /* DOS */
|
#endif /* DOS */
|
||||||
@@ -278,6 +281,7 @@ DLword ColorCursor_savebitmap[CURSORWIDTH / COLORPIXELS_IN_DLWORD * CURSORHEIGHT
|
|||||||
/* */
|
/* */
|
||||||
/* Statics: LispReadFds A 32-bit vector with a 1 for each */
|
/* Statics: LispReadFds A 32-bit vector with a 1 for each */
|
||||||
/* FD that can get SIGIO interrupts. */
|
/* FD that can get SIGIO interrupts. */
|
||||||
|
/* 12/04/2020 - now an fd_set */
|
||||||
/* */
|
/* */
|
||||||
/* LispWindowFd The keyboard/window FD, for keyboard */
|
/* LispWindowFd The keyboard/window FD, for keyboard */
|
||||||
/* and mouse events. */
|
/* and mouse events. */
|
||||||
@@ -286,14 +290,17 @@ DLword ColorCursor_savebitmap[CURSORWIDTH / COLORPIXELS_IN_DLWORD * CURSORHEIGHT
|
|||||||
/* FDs Lisp is doing async I/O on. */
|
/* FDs Lisp is doing async I/O on. */
|
||||||
/* Activity on any of these will signal */
|
/* Activity on any of these will signal */
|
||||||
/* the Lisp IOInterrupt interrupt. */
|
/* the Lisp IOInterrupt interrupt. */
|
||||||
|
/* 12/04/2020 - now an fd_set */
|
||||||
/* */
|
/* */
|
||||||
/* ether_fd The raw ethernet FD, for 10MB I/O */
|
/* ether_fd The raw ethernet FD, for 10MB I/O */
|
||||||
/* */
|
/* */
|
||||||
/* EtherReadFds A bit vector with the raw enet's */
|
/* EtherReadFds A bit vector with the raw enet's */
|
||||||
/* bit turned on. To speed up processing. */
|
/* bit turned on. To speed up processing. */
|
||||||
|
/* 12/04/2020 - now obsolete */
|
||||||
/* */
|
/* */
|
||||||
/* LogFileFd A bit vector with the log-file's */
|
/* LogFileFd A bit vector with the log-file's */
|
||||||
/* bit on, for capturing console msgs. */
|
/* bit on, for capturing console msgs. */
|
||||||
|
/* 12/04/2020 - now just the FD number */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
@@ -305,12 +312,13 @@ void getsignaldata(int sig, int code, void *scp)
|
|||||||
#ifndef XWINDOW
|
#ifndef XWINDOW
|
||||||
struct inputevent event;
|
struct inputevent event;
|
||||||
#endif /* XWINDOW */
|
#endif /* XWINDOW */
|
||||||
|
fd_set rfds, efds;
|
||||||
static int rfds, wfds, efds, res;
|
u_int iflags;
|
||||||
|
int i;
|
||||||
#ifdef ISC
|
#ifdef ISC
|
||||||
int fdcount = 0;
|
int fdcount = 0;
|
||||||
int bit;
|
int bit;
|
||||||
|
int res;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XWINDOW
|
#ifdef XWINDOW
|
||||||
@@ -327,22 +335,26 @@ void getsignaldata(int sig, int code, void *scp)
|
|||||||
#endif /* XWINDOW */
|
#endif /* XWINDOW */
|
||||||
|
|
||||||
/* #ifndef KBINT */
|
/* #ifndef KBINT */
|
||||||
rfds = LispReadFds;
|
/* FD_COPY would be preferred but uses deprecated bcopy() on macOS. Why? */
|
||||||
efds = LispReadFds;
|
memcpy(&rfds, &LispReadFds, sizeof(rfds));
|
||||||
|
memcpy(&efds, &LispReadFds, sizeof(efds));
|
||||||
|
|
||||||
/* label and ifs not needed if only keyboard on SIGIO */
|
/* label and ifs not needed if only keyboard on SIGIO */
|
||||||
getmore:
|
getmore:
|
||||||
#ifdef ISC
|
#ifdef ISC
|
||||||
for (res = 0, bit = 1; res < 32; res++, bit <<= 1)
|
for (res = 0, bit = 1; res < 32; res++, bit <<= 1)
|
||||||
if (LispReadFds & bit) { pollfds[fdcount++].fd = res; }
|
if (FD_ISSET(bit, &LispReadFds)) { pollfds[fdcount++].fd = res; }
|
||||||
if ((res = poll(pollfds, fdcount, 0)) > 0)
|
if ((res = poll(pollfds, fdcount, 0)) > 0)
|
||||||
#else
|
#else
|
||||||
if (select(32, (fd_set *)&rfds, NULL, (fd_set *)&efds, &SelectTimeout) >= 0)
|
if (select(32, &rfds, NULL, &efds, &SelectTimeout) >= 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
/* need to print out fd sets...
|
||||||
DBPRINT(("SIGIO: fd mask(r/e) = 0x%x/0x%x.\n", rfds, efds));
|
DBPRINT(("SIGIO: fd mask(r/e) = 0x%x/0x%x.\n", rfds, efds));
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef SUNDISPLAY
|
#ifdef SUNDISPLAY
|
||||||
if (rfds & (1 << LispWindowFd)) {
|
if (FD_ISSET(LispWindowFd, &rfds)) {
|
||||||
/* #endif */
|
/* #endif */
|
||||||
while (input_readevent(LispWindowFd, &event) >= 0) {
|
while (input_readevent(LispWindowFd, &event) >= 0) {
|
||||||
/*if(!kb_event( &event )) {goto getmore;};*/
|
/*if(!kb_event( &event )) {goto getmore;};*/
|
||||||
@@ -356,7 +368,7 @@ getmore:
|
|||||||
#endif /* SUNDISPLAY */
|
#endif /* SUNDISPLAY */
|
||||||
|
|
||||||
#ifdef XWINDOW
|
#ifdef XWINDOW
|
||||||
if (rfds & (1 << ConnectionNumber(currentdsp->display_id))) {
|
if (FD_ISSET(ConnectionNumber(currentdsp->display_id), &rfds)) {
|
||||||
if (!XLocked)
|
if (!XLocked)
|
||||||
getXsignaldata(currentdsp);
|
getXsignaldata(currentdsp);
|
||||||
else
|
else
|
||||||
@@ -367,19 +379,19 @@ getmore:
|
|||||||
|
|
||||||
#ifdef NOETHER
|
#ifdef NOETHER
|
||||||
#else
|
#else
|
||||||
if (rfds & EtherReadFds) { /* Raw ethernet (NIT) I/O happened, so handle it. */
|
if (FD_ISSET(ether_fd, &rfds)) { /* Raw ethernet (NIT) I/O happened, so handle it. */
|
||||||
DBPRINT(("Handling enet interrupt.\n\n"));
|
DBPRINT(("Handling enet interrupt.\n\n"));
|
||||||
check_ether();
|
check_ether();
|
||||||
}
|
}
|
||||||
#endif /* NOETHER */
|
#endif /* NOETHER */
|
||||||
|
|
||||||
#ifdef RS232
|
#ifdef RS232
|
||||||
if (((rfds & RS232CReadFds) == RS232CReadFds) || (RS232C_remain_data && rs232c_lisp_is_ready()))
|
if (FD_ISSET(RS232C_Fd, &rfds) || (RS232C_remain_data && rs232c_lisp_is_ready()))
|
||||||
rs232c_read();
|
rs232c_read();
|
||||||
#endif /* RS232 */
|
#endif /* RS232 */
|
||||||
|
|
||||||
#ifdef LOGINT
|
#ifdef LOGINT
|
||||||
if (rfds & LogFileFd) { /* There's info in the log file. Tell Lisp to print it. */
|
if (FD_ISSET(LogFileFd, &rfds)) { /* There's info in the log file. Tell Lisp to print it. */
|
||||||
flush_pty(); /* move the msg(s) to the log file */
|
flush_pty(); /* move the msg(s) to the log file */
|
||||||
|
|
||||||
((INTSTAT *)Addr68k_from_LADDR(*INTERRUPTSTATE_word))->LogFileIO = 1;
|
((INTSTAT *)Addr68k_from_LADDR(*INTERRUPTSTATE_word))->LogFileIO = 1;
|
||||||
@@ -388,10 +400,13 @@ getmore:
|
|||||||
Irq_Stk_End = Irq_Stk_Check = 0;
|
Irq_Stk_End = Irq_Stk_Check = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (rfds & LispIOFds) { /* There's activity on a Lisp-opened FD. Tell Lisp. */
|
iflags = 0;
|
||||||
|
for (i = 0; i < 32; i++)
|
||||||
|
if (FD_ISSET(i, &rfds) & FD_ISSET(i, &LispIOFds)) iflags |= 1 << i;
|
||||||
|
if (iflags) { /* There's activity on a Lisp-opened FD. Tell Lisp. */
|
||||||
u_int *flags;
|
u_int *flags;
|
||||||
flags = (u_int *)Addr68k_from_LADDR(*IOINTERRUPTFLAGS_word);
|
flags = (u_int *)Addr68k_from_LADDR(*IOINTERRUPTFLAGS_word);
|
||||||
*flags = rfds & LispIOFds;
|
*flags = iflags;
|
||||||
|
|
||||||
((INTSTAT *)Addr68k_from_LADDR(*INTERRUPTSTATE_word))->IOInterrupt = 1;
|
((INTSTAT *)Addr68k_from_LADDR(*INTERRUPTSTATE_word))->IOInterrupt = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ static char *id = "$Id: main.c,v 1.4 2001/12/26 22:17:03 sybalsky Exp $ Copyrigh
|
|||||||
|
|
||||||
#ifndef DOS
|
#ifndef DOS
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#endif /* DOS */
|
#endif /* DOS */
|
||||||
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
@@ -358,7 +359,7 @@ int main(int argc, char *argv[])
|
|||||||
char *envname;
|
char *envname;
|
||||||
extern int TIMER_INTERVAL;
|
extern int TIMER_INTERVAL;
|
||||||
char keytyped[255];
|
char keytyped[255];
|
||||||
|
extern fd_set LispReadFds;
|
||||||
#ifndef NOFORN
|
#ifndef NOFORN
|
||||||
if (dld_find_executable(argv[0]) == 0) {
|
if (dld_find_executable(argv[0]) == 0) {
|
||||||
perror("Name of executable not found.");
|
perror("Name of executable not found.");
|
||||||
@@ -532,6 +533,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
strcpy(keytyped, keystring);
|
strcpy(keytyped, keystring);
|
||||||
|
|
||||||
|
FD_ZERO(&LispReadFds);
|
||||||
|
|
||||||
#ifndef NOETHER
|
#ifndef NOETHER
|
||||||
init_ether(); /* modified by kiuchi Nov. 4 */
|
init_ether(); /* modified by kiuchi Nov. 4 */
|
||||||
#endif /* NOETHER */
|
#endif /* NOETHER */
|
||||||
|
|||||||
15
src/osmsg.c
15
src/osmsg.c
@@ -24,6 +24,7 @@ static char *id = "$Id: osmsg.c,v 1.2 1999/01/03 02:07:29 sybalsky Exp $ Copyrig
|
|||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef ISC
|
#ifdef ISC
|
||||||
#include <sys/bsdtypes.h>
|
#include <sys/bsdtypes.h>
|
||||||
@@ -79,7 +80,7 @@ int previous_size;
|
|||||||
int logChanged; /* T if log file has changed since last READ */
|
int logChanged; /* T if log file has changed since last READ */
|
||||||
/* Set by flush_pty, to avoid the stat call */
|
/* Set by flush_pty, to avoid the stat call */
|
||||||
u_int LogFileFd;
|
u_int LogFileFd;
|
||||||
extern u_int LispReadFds;
|
extern fd_set LispReadFds;
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -162,7 +163,7 @@ gotpty:
|
|||||||
|
|
||||||
if ((log_id = open(logfile, (O_RDWR | O_CREAT), 0666)) < 0) return;
|
if ((log_id = open(logfile, (O_RDWR | O_CREAT), 0666)) < 0) return;
|
||||||
#ifdef LOGINT
|
#ifdef LOGINT
|
||||||
LogFileFd = 1 << cons_pty;
|
LogFileFd = cons_pty; /* was kept as an fd_set, but doesn't need to be */
|
||||||
flags = fcntl(cons_pty, F_GETFL, 0);
|
flags = fcntl(cons_pty, F_GETFL, 0);
|
||||||
flags = fcntl(cons_pty, F_SETFL, (flags | FASYNC | FNDELAY));
|
flags = fcntl(cons_pty, F_SETFL, (flags | FASYNC | FNDELAY));
|
||||||
if (fcntl(cons_pty, F_SETOWN, getpid()) == -1) {
|
if (fcntl(cons_pty, F_SETOWN, getpid()) == -1) {
|
||||||
@@ -170,7 +171,7 @@ gotpty:
|
|||||||
perror("fcntl F_SETOWN of log PTY");
|
perror("fcntl F_SETOWN of log PTY");
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
LispReadFds |= LogFileFd;
|
FD_SET(LogFileFd, &LispReadFds);
|
||||||
flush_pty();
|
flush_pty();
|
||||||
#endif
|
#endif
|
||||||
previous_size = 0;
|
previous_size = 0;
|
||||||
@@ -344,7 +345,7 @@ LispPTR flush_pty() {
|
|||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
char buf[MESSAGE_BUFFER_SIZE]; /* Buffer between pty and log file */
|
char buf[MESSAGE_BUFFER_SIZE]; /* Buffer between pty and log file */
|
||||||
int size;
|
int size;
|
||||||
static int rfds;
|
static fd_set rfds;
|
||||||
int rval;
|
int rval;
|
||||||
struct statfs fsbuf;
|
struct statfs fsbuf;
|
||||||
|
|
||||||
@@ -352,10 +353,10 @@ LispPTR flush_pty() {
|
|||||||
DBPRINT(("flush_pty() called.\n"));
|
DBPRINT(("flush_pty() called.\n"));
|
||||||
/* polling pty nd flush os message to log file */
|
/* polling pty nd flush os message to log file */
|
||||||
#ifndef LOGINT
|
#ifndef LOGINT
|
||||||
rfds = (1 << cons_pty);
|
FD_SET(cons_pty, &rfds);
|
||||||
if (select(32, &rfds, NULL, NULL, &selecttimeout) < 0) return (NIL);
|
if (select(32, &rfds, NULL, NULL, &selecttimeout) <= 0) return (NIL);
|
||||||
|
|
||||||
if ((cons_pty >= 0) && (rfds & (1 << cons_pty)))
|
if ((cons_pty >= 0) && FD_ISSET(cons_pty, rfds))
|
||||||
#else /* LOGINT */
|
#else /* LOGINT */
|
||||||
|
|
||||||
if ((cons_pty >= 0) && ((size = read(cons_pty, buf, MESSAGE_BUFFER_SIZE - 1)) > 0))
|
if ((cons_pty >= 0) && ((size = read(cons_pty, buf, MESSAGE_BUFFER_SIZE - 1)) > 0))
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ static char *id = "$Id: rawrs232c.c,v 1.2 1999/01/03 02:07:31 sybalsky Exp $ Cop
|
|||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#include <sys/select.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/termios.h>
|
#include <sys/termios.h>
|
||||||
#include <sys/ttold.h>
|
#include <sys/ttold.h>
|
||||||
@@ -261,13 +262,13 @@ LispPTR raw_rs232c_read(LispPTR fd, LispPTR buff, LispPTR nbytes)
|
|||||||
unsigned char *buffptr;
|
unsigned char *buffptr;
|
||||||
int length;
|
int length;
|
||||||
u_int real_fd;
|
u_int real_fd;
|
||||||
u_int readfds;
|
fd_set readfds;
|
||||||
|
|
||||||
real_fd = fd & 0xffff;
|
real_fd = fd & 0xffff; /* FIXME: should be GetSmallp() ? */
|
||||||
readfds = (1 << real_fd);
|
FD_SET(real_fd, &readfds);
|
||||||
|
|
||||||
select(32, &readfds, NULL, NULL, &RS_TimeOut);
|
select(32, &readfds, NULL, NULL, &RS_TimeOut);
|
||||||
if (readfds & (1 << real_fd)) {
|
if (FD_ISSET(real_fd, &readfds)) {
|
||||||
buffptr = (unsigned char *)Addr68k_from_LADDR(buff);
|
buffptr = (unsigned char *)Addr68k_from_LADDR(buff);
|
||||||
|
|
||||||
if ((length = read(real_fd, buffptr, (nbytes & 0xffff))) < 0) {
|
if ((length = read(real_fd, buffptr, (nbytes & 0xffff))) < 0) {
|
||||||
@@ -285,20 +286,20 @@ LispPTR raw_rs232c_read(LispPTR fd, LispPTR buff, LispPTR nbytes)
|
|||||||
|
|
||||||
LispPTR raw_rs232c_setint(LispPTR fd, LispPTR onoff)
|
LispPTR raw_rs232c_setint(LispPTR fd, LispPTR onoff)
|
||||||
{
|
{
|
||||||
extern u_int LispReadFds;
|
extern fd_set LispReadFds;
|
||||||
extern u_int LispIOFds;
|
extern fd_set LispIOFds;
|
||||||
u_int real_fd;
|
u_int real_fd;
|
||||||
|
|
||||||
real_fd = (fd & 0xffff);
|
real_fd = (fd & 0xffff); /* FIXME: should be GetSmallp() */
|
||||||
|
|
||||||
if (onoff == ATOM_T) {
|
if (onoff == ATOM_T) {
|
||||||
LispReadFds |= (1 << real_fd);
|
FD_SET(real_fd, &LispReadFds);
|
||||||
LispIOFds |= (1 << real_fd);
|
FD_SET(real_fd, &LispIOFds);
|
||||||
int_io_open(real_fd);
|
int_io_open(real_fd);
|
||||||
} else {
|
} else {
|
||||||
int_io_close(real_fd);
|
int_io_close(real_fd);
|
||||||
LispReadFds &= ~(1 << real_fd);
|
FD_CLR(real_fd, &LispReadFds);
|
||||||
LispIOFds &= ~(1 << real_fd);
|
FD_CLR(real_fd, &LispIOFds);
|
||||||
}
|
}
|
||||||
return (ATOM_T);
|
return (ATOM_T);
|
||||||
}
|
}
|
||||||
|
|||||||
19
src/rpc.c
19
src/rpc.c
@@ -24,6 +24,7 @@ static char *id = "$Id: rpc.c,v 1.3 2001/12/24 01:09:06 sybalsky Exp $ Copyright
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@@ -70,11 +71,11 @@ LispPTR rpc(LispPTR *args)
|
|||||||
struct sockaddr_in sin, sin1, from;
|
struct sockaddr_in sin, sin1, from;
|
||||||
char *outbuf, *inbuf, *destaddr;
|
char *outbuf, *inbuf, *destaddr;
|
||||||
register int s, msec_until_timeout, msec_between_tries, out_length;
|
register int s, msec_until_timeout, msec_between_tries, out_length;
|
||||||
register int received, mask;
|
register int received;
|
||||||
register int port;
|
register int port;
|
||||||
int dontblock, dest, read_descriptors;
|
int dontblock, dest;
|
||||||
unsigned fromlen;
|
unsigned fromlen;
|
||||||
|
fd_set read_descriptors;
|
||||||
struct timeval pertry_timeout, total_timeout, time_waited;
|
struct timeval pertry_timeout, total_timeout, time_waited;
|
||||||
|
|
||||||
/* Set timeout */
|
/* Set timeout */
|
||||||
@@ -145,9 +146,6 @@ LispPTR rpc(LispPTR *args)
|
|||||||
if (sendto(s, outbuf, out_length, 0, (struct sockaddr *)&sin1, sizeof(sin1)) != out_length)
|
if (sendto(s, outbuf, out_length, 0, (struct sockaddr *)&sin1, sizeof(sin1)) != out_length)
|
||||||
goto handle_error;
|
goto handle_error;
|
||||||
|
|
||||||
/* Set the select mask */
|
|
||||||
mask = 1 << s;
|
|
||||||
|
|
||||||
/* Set up the timers */
|
/* Set up the timers */
|
||||||
time_waited.tv_sec = 0;
|
time_waited.tv_sec = 0;
|
||||||
time_waited.tv_usec = 0;
|
time_waited.tv_usec = 0;
|
||||||
@@ -155,10 +153,11 @@ LispPTR rpc(LispPTR *args)
|
|||||||
/* Start the waiting loop */
|
/* Start the waiting loop */
|
||||||
receive:
|
receive:
|
||||||
|
|
||||||
read_descriptors = mask;
|
/* Set the select mask */
|
||||||
|
FD_SET(s, &read_descriptors);
|
||||||
|
|
||||||
switch (
|
switch (
|
||||||
select(32, (fd_set *)&read_descriptors, (fd_set *)NULL, (fd_set *)NULL, &pertry_timeout)) {
|
select(32, &read_descriptors, NULL, NULL, &pertry_timeout)) {
|
||||||
/* Per try timeout expired, Check the total timeout */
|
/* Per try timeout expired, Check the total timeout */
|
||||||
case 0:
|
case 0:
|
||||||
time_waited.tv_sec += pertry_timeout.tv_sec;
|
time_waited.tv_sec += pertry_timeout.tv_sec;
|
||||||
@@ -184,8 +183,8 @@ receive:
|
|||||||
else
|
else
|
||||||
goto handle_error;
|
goto handle_error;
|
||||||
}
|
}
|
||||||
/* Did something arrive for this socket */
|
/* Nothing arrived for this socket, try again */
|
||||||
if ((read_descriptors & mask) == 0) goto receive;
|
if (!FD_ISSET(s, &read_descriptors)) goto receive;
|
||||||
|
|
||||||
/* Something arrived; try to get it */
|
/* Something arrived; try to get it */
|
||||||
|
|
||||||
|
|||||||
14
src/rs232c.c
14
src/rs232c.c
@@ -10,9 +10,9 @@ static char *id = "$Id: rs232c.c,v 1.2 1999/01/03 02:07:32 sybalsky Exp $ Copyri
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include "rs232c.h"
|
#include "rs232c.h"
|
||||||
|
#include "lspglob.h"
|
||||||
|
#include <sys/select.h>
|
||||||
/*
|
/*
|
||||||
* Lisp Interface
|
* Lisp Interface
|
||||||
*/
|
*/
|
||||||
@@ -28,9 +28,8 @@ static DLword *RS232CGetCSB, *RS232CPutCSB;
|
|||||||
/*
|
/*
|
||||||
* File descriptor
|
* File descriptor
|
||||||
*/
|
*/
|
||||||
extern int LispReadFds;
|
extern fd_set LispReadFds;
|
||||||
static int RS232C_Fd;
|
int RS232C_Fd;
|
||||||
int RS232CReadFds;
|
|
||||||
|
|
||||||
int RS232C_remain_data;
|
int RS232C_remain_data;
|
||||||
static char *RS232C_Dev;
|
static char *RS232C_Dev;
|
||||||
@@ -171,8 +170,7 @@ rs232c_open() {
|
|||||||
rs_error("RS232C: rs232c_open: cannot set signal");
|
rs_error("RS232C: rs232c_open: cannot set signal");
|
||||||
else {
|
else {
|
||||||
rs_install_hup_handler();
|
rs_install_hup_handler();
|
||||||
|
FD_SET(RS232C_Fd, &LispReadFds);
|
||||||
LispReadFds |= (RS232CReadFds = 1 << RS232C_Fd);
|
|
||||||
RS232C_remain_data = 0;
|
RS232C_remain_data = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,7 +184,7 @@ rs232c_close() {
|
|||||||
|
|
||||||
rs_restore_hup_handler();
|
rs_restore_hup_handler();
|
||||||
|
|
||||||
LispReadFds &= ~RS232CReadFds;
|
FD_CLR(RS232C_Fd, &LispReadFds);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (close(RS232C_Fd) < 0)
|
if (close(RS232C_Fd) < 0)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ static char *id = "$Id: tty.c,v 1.2 1999/01/03 02:07:39 sybalsky Exp $ Copyright
|
|||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#include <sys/select.h>
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
|
|
||||||
DLTTY_OUT_COMMAND *DLTTYPortCmd;
|
DLTTY_OUT_COMMAND *DLTTYPortCmd;
|
||||||
@@ -18,7 +19,7 @@ DLTTY_OUT_CSB *DLTTYOut;
|
|||||||
|
|
||||||
char *TTY_Dev;
|
char *TTY_Dev;
|
||||||
int TTY_Fd;
|
int TTY_Fd;
|
||||||
extern int LispReadFds;
|
extern fd_set LispReadFds;
|
||||||
struct sgttyb TTY_Mode;
|
struct sgttyb TTY_Mode;
|
||||||
|
|
||||||
void tty_init() {
|
void tty_init() {
|
||||||
@@ -47,7 +48,7 @@ void tty_open() {
|
|||||||
TTY_Mode.sg_flags = RAW;
|
TTY_Mode.sg_flags = RAW;
|
||||||
stat = ioctl(TTY_Fd, TIOCSETP, &TTY_Mode);
|
stat = ioctl(TTY_Fd, TIOCSETP, &TTY_Mode);
|
||||||
|
|
||||||
LispReadFds |= (1 << TTY_Fd);
|
FD_SET(TTY_Fd, &LispReadFds);
|
||||||
#ifdef TTYINT
|
#ifdef TTYINT
|
||||||
int_io_open(TTY_Fd);
|
int_io_open(TTY_Fd);
|
||||||
#endif
|
#endif
|
||||||
@@ -66,7 +67,7 @@ void tty_close() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (TTY_Fd >= 0) {
|
if (TTY_Fd >= 0) {
|
||||||
LispReadFds &= ~(1 << TTY_Fd);
|
FD_CLR(TTY_Fd, &LispReadFds);
|
||||||
stat = close(TTY_Fd);
|
stat = close(TTY_Fd);
|
||||||
#ifdef TTYINT
|
#ifdef TTYINT
|
||||||
int_io_close(TTY_Fd);
|
int_io_close(TTY_Fd);
|
||||||
|
|||||||
13
src/uraid.c
13
src/uraid.c
@@ -39,6 +39,7 @@ static char *id = "@(#) uraid.c 1.52 4/23/92 (Venue & Fuji Xerox)";
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#endif /* DOS */
|
#endif /* DOS */
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifndef XWINDOW
|
#ifndef XWINDOW
|
||||||
@@ -164,7 +165,8 @@ extern struct pixrect *ColorDisplayPixrect, *DisplayRegionPixrect;
|
|||||||
#endif /* NOPIXRECT */
|
#endif /* NOPIXRECT */
|
||||||
|
|
||||||
extern int DisplayRasterWidth;
|
extern int DisplayRasterWidth;
|
||||||
extern unsigned int LispReadFds, LispWindowFd, LispKbdFd;
|
extern unsigned int LispWindowFd, LispKbdFd;
|
||||||
|
extern fd_set LispReadFds;
|
||||||
#ifndef NOPIXRECT
|
#ifndef NOPIXRECT
|
||||||
extern struct pixrect *CursorBitMap, *InvisibleCursorBitMap;
|
extern struct pixrect *CursorBitMap, *InvisibleCursorBitMap;
|
||||||
#endif /* NOPIXRECT */
|
#endif /* NOPIXRECT */
|
||||||
@@ -173,7 +175,6 @@ extern struct screen LispScreen;
|
|||||||
extern int displaywidth, displayheight;
|
extern int displaywidth, displayheight;
|
||||||
extern DLword *DisplayRegion68k;
|
extern DLword *DisplayRegion68k;
|
||||||
extern int FrameBufferFd, ether_fd, RS232C_Fd;
|
extern int FrameBufferFd, ether_fd, RS232C_Fd;
|
||||||
extern u_int EtherReadFds;
|
|
||||||
|
|
||||||
LispPTR RadiAtomIndex;
|
LispPTR RadiAtomIndex;
|
||||||
LispPTR RaidPackageIndex;
|
LispPTR RaidPackageIndex;
|
||||||
@@ -1085,7 +1086,7 @@ static int re_init_display(int, int);
|
|||||||
int device_after_raid() {
|
int device_after_raid() {
|
||||||
extern DLword *EmMouseX68K, *EmMouseY68K, *EmKbdAd068K, *EmRealUtilin68K;
|
extern DLword *EmMouseX68K, *EmMouseY68K, *EmKbdAd068K, *EmRealUtilin68K;
|
||||||
extern DLword *EmKbdAd168K, *EmKbdAd268K, *EmKbdAd368K, *EmKbdAd468K, *EmKbdAd568K;
|
extern DLword *EmKbdAd168K, *EmKbdAd268K, *EmKbdAd368K, *EmKbdAd468K, *EmKbdAd568K;
|
||||||
LispReadFds = 0;
|
FD_ZERO(&LispReadFds);
|
||||||
if (re_init_display(DISPLAY_OFFSET, 65536 * 16 * 2) == -1) return (-1);
|
if (re_init_display(DISPLAY_OFFSET, 65536 * 16 * 2) == -1) return (-1);
|
||||||
set_cursor();
|
set_cursor();
|
||||||
init_keyboard(1);
|
init_keyboard(1);
|
||||||
@@ -1118,17 +1119,17 @@ int device_after_raid() {
|
|||||||
int_init();
|
int_init();
|
||||||
|
|
||||||
#ifdef SUNDISPLAY
|
#ifdef SUNDISPLAY
|
||||||
LispReadFds |= (1 << LispWindowFd);
|
FD_SET(LispWindowFd, &LispReadFds);
|
||||||
#endif /* SUNDISPLAY */
|
#endif /* SUNDISPLAY */
|
||||||
|
|
||||||
#ifdef NOETHER
|
#ifdef NOETHER
|
||||||
#else
|
#else
|
||||||
LispReadFds |= EtherReadFds;
|
FD_SET(ether_fd, &LispReadFds);
|
||||||
#endif /* NOETHER */
|
#endif /* NOETHER */
|
||||||
|
|
||||||
#ifdef XWINDOW
|
#ifdef XWINDOW
|
||||||
(currentdsp->device.after_raid)(currentdsp);
|
(currentdsp->device.after_raid)(currentdsp);
|
||||||
LispReadFds |= (1 << ConnectionNumber(currentdsp->display_id));
|
FD_SET(ConnectionNumber(currentdsp->display_id), &LispReadFds);
|
||||||
flush_display_buffer();
|
flush_display_buffer();
|
||||||
#elif DOS
|
#elif DOS
|
||||||
(currentdsp->device.after_raid)(currentdsp);
|
(currentdsp->device.after_raid)(currentdsp);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ static char *id = "$Id: xinit.c,v 1.5 2001/12/26 22:17:06 sybalsky Exp $ Copyrig
|
|||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
|
||||||
#ifndef APOLLO
|
#ifndef APOLLO
|
||||||
#ifndef HPUX
|
#ifndef HPUX
|
||||||
@@ -83,7 +84,7 @@ unsigned LispDisplayRequestedWidth, LispDisplayRequestedHeight;
|
|||||||
Colormap Colors;
|
Colormap Colors;
|
||||||
|
|
||||||
int XLocked = 0; /* non-zero while doing X ops, to avoid signals */
|
int XLocked = 0; /* non-zero while doing X ops, to avoid signals */
|
||||||
extern int LispReadFds;
|
extern fd_set LispReadFds;
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -203,7 +204,7 @@ void Xevent_after_raid(DspInterface dsp)
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
void Open_Display(DspInterface dsp)
|
void Open_Display(DspInterface dsp)
|
||||||
{
|
{
|
||||||
LispReadFds |= (1 << ConnectionNumber(dsp->display_id));
|
FD_SET(ConnectionNumber(dsp->display_id), &LispReadFds);
|
||||||
#ifndef ISC
|
#ifndef ISC
|
||||||
#ifndef HPUX
|
#ifndef HPUX
|
||||||
fcntl(ConnectionNumber(dsp->display_id), F_SETOWN, getpid());
|
fcntl(ConnectionNumber(dsp->display_id), F_SETOWN, getpid());
|
||||||
|
|||||||
Reference in New Issue
Block a user