Lines Matching defs:Pid
182 pub struct Pid(pid_t);
184 impl Pid {
185 /// Creates `Pid` from raw `pid_t`.
187 Pid(pid)
208 impl From<Pid> for pid_t {
209 fn from(pid: Pid) -> Self {
214 impl fmt::Display for Pid {
228 Parent { child: Pid },
298 res => Parent { child: Pid(res) },
308 pub fn getpid() -> Pid {
309 Pid(unsafe { libc::getpid() })
318 pub fn getppid() -> Pid {
319 Pid(unsafe { libc::getppid() }) // no error handling, according to man page: "These functions are always successful."
332 pub fn setpgid(pid: Pid, pgid: Pid) -> Result<()> {
337 pub fn getpgid(pid: Option<Pid>) -> Result<Pid> {
338 let res = unsafe { libc::getpgid(pid.unwrap_or(Pid(0)).into()) };
339 Errno::result(res).map(Pid)
345 pub fn setsid() -> Result<Pid> {
346 Errno::result(unsafe { libc::setsid() }).map(Pid)
356 pub fn getsid(pid: Option<Pid>) -> Result<Pid> {
357 let res = unsafe { libc::getsid(pid.unwrap_or(Pid(0)).into()) };
358 Errno::result(res).map(Pid)
370 pub fn tcgetpgrp(fd: c_int) -> Result<Pid> {
372 Errno::result(res).map(Pid)
380 pub fn tcsetpgrp(fd: c_int, pgrp: Pid) -> Result<()> {
394 pub fn getpgrp() -> Pid {
395 Pid(unsafe { libc::getpgrp() })
410 pub fn gettid() -> Pid {
411 Pid(unsafe { libc::syscall(libc::SYS_gettid) as pid_t })