Your IP : 3.128.28.117


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/psutil/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/psutil/__pycache__/_pslinux.cpython-37.pyc

B

�=�_�@�@s@dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%ddlm&Z&ddlm'Z'ddlm(Z(ddlm)Z)ddl*m+Z+ddl*m,Z,ddl*m-Z-dd l*m.Z.dd!l*m/Z/dd"l*m0Z0ej1d#k�r�ddl2Z2ndZ2d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3gZ3d4Z4ej5�6d5e�7��Z8e9ed6�Z:e9ed7�Z;e<�Z=e�>d8�Z?e�@�ZAdaBe0�rhd9nd:ZCejDd;kZEd<ZFe2dk�r�e
jGZHne2�Id=d>eJe
jG�i�ZKeKjHZHe2dk�r�dZLdZMd?ZNd@ZOn GdAdB�dBe2jI�ZPeQ��RePjS�ejTejUejVejWejXejYejZejZej[ej\ej]ej^dC�Z_ej`ejaejbejcejdejeejfejgejhejiejjdD�ZkedEdFdGdHdIdJdKdLdMdNdOdPg�ZledQdRdSdTdUdVdWdXdYdZg	�Zmed[d\d]d^d_d`g�Znedadb�Zoedceojpdd�Zqeded\dfdgdhdidjdkdldmdndog�Zredpdqdr�serjp��ZtedsdRdSdTdUdtdug�Zuedvdwdxdydzd{g�Zvd|d}�Zwd~d�Zxd�d��Zyed�d���Zze=d�fd�d��Z{yezd��Wn0e|k
�r�e
�}�ed�d��d�d�d��a~YnXdZydd�l�mZWnBe�k
�r�ddl�Z�e�j�dd�d��Z�e9e�d���r�d�d�d��ZYnXedk	�re3��d�d��e�e�D��d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�ej5�6d���s\ej5�6d���rfd�d��Z�n ej5�6d���r~d�d��Z�nd�d��Z�ej�Z�Gd�d��d�e|�Z�Gd�d��d��Z�e��Z�d�d�d��Z�d�d��Z�d�d��Z�ej�Z�d�d�d��Z�d�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�dÄZ�d�dńZ�d�dDŽZ�d�dɄZ�Gd�d˄d�e<�Z�dS)�zLinux platform implementation.�)�divisionN)�defaultdict)�
namedtuple�)�_common)�_psposix)�
_psutil_linux)�
_psutil_posix)�AccessDenied)�debug)�decode)�get_procfs_path)�
isfile_strict)�memoize)�memoize_when_activated)�NIC_DUPLEX_FULL)�NIC_DUPLEX_HALF)�NIC_DUPLEX_UNKNOWN)�
NoSuchProcess)�open_binary)�	open_text)�parse_environ_block)�path_exists_strict)�
supports_ipv6)�
usage_percent)�
ZombieProcess)�b)�
basestring)�FileNotFoundError)�PermissionError)�ProcessLookupError)�PY3)���PROCFS_PATH�IOPRIO_CLASS_NONE�IOPRIO_CLASS_RT�IOPRIO_CLASS_BE�IOPRIO_CLASS_IDLE�CONN_ESTABLISHED�
CONN_SYN_SENT�
CONN_SYN_RECV�CONN_FIN_WAIT1�CONN_FIN_WAIT2�CONN_TIME_WAIT�
CONN_CLOSE�CONN_CLOSE_WAIT�
CONN_LAST_ACK�CONN_LISTEN�CONN_CLOSINGz/sys/class/power_supplyz/proc/%s/smaps�proc_ioprio_get�proc_cpu_affinity_get�
SC_CLK_TCK���i �littlei�
AddressFamily�AF_LINK�r"c@seZdZdZdZdZdZdS)�
IOPriorityrrr;r"N)�__name__�
__module__�__qualname__r%r&r'r(�r@r@�B/opt/alt/python37/lib64/python3.7/site-packages/psutil/_pslinux.pyr<wsr<)�R�S�D�T�t�Z�X�x�K�W�I�P)Z01Z02Z03Z04Z05Z06Z07Z08Z09Z0AZ0B�svmem�total�	available�percent�used�free�active�inactive�buffers�cached�shared�slab�sdiskio�
read_count�write_count�
read_bytes�write_bytes�	read_time�
write_timeZread_merged_countZwrite_merged_count�	busy_time�	popenfile�path�fd�position�mode�flags�pmemz"rss vms shared text lib data dirty�pfullmem)�uss�pss�swap�
pmmap_grouped�rss�sizerkZshared_cleanZshared_dirtyZ
private_cleanZ
private_dirtyZ
referencedZ	anonymousrl�	pmmap_extzaddr perms � �pioZ
read_charsZwrite_chars�	pcputimes�user�system�
children_user�children_system�iowaitcCsLt|t�st|��t�|�}|�d�d}|�d�rHt|�sH|dd�}|S)zWrapper around os.readlink().�rz
 (deleted)Ni����)�
isinstancer�AssertionError�os�readlink�split�endswithr)rcr@r@rAr}�s
r}cCsXtjdtjdtjdi}||tjtjBtjB@}|tj@rH|�ddd�}|�dd�}|S)zZConvert file's open() flags into a readable string.
    Used by Process.open_files().
    �r�wzw+�arzr+)r|�O_RDONLY�O_WRONLY�O_RDWR�O_APPEND�replace)rgZ	modes_maprfr@r@rA�file_flags_to_mode�s
r�cCs4|�dd�}d}|rd|}nd|}t�|tj�S)z�Return True if the given name refers to a root device (e.g.
    "sda", "nvme0n1") as opposed to a logical partition (e.g.  "sda1",
    "nvme0n1p1"). If name is a virtual device (e.g. "loop1", "ram")
    return True.
    �/�!Tz
/sys/block/%sz/sys/block/%s/device)r�r|�access�F_OK)�nameZincluding_virtualrcr@r@rA�is_storage_device�s

r�c	Cs�td|��}|����dd�}WdQRXdddddd	d
g}t|�}|dkrX|�d�|d
krj|�d�|dkr||�d�td|�adS)z�Set a namedtuple of variable fields depending on the CPU times
    available on this Linux kernel version which may be:
    (user, nice, system, idle, iowait, irq, softirq, [steal, [guest,
     [guest_nice]]])
    Used by cpu_times() function.
    z%s/statrNrt�niceru�idlerxZirqZsoftirq�Zsteal�	Zguest�
