-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add helper to check if ftrace is enabled #94
Add helper to check if ftrace is enabled #94
Conversation
257d8d2
to
a7f1c2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just use TrimSpace and compare it? don't we also want to report the error instead of just a boolean?
I thought you had agreed already on this helper (when I saw your other PR). Whatever you both prefer I'm good, its a simple change. |
in the other pr I implemented what I suggested above - we can use return both bool and error IMO. |
@mtcherni95 and @yanivagman , I dont recall what we've agreed in last weeks discussion. Was it to be placed in libbpfgo or tracee ? I recall it could have been agreed to be added to tracee because libbpf did not have that check, but I could be wrong. |
You are right - we agreed it would have been in tracee. However, after some further thinking it is better to have it in libbpgo and tracee will use the new API of FtraceEnabled |
Agreed, changed accordingly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you mind squashing the changes into a single commit and addressing issue from my comment ? this way we can move on and merge this. thanks!
5b77145
to
e9de7e2
Compare
Signed-off-by: grantseltzer <grantseltzer@gmail.com>
e9de7e2
to
1f51ef4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM:
$ echo 0 | sudo tee /proc/sys/kernel/ftrace_enabled
0
$ go run temp.go
false <nil>
$ echo 1 | sudo tee /proc/sys/kernel/ftrace_enabled
1
$ go run temp.go
true <nil>
and simulating an error
$ go run temp.go
false could not read from ftrace_enabled file: open /proc/sys/kernel/ftrace_enabled: no such file or directory
Signed-off-by: grantseltzer grantseltzer@gmail.com