MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/alt/python35/lib64/python3.5/site-packages/psutil/__pycache__/_psposix.cpython-35.opt-1.pyc


Cs[��@s�dZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddl
mZdd	l
mZd
ddd
gZdd
�Zdddd�Zdd�Zedd
��ZdS)z%Routines common to all posix systems.�N�)�memoize)�
sdiskusage)�
usage_percent)�PY3)�unicode)�TimeoutExpired�
pid_exists�wait_pid�
disk_usage�get_terminal_mapcCs�|dkrdSytj|d�WnWtk
r}}z7|jtjkrOdS|jtjkredS|�WYdd}~XnXdSdS)z6Check whether pid exists in the current process table.rTFN)�os�kill�OSError�errnoZESRCH�EPERM)�pid�err�r�/_psposix.pyr	sc	s������fdd�}ttdtj���dk	ra�fdd�}����n�fdd�}d}xy|�\}}Wn�tk
r}zg|jtjkr�||�}w|n>|jtjkrx)t��r�||�}q�dSq�Wn�WYdd}~Xq|X|d	kr4||�}q|tj|�rQtj	|�Stj
|�rmtj|�Std
|��q|WdS)aIWait for process with pid 'pid' to terminate and return its
    exit status code as an integer.

    If pid is not a children of os.getpid() (current process) just
    waits until the process disappears and return None.

    If pid does not exist at all return None immediately.

    Raise TimeoutExpired on timeout expired.
    csQ�dk	r3���kr3t�d�d���tj|�t|dd�S)Nr�name�g{�G�z�?)r�time�sleep�min)�delay)r�	proc_name�stop_at�timeout�timerrr�
check_timeout?s

zwait_pid.<locals>.check_timeout�	monotonicNcstj�tj�S)N)r
�waitpid�WNOHANGr)rrr�waitcallHszwait_pid.<locals>.waitcallcstj�d�S)Nr)r
r"r)rrrr$Lsg-C��6?rzunknown process exit status %r)
�getattrrrrZEINTRZECHILDr	r
�WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS�
ValueError)	rrrr r$rZretpid�statusrr)rrrrrrr
4s8
cCs
trtj|�}nzytj|�}Wndtk
r�t|t�r�y|jtj��}Wntk
rwYnXtj|�}n�YnX|j	|j
}|j|j
}|j|j
}||}||}t
||dd�}td|d|d|d|�S)a.Return disk usage associated with path.
    Note: UNIX usually reserves 5% disk space which is not accessible
    by user. In this function "total" and "used" values reflect the
    total and used disk space whereas "free" and "percent" represent
    the "free" and "used percent" user disk space.
    Zround_r�total�used�freeZpercent)rr
�statvfs�UnicodeEncodeError�
isinstancer�encode�sys�getfilesystemencoding�f_blocks�f_frsize�f_bfree�f_bavailrr)�path�str,Z
avail_to_rootZ
avail_to_userr-Z
total_userZusage_percent_userrrrrws(



cCs�i}tjd�tjd�}xe|D]]}y||tj|�j<Wq)tk
r�}z|jtjkrs�WYdd}~Xq)Xq)W|S)zMGet a map of device-id -> path as a dict.
    Used by Process.terminal()
    z	/dev/tty*z
/dev/pts/*N)�globr
�stat�st_rdevrr�ENOENT)ZretZlsrrrrrr�s
)�__doc__rr;r
r3rZ_commonrrrZ_compatrr�_exceptionsr�__all__r	r
rrrrrr�<module>s C1