Z
guest_nice�	scputimes)r�readliner~�len�appendrr�)�procfs_path�f�values�fieldsZvlenr@r@rA�set_scputimes_ntuples	


r�Tc	CsXy,|rt|�nt|��}|����SQRXWn&ttfk
rR|tk	rL|S�YnXdS)z�Return file content.
    fallback: the value returned in case the file does not exist or
              cannot be read
    binary: whether to open the file in binary or text mode.
    N)rr�read�strip�IOError�OSError�_DEFAULT)�fname�fallback�binaryr�r@r@rA�catsr�z/procr�zuser system idleg)�prlimit)�	use_errnor�cCs�Gdd�dtj�}|�}|dkr8t�||dt�|��}n6|�}|d|_|d|_t�||t�|�t�|��}|dkr�t��}t|t	�
|���|j|jfS)Nc@s eZdZdejfdejfgZdS)zprlimit.<locals>.StructRlimit�rlim_cur�rlim_maxN)r=r>r?�ctypes�
c_longlong�_fields_r@r@r@rA�StructRlimitJsr�rr)r��	Structure�libcr��byrefr�r��	get_errnor�r|�strerror)�pid�	resource_�limitsr��current�ret�new�errnor@r@rAr�Is

cCs"g|]}|�d�r|��r|�qS)ZRLIM)�
startswith�isupper)�.0rIr@r@rA�
<listcomp>bsr�c	Cs
|d}||�dd�}y|d}|d}|d}Wntk
rH|SXytdt��}Wntk
rp|SXd}|�:x2|D]*}|��}|�d�r�|t|��d	�7}q�WWd
QRX|t	9}||}	||}
|
t
|
d|�8}
|	|
7}	|	|t
|d|�7}	t|	�S)
a�Fallback for kernels < 3.14 where /proc/meminfo does not provide
    "MemAvailable:" column, see:
    https://blog.famzah.net/2014/09/24/
    This code reimplements the algorithm outlined here:
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
        commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773

    XXX: on recent kernels this calculation differs by ~1.5% than
    "MemAvailable:" as it's calculated slightly differently, see:
    https://gitlab.com/procps-ng/procps/issues/42
    https://github.com/famzah/linux-memavailable-procfs/issues/2
    It is still way more realistic than doing (free + cached) though.
    sMemFree:sCached:rs
Active(file):sInactive(file):s
SReclaimable:z%s/zoneinfoslowrNr;g@)�get�KeyErrorrr
r�r�r��intr~�PAGESIZE�min)�memsrSr�Zlru_active_fileZlru_inactive_fileZslab_reclaimabler�Z
watermark_low�line�availZ	pagecacher@r@rA�calculate_avail_vmemjs2

"r�cCs�g}i}tdt���4}x,|D]$}|��}t|d�d||d<qWWdQRX|d}|d}y|d}Wn"tk
r�d}|�d	�YnXy|d
}Wn"tk
r�d}|�d�YnX||�dd�7}y|d
}	WnHtk
�r$y|d}	Wn$tk
�rd}	|�d�YnXYnXy|d}
Wn$tk
�rVd}
|�d�YnXy|d}WnXtk
�r�y|d|d|d}Wn$tk
�r�d}|�d�YnXYnXy|d}Wntk
�r�d}YnX||||}
|
dk�r||}
y|d}Wntk
�r2t|�}YnX|dk�rLd}|�d�||k�rZ|}t|||dd�}|�r�dd�	|�t
|�dk�r�dndf}t�|t
�t||||
||
||||	|�S)a�Report virtual memory stats.
    This implementation matches "free" and "vmstat -s" cmdline
    utility values and procps-ng-3.3.12 source was used as a reference
    (2016-09-18):
    https://gitlab.com/procps-ng/procps/blob/
        24fd2605c51fccc375ab0287cec33aa767f06718/proc/sysinfo.c
    For reference, procps-ng-3.3.10 is the version available on Ubuntu
    16.04.

    Note about "available" memory: up until psutil 4.3 it was
    calculated as "avail = (free + buffers + cached)". Now
    "MemAvailable:" column (kernel 3.14) from /proc/meminfo is used as
    it's more accurate.
    That matches "available" column in newer versions of "free".
    z
%s/meminforirNs	MemTotal:sMemFree:sBuffers:rVsCached:rWs
SReclaimable:sShmem:s
MemShared:rXsActive:rTs	Inactive:sInact_dirty:sInact_clean:sInact_laundry:rUsSlab:s
MemAvailable:rP)�round_z6%s memory stats couldn't be determined and %s set to 0z, �was�were)rr
r~r�r�r�r�r�r�joinr��warnings�warn�RuntimeWarningrN)Zmissing_fieldsr�r�r�r�rOrSrVrWrXrTrUrYrRr�rQ�msgr@r@rA�virtual_memory�s�
&

	


r�c
Cs�i}tdt���4}x,|D]$}|��}t|d�d||d<qWWdQRXy|d}|d}Wn:tk
r�t��\}}}}}}}||9}||9}YnX||}t||dd�}	ytd	t��}WnDtk
�r}
z$d
t	|
�}t
�|t�d}}
Wdd}
~
XYn�X|��d}}
x�|D]j}|�
d��rJt|�d�d�d
d}n&|�
d��rpt|�d�d�d
d}
|dk	�r|
dk	�rP�qWd}t
�|t�d}}
WdQRXt�||||	||
�S)zReturn swap memory metrics.z
%s/meminforirNs
SwapTotal:s	SwapFree:)r�z	%s/vmstatzP'sin' and 'sout' swap memory stats couldn't be determined and were set to 0 (%s)spswpin� r#spswpoutzK'sin' and 'sout' swap memory stats couldn't be determined and were set to 0)rr
r~r�r��cextZ
linux_sysinforr��strr�r�r�r�r�sswap)r�r�r�r�rOrS�_Zunit_multiplierrRrQ�errr��sin�soutr@r@rA�swap_memorysD
&

r�c	Cs^t�}t|�td|��}|����}WdQRX|dttj�d�}dd�|D�}t|�S)z�Return a named tuple representing the following system-wide
    CPU times:
    (user, nice, system, idle, iowait, irq, softirq [steal, [guest,
     [guest_nice]]])
    Last 3 fields may not be available on all Linux kernel versions.
    z%s/statNrcSsg|]}t|�t�qSr@)�float�CLOCK_TICKS)r�rIr@r@rAr�^szcpu_times.<locals>.<listcomp>)r
