HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //proc/self/root/usr/local/lib64/python3.9/site-packages/psutil/__pycache__/_psaix.cpython-39.pyc
a

q�dg�H�@s�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#e�$�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 d!�ZKed"d#d$g�ZLeLZMed%gd&��ZNed'gd(��ZOd)d*�ZPd+d,�ZQd-d.�ZRd/d0�ZSd1d2�ZTd3d4�ZUd5d6�ZVe
jWZWejXZXdKd8d9�ZYejZZZe"�r�e
j[Z[dLd;d<�Z\d=d>�Z]d?d@�Z^dAdB�Z_dCdD�Z`dEdF�ZadGdH�ZbGdIdJ�dJ�ZcdS)MzAIX 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)�ProcessLookupErrorZPROCFS_PATH�proc_threads�net_io_counters�proc_io_counters������)�ppid�rss�vms�create_time�nice�num_threads�status�ttynr�pmemr r!�	scputimes)�user�system�idleZiowait�svmem)�total�	available�percent�used�freecCs4t��\}}}}}t|||dd�}t|||||�S)Nr�Zround_)�cextZvirtual_memrr,)r-Zavailr1Z_pinnedZinuser/�r4�9/usr/local/lib64/python3.9/site-packages/psutil/_psaix.py�virtual_memoryksr6cCs:t��\}}}}||}t||dd�}t�||||||�S)z=Swap system memory as a (total, used, free, sin, sout) tuple.rr2)r3Zswap_memrrZsswap)r-r1�sinZsoutr0r/r4r4r5�swap_memoryqsr8cCst��}tdd�t|�D��S)z.Return system-wide CPU times as a named tuple.cSsg|]}t|��qSr4)�sum��.0�xr4r4r5�
<listcomp>��zcpu_times.<locals>.<listcomp>)r3�
per_cpu_timesr(�zip��retr4r4r5�	cpu_times~srCcCst��}dd�|D�S)z6Return system per-CPU times as a list of named tuples.cSsg|]}t|��qSr4)r(r:r4r4r5r=�r>z!per_cpu_times.<locals>.<listcomp>)r3r?rAr4r4r5r?�sr?cCs&zt�d�WSty YdS0dS)z0Return the number of logical CPUs in the system.�SC_NPROCESSORS_ONLNN)�os�sysconf�
ValueErrorr4r4r4r5�cpu_count_logical�srHcCstgd�}tj|tjtjd�}|��\}}trBdd�||fD�\}}|jdkr\td||f��|����}t	|�prdS)N)Zlsdevz-Cc�	processor��stdout�stderrcss|]}|�tjj�VqdS�N��decode�sysrK�encodingr:r4r4r5�	<genexpr>�sz"cpu_count_cores.<locals>.<genexpr>rz%r command error
%s)
�
subprocess�Popen�PIPE�communicater�
returncode�RuntimeError�strip�
splitlines�len)�cmd�prKrLZ
processorsr4r4r5�cpu_count_cores�s�

r^cCs t��\}}}}t�||||�S)z*Return various CPU stats as a named tuple.)r3�	cpu_statsrZ	scpustats)Zctx_switchesZ
interruptsZsoft_interruptsZsyscallsr4r4r5r_�s�r_Fc	Cs\g}t��}|D]F}|\}}}}|dkr,d}|s<t|�js<qt�||||�}|�|�q|S)zReturn system disk partitions.�none�)r3�disk_partitions�
disk_usager-rZ	sdiskpart�append)	�all�retlistZ
partitions�	partitionZdeviceZ
mountpointZfstype�opts�ntupler4r4r5rb�s
rb���cCs�tj}||vr.td|d�dd�|D��f��tj|\}}t�|�}g}|D]X}|\}}	}
}}}
}|	|vrnqN|
|vrxqNt||	|
|||
t|dkr�|ndd�}|�|�qN|S)z�Return socket connections.  If pid == -1 return system-wide
    connections (as opposed to connections opened by one process only).
    z+invalid %r kind argument; choose between %sz, cSsg|]}t|��qSr4)�reprr:r4r4r5r=�r>z#net_connections.<locals>.<listcomp>rjN��pid)	rZ	conn_tmaprG�joinr3�net_connectionsr�TCP_STATUSESrd)�kind�_pidZcmapZfamilies�types�rawlistrB�item�fd�fam�type_�laddr�raddrr%rm�ntr4r4r5ro�s8��
�
rocCs�ttd�}tdd�t�D��}i}|D]�}t�|�}t�|�}d}d}tjdd|gtj	tj	d�}|�
�\}	}
tr�d	d
�|	|
fD�\}	}
|jdkr�t
�d|	�}|dur�t|�d
��}|�d�}d�|�}d|v}
|�|t�}t�|
||||�||<q&|S)z)Get NIC stats (isup, duplex, speed, mtu).)�FullZHalfcSsg|]}|d�qS)rr4r:r4r4r5r=�r>z net_if_stats.<locals>.<listcomp>rarz/usr/bin/entstatz-drJcss|]}|�tjj�VqdSrMrNr:r4r4r5rRsznet_if_stats.<locals>.<genexpr>z"Running: (\d+) Mbps.*?(\w+) DuplexNrr�,�running)rr	�set�net_if_addrs�
cext_posixZ
net_if_mtuZnet_if_flagsrSrTrUrVrrW�re�search�int�grouprn�getr
rZ	snicstats)Z
duplex_map�namesrB�nameZmtu�flagsZduplex�speedr]rKrLZ	re_resultZoutput_flagsZisupr4r4r5�net_if_stats�s<


��

�

r�cCst��S)z:The system boot time expressed in seconds since the epoch.)r3�	boot_timer4r4r4r5r�sr�cCs\g}t��}d}|D]B}|\}}}}}}	|s.q||vr:d}t�|||||	�}
|�|
�q|S)z:Return currently connected users as a list of namedtuples.)z:0.0z:0�	localhost)r3�usersrZsuserrd)rfrtr�rur)�tty�hostnameZtstampZuser_processrmr{r4r4r5r�$sr�cCsdd�t�t��D�S)z7Returns a list of PIDs currently running on the system.cSsg|]}|��rt|��qSr4)�isdigitr�r:r4r4r5r=>r>zpids.<locals>.<listcomp>)rE�listdirrr4r4r4r5�pids<sr�cCstj�tj�t�t|�d��S)z&Check for the existence of a unix pid.Zpsinfo)rE�path�existsrnr�strrlr4r4r5�
pid_existsAsr�cst����fdd��}|S)z�Call callable into a try/except clause and translate ENOENT,
    EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
    c	s~z�|g|�Ri|��WSttfyZt|j�sDt|j|j��nt|j|j|j��Yn tyxt	|j|j��Yn0dSrM)
rrr�rmr�_namer
�_ppidrr)�self�args�kwargs��funr4r5�wrapperKs
z wrap_exceptions.<locals>.wrapper)�	functools�wraps)r�r�r4r�r5�wrap_exceptionsFsr�c@sreZdZdZgd�Zdd�Zdd�Zdd�Zee	d	d
���Z
ee	dd���Zed
d��Zedd��Z
edd��Zedd��Zedd��Zedd��Zer�edd��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$�rned;d<��Z%d8S)?�Processz1Wrapper class around underlying C implementation.)�_cacher�r��_procfs_pathrmcCs||_d|_d|_t�|_dSrM)rmr�r�rr�)r�rmr4r4r5�__init__bszProcess.__init__cCs|j�|�|j�|�dSrM)�_proc_basic_infoZcache_activate�
_proc_cred�r�r4r4r5�
oneshot_enterhszProcess.oneshot_entercCs|j�|�|j�|�dSrM)r�Zcache_deactivater�r�r4r4r5�oneshot_exitlszProcess.oneshot_exitcCst�|j|j�SrM)r3Zproc_basic_informr�r�r4r4r5r�pszProcess._proc_basic_infocCst�|j|j�SrM)r3Z	proc_credrmr�r�r4r4r5r�uszProcess._proc_credcCs$|jdkrdSt�|j|j��d�S)NrZswapper�)rmr3Z	proc_namer��rstripr�r4r4r5r�zs
zProcess.namecCs�|��}|sdS|d}tjj|vr�tj�|�sJtj�tj�|��|��}tj�|�rttj�|�rtt�	|tj
�rt|Stj�|�}tjd�
d�D]<}tj�tj�||��}tj�|�r�t�	|tj
�r�|Sq�dS)Nrar�PATH�:)�cmdlinerEr��sep�isabs�abspathrn�cwd�isfile�access�X_OK�basename�environ�split)r�r��exer�Zpossible_exer4r4r5r��s,
�
���
zProcess.execCst�|j�SrM)r3Z	proc_argsrmr�r4r4r5r��szProcess.cmdlinecCst�|j�SrM)r3Zproc_environrmr�r4r4r5r��szProcess.environcCs|��tdS)Nr"�r��
proc_info_mapr�r4r4r5r"�szProcess.create_timecCs|��tdS)Nr$r�r�r4r4r5r$�szProcess.num_threadscCsVt�|j�}g}|D]"\}}}t�|||�}|�|�q|sRt�d|j|jf�|S)N�%s/%s)	r3rrmrZpthreadrdrE�statr�)r�rtrf�	thread_id�utimeZstimerir4r4r5�threads�szProcess.threads�inetcCs,t||jd�}|s(t�d|j|jf�|S)N)rrr�)rormrEr�r�)r�rqrBr4r4r5ro�szProcess.net_connectionscCst�|j�SrM)r��getpriorityrmr�r4r4r5�nice_get�szProcess.nice_getcCst�|j|�SrM)r��setpriorityrm)r��valuer4r4r5�nice_set�szProcess.nice_setcCs|��td|_|jS)Nr)r�r�r�r�r4r4r5r�szProcess.ppidcCs"|��\}}}}}}t�|||�SrM�r�rZpuids)r��real�	effective�saved�_r4r4r5�uids�szProcess.uidscCs"|��\}}}}}}t�|||�SrMr�)r�r�r�r�r�r4r4r5�gids�szProcess.gidscCst�|j|j�}tj|�SrM)r3Zproc_cpu_timesrmr�rZ	pcputimes)r��tr4r4r5rC�szProcess.cpu_timescCsP|��td}|d@d?|d@B}t�d�D]}t�|�j|kr.|Sq.dS)Nr&l��i��z	/dev/**/*)r�r��globrEr��st_rdev)r�Zttydev�devr4r4r5�terminal�s
zProcess.terminalcCsT|j}z t�d||jf�}|�d�WStyNt�d||jf�YdS0dS)Nz	%s/%s/cwd�/r�ra)r�rE�readlinkrmr�rr�)r�Zprocfs_path�resultr4r4r5r��szProcess.cwdcCs2|��}|tdd}|tdd}t||�S)Nr ir!)r�r�r')r�rBr r!r4r4r5�memory_infoszProcess.memory_infocCs|��td}t�|d�S)Nr%�?)r�r��
PROC_STATUSESr�)r��coder4r4r5r%	szProcess.statuscCs�tjddt|j�gtjtjd�}|��\}}trFdd�||fD�\}}d|��vr`t|j|j	��t
�d|�}g}|D]J\}}|��}|�
d�r�|d	d�}|��d
kr�qt|�t�|t|���qt|S)Nz/usr/bin/procfilesz-nrJcss|]}|�tjj�VqdSrMrNr:r4r4r5rRsz%Process.open_files.<locals>.<genexpr>zno such processz(\d+): S_IFREG.*name:(.*)\nz//rzcannot be retrieved)rSrTr�rmrUrVr�lowerrr�r��findallrY�
startswithrdrZ	popenfiler�)r�r]rKrLZ	procfilesrfrvr�r4r4r5�
open_filess,��

