Remove WNOHANG from regression test

This commit is contained in:
Jianfeng Jiang
2024-02-05 07:38:39 +00:00
committed by Tate, Hongliang Tian
parent c88d10524c
commit fad1e42e56
4 changed files with 19 additions and 5 deletions

View File

@ -11,7 +11,8 @@ use crate::{
pub fn sys_wait4(wait_pid: u64, exit_status_ptr: u64, wait_options: u32) -> Result<SyscallReturn> { pub fn sys_wait4(wait_pid: u64, exit_status_ptr: u64, wait_options: u32) -> Result<SyscallReturn> {
log_syscall_entry!(SYS_WAIT4); log_syscall_entry!(SYS_WAIT4);
let wait_options = WaitOptions::from_bits(wait_options).expect("Unknown wait options"); let wait_options = WaitOptions::from_bits(wait_options)
.ok_or_else(|| Error::with_message(Errno::EINVAL, "unknown wait option"))?;
debug!( debug!(
"pid = {}, exit_status_ptr = {}, wait_options: {:?}", "pid = {}, exit_status_ptr = {}, wait_options: {:?}",
wait_pid as i32, exit_status_ptr, wait_options wait_pid as i32, exit_status_ptr, wait_options

View File

@ -1,5 +1,10 @@
# SPDX-License-Identifier: MPL-2.0 # SPDX-License-Identifier: MPL-2.0
# FIXME: WNOHANG option currently does not work properly without preemption, so we have temporarily
# removed it. Once preemption is supported, the following macro can be uncommented to add the WNOHANG
# option back.
# #define PREEMPTION_ENABLE
.global _start .global _start
.section .text .section .text
@ -22,14 +27,22 @@ _child:
call exit call exit
wait_child: wait_child:
mov %rax, %rdi # child process id mov %rax, %rdi # child process id
#ifdef PREEMPTION_ENABLE
_loop: _loop:
mov $61, %rax # syscall number of wait4 mov $61, %rax # syscall number of wait4
mov $0, %rsi # exit status address mov $0, %rsi # exit status address
mov $1, %rdx # WNOHANG mov $1, %rdx # wait option: WNOHANG
syscall syscall
cmp %rdi, %rax # The return value is the pid of child cmp %rdi, %rax # The return value is the pid of child
jne _loop jne _loop
ret ret
#else
mov $61, %rax # syscall number of wait4
mov $0, %rsi # exit status address
mov $0, %rdx # wait option
syscall
ret
#endif
exit: exit:
mov $60, %rax # syscall number of exit mov $60, %rax # syscall number of exit
mov $0, %rdi # exit code mov $0, %rdi # exit code

View File

@ -10,8 +10,8 @@ DEP_OUTPUT_DIR := $(BUILD_DIR)/dep/$(CUR_DIR_NAME)
C_SRCS := $(wildcard *.c) C_SRCS := $(wildcard *.c)
C_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(C_SRCS:%.c=%)) C_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(C_SRCS:%.c=%))
C_DEPS := $(addprefix $(DEP_OUTPUT_DIR)/,$(C_SRCS:%.c=%.d)) C_DEPS := $(addprefix $(DEP_OUTPUT_DIR)/,$(C_SRCS:%.c=%.d))
ASM_SRCS := $(wildcard *.s) ASM_SRCS := $(wildcard *.S)
ASM_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(ASM_SRCS:%.s=%)) ASM_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(ASM_SRCS:%.S=%))
CC := gcc CC := gcc
C_FLAGS := -Wall -Werror C_FLAGS := -Wall -Werror
@ -28,6 +28,6 @@ $(OBJ_OUTPUT_DIR)/%: %.c | $(OBJ_OUTPUT_DIR) $(DEP_OUTPUT_DIR)
-include $(C_DEPS) -include $(C_DEPS)
$(OBJ_OUTPUT_DIR)/%: %.s | $(OBJ_OUTPUT_DIR) $(OBJ_OUTPUT_DIR)/%: %.S | $(OBJ_OUTPUT_DIR)
@$(CC) $(C_FLAGS) $(EXTRA_C_FLAGS) $< -o $@ @$(CC) $(C_FLAGS) $(EXTRA_C_FLAGS) $< -o $@
@echo "CC <= $@" @echo "CC <= $@"