r�rr�r~r�r��_fields)r�r�r�r�r@r@rA�	cpu_timesRsr�c	Cs�t�}t|�g}td|��d}|��xT|D]L}|�d�r.|��}|dttj�d�}dd�|D�}t|�}|�	|�q.W|SQRXdS)zfReturn a list of namedtuple representing the CPU times
    for every CPU available on the system.
    z%s/statscpurcSsg|]}t|�t�qSr@)r�r�)r�rIr@r@rAr�psz!per_cpu_times.<locals>.<listcomp>N)
r
r�rr�r�r~r�r�r�r�)r��cpusr�r�r�r��entryr@r@rA�
per_cpu_timesbs

r�cCs�y
t�d�Stk
r�d}tdt���*}x"|D]}|���d�r4|d7}q4WWdQRX|dkr�t�d�}t	dt���4}x,|D]$}|�
d	�d}|�|�r�|d7}q�WWdQRX|dkr�dS|SXdS)
z0Return the number of logical CPUs in the system.�SC_NPROCESSORS_ONLNrz
%s/cpuinfos	processorrNzcpu\dz%s/statrq)r|�sysconf�
ValueErrorrr
�lowerr��re�compilerr~�match)�numr�r��searchr@r@rA�cpu_count_logicalvs$




r�c
Cst�}d}d}xBt�|�p"t�|�D]*}t|��}|�|�����WdQRXq$Wt|�}|dkrf|Si}i}tdt���z}xr|D]j}|����}|s�y|d||d<Wnt	k
r�YnXi}q�|�
d�r�|�d	d
�\}	}
t|
�||	<q�WWdQRXt
|���}|�pdS)z2Return the number of physical cores in the system.z9/sys/devices/system/cpu/cpu[0-9]*/topology/core_cpus_listz?/sys/devices/system/cpu/cpu[0-9]*/topology/thread_siblings_listNrz
%s/cpuinfos	cpu coressphysical id)sphysical ids	cpu coress	:r)�set�globr�addr�r�r�r
r�r�r�r~r��sumr�)�ls�p1�p2rcr��result�mappingZcurrent_infor��key�valuer@r@rA�cpu_count_physical�s2
 

r�c	Cs�tdt����}d}d}d}xx|D]p}|�d�rBt|��d�}n6|�d�r^t|��d�}n|�d�rxt|��d�}|dk	r"|dk	r"|dk	r"Pq"WWdQRXd}t�||||�S)z*Return various CPU stats as a named tuple.z%s/statNsctxtrsintrssoftirqr)rr
r�r�r~r�	scpustats)r��ctx_switches�
interrupts�soft_interruptsr��syscallsr@r@rA�	cpu_stats�s"



r�z'/sys/devices/system/cpu/cpufreq/policy0z$/sys/devices/system/cpu/cpu0/cpufreqcCs�dd�}g}x�tt��D]�}||�}|s*qtjj}t||d�dd�}|dkrnt||d�dd�}|dkrntd��t|�d}tt||d	���d}tt||d
���d}|�t	�
|||��qW|S)z�Return frequency metrics for all CPUs.
        Contrarily to other OSes, Linux updates these values in
        real-time.
        cSs.x(d|d|fD]}tj�|�r|SqWdS)Nz(/sys/devices/system/cpu/cpufreq/policy%sz%/sys/devices/system/cpu/cpu%s/cpufreq)r|rc�exists)r��pr@r@rA�get_path�szcpu_freq.<locals>.get_pathZscaling_cur_freqN)r�Zcpuinfo_cur_freqz!can't find current frequency filei�Zscaling_max_freqZscaling_min_freq)�ranger�r|rcr�r��NotImplementedErrorr�r�r�scpufreq)r�r��nrcZpjoin�currZmax_Zmin_r@r@rA�cpu_freq�s$rz
/proc/cpuinfoc	Csfg}tdt���J}xB|D]:}|���d�r|�dd�\}}|�t�t|�dd��qWWdQRX|S)z}Alternate implementation using /proc/cpuinfo.
        min and max frequencies are not available and are set to None.
        z
%s/cpuinfoscpu mhz�:rgN)	rr
r�r�r~r�rrr�)r�r�r�r�r�r@r@rAr�s
&cCsgS)zGDummy implementation when none of the above files are present.
        r@r@r@r@rArsc@seZdZdS)�_Ipv6UnsupportedErrorN)r=r>r?r@r@r@rArsrc@sZeZdZdZdd�Zdd�Zdd�Zedd	��Zeddd��Z	edd
