Or the signal handler functions do not comply with the relevant
    specifications, e.g.: signal handlers that do not preserve the value
    of errno, signal handlers that use a function not in the list of
    approved safe functions you can call from a signal handler as per
    the Single Unix Specification, etc...


Good point.  The signal handler essentially calls gettimeofday (not on
the approved list but time is) and sets a couple of variables (current
64-bit microsecond time, stackLimit).  But it does not preserve errno.
  I don't want to avoid calling gettimeofday and can see no harm in it;
it's equivalent internally to time providing it doesn't use its TIMEZONE
arg (which it doesn't).  But the signal handler /doesn't/ preserve errno
and doing so is a very good idea and easy to do.  Thanks.

Ok, but note that calling a function not on the list of approved functions results in undefined behavior. So, maybe later on you change the optimization level and the VM doesn't work, or you change some other unrelated code and the VM segfaults, etc... maybe it's less painful to just bite the bullet and obey the spec.

Andres.

Reply via email to