From 0b858de12035a9fc849dda9e86cc2aeacc841371 Mon Sep 17 00:00:00 2001 From: TXuian <1163589503@qq.com> Date: Thu, 16 May 2024 14:44:41 +0800 Subject: [PATCH] Fix userland exit() type --- Ubiquitous/XiZi_AIoT/services/app/init.c | 4 ++-- Ubiquitous/XiZi_AIoT/services/app/simple_client.c | 5 +++-- Ubiquitous/XiZi_AIoT/services/app/simple_server.c | 4 ++-- Ubiquitous/XiZi_AIoT/services/app/test_fs.c | 2 +- Ubiquitous/XiZi_AIoT/services/app/test_irq_block.c | 4 ++-- Ubiquitous/XiZi_AIoT/services/app/test_irq_handler.c | 6 +++--- Ubiquitous/XiZi_AIoT/services/app/test_priority.c | 2 +- .../services/boards/imx6q-sabrelite/test_irq_sender.c | 2 +- .../services/drivers/imx6q-sabrelite/clock/timer.c | 4 ++-- .../services/drivers/imx6q-sabrelite/enet/enet_test.c | 8 ++++---- Ubiquitous/XiZi_AIoT/services/fs/fs_server/fs_server.c | 4 ++-- Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.c | 4 ++-- Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.h | 2 +- 13 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Ubiquitous/XiZi_AIoT/services/app/init.c b/Ubiquitous/XiZi_AIoT/services/app/init.c index 3c3fc1446..d204ca4a8 100755 --- a/Ubiquitous/XiZi_AIoT/services/app/init.c +++ b/Ubiquitous/XiZi_AIoT/services/app/init.c @@ -28,7 +28,7 @@ int main(int argc, char* argv[]) char* shell_task_param[2] = { "/shell", 0 }; if ((fd = open(&session, shell_task_param[0])) < 0) { printf("Open %s failed\n", shell_task_param[0]); - exit(); + exit(1); } if (spawn(&session, fd, read, fsize, shell_task_param[0], shell_task_param) < 0) { @@ -37,6 +37,6 @@ int main(int argc, char* argv[]) close(&session, fd); - exit(); + exit(0); return 0; } diff --git a/Ubiquitous/XiZi_AIoT/services/app/simple_client.c b/Ubiquitous/XiZi_AIoT/services/app/simple_client.c index 0462bce7d..8df8064a1 100755 --- a/Ubiquitous/XiZi_AIoT/services/app/simple_client.c +++ b/Ubiquitous/XiZi_AIoT/services/app/simple_client.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "libfs_to_client.h" #include "libserial.h" @@ -90,7 +91,7 @@ int main(int argc, char** argv) struct Session session_nowait; if (connect_session(&session_wait, "SimpleServer", 4096) < 0 || connect_session(&session_nowait, "SimpleServer", 4096) < 0) { printf("connect session failed\n"); - exit(); + exit(1); } char *buf1 = NULL, *buf2 = NULL; @@ -138,5 +139,5 @@ int main(int argc, char** argv) free_session(&session_wait); free_session(&session_nowait); - exit(); + exit(0); } diff --git a/Ubiquitous/XiZi_AIoT/services/app/simple_server.c b/Ubiquitous/XiZi_AIoT/services/app/simple_server.c index 90cb8e442..0a2ba417c 100755 --- a/Ubiquitous/XiZi_AIoT/services/app/simple_server.c +++ b/Ubiquitous/XiZi_AIoT/services/app/simple_server.c @@ -38,10 +38,10 @@ int main(int argc, char* argv[]) { if (register_server("SimpleServer") < 0) { printf("register server name: %s failed.\n", "SimpleServer"); - exit(); + exit(1); } ipc_server_loop(&IpcSimpleServer); // never reached - exit(); + exit(0); } diff --git a/Ubiquitous/XiZi_AIoT/services/app/test_fs.c b/Ubiquitous/XiZi_AIoT/services/app/test_fs.c index 3e592530f..c6f2e5f95 100644 --- a/Ubiquitous/XiZi_AIoT/services/app/test_fs.c +++ b/Ubiquitous/XiZi_AIoT/services/app/test_fs.c @@ -48,6 +48,6 @@ int main(int argc, char* argv[]) printf("Test memry error %s.\n", 0x50000000); printf("After error computing.\n"); - exit(); + exit(0); return 0; } diff --git a/Ubiquitous/XiZi_AIoT/services/app/test_irq_block.c b/Ubiquitous/XiZi_AIoT/services/app/test_irq_block.c index 0fb246e80..d4a715379 100644 --- a/Ubiquitous/XiZi_AIoT/services/app/test_irq_block.c +++ b/Ubiquitous/XiZi_AIoT/services/app/test_irq_block.c @@ -24,12 +24,12 @@ int main(int argc, char* argv[]) struct Session session; if (connect_session(&session, "TestIRQ", 4096) < 0) { printf("connect session failed\n"); - exit(); + exit(1); } printf("%s start waiting for IRQ.\n", prog_name); wait_intr(&session); printf("%s return from waiting for IRQ.\n", prog_name); - exit(); + exit(0); } \ No newline at end of file diff --git a/Ubiquitous/XiZi_AIoT/services/app/test_irq_handler.c b/Ubiquitous/XiZi_AIoT/services/app/test_irq_handler.c index c1f49fb0c..60e97b726 100644 --- a/Ubiquitous/XiZi_AIoT/services/app/test_irq_handler.c +++ b/Ubiquitous/XiZi_AIoT/services/app/test_irq_handler.c @@ -40,16 +40,16 @@ int main() { if (register_irq(SW_INTERRUPT_3, Ipc_intr_3) < 0) { printf("TEST_SW_HDLR: bind failed"); - exit(); + exit(1); } static char prog_name[] = "TestIRQ"; if (register_server("TestIRQ") < 0) { printf("register server name: %s failed.\n", prog_name); - exit(); + exit(1); } ipc_server_loop(&IpcSwIntrHandler); - exit(); + exit(0); } \ No newline at end of file diff --git a/Ubiquitous/XiZi_AIoT/services/app/test_priority.c b/Ubiquitous/XiZi_AIoT/services/app/test_priority.c index 6bd1c15f1..cefa2a48e 100644 --- a/Ubiquitous/XiZi_AIoT/services/app/test_priority.c +++ b/Ubiquitous/XiZi_AIoT/services/app/test_priority.c @@ -39,6 +39,6 @@ int main(int argc, char* argv[]) // test function count_down(); - exit(); + exit(0); return 0; } diff --git a/Ubiquitous/XiZi_AIoT/services/boards/imx6q-sabrelite/test_irq_sender.c b/Ubiquitous/XiZi_AIoT/services/boards/imx6q-sabrelite/test_irq_sender.c index c3eb4328f..566d5add6 100644 --- a/Ubiquitous/XiZi_AIoT/services/boards/imx6q-sabrelite/test_irq_sender.c +++ b/Ubiquitous/XiZi_AIoT/services/boards/imx6q-sabrelite/test_irq_sender.c @@ -96,5 +96,5 @@ int main() printf("%s: Soft interrupt send 1 time\n", prog_name); } printf("%s: Soft interrupt send done\n", prog_name); - exit(); + exit(0); } \ No newline at end of file diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/clock/timer.c b/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/clock/timer.c index 03ded2d27..997c6fda6 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/clock/timer.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/clock/timer.c @@ -178,7 +178,7 @@ int main(int argc, char** argv) static char server_name[] = "TimerServer"; if (register_server(server_name) < 0) { printf("register server name %s failed\n", server_name); - exit(); + exit(1); } static uint32_t epit_instance = HW_EPIT2; @@ -188,7 +188,7 @@ int main(int argc, char** argv) ipc_server_loop(&IpcSabreliteTimer); - exit(); + exit(0); } //////////////////////////////////////////////////////////////////////////////// diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/enet/enet_test.c b/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/enet/enet_test.c index 2a1947e30..52d18b2fd 100755 --- a/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/enet/enet_test.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/enet/enet_test.c @@ -250,23 +250,23 @@ int main(int argc, char** argv) { if (connect_session(&timer_session, timer_server_name, 4096) < 0) { printf("%s connect server: %s failed\n", enet_server_name, timer_server_name); - exit(); + exit(1); } printf("%s: Mapping %08x(size: %x) to %08x\n", enet_server_name, AIPS1_ARB_PHY_BASE_ADDR, AIPS1_ARB_END_ADDR - AIPS1_ARB_BASE_ADDR, AIPS1_ARB_BASE_ADDR); if (!mmap(AIPS1_ARB_BASE_ADDR, AIPS1_ARB_PHY_BASE_ADDR, AIPS1_ARB_END_ADDR - AIPS1_ARB_BASE_ADDR, true)) { printf("%s: mmap AIPS1 ARB(%8x) failed\n", enet_server_name, AIPS1_ARB_PHY_BASE_ADDR); - exit(); + exit(1); } printf("%s: Mapping %08x(size: %x) to %8x\n", enet_server_name, AIPS2_ARB_PHY_BASE_ADDR, AIPS2_ARB_END_ADDR - AIPS2_ARB_BASE_ADDR, AIPS2_ARB_BASE_ADDR); if (!mmap(AIPS2_ARB_BASE_ADDR, AIPS2_ARB_PHY_BASE_ADDR, AIPS2_ARB_END_ADDR - AIPS2_ARB_BASE_ADDR, true)) { printf("%s: mmap AIPS1 ARB(%08x) failed\n", enet_server_name, AIPS2_ARB_PHY_BASE_ADDR); - exit(); + exit(1); } enet_test(); - exit(); + exit(0); return 0; } \ No newline at end of file diff --git a/Ubiquitous/XiZi_AIoT/services/fs/fs_server/fs_server.c b/Ubiquitous/XiZi_AIoT/services/fs/fs_server/fs_server.c index 8d0246f7e..5f13e6737 100644 --- a/Ubiquitous/XiZi_AIoT/services/fs/fs_server/fs_server.c +++ b/Ubiquitous/XiZi_AIoT/services/fs/fs_server/fs_server.c @@ -358,10 +358,10 @@ int main(int argc, char* argv[]) if (register_server("MemFS") < 0) { printf("register server name: %s failed.\n", "MemFs"); - exit(); + exit(1); } ipc_server_loop(&IpcFsServer); // never reached - exit(); + exit(0); } diff --git a/Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.c b/Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.c index 8570c0f98..77d96be01 100644 --- a/Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.c +++ b/Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.c @@ -26,9 +26,9 @@ int spawn(struct Session* session, int fd, ipc_read_fn ipc_read, ipc_fsize_fn ip return ret; } -int exit() +void exit(int status) { - return syscall(SYSCALL_EXIT, 0, 0, 0, 0); + syscall(SYSCALL_EXIT, (uintptr_t)status, 0, 0, 0); } int yield(task_yield_reason reason) diff --git a/Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.h b/Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.h index 822831942..68b488da7 100644 --- a/Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.h +++ b/Ubiquitous/XiZi_AIoT/services/lib/usyscall/usyscall.h @@ -65,7 +65,7 @@ typedef int (*ipc_write_fn)(struct Session* session, int fd, char* src, int offs int syscall(int sys_num, intptr_t a1, intptr_t a2, intptr_t a3, intptr_t a4); int spawn(struct Session* session, int fd, ipc_read_fn ipc_read, ipc_fsize_fn ipc_fsize, char* name, char** argv); -int exit(); +void exit(int status); int yield(task_yield_reason reason); int kill(int pid); int register_server(char* name);