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__/_psaix.cpython-310.pyc
o

�hLG�@s�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddl	mZddl	mZ
ddl	mZdd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddl
mZddl
mZddl
mZddl
mZddl
mZdgZee
d�Zee
d�Zee
d�Ze��Z ej!Z!e
j"e
j#e
j$e
j%e
j&e
j'e
j(e
j'e
j)e
j*iZ+e
j,e
j-e
j.e
j/e
j0e
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
jCiZDeEddddddddd�ZFeddd g�ZGeGZHed!gd"��ZIed#gd$��ZJd%d&�ZKd'd(�ZLd)d*�ZMd+d,�ZNd-d.�ZOd/d0�ZPd1d2�ZQe
jRZRejSZSdGd4d5�ZTejUZUe�r(e
jVZVdHd7d8�ZWd9d:�ZXd;d<�ZYd=d>�ZZd?d@�Z[dAdB�Z\dCdD�Z]GdEdF�dF�Z^dS)IzAIX 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�PROCFS_PATH�proc_threads�net_io_counters�proc_io_counters������)�ppid�rss�vms�create_time�nice�num_threads�status�ttynr�pmemrr�	scputimes)�user�system�idle�iowait�svmem)�total�	available�percent�used�freecCs4t��\}}}}}t|||dd�}t|||||�S)Nr��round_)�cext�virtual_memrr*)r+�availr/�_pinned�inuser-�r7�@/usr/local/CyberCP/lib/python3.10/site-packages/psutil/_psaix.py�virtual_memorygsr9cCs:t��\}}}}||}t||dd�}t�||||||�S)z=Swap system memory as a (total, used, free, sin, sout) tuple.rr0)r2�swap_memrr�sswap)r+r/�sin�soutr.r-r7r7r8�swap_memorymsr>cCst��}tdd�t|�D��S)z.Return system-wide CPU times as a named tuple.cSsg|]}t|��qSr7)�sum��.0�xr7r7r8�
<listcomp>}�zcpu_times.<locals>.<listcomp>)r2�
per_cpu_timesr%�zip��retr7r7r8�	cpu_timeszsrIcCst��}dd�|D�S)z6Return system per-CPU times as a list of named tuples.cSsg|]}t|��qSr7)r%r@r7r7r8rC�rDz!per_cpu_times.<locals>.<listcomp>)r2rErGr7r7r8rE�srEcCs"zt�d�WStyYdSw)z0Return the number of logical CPUs in the system.�SC_NPROCESSORS_ONLNN)�os�sysconf�
ValueErrorr7r7r7r8�cpu_count_logical�s
�rNcCsvgd�}tj|tjtjd�}|��\}}dd�||fD�\}}|jdkr/|�d|��}t|��|����}t|�p:dS)N)�lsdevz-Cc�	processor��stdout�stderrcs��|]
}|�tjj�VqdS�N��decode�sysrR�encodingr@r7r7r8�	<genexpr>�s�z"cpu_count_cores.<locals>.<genexpr>rz command error
)	�
subprocess�Popen�PIPE�communicate�
returncode�RuntimeError�strip�
splitlines�len)�cmd�prRrS�msg�
processorsr7r7r8�cpu_count_cores�s
rhcCs t��\}}}}t�||||�S)z*Return various CPU stats as a named tuple.)r2�	cpu_statsr�	scpustats)�ctx_switches�
interrupts�soft_interrupts�syscallsr7r7r8ri�s�riFc	Cs\g}t��}|D]#}|\}}}}|dkrd}|st|�jsqt�||||�}|�|�q|S)zReturn system disk partitions.�none�)r2�disk_partitions�
disk_usager+r�	sdiskpart�append)	�all�retlist�
partitions�	partition�device�
mountpoint�fstype�opts�ntupler7r7r8rq�s
rq���cCs~tj|\}}t�|�}g}|D],}|\}}}	}
}}}
||vr q|	|vr%qt|||	|
||t|dkr3|
ndd�}|�|�q|S)z�Return socket connections.  If pid == -1 return system-wide
    connections (as opposed to connections opened by one process only).
    r~N��pid)r�	conn_tmapr2�net_connectionsr�TCP_STATUSESrt)�kind�_pid�families�types�rawlistrH�item�fd�fam�type_�laddr�raddrr"r��ntr7r7r8r��s*
