Your IP : 18.226.166.207


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

�

P�DgVD��t�dZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
ZddlmZ
dd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZgZe
j��Ze
jZejejej ej!ej"ej#ej$ej%ej&ej'ej(ej)ej*ej+ej,ej-ej.ej/ej0ej1ej2ej3ej4ej5iZ6ej7ej8ej9ej:ej;ej<ej=ej>ej?ej@iZAeBddddddddddd���ZCeBdddddddd���ZDedgd ���ZEed!gd"���ZFed#gd$���ZGed%eGjHd&z��ZId'�ZJd(�ZKd)�ZLd*�ZMd+�ZNd,�ZOd-�ZPd.�ZQe	jRZRejSZSd=d0�ZTd1�ZUejVZVe
jWZWd>d3�ZXd4�ZYd5�ZZd6�Z[d7�Z\e	j]Z]d8�Z^d9�Z_ej`d:���ZaGd;�d<eb��ZcdS)?zmacOS platform implementation.�N)�
namedtuple�)�_common)�_psposix)�_psutil_osx)�
_psutil_posix)�AccessDenied)�	conn_tmap)�conn_to_ntuple)�
isfile_strict)�memoize_when_activated)�
NoSuchProcess)�parse_environ_block)�
usage_percent)�
ZombieProcess)�PermissionError)�ProcessLookupError��������	�
)�ppid�ruid�euid�suid�rgid�egid�sgid�ttynr�ctime�status�name)�cpuutime�cpustime�rss�vms�pfaults�pageins�
numthreads�volctxsw�	scputimes��user�nice�system�idle�svmem)�total�	available�percent�used�free�active�inactive�wired�pmem)r*r+r,r-�pfullmem)�ussc
��tj��\}}}}}}||z}||z}||z}t||z
|d���}t||||||||��S)z&System virtual memory as a namedtuple.r��round_)�cext�virtual_memrr6)	r7r<r=r>r;�speculative�availr:r9s	         �o/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/psutil/_psosx.py�virtual_memoryrJpsx��8<�8H�8J�8J�5�E�6�8�U�D�+�

�t�O�E��E�>�D�	�K��D��U�U�]�U�1�=�=�=�G����w��d���5�*�*�*�c��tj��\}}}}}t||d���}tj||||||��S)z=Swap system memory as a (total, used, free, sin, sout) tuple.rrC)rE�swap_memrr�sswap)r7r:r;�sin�soutr9s      rI�swap_memoryrQ�sF��#'�=�?�?� �E�4��s�D��D�%��2�2�2�G��=���d�G�S�$�?�?�?rKc�V�tj��\}}}}t||||��S)z(Return system CPU times as a namedtuple.)rE�	cpu_timesr0r1s    rIrSrS�s,��#�~�/�/��D�$����T�4���.�.�.rKc��g}tj��D]0}|\}}}}t||||��}|�|���1|S)z(Return system CPU times as a named tuple)rE�
per_cpu_timesr0�append)�ret�cpu_tr2r3r4r5�items       rIrUrU�sZ��
�C��#�%�%����#(� ��d�F�D���t�V�T�2�2���
�
�4������JrKc�(�tj��S)z0Return the number of logical CPUs in the system.)rE�cpu_count_logical�rKrIr[r[�s���!�#�#�#rKc�(�tj��S)z1Return the number of physical CPUs in the system.)rE�cpu_count_physr\rKrI�cpu_count_physicalr_�s���� � � rKc�b�tj��\}}}}}tj||||��S�N)rE�	cpu_statsr�	scpustats)�ctx_switches�
interrupts�soft_interrupts�syscalls�trapss     rIrbrb�s:������?�L�*�o�x�����j�/�8�=�=�=rKc�^�tj��\}}}tj|||��gS)z�Return CPU frequency.
    On macOS per-cpu frequency is not supported.
    Also, the returned frequency never changes, see:
    https://arstechnica.com/civis/viewtopic.php?f=19&t=465002
    )rE�cpu_freqr�scpufreq)�curr�min_�max_s   rIrjrj�s.���}����D�$����T�4��.�.�/�/rKFc	�>�g}tj��}|D]�}|\}}}}|dkrd}|s?tj�|��rtj�|��s�Rdx}}	t
j||||||	��}
|�|
����|S)z8Return mounted disk partitions as a list of namedtuples.�none�N)	rE�disk_partitions�os�path�isabs�existsr�	sdiskpartrV)�all�retlist�
partitions�	partition�device�
mountpoint�fstype�opts�maxfile�maxpath�ntuples           rIrrrr�s����G��%�'�'�J��
�
�	�+4�(��
�F�D��V����F��	��7�=�=��(�(�
�����v�0F�0F�
�� � ��'��"�6�:�v�t�#*�G�5�5�����v������NrKc���	tj��\}}}n#t$rYdSwxYw|dk}|r
tj}n|dkr
tj}n|dz}tj|||��S)zReturn battery information.Nr����<)rE�sensors_battery�NotImplementedErrorr�POWER_TIME_UNLIMITED�POWER_TIME_UNKNOWN�sbattery)r9�minsleft�
power_plugged�secslefts    rIr�r��s����+/�+?�+A�+A�(���=�=�������t�t�����"�Q�&�M��!��/���	�R����-����b�=����G�X�}�=�=�=s��
(�(�inetc��g}t��D]p}	t|���|��}|r9|D]6}t|��|gz}|�tj|����7�a#t$rY�mwxYw|S)z System-wide network connections.)�pids�Process�connections�listrVr�sconnr)�kindrW�pid�cons�cs     rI�net_connectionsr��s���
�C��v�v�	2�	2��	2��3�<�<�+�+�D�1�1�D��
2��2�2�A��Q���3�%��A��J�J�w�}�a�0�1�1�1�1���
�	�	�	��H�	�����Js�"A2�2
A?�>A?c��t�����}i}|D]�}	tj|��}tj|��}tj|��\}}t
td��rtj|��}tj	||||��||<��#t$r }|jtjkr�Yd}~��d}~wwxYw|S)z)Get NIC stats (isup, duplex, speed, mtu).�	NicDuplexN)
�net_io_counters�keys�
cext_posix�
net_if_mtu�net_if_is_running�net_if_duplex_speed�hasattrrr��	snicstats�OSError�errno�ENODEV)�namesrWr'�mtu�isup�duplex�speed�errs        rI�net_if_statsr�s������"�"�$�$�E�
�C��D�D��	D��'��-�-�C��/��5�5�D�&�:�4�@�@�M�F�E��w��,�,�
3� �*�6�2�2���)�$���s�C�C�C��I�I���	�	�	��y�E�L�(�(��)�(�(�(�(�����	�����Js�?B+�+
C�5C�Cc�(�tj��S)z:The system boot time expressed in seconds since the epoch.)rE�	boot_timer\rKrIr�r�s���>���rKc��g}tj��}|D]E}|\}}}}}|dkr�|s�tj||pd|pd||��}|�|���F|S)z:Return currently connected users as a list of namedtuples.�~N)rE�usersr�suserrV)	ry�rawlistrYr2�tty�hostname�tstampr��nts	         rIr�r�"s����G��j�l�l�G�����+/�(��c�8�V�S��#�:�:���	��
�]�4����h�.>�$���
L�
L�����r������NrKc��tj��}d|vrj	td�����|�dd��n1#t
$rYn%t$r|�dd��YnwxYw|S�Nr)rEr�r��create_time�insertrr	)�lss rIr�r�6s���	
����B���{�{�	��A�J�J�"�"�$�$�$��I�I�a��O�O�O�O���	�	�	��D��	�	�	��I�I�a��O�O�O�O�O�	����
�Is�7A�
A?�A?�>A?c��	tj|��td}|tjkS#t$rYdSwxYw)Nr&F)rE�proc_kinfo_oneshot�kinfo_proc_map�SZOMB�	Exception)r��sts  rI�	is_zombier�IsP���
�
$�S�
)�
)�.��*B�
C���T�Z���������u�u����s�47�
A�Ac�F��tj����fd���}|S)z`Decorator which translates bare OSError exceptions into
    NoSuchProcess and AccessDenied.
    c�x��	�|g|�Ri|��S#t$rOt|j��r t|j|j|j���t
|j|j���t$rt|j|j���tj
$r!t|j|j|j���wxYwra)rr�r�r�_name�_ppidrrr	rE�ZombieProcessError)�self�args�kwargs�funs   �rI�wrapperz wrap_exceptions.<locals>.wrapperUs����
	B��3�t�-�d�-�-�-�f�-�-�-��!�	:�	:�	:����"�"�
:�#�D�H�d�j�$�*�E�E�E�#�D�H�d�j�9�9�9��	5�	5�	5��t�x���4�4�4��&�	B�	B�	B����$�*�d�j�A�A�A�	B���s
��B*B9)�	functools�wraps)r�r�s` rI�wrap_exceptionsr�Qs?����_�S���B�B�B�B���B��NrKc#�zK�	dV�dS#ttf$r�}t|t��s|jtjkro	|���}|tjkr t|j	|j
|j���t|j	|j
���#t$r|�wxYw�d}~wwxYw)z�There are some poor C APIs which incorrectly raise ESRCH when
    the process is still alive or it's a zombie, or even RuntimeError
    (those who don't set errno). This is here in order to solve:
    https://github.com/giampaolo/psutil/issues/1044
    N)r��RuntimeError�
isinstancer��ESRCHr&r�
STATUS_ZOMBIErr�r�r�r	r)�procr�r&s   rI�catch_zombier�es������
��������\�"�����c�<�(�(�
	�C�I���,D�,D�

=��������W�2�2�2�'���$�*�d�j�I�I�I�&�t�x���<�<�<��
!�
�
�
��	�
����
��������s-�
�B:�*B5�B$�A
B5�$
B1�1B5�5B:c�v�eZdZdZgd�Zd�Zeed�����Zeed�����Z	d�Z
d�Zed���Zed	���Z
ed
���Zed���Zed���Zed
���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed!d���Zed���Zed"d���Zed���Zed���Z ed���Z!ed ���Z"dS)#r�z1Wrapper class around underlying C implementation.)r�r�r��_cachec�0�||_d|_d|_dSra)r�r�r�)r�r�s  rI�__init__zProcess.__init__�s�������
���
�
�
rKc��tj|j��}t|��tt��ksJ�|Sra)rEr�r��lenr��r�rWs  rI�_get_kinfo_proczProcess._get_kinfo_proc�s:���%�d�h�/�/���3�x�x�3�~�.�.�.�.�.�.��
rKc���t|��5tj|j��}ddd��n#1swxYwYt	|��t	t
��ksJ�|Sra)r�rE�proc_pidtaskinfo_oneshotr�r��pidtaskinfo_mapr�s  rI�_get_pidtaskinfozProcess._get_pidtaskinfo�s����$�
�
�	:�	:��/���9�9�C�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:��3�x�x�3��/�/�/�/�/�/��
s�6�:�:c�n�|j�|��|j�|��dSra)r��cache_activater��r�s rI�
oneshot_enterzProcess.oneshot_enter�s6����+�+�D�1�1�1���,�,�T�2�2�2�2�2rKc�n�|j�|��|j�|��dSra)r��cache_deactivater�r�s rI�oneshot_exitzProcess.oneshot_exit�s6����-�-�d�3�3�3���.�.�t�4�4�4�4�4rKc��|���td}|�|ntj|j��S)Nr')r�r�rE�	proc_namer�)r�r's  rIr'zProcess.name�s8���#�#�%�%�n�V�&<�=���'�t�t�T�^�D�H�-E�-E�ErKc��t|��5tj|j��cddd��S#1swxYwYdSra)r�rE�proc_exer�r�s rI�exezProcess.exe����
�$�
�
�	+�	+��=���*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+��6�:�:c��t|��5tj|j��cddd��S#1swxYwYdSra)r�rE�proc_cmdliner�r�s rI�cmdlinezProcess.cmdline�s���
�$�
�
�	/�	/��$�T�X�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/r�c��t|��5ttj|j����cddd��S#1swxYwYdSra)r�rrE�proc_environr�r�s rI�environzProcess.environ�s���
�$�
�
�	D�	D�&�t�'8���'B�'B�C�C�	D�	D�	D�	D�	D�	D�	D�	D�	D�	D�	D�	D����	D�	D�	D�	D�	D�	Ds�&A�A�
Ac�d�|���td|_|jS)Nr)r�r�r�r�s rIrzProcess.ppid�s'���)�)�+�+�N�6�,B�C��
��z�rKc��t|��5tj|j��cddd��S#1swxYwYdSra)r�rE�proc_cwdr�r�s rI�cwdzProcess.cwd�r�r�c��|���}tj|td|td|td��S)Nrrr �r�r�puidsr��r��rawtuples  rI�uidszProcess.uids��N���'�'�)�)���}��^�F�+�,��^�F�+�,��^�F�+�,�.�.�	.rKc��|���}tj|td|td|td��S)Nr!r"r#r�rs  rI�gidszProcess.gids�rrKc��|���td}tj��}	||S#t$rYdSwxYw)Nr$)r�r�r�get_terminal_map�KeyError)r��tty_nr�tmaps   rI�terminalzProcess.terminal�s\���%�%�'�'��w�(?�@���(�*�*��	���<����	�	�	��4�4�	���s�A�
A�Ac���|���}t|td|td|td|td��S)Nr*r+r,r-)r�r?r�rs  rI�memory_infozProcess.memory_info�sY���(�(�*�*����_�U�+�,��_�U�+�,��_�Y�/�0��_�Y�/�0�	
�
�	
rKc�v�|���}tj|j��}t	||fz�Sra)r
rE�proc_memory_ussr�r@)r��	basic_memrAs   rI�memory_full_infozProcess.memory_full_info�s7���$�$�&�&�	��"�4�8�,�,����c�W�,�-�-rKc��|���}tj|td|tddd��S)Nr(r)g)r�r�	pcputimesr�rs  rIrSzProcess.cpu_times�sG���(�(�*�*��� ��_�Z�0�1��_�Z�0�1���	��	rKc�L�|���tdS)Nr%)r�r�r�s rIr�zProcess.create_time�s���#�#�%�%�n�W�&=�>�>rKc�v�|���td}tj|d��S)Nr/r)r�r�r�pctxsw)r��vols  rI�num_ctx_switcheszProcess.num_ctx_switches�s1��
�#�#�%�%�o�j�&A�B���~�c�1�%�%�%rKc�L�|���tdS)Nr.)r�r�r�s rI�num_threadszProcess.num_threads�s���$�$�&�&��|�'D�E�ErKc�&�|jdkrgSg}t|��5tj|j��}ddd��n#1swxYwY|D]>\}}t	|��r*tj||��}|�|���?|Sr�)r�r�rE�proc_open_filesrr�	popenfilerV)r��filesr�rt�fdr�s      rI�
open_fileszProcess.open_filess����8�q�=�=��I���
�$�
�
�	5�	5��*�4�8�4�4�G�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5��	%�	%�H�D�"��T�"�"�
%� �*�4��4�4�����V�$�$�$���s�A�A	�A	r�c
��|tvr7td|�dd�d�tD���������t|\}}t|��5t	j|j||��}ddd��n#1swxYwYg}|D]:}|\}}}	}
}}t|||	|
||t��}
|�	|
���;|S)Nzinvalid z kind argument; choose between z, c�,�g|]}t|����Sr\)�repr)�.0�xs  rI�
<listcomp>z'Process.connections.<locals>.<listcomp>s��0L�0L�0L�Q��a���0L�0L�0LrK)
r
�
ValueError�joinr�rE�proc_connectionsr�r�TCP_STATUSESrV)r�r��families�typesr�rWrYr�fam�type�laddr�raddrr&r�s              rIr�zProcess.connectionssB���y� � ��*� $���d�i�i�0L�0L�)�0L�0L�0L�&M�&M�&M�O�P�P�
P�#�D�/���%�
�$�
�
�	G�	G��+�D�H�h��F�F�G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G����	G�	G�	G�	G����	�	�D�26�/�B��T�5�%����C��u�e�V� ,�.�.�B��J�J�r�N�N�N�N��
s� B�B�Bc��|jdkrdSt|��5tj|j��cddd��S#1swxYwYdSr�)r�r�rE�proc_num_fdsr�s rI�num_fdszProcess.num_fdss����8�q�=�=��1�
�$�
�
�	/�	/��$�T�X�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/s�A�A�
ANc�B�tj|j||j��Sra)r�wait_pidr�r�)r��timeouts  rI�waitzProcess.wait&s��� ���7�D�J�?�?�?rKc��t|��5tj|j��cddd��S#1swxYwYdSra)r�r��getpriorityr�r�s rI�nice_getzProcess.nice_get*s���
�$�
�
�	4�	4��)�$�(�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�	4�	4r�c��t|��5tj|j|��cddd��S#1swxYwYdSra)r�r��setpriorityr�)r��values  rI�nice_setzProcess.nice_set/s���
�$�
�
�	;�	;��)�$�(�E�:�:�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�	;�	;s�7�;�;c��|���td}t�|d��S)Nr&�?)r�r��
PROC_STATUSES�get)r��codes  rIr&zProcess.status4s3���#�#�%�%�n�X�&>�?��� � ��s�+�+�+rKc��tj|j��}g}|D]1\}}}tj|||��}|�|���2|Sra)rE�proc_threadsr�r�pthreadrV)r�r�ry�	thread_id�utime�stimer�s       rI�threadszProcess.threads:s\���#�D�H�-�-����'.�	#�	#�#�I�u�e��_�Y��u�=�=�F��N�N�6�"�"�"�"��rK�r�ra)#�__name__�
__module__�__qualname__�__doc__�	__slots__r�r�r
r�r�r�r�r'r�r�r�rr�rrrr
rrSr�rrr r�r3r7r:r>r&rJr\rKrIr�r�s"������;�;�3�3�3�I����
�������_���������_��3�3�3�5�5�5��F�F��_�F��+�+��_�+��/�/��_�/��D�D��_�D�����_���+�+��_�+��.�.��_�.��.�.��_�.�����_���
�
��_�
��.�.��_�.�
����_���?�?��_�?��&�&��_�&��F�F��_�F��
�
��_�
��
�
�
��_�
��/�/��_�/��@�@�@��_�@��4�4��_�4��;�;��_�;��,�,��_�,�
����_���rKr�)FrK)drO�
contextlibr�r�rs�collectionsrrqrrrrErr�r	r
rrr
rrrr�_compatrr�__extra__all__�getpagesize�PAGESIZE�AF_LINK�TCPS_ESTABLISHED�CONN_ESTABLISHED�
TCPS_SYN_SENT�
CONN_SYN_SENT�TCPS_SYN_RECEIVED�
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*�SIDL�STATUS_IDLE�SRUN�STATUS_RUNNING�SSLEEP�STATUS_SLEEPING�SSTOP�STATUS_STOPPEDr�r�rA�dictr�r�r0r6r?�_fieldsr@rJrQrSrUr[r_rbrj�
disk_usage�disk_io_countersrrr�r��net_if_addrsr�r�r�r�r��
pid_existsr�r��contextmanagerr��objectr�r\rKrI�<module>r�s���
%�$�������������	�	�	�	�"�"�"�"�"�"�������������!�!�!�!�!�!�)�)�)�)�)�)�!�!�!�!�!�!�������#�#�#�#�#�#�"�"�"�"�"�"�+�+�+�+�+�+�"�"�"�"�"�"�(�(�(�(�(�(�"�"�"�"�"�"�"�"�"�"�"�"�$�$�$�$�$�$�'�'�'�'�'�'���"�:�!�#�#��
�
��	��7�3����-���G�1���'�0���'�0����/���g�(���'�1����-���g�)���w�+���7�,�
�� 	�I�w�"��I�w�%��K��(��J��&��J��%��
���	
�	
�	
�	
�	
�	
�	
�
�
��	������$�
�
�	�	�
�
��
�	�	�	��$
�J�{�$F�$F�$F�G�G�	��
��-�-�-�	.�	.���z�&�>�>�>�?�?���:�j�$�,��":�;�;��*�*�*�"@�@�@�/�/�/����$�$�$�
!�!�!�
=�=�=�0�0�0��
 �
��(������.>�>�>�,�&���&������$���2���
���(
�
�
� �
 �
�������(�������2B�B�B�B�B�f�B�B�B�B�BrK

?>