Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:Maintenance:114
xen.openSUSE_Evergreen_11.4
suspend_evtchn_lock.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File suspend_evtchn_lock.patch of Package xen.openSUSE_Evergreen_11.4
Index: xen-4.0.3-testing/tools/libxc/xc_suspend.c =================================================================== --- xen-4.0.3-testing.orig/tools/libxc/xc_suspend.c +++ xen-4.0.3-testing/tools/libxc/xc_suspend.c @@ -6,14 +6,46 @@ #include "xc_private.h" #include "xenguest.h" +#include <signal.h> +#include <signal.h> +#ifdef __MINIOS__ +extern int kill (__pid_t __pid, int __sig); +#endif #define SUSPEND_LOCK_FILE "/var/lib/xen/suspend_evtchn_lock.d" +/* cleanup obsolete suspend lock file which is unlinked for any reason, +so that current process can get lock */ +static void clean_obsolete_lock(void) +{ + int fd, pid, n; + char buf[128]; + fd = open(SUSPEND_LOCK_FILE, O_RDWR); + if (fd < 0) + return; + + n = read(fd, buf, 127); + + close(fd); + + if (n > 0) + { + sscanf(buf, "%d", &pid); + /* pid does not exist, this lock file is obsolete, just delete it */ + if ( kill(pid,0) ) + { + unlink(SUSPEND_LOCK_FILE); + return; + } + } +} + static int lock_suspend_event(void) { int fd, rc; mode_t mask; char buf[128]; + clean_obsolete_lock(); mask = umask(022); fd = open(SUSPEND_LOCK_FILE, O_CREAT | O_EXCL | O_RDWR, 0666); if (fd < 0) @@ -27,6 +59,9 @@ static int lock_suspend_event(void) rc = write_exact(fd, buf, strlen(buf)); close(fd); + if(rc) + unlink(SUSPEND_LOCK_FILE); + return rc; } @@ -110,8 +145,7 @@ int xc_suspend_evtchn_init(int xc, int x return suspend_evtchn; cleanup: - if (suspend_evtchn != -1) - xc_suspend_evtchn_release(xce, suspend_evtchn); + xc_suspend_evtchn_release(xce, suspend_evtchn); return -1; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor