Sorry for delay, following is an explanation:
>> --- a/tools/libxc/xc_suspend.c Thu Aug 26 11:16:56 2010 +0100 >> +++ b/tools/libxc/xc_suspend.c Fri Nov 26 19:41:23 2010 +0800 >> @@ -16,19 +16,19 @@ >... >> +#include
>That looks like a mistake.
I wonder if you think the header file has something wrong?
flock is defined in <sys/file.h>. To use it, need to include that header file.
>> @@ -127,8 +115,7 @@ >> return suspend_evtchn; >> >> cleanup: >> - if (suspend_evtchn != -1) >> - xc_suspend_evtchn_release(xch, xce, domid, suspend_evtchn); >> + xc_suspend_evtchn_release(xch, xce, domid, suspend_evtchn); >> >> return -1; >> }
>What is this change for ?
if (suspend_evtchn != -1) part is unnecessary and might leave an orphan lock file.
Only suspend_evtchn > 0 means we got the lock successfully, all other values means we failed to bind suspend event channel, so we should do cleanup work, including: the lock file we created before should be removed. Otherwise, in xc_save, if suspend_evtchn = -1, there will be no chance to remove the lock file.
I noticed this part was added by Jiang, Yunhong, I've talked with him before, he also thought that the if (suspend_evtchn != -1) part should be removed altogether.
|