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/daemon/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/tuned/daemon/__pycache__/application.cpython-39.opt-1.pyc
a

,�g��@s�ddlmZmZmZmZmZmZmZddlm	Z	ddl
ZddlZddlm
Z
ddlmZddlZddlZddlZddlZddlZddlmZddlmZej��ZdgZGd	d�de�ZdS)
�)�storage�units�monitors�plugins�profiles�exports�hardware)�TunedExceptionN�)�
controller)�daemon)�GlobalConfig�Applicationc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	e
jfdd�Zdd�Z
dd�Ze
jfdd�Zedd��Zedd��Zdd�ZdS)rNc
Cs|t�dtjjt��df�d|_d|_t	�
�}t	�|�}|durJt�n||_
|j
�tj�rjt�d�n
t�d�t��}|j
�dtj�}tj|d�}t��}t��}	tj��}
tj��|_t�|||||	|
|j
|j�}t|j
�tj tj!��}t"�#|||||j
�}
t��}t�$�}t�%|j
�&tj'tj(��}t�)||||j
|j�}t*�+|
|||j
|�|_,t-�.|j,|j
�|_/|�0�d|_1dS)NzTuneD: %s, kernel: %s�z8dynamic tuning is enabled (can be overridden in plugins)z#dynamic tuning is globally disabled�udev_buffer_size)Zbuffer_size)2�log�info�tuned�versionZTUNED_VERSION_STR�os�uname�_dbus_exporter�_unix_socket_exporterrZPickleProviderZFactoryr
�config�get_bool�constsZCFG_DYNAMIC_TUNINGrZ
RepositoryZget_sizeZCFG_DEF_UDEV_BUFFER_SIZErZ	InventoryZ
DeviceMatcherZDeviceMatcherUdevr�instancerZ	variablesZ	Variables�int�getZCFG_DEFAULT_INSTANCE_PRIORITYZ!CFG_DEF_DEFAULT_INSTANCE_PRIORITYrZManagerZMergerZLocator�get_listZCFG_PROFILE_DIRSZCFG_DEF_PROFILE_DIRS�LoaderrZDaemon�_daemonrZ
Controller�_controller�
_init_signals�	_pid_file)�selfZprofile_namerZstorage_providerZstorage_factoryZmonitors_repositoryrZhardware_inventoryZdevice_matcherZdevice_matcher_udevZplugin_instance_factoryZplugins_repositoryZdef_instance_priorityZunit_managerZprofile_factoryZprofile_mergerZprofile_locatorZprofile_loader�r&�</usr/lib/python3.9/site-packages/tuned/daemon/application.py�__init__s@



��zApplication.__init__cs��fdd�}t��|�dS)Ncs�|kr��dS�Nr&)Z_signal_numberZ_frame��handler�
signal_numberr&r'�handler_wrapper@sz3Application._handle_signal.<locals>.handler_wrapper)�signal)r%r,r+r-r&r*r'�_handle_signal?szApplication._handle_signalcCs:|�tj|jj�|�tj|jj�|�tj|jj�dSr))r/r.�SIGHUPr"Zsighup�SIGINTZ	terminate�SIGTERM�r%r&r&r'r#EszApplication._init_signalscCs6|jdurtd��tj�||||�|_t�|j�dS)Nz&DBus interface is already initialized.)rr	rZdbusZDBusExporter�register_exporter)r%Zbus_nameZobject_nameZinterface_name�	namespacer&r&r'�attach_to_dbusJs
zApplication.attach_to_dbusc	Csj|jdurtd��tj�|j�tj�|j�	tj
�|j�tj�|j�tj
�|j�tj��|_t�|j�dS)Nz-Unix socket interface is already initialized.)rr	rZunix_socketZUnixSocketExporterrrrZCFG_UNIX_SOCKET_PATHrZCFG_UNIX_SOCKET_SIGNAL_PATHSZCFG_UNIX_SOCKET_OWNERSHIPZget_intZCFG_UNIX_SOCKET_PERMISIONSZ#CFG_UNIX_SOCKET_CONNECTIONS_BACKLOGr4r3r&r&r'�attach_to_unix_socketQs
�z!Application.attach_to_unix_socketcCst�|j�dSr))rZregister_objectr"r3r&r&r'�register_controller\szApplication.register_controllercCs�t�|�t�|gggtj�\}}}t|�dkrBt�|�td��t�|d�}t�|�t|�dkrltd��zt�	d|�d}Wntj
y�td��Yn0|dkr�td	��d
S)z|
		Wait till the child signalizes that the initialization is complete by writing
		some uninteresting data into the pipe.
		r
