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> {
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!(
"pid = {}, 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
# 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
.section .text
@ -22,14 +27,22 @@ _child:
call exit
wait_child:
mov %rax, %rdi # child process id
#ifdef PREEMPTION_ENABLE
_loop:
mov $61, %rax # syscall number of wait4
mov $0, %rsi # exit status address
mov $1, %rdx # WNOHANG
mov $1, %rdx # wait option: WNOHANG
syscall
cmp %rdi, %rax # The return value is the pid of child
jne _loop
ret
#else
mov $61, %rax # syscall number of wait4
mov $0, %rsi # exit status address
mov $0, %rdx # wait option
syscall
ret
#endif
exit:
mov $60, %rax # syscall number of exit
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_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(C_SRCS:%.c=%))
C_DEPS := $(addprefix $(DEP_OUTPUT_DIR)/,$(C_SRCS:%.c=%.d))
ASM_SRCS := $(wildcard *.s)
ASM_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(ASM_SRCS:%.s=%))
ASM_SRCS := $(wildcard *.S)
ASM_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(ASM_SRCS:%.S=%))
CC := gcc
C_FLAGS := -Wall -Werror
@ -28,6 +28,6 @@ $(OBJ_OUTPUT_DIR)/%: %.c | $(OBJ_OUTPUT_DIR) $(DEP_OUTPUT_DIR)
-include $(C_DEPS)
$(OBJ_OUTPUT_DIR)/%: %.s | $(OBJ_OUTPUT_DIR)
$(OBJ_OUTPUT_DIR)/%: %.S | $(OBJ_OUTPUT_DIR)
@$(CC) $(C_FLAGS) $(EXTRA_C_FLAGS) $< -o $@
@echo "CC <= $@"