o nnhL@sdZddlmZddlZddlZddlZddlZGdddZGdddZej dd Gd d d Z ej dd Gd d d Z dddZ dS)z5Linux control group constants, classes and utilities.) annotationsNc@eZdZdZdZdZdZdS) CGroupPathzLinux cgroup path constants.z/sys/fs/cgroupz/sys/fs/cgroup/systemdz$/sys/fs/cgroup/systemd/release_agentN)__name__ __module__ __qualname____doc__ROOTSYSTEMDSYSTEMD_RELEASE_AGENTr r H/usr/local/lib/python3.10/dist-packages/ansible_test/_internal/cgroup.pyr rc@r) MountTypez&Linux filesystem mount type constants.tmpfscgroupcgroup2N)rrrrTMPFS CGROUP_V1 CGROUP_V2r r r r rrrT)frozenc@sbeZdZUdZded<ded<ded<edd d Zedd d ZedddZ edddZ dS) CGroupEntryzNA single cgroup entry parsed from '/proc/{pid}/cgroup' in the proc filesystem.intidstr subsystempathlib.PurePosixPathpathreturncCsttj|jS)z(The root path for this cgroup subsystem.)pathlib PurePosixPathrr rselfr r r root_path"szCGroupEntry.root_pathcCst|jt|jdS)z(The full path for this cgroup subsystem./)rr r#rrlstripr!r r r full_path'zCGroupEntry.full_pathvaluecCs2|jddd\}}}|t||dt|dS)zOParse the given cgroup line from the proc filesystem and return a cgroup entry.:)maxsplitzname=)rrr)splitr removeprefixrr )clsr(cidrrr r r parse,s zCGroupEntry.parsetuple[CGroupEntry, ...]ctfdd|DS)zUParse the given output from the proc filesystem and return a tuple of cgroup entries.c3|]}|VqdSNr0.0liner.r r :z$CGroupEntry.loads..tuple splitlinesr.r(r r9r loads7r'zCGroupEntry.loadsN)rr)r(rrr)r(rrr1) rrrr__annotations__propertyr#r& classmethodr0r@r r r r rs     rc@seZdZUdZded<ded<ded<ded<ded<ded <d ed <d ed <d ed<ded<d ed<edddZedddZdS) MountEntryzUA single mount info entry parsed from '/proc/{pid}/mountinfo' in the proc filesystem.rmount_id parent_id device_major device_minorrrootrztuple[str, ...]optionsfieldsrtypesource super_optionsr(rcCs|d^}}}}}}}|dd} |dd\} } } } | dks"J|d\}}|t|t|t|t|t|t|t|dt| | t| t| dd S)zRParse the given mount info line from the proc filesystem and return a mount entry. N-r),) rErFrGrHrIrrJrKrLrMrN)r,r _decode_pathr=)r.r(rErFdevice_major_minorrIrrJ remainderrK separatormtyperMrNrGrHr r r r0Ms$    zMountEntry.parsetuple[MountEntry, ...]cr2)zYParse the given output from the proc filesystem and return a tuple of mount info entries.c3r3r4r5r6r9r r r:kr;z#MountEntry.loads..r<r?r r9r r@hr'zMountEntry.loadsN)r(rrrD)r(rrrX)rrrrrArCr0r@r r r r rD=s"  rDr(rrrcCstddd|}t|S)zBDecode and return a path which may contain octal escape sequences.z (\\[0-7]{3})cSst|dddS)Nrasciiunicode_escape)codecsdecodegroupencode)mr r r qsz_decode_path..)resubrr )r(rr r r rSns rS)r(rrr) r __future__rr[ dataclassesrrarr dataclassrrDrSr r r r s   "0