ó k°x]c@sÔddlmZddlZddlZddlZddlZddlZd„Zd„Zd„Z d„Z d„Z d„Z d „Z d d+d „ƒYZd d „Zd„Zdad„Zd„Zd„Zd„Zd„Ziied6dd6dd6d6ied6dd6dd6d6ied6dd6dd6d6Zd„ZiZd„Zd„Zd d,d!„ƒYZd"„Zd#„Zied$6ed%6ed&6ed'6Z d(„Z!d)„Z"e#d*krÐe"ƒndS(-iÿÿÿÿ(tprint_functionNcCs&|drt|ddƒStjSdS(Ntintrb(topentsyststdin(topts((s./usr/lib/python2.7/site-packages/pycriu/cli.pytinf s cCs&|drt|ddƒStjSdS(Ntoutsw+(RRtstdout(R((s./usr/lib/python2.7/site-packages/pycriu/cli.pytoutfs cCsttjj|d|ƒƒS(Ntdir(Rtostpathtjoin(Rtname((s./usr/lib/python2.7/site-packages/pycriu/cli.pytdinfscCsËd}y*tjjt|ƒ|d|dƒ}Wn@tjjk rr}td|jdtj ƒtj dƒnX|dr†d}nt |ƒ}t j ||d|ƒ|tjkrÇ|jdƒndS( NtprettytnoplsSUnknown magic %#x. Maybe you are feeding me an image with raw data(i.e. pages.img)?tfileiitindents (tNonetpycriutimagestloadRtMagicExceptiontprinttmagicRtstderrtexitR tjsontdumpR twrite(RRtimgtexctf((s./usr/lib/python2.7/site-packages/pycriu/cli.pytdecodes*   cCs2tjt|ƒƒ}tjj|t|ƒƒdS(N(RRRRRRR (RR!((s./usr/lib/python2.7/site-packages/pycriu/cli.pytencode0scCs<tjjt|ƒƒ}tj|tjddƒtƒdS(NRi( RRtinfoRRRRR R(Rtinfs((s./usr/lib/python2.7/site-packages/pycriu/cli.pyR&5scCs$||kr||S|d|dS(Ntns_i((tptval((s./usr/lib/python2.7/site-packages/pycriu/cli.pyt get_task_id;stps_itemcBseZd„ZRS(cCs>t|dƒ|_|d|_||_||_g|_dS(Ntpidtppid(R+R-R.R)tcoretkids(tselfR)R/((s./usr/lib/python2.7/site-packages/pycriu/cli.pyt__init__Es    (t__name__t __module__R2(((s./usr/lib/python2.7/site-packages/pycriu/cli.pyR,DsicCswtd|jt|jdƒt|jdƒdd||jddfƒx%|jD]}t|||dƒqUWdS( Ns%7d%7d%7d %s%stpgidtsidt ittctcommi(RR-R+R)R/R0tshow_ps(R)Rtdepthtkid((s./usr/lib/python2.7/site-packages/pycriu/cli.pyR:Ms 'c Csúi}tjjt|dƒƒ}x^|dD]R}tjjt|dt|dƒƒƒ}t||ddƒ}|||jR?R@RA( RRRRR+R,R-RR.R0tappendRR:( Rtpsstps_imgR)R/tpstpsrR-tpp((s./usr/lib/python2.7/site-packages/pycriu/cli.pyt explore_psUs"    cCstdkrBy#tjjt|dƒƒdaWqBgaqBXnttƒdkrXdSx"tD]}|d|kr_|Sq_WdS(Ns files.imgR=itid(t files_imgRRRRRtlen(RtfttfidR#((s./usr/lib/python2.7/site-packages/pycriu/cli.pytftype_find_in_filesps #  cCs‡t|||ƒ}|r$||dS|ddkrZtjjt||ƒƒd|d} d} x¿||d| krÒ||} ||krK| d7} nl| d| d| d| dd?f7} | dddB@r±| dt|idd6| dd6ƒ7} n|}| dd7} |d 7}qW|d 8}td| | fƒq®Wq&WdS( Ns pstree.imgR=R-s mm-%d.imgiRzspagemap-%d.imgs%diÿÿÿÿis %lx / %-8dtvaddrtnr_pagesR…i RUR„s ~s %08lx / %-8dR{iiR7R]RdR|RIs %23ss%-24s%si@i€(RRRRR+RRi( RRDR)R-RztpmstvmitpvmitpmtpstrtpmetvstrRˆ((s./usr/lib/python2.7/site-packages/pycriu/cli.pyt explore_rss%s<#   " REtfdstmemstrsscCst|d|ƒdS(Ntwhat(t explorers(R((s./usr/lib/python2.7/site-packages/pycriu/cli.pytexploreTsc Cs.d}tjd|dtjƒ}|jddƒ}|jdddƒ}|jddd d d ƒ|jd d ddƒ|jddddƒ|jdtdtƒ|jdddƒ}|jd d ddƒ|jddddƒ|jdt ƒ|jdddƒ}|jdƒ|jdt ƒ|jdddƒ}|jdƒ|jddd d!d"d#gƒ|jdt ƒ|jd$dd%ƒ}|jdƒ|jd&dd'd d ƒ|jdtd(t d)dƒt|jƒƒ}|stjj|jƒƒtjjd*ƒtjd+ƒn|d|ƒdS(,NsCRiu Image Toolt descriptiontformatter_classthelps-Use crit CMD --help for command-specific helpR$s+convert criu image from binary type to jsons--prettysIMultiline with indents and some numerical fields in field-specific formattactiont store_trues-is--ins<criu image in binary format to be decoded (stdin by default)s-os--outs:where to put criu image in json format (stdout by default)tfuncRR%s+convert criu image from json type to binarys:criu image in json format to be encoded (stdin by default)s<where to put criu image in binary format (stdout by default)R&sshow info about imageRRƒsexplore image dirR RštchoicesRER—R˜R™tshows5convert criu image from binary to human-readable jsons--nopls%do not show entry payload (if exists)RRscrit: error: too few arguments i(targparsetArgumentParsertRawTextHelpFormattertadd_subparserst add_parsert add_argumentt set_defaultsR$tFalseR%R&RœtTrueRtvarst parse_argsRRR t format_usageR( tdesctparsert subparserst decode_parsert encode_parsert info_parsertx_parsert show_parserR((s./usr/lib/python2.7/site-packages/pycriu/cli.pytmainXsf       t__main__((($t __future__RR¥RRR RRR RR$R%R&R+R,R:RHRRJRNRPRRRTRZRfRcReRiRrRsRŒR–R›RœR¹R3(((s./usr/lib/python2.7/site-packages/pycriu/cli.pytsd                       5 '   E