dom0/meminfo-writer: fork into background after first info sent to qmemman (#635)

This commit is contained in:
Marek Marczykowski 2012-07-20 16:41:26 +02:00
parent 148e5e55f7
commit 5ea32bd11b
2 changed files with 12 additions and 1 deletions

View File

@ -33,7 +33,7 @@ start()
/usr/lib/qubes/qmemman_daemon.py
MEM_CHANGE_THRESHOLD_KB=30000
MEMINFO_DELAY_USEC=100000
/usr/lib/qubes/meminfo-writer $MEM_CHANGE_THRESHOLD_KB $MEMINFO_DELAY_USEC &
/usr/lib/qubes/meminfo-writer $MEM_CHANGE_THRESHOLD_KB $MEMINFO_DELAY_USEC
# Hide mounted devices from qubes-block list (at first udev run, only / is mounted)
for dev in `xenstore-list /local/domain/0/qubes-block-devices`; do

View File

@ -154,6 +154,17 @@ int main(int argc, char **argv)
perror("xs_domain_open");
exit(1);
}
if (argc == 3) {
/* if not waiting for signal, fork after first info written to xenstore */
n = pread(fd, buf, sizeof(buf), 0);
buf[n] = 0;
meminfo_data = parse(buf);
if (meminfo_data)
send_to_qmemman(xs, meminfo_data);
if (fork() > 0)
exit(0);
}
for (;;) {
n = pread(fd, buf, sizeof(buf), 0);
buf[n] = 0;