z=Cannot daemonize, timeout when waiting for the child process.�rz:Cannot daemonize, no response from child process received.�?z?Cannot daemonize, invalid response from child process received.Tz0Cannot daemonize, child process reports failure.N)r�close�selectrZDAEMONIZE_PARENT_TIMEOUT�lenr	�read�struct�unpack�error)r%�parent_in_fd�child_out_fdZ
read_readyZdropZresponse�valr&r&r'�_daemonize_parent_s


zApplication._daemonize_parentc
Cs�||_|��z�tj�|j�}tj�|�s4t�|�t�t�|jtj	tj
BtjBd�d��"}|�dt�
��Wd�n1s�0YWn@ttfy�}z$t�d|jt|�f�WYd}~n
d}~00dS)Ni��wz%dzcannot write the PID to %s: %s)r$�_delete_pid_filer�path�dirname�exists�makedirs�fdopen�open�O_CREAT�O_TRUNC�O_WRONLY�write�getpid�OSError�IOErrorr�critical�str)r%�pid_fileZdir_name�frAr&r&r'�write_pid_filexs
(4zApplication.write_pid_filec
Cs`tj�|j�r\zt�|j�Wn<tyZ}z$t�d|jt|�f�WYd}~n
d}~00dS)Nz&cannot remove existing PID file %s, %s)	rrHrJr$�unlinkrSr�warningrV)r%rAr&r&r'rG�s
zApplication._delete_pid_filec
Cs,t�|�t�d�t��t�d�zt��}|dkrBt�d�Wn`ty�}zHt	�
dt|��t�
dd�}t�||�t�|�td��WYd}~n
d}~00tdd	�}t�|��tj���t�|��tj���t�|��tj���|�|�t	�d
�t�
dd�}t�||�t�|�dS)zy
		Finishes daemonizing process, writes a PID file and signalizes to the parent
		that the initialization is complete.
		�/rz"cannot daemonize, fork() error: %sr:Fz'Cannot daemonize, second fork() failed.Nz	/dev/nullzw+zsuccessfully daemonizedT)rr;�chdir�setsid�umask�fork�sys�exitrSrrUrVr?�packrQr	rM�dup2�fileno�stdin�stdout�stderrrY�debug)r%rWrBrC�pidrArD�fdr&r&r'�_daemonize_child�s.






zApplication._daemonize_childc
Cs�t��}zt��}WnHty\}z0t�|d�t�|d�td��WYd}~n
d}~00z4|dkr~|j|�t�d�n|j	|g|�R�Wn"|dkr��n
t�d�Yn0dS)z�
		Daemonizes the application. In case of failure, TunedException is raised
		in the parent process. If the operation is successfull, the main process
		is terminated and only child process returns from this method.
		rr
z Cannot daemonize, fork() failed.N)
r�piper`rSr;r	rErarbrl)r%rWZparent_child_fdsZ	child_pidrAr&r&r'�	daemonize�s 
zApplication.daemonizecCs|jSr))r!r3r&r&r'r�szApplication.daemoncCs|jSr))r"r3r&r&r'r�szApplication.controllercCsj|r|j�tjd�|j�tjtj�s0t�d�|j�	�}|j�tjtj�rTt
��|jdurf|�
�|S)NTzrUsing one shot no daemon mode, most of the functionality will be not available, it can be changed in global config)r�setrZ
CFG_DAEMONrZCFG_DEF_DAEMONrr[r"�runr�stopr$rG)r%r�resultr&r&r'rp�s


zApplication.run)NN)�__name__�
__module__�__qualname__r(r/r#r6r7r8rErZPID_FILErYrGrlrn�propertyrrrpr&r&r&r'rs 
+
"

)rrrrrrrrZtuned.exceptionsr	Z
tuned.logsZ
tuned.version�rrr.rrar<r?Ztuned.constsrZtuned.utils.global_configr
Zlogsrr�__all__�objectrr&r&r&r'�<module>s$


Youez - 2016 - github.com/yon3zu
LinuXploit