403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.6/site-packages/tuned/daemon/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/tuned/daemon/__pycache__/controller.cpython-36.pyc
3

��c4+�@s�ddlmZddlZddlZddlmZddlZddljZddlm	Z	dgZ
ejj�Z
Gdd�de�ZGdd�dejjj�ZdS)	�)�exportsN)�TunedException)�commands�
Controllerc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
TimerStorecCst�|_tj�|_dS)N)�dict�_timers�	threadingZLock�_timers_lock)�self�r� /usr/lib/python3.6/controller.py�__init__szTimerStore.__init__c
Cs |j�||j|<WdQRXdS)N)r
r)r�token�timerrrr
�store_timerszTimerStore.store_timercCsB|j�2y|j|}|j�|j|=WnYnXWdQRXdS)N)r
r�cancel)rrrrrr
�
drop_timers
zTimerStore.drop_timerc	Cs<|j�,x|jj�D]}|j�qW|jj�WdQRXdS)N)r
r�valuesr�clear)rrrrr
�
cancel_allszTimerStore.cancel_allN)�__name__�
__module__�__qualname__rrrrrrrr
r
s	rcsLeZdZdZ�fdd�Zdd�Zdd�Zejd�d	d
��Z	dd�Z
ejd
d�dJdd��Zejdd�dKdd��Z
ejdd�dLdd��Zejdd�dMdd��Zejdd�dNdd��Zdd�Zejdd�dOdd ��Zejdd�dPd!d"��Zejdd�dQd#d$��Zejdd%�dRd&d'��Zejdd�dSd(d)��Zejdd�dTd*d+��Zejdd�dUd,d-��Zejdd.�dVd/d0��Zejdd1�dWd2d3��Zejdd4�dXd5d6��Zejdd�dYd7d8��Zejdd�dZd9d:��Zejdd�d[d;d<��Zejdd=�d\d>d?��Zejdd�d]d@dA��Z ejddB�d^dCdD��Z!ejdd�d_dEdF��Z"ejdGd�d`dHdI��Z#�Z$S)arz�
	Controller's purpose is to keep the program running, start/stop the tuning,
	and export the controller interface (currently only over D-Bus).
	cs8tt|�j�||_||_tj�|_t�|_	t
�|_dS)N)�superrr�_daemon�_global_configr	ZEvent�
_terminater�_cmdr�_timer_store)r�daemonZ
global_config)�	__class__rr
r+s
zController.__init__cCsxtjd�|j�}|jjtjtj�}|r6|r6tj�|rb|j	j
�x|jj|j	d�s`tj
�qFWtjd�|j�dS)z1
		Controller main loop. The call is blocking.
		zstarting controller�zterminating controllerN)�log�info�startr�get_bool�consts�
CFG_DAEMON�CFG_DEF_DAEMONrrrr�waitZperiod_check�stop)r�resr rrr
�run3s



zController.runcCs|jj�dS)N)r�set)rrrr
�	terminateFszController.terminateZsbscCsdS)Nr)r�profile_name�resultZerrstrrrr
�profile_changedIszController.profile_changedcCstjj|�|jj|�dS)N)�tuned�logs�log_capture_finishrr)rrrrr
�_log_capture_abortRszController._log_capture_abortZii�sNcCsf|dkrdStjj|�}|dkr$dS|dkrVtj||j|gd�}|jj||�|j�|dkrbdS|S)N�r)�args)	r3r4�log_capture_startr	ZTimerr6rrr%)rZ	log_levelZtimeout�callerrrrrr
r:VszController.log_capture_startcCs4|dkrdStjj|�}|jj|�|dkr0dS|S)Nr8)r3r4r5rr)rrr;r,rrr
r5ds
zController.log_capture_finishr8�bcCsD|dkrdS|jjtjtj�r:|jj�r,dS|jj�s:dS|jj�S)Nr8FT)	rr&r'r(r)r�
is_running�
is_enabledr%)rr;rrr
r%ls

zController.startcCs4|dkrdS|jj�sd}n
|jj�}|jj�|S)Nr8FT)rr=r+rr)rr;r,rrr
r+ws


zController.stopcCsl|dkrdS|jj�r&|j�}|s&dSy|jj�Wn.tk
rb}ztjd|�dSd}~XnX|j�S)Nr8FzFailed to reload TuneD: %s)rr=r+Zreload_profile_configrr#�errorr%)rr;Zstop_ok�errr
�reload�s
zController.reloadcCs�|jj�}d}d}d}z�y$|r,|jjdd�|jj||�Wnftjjk
r�}zFd}t|�}|r�|jjj	|kr�t
jd|�d}nt
jd|�WYdd}~XnXWd|r�|r�t
jd|�n|s�t
j
d�|jj�X||fS)	N�OKTF)Zprofile_switchz@Failed to reapply profile '%s'. Did it change on disk and break?zFailed to apply profile '%s'z>Applying previously applied (possibly out-dated) profile '%s'.z$Applying previously applied profile.)rr=r+Zset_profiler3�
exceptionsr�str�profile�namer#r?�warnr$r%)rr0�manualZwas_running�msg�successZreapplyr@rrr
�_switch_profile�s,
$
zController._switch_profilez(bs)cCs|dkrdS|j|d�S)Nr8F�UnauthorizedT)FrL)rK)rr0r;rrr
�switch_profile�szController.switch_profilecCs |dkrdS|j�}|j|d�S)Nr8FrL)FrL)�recommend_profilerK)rr;r0rrr
�auto_profile�szController.auto_profilecCs*|dkrdS|jjdk	r"|jjjSdSdS)Nr8)rrErF)rr;rrr
�active_profile�s

