[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/17] tests: Fix halt()
From: |
Sergey Bugaev |
Subject: |
[PATCH 11/17] tests: Fix halt() |
Date: |
Wed, 27 Mar 2024 19:18:35 +0300 |
Mark it as noreturn, and make sure to halt, not reboot.
---
tests/include/testlib.h | 2 +-
tests/testlib.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/include/testlib.h b/tests/include/testlib.h
index a3f3a6a8..cdb2ce13 100644
--- a/tests/include/testlib.h
+++ b/tests/include/testlib.h
@@ -63,7 +63,7 @@ extern const char* TEST_FAILURE_MARKER;
const char* e2s(int err);
const char* e2s_gnumach(int err);
-void halt();
+extern void __attribute__((noreturn)) halt();
int msleep(uint32_t timeout);
thread_t test_thread_start(task_t task, void(*routine)(void*), void* arg);
diff --git a/tests/testlib.c b/tests/testlib.c
index 2eaeb591..d2198830 100644
--- a/tests/testlib.c
+++ b/tests/testlib.c
@@ -23,6 +23,7 @@
#include <mach/message.h>
#include <mach/mig_errors.h>
#include <mach/vm_param.h>
+#include <sys/reboot.h>
#include <mach.user.h>
#include <mach_host.user.h>
@@ -55,7 +56,7 @@ mach_port_t device_priv(void)
void halt()
{
- int ret = host_reboot(host_priv_port, 0);
+ int ret = host_reboot(host_priv_port, RB_HALT);
ASSERT_RET(ret, "host_reboot() failed!");
while (1)
;
--
2.44.0
- [PATCH 04/17] Load 64-bit ELFs on all 64-bit ports, (continued)
- [PATCH 04/17] Load 64-bit ELFs on all 64-bit ports, Sergey Bugaev, 2024/03/27
- [PATCH 06/17] kern/syscall_subr.c: Use copyin()/copyout() to access user memory, Sergey Bugaev, 2024/03/27
- [PATCH 03/17] Use the x86_64 message ABI on all 64-bit ports, Sergey Bugaev, 2024/03/27
- [PATCH 02/17] Disable host_kernel_version() everywhere but on i386, Sergey Bugaev, 2024/03/27
- [PATCH 08/17] ipc: Turn ipc_entry_lookup_failed() into a macro, Sergey Bugaev, 2024/03/27
- [PATCH 11/17] tests: Fix halt(),
Sergey Bugaev <=
- [PATCH 09/17] Move copy{in,out}msg declarations to copy_user.h, Sergey Bugaev, 2024/03/27
- [PATCH 15/17] tests: Make exception subcode a long, Sergey Bugaev, 2024/03/27
- [PATCH 12/17] tests: Add a more serious mach_msg_server() routine, Sergey Bugaev, 2024/03/27
- [PATCH 07/17] kern/rdxtree: Fix undefined behavior, Sergey Bugaev, 2024/03/27
- [PATCH 17/17] tests: Create tests/ in the build tree before trying to use it, Sergey Bugaev, 2024/03/27