• Home
  • Raw
  • Download

Lines Matching full:libc

51 use libc::ssize_t;
52 use libc::{c_void, in6_addr, in_addr};
58 pub(crate) use libc::c_int;
61 pub(crate) use libc::{AF_INET, AF_INET6};
64 pub(crate) use libc::SOCK_RAW;
66 pub(crate) use libc::SOCK_SEQPACKET;
67 pub(crate) use libc::{SOCK_DGRAM, SOCK_STREAM};
69 pub(crate) use libc::{IPPROTO_ICMP, IPPROTO_ICMPV6, IPPROTO_TCP, IPPROTO_UDP};
71 pub(crate) use libc::{
76 pub(crate) use libc::{MSG_TRUNC, SO_OOBINLINE};
79 pub(crate) use libc::IP_HDRINCL;
89 pub(crate) use libc::IP_RECVTOS;
96 pub(crate) use libc::IP_TOS;
98 pub(crate) use libc::SO_LINGER;
100 pub(crate) use libc::SO_LINGER_SEC as SO_LINGER;
101 pub(crate) use libc::{
116 pub(crate) use libc::{
129 pub(crate) use libc::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
140 pub(crate) use libc::{
156 pub(crate) use libc::{TCP_KEEPCNT, TCP_KEEPINTVL};
162 use libc::TCP_KEEPALIVE as KEEPALIVE_TIME;
164 use libc::TCP_KEEPIDLE as KEEPALIVE_TIME;
170 let res = unsafe { libc::$fn($($arg, )*) };
187 // On macOS, however, apparently the 64-bit libc is either buggy or
230 pub const UNIX: Domain = Domain(libc::AF_UNIX);
244 pub const PACKET: Domain = Domain(libc::AF_PACKET);
252 pub const VSOCK: Domain = Domain(libc::AF_VSOCK);
257 libc::AF_INET,
258 libc::AF_INET6,
259 libc::AF_UNIX,
265 libc::AF_PACKET,
268 libc::AF_VSOCK,
269 libc::AF_UNSPEC, // = 0.
305 Type(self.0 | libc::SOCK_NONBLOCK) in nonblocking()
353 Type(self.0 | libc::SOCK_CLOEXEC) in _cloexec()
359 libc::SOCK_STREAM,
360 libc::SOCK_DGRAM,
362 libc::SOCK_RAW,
364 libc::SOCK_RDM,
365 libc::SOCK_SEQPACKET,
376 libc::SOCK_NONBLOCK,
386 libc::SOCK_CLOEXEC,
392 libc::IPPROTO_ICMP,
393 libc::IPPROTO_ICMPV6,
394 libc::IPPROTO_TCP,
395 libc::IPPROTO_UDP,
409 self.0 & libc::MSG_EOR != 0 in is_end_of_record()
419 self.0 & libc::MSG_OOB != 0 in is_out_of_band()
436 vec: libc::iovec,
447 vec: libc::iovec { in new()
482 let storage: &mut libc::sockaddr_un = unsafe { &mut *storage.cast() }; in unix()
499 storage.sun_family = libc::AF_UNIX as sa_family_t; in unix()
548 let storage: &mut libc::sockaddr_vm = unsafe { &mut *storage.cast() }; in vsock()
551 storage.svm_family = libc::AF_VSOCK as sa_family_t; in vsock()
555 *len = mem::size_of::<libc::sockaddr_vm>() as socklen_t; in vsock()
571 if self.family() == libc::AF_VSOCK as sa_family_t { in vsock_address()
573 let addr = unsafe { &*(self.as_ptr() as *const libc::sockaddr_vm) }; in vsock_address() constant
616 let mut pollfd = libc::pollfd { in poll_connect()
618 events: libc::POLLIN | libc::POLLOUT, in poll_connect()
635 if (pollfd.revents & libc::POLLHUP) != 0 || (pollfd.revents & libc::POLLERR) != 0 { in poll_connect()
692 syscall!(fcntl(fd, libc::F_DUPFD_CLOEXEC, 0)) in try_clone()
697 fcntl_add(fd, libc::F_GETFL, libc::F_SETFL, libc::O_NONBLOCK) in set_nonblocking()
699 fcntl_remove(fd, libc::F_GETFL, libc::F_SETFL, libc::O_NONBLOCK) in set_nonblocking()
705 Shutdown::Write => libc::SHUT_WR, in shutdown()
706 Shutdown::Read => libc::SHUT_RD, in shutdown()
707 Shutdown::Both => libc::SHUT_RDWR, in shutdown()
779 ) -> io::Result<(usize, libc::socklen_t, RecvFlags)> { in recvmsg()
783 size_of::<sockaddr_storage>() as libc::socklen_t in recvmsg()
785 // libc::msghdr contains unexported padding fields on Fuchsia. in recvmsg()
786 let mut msg: libc::msghdr = unsafe { mem::zeroed() }; in recvmsg()
841 // libc::msghdr contains unexported padding fields on Fuchsia. in sendmsg()
842 let mut msg: libc::msghdr = unsafe { mem::zeroed() }; in sendmsg()
859 fn from_timeval(duration: libc::timeval) -> Option<Duration> { in from_timeval()
880 fn into_timeval(duration: Option<Duration>) -> libc::timeval { in into_timeval()
882 // https://github.com/rust-lang/libc/issues/1848 in into_timeval()
884 Some(duration) => libc::timeval { in into_timeval()
885 tv_sec: min(duration.as_secs(), libc::time_t::max_value() as u64) as libc::time_t, in into_timeval()
886 tv_usec: duration.subsec_micros() as libc::suseconds_t, in into_timeval()
888 None => libc::timeval { in into_timeval()
909 unsafe { setsockopt(fd, libc::IPPROTO_TCP, KEEPALIVE_TIME, secs)? } in set_tcp_keepalive()
925 unsafe { setsockopt(fd, libc::IPPROTO_TCP, libc::TCP_KEEPINTVL, secs)? } in set_tcp_keepalive()
929 unsafe { setsockopt(fd, libc::IPPROTO_TCP, libc::TCP_KEEPCNT, retries as c_int)? } in set_tcp_keepalive()
968 let mut len = size_of::<T>() as libc::socklen_t; in getsockopt()
996 mem::size_of::<T>() as libc::socklen_t, in setsockopt()
1035 ) -> libc::ip_mreqn { in to_mreqn()
1037 crate::socket::InterfaceIndexOrAddress::Index(interface) => libc::ip_mreqn { in to_mreqn()
1042 crate::socket::InterfaceIndexOrAddress::Address(interface) => libc::ip_mreqn { in to_mreqn()
1127 libc::F_GETFD, in _set_cloexec()
1128 libc::F_SETFD, in _set_cloexec()
1129 libc::FD_CLOEXEC, in _set_cloexec()
1134 libc::F_GETFD, in _set_cloexec()
1135 libc::F_SETFD, in _set_cloexec()
1136 libc::FD_CLOEXEC, in _set_cloexec()
1153 libc::SOL_SOCKET, in _set_nosigpipe()
1154 libc::SO_NOSIGPIPE, in _set_nosigpipe()
1169 getsockopt::<c_int>(self.as_raw(), libc::IPPROTO_TCP, libc::TCP_MAXSEG) in mss()
1184 libc::IPPROTO_TCP, in set_mss()
1185 libc::TCP_MAXSEG, in set_mss()
1216 getsockopt::<c_int>(self.as_raw(), libc::SOL_SOCKET, libc::SO_ACCEPTCONN) in is_listener()
1244 unsafe { getsockopt::<c_int>(self.as_raw(), libc::SOL_SOCKET, libc::SO_DOMAIN).map(Domain) } in domain()
1272 getsockopt::<c_int>(self.as_raw(), libc::SOL_SOCKET, libc::SO_PROTOCOL).map(|v| match v in protocol()
1299 getsockopt::<c_int>(self.as_raw(), libc::SOL_SOCKET, libc::SO_MARK) in mark()
1326 libc::SOL_SOCKET, in set_mark()
1327 libc::SO_MARK, in set_mark()
1351 getsockopt::<Bool>(self.as_raw(), libc::IPPROTO_TCP, libc::TCP_CORK) in cork()
1377 libc::IPPROTO_TCP, in set_cork()
1378 libc::TCP_CORK, in set_cork()
1402 getsockopt::<Bool>(self.as_raw(), libc::IPPROTO_TCP, libc::TCP_QUICKACK) in quickack()
1428 libc::IPPROTO_TCP, in set_quickack()
1429 libc::TCP_QUICKACK, in set_quickack()
1455 libc::IPPROTO_TCP, in thin_linear_timeouts()
1456 libc::TCP_THIN_LINEAR_TIMEOUTS, in thin_linear_timeouts()
1482 libc::IPPROTO_TCP, in set_thin_linear_timeouts()
1483 libc::TCP_THIN_LINEAR_TIMEOUTS, in set_thin_linear_timeouts()
1505 let mut buf: [MaybeUninit<u8>; libc::IFNAMSIZ] = in device()
1507 let mut len = buf.len() as libc::socklen_t; in device()
1510 libc::SOL_SOCKET, in device()
1511 libc::SO_BINDTODEVICE, in device()
1550 libc::SOL_SOCKET, in bind_device()
1551 libc::SO_BINDTODEVICE, in bind_device()
1553 len as libc::socklen_t, in bind_device()
1566 libc::SOL_SOCKET, in set_fib()
1567 libc::SO_SETFIB, in set_fib()
1569 mem::size_of::<u32>() as libc::socklen_t, in set_fib()
1582 /// One can use `libc::if_nametoindex` to convert an interface alias to an
1588 unsafe { setsockopt(self.as_raw(), IPPROTO_IP, libc::IP_BOUND_IF, index) } in bind_device_by_index()
1600 unsafe { getsockopt::<libc::c_uint>(self.as_raw(), IPPROTO_IP, libc::IP_BOUND_IF)? }; in device_index()
1613 getsockopt::<c_int>(self.as_raw(), libc::SOL_SOCKET, libc::SO_INCOMING_CPU) in cpu_affinity()
1627 libc::SOL_SOCKET, in set_cpu_affinity()
1628 libc::SO_INCOMING_CPU, in set_cpu_affinity()
1653 getsockopt::<c_int>(self.as_raw(), libc::SOL_SOCKET, libc::SO_REUSEPORT) in reuse_port()
1679 libc::SOL_SOCKET, in set_reuse_port()
1680 libc::SO_REUSEPORT, in set_reuse_port()
1704 getsockopt::<c_int>(self.as_raw(), libc::SOL_IP, libc::IP_FREEBIND) in freebind()
1731 libc::SOL_IP, in set_freebind()
1732 libc::IP_FREEBIND, in set_freebind()
1752 getsockopt::<c_int>(self.as_raw(), libc::SOL_IPV6, libc::IPV6_FREEBIND) in freebind_ipv6()
1796 libc::SOL_IPV6, in set_freebind_ipv6()
1797 libc::IPV6_FREEBIND, in set_freebind_ipv6()
1858 offset: libc::off_t, in _sendfile()
1864 Some(n) => n.get() as libc::off_t, in _sendfile()
1883 offset: libc::off_t, in _sendfile()
1887 Some(n) => n.get() as libc::size_t, in _sendfile()
1899 offset: libc::off_t, in _sendfile()
1903 Some(n) => n.get() as libc::size_t, in _sendfile()
1907 let mut sbytes: libc::off_t = 0; in _sendfile()
1943 .map(|to| min(to.as_millis(), libc::c_uint::MAX as u128) as libc::c_uint) in set_tcp_user_timeout()
1948 libc::IPPROTO_TCP, in set_tcp_user_timeout()
1949 libc::TCP_USER_TIMEOUT, in set_tcp_user_timeout()
1973 getsockopt::<libc::c_uint>(self.as_raw(), libc::IPPROTO_TCP, libc::TCP_USER_TIMEOUT) in tcp_user_timeout()
1991 pub fn attach_filter(&self, filters: &[libc::sock_filter]) -> io::Result<()> { in attach_filter()
1992 let prog = libc::sock_fprog { in attach_filter()
2000 libc::SOL_SOCKET, in attach_filter()
2001 libc::SO_ATTACH_FILTER, in attach_filter()
2012 unsafe { setsockopt(self.as_raw(), libc::SOL_SOCKET, libc::SO_DETACH_FILTER, 0) } in detach_filter()