AlkantarClanX12

Your IP : 3.147.27.129


Current Path : /usr/lib/python2.7/site-packages/pycriu/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pycriu/criu.pyc

�
k�x]c@s�ddlZddlZddlZddlZddlZddljZddd��YZdefd��YZ	defd��YZ
defd	��YZd
efd��YZ
de
fd
��YZde
fd��YZddd��YZdS(i����Nt
_criu_commcBsDeZdZdZdZdZdZdZdZ	d�Z
d�ZRS(s/
    Base class for communication classes.
    iiicCsdS(s�
        Connect to criu and return socket object.
        daemon -- is for whether or not criu should daemonize if executing criu from binary(comm_bin).
        N((tselftdaemon((s//usr/lib/python2.7/site-packages/pycriu/criu.pytconnectscCsdS(s'
        Disconnect from criu.
        N((R((s//usr/lib/python2.7/site-packages/pycriu/criu.pyt
disconnectsN(t__name__t
__module__t__doc__tCOMM_SKtCOMM_FDtCOMM_BINtNonet	comm_typetcommtskRR(((s//usr/lib/python2.7/site-packages/pycriu/criu.pyRs	t
_criu_comm_skcBs)eZdZd�Zd�Zd�ZRS(s.
    Communication class for unix socket.
    cCs|j|_||_dS(N(RRR
(Rtsk_path((s//usr/lib/python2.7/site-packages/pycriu/criu.pyt__init__*scCs5tjtjtj�|_|jj|j�|jS(N(tsockettAF_UNIXtSOCK_SEQPACKETRRR
(RR((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR.scCs|jj�dS(N(Rtclose(R((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR4s(RRRRRR(((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR%s		t
_criu_comm_fdcBs)eZdZd�Zd�Zd�ZRS(s2
    Communication class for file descriptor.
    cCs|j|_||_dS(N(R	RR
(Rtfd((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR=scCs(tj|jtjtj�|_|jS(N(RtfromfdR
RRR(RR((s//usr/lib/python2.7/site-packages/pycriu/criu.pyRAscCs|jj�dS(N(RR(R((s//usr/lib/python2.7/site-packages/pycriu/criu.pyRGs(RRRRRR(((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR8s		t_criu_comm_bincBs)eZdZd�Zd�Zd�ZRS(s)
    Communication class for binary.
    cCs+|j|_||_d|_d|_dS(N(R
RR
RtswrkR(Rtbin_path((s//usr/lib/python2.7/site-packages/pycriu/criu.pyRPs		csmtjtjtj��tj�dtj�}tj�dtj|tjB�tj�dtj�}tj�dtj|tj@�|�_t	j
�}|dkr��fd�}|rt	j
�}|dkr�t	j�|�q	t	jd�q%|�n|r%t	j
|d�n�dj�tjd�djd��d�_�d�_�jS(Niics�tjd�tjd�tjd��djtjdtj���tj�j�jdd�dj�g�tj	d�dS(NiiitiRs%d(
tosRtsendtstructtpacktgetpidtexecvR
tfilenot_exit((tcssR(s//usr/lib/python2.7/site-packages/pycriu/criu.pyt	exec_criuds


#	Ri(Rt
socketpairRRtfcntltF_GETFDtF_SETFDt
FD_CLOEXECRRtforktsetsidR$twaitpidRRtunpacktrecvRR(RRtflagstpR&((R%Rs//usr/lib/python2.7/site-packages/pycriu/criu.pyRVs,!"	


&
cCs0|jj�|js,tj|jd�ndS(Ni(RRRRR.R(R((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR�s
	(RRRRRR(((s//usr/lib/python2.7/site-packages/pycriu/criu.pyRKs		0t
CRIUExceptioncBs#eZdZdZdZd�ZRS(s?
    Exception class for handling and storing criu errors.
    cCs|jS(N(t_str(R((s//usr/lib/python2.7/site-packages/pycriu/criu.pyt__str__�sN(RRRRttypR4R5(((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR3�stCRIUExceptionInternalcBseZdZd�ZRS(sC
    Exception class for handling and storing internal errors.
    cCs/||_dtjj|j�|f|_dS(Ns!%s failed with internal error: %s(R6trpct
criu_req_typetNameR4(RR6ts((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR�s	(RRRR(((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR7�stCRIUExceptionExternalcBs eZdZd�Zd�ZRS(sC
    Exception class for handling and storing criu RPC errors.
    cCs.||_||_||_|j�|_dS(N(R6tresp_typterrnot_gen_error_strR4(Rtreq_typR=R>((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR�s			cCs�dtjj|j�f}|j|jkrE|d|jf7}n|d|jf7}|jtjkrx|d7}n|jtjkr�|jtjkr�|d7}q�n|jtj	kr�|jtj
kr�|d7}q�n|d7}|S(Ns%s failed: sUnexpected response type %d: sError(%d): sBad optionssNo process with such pids)Process with requested pid already existstUnknown(R8R9R:R6R=R>tEBADRQCtDUMPtESRCHtRESTOREtEEXIST(RR;((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR?�s

(RRRRR?(((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR<�s	tcriucBs}eZdZdZdZd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�ZRS(
s 
    Call criu through RPC.
    cCs)|jd�tj�|_d|_dS(NRG(t
use_binaryR8t	criu_optstoptsRR(R((s//usr/lib/python2.7/site-packages/pycriu/criu.pyR�s
cCst|�|_dS(sZ
        Access criu using unix socket which that belongs to criu service daemon.
        N(Rt_comm(Rtsk_name((s//usr/lib/python2.7/site-packages/pycriu/criu.pytuse_sk�scCst|�|_dS(s0
        Access criu using provided fd.
        N(RRK(RR((s//usr/lib/python2.7/site-packages/pycriu/criu.pytuse_fd�scCst|�|_dS(sO
        Access criu by execing it using provided path to criu binary.
        N(RRK(Rtbin_name((s//usr/lib/python2.7/site-packages/pycriu/criu.pyRH�scCst}|jtjkr4|jjd�r4t}ny�|jsU|jj	|�}n	|j}|j
rs||_n|j|j��|j
t|j
dtjtjB���}|j
s�|jj�ntj�}|j|�Wn+tk
r}t|jt|���nX|S(sA
        As simple as send request and receive response.
        tpidi(tFalsettypeR8RCRJtHasFieldtTrueRRKRt	keep_openRtSerializeToStringR0tlenRt	MSG_TRUNCtMSG_PEEKRt	criu_resptParseFromStringt	ExceptionR7tstr(RtreqRR;tbuftrespte((s//usr/lib/python2.7/site-packages/pycriu/criu.pyt_send_req_and_recv_resp�s$%				+	cCsRtj�}tj|_|j|�}|jsNt|j|j|j��ndS(sB
        Checks whether the kernel support is up-to-date.
        N(R8tcriu_reqtCHECKRRRbtsuccessR<tcr_errno(RR^R`((s//usr/lib/python2.7/site-packages/pycriu/criu.pytchecks
	cCshtj�}tj|_|jj|j�|j|�}|jsat|j|j|j	��n|j
S(sC
        Checkpoint a process/tree identified by opts.pid.
        (R8RcRCRRRJt	MergeFromRbReR<Rftdump(RR^R`((s//usr/lib/python2.7/site-packages/pycriu/criu.pyRis	cCshtj�}tj|_|jj|j�|j|�}|jsat|j|j|j	��n|j
S(sC
        Checkpoint a process/tree identified by opts.pid.
        (R8RctPRE_DUMPRRRJRhRbReR<RfRi(RR^R`((s//usr/lib/python2.7/site-packages/pycriu/criu.pytpre_dump"s	cCshtj�}tj|_|jj|j�|j|�}|jsat|j|j|j	��n|j
S(s)
        Restore a process/tree.
        (R8RcRERRRJRhRbReR<Rftrestore(RR^R`((s//usr/lib/python2.7/site-packages/pycriu/criu.pyRl1s	cCsqtj�}tj|_|jj|j�t|_|j|�}|j	sjt
|j|j|j��n|jS(N(
R8RctPAGE_SERVER_CHLDRRRJRhRTRURbReR<Rftps(RR^R`((s//usr/lib/python2.7/site-packages/pycriu/criu.pytpage_server_chld@s		cCs^tj�}tj|_||_|j|�}|jsWt|j|j|j��n|j	S(N(
R8RctWAIT_PIDRRRPRbReR<Rftstatus(RRPR^R`((s//usr/lib/python2.7/site-packages/pycriu/criu.pytwait_pidMs		N(RRRRRJRKRRMRNRHRbRgRiRkRlRoRr(((s//usr/lib/python2.7/site-packages/pycriu/criu.pyRG�s					#					
(((RR>R(RRtpycriu.rpc_pb2trpc_pb2R8RRRRR\R3R7R<RG(((s//usr/lib/python2.7/site-packages/pycriu/criu.pyt<module>sA#