Skip to content

Commit

Permalink
feat(syscall): add sys_shutdown in favor of sys_shutdown_socket
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
  • Loading branch information
mkroening committed May 22, 2024
1 parent 791221b commit 96498f1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/syscalls/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand All @@ -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 {
Expand Down

0 comments on commit 96498f1

Please sign in to comment.