zProcess.open_filescCs(|jdkrdStt�d|j|jf��S)Nrz%s/%s/fd)rmr[rEr�r�r�r4r4r5�num_fds)s
zProcess.num_fdscCstjt�|j��SrM)rZpctxswr3Zproc_num_ctx_switchesrmr�r4r4r5�num_ctx_switches/szProcess.num_ctx_switchesNcCst�|j||j�SrM)rZwait_pidrmr�)r��timeoutr4r4r5�wait3szProcess.waitcCsVzt�|j�\}}}}Wn,tyDt|j�s>t|j|j���Yn0t�||||�SrM)	r3rrm�OSErrorr�rr�rZpio)r��rcZwc�rb�wbr4r4r5�io_counters9s
zProcess.io_counters)r�)N)&�__name__�
__module__�__qualname__�__doc__�	__slots__r�r�r�r�rr�r�r�r�r�r�r"r$�HAS_THREADSr�ror�r�rr�r�rCr�r�r�Zmemory_full_infor%r�r�r�r��HAS_PROC_IO_COUNTERSr�r4r4r4r5r�]sv















	



r�)F)rj)dr�r�r�rEr�rSrP�collectionsrrarrrr3rr�rr	r
rrr
rrrrZ_compatrrrrZ__extra__all__�hasattrr�ZHAS_NET_IO_COUNTERSr�ZgetpagesizeZ	PAGE_SIZEZAF_LINKZSIDLZSTATUS_IDLEZSZOMBZ
STATUS_ZOMBIEZSACTIVEZSTATUS_RUNNINGZSSWAPZSSTOPZSTATUS_STOPPEDr�ZTCPS_ESTABLISHEDZCONN_ESTABLISHEDZ
TCPS_SYN_SENTZ
CONN_SYN_SENTZ
TCPS_SYN_RCVDZ
CONN_SYN_RECVZTCPS_FIN_WAIT_1ZCONN_FIN_WAIT1ZTCPS_FIN_WAIT_2ZCONN_FIN_WAIT2ZTCPS_TIME_WAITZCONN_TIME_WAITZTCPS_CLOSEDZ
CONN_CLOSEZTCPS_CLOSE_WAITZCONN_CLOSE_WAITZ
TCPS_LAST_ACKZ
CONN_LAST_ACKZTCPS_LISTENZCONN_LISTENZTCPS_CLOSINGZCONN_CLOSINGZPSUTIL_CONN_NONEZ	CONN_NONErp�dictr�r'Zpfullmemr(r,r6r8rCr?rHr^r_Zdisk_io_countersrcrbr�rror�r�r�r�r�r�r�r4r4r4r5�<module>s�


�	��
	


!,