1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
$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);
|