d��Z
ddd�Zd
S)�ConnectionsawA wrapper on top of /proc/net/* files, retrieving per-process
    and system-wide open connections (TCP, UDP, UNIX) similarly to
    "netstat -an".

    Note: in case of UNIX sockets we're only able to determine the
    local endpoint/path, not the one it's connected to.
    According to [1] it would be possible but not easily.

    [1] http://serverfault.com/a/417946
    cCs�dtjtjf}dtjtjf}dtjtjf}dtjtjf}dtjdf}|||||f||f|f|f||f|f|f|f||||f||f||fd�|_d|_dS)N�tcp�tcp6�udp�udp6�unix)�allr�tcp4r	r
�udp4rr�inet�inet4�inet6)�socket�AF_INET�SOCK_STREAM�AF_INET6�
SOCK_DGRAM�AF_UNIX�tmap�_procfs_path)�selfrr	rrrr@r@rA�__init__ s"
zConnections.__init__cCs�tt�}x�t�d|j|f�D]�}ytd|j||f�}WnJttfk
rTwYqtk
r�}z|j	t	j
krrw�Wdd}~XYqX|�d�r|dd�dd�}||�|t
|�f�qW|S)Nz%s/%s/fdz%s/%s/fd/%szsocket:[r�r7)r�listr|�listdirrr}rr r�r��EINVALr�r�r�)rr��inodesrd�inoder�r@r@rA�get_proc_inodes7s
zConnections.get_proc_inodescCsJi}x@t�D]6}y|�|�|��Wqtttfk
r@wYqXqW|S)N)�pids�updater"rr r)rr r�r@r@rA�get_all_inodesMszConnections.get_all_inodesc	Cs�|�d�\}}t|d�}|s dStr.|�d�}|tjkrntrZt�|t�	|�ddd��}q�t�|t�	|��}nxt�	|�}yJtr�t�tj
tjd	t�
d|����}n t�tj
tjd
t�
d|����}Wn"tk
r�t�s�t�n�YnXt�||�S)a�Accept an "ip:port" address as displayed in /proc/net/*
        and convert it into a human readable form, like:

        "0500000A:0016" -> ("10.0.0.5", 22)
        "0000000000000000FFFF00000100007F:9E49" -> ("::ffff:127.0.0.1", 40521)

        The IP address portion is a little or big endian four-byte
        hexadecimal number; that is, the least significant byte is listed
        first, so we need to reverse the order of the bytes to convert it
        to an IP address.
        The port is represented as a two-byte hexadecimal number.

        Reference:
        http://linuxdevcenter.com/pub/a/linux/2000/11/16/LinuxAdmin.html
        �:�r@�asciiNr7�>4I�<4I)r))r*)r~r�r!�encoderr�
LITTLE_ENDIAN�	inet_ntop�base64�	b16decoder�struct�pack�unpackr�rrr�addr)r3�family�ip�portr@r@rA�decode_address]s0



zConnections.decode_addressNccsD|�d�rtj�|�sdSt|td���}|���xt|d�D]�\}}y(|��dd�\
}}	}
}}}}}}}Wn&t	k
r�t
d|||f��YnX||kr�||d\}
}nd\}
}|dk	r�||
kr�q@q@|tjkr�t
|}ntj}yt�|	|�}	t�|
|�}
Wntk
�rw@YnX||||	|
||
fVq@WWdQRXdS)	z.Parse /proc/net/tcp* and /proc/net/udp* files.�6N)�	bufferingrr�z,error while parsing %s; malformed line %s %rr)Nr7)rr|rcr�r�BIGFILE_BUFFERINGr��	enumerater~r��RuntimeErrorrr�TCP_STATUSESr�	CONN_NONErr7r)�filer4�type_r �
filter_pidr��linenor�r��laddr�raddr�statusr!r�rdr@r@rA�process_inet�s2(

zConnections.process_inetc
cst|td���}|��x�|D]�}|��}y|dd�\}}}}}}}	Wn.tk
rtd|kr`wtd||f��YnX|	|kr�||	}
ndg}
xj|
D]b\}}|dk	r�||kr�q�q�t|�dkr�|d	}
nd
}
t�t	|��}d
}tj
}||||
|||fVq�WqWWdQRXdS)zParse /proc/net/unix files.)r9r�rqz)error while parsing %s; malformed line %r)Nr7Nr�r7�)rr:r�r~r�r<r�r�socktype_to_enumr�r>)r?r4r rAr�r��tokensr�r@r!�pairsr�rdrcrDrEr@r@rA�process_unix�s2


zConnections.process_unixcCs||jkr,td|d�dd�|jD��f��t�|_|dk	rP|�|�}|sXgSn|��}t�}x�|j|D]�\}}}d|j|f}|tj	tj
fkr�|j|||||d�}	n|j||||d�}	xT|	D]L\}
}}}}}
}|r�t
�|
|||||
�}nt
�|
|||||
|�}|�|�q�WqjWt|�S)Nz+invalid %r kind argument; choose between %sz, cSsg|]}t|��qSr@)�repr)r�rIr@r@rAr��sz(Connections.retrieve.<locals>.<listcomp>z	%s/net/%s)rA)rr�r�r
rr"r%r�rrrrFrLr�pconn�sconnr�r)r�kindr�r r�Z
proto_namer4r@rcr�rdrCrDrEZ	bound_pidZconnr@r@rA�retrieve�s2

zConnections.retrieve)N)N)N)r=r>r?�__doc__rr"r%�staticmethodr7rFrLrQr@r@r@rArs
3'%rrcCs
t�|�S)z$Return system-wide open connections.)�_connectionsrQ)rPr@r@rA�net_connectionssrUcCs�tdt���}|��}WdQRXi}x�|dd�D]�}|�d�}|dksVtt|���|d|���}||dd�����}tt	|�\}}}	}
}}}
}}}}}}}}}|||||	||
|f||<q4W|S)zsReturn network I/O statistics for every network interface
    installed on the system as a dict of raw tuples.
    z
%s/net/devNr;r&rr)
rr
�	readlines�rfindr{rMr�r~�mapr�)r��lines�retdictr��colonr�r��
bytes_recv�packets_recv�errin�dropinZfifoinZframeinZcompressedinZmulticastin�
bytes_sent�packets_sent�errout�dropoutZfifooutZ
collisionsoutZ
carrieroutZ
compressedoutr@r@rA�net_io_counterss
*rdc	Cs�tjttjttjti}t���}i}x||D]t}y&t	�
|�}t	�|�}t�|�\}}Wn0t
k
r�}z|jtjkrt�Wdd}~XYq*Xt�|||||�||<q*W|S)z)Get NIC stats (isup, duplex, speed, mtu).N)r�ZDUPLEX_FULLrZDUPLEX_HALFrZDUPLEX_UNKNOWNrrd�keys�
cext_posixZ
net_if_mtuZnet_if_is_runningZnet_if_duplex_speedr�r�ZENODEVr�	snicstats)	Z
duplex_map�namesr�r��mtu�isup�duplex�speedr�r@r@rA�net_if_stats+s




rmFcCs�dd�}dd�}tj�dt��r*|�}n"tj�d�r>|�}ntdt���i}x\|D]T}|\
}}}}	}
}}}
}}|s�t|�s�qV|	t9}	|
t9}
|||	|
|||
||f	||<qVW|S)zcReturn disk I/O statistics for every disk installed on the
    system as a dict of raw tuples.
    css6tdt���}|��}WdQRX�x|D�]}|��}t|�}|dkr�|d}t|d�}tt|dd��\
}}}	}
}}}
}}}n�|dks�|dkr�|d}tt|dd��\}}}}	}
}}}
}}}nN|dk�r|d}tt|dd��\}}}
}d	}	}
}}}ntd
|��|||
|||	|
|||f
Vq*WdS)Nz%s/diskstats�r"r;r#��rGrz!not sure how to interpret line %r)rr
rVr~r�r�rXr�)r�rYr�r�Zflenr��reads�reads_merged�rbytes�rtime�writes�
writes_merged�wbytes�wtimer�rar@r@rA�read_procfsLs&(*
z%disk_io_counters.<locals>.read_procfscss�x�t�d�D]�}x�t�tj�d|��D]�\}}}d|kr:q&ttj�|d���}|������}WdQRXtj�	|�}t
t|dd��\
}}}	}
}}}
}}}||||	|
|
||||f
Vq&WqWdS)Nz
/sys/block�statr�)r|r�walkrcr�rr�r�r~�basenamerXr�)�block�rootr��filesr�r�r�rqrrrsrtrurvrwrxrar@r@rA�
read_sysfsws &z$disk_io_counters.<locals>.read_sysfsz%s/diskstatsz
/sys/blockzC%s/diskstats nor /sys/block filesystem are available on this system)r|rcr�r
rr��DISK_SECTOR_SIZE)Zperdiskryr��genrZr�r�rqrursrwrtrxrrrvrar@r@rA�disk_io_countersHs&+


r�c	Cst�}t�}td|��V}xN|D]F}|��}|�d�sF|�|���q |�d�d}|dkr |�d�q WWdQRX|dkr�tj�	d�r�tj�
d�}ntj�
d	|�}g}t�|�}x`|D]X}	|	\}
}}}|
d
kr�d}
|s�|
dks�||kr�q�d}
}t
�|
||||
|�}|�|�q�W|S)z8Return mounted disk partitions as a list of namedtuples.z%s/filesystemsZnodev�	rZzfsNz/procz	/etc/mtabz%s/self/mountsZnonerH)r�r
rr�r�r�r~r|rc�isfile�realpathr��disk_partitionsr�	sdiskpartr�)r
Zfstypesr�r�r��fstypeZmounts_path�retlist�
partitions�	partition�device�
mountpoint�opts�maxfile�maxpath�ntupler@r@rAr��s6



r�cCstt�t�}t�d�}|�t�d��ttdd�|D���}t�d�}t�d�}x*|D]"}|�	d|�}||krT|�
|�qTW�x|D�]}y>|d}tt|��d	}t
j�t
j�|�d
�}t|dd�}	Wntttfk
r�w�YnXt|d
dd�}
t|ddd�}t|dddd�}|
dk	�rLyt|
�d	}
Wntk
�rJd}
YnX|dk	�r�yt|�d	}Wntk
�r�d}YnX||	�
|||
|f�q�W|�slt�d�}tt|��}�x�|D�]�}y<t
j�|d�}tt|��d	}t
j�|d�}t|dd�}	Wn>tttfk
�r@}
ztd|
|f��w�Wdd}
~
XYnXt�|d�}tdd�|D��}d}d}
x�|D]�}t
j�||d�}t|ddd�}|dk�r�tt
j�||d�dd�}n$|dk�r�tt
j�||d�dd�}
|
dk	�ryt|
�d	}
Wntk
�rd}
YnX|dk	�rpyt|�d	}Wntk
�rHd}YnX�qpW||	�
d||
|f��q�Wt|�S)a�Return hardware (CPU and others) temperatures as a dict
    including hardware name, label, current, max and critical
    temperatures.

    Implementation notes:
    - /sys/class/hwmon looks like the most recent interface to
      retrieve this info, and this implementation relies on it
      only (old distros will probably use something else)
    - lm-sensors on Ubuntu 16.04 relies on /sys/class/hwmon
    - /sys/class/thermal/thermal_zone* is another one but it's more
      difficult to parse
    z/sys/class/hwmon/hwmon*/temp*_*z&/sys/class/hwmon/hwmon*/device/temp*_*cSsg|]}|�d�d�qS)r�r)r~)r�rIr@r@rAr��sz(sensors_temperatures.<locals>.<listcomp>z5/sys/devices/platform/coretemp.*/hwmon/hwmon*/temp*_*z'/sys/devices/platform/coretemp.*/hwmon/z/sys/class/hwmon/�_inputg@�@r�F)r�Z_maxN)r�Z_crit�_labelrH)r�r�z /sys/class/thermal/thermal_zone*�temp�typezignoring %r for file %rz/trip_point*cSs,g|]$}d�tj�|��d�dd���qS)r�rr")r�r|rcr|r~)r�r�r@r@rAr�%sZ_type�critical�_temp�high)�collectionsrrr��extend�sortedr�r�r��subr�r�r�r|rcr��dirnamer�r�r�r�dict)r��	basenamesZ
basenames2�replr�Zaltname�basercr��	unit_namer�r��labelr�Z
trip_pathsZtrip_pointsZ
trip_pointZ	trip_typer@r@rA�sensors_temperatures�s�



	












r�cCs�t�t�}t�d�}|s"t�d�}ttdd�|D���}x�|D]�}ytt|d��}Wn8tt	fk
r�}zt
�d|t�w>Wdd}~XYnXtt
j�t
j�|�d�d	d
�}t|ddd	d
�}||�t�||��q>Wt|�S)a�Return hardware fans info (for CPU and other peripherals) as a
    dict including hardware label and current speed.

    Implementation notes:
    - /sys/class/hwmon looks like the most recent interface to
      retrieve this info, and this implementation relies on it
      only (old distros will probably use something else)
    - lm-sensors on Ubuntu 16.04 relies on /sys/class/hwmon
    z/sys/class/hwmon/hwmon*/fan*_*z%/sys/class/hwmon/hwmon*/device/fan*_*cSsg|]}|�d�d�qS)r�r)r~)r�rIr@r@rAr�Tsz sensors_fans.<locals>.<listcomp>r�zignoring %rNr�F)r�r�rH)r�r�)r�rrr�r�r�r�r�r�r�r�r�r�r|rcr�r�r�r�sfanr�)r�r�r�r�r�r�r�r@r@rA�sensors_fansCs 




