Add shutdown, listen, and getpagesize

This commit is contained in:
Jeremy Soller
2018-12-26 19:26:38 -07:00
parent a321545fd0
commit 7aa789575a
8 changed files with 41 additions and 18 deletions
+4
View File
@@ -239,6 +239,10 @@ impl Pal for Sys {
e(unsafe { syscall!(GETGID) }) as gid_t
}
fn getpagesize() -> c_int {
e(unsafe { syscall!(GETPAGESIZE) }) as c_int
}
fn getpgid(pid: pid_t) -> pid_t {
e(unsafe { syscall!(GETPGID, pid) }) as pid_t
}
+8 -8
View File
@@ -4,14 +4,6 @@ use super::{e, Sys};
use header::sys_socket::{sockaddr, socklen_t};
impl Sys {
fn listen(socket: c_int, backlog: c_int) -> c_int {
e(unsafe { syscall!(LISTEN, socket, backlog) }) as c_int
}
fn shutdown(socket: c_int, how: c_int) -> c_int {
e(unsafe { syscall!(SHUTDOWN, socket, how) }) as c_int
}
fn socketpair(domain: c_int, kind: c_int, protocol: c_int, socket_vector: *mut c_int) -> c_int {
e(unsafe { syscall!(SOCKETPAIR, domain, kind, protocol, socket_vector) }) as c_int
}
@@ -65,6 +57,10 @@ impl PalSocket for Sys {
}) as c_int
}
fn listen(socket: c_int, backlog: c_int) -> c_int {
e(unsafe { syscall!(LISTEN, socket, backlog) }) as c_int
}
unsafe fn recvfrom(
socket: c_int,
buf: *mut c_void,
@@ -116,6 +112,10 @@ impl PalSocket for Sys {
}) as c_int
}
fn shutdown(socket: c_int, how: c_int) -> c_int {
e(unsafe { syscall!(SHUTDOWN, socket, how) }) as c_int
}
unsafe fn socket(domain: c_int, kind: c_int, protocol: c_int) -> c_int {
e(syscall!(SOCKET, domain, kind, protocol)) as c_int
}