Spade

Mini Shell

Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/tuned/daemon/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/usr/lib/python2.7/site-packages/tuned/daemon/application.pyc

�
��\c@s�ddlmZmZmZmZmZmZmZddlm	Z	ddl
ZddlmZddlm
Z
ddlZddlZddlZddlZddlZddljZddlmZejj�ZdgZdefd	��YZdS(
i����(tstoragetunitstmonitorstpluginstprofilestexportsthardware(tTunedExceptionNi(t
controller(tdaemon(tGlobalConfigtApplicationcBs�eZddd�Zd�Zd�Zd�Zd�Zej	d�Z
d�Zd�Zej	d�Z
ed	��Zed
��Zd�ZRS(
c	Cs�d|_tj�}tj|�}|dkr9t�n||_|jjtj	�rgt
jd�n
t
jd�tj
�}|jjdtj�}tjd|�}tj�}tj�}	tjj�}
tjj�|_tj
|||||	|
|j|j�}t|jjtjtj��}tj||||�}
tj�}tj�}tj
tj!�}tj"||||j|j�}t#j$|
|||j|�|_%t&j'|j%|j�|_(|j)�d|_*dS(Ns8dynamic
tuning is enabled (can be overridden in plugins)s#dynamic tuning is
globally
disabledtudev_buffer_sizetbuffer_size(+tNonet_dbus_exporterRtPickleProvidertFactoryR
tconfigtget_booltconststCFG_DYNAMIC_TUNINGtlogtinfoRt
Repositorytget_sizetCFG_DEF_UDEV_BUFFER_SIZERt	Inventoryt
DeviceMatchertDeviceMatcherUdevRtinstanceRt	variablest	VariablestinttgettCFG_DEFAULT_INSTANCE_PRIORITYt!CFG_DEF_DEFAULT_INSTANCE_PRIORITYRtManagertMergertLocatortLOAD_DIRECTORIEStLoaderR	tDaemont_daemonRt
Controllert_controllert
_init_signalst	_pid_file(tselftprofile_nameRtstorage_providertstorage_factorytmonitors_repositoryRthardware_inventorytdevice_matchertdevice_matcher_udevtplugin_instance_factorytplugins_repositorytdef_instance_prioritytunit_managertprofile_factorytprofile_mergertprofile_locatortprofile_loader((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyt__init__s8	
!!!
cs&��fd�}tj�|�dS(Ncs�|kr��ndS(N((t_signal_numbert_frame(thandlert
signal_number(s</usr/lib/python2.7/site-packages/tuned/daemon/application.pythandler_wrapper;s(tsignal(R0RDRCRE((RCRDs</usr/lib/python2.7/site-packages/tuned/daemon/application.pyt_handle_signal:scCsO|jtj|jj�|jtj|jj�|jtj|jj�dS(N(RGRFtSIGHUPR-treloadtSIGINTt	terminatetSIGTERM(R0((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyR.@scCs]|jdk	rtd��ntjj|||�|_tj|j�tj|j�dS(Ns&DBus
interface is already
initialized.(	RRRRtdbustDBusExportertregister_exportertregister_objectR-(R0tbus_nametobject_nametinterface_name((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pytattach_to_dbusEs
cCs�tj|�tj|gggtj�\}}}t|�dkrbtj|�td��ntj|d�}tj|�t|�dkr�td��nytj	d|�d}Wn
tj
k
r�td��nX|tkr�td��nd	S(
s|
		Wait till the child signalizes that the initialization is complete by
writing
		some uninteresting data into the pipe.
		is=Cannot daemonize, timeout when waiting for the child
process.iis:Cannot daemonize, no response from child process
received.t?s?Cannot daemonize, invalid response from child process
received.s0Cannot daemonize, child process reports
failure.N(tostclosetselectRtDAEMONIZE_PARENT_TIMEOUTtlenRtreadtstructtunpackterrortTrue(R0tparent_in_fdtchild_out_fdt
read_readytdroptresponsetval((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyt_daemonize_parentMs
'

cCs�||_|j�y�tjj|j�}tjj|�sMtj|�ntjtj|jtj	tj
BtjBd�d��}|jdtj
��WdQXWn9ttfk
r�}tjd|jt|�f�nXdS(Ni�tws%dscannot write the PID
to %s:
%s(R/t_delete_pid_fileRVtpathtdirnametexiststmakedirstfdopentopentO_CREATtO_TRUNCtO_WRONLYtwritetgetpidtOSErrortIOErrorRtcriticaltstr(R0tpid_filetdir_nametfR^((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pytwrite_pid_filefs	
8!cCsftjj|j�rbytj|j�Wqbtk
r^}tjd|jt|�f�qbXndS(Ns&cannot remove existing PID
file %s,
%s(	RVRiRkR/tunlinkRtRtwarningRw(R0R^((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyRhss
cCs~tj|�tjd�tj�tjd�y,tj�}|dkr\tjd�nWnetk
r�}t	j
dt|��tj
dt�}tj||�tj|�td��nXtdd�}tj|j�tjj��tj|j�tjj��tj|j�tjj��|j|�t	jd�tj
dt�}tj||�tj|�d	S(
sy
		Finishes daemonizing process, writes a PID file and signalizes to the
parent
		that the initialization is complete.
		t/is"cannot daemonize, fork() error: %sRUs'Cannot daemonize,
second fork() failed.s	/dev/nullsw+ssuccessfully
daemonizedN(RVRWtchdirtsetsidtumasktforktsystexitRtRRvRwR\tpacktFalseRrRRntdup2tfilenotstdintstdouttstderrR{tdebugR_(R0RxR`RatpidR^Retfd((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyt_daemonize_childzs.






cCs�tj�}ytj�}WnAtk
r_}tj|d�tj|d�td��nXy=|dkr�|j|�tjd�n|j	||�Wn&|dkr��q�tjd�nXdS(s�
		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.
		iis Cannot daemonize, fork() failed.N(
RVtpipeR�RtRWRRfR�R�R�(R0Rxtparent_child_fdst	child_pidR^((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyt	daemonize�s

cCs|jS(N(R+(R0((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyR	�scCs|jS(N(R-(R0((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyR�scCs�|r|jjtjt�n|jjtjtj�sJtjd�n|j	j
�}|jjtjtj�r�tj�n|j
dk	r�|j�n|S(NsrUsing one shot
no deamon mode, most of the functionality will be not available, it can be
changed in global config(RtsetRt
CFG_DAEMONR_RtCFG_DEF_DAEMONRtwarnR-trunRtstopR/RRh(R0R	tresult((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyR��s

N(t__name__t
__module__RR@RGR.RTRfRtPID_FILER{RhR�R�tpropertyR	RR�(((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyRs'				
		"(ttunedRRRRRRRttuned.exceptionsRt
tuned.logstRR	RFRVR�RXR\ttuned.constsRttuned.utils.global_configR
tlogsR"Rt__all__tobjectR(((s</usr/lib/python2.7/site-packages/tuned/daemon/application.pyt<module>s4