Crates.io | pdfork |
lib.rs | pdfork |
version | 0.1.1 |
source | src |
created_at | 2018-06-09 23:19:05.706552 |
updated_at | 2022-10-02 00:07:44.657533 |
description | fork wrapper that uses process descriptors (pdfork) on FreeBSD and normal fork elsewhere |
homepage | https://codeberg.org/valpackett/pdfork |
repository | https://codeberg.org/valpackett/pdfork |
max_upload_size | |
id | 69406 |
size | 5,646 |
A Rust fork wrapper that uses process descriptors (pdfork) on FreeBSD and normal fork elsewhere.
Process descriptors are like file descriptors but for processes:
extern crate libc;
extern crate pdfork;
use pdfork::*;
match fork() {
ForkResult::Fail => panic!("fork"),
ForkResult::Parent(child_proc) => {
// do stuff
// you can access child_proc.child_pid on any platform
// you can also access child_proc.child_pd on FreeBSD
if !child_proc.signal(libc::SIGTERM) {
panic!("sigterm");
}
},
ForkResult::Child => {
// do stuff
}
}
By participating in this project you agree to follow the Contributor Code of Conduct.
The list of contributors is available on GitHub.
This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE
file or unlicense.org.