HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/psutil/__pycache__/_common.cpython-310.pyc
o

�N�gjf�
@s dZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddl
mZddlmZddlmZddlmZzdd	lmZWney_dZYnwzdd
lmZWneysdZYnwe
jdkr~ddlZndZe
jddkZgd
�ZejdkZejdkZe
j�d�Ze
j�d�Z e Z!e
j�d�Z"e
j�d�Z#e
j�d�Z$e"p�e#p�e$Z%e
j�d�Z&e
j�d�Z'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0d Z1d!Z2d"Z3d#Z4d$Z5d%Z6d&Z7d'Z8d(Z9d)Z:d*Z;d+Z<d,Z=d-Z>d.Z?d/Z@d0ZAedu�rd1ZBd2ZCdZDnGd3d4�d4ejE�ZFeG��HeFjI�edu�r!d5ZJd6ZKnGd7d8�d8ejE�ZLeG��HeLjI�e
�M�ZNe�s;d9ZOnze
�P�ZOWneQ�yRe�rNd:nd9ZOYnwed;gd<��ZRed=gd>��ZSed?gd@��ZTedAgdB��ZUedCgdD��ZVedEgdF��ZWedGgdH��ZXedIgdJ��ZYedKgdL��ZZedMgdN��Z[edOgdP��Z\edQgdR��Z]edSgdT��Z^edUdVdWg�Z_edXgdY��Z`edZd[d\g�Zaed]gd^��Zbed_gd`��Zcedagd`��Zdedbgdc��Zeedddedfg�Zfedgdhdig�Zgedjgdk��Zhedldmdng�Zieeegeegfeegegfegegfeegegfegegfeegeegfegeegfegeegfdo�Zjedu�rDej�Hegegfegegfdp��edu�rUej�Hdqegeegfi�Gdrds�dsek�ZlGdtdu�duel�ZmGdvdw�dwem�ZnGdxdy�dyel�ZoGdzd{�d{el�Zpd�d|d}�Zqd~d�Zrd�d��Zsd�d��Ztd�d��Zuerd�d���Zvd�d��Zwd�d��Zxd�d��Zyd�d�d��Zzd�d��Z{Gd�d��d��Z|d�d��Z}e|�Z~e~je}_e~j�e}_�d�d��Z�d�d��Z�d�d�d��Z�d�d��Z�e�r�d�d��Z�nd�d��Z�ere
j�fd�d���Z�d�d�d��Z�dd�e
j�fd�d��Z�e�e��d�d���r
ddl�Z�d�d��Z�dSd�d��Z�dS)�z9Common objects shared by __init__.py and _ps*.py modules.�)�division�print_functionN)�defaultdict)�
namedtuple)�AF_INET)�
SOCK_DGRAM)�SOCK_STREAM)�AF_INET6)�AF_UNIX)��r)N�FREEBSD�BSD�LINUX�NETBSD�OPENBSD�MACOS�OSX�POSIX�SUNOS�WINDOWS�
CONN_CLOSE�CONN_CLOSE_WAIT�CONN_CLOSING�CONN_ESTABLISHED�CONN_FIN_WAIT1�CONN_FIN_WAIT2�
CONN_LAST_ACK�CONN_LISTEN�	CONN_NONE�
CONN_SYN_RECV�
CONN_SYN_SENT�CONN_TIME_WAIT�NIC_DUPLEX_FULL�NIC_DUPLEX_HALF�NIC_DUPLEX_UNKNOWN�STATUS_DEAD�STATUS_DISK_SLEEP�STATUS_IDLE�
STATUS_LOCKED�STATUS_RUNNING�STATUS_SLEEPING�STATUS_STOPPED�STATUS_SUSPENDED�STATUS_TRACING_STOP�STATUS_WAITING�STATUS_WAKE_KILL�
STATUS_WAKING�
STATUS_ZOMBIE�
STATUS_PARKED�ENCODING�
ENCODING_ERRSr	�pconn�	pcputimes�pctxsw�pgids�pio�pionice�	popenfile�pthread�puids�sconn�	scpustats�sdiskio�	sdiskpart�
sdiskusage�snetio�snicaddr�	snicstats�sswap�suser�	conn_tmap�deprecated_method�
isfile_strict�memoize�parse_environ_block�path_exists_strict�
usage_percent�
supports_ipv6�sockfam_to_enum�socktype_to_enum�wrap_numbers�bytes2human�conn_to_ntuple�debug�hilite�term_supports_colors�print_color�posix�nt�linux�darwinZfreebsdZopenbsdZnetbsd)ZsunosZsolaris�aixZrunningZsleepingz
disk-sleep�stoppedztracing-stopZzombieZdeadz	wake-killZwakingZidle�lockedZwaitingZ	suspendedZparkedZESTABLISHEDZSYN_SENTZSYN_RECVZ	FIN_WAIT1Z	FIN_WAIT2Z	TIME_WAITZCLOSEZ
CLOSE_WAITZLAST_ACKZLISTENZCLOSINGZNONE��c@seZdZdZdZdZdS)�	NicDuplexrarbrN)�__name__�
__module__�__qualname__r#r$r%�rgrg�B/opt/saltstack/salt/lib/python3.10/site-packages/psutil/_common.pyrc�src������c@seZdZdZdZdS)�BatteryTimerirjN)rdrerf�POWER_TIME_UNKNOWN�POWER_TIME_UNLIMITEDrgrgrgrhrk�srk�replace�surrogateescaperG)�total�used�free�percent�sinZsoutrC)rprqrrrsrA)�
read_count�write_count�
read_bytes�write_bytesZ	read_timeZ
write_timerB)ZdeviceZ
mountpointZfstype�optsZmaxfileZmaxpathrD)Z
bytes_sentZ
bytes_recvZpackets_sentZpackets_recvZerrinZerroutZdropinZdropoutrH)�nameZterminal�host�started�pidr?)�fd�family�type�laddr�raddr�statusr}rE)r�address�netmask�	broadcastZptprF)ZisupZduplexZspeedZmtur@)Zctx_switchesZ
interruptsZsoft_interruptsZsyscalls�scpufreq)�current�min�max�shwtemp)�labelr��high�critical�sbattery)rsZsecsleftZ
power_plugged�sfanr�r�r7)�user�system�
children_user�children_systemr<�pathr~r=)�idZ	user_timeZsystem_timer>)�realZ	effectiveZsavedr9r:)rurvrwrxr;Zioclass�valuer8Z	voluntaryZinvoluntaryr6)r~rr�r�r�r��addr�ip�port)�allZtcpZtcp4ZudpZudp4ZinetZinet4Zinet6)Ztcp6Zudp6Zunixc@s*eZdZdZdZd	dd�Zdd�ZeZdS)
�ErrorzQBase exception class. All other psutil exceptions inherit
    from this one.
    �psutil�cCst�||�||_dS�N)�	Exception�__init__�msg)�selfr�rgrgrhr�s
zError.__init__cCsd|jj|jf}|��S)Nzpsutil.%s %s)�	__class__rdr��strip�r��retrgrgrh�__repr__szError.__repr__N)r�)rdrerf�__doc__r�r��__str__rgrgrgrhr�s
r�c@�eZdZdZdZddd�ZdS)�
NoSuchProcesszXException raised when a process with a certain PID doesn't
    or no longer exists.
    r�NcCs\t�||�||_||_||_|dur,|r d|jt|j�f}nd|j}d||_dSdS)N�(pid=%s, name=%s)�(pid=%s)zprocess no longer exists �r�r�r}rzr��repr)r�r}rzr��detailsrgrgrhr�'s
�zNoSuchProcess.__init__�NN�rdrerfr�r�rgrgrgrhr�!�r�c@r�)�
ZombieProcessa1Exception raised when querying a zombie process. This is
    raised on macOS, BSD and Solaris only, and not always: depending
    on the query the OS may be able to succeed anyway.
    On Linux all zombie processes are querable (hence this is never
    raised). Windows doesn't have zombie processes.
    r�NcCs�t�||�||_||_||_||_|dur?d|g}|r'|�dt|j��|r1|�d|j�dd�|�}d||_dSdS)Nzpid=%szname=%szppid=%sz(%s)z, z'process still exists but it's a zombie )	r�r�r}�ppidrzr��appendr��join)r�r}rzr�r��argsr�rgrgrhr�=s
�zZombieProcess.__init__�NNNr�rgrgrgrhr�4sr�c@r�)�AccessDeniedz@Exception raised when permission to perform an action is denied.r�NcCsrt�||�||_||_||_|dur7|dur&|dur&d|t|�f|_dS|dur2d|j|_dSd|_dSdS)Nr�r�r�r�)r�r}rzr�rgrgrhr�Qs
�zAccessDenied.__init__r�r�rgrgrgrhr�Msr�c@r�)�TimeoutExpiredzWRaised on Process.wait(timeout) if timeout expires and process
    is still alive.
    r�NcCstt�|d|�||_||_||_|dur(|dur(|jd|t|�f7_dS|dur8|jd|j7_dSdS)Nztimeout after %s secondsz (pid=%s, name=%s)z	 (pid=%s))r�r��secondsr}rzr�r�)r�r�r}rzrgrgrhr�es�zTimeoutExpired.__init__r�r�rgrgrgrhr�_r�r�cCs@z
t|�|d}Wn
tyYdSw|durt||�}|S)z5Calculate percentage usage of 'used' against 'total'.�dgN)�float�ZeroDivisionError�round)rqrpZround_r�rgrgrhrOus�
rOcs2t�����fdd��}�fdd�}i�||_|S)aA simple memoize decorator for functions supporting (hashable)
    positional arguments.
    It also provides a cache_clear() function for clearing the cache:

    >>> @memoize
    ... def foo()
    ...     return 1
        ...
    >>> foo()
    1
    >>> foo.cache_clear()
    >>>
    csL|tt|����f}z�|WSty%�|i|��}�|<|YSwr�)�	frozenset�sorted�items�KeyError)r��kwargs�keyr���cache�funrgrh�wrapper�s
�zmemoize.<locals>.wrappercs���dS)zClear cache.N)�clearrg)r�rgrh�cache_clear��zmemoize.<locals>.cache_clear)�	functools�wrapsr�)r�r�r�rgr�rhrL�srLcs6t����fdd��}dd�}dd�}||_||_|S)a�A memoize decorator which is disabled by default. It can be
    activated and deactivated on request.
    For efficiency reasons it can be used only against class methods
    accepting no arguments.

    >>> class Foo:
    ...     @memoize
    ...     def foo()
    ...         print(1)
    ...
    >>> f = Foo()
    >>> # deactivated (default)
    >>> foo()
    1
    >>> foo()
    1
    >>>
    >>> # activated
    >>> foo.cache_activate(self)
    >>> foo()
    1
    >>> foo()
    >>> foo()
    >>>
    csPz|j�}W|Sty�|�YSty'�|�}|j�<Y|Swr�)�_cache�AttributeErrorr�r��r�rgrhr��s��z'memoize_when_activated.<locals>.wrappercSs
i|_dS)zjActivate cache. Expects a Process instance. Cache will be
        stored as a "_cache" instance attribute.N)r���procrgrgrh�cache_activate�s
z.memoize_when_activated.<locals>.cache_activatecSs z|`WdStyYdSw)zDeactivate and clear cache.N)r�r�r�rgrgrh�cache_deactivate�s

