Commit 2532624
fix(net): add packet polling to networking syscalls for first-call readiness (#99)
* fix(ext2): add init_shell and telnetd to filesystem
The telnetd server was trying to exec /bin/init_shell but it wasn't
in the ext2 filesystem, causing the shell to fail to start over telnet.
Now ext2 contains:
- /bin/init_shell (32KB) - interactive shell
- /bin/telnetd (9KB) - telnet server
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(net): add packet polling to networking syscalls for first-call readiness
TCP listeners were not detecting pending connections on the first
poll/select/accept call because incoming SYN packets remained
unprocessed in the e1000 driver buffer. The fix ensures process_rx()
and drain_loopback_queue() are called at syscall entry.
Changes:
- Add process_rx() + drain_loopback_queue() to sys_poll, sys_select,
sys_accept, sys_recvfrom, and sys_read for TcpConnection
- Add first-call accept test (Test 25) without retry loop
- Add TCP listener poll test (Phase 8) verifying POLLIN on first call
- Add TCP listener select test (Phase 8) verifying readiness on first call
- Fix PTY master reference counting for fork/exec scenarios
- Add telnetd to ext2 filesystem and update run.sh for interactive mode
All 226 boot stages pass. Tests verify first-call success without
retry loops, ensuring the fix actually works rather than masking
timing issues.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(tcp): add refcount for fork/close pattern + remove debug output
TCP connections now use reference counting similar to PTY:
- Add refcount field to TcpConnection (AtomicUsize)
- tcp_add_ref() increments count during fork
- tcp_close() only sends FIN when last reference drops
- FdTable::clone() calls tcp_add_ref() for TCP fds
This fixes telnetd where the child closes inherited socket fds,
which was prematurely closing the parent's connection.
Also removes debug output:
- TSS RSP0 updated messages from gdt.rs
- tcp_add_ref/tcp_close debug logs from tcp.rs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent db6d3c6 commit 2532624
File tree
13 files changed
+466
-22
lines changed- kernel/src
- ipc
- net
- process
- syscall
- scripts
- testdata
- userspace/tests
13 files changed
+466
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | 181 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | 182 | | |
189 | 183 | | |
190 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
214 | 226 | | |
215 | 227 | | |
216 | 228 | | |
| |||
470 | 482 | | |
471 | 483 | | |
472 | 484 | | |
473 | | - | |
474 | | - | |
475 | | - | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
476 | 495 | | |
477 | 496 | | |
478 | 497 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
299 | 301 | | |
300 | 302 | | |
301 | 303 | | |
| |||
321 | 323 | | |
322 | 324 | | |
323 | 325 | | |
| 326 | + | |
324 | 327 | | |
325 | 328 | | |
326 | 329 | | |
| |||
352 | 355 | | |
353 | 356 | | |
354 | 357 | | |
| 358 | + | |
355 | 359 | | |
356 | 360 | | |
357 | 361 | | |
| |||
1034 | 1038 | | |
1035 | 1039 | | |
1036 | 1040 | | |
1037 | | - | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
1038 | 1050 | | |
1039 | 1051 | | |
1040 | 1052 | | |
1041 | 1053 | | |
1042 | 1054 | | |
1043 | 1055 | | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
1044 | 1065 | | |
1045 | 1066 | | |
1046 | 1067 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
279 | | - | |
280 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
281 | 288 | | |
282 | 289 | | |
283 | 290 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
783 | 783 | | |
784 | 784 | | |
785 | 785 | | |
786 | | - | |
| 786 | + | |
| 787 | + | |
787 | 788 | | |
788 | 789 | | |
789 | 790 | | |
| |||
2301 | 2302 | | |
2302 | 2303 | | |
2303 | 2304 | | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
2304 | 2311 | | |
2305 | 2312 | | |
2306 | 2313 | | |
| |||
2429 | 2436 | | |
2430 | 2437 | | |
2431 | 2438 | | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
2432 | 2445 | | |
2433 | 2446 | | |
2434 | 2447 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | | - | |
197 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
198 | 208 | | |
199 | 209 | | |
200 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
315 | 319 | | |
316 | 320 | | |
317 | 321 | | |
| |||
471 | 475 | | |
472 | 476 | | |
473 | 477 | | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
474 | 483 | | |
475 | 484 | | |
476 | 485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
110 | 128 | | |
111 | 129 | | |
112 | 130 | | |
| |||
209 | 227 | | |
210 | 228 | | |
211 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
212 | 244 | | |
213 | 245 | | |
214 | 246 | | |
| |||
265 | 297 | | |
266 | 298 | | |
267 | 299 | | |
| 300 | + | |
| 301 | + | |
268 | 302 | | |
269 | 303 | | |
270 | 304 | | |
| |||
Binary file not shown.
0 commit comments