<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
I was just writing a little mmapped (that's two `m`'s -- no typo ;-)
) file stream and thought to do it properly just in case I might
fork(). So I thought to give some advise about memory:<br>
<blockquote>madvise(daBuffer, FileSize, MADV_DONTFORK);<br>
</blockquote>
<br>
Now if I check the result value and, if <> 0, print the
detailed error code using:<br>
<blockquote>ErrorCode:= fpGetErrNo();<br>
WriteMsg(strError(ErrorCode));<br>
</blockquote>
<br>
I get the most ambiguous results (ENOTTY, ENOENT, which are not even
documented as being possible error comditions after this call).<br>
<br>
After some research I decided to try implement fpGetErrNo myself
using (straight from <errno.h> -- using linux 3.7.4 running
x86_64 hardware):<br>
<br>
<blockquote>Function __errno_location: pcint; cdecl; external 'c'
name '__errno_location';<br>
<br>
Function fpGetErrNo: cint;<br>
Begin<br>
Result:= __errno_location()^;<br>
End;<br>
</blockquote>
<br>
And this gave me the expected results (Out of memory, Success, ...).<br>
<br>
So, did I discover a bug or do I miss something?<br>
<br>
<br>
Just for the record: `daBuffer` is just mmapped in the line
preceding this one, there is no error there, it contains the right
data, `Filesize` is obtained through stat(), so no issue there
either.<br>
<br>
<pre class="moz-signature" cols="72">--
Ewald
</pre>
</body>
</html>