| author | |
| committer | |
| log | b90fb1e96b2c3edd2fb9e8884e64944692d5dd7f |
| tree | 885efcd11a58a11ce2b7fbb9a729d2d37db4d4ba |
| parent | 02252f3f078c82375857fb5642167ef0e3a72383 |
| signature |
2 files changed, 84 insertions(+), 2 deletions(-)
lib/std/os.zig+2-2| ... | @@ -5636,7 +5636,7 @@ pub const PrctlError = error{ | ... | @@ -5636,7 +5636,7 @@ pub const PrctlError = error{ |
| 5636 | PermissionDenied, | 5636 | PermissionDenied, |
| 5637 | } || UnexpectedError; | 5637 | } || UnexpectedError; |
| 5638 | 5638 | ||
| 5639 | pub fn prctl(option: i32, args: anytype) PrctlError!u31 { | 5639 | pub fn prctl(option: PR, args: anytype) PrctlError!u31 { |
| 5640 | if (@typeInfo(@TypeOf(args)) != .Struct) | 5640 | if (@typeInfo(@TypeOf(args)) != .Struct) |
| 5641 | @compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(args))); | 5641 | @compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(args))); |
| 5642 | if (args.len > 4) | 5642 | if (args.len > 4) |
| ... | @@ -5648,7 +5648,7 @@ pub fn prctl(option: i32, args: anytype) PrctlError!u31 { | ... | @@ -5648,7 +5648,7 @@ pub fn prctl(option: i32, args: anytype) PrctlError!u31 { |
| 5648 | inline while (i < args.len) : (i += 1) buf[i] = args[i]; | 5648 | inline while (i < args.len) : (i += 1) buf[i] = args[i]; |
| 5649 | } | 5649 | } |
| 5650 | 5650 | ||
| 5651 | const rc = system.prctl(option, buf[0], buf[1], buf[2], buf[3]); | 5651 | const rc = system.prctl(@enumToInt(option), buf[0], buf[1], buf[2], buf[3]); |
| 5652 | switch (errno(rc)) { | 5652 | switch (errno(rc)) { |
| 5653 | 0 => return @intCast(u31, rc), | 5653 | 0 => return @intCast(u31, rc), |
| 5654 | EACCES => return error.AccessDenied, | 5654 | EACCES => return error.AccessDenied, |
lib/std/os/bits/linux/prctl.zig+82| ... | @@ -4,6 +4,88 @@ | ... | @@ -4,6 +4,88 @@ |
| 4 | // The MIT license requires this copyright notice to be included in all copies | 4 | // The MIT license requires this copyright notice to be included in all copies |
| 5 | // and substantial portions of the software. | 5 | // and substantial portions of the software. |
| 6 | 6 | ||
| 7 | pub const PR = extern enum(i32) { | ||
| 8 | SET_PDEATHSIG = 1, | ||
| 9 | GET_PDEATHSIG = 2, | ||
| 10 | |||
| 11 | GET_DUMPABLE = 3, | ||
| 12 | SET_DUMPABLE = 4, | ||
| 13 | |||
| 14 | GET_UNALIGN = 5, | ||
| 15 | SET_UNALIGN = 6, | ||
| 16 | |||
| 17 | GET_KEEPCAPS = 7, | ||
| 18 | SET_KEEPCAPS = 8, | ||
| 19 | |||
| 20 | GET_FPEMU = 9, | ||
| 21 | SET_FPEMU = 10, | ||
| 22 | |||
| 23 | GET_FPEXC = 11, | ||
| 24 | SET_FPEXC = 12, | ||
| 25 | |||
| 26 | GET_TIMING = 13, | ||
| 27 | SET_TIMING = 14, | ||
| 28 | |||
| 29 | SET_NAME = 15, | ||
| 30 | GET_NAME = 16, | ||
| 31 | |||
| 32 | GET_ENDIAN = 19, | ||
| 33 | SET_ENDIAN = 20, | ||
| 34 | |||
| 35 | GET_SECCOMP = 21, | ||
| 36 | SET_SECCOMP = 22, | ||
| 37 | |||
| 38 | CAPBSET_READ = 23, | ||
| 39 | CAPBSET_DROP = 24, | ||
| 40 | |||
| 41 | GET_TSC = 25, | ||
| 42 | SET_TSC = 26, | ||
| 43 | |||
| 44 | GET_SECUREBITS = 27, | ||
| 45 | SET_SECUREBITS = 28, | ||
| 46 | |||
| 47 | SET_TIMERSLACK = 29, | ||
| 48 | GET_TIMERSLACK = 30, | ||
| 49 | |||
| 50 | TASK_PERF_EVENTS_DISABLE = 31, | ||
| 51 | TASK_PERF_EVENTS_ENABLE = 32, | ||
| 52 | |||
| 53 | MCE_KILL = 33, | ||
| 54 | |||
| 55 | MCE_KILL_GET = 34, | ||
| 56 | |||
| 57 | SET_MM = 35, | ||
| 58 | |||
| 59 | SET_PTRACER = 0x59616d61, | ||
| 60 | |||
| 61 | SET_CHILD_SUBREAPER = 36, | ||
| 62 | GET_CHILD_SUBREAPER = 37, | ||
| 63 | |||
| 64 | SET_NO_NEW_PRIVS = 38, | ||
| 65 | GET_NO_NEW_PRIVS = 39, | ||
| 66 | |||
| 67 | GET_TID_ADDRESS = 40, | ||
| 68 | |||
| 69 | SET_THP_DISABLE = 41, | ||
| 70 | GET_THP_DISABLE = 42, | ||
| 71 | |||
| 72 | MPX_ENABLE_MANAGEMENT = 43, | ||
| 73 | MPX_DISABLE_MANAGEMENT = 44, | ||
| 74 | |||
| 75 | SET_FP_MODE = 45, | ||
| 76 | GET_FP_MODE = 46, | ||
| 77 | |||
| 78 | CAP_AMBIENT = 47, | ||
| 79 | |||
| 80 | SVE_SET_VL = 50, | ||
| 81 | SVE_GET_VL = 51, | ||
| 82 | |||
| 83 | GET_SPECULATION_CTRL = 52, | ||
| 84 | SET_SPECULATION_CTRL = 53, | ||
| 85 | |||
| 86 | _, | ||
| 87 | }; | ||
| 88 | |||
| 7 | pub const PR_SET_PDEATHSIG = 1; | 89 | pub const PR_SET_PDEATHSIG = 1; |
| 8 | pub const PR_GET_PDEATHSIG = 2; | 90 | pub const PR_GET_PDEATHSIG = 2; |
| 9 | 91 |