changeset 2a7c8ec11cff in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=2a7c8ec11cff
description:
        base: Fix a potential race in PollQueue::setupAsyncIO

        There is a potential race between enabling asynchronous IO and
        selecting the target for the SIGIO signal. This changeset move the
        F_SETOWN call to before the F_SETFL call that enables SIGIO
        delivery. This ensures that signals are always sent to the correct
        process.

diffstat:

 src/base/pollevent.cc |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (20 lines):

diff -r e672a39fd426 -r 2a7c8ec11cff src/base/pollevent.cc
--- a/src/base/pollevent.cc     Thu Oct 03 11:00:18 2013 +0200
+++ b/src/base/pollevent.cc     Mon Oct 07 16:03:15 2013 +0200
@@ -213,13 +213,13 @@
     else
         flags &= ~(FASYNC);
 
-    if (fcntl(fd, F_SETFL, flags) == -1)
-        panic("Could not set up async IO");
-
     if (set) {
       if (fcntl(fd, F_SETOWN, getpid()) == -1)
         panic("Could not set up async IO");
     }
+
+    if (fcntl(fd, F_SETFL, flags) == -1)
+        panic("Could not set up async IO");
 }
 
 void
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to