Build and program starting fixes
This commit is contained in:
@ -666,21 +666,26 @@ void stopLMS() {
|
||||
closedir(dir);
|
||||
|
||||
if (lmsPid) {
|
||||
DBG("SIGSTOP to lmsPID=%d", lmsPid);
|
||||
DBG("SIGSTOP to lmsPID=%d\n", lmsPid);
|
||||
kill(lmsPid, SIGSTOP);
|
||||
} else {
|
||||
DBG("LMS not found\n");
|
||||
}
|
||||
}
|
||||
|
||||
void waitAndContinue() {
|
||||
stopLMS();
|
||||
for (int fd = 3; fd < 9999; ++fd)
|
||||
close(fd);
|
||||
pid_t child = fork();
|
||||
if (child == 0) {
|
||||
execl(elfPath, elfPath, "--msd");
|
||||
DBG("start %s\n", elfPath);
|
||||
execl(elfPath, elfPath, "--msd", (char*) NULL);
|
||||
exit(128);
|
||||
}
|
||||
int status;
|
||||
waitpid(child, &status, 0);
|
||||
DBG("re-start LMS\n");
|
||||
if (lmsPid)
|
||||
kill(lmsPid, SIGCONT);
|
||||
exit(0);
|
||||
|
@ -133,6 +133,7 @@ void runNBD() {
|
||||
reply.error = htonl(0);
|
||||
|
||||
for (;;) {
|
||||
nbd_ioctl(BLKFLSBUF, 0); // flush buffers - we don't want the kernel to cache the writes
|
||||
int nread = read(sock, &request, sizeof(request));
|
||||
|
||||
if (nread < 0) {
|
||||
@ -199,7 +200,9 @@ int main() {
|
||||
|
||||
if (!WIFEXITED(wstatus) || WEXITSTATUS(wstatus) != 0) {
|
||||
LOG("abnormal child return, %d", child);
|
||||
sleep(3);
|
||||
sleep(5);
|
||||
} else {
|
||||
sleep(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user