docs: clarify byte units for size-based ulimits (memlock)#7115
Open
locker95 wants to merge 1 commit into
Open
Conversation
The values for size-based ulimits, such as memlock, data, and fsize, are passed to the setrlimit(2) syscall as-is, and are therefore expressed in bytes. This differs from the ulimit shell builtin, which reports several of these limits in kilobytes, which has proven to be a source of confusion (--ulimit memlock=4096 results in a 4 KiB limit, reported by "ulimit -l" as "4"). Document the units explicitly, mention that values must be plain integers without unit suffixes, and add a memlock example showing the byte value alongside the corresponding "ulimit -l" output. Signed-off-by: Dean Chen <862469039@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
Documented the units for size-based
--ulimitvalues.The values of
--ulimitoptions are passed to thesetrlimit(2)syscall as-is, so size-based limits such asmemlock,data, andfsizeare expressed in bytes. Theulimitshell builtin, however, reports several of these limits in kilobytes, so--ulimit memlock=4096produces a limit thatulimit -lreports as4. That's counter-intuitive for users expecting the same units as the shell, and it wasn't documented. Values must also be plain integers; unit suffixes such ask,m, orgaren't supported.This PR only clarifies the documentation and doesn't change any behavior. Accepting human-friendly suffixes (for example
--ulimit memlock=64m) could be a follow-up enhancement if maintainers think it's worthwhile, but that changes option parsing and deserves its own discussion.Fixes #5799
- How I did it
--ulimitsection indocs/reference/commandline/container_run.md: documented that size-based limits are in bytes (followingsetrlimit(2)semantics) and that values must be plain integers without unit suffixes, and added a note with amemlockexample showing the byte value (67108864= 64 MiB) next to the correspondingulimit -loutput (65536, in kilobytes).--ulimitentry inman/docker-run.1.mdwith the same information.- How to verify it
Documentation-only change; review the rendered Markdown. The documented behavior can be verified with:
- Human readable description for the release notes