-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to specify signal when calling clone. #344
Conversation
@@ -197,15 +198,16 @@ pub fn sched_setaffinity(pid: isize, cpuset: &CpuSet) -> Result<()> { | |||
Errno::result(res).map(drop) | |||
} | |||
|
|||
pub fn clone(mut cb: CloneCb, stack: &mut [u8], flags: CloneFlags) -> Result<pid_t> { | |||
pub fn clone(mut cb: CloneCb, stack: &mut [u8], flags: CloneFlags, signal: Option<c_int>) -> Result<pid_t> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signal should be constrained to an 8-bit unsigned value (u8
/c_char
) at compile time given the allowable mask for signal: http://lxr.free-electrons.com/source/include/uapi/linux/sched.h#L7. Other values could clobber the other flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to let signal remain of type c_int
, the type for signals. In order to address your (valid) concern, we could add a check into our wrapper, that signals an appropriate error.
I don't have a strong opinion on this one. Allowing for the signal to be included does seem important and I don't see any obvious problems with this approach. @kamalmarhubi |
Interesting. I'd have to read the entire man page to figure out if there are any other similar issues so we don't end up changing the signature repeatedly. |
I just opened a PR with an alternative approach at #348. |
☔ The latest upstream changes (presumably #353) made this pull request unmergeable. Please resolve the merge conflicts. |
⚡ Test exempted - status |
Allow to specify signal when calling clone. This is my suggestion on how to fix #343.
This is my suggestion on how to fix #343.