• Home
  • Raw
  • Download

Lines Matching full:libc

5 pub(crate) fn new_ip_socket(addr: SocketAddr, socket_type: libc::c_int) -> io::Result<libc::c_int> {  in new_ip_socket()
7 SocketAddr::V4(..) => libc::AF_INET, in new_ip_socket()
8 SocketAddr::V6(..) => libc::AF_INET6, in new_ip_socket()
15 pub(crate) fn new_socket(domain: libc::c_int, socket_type: libc::c_int) -> io::Result<libc::c_int> { in new_socket()
25 let socket_type = socket_type | libc::SOCK_NONBLOCK | libc::SOCK_CLOEXEC; in new_socket()
33 libc::SOL_SOCKET, in new_socket()
34 libc::SO_NOSIGPIPE, in new_socket()
35 &1 as *const libc::c_int as *const libc::c_void, in new_socket()
36 size_of::<libc::c_int>() as libc::socklen_t in new_socket()
45 if let Err(err) = syscall!(fcntl(socket, libc::F_SETFL, libc::O_NONBLOCK)) { in new_socket()
49 if let Err(err) = syscall!(fcntl(socket, libc::F_SETFD, libc::FD_CLOEXEC)) { in new_socket()
58 /// A type with the same memory layout as `libc::sockaddr`. Used in converting Rust level
60 /// type over using `libc::sockaddr_storage` is that this type is exactly as large as it
64 v4: libc::sockaddr_in,
65 v6: libc::sockaddr_in6,
69 pub(crate) fn as_ptr(&self) -> *const libc::sockaddr { in as_ptr()
70 self as *const _ as *const libc::sockaddr in as_ptr() constant
75 pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_t) { in socket_addr()
80 let sin_addr = libc::in_addr { in socket_addr()
84 let sockaddr_in = libc::sockaddr_in { in socket_addr()
85 sin_family: libc::AF_INET as libc::sa_family_t, in socket_addr()
101 let socklen = size_of::<libc::sockaddr_in>() as libc::socklen_t; in socket_addr()
105 let sockaddr_in6 = libc::sockaddr_in6 { in socket_addr()
106 sin6_family: libc::AF_INET6 as libc::sa_family_t, in socket_addr()
108 sin6_addr: libc::in6_addr { in socket_addr()
127 let socklen = size_of::<libc::sockaddr_in6>() as libc::socklen_t; in socket_addr()
133 /// Converts a `libc::sockaddr` compatible struct into a native Rust `SocketAddr`.
140 storage: *const libc::sockaddr_storage, in to_socket_addr()
142 match (*storage).ss_family as libc::c_int { in to_socket_addr()
143 libc::AF_INET => { in to_socket_addr()
145 let addr: &libc::sockaddr_in = &*(storage as *const libc::sockaddr_in); in to_socket_addr() constant
150 libc::AF_INET6 => { in to_socket_addr()
152 let addr: &libc::sockaddr_in6 = &*(storage as *const libc::sockaddr_in6); in to_socket_addr() constant