�z0memoize_when_activated.<locals>.cache_deactivate)r�r�r�r�)r�r�r�r�rgr�rh�memoize_when_activated�s
r�c
CsVzt�|�}Wnty$}z|jtjtjfvr�WYd}~dSd}~wwt�|j�S)z�Same as os.path.isfile() but does not swallow EACCES / EPERM
    exceptions, see:
    http://mail.python.org/pipermail/python-dev/2012-June/120787.html
    NF)�os�stat�OSError�errno�EPERM�EACCES�S_ISREG�st_mode)r��st�errrgrgrhrK�s��rKc
CsLzt�|�WdSty%}z|jtjtjfvr�WYd}~dSd}~ww)z�Same as os.path.exists() but does not swallow EACCES / EPERM
    exceptions, see:
    http://mail.python.org/pipermail/python-dev/2012-June/120787.html
    NFT)r�r�r�r�r�r�)r�r�rgrgrhrN�s���rNcCsvtjrtdur	dSz&t�ttj�}t�|��|�d�Wd�WdS1s(wYWdStjy:YdSw)z2Return True if IPv6 is supported on this platform.NF)z::1rT)�socket�has_ipv6r	r�
contextlib�closing�bind�error)�sockrgrgrhrP�s
���rPcCsxi}d}t}	|�d|�}||kr	|S|�d||�}||kr7|||�}||d|�}|r3|��}|||<|d}q)zCParse a C environ block of environment variables into a dictionary.rT��=rb)r�find�upper)�datar��posZWINDOWS_Znext_posZ	equal_posr�r�rgrgrhrMs"��rMcC�0tdur|Szt�|�WSty|YSw)z�Convert a numeric socket family value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    N)�enumr��
AddressFamily�
ValueError��numrgrgrhrQ"��rQcCr�)zConvert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    N)r�r��
SocketKindr�r�rgrgrhrR/r�rRcCs�|tjtfvr|r
t|�}|rt|�}|tjkr%|ttfvr%|�|t�}nt}t|�}t|�}|dur<t	||||||�St
|||||||�S)z2Convert a raw connection tuple to a proper ntuple.N)r�rr	r�r�getrrQrRr6r?)r~ZfamZtype_r�r�r�Z
status_mapr}rgrgrhrU<srUcs�fdd�}|S)z�A decorator which can be used to mark a method as deprecated
    'replcement' is the method name which will be called instead.
    cs:d|j�f�|jdur�|_t�|���fdd��}|S)Nz8%s() is deprecated and will be removed; use %s() insteadcs$tj�tdd�t|��|i|��S)Nra)�category�
