<html style="direction: ltr;">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">body p { margin-bottom: 0.2cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="UTF-8" bgcolor="#FFFFFF"
text="#000000">
Hi all,<br>
<br>
As we all know, from a signal handler it is only safe to call
functions that are "async signal safe". I have a couple of questions
(three, actually), if anyone happens to know the answer to:<br>
<br>
First, why the name? The list contains functions that are obviously
not async. Does that mean these functions are only safe in
non-blocking mode? (make sense, but you'd expect it to be better
documented)<br>
<br>
The second is why isn't mmap and munmap on this list? These are
functions that are handled entirely by the kernel, and will,
therefor, never block on something that is up to the program that is
currently halted by the signal. Mmap is, in fact, marked as
async-signal-safe on Solaris[1]. And yet, Posix decided not to
include it in its list. On a related note - is mmap
async-signal-safe on Linux?<br>
<br>
And, lastly, what is the signal delivery flow in the kernel? What
happens when a signal arrives in the middle of a blocking system
call? Is the signal handler really called before the system call
code has finished? The prospect seems so absurd to me that it defies
all logic, as well as my understanding of the process, but that is
the only explanation I have for why mmap should not be signal
handler safe.<br>
<br>
Thanks,<br>
Shachar<br>
<br>
1- <a class="moz-txt-link-freetext" href="http://docs.oracle.com/cd/E19963-01/html/821-1463/mmap-2.html">http://docs.oracle.com/cd/E19963-01/html/821-1463/mmap-2.html</a><br>
</body>
</html>