mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 05:48:05 +00:00
crit: Add dump for semaphores
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
21cce134ea
commit
8841edf770
@ -274,7 +274,17 @@ class ipc_sem_set_handler:
|
||||
return s.tolist()
|
||||
|
||||
def dump(self, extra, f, pb):
|
||||
raise Exception("Not yet implemented")
|
||||
entry = pb2dict.pb2dict(pb)
|
||||
size = sizeof_u16 * entry['nsems']
|
||||
rounded = round_up(size, sizeof_u64)
|
||||
s = array.array('H')
|
||||
if s.itemsize != sizeof_u16:
|
||||
raise Exception("Array size mismatch")
|
||||
s.fromlist(extra)
|
||||
if len(s) != entry['nsems']:
|
||||
raise Exception("Number of semaphores mismatch")
|
||||
s.tofile(f)
|
||||
f.write('\0' * (rounded - size))
|
||||
|
||||
class ipc_msg_queue_handler:
|
||||
def load(self, f, pb):
|
||||
|
Loading…
x
Reference in New Issue
Block a user