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

Lower limits in setrlimit example #1536

Merged
merged 1 commit into from
Sep 28, 2021
Merged

Conversation

rtzoeller
Copy link
Collaborator

@rtzoeller rtzoeller commented Sep 19, 2021

The current values causes the doc test to fail on Fedora 34 for unprivileged users. The values can be lowered without meaningfully changing the example.

Previously the example failed with EPERM.

@rtzoeller
Copy link
Collaborator Author

Obtained the new value by building and running the following C program as a non-root user:

#include <stdio.h>
#include <sys/resource.h>

int main() {
    struct rlimit rlimit;
    int retval = getrlimit(RLIMIT_NOFILE, &rlimit);
    printf("%d\n", rlimit.rlim_cur);
    printf("%d\n", rlimit.rlim_max);
}

Results in

1024
524288

@rtzoeller
Copy link
Collaborator Author

Alternatively, this code block could be marked as no_run.

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

I think you should make the limit way smaller, like maybe 512/1024 or something. There's no reason it should be this high.

The current value causes the doc test to fail on Fedora 34 for
unprivileged users.
@rtzoeller rtzoeller changed the title Lower hard limit in setrlimit example Lower limits in setrlimit example Sep 20, 2021
@asomers
Copy link
Member

asomers commented Sep 28, 2021

I guess I forgot to order bors around earlier.

bors r+

@bors bors bot merged commit 759b34a into nix-rust:master Sep 28, 2021
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