6 static unsigned long flag
= PERF_FLAG_FD_CLOEXEC
;
8 static int perf_flag_probe(void)
10 /* use 'safest' configuration as used in perf_evsel__fallback() */
11 struct perf_event_attr attr
= {
12 .type
= PERF_COUNT_SW_CPU_CLOCK
,
13 .config
= PERF_COUNT_SW_CPU_CLOCK
,
18 /* check cloexec flag */
19 fd
= sys_perf_event_open(&attr
, 0, -1, -1,
20 PERF_FLAG_FD_CLOEXEC
);
28 WARN_ONCE(err
!= EINVAL
,
29 "perf_event_open(..., PERF_FLAG_FD_CLOEXEC) failed with unexpected error %d (%s)\n",
32 /* not supported, confirm error related to PERF_FLAG_FD_CLOEXEC */
33 fd
= sys_perf_event_open(&attr
, 0, -1, -1, 0);
37 "perf_event_open(..., 0) failed unexpectedly with error %d (%s)\n",
46 unsigned long perf_event_open_cloexec_flag(void)
51 if (perf_flag_probe() <= 0)
This page took 0.031712 seconds and 5 git commands to generate.