stacklevel)�warnings�warn�DeprecationWarning�getattr)r�r�r�)r��replacementrgrh�innerYsz/deprecated_method.<locals>.outer.<locals>.inner)rdr�r�r�)r�r�r�r�rh�outerSs�
z deprecated_method.<locals>.outerrg)rrrgrrhrJOsrJc@sBeZdZdZdd�Zdd�Zdd�Zdd	�Zddd�Zd
d�Z	d
S)�_WrapNumberszNWatches numbers so that they don't overflow and wrap
    (reset to zero).
    cCs t��|_i|_i|_i|_dSr�)�	threading�Lock�lockr��	reminders�
reminder_keys�r�rgrgrhr�fs

z_WrapNumbers.__init__cCsT||jvsJ�||jvsJ�||jvsJ�||j|<tt�|j|<tt�|j|<dSr�)r�r	r
r�int�set)r��
input_dictrzrgrgrh�	_add_dictls
z_WrapNumbers._add_dictcCs\|j|}t|���t|���}|D]}|j||D]}|j||=q|j||=qdS)z�In case the number of keys changed between calls (e.g. a
        disk disappears) this removes the entry from self.reminders.
        N)r�r
�keysr
r	)r�rrz�old_dictZ	gone_keysZgone_key�remkeyrgrgrh�_remove_dead_remindersts
�z#_WrapNumbers._remove_dead_remindersc
	Cs||jvr
