From 6f83b8c4c6ad6fc8c3056bc1380a125123c761e9 Mon Sep 17 00:00:00 2001 From: oetiker Date: Fri, 15 Jan 2010 06:57:18 +0000 Subject: [PATCH] add a timeout to the ms_async timestamp updating issue since this test was reported to hang while sync was called. git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2003 a5681a0c-68f1-0310-ab6d-d61299d08faa --- m4/acinclude.m4 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 index 01eb4a4..ee2fc1b 100644 --- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -524,6 +524,8 @@ AC_CACHE_VAL([rd_cv_ms_async], #include #include #include +#include +void timeout (int i) { exit (1); } int main(void){ int fd; struct stat stbuf; @@ -531,7 +533,6 @@ int main(void){ int res; char temp[] = "mmaptestXXXXXX"; struct utimbuf newtime; - time_t create_ts; fd = mkstemp(temp); if (fd == -1){ @@ -560,13 +561,17 @@ int main(void){ perror("close"); goto bad_exit; } + /* there were reports of sync hanging + so we better set an alarm */ + signal(SIGALRM,&timeout); + alarm(5); /* The ASYNC means that we schedule the msync and return immediately. Since we want to see if the modification time is updated upon msync(), we have to make sure that our asynchronous request completes before we stat below. In a real application, the request would be completed at a random time in the future but for this test we do not want to wait an arbitrary amount of - time, so force a commit now. */ + time, so force a commit now. */ sync(); stat(temp, &stbuf); if (create_ts > stbuf.st_mtime){ -- 2.11.0