zController.active_profilez(ss)cCs�|dkrdS|jj}|dkrpy"|jj�\}}|dkr<|dk	}Wn0tk
rn}zd}t|�}||fSd}~XnX|rztjntj}|dfS)Nr8�unknownrL)rQrL)	rrHrZget_active_profilerrDr'ZACTIVE_PROFILE_MANUALZACTIVE_PROFILE_AUTO)rr;rHrEr@�moder?rrr
�profile_mode�szController.profile_modecCs|dkrdS|jjpdS)Nr8)r�post_loaded_profile)rr;rrr
rT�szController.post_loaded_profilecCsB|dkrdS|jj�r |jj�|jj�r>|jjddddd�dS)Nr8FT)Zsave_instantly)rr=r+r>Zset_all_profiles)rr;rrr
�disable�s


zController.disablecCs|dkrdS|jj�S)Nr8F)rr=)rr;rrr
r=�szController.is_running�ascCs|dkrgS|jjjj�S)Nr8)r�profile_loader�profile_locatorZget_known_names)rr;rrr
�profiles�szController.profilesza(ss)cCs|dkrgS|jjjj�S)Nr8)rrWrXZget_known_names_summary)rr;rrr
�	profiles2�szController.profiles2z(bsss)cCsP|dkrtdddd�S|dks&|dkr.|j�}t|jjjj|tjtjgdg��S)Nr8F)	�tuplerPrrWrXZget_profile_attrsr'ZPROFILE_ATTR_SUMMARYZPROFILE_ATTR_DESCRIPTION)rr0r;rrr
�profile_info�s
zController.profile_infocCs|dkrdS|jjj�S)Nr8)rZprofile_recommenderZ	recommend)rr;rrr
rN�szController.recommend_profilecCs|dkrdS|jjdd�S)Nr8F)�ignore_missing)r�verify_profile)rr;rrr
r^szController.verify_profilecCs|dkrdS|jjdd�S)Nr8FT)r])rr^)rr;rrr
�verify_profile_ignore_missingsz(Controller.verify_profile_ignore_missingz	a{sa{ss}}cCsz|dkrdSi}xd|jj�D]V}|jjd�djdd�d}|j�}i||<x$|j�D]\}}t|�|||<qVWqW|S)zuReturn dictionary with accesible plugins

		Return:
		dictionary -- {plugin_name: {parameter_name: default_value}}
		r8F�.r"�_���)r�get_all_pluginsr�splitZ_get_config_options�itemsrD)rr;ZpluginsZplugin_class�plugin_nameZconf_options�key�valrrr
rcszController.get_all_pluginscCs|dkrdS|jjt|��S)z"Return docstring of plugin's classr8F)r�get_plugin_documentationrD)rrfr;rrr
ri#sz#Controller.get_plugin_documentationza{ss}cCs|dkrdS|jjt|��S)z�Return dictionary with plugin's parameters and their hints

		Parameters:
		plugin_name -- name of plugin

		Return:
		dictionary -- {parameter_name: hint}
		r8F)r�get_plugin_hintsrD)rrfr;rrr
rj*s
zController.get_plugin_hintscCs6|dkrdS|jjr2|jjjr2|jjjj|�dSdS)z�Allows to dynamically add sockets to send signals to

		Parameters:
		path -- path to socket to register for sending signals

		Return:
		bool -- True on success
		r8FT)rZ_applicationZ_unix_socket_exporterZregister_signal_path)r�pathr;rrr
�register_socket_signal_path8s
z&Controller.register_socket_signal_pathZssc
Csb|dkrdSd}x2|jjjD]$}|j|krtjd|j�d}PqW|sbd|}tj|�d|fSt|jj	|��}tjd|jt
|�f�x�|jjjD]�}|j|@}	t|	�r�||	8}tj
dt
|	�|j|jf�|jj|jjk�rd	|j|jjt
|	�|j|jjf}tj|�d|fS|jj||	�|jj||	�q�Wt|��r^d
t
|�}tj
|�d|fSd
S)Nr8FrLzFound instance '%s'.TzInstance '%s' not foundz-Instance '%s' trying to acquire devices '%s'.z8Moving devices '%s' from instance '%s' to instance '%s'.ztTarget instance '%s' is of type '%s', but devices '%s' are currently handled by instance '%s' which is of type '%s'.z2Ignoring devices not handled by any instance '%s'.rB)FrL)TrB)rZ
_unit_managerZ	instancesrFr#�debugr?r.rZdevstr2devsrDZprocessed_devices�lenr$ZpluginZ_remove_devices_nocheckZ_add_devices_nocheck)
rZdevicesZ
instance_namer;�foundZinstance_targetZretsZdevs�instanceZdevs_movingrrr
�instance_acquire_devicesLsB





z#Controller.instance_acquire_devices)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)%rrr�__doc__rr-r/r�signalr2r6Zexportr:r5r%r+rArKrMrOrPrSrTrUr=rYrZr\rNr^r_rcrirjrlrq�
__classcell__rr)r!r
r%sj	

























)r3rZ
tuned.logsZtuned.exceptionsrr	Ztuned.constsr'Ztuned.utils.commandsr�__all__r4�getr#�objectrZ
interfacesZExportableInterfacerrrrr
�<module>s



Youez - 2016 - github.com/yon3zu
LinuXploit