diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-12 17:39:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-12 17:39:34 +0000 |
commit | 37e0c10f3c119b3455213ff183b637b534ad46f3 (patch) | |
tree | d4d587c08cdda9799b6bc838a7735a96b0c4cfb6 /src | |
parent | 99fc58e9bd14a30d8b5eb84b979679c13138b06c (diff) | |
parent | 9f71a4921e8a12af037e8fd80f3a2d1de663de0b (diff) | |
download | nix-37e0c10f3c119b3455213ff183b637b534ad46f3.zip |
Merge #1448
1448: Add documentation for sched::clone r=asomers a=Mandragorian
Add a note in the documentation for sched::clone to point out that the
stack pointer does not neet to be a reference to the highest address of
the stack.
Users who simply read the manpages for clone(2) might assume that they
will need to use unsafe pointer arithmetics in order to create a
reference to the highest address of their buffer, rather than providing
their buffer directly.
Co-authored-by: Konstantinos Andrikopoulos <mandragore@protonmail.com>
Co-authored-by: Alan Somers <asomers@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/sched.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sched.rs b/src/sched.rs index 576eb4aa..9dc49c61 100644 --- a/src/sched.rs +++ b/src/sched.rs @@ -176,6 +176,14 @@ mod sched_linux_like { Errno::result(res).and(Ok(cpuset)) } + /// `clone` create a child process + /// ([`clone(2)`](https://man7.org/linux/man-pages/man2/clone.2.html)) + /// + /// `stack` is a reference to an array which will hold the stack of the new + /// process. Unlike when calling `clone(2)` from C, the provided stack + /// address need not be the highest address of the region. Nix will take + /// care of that requirement. The user only needs to provide a reference to + /// a normally allocated buffer. pub fn clone( mut cb: CloneCb, stack: &mut [u8], |