r�cs�t���fdd�}dd�t�t�D�}|s.dStj�tt|�d�}||d|d�}||d	|d
�}||d|d�}||d
�}|dk	r�|dk	r�yd||}Wq�tk
r�d}Yq�Xn tt	|ddd��}|dkr�dSd}|tj�td�tj�td��}	|	dk	�r|	dk}n4t	|dddd��
�}
|
dk�r>d}n|
dk�rLd}|�rZtj}nv|dk	�r�|dk	�r�yt||d�}Wntk
�r�tj
}YnXn.|dk	�r�t|d�}|dk�r�tj
}ntj
}t�|||�S)aReturn battery information.
    Implementation note: it appears /sys/class/power_supply/BAT0/
    directory structure may vary and provide files with the same
    meaning but under different names, see:
    https://github.com/giampaolo/psutil/issues/966
    cs:x4|D],}t|�d�}|�kr|��r.t|�S|SqWdS)zvAttempt to read the content of multiple files which may
        not exist. If none of them exist return None.
        )r�N)r��isdigitr�)�pathsrcr�)�nullr@rA�	multi_catls

z"sensors_battery.<locals>.multi_catcSs&g|]}|�d�sd|��kr|�qS)ZBATZbattery)r�r�)r�rIr@r@rAr�vsz#sensors_battery.<locals>.<listcomp>Nrz/energy_nowz/charge_nowz
/power_nowz/current_nowz/energy_fullz/charge_fullz/time_to_empty_nowgY@gz	/capacityr7)r�z
AC0/onlinez	AC/onlinerz/statusrHF)r�r�Zdischarging)Zcharging�fullTi�<)�objectr|r�POWER_SUPPLY_PATHrcr�r��ZeroDivisionErrorr�r�r�r�POWER_TIME_UNLIMITED�POWER_TIME_UNKNOWN�sbattery)r�Zbatsr~Z
energy_nowZ	power_nowZenergy_fullZ
time_to_emptyrQ�
power_pluggedZonlinerE�secsleftr@)r�rA�sensors_batterycs`









r�c
Cs`g}t��}xN|D]F}|\}}}}}}|s,q|dkr8d}t�||pDd|||�}	|�|	�qW|S)z:Return currently connected users as a list of namedtuples.)z:0.0z:0Z	localhostN)r��usersr�suserr�)
r�Zrawlist�itemrt�tty�hostnameZtstampZuser_processr��ntr@r@rAr��s
r�c	Csbdt�}t|��F}x2|D]*}|�d�rt|����d�}|a|SqWtd|��WdQRXdS)zAReturn the system boot time expressed in seconds since the epoch.z%s/statsbtimerzline 'btime' not found in %sN)r
rr�r�r�r~�	BOOT_TIMEr<)rcr�r�r�r@r@rA�	boot_time�s



