mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-08 11:52:55 -04:00
90 lines
2.8 KiB
Plaintext
90 lines
2.8 KiB
Plaintext
$NetBSD: patch-aa,v 1.3 2014/02/16 15:45:52 wiedi Exp $
|
|
|
|
--- sredird.c.orig 2002-01-14 10:40:44.000000000 +0000
|
|
+++ sredird.c
|
|
@@ -77,14 +77,17 @@
|
|
#include <sys/time.h>
|
|
#include <sys/times.h>
|
|
#include <sys/types.h>
|
|
+#if defined(__sun)
|
|
+#include <sys/filio.h>
|
|
+#endif
|
|
#include <sys/ioctl.h>
|
|
#include <signal.h>
|
|
#include <fcntl.h>
|
|
#include <syslog.h>
|
|
#include <termios.h>
|
|
-#include <termio.h>
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
+#include <netinet/in_systm.h>
|
|
#include <netinet/ip.h>
|
|
#include <netinet/tcp.h>
|
|
|
|
@@ -656,10 +659,14 @@ unsigned long int GetPortSpeed(int PortF
|
|
return(57600UL);
|
|
case B115200:
|
|
return(115200UL);
|
|
+#ifdef B230400
|
|
case B230400:
|
|
return(230400UL);
|
|
+#endif
|
|
+#ifdef B460800
|
|
case B460800:
|
|
return(460800UL);
|
|
+#endif
|
|
default:
|
|
return(0UL);
|
|
}
|
|
@@ -1038,9 +1045,11 @@ void SetPortSpeed(int PortFd, unsigned l
|
|
case 230400UL:
|
|
Speed = B230400;
|
|
break;
|
|
+#ifdef B460800
|
|
case 460800UL:
|
|
Speed = B460800;
|
|
break;
|
|
+#endif
|
|
default:
|
|
LogMsg(LOG_WARNING,"Unknwon baud rate requested, setting to 9600.");
|
|
Speed = B9600;
|
|
@@ -1770,7 +1779,8 @@ int main(int argc, char * argv[])
|
|
int SockParm;
|
|
|
|
/* Out buffer ticks count */
|
|
- clock_t OutBTicks = times(NULL);
|
|
+ struct tms Tms;
|
|
+ clock_t OutBTicks = times(&Tms);
|
|
|
|
/* Out buffer clock ticks limit */
|
|
clock_t MaxBTicks;
|
|
@@ -1882,7 +1892,15 @@ int main(int argc, char * argv[])
|
|
tcgetattr(DeviceFd,&PortSettings);
|
|
|
|
/* Set the serial port to raw mode */
|
|
+#if defined(__sun)
|
|
+ PortSettings.c_iflag &= ~(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
|
|
+ PortSettings.c_oflag &= ~OPOST;
|
|
+ PortSettings.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
|
|
+ PortSettings.c_cflag &= ~(CSIZE|PARENB);
|
|
+ PortSettings.c_cflag |= CS8;
|
|
+#else
|
|
cfmakeraw(&PortSettings);
|
|
+#endif
|
|
|
|
/* Enable HANGUP on close and disable modem control line handling */
|
|
PortSettings.c_cflag = (PortSettings.c_cflag | HUPCL) | CLOCAL;
|
|
@@ -1907,10 +1925,10 @@ int main(int argc, char * argv[])
|
|
*/
|
|
SockParm = IPTOS_LOWDELAY;
|
|
setsockopt(STDIN_FILENO,SOL_SOCKET,SO_KEEPALIVE,&SockParmEnable,sizeof(SockParmEnable));
|
|
- setsockopt(STDIN_FILENO,SOL_IP,IP_TOS,&SockParm,sizeof(SockParm));
|
|
+ setsockopt(STDIN_FILENO,IPPROTO_IP,IP_TOS,&SockParm,sizeof(SockParm));
|
|
setsockopt(STDIN_FILENO,SOL_SOCKET,SO_OOBINLINE,&SockParmEnable,sizeof(SockParmEnable));
|
|
setsockopt(STDOUT_FILENO,SOL_SOCKET,SO_KEEPALIVE,&SockParmEnable,sizeof(SockParmEnable));
|
|
- setsockopt(STDOUT_FILENO,SOL_IP,IP_TOS,&SockParm,sizeof(SockParm));
|
|
+ setsockopt(STDOUT_FILENO,IPPROTO_IP,IP_TOS,&SockParm,sizeof(SockParm));
|
|
|
|
/* Make reads/writes unblocking */
|
|
ioctl(STDOUT_FILENO,FIONBIO,&SockParmEnable);
|