IOPriority.h 956 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef HEADER_IOPriority
  2. #define HEADER_IOPriority
  3. /*
  4. htop - IOPriority.h
  5. (C) 2004-2012 Hisham H. Muhammad
  6. Released under the GNU GPLv2+, see the COPYING file
  7. in the source distribution for its full text.
  8. Based on ionice,
  9. Copyright (C) 2005 Jens Axboe <jens@axboe.dk>
  10. Released under the terms of the GNU General Public License version 2
  11. */
  12. enum {
  13. IOPRIO_CLASS_NONE,
  14. IOPRIO_CLASS_RT,
  15. IOPRIO_CLASS_BE,
  16. IOPRIO_CLASS_IDLE,
  17. };
  18. #define IOPRIO_WHO_PROCESS 1
  19. #define IOPRIO_CLASS_SHIFT (13)
  20. #define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
  21. #define IOPriority_class(ioprio_) ((int) ((ioprio_) >> IOPRIO_CLASS_SHIFT) )
  22. #define IOPriority_data(ioprio_) ((int) ((ioprio_) & IOPRIO_PRIO_MASK) )
  23. typedef int IOPriority;
  24. #define IOPriority_tuple(class_, data_) (((class_) << IOPRIO_CLASS_SHIFT) | (data_))
  25. #define IOPriority_None IOPriority_tuple(IOPRIO_CLASS_NONE, 0)
  26. #define IOPriority_Idle IOPriority_tuple(IOPRIO_CLASS_IDLE, 7)
  27. #endif