Advertisement
Guest User

systemtap

a guest
Apr 16th, 2020
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #!/usr/local/bin/stap -vg
  2. %{
  3. #include <linux/usb.h>
  4. #include <linux/device.h>
  5. %}
  6.  
  7. global var;
  8. %{
  9. static int get_usb_dev(struct usb_device *dev, void *p) {
  10. /* pragma:write:var*/
  11. STAP_GLOBAL_SET_var(dev);
  12. return 0;
  13. }
  14. %}
  15. function get_all_usb_dev () %{
  16. usb_for_each_dev(NULL, get_usb_dev);
  17. %}
  18.  
  19. probe begin {
  20. get_all_usb_dev();
  21. print(var);
  22. exit();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement