HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib64/python3.10/site-packages/psutil/__pycache__/_psbsd.cpython-310.pyc
o

�h|�@s�dZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddl
mZdd	l
m
Zdd
l
mZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZgZer�ejejej ej!ej"ej#ej$ej%ej&ej'ej(ej)ej*ej+iZ,n=er�ejejej"ej#ej$ej%ej-ej'ej&ej'ej ej.ej/ej!iZ,ner�ejejej"ej#ej$ej%ej&ej'ej ej.ej/ej!iZ,ej0ej1ej2ej3ej4ej5ej6ej7ej8ej9ej:ej;ej<ej=ej>ej?ej@ejAejBejCejDejEejFejGiZHe�I�ZJejKZKeLed�ZMeLed�ZNeLed�ZOeLed�ZPeQd�idd�dd�dd�dd �d!d"�d#d$�d%d&�d'd(�d)d*�d+d,�d-d.�d/d0�d1d2�d3d4�d5d6�d7d8�d9d:�d;d<�d=d>�d?d@�dAdB�dCdD�dEdF�dGdH�dIdJ��ZRedKgdL��ZSedMgdN��ZTedOgdP��ZUeUZVedQgdR��ZWedSdT�ZXedUdV�ZYe�r�edWgdX��ZZnedWgdY��ZZdZd[�Z[d\d]�Z\d^d_�Z]eM�r�d`d�Z^ndad�Z^dbe^__dcdd�Z`e�s�e�r�dedf�Zandgdf�Zadhdi�Zbe�r�djdk�Zcne�r�dldk�Zcd�dmdn�ZdejeZeejfZfejgZgejhZhdodp�Zidqdr�Zje�r dsdt�Zkdudv�Zldwdx�Zmdydz�Zned{d|��Zod}d~�Zpe�r:dd��Zqne�rBd�d��ZqnejqZqd�d��Zrd�d��Zsejtd�d���ZuGd�d��d��ZvdS)�z5FreeBSD, OpenBSD and NetBSD platforms implementation.�N)�defaultdict)�
namedtuple)�ElementTree�)�_common)�_psposix)�_psutil_bsd)�
_psutil_posix)�FREEBSD)�NETBSD)�OPENBSD)�AccessDenied)�
NoSuchProcess)�
ZombieProcess)�	conn_tmap)�conn_to_ntuple)�debug)�memoize)�memoize_when_activated)�
usage_percent�
per_cpu_times�proc_num_threads�proc_open_files�proc_num_fds�ppid�status�real_uid��
effective_uid��	saved_uid��real_gid��
effective_gid��	saved_gid��ttynr��create_time�	�ctx_switches_vol�
�ctx_switches_unvol��
read_io_count��write_io_count�
�	user_time��sys_time��ch_user_time��ch_sys_time��rss��vms��memtext��memdata��memstack��cpunum��name��svmem)�total�	available�percent�used�free�active�inactive�buffers�cached�shared�wired�	scputimes��user�nice�system�idle�irq�pmem)r<r>�text�data�stack�	pcputimes)rXrZ�
children_user�children_system�
pmmap_grouped�*path rss, private, ref_count, shadow_count�	pmmap_ext�6addr, perms path rss, private, ref_count, shadow_count�sdiskio)�
read_count�write_count�
read_bytes�write_bytes�	read_time�
write_time�	busy_time)rirjrkrlcCs�t��}trP|\}}}}}}tdd��,}|D]!}|�d�r(t|��d�d}	q|�d�r7t|��d�d}
qWd�n1sBwY||}||}n|\}}}}}}}	}
|||}|||}t|||dd�}
t|||
|||||	||
|�S)Nz
/proc/meminfo�rbsBuffers:ris
MemShared:��round_)	�cext�virtual_memr�open�
startswith�int�splitrrJ)�memrKrOrPrQrUrS�f�linerRrTrN�availrM�r}�@/usr/local/CyberCP/lib/python3.10/site-packages/psutil/_psbsd.py�virtual_memory�s>

���
�rcCs4t��\}}}}}t||dd�}t�||||||�S)z@System swap memory as (total, used, free, sin, sout) namedtuple.rrq)rs�swap_memrr�sswap)rKrNrO�sin�soutrMr}r}r~�swap_memory�sr�cCs"t��\}}}}}t|||||�S)z,Return system per-CPU times as a namedtuple.)rs�	cpu_timesrVrWr}r}r~r��sr�cCs>g}t��D]}|\}}}}}t|||||�}|�|�q|S)�(Return system CPU times as a namedtuple.)rsrrV�append)�ret�cpu_trXrYrZr[r\�itemr}r}r~r�scCs2t�dkr	t�gStjrd}t|��dt_t�gS)r�r�&supported only starting from FreeBSD 8T)�cpu_count_logicalr�r�
__called__�NotImplementedError)�msgr}r}r~rs
FcC�t��S)z0Return the number of logical CPUs in the system.)rsr�r}r}r}r~r��r�cCst�dkrdSdS)Nr)r�r}r}r}r~�cpu_count_cores�r�cCs�d}t��}|dur5|�d�}|dkr5|d|d�}t�|�}zt|�d��p)d}W|��n|��w|s>t�dkr>dS|S)z-Return the number of CPU cores in the system.Nz	</groups>���r+zgroup/children/group/cpur)	rs�cpu_topology�rfindr�
fromstring�len�findall�clearr�)r��s�index�rootr}r}r~r� s


c	Cs�trt��\}}}}}nBtrAt��\}}}}}}}tdd��}|D]}|�d�r0t|��d�}q!Wd�n1s;wYn
trNt��\}}}}}}}t	�
||||�S)z*Return various CPU stats as a named tuple.z
/proc/statrpsintrrN)r
rs�	cpu_statsrrurvrwrxrr�	scpustats)	�ctxsw�intrs�
soft_intrs�syscalls�_traps�_faults�_forksrzr{r}r}r~r�;s"�
�����r�c
Cs�g}t�}t|�D]]}z	t�|�\}}Wn	tyYq	w|r\zt|�d�d�d�d�}Wn
ttfy=d}Ynwzt|�d�d�d�d�}Wn
ttfy[d}Ynw|�	t
�|||��q	|S)z�Return frequency metrics for CPUs. As of Dec 2018 only
        CPU 0 appears to be supported by FreeBSD and all other cores
        match the frequency of CPU 0.
        � r��/rN)r��rangers�cpu_freqr�rwrx�
IndexError�
ValueErrorr�r�scpufreq)r��num_cpus�cpu�current�available_freq�min_freq�max_freqr}r}r~r�]s*� � �r�cCstt���}t�|dd�gS)Ng)�floatrsr�rr�)�currr}r}r~r�wsc	Cs@g}t��}|D]}|\}}}}t�||||�}|�|�q|S)z�Return mounted disk partitions as a list of namedtuples.
    'all' argument is ignored, see:
    https://github.com/giampaolo/psutil/issues/906.
    )rs�disk_partitionsr�	sdiskpartr�)	�all�retlist�
partitions�	partition�device�
mountpoint�fstype�opts�ntupler}r}r~r��sr�c
Cs�t���}i}|D]M}zt�|�}t�|�}t�|�\}}Wnty7}z
|jtjkr-�WYd}~q	d}~wwt	t
d�rBt
�|�}d�|�}d|v}	t
�
|	||||�||<q	|S)z)Get NIC stats (isup, duplex, speed, mtu).N�	NicDuplex�,�running)�net_io_counters�keys�
cext_posix�
net_if_mtu�net_if_flags�net_if_duplex_speed�OSError�errno�ENODEV�hasattrrr��join�	snicstats)
�namesr�rH�mtu�flags�duplex�speed�err�output_flags�isupr}r}r~�net_if_stats�s*


���




�r�c
Cs�t|\}}t�}trt�d||�}ntrt�d|�}nt�||�}|D]}|\}}}}	}
}}t||||	|
|t|�}
|�|
�q$t	|�S)z System-wide network connections.r�)
r�setrrs�net_connectionsrr�TCP_STATUSES�add�list)�kind�families�typesr��rawlistr��fd�fam�type�laddr�raddrr�pid�ntr}r}r~r��s�r�cCsbz	t��\}}}Wn
tyYdSw|dk}|rtj}n|dkr&tj}n|d}t�|||�S)zReturn battery info.Nrr��<)rs�sensors_batteryr�r�POWER_TIME_UNLIMITED�POWER_TIME_UNKNOWN�sbattery)rM�minsleft�
power_plugged�secsleftr}r}r~r��s�r�c	Csttt�}t�}t|�D],}z!t�|�\}}|dkrd}d|��}|d�t�||||��Wqt	y7Yqw|S)z?Return CPU cores temperatures if available, else an empty dict.rNzCore �coretemp)
rr�r�r�rs�sensors_cpu_temperaturer�r�shwtempr�)r�r�r�r��highrHr}r}r~�sensors_temperatures�s
��r�cCr�)z:The system boot time expressed in seconds since the epoch.)rs�	boot_timer}r}r}r~r��r�r�c	Csfg}t��}|D](}|\}}}}}|dkrtsJ�d}|dkr qt�||p&d|||�}|�|�q|S)z:Return currently connected users as a list of namedtuples.r�N�~)rs�usersrr�suserr�)	r�r�r�rX�tty�hostname�tstampr�r�r}r}r~r��sr�cCs:z	td���WdStyYdStyYdSw)NrFT)�ProcessrHrr
r}r}r}r~�
_pid_0_existss��r�cCs*t��}trd|vrt�r|�dd�|S)z7Returns a list of PIDs currently running on the system.r)rs�pidsrr��insert)r�r}r}r~r�sr�cCst�|�}|s|t�vSdS)NT�r�
pid_existsr��r��existsr}r}r~r)s

rcCst�|�}|s	dS|t�vS)NFrrr}r}r~r4s

cCs:zt�|�td}t�|�tjkWStyYdSw)NrF)rs�proc_oneshot_info�kinfo_proc_map�
PROC_STATUSES�getr�
STATUS_ZOMBIEr�)r��str}r}r~�	is_zombieBs�rcst����fdd��}|S)z`Decorator which translates bare OSError exceptions into
    NoSuchProcess and AccessDenied.
    c
s�|j|j|j}}}z�|g|�Ri|��WSty4}zt|�r*t|||�|�t||�|�d}~wtyE}zt||�|�d}~wt	y`}z|dkr[dt
�vr[t||�|��d}~ww)Nr)r��_ppid�_name�ProcessLookupErrorrrr�PermissionErrorr
r�r�)�self�args�kwargsr�rrHr���funr}r~�wrapperOs"����z wrap_exceptions.<locals>.wrapper)�	functools�wraps)rrr}rr~�wrap_exceptionsJsrc
cs��|j|j|j}}}zdVWdSttfy2}zt|j�r(t|||�|�t||�|�d}~wtyC}zt	||�|�d}~ww)z8Same as above, for routines relying on reading /proc fs.N)
r�r
rr�FileNotFoundErrorrrrrr
)�instr�rHrr�r}r}r~�wrap_exceptions_procfsbs�
���rc@s�eZdZdZgd�Zdd�Zdd�Zeedd���Z	d	d
�Z
dd�Zed
d��Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zer`edd ��Zed!d"��ZeZed#d$��Zed%d&��Zed'd(��Zed)d*��ZedLd,d-��ZedMd/d0��Zed1d2��Zed3d4��Z ed5d6��Z!ed7d8��Z"ed9d:��Z#e$d;d<�Z%e$d;d=�Z&d>d?�Z'e(r�ed@dA��Z)ne'Z)e*r�edBdC��Z+ne'Z+er�edDdE��Z,edFdG��Z-edHdI��Z.edMdJdK��Z/d.Sd.S)Nr�z1Wrapper class around underlying C implementation.)�_cacher
rr�cCs||_d|_d|_dS�N)r�r
r)rr�r}r}r~�__init__ys
zProcess.__init__cCst�|j�dS)z+Raise NSP if the process disappeared on us.N)rs�	proc_namer��rr}r}r~�
_assert_alive~szProcess._assert_alivecCs$t�|j�}t|�tt�ksJ�|S)z;Retrieves multiple process info in one shot as a raw tuple.)rsrr�r�r�rr�r}r}r~�oneshot�szProcess.oneshotcC�|j�|�dSr)r#�cache_activater r}r}r~�
oneshot_enter��zProcess.oneshot_entercCr$r)r#�cache_deactivater r}r}r~�oneshot_exit�r'zProcess.oneshot_exitcCs(|��td}|dur|St�|j�S)NrH)r#rrsrr�)rrHr}r}r~rH�szProcess.namecCs�tr|jdkr	dSt�|j�Str8|jdkrdSt|��t�d|j�d��Wd�S1s1wYdSddl}|�	�}|rK|�
|d�pJdSdS)Nr�z/proc/z/exe)r
r�rs�proc_exerr�os�readlink�shutil�cmdline�which)rr.r/r}r}r~�exe�s


$�zProcess.exec
Cs�tr	|jdkr	gStrYzt�|j�WStyX}z:|jtjkrS|j|j|j	}}}t
|j�r7t|||�|�t|j�sCt
|||�|�td|�d��gWYd}~S�d}~wwt�|j�S)Nrz	ignoring z and returning an empty list)rr�rrs�proc_cmdliner�r��EINVALr
rrrrrr)rr�r�rHrr}r}r~r/�s$

��zProcess.cmdlinecC�t�|j�Sr)rs�proc_environr�r r}r}r~�environ��zProcess.environcCs8|��td}t��}z||WStyYdSw)Nr()r#rr�get_terminal_map�KeyError)r�tty_nr�tmapr}r}r~�terminal�s
�zProcess.terminalcCs|��td|_|jS)Nr)r#rrr r}r}r~r�szProcess.ppidcC�.|��}t�|td|td|td�S)Nrrr )r#r�puidsr�r�rawtupler}r}r~�uids��


�zProcess.uidscCr=)Nr"r$r&)r#r�pgidsrr?r}r}r~�gids�rBzProcess.gidscCs8|��}t�|td|td|td|td�S)Nr4r6r8r:)r#rrarr?r}r}r~r��s



�zProcess.cpu_timescC�|��tdS)NrF�r#rr r}r}r~�cpu_num��zProcess.cpu_numcCs@|��}t|td|td|td|td|td�S)Nr<r>r@rBrD)r#r]rr?r}r}r~�memory_infos




�zProcess.memory_infocCrE)Nr*rFr r}r}r~r*
rHzProcess.create_timecCstrt�|j�St|���Sr)�HAS_PROC_NUM_THREADSrsrr�r��threadsr r}r}r~�num_threadsszProcess.num_threadscCs$|��}t�|td|td�S)Nr,r.)r#r�pctxswrr?r}r}r~�num_ctx_switchess


�zProcess.num_ctx_switchescCsHt�|j�}g}|D]\}}}t�|||�}|�|�q
tr"|��|Sr)rs�proc_threadsr�r�pthreadr�rr!)rr�r��	thread_id�utime�stimer�r}r}r~rK!szProcess.threads�inetc	Cs�t|\}}g}trt�|j|�}ntrt�|j||�}nt�|j||�}|D](}|dd�\}}}	}
}}tr@||vs?|	|vr@q't|||	|
||t	�}
|�
|
�q'|��|S)Nr%)rrrsr�r�r�proc_net_connectionsr
rr�r�r!)rr�r�r�r�r�r�r�r�r�r�r�rr�r}r}r~r�-s$�zProcess.net_connectionsNcCst�|j||j�Sr)r�wait_pidr�r
)r�timeoutr}r}r~�waitFr�zProcess.waitcCr4r)r��getpriorityr�r r}r}r~�nice_getJr7zProcess.nice_getcCst�|j|�Sr)r��setpriorityr�)r�valuer}r}r~�nice_setNszProcess.nice_setcCs|��td}t�|d�S)Nr�?)r#rrr)r�coder}r}r~rRszProcess.statuscCs(|��}t�|td|tddd�S)Nr0r2r�)r#r�piorr?r}r}r~�io_countersXs

�zProcess.io_counterscCs8tr	|jdkr	dSts
trt�|j�Sttrd��d��)z)Return process current working directory.rr*r�)rr�r�HAS_PROC_OPEN_FILESrs�proc_cwdr�r
r r}r}r~�cwdbs��zProcess.cwd�mmaprergcCst�r)r�r r}r}r~�_not_implementedyszProcess._not_implementedcCst�|j�}dd�|D�S)z8Return files opened by process as a list of namedtuples.cSsg|]
\}}t�||��qSr})r�	popenfile)�.0�pathr�r}r}r~�
<listcomp>�sz&Process.open_files.<locals>.<listcomp>)rsrr�)rr�r}r}r~�
open_files�szProcess.open_filescCst�|j�}tr|��|S)z=Return the number of file descriptors opened by this process.)rsrr�rr!r"r}r}r~�num_fds�szProcess.num_fdscCr4r)rs�proc_cpu_affinity_getr�r r}r}r~�cpu_affinity_get�r7zProcess.cpu_affinity_getc
Cs�tttt����}|D]}||vrd|�d|�d�}t|��qz
t�|j|�WdStyV}z!|j	t	j
t	jhvrQ|D]}||vrPd|�d|�d�}t|�|�q<�d}~ww)Nzinvalid CPU z (choose between �))r�r�r�rr�rs�proc_cpu_affinity_setr�r�r�r3�EDEADLK)r�cpus�allcpusr�r�r�r}r}r~�cpu_affinity_set�s*���
���zProcess.cpu_affinity_setcCr4r)rs�proc_memory_mapsr�r r}r}r~�memory_maps�r7zProcess.memory_mapscCsN|durt�|j|�St|�dkrd|��}t|��|\}}t�|j|||�S)Nrz2second argument must be a (soft, hard) tuple, got )rs�proc_getrlimitr�r�r��proc_setrlimit)r�resource�limitsr��soft�hardr}r}r~�rlimit�s��zProcess.rlimit)rTr)0�__name__�
__module__�__qualname__�__doc__�	__slots__rr!rrr#r&r)rHr1r/r6r<rrArDr�r
rGrI�memory_full_infor*rLrNrKr�rXrZr]rrardr�nt_mmap_grouped�nt_mmap_extrfrbrk�HAS_PROC_NUM_FDSrlrnrtrvr}r}r}r}r~r�ts�








	










	
��


�r�r})F)wr��
contextlibr�rr,�collectionsrr�	xml.etreerr*rrrrsr	r�r
rrr
rrrrrrrr�__extra__all__�SIDL�STATUS_IDLE�SRUN�STATUS_RUNNING�SSLEEP�STATUS_SLEEPING�SSTOP�STATUS_STOPPED�SZOMBr	�SWAIT�STATUS_WAITING�SLOCK�
STATUS_LOCKEDr�SDEAD�
STATUS_WAKING�SONPROC�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��getpagesize�PAGESIZE�AF_LINKr��HAS_PER_CPU_TIMESrJrbr��dictrrJrVr]�pfullmemrardrfrhrr�r�rr�r�r�r�r�r��
disk_usage�disk_io_countersr��net_if_addrsr�r�r�r�r�r�r�r�rrr�contextmanagerrr�r}r}r}r~�<module>sl�	��
�



��������	�
���
�������������$�����
/