Projects STRLCPY criu Commits babc8b3d
🤬
  • crit: Files now sit in another image

    When merging files into one image we've forgotten about crit x
    feature that scans image files by names.
    
    https://github.com/xemul/criu/issues/381
    
    The patch was made for master (as in criu-dev there was problem
    with pstree_item.pid parsing), but should apply to dev smoothly.
    
    Signed-off-by: Pavel Emelyanov <[email protected]>
  • Loading...
  • Pavel Emelyanov committed 7 years ago
    babc8b3d
    1 parent b6d397e4
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    crit/crit
    skipped 88 lines
    89 89   print "%7s%7s%7s %s" % ('PID', 'PGID', 'SID', 'COMM')
    90 90   show_ps(psr, opts)
    91 91   
     92 +files_img = None
     93 + 
     94 +def ftype_find_in_files(opts, ft, fid):
     95 + global files_img
     96 + 
     97 + if files_img is None:
     98 + try:
     99 + files_img = pycriu.images.load(dinf(opts, "files.img"))['entries']
     100 + except:
     101 + files_img = []
     102 + 
     103 + if len(files_img) == 0:
     104 + return None
     105 + 
     106 + for f in files_img:
     107 + if f['id'] == fid:
     108 + return f
     109 + 
     110 + return None
     111 + 
    92 112   
    93 113  def ftype_find_in_image(opts, ft, fid, img):
     114 + f = ftype_find_in_files(opts, ft, fid)
     115 + if f:
     116 + return f[ft['field']]
     117 + 
    94 118   if ft['img'] == None:
    95 119   ft['img'] = pycriu.images.load(dinf(opts, img))['entries']
    96 120   for f in ft['img']:
    skipped 14 lines
    111 135   if not ux:
    112 136   return 'unix[?]'
    113 137   
    114  - n = ux['name'] and ' %s' % ux['name'].decode('base64') or ''
     138 + n = ux['name'] and ' %s' % ux['name'] or ''
    115 139   return 'unix[%d (%d)%s]' % (ux['ino'], ux['peer'], n)
    116 140   
    117 141  file_types = {
    118  - 'REG': {'get': ftype_reg, 'img': None},
    119  - 'PIPE': {'get': ftype_pipe, 'img': None},
    120  - 'UNIXSK': {'get': ftype_unix, 'img': None},
     142 + 'REG': {'get': ftype_reg, 'img': None, 'field': 'reg'},
     143 + 'PIPE': {'get': ftype_pipe, 'img': None, 'field': 'pipe'},
     144 + 'UNIXSK': {'get': ftype_unix, 'img': None, 'field': 'usk'},
    121 145  }
    122 146   
    123 147  def ftype_gen(opts, ft, fid):
    skipped 189 lines
Please wait...
Page is in error, reload to recover