�
r�cCs�ttd�}dd�t�D�}i}|D]c}t�|�}t�|�}d}d}tjdd|gtjtjd�}|�	�\}	}
d	d
�|	|
fD�\}	}
|j
dkrZt�d|	�}|durZt
|�d
��}|�d�}d�|�}d|v}
|�|t�}t�|
||||�||<q|S)z)Get NIC stats (isup, duplex, speed, mtu).)�Full�HalfcSsh|]}|d�qS)rr7r@r7r7r8�	<setcomp>�rDznet_if_stats.<locals>.<setcomp>rprz/usr/bin/entstatz-drQcsrTrUrVr@r7r7r8rZ���
�znet_if_stats.<locals>.<genexpr>z"Running: (\d+) Mbps.*?(\w+) DuplexNrr�,�running)rr	�net_if_addrs�
cext_posix�
net_if_mtu�net_if_flagsr[r\r]r^r_�re�search�int�group�join�getr
r�	snicstats)�
duplex_map�namesrH�name�mtu�flags�duplex�speedrerRrS�	re_result�output_flags�isupr7r7r8�net_if_stats�s:


�
�
�

r�cCst��S)z:The system boot time expressed in seconds since the epoch.)r2�	boot_timer7r7r7r8r�sr�cCs\g}t��}d}|D]!}|\}}}}}}	|sq
||vrd}t�|||||	�}
|�|
�q
|S)z:Return currently connected users as a list of namedtuples.)z:0.0z:0�	localhost)r2�usersr�suserrt)rvr�r�r�r&�tty�hostname�tstamp�user_processr�r�r7r7r8r�sr�cCsdd�t�t��D�S)z7Returns a list of PIDs currently running on the system.cSsg|]
}|��rt|��qSr7)�isdigitr�r@r7r7r8rC1szpids.<locals>.<listcomp>)rK�listdirrr7r7r7r8�pids/sr�cCstj�tj�t�t|�d��S)z&Check for the existence of a unix pid.�psinfo)rK�path�existsr�r�strrr7r7r8�
pid_exists4sr�cst����fdd��}|S)z�Call callable into a try/except clause and translate ENOENT,
    EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
    c
