Changeset 7892963 for global.c


Ignore:
Timestamp:
Apr 27, 2010, 5:21:31 PM (11 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
8479494
Parents:
72634c5
git-author:
Anders Kaseorg <andersk@mit.edu> (04/27/10 16:31:56)
git-committer:
Anders Kaseorg <andersk@mit.edu> (04/27/10 17:21:31)
Message:
Mark variables modified from signal handlers as volatile sig_atomic_t.

According to POSIX, this is the only type of variable (other than
errno) that may be accessed from a signal handler with defined
results.  In practice, at least the volatile is important to prevent
the compiler from reordering accesses.

err_signal_info is a bigger struct that cannot be assigned atomically,
but it’s only for debugging so we just do the best we can.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • global.c

    r98d296d r7892963  
    937937    g->err_signal_info = *siginfo;
    938938  } else {
    939     memset(&(g->err_signal_info), 0, sizeof(siginfo_t));
     939    siginfo_t si;
     940    memset(&si, 0, sizeof(si));
     941    g->err_signal_info = si;
    940942  }
    941943}
Note: See TracChangeset for help on using the changeset viewer.