| ... | @@ -5369,3 +5369,55 @@ pub const PERF = struct { | ... | @@ -5369,3 +5369,55 @@ pub const PERF = struct { |
| 5369 | | 5369 | |
| 5370 | pub const IOC_FLAG_GROUP = 1; | 5370 | pub const IOC_FLAG_GROUP = 1; |
| 5371 | }; | 5371 | }; |
| | 5372 | |
| | 5373 | // TODO: Add the rest of the AUDIT defines? |
| | 5374 | pub const AUDIT = struct { |
| | 5375 | pub const ARCH = enum(u32) { |
| | 5376 | const _64BIT = 0x80000000; |
| | 5377 | const _LE = 0x40000000; |
| | 5378 | |
| | 5379 | pub const current = switch (native_arch) { |
| | 5380 | .i386 => .I386, |
| | 5381 | .x86_64 => .X86_64, |
| | 5382 | .aarch64 => .AARCH64, |
| | 5383 | .arm, .thumb => .ARM, |
| | 5384 | .riscv64 => .RISCV64, |
| | 5385 | .sparcv9 => .SPARC64, |
| | 5386 | .mips => .MIPS, |
| | 5387 | .mipsel => .MIPSEL, |
| | 5388 | .powerpc => .PPC, |
| | 5389 | .powerpc64 => .PPC64, |
| | 5390 | .powerpc64le => .PPC64LE, |
| | 5391 | else => undefined, |
| | 5392 | }; |
| | 5393 | |
| | 5394 | AARCH64 = toAudit(.aarch64), |
| | 5395 | ARM = toAudit(.arm), |
| | 5396 | ARMEB = toAudit(.armeb), |
| | 5397 | CSKY = toAudit(.csky), |
| | 5398 | HEXAGON = @enumToInt(std.elf.EM._HEXAGON), |
| | 5399 | I386 = toAudit(.i386), |
| | 5400 | M68K = toAudit(.m68k), |
| | 5401 | MIPS = toAudit(.mips), |
| | 5402 | MIPSEL = toAudit(.mips) | _LE, |
| | 5403 | MIPS64 = toAudit(.mips64), |
| | 5404 | MIPSEL64 = toAudit(.mips64) | _LE, |
| | 5405 | PPC = toAudit(.powerpc), |
| | 5406 | PPC64 = toAudit(.powerpc64), |
| | 5407 | PPC64LE = toAudit(.powerpc64le), |
| | 5408 | RISCV32 = toAudit(.riscv32), |
| | 5409 | RISCV64 = toAudit(.riscv64), |
| | 5410 | S390X = toAudit(.s390x), |
| | 5411 | SPARC = toAudit(.sparc), |
| | 5412 | SPARC64 = toAudit(.sparcv9), |
| | 5413 | X86_64 = toAudit(.x86_64), |
| | 5414 | |
| | 5415 | fn toAudit(arch: std.Target.Cpu.Arch) u32 { |
| | 5416 | var res: u32 = @enumToInt(arch.toElfMachine()); |
| | 5417 | if (arch.endian() == .Little) res |= _LE; |
| | 5418 | if (arch.ptrBitWidth() == 64) res |= _64BIT; |
| | 5419 | |
| | 5420 | return res; |
| | 5421 | } |
| | 5422 | }; |
| | 5423 | }; |