changeset 5:f6b03af63bf7

fcsim-calypso-be: add FIONBIO setting to 0
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 05:15:49 +0000
parents deeeef558279
children 0a21a7ffe144
files calypso/Makefile calypso/main.c calypso/nonblock.c
diffstat 3 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/calypso/Makefile	Sun Mar 14 05:07:34 2021 +0000
+++ b/calypso/Makefile	Sun Mar 14 05:15:49 2021 +0000
@@ -6,7 +6,7 @@
 
 INSTBIN=${INSTALL_PREFIX}/bin
 
-MAIN_OBJS=	main.o targetfd.o tpinterf.o
+MAIN_OBJS=	main.o nonblock.o targetfd.o tpinterf.o
 
 all:	${PROGS}
 
--- a/calypso/main.c	Sun Mar 14 05:07:34 2021 +0000
+++ b/calypso/main.c	Sun Mar 14 05:15:49 2021 +0000
@@ -60,6 +60,7 @@
 	unsigned len;
 
 	parse_target_fd_opt(argc, argv);
+	set_serial_nonblock(0);
 	putchar('\n');
 
 	while (fgets(inbuf, sizeof inbuf, stdin)) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/calypso/nonblock.c	Sun Mar 14 05:15:49 2021 +0000
@@ -0,0 +1,15 @@
+/*
+ * This module contains the set_serial_nonblock() function.
+ */
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+extern int target_fd;
+
+set_serial_nonblock(state)
+	int state;
+{
+	ioctl(target_fd, FIONBIO, &state);
+}