Implement ipc_netsockdelete() syscall and automatic dangling socket cleanup

This commit is contained in:
2025-10-29 21:21:35 +01:00
parent 7db6a8e130
commit 4417141216
12 changed files with 107 additions and 7 deletions

View File

@ -12,8 +12,10 @@ void main(void) {
if (string_strcmp(cmd, "block") == 0) {
diagdummy_block();
} else if (string_strcmp(cmd, "tcp-test") == 0) {
diagdummy_tcptest();
} else if (string_strcmp(cmd, "tcp-test-server") == 0) {
diagdummy_tcptestserver();
} else if (string_strcmp(cmd, "tcp-test-client") == 0) {
diagdummy_tcptestclient();
} else {
uprintf("diagdummy: unknown cmd %s\n", cmd);
}

View File

@ -4,7 +4,7 @@
#define MAX_CONNS 10
void diagdummy_tcptest(void) {
void diagdummy_tcptestserver(void) {
netsock_t netsock = ipc_netsockmake(NETSOCK_IPV4, NETSOCK_TCP, 1);
ipc_netsocklisten(netsock, MAX_CONNS);
@ -16,4 +16,10 @@ void diagdummy_tcptest(void) {
} else {
}
}
ipc_netsockdelete(netsock);
}
void diagdummy_tcptestclient(void) {
}

View File

@ -1,6 +1,7 @@
#ifndef DIAGDUMMY_TCPTEST_H_
#define DIAGDUMMY_TCPTEST_H_
void diagdummy_tcptest(void);
void diagdummy_tcptestserver(void);
void diagdummy_tcptestclient(void);
#endif // DIAGDUMMY_TCPTEST_H_