perf_event_open.2: Use syscall(SYS_...); for system calls without a wrapper

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2021-05-10 19:55:37 +02:00 committed by Michael Kerrisk
parent 10f4414ccb
commit e691579150
1 changed files with 11 additions and 10 deletions

View File

@ -29,16 +29,21 @@
perf_event_open \- set up performance monitoring
.SH SYNOPSIS
.nf
.B #include <linux/perf_event.h>
.B #include <linux/hw_breakpoint.h>
.BR "#include <linux/perf_event.h>" " /* Definition of " PERF_* " constants */"
.BR "#include <linux/hw_breakpoint.h>" " /* Definition of " HW_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int perf_event_open(struct perf_event_attr *" attr ,
.BI " pid_t " pid ", int " cpu ", int " group_fd ,
.BI " unsigned long " flags );
.BI "int syscall(SYS_perf_event_open, struct perf_event_attr *" attr ,
.BI " pid_t " pid ", int " cpu ", int " group_fd \
", unsigned long " flags );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR perf_event_open (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
Given a list of parameters,
.BR perf_event_open ()
@ -3641,10 +3646,6 @@ This
system call Linux-specific
and should not be used in programs intended to be portable.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
See the example below.
.PP
The official way of knowing if
.BR perf_event_open ()
support is enabled is checking