Question on closing checkpoint file

From: Neal Becker (ndbecker2_at_gmail.com)
Date: Wed Jan 30 2008 - 04:06:38 PST

  • Next message: postmaster_at_krakmail.b2b.dk: "Message delayed ([email protected])"
    In the ctypes wrapper I just sent, there are a couple of small issues.
    Here is the loop I used (python version of cr_checkpoint.c)
    
    with open ("checkpoint", 'w') as cp_file:
        cr_args.cr_fd = cp_file.fileno()
    
        err,cr_handle = request_checkpoint (cr_args, cr_handle)
    
        err = -1
        while (err < 0):
            err = libcr.cr_poll_checkpoint (byref(cr_handle), POINTER(timeval_t)
    ())
            print "err:", os.strerror(err)
            if (err < 0):
                if (errno == EINVAL):
                    break                   # restarted
                elif (errno == EINTR):
                    continue
                else:
                    die ("cr_poll_checkpoint")
            elif (err == 0):
                die ("cr_poll_checkpoint returned unexpected 0")
    
    On restart, I get:
    cr_restart checkpoint 
    err: Unknown error 18446744073709551615
    ---------------------------------------------------------------------------
    IOError                                   Traceback (most recent call last)
    
    /home/nbecker/idma-cdma/test/<ipython console> in <module>()
    
    /usr/tmp/python-m9AicK.py in <module>()
    
    IOError: [Errno 9] Bad file descriptor
    
    Looks like 2 errors:
    1) On restart, the "print err" statement is executed and seems to print a 
    garbage value
    2) Looks like on restart closing the fd is a bad idea
    

  • Next message: postmaster_at_krakmail.b2b.dk: "Message delayed ([email protected])"