summarylogtreecommitdiffstats
path: root/0002-kernel-5.14-task_struct.state-unsigned-tty-flow-tty.patch
blob: 68a24ffb24aeca210d68ce6f30a68f08f990cbde (plain)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
diff -pNaru5 trueport-6.10.0.orig/ptyx/ptyc.c trueport-6.10.0/ptyx/ptyc.c
--- trueport-6.10.0.orig/ptyx/ptyc.c	2020-05-28 07:56:32.000000000 -0400
+++ trueport-6.10.0/ptyx/ptyc.c	2021-09-12 22:50:04.105320366 -0400
@@ -91,29 +91,41 @@ static void ptyx_ctrl_close(struct tty_s
 
 }
 
 
   
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+static unsigned int ptyx_ctrl_write_room(struct tty_struct *tty)
+#else
 static int ptyx_ctrl_write_room(struct tty_struct *tty)
+#endif
 {
 	struct ptyx_struct *ptyx_info;
 
 	if (!tty || !tty->driver_data)		// paranoia
 		return 0;
 
 	ptyx_info = (struct ptyx_struct *) tty->driver_data;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+	if (!tty || tty->flow.stopped || (ptyx_info->flags & SLAVE_CLOSING) )
+#else
 	if (!tty || tty->stopped || (ptyx_info->flags & SLAVE_CLOSING) )
+#endif
 		return 0;
 
 	return RECEIVE_ROOM(tty);
 }
 
 //	The Control tty will pass all statuses in raw mode to the dameon
 // so in this case we can	return the true count in the buffer.
 //
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+static unsigned int ptyx_ctrl_chars_in_buffer(struct tty_struct *tty)
+#else
 static int ptyx_ctrl_chars_in_buffer(struct tty_struct *tty)
+#endif
 {
     return 0;
 }
 
 
