bg5 dZddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm Z ddlm Z dd l m Z dd l mZdd l mZdd l mZdd l mZddl mZddl mZerddlmZejdkrddlZndZgdZdZe9eedr-ejdedejDZdZndZddej e!edeje"ej#efdZ$dZ%e dZ&dS)z%Routines common to all posix systems.N)MACOSTimeoutExpired)memoize) sdiskusage) usage_percent)PY3)ChildProcessError)FileNotFoundError)InterruptedError)PermissionError)ProcessLookupError)unicode) _psutil_osx)) pid_existswait_pid disk_usageget_terminal_mapc||dkrdS tj|ddS#t$rYdSt$rYdSwxYw)z6Check whether pid exists in the current process table.rTF)oskillrr)pids F/opt/cloudlinux/venv/lib64/python3.11/site-packages/psutil/_psposix.pyrr(sj axx t  Qt uu tts! ; ;;Signals Negsignalc,g|]}|j|j fS)namevalue).0xs r r%Bs#FFF!AFQWH-FFFcF t|S#t$r|cYSwxYw)z+Convert a negative signal value to an enum.)r ValueErrornums rnegsig_to_enumr+Ds7 S>> !   JJJ s   c|S)Nr r)s rr+r+Ks r& monotonicc^ dkrtdd}d} | tjz} z  fd} tj| \} } | dkr | |},tj| rtj| Stj| r"ttj|  Std| z#t$r| |}Yn1t$r%|r| |}|YdSwxYw)aWait for a process PID to terminate. If the process terminated normally by calling exit(3) or _exit(2), or by returning from main(), the return value is the positive integer passed to *exit(). If it was terminated by a signal it returns the negated value of the signal which caused the termination (e.g. -SIGTERM). If PID is not a children of os.getpid() (current process) just wait until the process disappears and return None. If PID does not exist at all return None immediately. If *timeout* != None and process is still alive raise TimeoutExpired. timeout=0 is also possible (either return immediately or raise). rzcan't wait for PID 0g-C6?Nc| krt||dzdS)N)rr!g{Gz?r)interval_min_sleep_timerr proc_namestop_attimeouts rsleepzwait_pid..sleepnsU  vxx7""$W#IFFFFxtHqL$'''r&Tzunknown process exit status %r) r(rWNOHANGwaitpid WIFEXITED WEXITSTATUS WIFSIGNALEDr+WTERMSIGr r )rr7r5_waitpidr4r2r3 _pid_existsr1flagsr8retpidstatusr6s``` ``` @rrrOs. axx/000H E &((W$(((((((((((-L, LZU33NFF{{ 5??f%% L~f---'' L&r{6':':&:;;;"!!AF!JKKKU  ' ' 'uXHHH   +c"" + 5??+c"" + FF  -Ls C&&D+=*D+*D+c<trtj|}n tj|}ns#t$rft |t rM |tj}n#t$rYnwxYwtj|}nYnwxYw|j |j z}|j |j z}|j |j z}||z }trtj||}||z}t!||d}t#||||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. r)round_)totalusedfreepercent)r rstatvfsUnicodeEncodeError isinstancerencodesysgetfilesystemencodingf_blocksf_frsizef_bfreef_bavailrrdisk_usage_usedr r)pathstrF avail_to_root avail_to_userrG total_userusage_percent_users rrrsV  Z   D!!BB!   $(( ;;s'@'B'BCCDD)DZ%%  [2; &EZ"+-M[2;.M M !D 7*466 %J'tZBBB $] path as a dict. Used by Process.terminal() z /dev/tty*z /dev/pts/*)globrstatst_rdevr )retlsr!s rrrs C ;  $)L"9"9 9B3 )-C % & &     D  JsA A)(A))'__doc__r\rsignalrNtime_commonrrrrr _compatr r r r rrrr version_infoenum__all__rhasattrIntEnumdictrrr+r:getattrminr8rrrr r&rros[ ,+ ######""""""&&&&&&&&&&&&%%%%%%$$$$$$'''''' vKKKK D G F F0 22 TTFFv~FFFGGIII$jGD+ty99J# ULULULULp1P1P1Ph       r&