grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a MÝ_mã@sZdZddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm Z ddl m Z dd l m Z dd l mZdd l mZdd l mZdd l mZddl mZejdkrÄddlZndZgd¢Zdd„Zedu�reedƒ�re dedd„ejDƒƒ¡Zdd„Zndd„Zddejeedejƒeej efdd„Z!dd„Z"edd „ƒZ#dS)!z%Routines common to all posix systems.éNé)Úmemoize)Ú sdiskusage©ÚTimeoutExpired)Ú usage_percent)ÚChildProcessError)ÚFileNotFoundError)ÚInterruptedError)ÚPermissionError)ÚProcessLookupError)ÚPY3)Úunicode)éé)Ú pid_existsÚwait_pidÚ disk_usageÚget_terminal_mapcCsL|dkr dSzt |d¡Wn&ty0YdStyBYdS0dSdS)z6Check whether pid exists in the current process table.rTFN)ÚosÚkillr r )Úpid©rú5/usr/lib64/python3.9/site-packages/psutil/_psposix.pyr"s  rÚSignalsÚ NegsignalcCsg|]}|j|j f‘qSr)ÚnameÚvalue)Ú.0ÚxrrrÚ <ór cCs&z t|ƒWSty |YS0dS)z+Convert a negative signal value to an enum.N)rÚ ValueError©ZnumrrrÚnegsig_to_enum>s  r$cCs|S)Nrr#rrrr$EsÚ monotonicc sôˆdkrtdƒ‚d}d} ˆdur4| tjO} ˆƒˆ‰‡‡‡‡‡‡‡fdd„} zt ˆ| ¡\} } Wn>tyz| |ƒ}YqLtyž|ˆƒr˜| |ƒ}q†YdS0| dkr´| |ƒ}qLqLt | ¡rÈt | ¡St | ¡rât t  | ¡ ƒStd| ƒ‚qLdS)a›Wait 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-Cëâ6?Ncs6ˆdur ˆƒˆkr tˆˆˆd�‚ˆ|ƒˆ|ddƒS)N)rrég{®Gáz¤?r)Úinterval©Ú_minÚ_sleepÚ_timerrÚ proc_nameZstop_atÚtimeoutrrÚsleephs  zwait_pid..sleepzunknown process exit status %r) r"rÚWNOHANGÚwaitpidr rÚ WIFEXITEDÚ WEXITSTATUSÚ WIFSIGNALEDr$ÚWTERMSIG) rr-r,Z_waitpidr+r)r*Z _pid_existsr'Úflagsr.ZretpidÚstatusrr(rrIs0          rc CsÂtrt |¡}n`zt |¡}WnPtynt|tƒrhz| t ¡¡}WntyZYn0t |¡}n‚Yn0|j |j }|j |j }|j |j }||}||}t ||dd�}t||||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. r)Zround_)ÚtotalÚusedÚfreeÚpercent)r rÚstatvfsÚUnicodeEncodeErrorÚ isinstancerÚencodeÚsysÚgetfilesystemencodingÚf_blocksÚf_frsizeÚf_bfreeÚf_bavailrr)ÚpathÚstr7Z avail_to_rootZ avail_to_userr8Z total_userZusage_percent_userrrrr¡s*        ÿrc Cs^i}t d¡t d¡}|D]<}||vs0J|ƒ‚z||t |¡j<WqtyVYq0q|S)zMGet a map of device-id -> path as a dict. Used by Process.terminal() z /dev/tty*z /dev/pts/*)ÚglobrÚstatÚst_rdevr )ÚretZlsrrrrrÒs r)$Ú__doc__rGrÚsignalr?ÚtimeZ_commonrrrrZ_compatrr r r r r rÚ version_infoÚenumÚ__all__rÚhasattrÚIntEnumÚdictrrr$r0ÚgetattrÚminr.rrrrrrrÚsJ             ÿ  û X1