nh2 / nh2/haskell-cpu-instruction-counter

Use PERF_FLAG_FD_CLOEXEC

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
Haskell
Stars
83
Forks
5
PR merge metrics
No merged PRs in 30d

Description

as per [man page](http://man7.org/linux/man-pages/man2/perf_event_open.2.html):

```
PERF_FLAG_FD_CLOEXEC (since Linux 3.14)
This flag enables the close-on-exec flag for the created event
file descriptor, so that the file descriptor is automatically
closed on execve(2). Setting the close-on-exec flags at
creation time, rather than later with fcntl(2), avoids
potential race conditions where the calling thread invokes
perf_event_open() and fcntl(2) at the same time as another
thread calls fork(2) then execve(2).
```

We want that.

It will make it less possible to have weird random behaviour if the tested code forks a subprocess.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.