make deadlock can run everywhere
Currently, deadlock.py open deadlock.c in relative path, which make deadlock.py only can run in the installation directory. This patch make deadlock.c opened in absolute path, then we can run deadlock.py everywhere.
Before:
➜ ~ sudo deadlock --binary /usr/lib64/libc.so.6 1102
Traceback (most recent call last):
File "/usr/share/bcc/tools/deadlock", line 573, in <module>
main()
File "/usr/share/bcc/tools/deadlock", line 481, in main
with open('deadlock.c') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'deadlock.c'
After:
➜ ~ sudo deadlock --binary /usr/lib64/libc.so.6 1102
Tracing... Hit Ctrl-C to end.
Could you have a good commit message to explain the problem you are facing and how this patch addressed your issue?
I confirm that I face the same problem on my side. I patched my BCC setup with the proposed patch and it helped me to get rid of this error.
The commit message seems explicit to me, but maybe some words could be added to highlight the problem like suggested by @yonghong-song. Can't hurt.
Thanks @mackong for proposing this fix. Hopefully it will be merged.