Your IP : 52.14.219.203


Current Path : /usr/lib/python3.6/site-packages/iotop/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/iotop/__pycache__/ioprio.cpython-36.opt-1.pyc

3

B��Qw�@s�ddlZddlZddlZddlZdBdCdDdEdFdGdHdIdJdKdLgZdMdNdOdPdQdRdSdTdUdVdWgZd"d#�ZGd$d%�d%e�Zee�Z	ee�Z
yejdd&d'�ZWn e
k
�r�ejd�ZYnXejZdd(d)d*gZd+Zd,Zd+e>d+Zd-d.�Zd/d0�Zd1d2�ZejZed3�\ZZZZZZejZdZd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#d<d=�Z$e%d>k�r�ddl&Z&e'e&j(�d?k�rle)e&j(d+�Z*nej+�Z*e,d@e*�e,dAe!e*��dS)X�N�alpha�*��arm*�;�i*86�"�ia64*��parisc*��powerpc*��s390*��sparc*���sh*�!�x86_64*�32bit�64bit���:������� �cCsLtj�d}tj�d}x.|D]&\}}}tj||�rtj||�r|SqWdS)N�r)�os�uname�platformZarchitecture�fnmatch)Zsyscall_listZarch�bitsZcandidate_archZcandidate_bitsZ
syscall_nr�r(�/usr/lib/python3.6/ioprio.py�find_ioprio_syscall_number9sr*c@seZdZdd�ZdS)�IoprioSetErrorcCs0ytj|�|_Wntk
r*||_YnXdS)N)r#�strerror�err�	TypeError)�selfr-r(r(r)�__init__CszIoprioSetError.__init__N)�__name__�
__module__�__qualname__r0r(r(r(r)r+Bsr+T)�	use_errnoZrtZbe�idle��
cCs:ytj|�}Wntk
r,tjd�}YnX|t>|BS)N)�PRIORITY_CLASSES�index�
ValueError�IOPRIO_CLASS_SHIFT)�ioprio_class�ioprio_datar(r(r)�ioprio_valueYs
r>cCst|t?S)N)r8r;)�ioprior(r(r)r<`sr<cCs|t@S)N)�IOPRIO_PRIO_MASK)r?r(r(r)r=csr=�cCsJt|�}tt|�}|dd}|ttfkr2d|S|tkr>dSd|SdS)N��zrt/%dr5zbe/%d)�sched_getscheduler�getpriority�PRIO_PROCESS�
SCHED_FIFO�SCHED_RR�
SCHED_IDLE)�pidZ	scheduler�niceZioprio_nicer(r(r)�get_ioprio_from_schedls
rLcCsTtdkrdSttt|�}|dkr$dSt|�}|s8t|�S|dkrD|Sd|t|�fS)Nz?sysrz?errr5z%s/%d)�__NR_ioprio_get�syscall�IOPRIO_WHO_PROCESSr<rLr=)rJr?Z
prio_classr(r(r)�getxsrPcCsftdkrtd��t||�}tt|||dd�}|dkrbytj�}Wntk
rXd}YnXt|��dS)NzNo ioprio_set syscall foundT)r4rz<Unknown error (errno support not available before Python2.6))�__NR_ioprio_setr+r>rN�ctypesZ	get_errno�AttributeError)ZwhichZwhor<r=Z
ioprio_val�retr-r(r(r)�
set_ioprio�s

rUcCst|ddkrt|d�Sd|krT|jd�r2d}n|jd�r@d}t|jd�d�}n|dkrdd}d}d|t>|S)	Nr�?r6�/zrt/zbe/r5�)�ord�
startswith�int�splitr;)�keyZshiftZprior(r(r)�sort_key�s

r^cCs6d|kr&|jd�}|dt|d�fS|dkr2dSdS)NrWrr6r5)r5r)NN)r\r[)Z
ioprio_strr\r(r(r)�to_class_and_data�s
r_�__main__rXzpid:zioprio:)rrr)rrr)rrr)r	rr
)rrr)r
rr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)rrr)r	rr)rrr)r
rr)rrr)rrr)rrr )rrr)rrr!)-rRr&r#r%ZIOPRIO_GET_ARCH_SYSCALLZIOPRIO_SET_ARCH_SYSCALLr*�	Exceptionr+rMrQZCDLLZ
ctypes_handler.rNr8rOr;r@r>r<r=rD�range�SCHED_OTHERrGrH�SCHED_BATCHZ	SCHED_ISOrIrErFrLrPrUr^r_r1�sys�len�argvr[rJ�getpid�printr(r(r(r)�<module>sr	




?>