Skip to content
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

Replace parts of ffi module by libc functions ind sched.rs #402

Merged
merged 1 commit into from
Aug 29, 2016
Merged

Replace parts of ffi module by libc functions ind sched.rs #402

merged 1 commit into from
Aug 29, 2016

Conversation

fiveop
Copy link
Contributor

@fiveop fiveop commented Aug 15, 2016

Not exporting CpuMask anymore, should be the only API change of this PR. Since the type is not used in any other exported signature or type, I think it is fine to no longer export it.

r? @kamalmarhubi @posborne

flags: c_int,
arg: *mut super::CloneCb,
...)
-> c_int;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be replaced with the libc clone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but understanding what is happning and how clone is supposed to be used, was to much for me yesterday evening, so given that it does not share any types or code with the other functions in that file, I left it for another commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah there's some fanciness going on here to allow passing a Rust closure as the function to run in the new process. There's also #360 which is concerning.

@posborne
Copy link
Member

Overall looks good. Interested to hear feedback on the comments but neither of those seem gating. Your commit message has a typo ("ind") that you might as well amend to fix.

@posborne
Copy link
Member

Test failures look legitimate (typo). Once that is fixed, looks good r=me.


// Structure representing the CPU set to apply
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CpuSet {
cpu_mask: [CpuMask; cpuset_attribs::CPU_SETSIZE/cpuset_attribs::CPU_MASK_BITS]
cpu_mask: [CpuMask; CPU_SETSIZE as usize / cpuset_attribs::CPU_MASK_BITS],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make more sense to wrap libc::cpu_set_t here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the field in cpu_set_t is private, it would complicate the set and get methods below needlessly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we use theCPU_ functions (macros), the previous comment becomes obsolete.

@kamalmarhubi
Copy link
Member

Few more comments, mostly to do with using even more libc :-)

@fiveop
Copy link
Contributor Author

fiveop commented Aug 17, 2016

Thank you for your comments. #392 is also awaiting a merge (or more comments).

@fiveop
Copy link
Contributor Author

fiveop commented Aug 20, 2016

I changed the PR based on @kamalmarhubi's comments. However, I did not use CPU_ZERO, because just mem::zeroed is nicer than mem::uninitialized + CPU_ZERO.

Maybe someone can come up with a macro, that captures the three very similar functions. I could not get around implementing it in at least two rules in order to differentiate between &self and &self mut. And two cases for three functions is not worth it.

What also should be looked at are the return values. Since we want to provide safe interfaces, I felt that such a check was necessary.

@fiveop
Copy link
Contributor Author

fiveop commented Aug 29, 2016

Given that @posborne was fine with the changes and I addressed (almost) all of @kamalmarhubi's concerns and in the intrest of getting forward with this project, I'll take @posborne's invitation:

@homu r=@posborne

How about a release in the next few weeks? @kamalmarhubi could write up how it is done in the RELEASE_PROCEDURE.md, and then I could do it in the future in regular intervals.

@homu
Copy link
Contributor

homu commented Aug 29, 2016

📌 Commit 899a130 has been approved by @posborne

homu added a commit that referenced this pull request Aug 29, 2016
Replace parts of ffi module by libc functions ind sched.rs

Not exporting `CpuMask` anymore, should be the only API change of this PR. Since the type is not used in any other exported signature or type, I think it is fine to no longer export it.

r? @kamalmarhubi @posborne
@homu
Copy link
Contributor

homu commented Aug 29, 2016

⌛ Testing commit 899a130 with merge 0703935...

@posborne
Copy link
Member

How about a release in the next few weeks? @kamalmarhubi could write up how it is done in the RELEASE_PROCEDURE.md, and then I could do it in the future in regular intervals.

Absolutely, it may make sense to push for it earlier. I saw some requests for it on nix and I think @carllerche said he was planning to cut a mio release soon.

@homu
Copy link
Contributor

homu commented Aug 29, 2016

☀️ Test successful - status

@homu homu merged commit 899a130 into nix-rust:master Aug 29, 2016
@fiveop fiveop deleted the less_ffi_sched branch October 15, 2016 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants