• Home
  • Raw
  • Download

Lines Matching full:libc

28 use libc::c_int;
29 use libc::in6_addr;
30 use libc::in_addr;
31 use libc::recvfrom;
32 use libc::sa_family_t;
33 use libc::sockaddr;
34 use libc::sockaddr_in;
35 use libc::sockaddr_in6;
36 use libc::socklen_t;
37 use libc::AF_INET;
38 use libc::AF_INET6;
39 use libc::MSG_PEEK;
40 use libc::MSG_TRUNC;
41 use libc::SOCK_CLOEXEC;
42 use libc::SOCK_STREAM;
105 match unsafe { libc::socket(domain, sock_type, protocol) } { in socket()
119 match unsafe { libc::socketpair(domain, sock_type, protocol, fds.as_mut_ptr()) } { in socketpair()
157 .map_err(|_| io::Error::from_raw_os_error(libc::EINVAL))? in bind()
166 libc::bind( in bind()
177 libc::bind( in bind()
196 .map_err(|_| io::Error::from_raw_os_error(libc::EINVAL))? in connect()
205 libc::connect( in connect()
216 libc::connect( in connect()
235 let ret = unsafe { libc::listen(self.as_raw_descriptor(), 1) }; in listen()
259 libc::getsockname( in local_port()
288 libc::getsockname( in local_port()
318 let addr = 0 as *const libc::sockaddr_un; in sun_path_offset() constant
325 fn sockaddr_un<P: AsRef<Path>>(path: P) -> io::Result<(libc::sockaddr_un, libc::socklen_t)> { in sockaddr_un()
326 let mut addr = libc::sockaddr_un { in sockaddr_un()
327 sun_family: libc::AF_UNIX as libc::sa_family_t, in sockaddr_un()
351 *dst = *src as libc::c_char; in sockaddr_un()
361 Ok((addr, len as libc::socklen_t)) in sockaddr_un()
384 let descriptor = socket(libc::AF_UNIX, libc::SOCK_SEQPACKET, 0)?; in connect()
389 let ret = libc::connect( in connect()
405 socketpair(libc::AF_UNIX, libc::SOCK_SEQPACKET | libc::SOCK_CLOEXEC, 0) in pair()
417 let ret = unsafe { libc::ioctl(self.as_raw_descriptor(), libc::FIONREAD, &mut byte_count) }; in get_readable_bytes()
465 /// Returns error when `libc::write` failed.
469 let ret = libc::write( in send()
491 /// Returns error when `libc::read` failed.
495 let ret = libc::read( in recv()
514 /// Returns error when `libc::read` or `get_readable_bytes` failed.
529 /// Returns error when `libc::read` or `get_readable_bytes` failed.
556 fn set_timeout(&self, timeout: Option<Duration>, kind: libc::c_int) -> io::Result<()> { in set_timeout()
567 libc::timeval { in set_timeout()
568 tv_sec: t.as_secs() as libc::time_t, in set_timeout()
569 tv_usec: libc::suseconds_t::from(nsec), in set_timeout()
572 None => libc::timeval { in set_timeout()
581 libc::setsockopt( in set_timeout()
583 libc::SOL_SOCKET, in set_timeout()
585 &timeval as *const libc::timeval as *const libc::c_void, in set_timeout() constant
586 mem::size_of::<libc::timeval>() as libc::socklen_t, in set_timeout()
598 self.set_timeout(timeout, libc::SO_RCVTIMEO) in set_read_timeout()
603 self.set_timeout(timeout, libc::SO_SNDTIMEO) in set_write_timeout()
608 let mut nonblocking = nonblocking as libc::c_int; in set_nonblocking()
611 let ret = unsafe { libc::ioctl(self.as_raw_descriptor(), libc::FIONBIO, &mut nonblocking) }; in set_nonblocking()
679 let mut result_len = size_of::<c_int>() as libc::socklen_t; in bind()
681 libc::getsockopt( in bind()
683 libc::SOL_SOCKET, in bind()
684 libc::SO_ACCEPTCONN, in bind()
685 &mut result as *mut _ as *mut libc::c_void, in bind()
706 let descriptor = socket(libc::AF_UNIX, libc::SOCK_SEQPACKET, 0)?; in bind()
712 let ret = handle_eintr_errno!(libc::bind( in bind()
720 let ret = handle_eintr_errno!(libc::listen(descriptor.as_raw_descriptor(), 128)); in bind()
738 libc::accept4( in accept()
742 libc::SOCK_CLOEXEC, in accept()
760 let mut fds = libc::pollfd { in accept_with_timeout()
762 events: libc::POLLIN, in accept_with_timeout()
770 match unsafe { libc::poll(&mut fds, 1, cur_timeout_ms) }.cmp(&0) { in accept_with_timeout()
772 Ordering::Equal => return Err(io::Error::from_raw_os_error(libc::ETIMEDOUT)), in accept_with_timeout()
774 if Error::last() != Error::new(libc::EINTR) { in accept_with_timeout()
784 let mut addr = libc::sockaddr_un { in path()
785 sun_family: libc::AF_UNIX as libc::sa_family_t, in path()
796 as libc::socklen_t; in path()
797 let mut len = mem::size_of::<libc::sockaddr_un>() as libc::socklen_t; in path()
801 handle_eintr_errno!(libc::getsockname( in path()
803 &mut addr as *mut libc::sockaddr_un as *mut libc::sockaddr, in path()
810 if addr.sun_family != libc::AF_UNIX as libc::sa_family_t in path()
831 let mut nonblocking = nonblocking as libc::c_int; in set_nonblocking()
834 let ret = unsafe { libc::ioctl(self.as_raw_descriptor(), libc::FIONBIO, &mut nonblocking) }; in set_nonblocking()
910 // `'a' as libc::c_char` below to `b'a'` won't work everywhere.
917 assert_eq!(addr.sun_family, libc::AF_UNIX as libc::sa_family_t); in sockaddr_un_pass()
920 let mut ref_sun_path = [0 as libc::c_char; 108]; in sockaddr_un_pass()
922 *path = 'a' as libc::c_char; in sockaddr_un_pass()