taskstats_kern.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* taskstats_kern.h - kernel header for per-task statistics interface
  2. *
  3. * Copyright (C) Shailabh Nagar, IBM Corp. 2006
  4. * (C) Balbir Singh, IBM Corp. 2006
  5. */
  6. #ifndef _LINUX_TASKSTATS_KERN_H
  7. #define _LINUX_TASKSTATS_KERN_H
  8. #include <linux/taskstats.h>
  9. #include <linux/sched.h>
  10. enum {
  11. TASKSTATS_MSG_UNICAST, /* send data only to requester */
  12. TASKSTATS_MSG_MULTICAST, /* send data to a group */
  13. };
  14. #ifdef CONFIG_TASKSTATS
  15. extern kmem_cache_t *taskstats_cache;
  16. extern struct mutex taskstats_exit_mutex;
  17. static inline void taskstats_exit_alloc(struct taskstats **ptidstats,
  18. struct taskstats **ptgidstats)
  19. {
  20. *ptidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
  21. *ptgidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
  22. }
  23. static inline void taskstats_exit_free(struct taskstats *tidstats,
  24. struct taskstats *tgidstats)
  25. {
  26. if (tidstats)
  27. kmem_cache_free(taskstats_cache, tidstats);
  28. if (tgidstats)
  29. kmem_cache_free(taskstats_cache, tgidstats);
  30. }
  31. extern void taskstats_exit_send(struct task_struct *, struct taskstats *,
  32. struct taskstats *);
  33. extern void taskstats_init_early(void);
  34. #else
  35. static inline void taskstats_exit_alloc(struct taskstats **ptidstats,
  36. struct taskstats **ptgidstats)
  37. {}
  38. static inline void taskstats_exit_free(struct taskstats *ptidstats,
  39. struct taskstats *ptgidstats)
  40. {}
  41. static inline void taskstats_exit_send(struct task_struct *tsk,
  42. struct taskstats *tidstats,
  43. struct taskstats *tgidstats)
  44. {}
  45. static inline void taskstats_init_early(void)
  46. {}
  47. #endif /* CONFIG_TASKSTATS */
  48. #endif