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()
36 libc::SOL_SOCKET, in new_socket()
37 libc::SO_NOSIGPIPE, in new_socket()
38 &1 as *const libc::c_int as *const libc::c_void, in new_socket()
39 size_of::<libc::c_int>() as libc::socklen_t in new_socket()
50 syscall!(fcntl(socket, libc::F_SETFL, libc::O_NONBLOCK)) in new_socket()
51 .and_then(|_| syscall!(fcntl(socket, libc::F_SETFD, libc::FD_CLOEXEC)).map(|_| socket)) in new_socket()
63 /// A type with the same memory layout as `libc::sockaddr`. Used in converting Rust level
65 /// type over using `libc::sockaddr_storage` is that this type is exactly as large as it
69 v4: libc::sockaddr_in,
70 v6: libc::sockaddr_in6,
74 pub(crate) fn as_ptr(&self) -> *const libc::sockaddr { in as_ptr()
75 self as *const _ as *const libc::sockaddr in as_ptr() constant
80 pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_t) { in socket_addr()
85 let sin_addr = libc::in_addr { in socket_addr()
89 let sockaddr_in = libc::sockaddr_in { in socket_addr()
90 sin_family: libc::AF_INET as libc::sa_family_t, in socket_addr()
106 let socklen = size_of::<libc::sockaddr_in>() as libc::socklen_t; in socket_addr()
110 let sockaddr_in6 = libc::sockaddr_in6 { in socket_addr()
111 sin6_family: libc::AF_INET6 as libc::sa_family_t, in socket_addr()
113 sin6_addr: libc::in6_addr { in socket_addr()
132 let socklen = size_of::<libc::sockaddr_in6>() as libc::socklen_t; in socket_addr()
138 /// Converts a `libc::sockaddr` compatible struct into a native Rust `SocketAddr`.
145 storage: *const libc::sockaddr_storage, in to_socket_addr()
147 match (*storage).ss_family as libc::c_int { in to_socket_addr()
148 libc::AF_INET => { in to_socket_addr()
150 let addr: &libc::sockaddr_in = &*(storage as *const libc::sockaddr_in); in to_socket_addr() constant
155 libc::AF_INET6 => { in to_socket_addr()
157 let addr: &libc::sockaddr_in6 = &*(storage as *const libc::sockaddr_in6); in to_socket_addr() constant