feature. See also
. The project being documented here (as the example) is the Zig library itself.
posix.perf_event_open
pub fn perf_event_open(
attr: *system.perf_event_attr,
pid: pid_t,
cpu: i32,
group_fd: fd_t,
flags: usize,
) PerfEventOpenError!fd_t
File
Code
pub fn perf_event_open(
attr: *system.perf_event_attr,
pid: pid_t,
cpu: i32,
group_fd: fd_t,
flags: usize,
) PerfEventOpenError!fd_t {
if (native_os == .linux) {
const rc = linux.perf_event_open(attr, pid, cpu, group_fd, flags);
switch (linux.errno(rc)) {
.SUCCESS => return @intCast(rc),
.@"2BIG" => return error.TooBig,
.ACCES => return error.PermissionDenied,
.BADF => unreachable,
.BUSY => return error.DeviceBusy,
.FAULT => unreachable,
.INVAL => unreachable,
.INTR => unreachable,
.MFILE => return error.ProcessResources,
.NODEV => return error.EventRequiresUnsupportedCpuFeature,
.NOENT => unreachable,
.NOSPC => return error.TooManyBreakpoints,
.NOSYS => return error.SampleStackNotSupported,
.OPNOTSUPP => return error.EventNotSupported,
.OVERFLOW => return error.SampleMaxStackOverflow,
.PERM => return error.PermissionDenied,
.SRCH => return error.ProcessNotFound,
else => |err| return unexpectedErrno(err),
}
}
}