From 201eb718c2244684dacc0c73e1fc20edacc30e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Wed, 22 May 2024 14:44:38 +0200 Subject: [PATCH 1/2] feat(syscalls): remove `sys_shutdown` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- src/syscalls/mod.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/syscalls/mod.rs b/src/syscalls/mod.rs index 21ece2cbea..15b09a32f0 100644 --- a/src/syscalls/mod.rs +++ b/src/syscalls/mod.rs @@ -283,12 +283,6 @@ pub(crate) fn shutdown(arg: i32) -> ! { SYS.shutdown(arg) } -#[hermit_macro::system] -#[no_mangle] -pub extern "C" fn sys_shutdown(arg: i32) -> ! { - shutdown(arg) -} - #[hermit_macro::system] #[no_mangle] pub unsafe extern "C" fn sys_unlink(name: *const u8) -> i32 { From bdf1f48ee6283df748cef80e868298d7adb69ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Wed, 22 May 2024 14:15:39 +0200 Subject: [PATCH 2/2] feat(syscall): add `sys_shutdown` in favor of `sys_shutdown_socket` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- src/syscalls/socket.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/syscalls/socket.rs b/src/syscalls/socket.rs index 818f43023b..bda5e67a83 100644 --- a/src/syscalls/socket.rs +++ b/src/syscalls/socket.rs @@ -596,10 +596,8 @@ pub unsafe extern "C" fn sys_send(s: i32, mem: *const c_void, len: usize, _flags unsafe { super::write(s, mem.cast(), len) } } -#[hermit_macro::system] -#[no_mangle] -pub extern "C" fn sys_shutdown_socket(fd: i32, how: i32) -> i32 { - let obj = get_object(fd); +fn shutdown(sockfd: i32, how: i32) -> i32 { + let obj = get_object(sockfd); obj.map_or_else( |e| -num::ToPrimitive::to_i32(&e).unwrap(), |v| { @@ -609,6 +607,18 @@ pub extern "C" fn sys_shutdown_socket(fd: i32, how: i32) -> i32 { ) } +#[hermit_macro::system] +#[no_mangle] +pub extern "C" fn sys_shutdown(sockfd: i32, how: i32) -> i32 { + shutdown(sockfd, how) +} + +#[hermit_macro::system] +#[no_mangle] +pub extern "C" fn sys_shutdown_socket(fd: i32, how: i32) -> i32 { + shutdown(fd, how) +} + #[hermit_macro::system] #[no_mangle] pub unsafe extern "C" fn sys_recv(fd: i32, buf: *mut u8, len: usize, flags: i32) -> isize {