r�cCsdd�t�tt���D�S)z7Returns a list of PIDs currently running on the system.cSsg|]}|��rt|��qSr@)r�r�)r�rIr@r@rAr��szpids.<locals>.<listcomp>)r|rrr
r@r@r@rAr#�sr#c	Cs�t�|�sdSybdt�|f}t|��B}x.|D]&}|�d�r.t|��d�}||kSq.Wtd|��WdQRXWnttfk
r�|t	�kSXdS)zcCheck for the existence of a unix PID. Linux TIDs are not
    supported (always return False).
    Fz%s/%s/statussTgid:rz'Tgid' line not found in %sN)
r�
pid_existsr
rr�r�r~r��EnvironmentErrorr#)r�rcr�r�Ztgidr@r@rAr��s




r�c
Cs�i}t�}x�t�D]x}y(td||f��}|��}WdQRXWnttfk
rVYqX|�d�}||dd���}t|d�}|||<qW|S)zsObtain a {pid: ppid, ...} dict for all running processes in
    one shot. Used to speed up Process.children().
    z
%s/%s/statN�)r;r)	r
r#rr�rr rWr~r�)r�r�r�r��data�rparZdset�ppidr@r@rA�ppid_maps
r�cst����fdd��}|S)zlDecorator which translates bare OSError and IOError exceptions
    into NoSuchProcess and AccessDenied.
    cs�y�|f|�|�Stk
r2t|j|j��Yn\tk
rRt|j|j��Yn<tk
r�tj�	d|j
|jf�s�t|j|j���YnXdS)Nz%s/%s)rr
r��_namer rrr|rcr�r)r�args�kwargs)�funr@rA�wrapper%sz wrap_exceptions.<locals>.wrapper)�	functools�wraps)r�r�r@)r�rA�wrap_exceptions!sr�c@steZdZdZdddddgZdd�Zd	d
�Zeedd���Z	eed
d���Z
eedd���Zdd�Zdd�Z
edd��Zdd�Zedd��Zedd��Zedd��Zej�de���r�ed d!��Zed"d#��Zed$d%��Zed`d'd(��Zed)d*��Zed+d,��Ze�r.ee�d-�e�d.�e�d/�fd0d1��Z neZ e�rDed2d3��Z!ed4d5��Z"ee�d6�fd7d8��Z#ee�d9�fd:d;��Z$ed<d=��Z%ed>d?��Z&ed@dA��Z'e(�r�edBdC��Z)e�dD�fdEdF�Z*edGdH��Z+e,�r�edIdJ��Z-edKdL��Z.e/d&k	�redadMdN��Z0edOdP��Z1edQdR��Z2edbdTdU��Z3edVdW��Z4edXdY��Z5ee�dZ�fd[d\��Z6ee�d]�fd^d_��Z7d&S)c�ProcesszLinux process implementation.r�r��_ppidr�_cachecCs||_d|_d|_t�|_dS)N)r�r�r�r
r)rr�r@r@rAr;szProcess.__init__cCst�d|j|jf�dS)z+Raise NSP if the process disappeared on us.z%s/%sN)r|rzrr�)rr@r@rA�
_assert_aliveAszProcess._assert_alivec	Cs�td|j|jf��}|��}WdQRX|�d�}||�d�d|�}||dd���}i}||d<|d|d	<|d|d
<|d|d<|d
|d<|d|d<|d|d<|d|d<|d|d<|d|d<|d|d<|S)aZParse /proc/{pid}/stat file and return a dict with various
        process info.
        Using "man proc" as a reference: where "man proc" refers to
        position N always substract 3 (e.g ppid position 4 in
        'man proc' == position 1 in here).
        The return value is cached in case oneshot() ctx manager is
        in use.
        z
%s/%s/statNr��(rr;r�rrEr�r#�ttynr��utime��stime�
�children_utimero�children_stime��create_time�$�cpu_num�'�blkio_ticks)rrr�r�rW�findr~)rr�r�r�r�r�r�r@r@rA�_parse_stat_fileGs$
zProcess._parse_stat_filec	Cs(td|j|jf��
}|��SQRXdS)z�Read /proc/{pid}/stat file and return its content.
        The return value is cached in case oneshot() ctx manager is
        in use.
        z%s/%s/statusN)rrr�r�)rr�r@r@rA�_read_status_filejszProcess._read_status_filec	Cs0td|j|jftd��}|����SQRXdS)Nz%s/%s/smaps)r9)rrr�r:r�r�)rr�r@r@rA�_read_smaps_filets
