| ... | @@ -5413,10 +5413,12 @@ pub fn prctl(option: i32, args: anytype) PrctlError!u31 { | ... | @@ -5413,10 +5413,12 @@ pub fn prctl(option: i32, args: anytype) PrctlError!u31 { |
| 5413 | | 5413 | |
| 5414 | pub const GetrlimitError = UnexpectedError; | 5414 | pub const GetrlimitError = UnexpectedError; |
| 5415 | | 5415 | |
| 5416 | pub fn getrlimit(resource: rlimit_resource, limits: *rlimit) GetrlimitError!void { | 5416 | pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit { |
| 5417 | const rc = system.getrlimit(resource, limits); | 5417 | // TODO implement for systems other than linux and enable test |
| | 5418 | var limits: rlimit = undefined; |
| | 5419 | const rc = system.getrlimit(resource, &limits); |
| 5418 | switch (errno(rc)) { | 5420 | switch (errno(rc)) { |
| 5419 | 0 => return, | 5421 | 0 => return limits, |
| 5420 | EFAULT => unreachable, // bogus pointer | 5422 | EFAULT => unreachable, // bogus pointer |
| 5421 | EINVAL => unreachable, | 5423 | EINVAL => unreachable, |
| 5422 | else => |err| return std.os.unexpectedErrno(err), | 5424 | else => |err| return std.os.unexpectedErrno(err), |
| ... | @@ -5427,8 +5429,9 @@ pub const SetrlimitError = error{ | ... | @@ -5427,8 +5429,9 @@ pub const SetrlimitError = error{ |
| 5427 | PermissionDenied, | 5429 | PermissionDenied, |
| 5428 | } || UnexpectedError; | 5430 | } || UnexpectedError; |
| 5429 | | 5431 | |
| 5430 | pub fn setrlimit(resource: rlimit_resource, limits: *const rlimit) SetrlimitError!void { | 5432 | pub fn setrlimit(resource: rlimit_resource, limits: rlimit) SetrlimitError!void { |
| 5431 | const rc = system.setrlimit(resource, limits); | 5433 | // TODO implement for systems other than linux and enable test |
| | 5434 | const rc = system.setrlimit(resource, &limits); |
| 5432 | switch (errno(rc)) { | 5435 | switch (errno(rc)) { |
| 5433 | 0 => return, | 5436 | 0 => return, |
| 5434 | EFAULT => unreachable, // bogus pointer | 5437 | EFAULT => unreachable, // bogus pointer |