|�||�|S|�||�|j|}i}|��D]\}||}z||}Wn
ty7|||<Yqwg}tt|��D]3}	||	}
||	}||	f}|
|krg|j|||7<|j||�	|�|�
|
|j||�q@t|�||<q||j|<|S)zkCache dict and sum numbers which overflow and wrap.
        Return an updated copy of `input_dict`
        )r�rrrr��range�lenr	r
�addr��tuple)
r�rrzrZnew_dictr�Zinput_tupleZ	old_tuple�bits�iZinput_value�	old_valuerrgrgrh�runs4

�
z_WrapNumbers.runNcCs�|j�:|dur|j��|j��|j��n|j�|d�|j�|d�|j�|d�Wd�dSWd�dS1s@wYdS)z>Clear the internal cache, optionally only for function 'name'.N)rr�r�r	r
�pop)r�rzrgrgrhr��s

�"�z_WrapNumbers.cache_clearcCs:|j�|j|j|jfWd�S1swYdS)z5Return internal cache dicts as a tuple of 3 elements.N)rr�r	r
rrgrgrh�
cache_info�s$�z_WrapNumbers.cache_infor�)
rdrerfr�r�rrrr�rrgrgrgrhras
'rcCs6tj�t�||�Wd�S1swYdS)z�Given an `input_dict` and a function `name`, adjust the numbers
    which "wrap" (restart from zero) across different calls by adding
    "old value" to "new value" and return an updated dict.
    N)�_wnrr)rrzrgrgrhrS�s
$�rScKst|dfi|��S)N�rb)�open��fnamer�rgrgrh�open_binary�sr#cKs.tr|�dt�|�dt�t|dfi|��S)z�On Python 3 opens a file in text mode by using fs encoding and
    a proper en/decoding errors handler.
    On Python 2 this is just an alias for open(name, 'rt').
    �encoding�errorsZrt)�PY3�
setdefaultr4r5r r!rgrgrh�	open_text�sr(�%(value).1f%(symbol)scCs�d}i}t|dd��D]\}}d|dd>||<qt|dd��D]}|||kr:t|�||}|t�Sq#|t|d|d�S)z�Used by various scripts. See:
    http://goo.gl/zeJZl

    >>> bytes2human(10000)
    '9.8K'
    >>> bytes2human(100001221)
    '95.4M'
    )	�B�K�M�G�T�P�E�Z�YrbN�
r)�symbolr�)�	enumerate�reversedr��locals�dict)�n�format�symbols�prefixr�sr4r�rgrgrhrT�s	�rTcCstjdjS)z+Return updated psutil.PROCFS_PATH constant.r�)�sys�modulesZPROCFS_PATHrgrgrgrh�get_procfs_path�r�r@cCs|jttd�S)N)r$r%)�decoder4r5�r=rgrgrhrA�srAcCs|Sr�rgrBrgrgrhrA��cCsXtjdkrdSzddl}|��sJ�|��|�d�dksJ�WdSty+YdSw)Nr[Tr�colorsF)r�rz�curses�isattyZ	setuptermZtigetnumr�)�filerErgrgrhrX�s
��rXFcCs�t�s|Sg}tddddddddd	d
�	}d|d<z||}Wnty/td
t|�����w|�|�|r<|�d�dd�|�|fS)z*Return an highlighted version of 'string'.Z32Z91Z33Z93Z34Z35Z36Z37Z30)	�green�red�brown�yellowZblueZvioletZ	lightblueZgreyZdarkgreyZ29Nz#invalid color %r; choose between %s�1z[%sm%s�;)rXr8r�r��listrr�r�)r=�color�bold�attrrDrgrgrhrW
s$�
��

rWc	Cst�st||d�dStrtt|||�|d�dSddl}d}|jjj}|jjj}t	ddddd�}||d<z||}Wnt
yNtd	|t|�
��f��w|rY|dkrY|d
7}|tjur`dnd}	|j|_||	�}
||
|�zt||d�W||
|�dS||
|�w)
z$Print a colorized version of string.�rGrN�rar�)rHrIrJrKz#invalid color %r; choose between %r�i�i����)rX�printrrW�ctypesZwindllZKernel32�GetStdHandle�SetConsoleTextAttributer8r�r�rNrr>�stderr�c_ulong�restype)r=rOrPrGrWZ
DEFAULT_COLORrXrYrDZ	handle_id�handlergrgrhrY s6
���
rYZPSUTIL_DEBUGcCs6t�t��j�\}}}}}td|||ftjd�dS)z@If PSUTIL_DEBUG env var is set, print a debug message to stderr.zpsutil-debug [%s:%s]> %srRN)�inspectZgetframeinfo�currentframe�f_backrVr>rZ)r�r"�linenoZ	func_name�lines�indexrgrgrhrVFs�
�rVcCsdSr�rgrrgrgrhrVMrCr�)r))NF)�r�Z
__future__rrr�r�r�r�r�r�r>rr��collectionsrrrrrr	�ImportErrorr
�version_infor�r&�__all__rzrr�platform�
startswithrrrr
rrrrZAIXr*r+r'r,r.r2r&r0r1r(r)r/r-r3rr!r rrr"rrrrrrr#r$r%�IntEnumrc�globals�update�__members__rlrmrk�getfilesystemencodingr4r5�getfilesystemencodeerrorsr�rGrCrArBrDrHr?rErFr@r�r�r�r�r7r<r=r>r9r:r;r8r6r�rIr�r�r�r�r�r�rOrLr�rKrNrPrMrQrRrUrJrrSrr�rr#r(rTr@rA�stdoutrXrWrY�bool�getenvr^rVrgrgrgrh�<module>s^��


$
	

�����	

�


�
�

 9



W	

	

�#