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

Implement ulimit builtin #280

Closed
jyn514 opened this issue Apr 21, 2019 · 6 comments
Closed

Implement ulimit builtin #280

jyn514 opened this issue Apr 21, 2019 · 6 comments

Comments

@jyn514
Copy link
Contributor

jyn514 commented Apr 21, 2019

Found this while investigating #279 - we don't implement ulimit. There's a man page at https://ss64.com/bash/ulimit.html, strace shows that bash is using prlimit64. Python has this in a library: https://docs.python.org/3.5/library/resource.html#resource.prlimit

$ ulimit -u
prlimit64(0, RLIMIT_NPROC, NULL, {rlim_cur=1000, rlim_max=1000}) = 0
write(1, "1000\n", 5)
$ ulimit -u 999
prlimit64(0, RLIMIT_NPROC, NULL, {rlim_cur=1000, rlim_max=1000}) = 0
prlimit64(0, RLIMIT_NPROC, {rlim_cur=999, rlim_max=999}, NULL) = 0
@andychu
Copy link
Contributor

andychu commented Apr 21, 2019

Yes good point. This would be a great contribution for someone since it's self-contained and AFAIK is a wrapper for the syscall :)

It may have side effects that aren't easily testable, but in those cases I think simply testing that it "doesn't crash" is fine first the first pass. I also sometimes add manual demos in demo/.

@andychu
Copy link
Contributor

andychu commented Jun 22, 2019

@gardenappl
Copy link

Found this during Java development: gradlew uses ulimit.

Osh prints an error, but apparently the gradlew script can handle this, so it just shows "Could not query maximum file descriptor limit" and keeps on going.

@kseistrup
Copy link

As of Oils 0.21.0 (commit cc2f683) the ulimit command is still missing:

$ osh -c 'ulimit -n 1024'
  ulimit -n 1024
  ^~~~~~
[ -c flag ]:1: 'ulimit' not found

bash scripts that attempt to use ulimit will fail.

@kseistrup
Copy link

PS: See also #1914

@andychu
Copy link
Contributor

andychu commented Jun 20, 2024

@andychu andychu closed this as completed Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants