Python: libc fallocate returns with failure
<p>I am trying to fallocate a tempfile, but unfortunately the following code returns -1 (failure):</p>

<pre><code>import ctypes, tempfile
from ctypes import *

t_file=tempfile.NamedTemporaryFile(delete=True, dir=".", prefix="temp_file_")

libc=cdll.LoadLibrary("libc.so.6")
libc.fallocate(t_file.fileno(), c_int(0), c_longlong(0), c_longlong(102400))
</code></pre>

<p>However, I can do fine with the following from command line</p>

<pre><code>hdparm --fallocate 10 ./temp_file_foo
</code></pre>

<p>which should do the same. If it matters, this is done on an ext4 filesystem. </p>

<p>A separate question I have is whether libc.fallocate writes zeros to the disk, or does it mark the blocks as uninitialized? </p>
