mfmdZddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm Z ddl m Z dd l m Z dd l mZdd l mZdd l mZdd l mZddl mZejdkrddlZndZgdZdZe9eedr-ejdedejDZdZndZddejeedejeej efdZ!dZ"edZ#dS)z%Routines common to all posix systems.N)memoize) sdiskusageTimeoutExpired) usage_percent)ChildProcessError)FileNotFoundError)InterruptedError)PermissionError)ProcessLookupError)PY3)unicode)) pid_existswait_pid disk_usageget_terminal_mapc||dkrdS tj|ddS#t$rYdSt$rYdSwxYw)z6Check whether pid exists in the current process table.rTF)oskillr r )pids F/opt/imunify360/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#<s#FFF!AFQWH-FFFcF t|S#t$r|cYSwxYw)z+Convert a negative signal value to an enum.)r ValueErrornums rnegsig_to_enumr)>s7 S>> !   JJJ s   c|S)Nrr's rr)r)Es 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)rrg{Gz?r)interval_min_sleep_timerr proc_namestop_attimeouts rsleepzwait_pid..sleephsU  vxx7""$W#IFFFFxtHqL$'''r$Tzunknown process exit status %r) r&rWNOHANGwaitpid WIFEXITED WEXITSTATUS WIFSIGNALEDr)WTERMSIGr r )rr5r3_waitpidr2r0r1 _pid_existsr/flagsr6retpidstatusr4s``` ``` @rrrIs. 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+ctrtj|}n tj|}ns#t$rft |t rM |tj}n#t$rYnwxYwtj|}nYnwxYw|j |j z}|j |j z}|j |j z}||z }||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)rrstatvfsUnicodeEncodeError isinstancerencodesysgetfilesystemencodingf_blocksf_frsizef_bfreef_bavailrr)pathstrD avail_to_root avail_to_userrE total_userusage_percent_users rrrs<  Z   D!!BB!   $(( ;;s'@'B'BCCDD)DZ%%  [2; &EZ"+-M[2;.M M !D %J'tZBBB $] path as a dict. Used by Process.terminal() z /dev/tty*z /dev/pts/*)globrstatst_rdevr )retlsrs rrrs C ;  $)L"9"9 9B3 )-C % & &     D  JsA A)(A))$__doc__rYrsignalrLtime_commonrrrr_compatr r r r r rr version_infoenum__all__rhasattrIntEnumdictrrr)r8getattrminr6rrrrr$rrks+ ,+ ######""""""&&&&&&&&&&&&%%%%%%$$$$$$''''''vKKKK D G F F0 22 TTFFv~FFFGGIII$jGD+ty99J# ULULULULp.P.P.Pb       r$