Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/pycriu/images/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/pycriu/images/images.pyo

�
k�x]c@s�ddlZddlZddlZddlZddlZddlmZddlmZddlmZde	e�kr�ej
e_eje_
ndZdZd	Zd
�Zdefd��YZd
d`d��YZddad��YZddbd��YZddcd��YZdddd��YZdded��YZddfd��YZddgd��YZddhd��YZi;eej�d6eej�d 6eej�d!6eej �d"6eej!�d#6eej"�d$6eej#�d%6e�d&6eej$�d'6eej%�d(6eej&e��d)6eej'�d*6e�d+6eej(�d,6eej)�d-6eej*�d.6eej+�d/6eej,�d06eej-�d16eej.�d26eej/�d36eej0�d46eej1�d56eej2�d66eej3�d76eej4�d86eej5�d96eej6�d:6eej7�d;6eej8�d<6eej9�d=6eej:�d>6eej;�d?6eej<�d@6eej=�dA6eej>�dB6eej?�dC6eej@�dD6eejA�dE6eejB�dF6eejC�dG6eejD�dH6eejE�dI6eejF�dJ6eejG�dK6eejH�dL6eejI�dM6eejJe��dN6eejJe��dO6eejKe��dP6eejLe��dQ6eejMe��dR6eejNe��dS6eejO�dT6eejP�dU6eejQ�dV6eejR�dW6eejS�dX6eejT�dY6ZUdZ�ZVeWeWd[�ZXd\�ZYeWd]�ZZd^�Z[d_�Z\dS(ii����Ni(tmagic(tpb(tpb2dicttencodebytesiiicCs|d|dBdS(Ni((txty((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pytround_up>stMagicExceptioncBseZd�ZRS(cCs
||_dS(N(R(tselfR((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyt__init__Cs(t__name__t
__module__R	(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyRBst
entry_handlercBsPeZdZdd�Zeed�Zed�Zd�Zd�Z	d�Z
RS(sp
    Generic class to handle loading/dumping criu images
    entries from/to bin format to/from dict(json).
    cCs||_||_dS(s=
        Sets payload class and extra handler class.
        N(tpayloadt
extra_handler(RR
R((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR	Os	cCs�g}x�tr�i}|j�}|jd�}|dkr@Pntjd|�\}|j|j|��tj||�}|jr�|r�d�}	|jj||�}
d|	|
�|d<q�|jj	||�|d<n|j
|�q	W|S(s�
        Convert criu image entries from binary format to dict(json).
        Takes a file-like object and returnes a list with entries in
        dict(json) format.
        itticSsxxmddddddddgD]M}|d	krbt|�|krQd
||fSd||fSn|d	:}qWd|S(
NRtKtMtGtTtPtEtZg�@s%d%sBs%.1f%sBs%.1fYB(tint(tnumtunit((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pythuman_readablens%s... <%s>textra(tTrueR
treadtstructtunpacktParseFromStringRRtskiptloadtappend(Rtftprettyt
no_payloadtentriestentrytpbufftbuftsizeRtpl_size((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#Vs$			
cCstj|�}|j||�S(sD
        Same as load(), but takes a string as an argument.
        (tiotBytesIOR#(RtsR&R%((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pytloads�scCs�x�|D]�}|jdd�}|j�}tj||�|j�}t|�}|jtj	d|��|j|�|j
r|r|j
j|||�qqWdS(s�
        Convert criu image entries from dict(json) format to binary.
        Takes a list of entries and a file-like object to write entries
        in binary format to.
        RRN(tpoptNoneR
Rtdict2pbtSerializeToStringtlentwriteRtpackRtdump(RR(R%R)RR*tpb_strR,((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR9�s

cCs)tjd�}|j||�|j�S(sf
        Same as dump(), but doesn't take file-like object and just
        returns a string.
        R(R.R/R9R(RR(R%((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pytdumps�scCsed}xXtr`|jd�}|dkr.Pntjd|�\}|j|d�|d7}q	W|S(sI
        Counts the number of top-level object in the image file
        iiRRi(RRRR tseek(RR%R(R+R,((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pytcount�s	N(R
Rt__doc__R3R	tFalseR#R1R9R;R=(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyRIs+			tpagemap_handlercBsDeZdZeed�Zed�Zd�Zd�Zd�ZRS(s�
    Special entry handler for pagemap.img, which is unique in a way
    that it has a header of pagemap_head type followed by entries
    of pagemap_entry type.
    cCs�g}tj�}xytr�|jd�}|dkr:Pntjd|�\}|j|j|��|jtj||��tj	�}qW|S(NiRR(
Rtpagemap_headRRRR R!R$Rt
pagemap_entry(RR%R&R'R(R*R+R,((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#�s	cCstj|�}|j||�S(N(R.R/R#(RR0R&R%((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR1�scCs{tj�}xh|D]`}tj||�|j�}t|�}|jtjd|��|j|�tj	�}qWdS(NR(
RRARR4R5R6R7RR8RB(RR(R%R*titemR:R,((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR9�s

cCs)tjd�}|j||�|j�S(NR(R.R/R9R(RR(R%((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR;�scCstd�j|�dS(Ni(RR3R=(RR%((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR=�s(	R
RR>R?R#R1R9R;R=(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR@�s		tghost_file_handlercBs5eZeed�Zed�Zd�Zd�ZRS(cCs}g}tj�}|jd�}tjd|�\}|j|j|��tj||�}|jr7|j|�xt	r3tj
�}	|jd�}|dkr�Pntjd|�\}|	j|j|��tj|	|�}
|r|j|	jt
j�ntj|j|	j��|
d<|j|
�qwWnB|rS|jdt
j�ntj|j��|d<|j|�|S(NiRRRi(Rtghost_file_entryRRR R!RtchunksR$Rtghost_chunk_entryR<R6tostSEEK_CURtbase64RtSEEK_END(RR%R&R'R(tgfR+R,tg_entrytgcR)((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#�s2	
	
cCstj|�}|j||�S(N(R.R/R#(RR0R&R%((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR1
scCstj�}|jd�}tj||�|j�}t|�}|jtj	d|��|j|�|j
r�x�|D]z}tj�}tj||�|j�}t|�}|jtj	d|��|j|�|jtj
|d��qyWn|jtj
|d��dS(NiRR(RRER2RR4R5R6R7RR8RFRGRJtdecodebytes(RR(R%R*RCR:R,((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR9s"
	

!cCs)tjd�}|j||�|j�S(NR(R.R/R9R(RR(R%((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR;#s(R
RR?R#R1R9R;(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyRD�s!	tpipes_data_extra_handlercBs#eZd�Zd�Zd�ZRS(cCs%|j}|j|�}tj|�S(N(tbytesRRJR(RR%tploadR,tdata((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#0s	cCs tj|�}|j|�dS(N(RJROR7(RRR%RRRS((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR95scCs|j|jtj�|jS(N(R<RQRHRI(RR%RR((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR"9s(R
RR#R9R"(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyRP/s		tsk_queues_extra_handlercBs#eZd�Zd�Zd�ZRS(cCs%|j}|j|�}tj|�S(N(tlengthRRJR(RR%RRR,RS((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#?s	cCs tj|�}|j|�dS(N(RJROR7(RRR%t_unusedRS((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR9DscCs|j|jtj�|jS(N(R<RURHRI(RR%RR((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR"Hs(R
RR#R9R"(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyRT>s		ttcp_stream_extra_handlercBs#eZd�Zd�Zd�ZRS(cCsTi}|j|j�}|j|j�}tj|�|d<tj|�|d<|S(Ntinqtoutq(Rtinq_lentoutq_lenRJR(RR%R*tdRXRY((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#NscCsDtj|d�}tj|d�}|j|�|j|�dS(NRXRY(RJROR7(RRR%RVRXRY((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR9Ys
cCs!|jdtj�|j|jS(Ni(R<RHRKRZR[(RR%R*((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR"`s(R
RR#R9R"(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyRWMs		tipc_sem_set_handlercBs#eZd�Zd�Zd�ZRS(cCs�tj|�}t|d}t|t�}tjd�}|jtkrYtd��n|j|j|��|j	||d�|j
�S(NtnsemstHsArray size mismatchi(Rt
sizeof_u16Rt
sizeof_u64tarraytitemsizet	Exceptiont
fromstringRR<ttolist(RR%R*R)R,troundedR0((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#fscCs�tj|�}t|d}t|t�}tjd�}|jtkrYtd��n|j|�t|�|dkr�td��n|j	|j
��|j	d||�dS(NR^R_sArray size mismatchsNumber of semaphores mismatchs(RR`RRaRbRcRdtfromlistR6R7ttostring(RRR%R*R)R,RgR0((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR9qs
cCs=tj|�}t|d}|jt|t�tj�|S(NR^(RR`R<RRaRHRI(RR%R*R)R,((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR"~s(R
RR#R9R"(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR]es		
tipc_msg_queue_handlercBs#eZd�Zd�Zd�ZRS(cCs�tj|�}g}x�td|d�D]�}|jd�}|dkrNPntjd|�\}tj�}|j|j|��t|j	t
�}	|j|j	�}
|j|	|j	d�|jtj|��|jt
j|
��q)W|S(NitqnumiRRi(RtrangeRRR Rtipc_msgR!RtmsizeRaR<R$RJR(RR%R*R)tmessagesRR+R,tmsgRgRS((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#�scCs�tj|�}x�tdt|�d�D]�}tj�}tj|||�|j�}t|�}|jtj	d|��|j|�t
|jt�}	t
j||d�}
|j|
|j �|jd|	|j�q(WdS(NiiRis(RRlR6RRmR4R5R7RR8RRnRaRJRO(RRR%R*R)RRptmsg_strR,RgRS((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR9�s
c
Cs�tj|�}d}x�td|d�D]�}|jd�}|dkrNPntjd|�\}tj�}|j|j|��t|j	t
�}	|j|	tj
�|||j	7}q)W|S(NiRkiRR(RRlRRR RRmR!RRnRaR<RHRI(
RR%R*R)tpl_lenRR+R,RpRg((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR"�s(R
RR#R9R"(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyRj�s		tipc_shm_handlercBs#eZd�Zd�Zd�ZRS(cCsXtj|�}|d}|j|�}t|t�}|j||d�tj|�S(NR,i(RRRt
sizeof_u32R<RJR(RR%R*R)R,RSRg((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#�s
cCsatj|�}|d}tj|�}t|t�}|j|| �|jd||�dS(NR,s(RRJRORRtR7(RRR%R*R)R,RSRg((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR9�s
cCs?tj|�}|d}t|t�}|j|tj�|S(NR,(RRRtR<RHRI(RR%R*R)R,Rg((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR"�s

(R
RR#R9R"(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyRs�s		t	INVENTORYtCOREtIDStCREDStUTSNStIPC_VARtFSt
GHOST_FILEtMMtCGROUPt
TCP_STREAMtSTATStPAGEMAPtPSTREEt	REG_FILEStNS_FILEStEVENTFD_FILEtEVENTPOLL_FILEt
EVENTPOLL_TFDtSIGNALFDtTIMERFDtINOTIFY_FILEt
INOTIFY_WDt
FANOTIFY_FILEt
FANOTIFY_MARKtVMAStPIPEStFIFOtSIGACTt
NETLINK_SKtREMAP_FPATHtMNTSt	TTY_FILEStTTY_INFOtTTY_DATAtRLIMITtTUNFILEt	EXT_FILEStIRMAP_CACHEt
FILE_LOCKStFDINFOtUNIXSKtINETSKtPACKETSKtITIMERStPOSIX_TIMERStNETDEVt
PIPES_DATAt	FIFO_DATAt	SK_QUEUESt	IPCNS_SHMt	IPCNS_SEMt	IPCNS_MSGtNETNStUSERNStSECCOMPtAUTOFStFILEStCPUINFOcCs�tjd|jd��\}|tjdtjdfkr_tjd|jd��\}nytj|}Wnt|��nXyt|}Wntd|��nX||fS(NRit
IMG_COMMONtIMG_SERVICEs&No handler found for image with magic (	RR RRtby_nametby_valRthandlersRd(R%t	img_magictmthandler((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyt
__rhandlers
!cCs?i}t|�\}}||d<|j|||�|d<|S(s�
    Convert criu image from binary format to dict(json).
    Takes a file-like object to read criu image from.
    Returns criu image in dict(json) format.
    RR((R�R#(R%R&R'timageR�R�((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR#$s

cCs9i}t|�\}}||d<|j|�|d<|S(NRR=(R�R=(R%tresR�R�((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pytinfo4s

cCstj|�}t||�S(s-
    Same as load(), but takes a string.
    (R.R/R#(R0R&R%((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR1?scCs�|d}tj|d}|dkry|dkrV|jtjdtjd��qy|jtjdtjd��n|jtjd|��yt|}Wntd��nX|j|d	|�d
S(s�
    Convert criu image from dict(json) format to binary.
    Takes an image in dict(json) format and file-like
    object to write to.
    RRuR�R�RR�R�s*No handler found for image with such magicR(N(R�R�(RR�R7RR8R�RdR9(timgR%R�t	magic_valR�((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR9Gs
##cCs&tjd�}t||�|j�S(sK
    Same as dump(), but takes only an image and returns
    a string.
    R(R.R/R9tgetvalue(R�R%((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyR;bs
((((((((((]R.RJRRHRbRRRRtdirtencodestringRtdecodestringROR`RtRaRRdRRR@RDRPRTRWR]RjRstinventory_entryt
core_entryttask_kobj_ids_entrytcreds_entrytutsns_entryt
ipc_var_entrytfs_entrytmm_entrytcgroup_entryttcp_stream_entrytstats_entrytpstree_entrytreg_file_entryt
ns_file_entryteventfd_file_entryteventpoll_file_entryteventpoll_tfd_entrytsignalfd_entryt
timerfd_entrytinotify_file_entrytinotify_wd_entrytfanotify_file_entrytfanotify_mark_entryt	vma_entryt
pipe_entryt
fifo_entrytsa_entrytnetlink_sk_entrytremap_file_path_entryt	mnt_entryttty_file_entryttty_info_entryttty_data_entrytrlimit_entryt
tunfile_entrytext_file_entrytirmap_cache_entrytfile_lock_entrytfdinfo_entryt
unix_sk_entryt
inet_sk_entrytpacket_sock_entrytitimer_entrytposix_timer_entrytnet_device_entrytpipe_data_entrytsk_packet_entryt
ipc_shm_entryt
ipc_sem_entryt
ipc_msg_entrytnetns_entrytuserns_entryt
seccomp_entrytautofs_entryt
file_entryt
cpuinfo_entryR�R�R?R#R�R1R9R;(((s8/usr/lib/python2.7/site-packages/pycriu/images/images.pyt<module>(s�	o0G 1
	

	
			

Hacked By AnonymousFox1.0, Coded By AnonymousFox