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

Fix type of getrlimit arg #15

Merged
merged 1 commit into from
Jul 21, 2019
Merged

Conversation

dalance
Copy link
Contributor

@dalance dalance commented Jun 7, 2019

At libc 0.2.56, the type of resource changed from c_int to __rlimit_resource_t on linux environment.
Therefore build failure occurs.

error[E0308]: mismatched types
  --> src/valgrind.rs:15:39
   |
15 |     let err = unsafe { libc::getrlimit64(resource, &mut rlim) };
   |                                          ^^^^^^^^ expected u32, found i32
help: you can convert an `i32` to `u32` and panic if the converted value wouldn't fit
   |
15 |     let err = unsafe { libc::getrlimit64(resource.try_into().unwrap(), &mut rlim) };
   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/valgrind.rs:33:23
   |
33 |     let rlim = getrlimit(libc::RLIMIT_NOFILE).unwrap();
   |                          ^^^^^^^^^^^^^^^^^^^ expected i32, found u32
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
   |
33 |     let rlim = getrlimit(libc::RLIMIT_NOFILE.try_into().unwrap()).unwrap();
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

@alecmocatta
Copy link
Owner

Thanks very much for your PRs @dalance! I'm currently away but will review, merge and publish this when I'm back next week.

alecmocatta added a commit that referenced this pull request Jul 21, 2019
@alecmocatta alecmocatta merged commit 0d4f8ab into alecmocatta:master Jul 21, 2019
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

2 participants