Esempio n. 1
0
 def ionice_set(self, ioclass, value):
     if ioclass in (IOPRIO_CLASS_NONE, None):
         if value:
             msg = "can't specify value with IOPRIO_CLASS_NONE"
             raise ValueError(msg)
         ioclass = IOPRIO_CLASS_NONE
         value = 0
     if ioclass in (IOPRIO_CLASS_RT, IOPRIO_CLASS_BE):
         if value is None:
             value = 4
     elif ioclass == IOPRIO_CLASS_IDLE:
         if value:
             msg = "can't specify value with IOPRIO_CLASS_IDLE"
             raise ValueError(msg)
         value = 0
     else:
         value = 0
     if not 0 <= value <= 8:
         raise ValueError(
             "value argument range expected is between 0 and 8")
     return cext.proc_ioprio_set(self.pid, ioclass, value)
Esempio n. 2
0
 def ionice_set(self, ioclass, value):
     if ioclass in (IOPRIO_CLASS_NONE, None):
         if value:
             msg = "can't specify value with IOPRIO_CLASS_NONE"
             raise ValueError(msg)
         ioclass = IOPRIO_CLASS_NONE
         value = 0
     if ioclass in (IOPRIO_CLASS_RT, IOPRIO_CLASS_BE):
         if value is None:
             value = 4
     elif ioclass == IOPRIO_CLASS_IDLE:
         if value:
             msg = "can't specify value with IOPRIO_CLASS_IDLE"
             raise ValueError(msg)
         value = 0
     else:
         value = 0
     if not 0 <= value <= 8:
         raise ValueError(
             "value argument range expected is between 0 and 8")
     return cext.proc_ioprio_set(self.pid, ioclass, value)