zProcess._read_smaps_filecCs(|j�|�|j�|�|j�|�dS)N)r��cache_activater�r�)rr@r@rA�
oneshot_enter{szProcess.oneshot_entercCs(|j�|�|j�|�|j�|�dS)N)r��cache_deactivater�r�)rr@r@rA�oneshot_exit�szProcess.oneshot_exitcCs|��d}trt|�}|S)Nr�)r�r!r)rr�r@r@rAr��szProcess.namec	Cs�ytd|j|jf�Sttfk
rttj�d|j|jf�rDdSt|j�s^t	|j|j
��nt|j|j
|j��Yn"t
k
r�t|j|j
��YnXdS)Nz	%s/%s/exez%s/%srH)r}rr�rr r|rc�lexistsr�rr�rr�rr
)rr@r@rA�exe�s
zProcess.exec	Cs�td|j|jf��}|��}WdQRX|s0gS|�d�r>dnd}|�|�rX|dd�}|�|�}|dkr�t|�dkr�d|kr�|�d�}|S)Nz
%s/%s/cmdlineryrqr7r)rrr�r�rr~r�)rr�r��sep�cmdliner@r@rAr��s


zProcess.cmdlinec	Cs0td|j|jf��}|��}WdQRXt|�S)Nz
%s/%s/environ)rrr�r�r)rr�r�r@r@rA�environ�szProcess.environcCs:t|��d�}t��}y||Stk
r4dSXdS)Nr�)r�r�rZget_terminal_mapr�)rZtty_nrrr@r@rA�terminal�szProcess.terminalz/proc/%s/ioc
Cs�d|j|jf}i}t|��V}xN|D]F}|��}|r$y|�d�\}}Wntk
r\w$Yq$Xt|�||<q$WWdQRX|s�td|��y*t|d|d|d|d|d|d	�St	k
r�}ztd
|d||f��Wdd}~XYnXdS)Nz%s/%s/ios: z%s file was emptyssyscrssyscws
read_bytesswrite_bytessrcharswcharz1%r field was not found in %s; found fields are %rr)
rr�rr�r~r�r�r<rrr�)rr�r�r�r�r�r�r�r@r@rA�io_counters�s0


