Skip to content

Commit

Permalink
Merge pull request #1220 from hermit-os/socket-shutdown
Browse files Browse the repository at this point in the history
feat(syscall): add `sys_shutdown` in favor of `sys_shutdown_socket`
  • Loading branch information
mkroening authored May 22, 2024
2 parents 0df2d02 + bdf1f48 commit 0d29aa5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
6 changes: 0 additions & 6 deletions src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
18 changes: 14 additions & 4 deletions src/syscalls/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,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 @@ -615,6 +613,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 0d29aa5

Please sign in to comment.