Close perf_event file descriptor on exec.

This commit is contained in:
Bartosz Taudul 2021-05-19 01:34:57 +02:00 committed by Bartosz Taudul
parent 9cd1b26bc7
commit 16101571e0
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -715,7 +715,7 @@ static void SetupSampling( int64_t& samplingPeriod )
for( int i=0; i<s_numCpus; i++ )
{
const int fd = perf_event_open( &pe, -1, i, -1, 0 );
const int fd = perf_event_open( &pe, -1, i, -1, PERF_FLAG_FD_CLOEXEC );
if( fd == -1 )
{
for( int j=0; j<s_numBuffers; j++ ) s_ring[j].~RingBuffer<RingBufSize>();