Lines Matching refs:libc
103 use libc::{
109 pub type Pid = libc::pid_t;
110 pub type Uid = libc::uid_t;
111 pub type Gid = libc::gid_t;
153 let ret = unsafe { libc::getsid(pid.unwrap_or(0)) } as Pid; in getsid()
165 let ret = unsafe { libc::setsid() as Pid }; in setsid()
178 unsafe { libc::geteuid() } in geteuid()
185 unsafe { libc::getegid() } in getegid()
192 let ret = unsafe { libc::chown(path.as_ptr(), uid, gid) }; in chown()
213 FlockOperation::LockShared => libc::LOCK_SH, in flock()
214 FlockOperation::LockExclusive => libc::LOCK_EX, in flock()
215 FlockOperation::Unlock => libc::LOCK_UN, in flock()
219 operation |= libc::LOCK_NB; in flock()
223 let ret = unsafe { libc::flock(file.as_raw_fd(), operation) }; in flock()
247 let offset = if offset > libc::off64_t::max_value() as u64 { in fallocate()
248 return Err(Error::new(libc::EINVAL)); in fallocate()
250 offset as libc::off64_t in fallocate()
253 let len = if len > libc::off64_t::max_value() as u64 { in fallocate()
254 return Err(Error::new(libc::EINVAL)); in fallocate()
256 len as libc::off64_t in fallocate()
260 FallocateMode::PunchHole => libc::FALLOC_FL_PUNCH_HOLE, in fallocate()
261 FallocateMode::ZeroRange => libc::FALLOC_FL_ZERO_RANGE, in fallocate()
266 mode |= libc::FALLOC_FL_KEEP_SIZE; in fallocate()
271 let ret = unsafe { libc::fallocate64(file.as_raw_fd(), mode, offset, len) }; in fallocate()
352 let ret = unsafe { fcntl(fd, libc::F_SETPIPE_SZ, size as c_int) }; in set_pipe_size()
401 let flags = unsafe { libc::fcntl(raw_fd, libc::F_GETFD) }; in validate_raw_fd()
402 if flags < 0 || (flags & libc::FD_CLOEXEC) != 0 { in validate_raw_fd()
403 return Err(Error::new(libc::EBADF)); in validate_raw_fd()
409 let dup_fd = unsafe { libc::fcntl(raw_fd, libc::F_DUPFD_CLOEXEC, 0) }; in validate_raw_fd()
421 let mut fds = libc::pollfd { in poll_in()
423 events: libc::POLLIN, in poll_in()
427 let ret = unsafe { libc::poll(&mut fds, 1, 0) }; in poll_in()
434 fds.revents & libc::POLLIN != 0 in poll_in()
480 pub fn duration_to_timespec(duration: Duration) -> libc::timespec { in duration_to_timespec()
482 let mut ts: libc::timespec = unsafe { mem::zeroed() }; in duration_to_timespec()
484 ts.tv_sec = duration.as_secs() as libc::time_t; in duration_to_timespec()
487 ts.tv_nsec = libc::c_long::from(nsec); in duration_to_timespec()
493 Duration::new(libc::time_t::max_value() as u64, 999999999) in max_timeout()
508 add_fd_flags(tx.as_raw_fd(), libc::O_NONBLOCK).expect("Failed to set tx non blocking"); in pipe_size_and_fill()