diff -pNaru5 trueport-6.10.0.orig/ptyx/ptym.c trueport-6.10.0/ptyx/ptym.c
--- trueport-6.10.0.orig/ptyx/ptym.c	2020-05-28 07:56:32.000000000 -0400
+++ trueport-6.10.0/ptyx/ptym.c	2021-09-12 22:50:24.095375131 -0400
@@ -173,11 +173,15 @@ static int ptyx_master_write(struct tty_
 	ptyx_print(PTYX_DEBUG_WRITE, ("ptyx_master_write(%d): buf=0x%p, count=%d\n", ptyx_info->line, buf, count));
 	PTYX_LOCK(&ptyx_info->port_lock, flags);
 	s_tty = ptyx_info->s_tty;
 	PTYX_UNLOCK(&ptyx_info->port_lock, flags);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+	if (!s_tty || tty->flow.stopped || (ptyx_info->flags & SLAVE_CLOSING) )
+#else
 	if (!s_tty || tty->stopped || (ptyx_info->flags & SLAVE_CLOSING) )
+#endif
 		return 0;
 
 	if (from_user) 
 	{
 		down(&tty->flip.pty_sem);
@@ -243,11 +247,15 @@ static int ptyx_master_write(struct tty_
 	ptyx_print(PTYX_DEBUG_WRITE, ("ptyx_master_write(%d): buf=0x%p, count=%d\n", ptyx_info->line, buf, count));
 	PTYX_LOCK(&ptyx_info->port_lock, flags);
 	s_tty = ptyx_info->s_tty;
 	PTYX_UNLOCK(&ptyx_info->port_lock, flags);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+	if (!s_tty || tty->flow.stopped || (ptyx_info->flags & SLAVE_CLOSING) )
+#else
 	if (!s_tty || tty->stopped || (ptyx_info->flags & SLAVE_CLOSING) )
+#endif
 		return 0;
 
     if (count > 0) 
     {
         /* Stuff the data into the input queue of the other end */
@@ -264,11 +272,15 @@ static int ptyx_master_write(struct tty_
 
 	return c;
 }
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+static unsigned int ptyx_master_write_room(struct tty_struct *tty)
+#else
 static int ptyx_master_write_room(struct tty_struct *tty)
+#endif
 {
 	struct ptyx_struct *ptyx_info;
 	struct tty_struct *s_tty;
 	unsigned long flags;
 
@@ -279,11 +291,15 @@ static int ptyx_master_write_room(struct
 
 	PTYX_LOCK(&ptyx_info->port_lock, flags);
 	s_tty = ptyx_info->s_tty;
 	PTYX_UNLOCK(&ptyx_info->port_lock, flags);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+	if (!s_tty || tty->flow.stopped || (ptyx_info->flags & SLAVE_CLOSING) )
+#else
 	if (!s_tty || tty->stopped || (ptyx_info->flags & SLAVE_CLOSING) )
+#endif
 		return 0;
 
 	return RECEIVE_ROOM(s_tty);
 }
 
@@ -299,11 +315,15 @@ static int ptyx_master_write_room(struct
  *	WAKEUP_CHARS is regarded by select() as "full".)  To avoid deadlock 
  *	the count returned must be 0 if no canonical data is available to be 
  *	read. (The N_TTY ldisc.chars_in_buffer now knows this.)
  *  
  */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+static unsigned int ptyx_master_chars_in_buffer(struct tty_struct *tty)
+#else
 static int ptyx_master_chars_in_buffer(struct tty_struct *tty)
+#endif
 {
     return 0;
 }
 
 
diff -pNaru5 trueport-6.10.0.orig/ptyx/ptys.c trueport-6.10.0/ptyx/ptys.c
--- trueport-6.10.0.orig/ptyx/ptys.c	2021-09-12 22:49:37.855248337 -0400
+++ trueport-6.10.0/ptyx/ptys.c	2021-09-12 22:50:41.015421437 -0400
@@ -223,11 +223,15 @@ static int ptyx_slave_write(struct tty_s
 
 	PTYX_LOCK(&ptyx_info->port_lock, flags);
 	m_tty = ptyx_info->m_tty;
 	PTYX_UNLOCK(&ptyx_info->port_lock, flags);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+	if ( !m_tty || tty->flow.stopped )
+#else
 	if ( !m_tty || tty->stopped )
+#endif
 		return 0;
 
 	if (from_user) 
 	{
 		down(&tty->flip.pty_sem);
@@ -307,11 +311,15 @@ static int ptyx_slave_write(struct tty_s
 
 	PTYX_LOCK(&ptyx_info->port_lock, flags);
 	m_tty = ptyx_info->m_tty;
 	PTYX_UNLOCK(&ptyx_info->port_lock, flags);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+	if ( !m_tty || tty->flow.stopped )
+#else
 	if ( !m_tty || tty->stopped )
+#endif
 		return 0;
 	    
         if (!slave_dump_data(ptyx_info))
         {
             if (count > 0) 
@@ -337,11 +345,15 @@ static int ptyx_slave_write(struct tty_s
 }
 #endif // end greater than or equal to 2.6.10
 
  
  
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+static unsigned int ptyx_slave_write_room(struct tty_struct *tty)
+#else
 static int ptyx_slave_write_room(struct tty_struct *tty)
+#endif
 {
 	struct ptyx_struct *ptyx_info;
 	struct tty_struct *m_tty;
 	unsigned long flags;
 
@@ -353,11 +365,15 @@ static int ptyx_slave_write_room(struct
 
 	PTYX_LOCK(&ptyx_info->port_lock, flags);
 	m_tty = ptyx_info->m_tty;
 	PTYX_UNLOCK(&ptyx_info->port_lock, flags);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+	if (!m_tty || tty->flow.stopped)
+#else
 	if (!m_tty || tty->stopped)
+#endif
 		return 0;
 
 	return RECEIVE_ROOM(m_tty);
 }
 
@@ -365,11 +381,15 @@ static int ptyx_slave_write_room(struct
  *  
  *	The Slave side passes all characters in raw mode to the Master side's
  *	buffer where they can be read immediately, so in this case we can
  *	return the true count in the buffer.
  */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
+static unsigned int ptyx_slave_chars_in_buffer(struct tty_struct *tty)
+#else
 static int ptyx_slave_chars_in_buffer(struct tty_struct *tty)
+#endif
 {
     return 0;
 }