zProcess.io_counterscCsh|��}t|d�t}t|d�t}t|d�t}t|d�t}t|d�t}t|||||�S)Nr�r�r�r�r�)r�r�r�rs)rr�r�r�r�r�rxr@r@rAr��szProcess.cpu_timescCst|��d�S)zWhat CPU the process is on.r�)r�r�)rr@r@rAr��szProcess.cpu_numNcCst�|j||j�S)N)rZwait_pidr�r�)r�timeoutr@r@rA�wait�szProcess.waitcCs&t|��d�}tpt�}|t|S)Nr�)r�r�r�r�r�)r�ctimeZbtr@r@rAr��s
zProcess.create_timec		Cs`td|j|jf��2}dd�|����dd�D�\}}}}}}}WdQRXt|||||||�S)Nz%s/%s/statmcSsg|]}t|�t�qSr@)r�r�)r�rIr@r@rAr�sz'Process.memory_info.<locals>.<listcomp>rG)rrr�r�r~rh)	rr�ZvmsrnrX�text�libr�Zdirtyr@r@rA�memory_infos
6zProcess.memory_infos\nPrivate.*:\s+(\d+)s\nPss\:\s+(\d+)s\nSwap\:\s+(\d+)c	Csj|��}|��}ttt|�|���d}ttt|�|���d}ttt|�|���d}t||||f�S)Ni)r�r�r�rXr��findallri)	rZ_private_reZ_pss_reZ_swap_reZ	basic_memZ
smaps_datarjrkrlr@r@rA�memory_full_infos
zProcess.memory_full_infocCsZdd�}|��}|sgS|�d�}g}|�d�}|g}�x|||�D�]\}}|�dd�}y|\}	}
}}}
}Wn*tk
r�|dg\}	}
}}}
}YnX|s�d}n2tr�t|�}|��}|�d	�r�t|�s�|dd
�}|�	t|	�t|
�||�
dd�|�
dd�|�
d
d�|�
dd�|�
dd�|�
dd�|�
dd�|�
dd�|�
dd�|�
dd�f
�qDW|S)aPReturn process's mapped memory regions as a list of named
            tuples. Fields are explained in 'man proc'; here is an updated
            (Apr 2012) version: http://goo.gl/fmebo

            /proc/{PID}/smaps does not exist on kernels < 2.6.14 or if
            CONFIG_MMU kernel configuration option is not enabled.
            c	ss�i}x�|D]�}|�dd�}|d�d�sB|��|fV|�|�q
yt|d�d||d<Wq
tk
r�|d�d�r�w
ntd|��Yq
Xq
W|��|fVdS)N�rrrisVmFlags:z#don't know how to interpret line %r)r~r�popr�r�r�r�)rY�
current_blockr�r�r�r@r@rA�
get_blocksEs
z'Process.memory_maps.<locals>.get_blocks�
rNr�rHz[anon]z
 (deleted)i����sRss:sSize:sPss:s
Shared_Clean:s
Shared_Dirty:sPrivate_Clean:sPrivate_Dirty:sReferenced:s
Anonymous:sSwap:)r�r~r�r�r!rr�rrr�r�)rr�r�rYr��
first_liner��headerZhfieldsr3Zperms�offset�devr!rcr@r@rA�memory_maps<sF	











zProcess.memory_mapsc	Cs^ytd|j|jf�Sttfk
rXt|j�sBt|j|j��nt|j|j|j	��YnXdS)Nz	%s/%s/cwd)
r}rr�rr r�rr�rr�)rr@r@rA�cwd�s
zProcess.cwdsctxt_switches:\t(\d+)cCsL|��}|�|�}|s,td|j|jf��nt�t|d�t|d��SdS)Nz�'voluntary_ctxt_switches' and 'nonvoluntary_ctxt_switches'lines were not found in %s/%s/status; the kernel is probably older than 2.6.23rr)r�r�rrr�r�pctxswr�)rZ	_ctxsw_rer�Zctxswr@r@rA�num_ctx_switches�s
zProcess.num_ctx_switchessThreads:\t(\d+)cCs|��}t|�|�d�S)Nr)r�r�r�)rZ_num_threads_rer�r@r@rA�num_threads�szProcess.num_threadsc
Cs�t�d|j|jf�}|��g}d}x�|D]�}d|j|j|f}y$t|��}|����}WdQRXWntk
r�d}w,YnX||�	d�dd�}|�
d�}t|d�t}	t|d	�t}
t
�t|�|	|
�}|�|�q,W|r�|��|S)
Nz
%s/%s/taskFz%s/%s/task/%s/statTr�r;r�r�r�)r|rrr��sortrr�r�rr�r~r�r�r�pthreadr�r�r�)rZ
thread_idsr��
hit_enoentZ	thread_idr�r��str�r�r�r�r@r@rA�threads�s,


zProcess.threadscCst�|j�S)N)rf�getpriorityr�)rr@r@rA�nice_get�szProcess.nice_getcCst�|j|�S)N)rf�setpriorityr�)rr�r@r@rA�nice_set�szProcess.nice_setcCst�|j�S)N)r�r5r�)rr@r@rA�cpu_affinity_get�szProcess.cpu_affinity_getsCpus_allowed_list:\t(\d+)-(\d+)cCsV|��}|�|�}|r@ttt|dd�t|dd�d��Stttt����SdS)Nrr)r�r�rr�r�r�r�)r�_rer�r�r@r@rA�_get_eligible_cpus�s

*zProcess._get_eligible_cpusc
Cs�yt�|j|�Wn�ttfk
r�}ztt|t�s>|jtjkr�|��}t	t
tt����}x<|D]4}||krztd||f��||kr^td||f��q^W�Wdd}~XYnXdS)Nz(invalid CPU number %r; choose between %sz0CPU number %r is not eligible; choose between %s)
r�Zproc_cpu_affinity_setr�r�r�rzr�rr�tupler�r�r�)rr�r�Z
eligible_cpusZall_cpusZcpur@r@rA�cpu_affinity_set�s 
zProcess.cpu_affinity_setcCs,t�|j�\}}tdk	r t|�}t�||�S)N)r�r4r��enumr<r�pionice)r�ioclassr�r@r@rA�
ionice_get�szProcess.ionice_getcCsP|dkrd}|r(|ttfkr(td|��|dks8|dkr@td��t�|j||�S)Nrz%r ioclass accepts no valuerGzvalue not in 0-7 range)r(r%r�r�Zproc_ioprio_setr�)rrr�r@r@rA�
ionice_set�szProcess.ionice_setc
Cs�|jdkrtd��yB|dkr(t|j|�St|�dkrDtdt|���t|j||�WnNtk
r�}z0|jtjkr�t|j�r�t	|j|j
|j��n�Wdd}~XYnXdS)Nrz)can't use prlimit() against PID 0 processr;z4second argument must be a (soft, hard) tuple, got %s)r�r�r�r�rMr�r�ZENOSYSr�rr�r�)rr�r�r�r@r@rA�rlimits
zProcess.rlimitcCs$|��d}tr|��}t�|d�S)NrE�?)r�r!r�
PROC_STATUSESr�)r�letterr@r@rArEszProcess.statusc
Cs\g}t�d|j|jf�}d}�x(|D�]}d|j|j|f}yt|�}WnNttfk
rhd}w&Yq&tk
r�}z|jtj	kr�w&�Wdd}~XYq&X|�
d�r&t|�r&d|j|j|f}yBt|��0}t
|����d�}	t
|����dd�}
WdQRXWntk
�rd}Yq&Xt|
�}t|t
|�t
|	�||
�}|�|�q&W|�rX|��|S)	Nz%s/%s/fdFz%s/%s/fd/%sTr�z%s/%s/fdinfo/%srr�)r|rrr�r}rr r�r�rr�rrr�r�r~r�rbr�r�)
rr�rrrdr?rcr�r��posrgrfr�r@r@rA�
open_files&s<
$
zProcess.open_filesrcCst�||j�}|��|S)N)rTrQr�r�)rrPr�r@r@rA�connectionsRszProcess.connectionscCstt�d|j|jf��S)Nz%s/%s/fd)r�r|rrr�)rr@r@rA�num_fdsXszProcess.num_fdscCst|��d�S)Nr�)r�r�)rr@r@rAr�\szProcess.ppidsUid:\t(\d+)\t(\d+)\t(\d+)cCs6|��}|�|�d\}}}t�t|�t|�t|��S)Nr)r�r�r�puidsr�)rZ_uids_rer��real�	effective�savedr@r@rA�uids`szProcess.uidssGid:\t(\d+)\t(\d+)\t(\d+)cCs6|��}|�|�d\}}}t�t|�t|�t|��S)Nr)r�r�r�pgidsr�)rZ_gids_rer�r"r#r$r@r@rA�gidsfszProcess.gids)N)N)r)8r=r>r?rR�	__slots__rr�r�rr�r�r�r�r�r�r�r�r�r�r|rcr��getpidr�r�r�r�r�r��	HAS_SMAPSr�r�r�rrrrr
rr�HAS_CPU_AFFINITYrrr�HAS_PROC_IO_PRIORITYrrr�rrErrr r�r%r'r@r@r@rAr�6sz"	

D		

,r�)N)r)F)F)�rR�
__future__rr.r�r�r�r�r|r�rr0�sys�	tracebackr�rrrHrrrr�r	rfr
rrr
rrrrrrrrrrrrrr�_compatrrrrr r!�version_inforZ__extra__all__r�rcr�r)r*�hasattrr,r+r�r�r�r�Zgetpagesizer�r�r:�	byteorderr,r��	AF_PACKETr:�IntEnumr�r9r%r&r'r(r<�globalsr$�__members__�STATUS_RUNNING�STATUS_SLEEPING�STATUS_DISK_SLEEP�STATUS_STOPPED�STATUS_TRACING_STOP�
STATUS_ZOMBIE�STATUS_DEAD�STATUS_WAKE_KILL�
STATUS_WAKING�STATUS_IDLE�
STATUS_PARKEDrr)r*r+r,r-r.r/r0r1r2r3r=rNrZrbrhr�rirmr�rprrrsr}r�r�r�r��	Exception�	print_excr�r��resource�ImportErrorr��CDLLr�r��dirr�r�r�r�r�r�r�r�rZnet_if_addrsrrrTrUrdrm�
disk_usager�r�r�r�r�r�r�r#r�r�r�r�r@r@r@rA�<module>sf
















4z:*
 

k
%
_
+q ^ 

?>