projects
/
gapil.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Spostata utimesat nella sezione delle at-functions
[gapil.git]
/
sources
/
FifoReporter.c
diff --git
a/sources/FifoReporter.c
b/sources/FifoReporter.c
index 49b328aafe3489a267f75f2ffc85d79ead98a713..0ce8c37df0313cb39d07267077e424558c7adee1 100644
(file)
--- a/
sources/FifoReporter.c
+++ b/
sources/FifoReporter.c
@@
-157,7
+157,7
@@
int main(int argc, char *argv[])
die("Cannot create well known fifo");
}
if ((fifofd = open(fifoname, O_RDWR|O_NONBLOCK)) < 0) // open fifo
die("Cannot create well known fifo");
}
if ((fifofd = open(fifoname, O_RDWR|O_NONBLOCK)) < 0) // open fifo
- die("Cannot open
read only
well known fifo");
+ die("Cannot open well known fifo");
epev.data.fd = fifofd; // add fd to epoll
epev.events = EPOLLIN;
if (epoll_ctl(epfd, EPOLL_CTL_ADD, fifofd, &epev))
epev.data.fd = fifofd; // add fd to epoll
epev.events = EPOLLIN;
if (epoll_ctl(epfd, EPOLL_CTL_ADD, fifofd, &epev))
@@
-165,11
+165,12
@@
int main(int argc, char *argv[])
/*
* Main body: wait something to report
*/
/*
* Main body: wait something to report
*/
+ printf("FifoReporter starting, pid %i\n", getpid());
while (1) {
if ((n=epoll_wait(epfd, events, MAX_EPOLL_EV, -1)) < 0)
die("error on epoll_wait");
debug("Got %i events\n", n);
while (1) {
if ((n=epoll_wait(epfd, events, MAX_EPOLL_EV, -1)) < 0)
die("error on epoll_wait");
debug("Got %i events\n", n);
- /* loop on ep
po
l events */
+ /* loop on ep
ol
l events */
for (i=0; i<n; i++) {
if (events[i].data.fd == sigfd) { // if signalfd ready
printf("Signal received:\n");
for (i=0; i<n; i++) {
if (events[i].data.fd == sigfd) { // if signalfd ready
printf("Signal received:\n");
@@
-185,7
+186,9
@@
int main(int argc, char *argv[])
continue;
}
printf("Got %s\n", sig_names[siginf.ssi_signo]);
continue;
}
printf("Got %s\n", sig_names[siginf.ssi_signo]);
+ printf("From pid %i\n", siginf.ssi_pid);
if(siginf.ssi_signo == SIGINT) { // SIGINT is exit
if(siginf.ssi_signo == SIGINT) { // SIGINT is exit
+ printf("SIGINT means exit\n");
unlink(fifoname);
exit(0);
}
unlink(fifoname);
exit(0);
}
@@
-204,7
+207,7
@@
int main(int argc, char *argv[])
}
buffer[nread] = 0;
if (fputs(buffer, stdout) == EOF)
}
buffer[nread] = 0;
if (fputs(buffer, stdout) == EOF)
- die("Error
e in scrittura su terminal
e");
+ die("Error
on terminal writ
e");
}
} else { // anything else is an error
printf("epoll activity on unknown %i file descriptor\n",
}
} else { // anything else is an error
printf("epoll activity on unknown %i file descriptor\n",