Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save atr000/186217 to your computer and use it in GitHub Desktop.
Save atr000/186217 to your computer and use it in GitHub Desktop.
#Constants from sys/resources.h
#I/O type
#IOPOL_TYPE_DISK 0
#scope
#IOPOL_SCOPE_PROCESS 0
#IOPOL_SCOPE_THREAD 1
#I/O Priority
#IOPOL_DEFAULT 0
#IOPOL_NORMAL 1
#IOPOL_PASSIVE 2
#IOPOL_THROTTLE 3
#int getiopolicy_np(int iotype, int scope);
#int setiopolicy_np(int iotype, int scope, int policy);
#load libc
from ctypes import cdll
libc=cdll.LoadLibrary('libc.dylib')
print "Get IO Priority Before"
intBefore=libc.getiopolicy_np(0,1)
print intBefore
print "Set IO Priority Result"
boolSetResult=libc.setiopolicy_np(0,1,3)
print boolSetResult
print "Get IO Priority After"
intAfter=libc.getiopolicy_np(0,1)
print intAfter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment