Your IP : 18.118.142.101


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/psutil/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/psutil/__pycache__/_psaix.cpython-311.pyc

�

��bg�H��l�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddl	mZddl	mZ
ddl	mZdd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddl
mZddl
mZddl
mZddl
mZddl
mZddlmZddlmZddlmZddlmZdgZe e
d��Z!e e
d��Z"e e
d��Z#ej$��Z%ej&Z&e
j'e
j(e
j)e
j*e
j+e
j,e
j-e
j,e
j.e
j/iZ0e
j1e
j2e
j3e
j4e
j5e
j6e
j7e
j8e
j9e
j:e
j;e
j<e
j=e
j>e
j?e
j@e
jAe
jBe
jCe
jDe
jEe
jFe
jGe
jHiZIeJdddddddd �!��ZKed"d#d$g��ZLeLZMed%gd&���ZNed'gd(���ZOd)�ZPd*�ZQd+�ZRd,�ZSd-�ZTd.�ZUd/�ZVe
jWZWejXZXd<d1�ZYejZZZe"re
j[Z[d=d3�Z\d4�Z]d5�Z^d6�Z_d7�Z`d8�Zad9�ZbGd:�d;ec��ZddS)>zAIX platform implementation.�N)�
namedtuple�)�_common)�_psposix)�_psutil_aix)�
_psutil_posix)�NIC_DUPLEX_FULL)�NIC_DUPLEX_HALF)�NIC_DUPLEX_UNKNOWN)�AccessDenied)�
NoSuchProcess)�
ZombieProcess)�conn_to_ntuple)�get_procfs_path)�memoize_when_activated)�
usage_percent)�PY3)�FileNotFoundError)�PermissionError)�ProcessLookupError�PROCFS_PATH�proc_threads�net_io_counters�proc_io_counters������)�ppid�rss�vms�create_time�nice�num_threads�status�ttynr�pmemr"r#�	scputimes)�user�system�idle�iowait�svmem)�total�	available�percent�used�freec��tj��\}}}}}t||z
|d���}t|||||��S)Nr��round_)�cext�virtual_memrr/)r0�availr4�pinned�inuser2s      �`/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib64/python3.11/site-packages/psutil/_psaix.py�virtual_memoryr>jsI��(,�(8�(:�(:�%�E�5�$����U�U�]�U�1�=�=�=�G����w��t�4�4�4�c��tj��\}}}}||z
}t||d���}tj||||||��S)z=Swap system memory as a (total, used, free, sin, sout) tuple.rr6)r8�swap_memrr�sswap)r0r4�sin�soutr3r2s      r=�swap_memoryrEpsM��!�]�_�_��E�4��d��4�<�D��D�%��2�2�2�G��=���d�G�S�$�?�?�?r?c�\�tj��}td�t|�D���S)z-Return system-wide CPU times as a named tuplec�,�g|]}t|����S�)�sum��.0�xs  r=�
<listcomp>zcpu_times.<locals>.<listcomp>�s��1�1�1�!�s�1�v�v�1�1�1r?)r8�
per_cpu_timesr*�zip��rets r=�	cpu_timesrR}s.��
�
�
�
�C��1�1�s�C�y�1�1�1�2�2r?c�@�tj��}d�|D��S)z5Return system per-CPU times as a list of named tuplesc� �g|]}t|���SrH)r*rJs  r=rMz!per_cpu_times.<locals>.<listcomp>�s��'�'�'�a�I�q�M�'�'�'r?)r8rNrPs r=rNrN�s$��
�
�
�
�C�'�'�3�'�'�'�'r?c�N�	tjd��S#t$rYdSwxYw)z0Return the number of logical CPUs in the system.�SC_NPROCESSORS_ONLNN)�os�sysconf�
ValueErrorrHr?r=�cpu_count_logicalrZ�s:����z�/�0�0�0�������t�t����s��
$�$c�h�d}tj|dtjtj���}|���\}}trd�||fD��\}}|jdkrt
|�d|�����|������}t|��pdS)Nzlsdev -Cc processorT)�shell�stdout�stderrc�V�g|]&}|�tjj����'SrH��decode�sysr]�encodingrJs  r=rMz#cpu_count_cores.<locals>.<listcomp>�s9��5�5�5���(�(�3�:�#6�7�7�5�5�5r?rz command error
)
�
subprocess�Popen�PIPE�communicater�
returncode�RuntimeError�strip�
splitlines�len)�cmd�pr]r^�
processorss     r=�cpu_count_coresrp�s���
�C����D��� *��	1�	1�	1�A��]�]�_�_�N�F�F�
�5�5�5�$*�F�#3�5�5�5�����|�q����S�S�S�&�&�A�B�B�B������*�*�,�,�J��z�?�?�"�d�"r?c�`�tj��\}}}}tj||||��S)z*Return various CPU stats as a named tuple.)r8�	cpu_statsr�	scpustats)�ctx_switches�
interrupts�soft_interrupts�syscallss    r=rrrr�s6��:>�.�:J�:J�7�L�*�o�x����j�/�8�=�=�=r?Fc	���g}tj��}|D]Z}|\}}}}|dkrd}|st|��js�(dx}}	t	j||||||	��}
|�|
���[|S)zReturn system disk partitions.�none�N)r8�disk_partitions�
disk_usager0r�	sdiskpart�append)�all�retlist�
partitions�	partition�device�
mountpoint�fstype�opts�maxfile�maxpath�ntuples           r=r{r{�s����G��%�'�'�J��
�
�	�+4�(��
�F�D��V����F��	��j�)�)�/�
�� � ��'��"�6�:�v�t�#*�G�5�5�����v������Nr?���c��tj}||vr2td|�dd�d�|D���������tj|\}}t	j|��}g}|D]O}|\}}	}
}}}
}|	|vr�|
|vr�t
||	|
|||
t|dkr|nd���}|�|���P|S)z�Return socket connections.  If pid == -1 return system-wide
    connections (as opposed to connections opened by one process only).
    zinvalid z kind argument; choose between z, c�,�g|]}t|����SrH)�reprrJs  r=rMz#net_connections.<locals>.<listcomp>�s��,C�,C�,C��T�!�W�W�,C�,C�,Cr?r�N��pid)	r�	conn_tmaprY�joinr8�net_connectionsr�TCP_STATUSESr~)�kind�_pid�cmap�families�types�rawlistrQ�item�fd�fam�type_�laddr�raddrr'r��nts                r=r�r��s
����D��4����j� �D�D�$�)�)�,C�,C�d�,C�,C�,C�"D�"D�"D�F�G�G�	G��'��-�O�H�e��"�4�(�(�G�
�C�����48�1��C���u�f�c��h���������
�B��U�E�5�&�(�T�R�Z�Z�c�c�T�K�K�K���
�
�2������Jr?c���ttd�}td�t��D����}i}|D�]4}t	j|��}t	j|��}d}d}tjdd|gtj	tj	���}|�
��\}	}
trd�|	|
fD��\}	}
|jdkrNtjd	|	��}|�7t|�d����}|�d��}d
�|��}d|v}
|�|t&��}t)j|
||||��||<��6|S)z)Get NIC stats (isup, duplex, speed, mtu).)�Full�Halfc��g|]
}|d��S)rrHrJs  r=rMz net_if_stats.<locals>.<listcomp>�s��.�.�.�!��1��.�.�.r?rzrz/usr/bin/entstatz-d�r]r^c�V�g|]&}|�tjj����'SrHr`rJs  r=rMz net_if_stats.<locals>.<listcomp>��9��9�9�9�"#� �h�h�s�z�':�;�;�9�9�9r?z"Running: (\d+) Mbps.*?(\w+) DuplexNrr�,�running)r	r
�set�net_if_addrs�
cext_posix�
net_if_mtu�net_if_flagsrdrerfrgrrh�re�search�int�groupr��getrr�	snicstats)�
duplex_map�namesrQ�name�mtu�flags�duplex�speedrnr]r^�	re_result�output_flags�isups              r=�net_if_statsr��s���)�)�+�+�J��.�.�|�~�~�.�.�.�/�/�E�
�C��N�N���#�D�)�)���'��-�-��
������0�$��=�$.�O�J�O�
M�
M�
M�����������	9�9�9�(.��'7�9�9�9�N�F�F��<�1����	�5�v�?�?�I��$��I�O�O�A�.�.�/�/��"����+�+���x�x������E�!������(:�;�;���%�d�F�E�3��M�M��D�	�	��Jr?c�(�tj��S)z:The system boot time expressed in seconds since the epoch.)r8�	boot_timerHr?r=r�r�s���>���r?c��g}tj��}d}|D]A}|\}}}}}}	|s�||vrd}tj|||||	��}
|�|
���B|S)z:Return currently connected users as a list of namedtuples.)z:0.0z:0�	localhost)r8�usersr�suserr~)r�r�r�r�r+�tty�hostname�tstamp�user_processr�r�s           r=r�r�s����G��j�l�l�G��I��
�
��9=�6��c�8�V�\�3��	���y� � �"�H�
�]�4��h���
<�
<�����r������Nr?c�V�d�tjt����D��S)z7Returns a list of PIDs currently running on the system.c�T�g|]%}|����t|����&SrH)�isdigitr�rJs  r=rMzpids.<locals>.<listcomp>0s+��I�I�I�q�Q�Y�Y�[�[�I�C��F�F�I�I�Ir?)rW�listdirrrHr?r=�pidsr�.s&��I�I�B�J��'8�'8�9�9�I�I�I�Ir?c��tj�tj�t	��t|��d����S)z&Check for the existence of a unix pid.�psinfo)rW�path�existsr�r�strr�s r=�
pid_existsr�3s4��
�7�>�>�"�'�,�,��'8�'8�#�c�(�(�H�M�M�N�N�Nr?c�F��tj����fd���}|S)z�Call callable into a try/except clause and translate ENOENT,
    EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
    c�*��	�|g|�Ri|��S#ttf$rOt|j��st	|j|j���t
|j|j|j���t$rt|j|j���wxYw�N)
rrr�r�r
�_namer�_ppidrr)�self�args�kwargs�funs   �r=�wrapperz wrap_exceptions.<locals>.wrapper<s����	5��3�t�-�d�-�-�-�f�-�-�-��!�#5�6�	F�	F�	F��d�h�'�'�
F�#�D�H�d�j�9�9�9�#�D�H�d�j�$�*�E�E�E��	5�	5�	5��t�x���4�4�4�	5���s
��BB)�	functools�wraps)r�r�s` r=�wrap_exceptionsr�8s:����_�S���5�5�5�5���5��Nr?c�v�eZdZdZgd�Zd�Zd�Zd�Zee	d�����Z
ee	d�����Zed���Zed	���Z
ed
���Zed���Zed���Zed
���Zered���Zed!d���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���ZeZed���Zd�Z ed���Z!ed���Z"ed"d���Z#e$r
ed ���Z%dSdS)#�Processz1Wrapper class around underlying C implementation.)r�r�r��_procfs_path�_cachec�V�||_d|_d|_t��|_dSr�)r�r�r�rr�)r�r�s  r=�__init__zProcess.__init__Rs+�������
���
�+�-�-����r?c�n�|j�|��|j�|��dSr�)�_proc_basic_info�cache_activate�
_proc_cred�r�s r=�
oneshot_enterzProcess.oneshot_enterXs5����,�,�T�2�2�2���&�&�t�,�,�,�,�,r?c�n�|j�|��|j�|��dSr�)r��cache_deactivater�r�s r=�oneshot_exitzProcess.oneshot_exit\s5����.�.�t�4�4�4���(�(��.�.�.�.�.r?c�@�tj|j|j��Sr�)r8�proc_basic_infor�r�r�s r=r�zProcess._proc_basic_info`s���#�D�H�d�.?�@�@�@r?c�@�tj|j|j��Sr�)r8�	proc_credr�r�r�s r=r�zProcess._proc_credes���~�d�h��(9�:�:�:r?c��|jdkrdStj|j|j���d��S)Nr�swapper�)r�r8�	proc_namer��rstripr�s r=r�zProcess.namejs7���8�q�=�=��9��~�d�h��(9�:�:�A�A�&�I�I�Ir?c��|���}|sdS|d}tjj|vr�tj�|��sOtj�tj�|���|����}tj�|��r@tj�|��r!tj	|tj
��r|Stj�|��}tjd�
d��D]�}tj�tj�||����}tj�|��r#tj	|tj
��r|cS��dS)Nrzr�PATH�:)�cmdlinerWr��sep�isabs�abspathr��cwd�isfile�access�X_OK�basename�environ�split)r�r��exer��possible_exes     r=rzProcess.exeqs[���,�,�.�.���	��2��a�j��
�7�;�#����7�=�=��%�%�
E��g�o�o�b�g�l�l�4�8�8�:�:�s�&C�&C�D�D����
�
�c�"�"�
��G�N�N�3�'�'�
��I�c�2�7�+�+�
��
��'�"�"�3�'�'�C��J�v�&�,�,�S�1�1�	$�	$�D��7�?�?�2�7�<�<��c�+B�+B�C�C�L�����|�,�,�
$��I�l�B�G�4�4�
$�#�#�#�#���rr?c�4�tj|j��Sr�)r8�	proc_argsr�r�s r=r�zProcess.cmdline�s���~�d�h�'�'�'r?c�4�tj|j��Sr�)r8�proc_environr�r�s r=rzProcess.environ�s��� ���*�*�*r?c�L�|���tdS)Nr$�r��
proc_info_mapr�s r=r$zProcess.create_time�����$�$�&�&�}�]�'C�D�Dr?c�L�|���tdS)Nr&rr�s r=r&zProcess.num_threads�rr?c���tj|j��}g}|D]1\}}}tj|||��}|�|���2|s#t
j|j�d|j����|S)N�/)	r8rr�r�pthreadr~rW�statr�)r�r�r��	thread_id�utime�stimer�s       r=�threadszProcess.threads�s����'���1�1�G��G�+2�
'�
'�'�	�5�%� ���E�5�A�A�����v�&�&�&�&��
A���4�#4�#4�#4�d�h�h�?�@�@�@��Nr?�inetc�|�t||j���}|s#tj|j�d|j����|S)N)r�r)r�r�rWrr�)r�r�rQs   r=�connectionszProcess.connections�sG���d���2�2�2���	=��G�t�0�0�0�$�(�(�;�<�<�<��
r?c�4�tj|j��Sr�)r��getpriorityr�r�s r=�nice_getzProcess.nice_get�s���%�d�h�/�/�/r?c�6�tj|j|��Sr�)r��setpriorityr�)r��values  r=�nice_setzProcess.nice_set�s���%�d�h��6�6�6r?c�d�|���td|_|jS)Nr!)r�rr�r�s r=r!zProcess.ppid�s'���*�*�,�,�]�6�-B�C��
��z�r?c�d�|���\}}}}}}tj|||��Sr��r�r�puids)r��real�	effective�saved�_s     r=�uidszProcess.uids�s2��*.�/�/�*;�*;�'��i���1�a��}�T�9�e�4�4�4r?c�d�|���\}}}}}}tj|||��Sr�r')r�r,r)r*r+s     r=�gidszProcess.gids�s2��*.�/�/�*;�*;�'��1�a��y�%��}�T�9�e�4�4�4r?c�\�tj|j|j��}t	j|�Sr�)r8�proc_cpu_timesr�r�r�	pcputimes)r��ts  r=rRzProcess.cpu_times�s'������$�*;�<�<��� �!�$�$r?c���|���td}|dzdz	|dzz}tjd��D]#}tj|��j|kr|cS�$dS)Nr(l��i��z	/dev/**/*)r�r�globrWr�st_rdev)r��ttydev�devs   r=�terminalzProcess.terminal�sx���&�&�(�(��w�)?�@���/�/�B�6�6�F�?�K���9�[�)�)�	�	�C��w�s�|�|�#�v�-�-��
�
�
�.��tr?c���|j}	tj|�d|j�d���}|�d��S#t
$r"tj|�d|j����YdSwxYw)Nrz/cwdrz)r�rW�readlinkr�r�rr)r��procfs_path�results   r=rzProcess.cwd�s~���'��	��[����T�X�X�X�!F�G�G�F��=�=��%�%�%�� �	�	�	��G�{�{�{�D�H�H�5�6�6�6��2�2�	���s�3=�(A)�(A)c��|���}|tddz}|tddz}t||��S)Nr"ir#)r�rr))r�rQr"r#s    r=�memory_infozProcess.memory_info�sI���#�#�%�%���-��&�'�$�.���-��&�'�$�.���C��~�~�r?c��|���td}t�|d��S)Nr'�?)r�r�
PROC_STATUSESr�)r��codes  r=r'zProcess.status�s3���$�$�&�&�}�X�'>�?��� � ��s�+�+�+r?c	��tjddt|j��gtjtj���}|���\}}trd�||fD��\}}d|���vrt|j|j	���tjd|��}g}|D]�\}}|���}|�
d��r
|dd�}|���d	kr�Q|�tj|t#|��������|S)
Nz/usr/bin/procfilesz-nr�c�V�g|]&}|�tjj����'SrHr`rJs  r=rMz&Process.open_files.<locals>.<listcomp>r�r?zno such processz (\d+): S_IFREG.*\s*.*name:(.*)\nz//rzcannot be retrieved)rdrer�r�rfrgr�lowerr
r�r��findallrj�
startswithr~r�	popenfiler�)r�rnr]r^�	procfilesr�r�r�s        r=�
open_fileszProcess.open_files�s<��
��2�D�#�d�h�-�-�H�$.�O�J�O�
M�
M�
M�����������	9�9�9�(.��'7�9�9�9�N�F�F�������.�.����$�*�5�5�5��J�B�F�K�K�	���!�	=�	=�H�B���:�:�<�<�D����t�$�$�
 ��A�B�B�x���z�z�|�|�4�4�4���N�N�7�,�T�3�r�7�7�;�;�<�<�<�<��r?c�~�|jdkrdSttj|j�d|j�d�����S)Nrrz/fd)r�rlrWr�r�r�s r=�num_fdszProcess.num_fdss>���8�q�=�=��1��2�:�D�,=�,=�,=�t�x�x�x�H�I�I�J�J�Jr?c�L�tjtj|j���Sr�)r�pctxswr8�proc_num_ctx_switchesr�r�s r=�num_ctx_switcheszProcess.num_ctx_switchess!���~�
�
'���
1�
1�3�	3r?Nc�B�tj|j||j��Sr�)r�wait_pidr�r�)r��timeouts  r=�waitzProcess.waits��� ���7�D�J�?�?�?r?c���	tj|j��\}}}}n=#t$r0t	|j��st|j|j����wxYwtj||||��Sr�)	r8rr��OSErrorr�r
r�r�pio)r��rc�wc�rb�wbs     r=�io_counterszProcess.io_counters!s���
�!%�!6�t�x�!@�!@���B��B�B���
�
�
�"�$�(�+�+�>�'���$�*�=�=�=��
�����;�r�2�r�2�.�.�.s	�!�:A)rr�)&�__name__�
__module__�__qualname__�__doc__�	__slots__r�r�r�r�rr�r�r�rr�rr$r&�HAS_THREADSrrr r$r!r-r/rRr:rr@�memory_full_infor'rLrNrRrV�HAS_PROC_IO_COUNTERSr^rHr?r=r�r�Ms<������;�;�C�C�C�I�.�.�.�-�-�-�/�/�/���A�A����_�A���;�;����_�;��J�J��_�J�����_��4�(�(��_�(��+�+��_�+��E�E��_�E��E�E��_�E���	�	�	�
��	� �
�
�
��_�
��0�0��_�0��7�7��_�7�����_���5�5��_�5��5�5��_�5��%�%��_�%�����_������_������_��#���,�,��_�,�
���,�K�K��_�K�
�3�3��_�3��@�@�@��_�@��/�	�		/�		/�
��		/�		/�		/�/�/r?r�)F)r�)erbr�r6rWr�rdrb�collectionsrrzrrrr8rr�r	r
rrr
rrrrr�_compatrrrr�__extra__all__�hasattrrd�HAS_NET_IO_COUNTERSrf�getpagesize�	PAGE_SIZE�AF_LINK�SIDL�STATUS_IDLE�SZOMB�
STATUS_ZOMBIE�SACTIVE�STATUS_RUNNING�SSWAP�SSTOP�STATUS_STOPPEDrC�TCPS_ESTABLISHED�CONN_ESTABLISHED�
TCPS_SYN_SENT�
CONN_SYN_SENT�
TCPS_SYN_RCVD�
CONN_SYN_RECV�TCPS_FIN_WAIT_1�CONN_FIN_WAIT1�TCPS_FIN_WAIT_2�CONN_FIN_WAIT2�TCPS_TIME_WAIT�CONN_TIME_WAIT�TCPS_CLOSED�
CONN_CLOSE�TCPS_CLOSE_WAIT�CONN_CLOSE_WAIT�
TCPS_LAST_ACK�
CONN_LAST_ACK�TCPS_LISTEN�CONN_LISTEN�TCPS_CLOSING�CONN_CLOSING�PSUTIL_CONN_NONE�	CONN_NONEr��dictrr)�pfullmemr*r/r>rErRrNrZrprr�disk_io_countersr|r{r�rr�r�r�r�r�r�r��objectr�rHr?r=�<module>r�s���#�"���������	�	�	�	�	�	�	�	�����
�
�
�
�"�"�"�"�"�"�������������!�!�!�!�!�!�)�)�)�)�)�)�$�$�$�$�$�$�$�$�$�$�$�$�'�'�'�'�'�'�!�!�!�!�!�!�"�"�"�"�"�"�"�"�"�"�"�"�#�#�#�#�#�#�$�$�$�$�$�$�+�+�+�+�+�+�"�"�"�"�"�"�������&�&�&�&�&�&�$�$�$�$�$�$�'�'�'�'�'�'� ����g�d�N�+�+���g�d�$5�6�6���w�t�%7�8�8��"�J�"�$�$�	�
�
��	�I�w�"��J��%��L�'�(��J��&��J��&��
�	��7�3����-����-���'�0���'�0����/���g�(���'�1����-���g�)���w�+���7�,�
����	
�	�	��	
���
�
�
�
�
�"�z�&�5�%�.�)�)�����J�{�$H�$H�$H�I�I�	��
�7�M�M�M�N�N��5�5�5�@�@�@�3�3�3�(�(�(����#�#�#�=�=�=��(��
�
 �
�����8�&���+��*�O�����. � � �P���
���0J�J�J�
O�O�O�
���*^/�^/�^/�^/�^/�f�^/�^/�^/�^/�^/r?

?>