From: Neal Becker (ndbecker2_at_gmail.com)
Date: Tue Jan 29 2008 - 18:23:35 PST
Hey, this is fun: from ctypes import * class cr_checkpoint_args_t (Structure): _fields_ = [("cr_version", c_int), ("cr_scope", c_int), ("cr_target", c_int), ("cr_fd", c_int), ("cr_signal", c_int), ("cr_timeout", c_int), ("cr_flags", c_int)] libcr = CDLL ('/usr/lib64/libcr.so.0') cr_args = cr_checkpoint_args_t() cr_args.cr_version = 1 CR_SCOPE_PROC = 1 libcr.cri_initialize_checkpoint_args_t (byref(cr_args)) cr_args.cr_scope = CR_SCOPE_PROC cr_args.cr_target = 0 cr_args.cr_signal = 0 cr_args.cr_timeout = 0 cr_args.cr_flags = 0 _id = libcr.cr_init() assert (_id >= 0) def request_checkpoint (cr_args, cr_handle): assert (isinstance (cr_args, cr_checkpoint_args_t)) assert (isinstance (cr_handle, c_ulong)) # c long err = libcr.cr_request_checkpoint (byref(cr_args), byref (cr_handle)) return err, cr_handle cr_handle = c_ulong() cp_file = open ("checkpoint", 'w') cr_args.cr_fd = cp_file.fileno() err,handle = request_checkpoint (cr_args, cr_handle) All we need to add is to wait till file write is finished and close the file (I think)