2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +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:
Cyrill Gorcunov
2015-12-10 13:07:06 +03:00
committed by Pavel Emelyanov
parent 21cce134ea
commit 8841edf770

View File

@@ -274,7 +274,17 @@ class ipc_sem_set_handler:
return s.tolist() return s.tolist()
def dump(self, extra, f, pb): 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: class ipc_msg_queue_handler:
def load(self, f, pb): def load(self, f, pb):