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

macosx libc::sysconf(84) as usize // result 18446744073709551615 #6

Closed
whispermemory opened this issue Apr 13, 2015 · 4 comments
Closed

Comments

@whispermemory
Copy link

|- 1-|
|- 2-| extern crate libc;
|- 3-| fn get_num_cpus() -> usize {
|- 4-| unsafe {
|- 5-| libc::sysconf(84) as usize
|- 6-| }
|- 7-| }
|- 8-|
|- 9-| fn main() {
|-10-| println!("{}", get_num_cpus());//18446744073709551615
|-11-| }

Darwin matoMacBook-Pro.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

@whispermemory
Copy link
Author

seanmonstar/num_cpus#2

@oh-its-jimjam
Copy link
Contributor

84 is only valid for linux and not macos; i've submitted a pull request to fix this so you can reference it as a constant as libc::_SC_NPROCESSORS_ONLN and it will ensure it's the correct value for macos

rust-lang/rust#24376

@alexcrichton
Copy link
Member

Closing in favor of rust-lang/rust#24374, but thanks for the report!

@whispermemory
Copy link
Author

THANKS

alexcrichton added a commit that referenced this issue Oct 30, 2015
dlrobertson pushed a commit to dlrobertson/libc that referenced this issue Oct 31, 2017
…ust-lang#6)

This also fixes patching, since otherwise it tried to apply the patch to
the already patched source tree.
lvllvl added a commit to lvllvl/libc that referenced this issue Jan 7, 2025
# This is the 1st commit message:

chore: add labels to FIXMEs

# This is the commit message rust-lang#2:

change label for .field FIXMEs
# This is the commit message rust-lang#3:

add fixme csv

# This is the commit message rust-lang#4:

Update fixmes.csv
# This is the commit message rust-lang#5:

Update fixmes.csv
# This is the commit message rust-lang#6:

Update fixmes.csv
# This is the commit message rust-lang#7:

Update fixmes.csv
# This is the commit message rust-lang#8:

Update fixmes.csv
# This is the commit message rust-lang#9:

Update fixmes.csv
# This is the commit message rust-lang#10:

Update fixmes.csv
# This is the commit message rust-lang#11:

Update fixmes.csv
# This is the commit message rust-lang#12:

Update fixmes.csv
# This is the commit message rust-lang#13:

Update fixmes.csv
# This is the commit message rust-lang#14:

Update fixmes.csv
# This is the commit message rust-lang#15:

Update fixmes.csv
# This is the commit message rust-lang#16:

Update fixmes.csv
# This is the commit message rust-lang#17:

Update fixmes.csv
# This is the commit message rust-lang#18:

updates to csv

# This is the commit message rust-lang#19:

Update fixmes.csv
# This is the commit message rust-lang#20:

Update fixmes.csv
# This is the commit message rust-lang#21:

Update fixmes.csv
# This is the commit message rust-lang#22:

Update fixmes.csv remove hurd"
# This is the commit message rust-lang#23:

Update fixmes.csv remove "'s
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

No branches or pull requests

3 participants