s�|j|j|j}}}z�|g|�Ri|��WSttfy6}zt|�s+t||�|�t|||�|�d}~wtyG}zt	||�|�d}~wwrU)
r��_ppid�_name�FileNotFoundError�ProcessLookupErrorr�rr
�PermissionErrorr)�self�args�kwargsr�rr��err��funr7r8�wrapper>s���z wrap_exceptions.<locals>.wrapper)�	functools�wraps)r�r�r7r�r8�wrap_exceptions9sr�c@steZdZdZgd�Zdd�Zdd�Zdd�Zee	d	d
���Z
ee	dd���Zed
d��Zedd��Z
edd��Zedd��Zedd��Zedd��ZerRedd��Zed=dd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zed(d)��Zed*d+��Zed,d-��Zed.d/��ZeZed0d1��Zd2d3�Z ed4d5��Z!ed6d7��Z"ed>d9d:��Z#e$r�ed;d<��Z%d8Sd8S)?�Processz1Wrapper class around underlying C implementation.)�_cacher�r��_procfs_pathr�cCs||_d|_d|_t�|_dSrU)r�r�r�rr�)r�r�r7r7r8�__init__UszProcess.__init__cC�|j�|�|j�|�dSrU)�_proc_basic_info�cache_activate�
_proc_cred�r�r7r7r8�
oneshot_enter[�zProcess.oneshot_entercCr�rU)r��cache_deactivater�r�r7r7r8�oneshot_exit_r�zProcess.oneshot_exitcC�t�|j|j�SrU)r2�proc_basic_infor�r�r�r7r7r8r�c�zProcess._proc_basic_infocCr�rU)r2�	proc_credr�r�r�r7r7r8r�hr�zProcess._proc_credcCs$|jdkrdSt�|j|j��d�S)Nr�swapper�)r�r2�	proc_namer��rstripr�r7r7r8r�ms
zProcess.namecCs�|��}|sdS|d}tjj|vr@tj�|�s%tj�tj�|��|��}tj�|�r:tj�|�r:t�	|tj
�r:|Stj�|�}tjd�
d�D]}tj�tj�||��}tj�|�rft�	|tj
�rf|SqHdS)Nrpr�PATH�:)�cmdlinerKr��sep�isabs�abspathr��cwd�isfile�access�X_OK�basename�environ�split)r�r��exer��possible_exer7r7r8r�ts.
�
����zProcess.execC�t�|j�SrU)r2�	proc_argsr�r�r7r7r8r���zProcess.cmdlinecCr�rU)r2�proc_environr�r�r7r7r8r��r�zProcess.environcC�|��tdS)Nr�r��
proc_info_mapr�r7r7r8r��zProcess.create_timecCr�)Nr!r�r�r7r7r8r!�r�zProcess.num_threadscCsXt�|j�}g}|D]\}}}t�|||�}|�|�q
|s*t�|j�d|j���|S)N�/)	r2rr�r�pthreadrtrK�statr�)r�r�rv�	thread_id�utime�stimer}r7r7r8�threads�szProcess.threads�inetcCs.t||jd�}|st�|j�d|j���|S)N)r�r�)r�r�rKr�r�)r�r�rHr7r7r8r��szProcess.net_connectionscCr�rU)r��getpriorityr�r�r7r7r8�nice_get�r�zProcess.nice_getcCst�|j|�SrU)r��setpriorityr�)r��valuer7r7r8�nice_set�szProcess.nice_setcCs|��td|_|jS)Nr)r�r�r�r�r7r7r8r�szProcess.ppidcCs"|��\}}}}}}t�|||�SrU�r�r�puids)r��real�	effective�saved�_r7r7r8�uids��zProcess.uidscCs"|��\}}}}}}t�|||�SrUr)r�r	rrrr7r7r8�gids�rzProcess.gidscCst�|j|j�}tj|�SrU)r2�proc_cpu_timesr�r�r�	pcputimes)r��tr7r7r8rI�s
zProcess.cpu_timescCsP|��td}|d@d?|d@B}t�d�D]}t�|�j|kr%|SqdS)Nr#l��i��z	/dev/**/*)r�r��globrKr��st_rdev)r��ttydev�devr7r7r8�terminal�s�zProcess.terminalcCsV|j}zt�|�d|j�d��}|�d�WSty*t�|�d|j���YdSw)Nr�z/cwdrp)r�rK�readlinkr�r�r�r�)r��procfs_path�resultr7r7r8r��s�zProcess.cwdcCs2|��}|tdd}|tdd}t||�S)Nrir)r�r�r$)r�rHrrr7r7r8�memory_info�s
zProcess.memory_infocCs|��td}t�|d�S)Nr"�?)r�r��
PROC_STATUSESr�)r��coder7r7r8r"�szProcess.statuscCs�tjddt|j�gtjtjd�}|��\}}dd�||fD�\}}d|��vr.t|j|j��t	�
d|�}g}|D]%\}}|��}|�d�rK|d	d�}|��d
krRq8|�
t�|t|���q8|S)Nz/usr/bin/procfilesz-nrQcsrTrUrVr@r7r7r8rZr�z%Process.open_files.<locals>.<genexpr>zno such processz(\d+): S_IFREG.*name:(.*)\nz//rzcannot be retrieved)r[r\r�r�r]r^�lowerrr�r��findallra�
startswithrtr�	popenfiler�)r�rerRrS�	procfilesrvr�r�r7r7r8�
open_filess*�
�
zProcess.open_filescCs,|jdkrdStt�|j�d|j�d���S)Nrr�z/fd)r�rcrKr�r�r�r7r7r8�num_fdss
zProcess.num_fdscCstjt�|j��SrU)r�pctxswr2�proc_num_ctx_switchesr�r�r7r7r8�num_ctx_switches!�zProcess.num_ctx_switchesNcCst�|j||j�SrU)r�wait_pidr�r�)r��timeoutr7r7r8�wait%r'zProcess.waitc
Cs^zt�|j�\}}}}Wnty&}zt|j�s!t|j|j�|��d}~wwt�||||�SrU)	r2rr��OSErrorr�rr�r�pio)r��rc�wc�rb�wbr�r7r7r8�io_counters+s
��zProcess.io_counters)r�rU)&�__name__�
__module__�__qualname__�__doc__�	__slots__r�r�r�r�rr�r�r�r�r�r�rr!�HAS_THREADSr�r�rrrr
rrIrr�r�memory_full_infor"r"r#r&r*�HAS_PROC_IO_COUNTERSr1r7r7r7r8r�Psz















	



�r�)F)r~)_r5r�rrKr�r[rX�collectionsrrprrrr2rr�rr	r
rrr
rrrr�__extra__all__�hasattrr7�HAS_NET_IO_COUNTERSr9�getpagesize�	PAGE_SIZE�AF_LINK�SIDL�STATUS_IDLE�SZOMB�
STATUS_ZOMBIE�SACTIVE�STATUS_RUNNING�SSWAP�SSTOP�STATUS_STOPPEDr�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��dictr�r$�pfullmemr%r*r9r>rIrErNrhri�disk_io_countersrrrqr�rr�r�r�r�r�r�r�r�r7r7r7r8�<module>s�


�	��
	


+