target.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef _PERF_TARGET_H
  2. #define _PERF_TARGET_H
  3. #include <stdbool.h>
  4. #include <sys/types.h>
  5. struct perf_target {
  6. const char *pid;
  7. const char *tid;
  8. const char *cpu_list;
  9. const char *uid_str;
  10. uid_t uid;
  11. bool system_wide;
  12. };
  13. enum perf_target_errno {
  14. PERF_ERRNO_TARGET__SUCCESS = 0,
  15. /*
  16. * Choose an arbitrary negative big number not to clash with standard
  17. * errno since SUS requires the errno has distinct positive values.
  18. * See 'Issue 6' in the link below.
  19. *
  20. * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
  21. */
  22. __PERF_ERRNO_TARGET__START = -10000,
  23. /* for perf_target__validate() */
  24. PERF_ERRNO_TARGET__PID_OVERRIDE_CPU = __PERF_ERRNO_TARGET__START,
  25. PERF_ERRNO_TARGET__PID_OVERRIDE_UID,
  26. PERF_ERRNO_TARGET__UID_OVERRIDE_CPU,
  27. PERF_ERRNO_TARGET__PID_OVERRIDE_SYSTEM,
  28. PERF_ERRNO_TARGET__UID_OVERRIDE_SYSTEM,
  29. /* for perf_target__parse_uid() */
  30. PERF_ERRNO_TARGET__INVALID_UID,
  31. PERF_ERRNO_TARGET__USER_NOT_FOUND,
  32. __PERF_ERRNO_TARGET__END,
  33. };
  34. enum perf_target_errno perf_target__validate(struct perf_target *target);
  35. enum perf_target_errno perf_target__parse_uid(struct perf_target *target);
  36. #endif /* _PERF_TARGET_H */