[linux] better construction of setrlimit’s first parameter - #1835
Open
glessard wants to merge 2 commits into
Open
[linux] better construction of setrlimit’s first parameter#1835glessard wants to merge 2 commits into
setrlimit’s first parameter#1835glessard wants to merge 2 commits into
Conversation
Construct the parameter using its typedef rather than 'CInt’. Glibc declares the typedef as 'int' normally, but as an enumeration under '_GNU_SOURCE’. Spelling the conversion using the typedef’s name compiles either way.
glessard
requested review from
briancroom,
grynspan,
harlanhaskins,
jerryjrchen and
stmontgomery
as code owners
August 16, 2026 00:46
Contributor
|
Please try running We should make sure a full toolchain build succeeds before you merge this PR. |
grynspan
reviewed
Aug 17, 2026
Contributor
Author
swiftlang/swift#91514 (comment) Not from an empty PR, because GitHub is having a bad day. Used a stdlib-only PR instead. |
Construct the parameter using an unnamed, unlabeled initializer. Glibc declares the typedef to be over 'int' normally, but under `_GNU_SOURCE` declares it over an enumeration. The unlabled initializer lets the compiler infer the precise type.
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.
For Linux, construct
setrlimit's first parameter using the name of its typedef rather than usingCInt.Motivation:
Glibc declares the typedef as 'int' normally, but as an enumeration under '_GNU_SOURCE’. Spelling the conversion using the typedef’s name allows this call to compile either way.
Modifications:
Substitution of a constructor name.
Checklist: