LINUX.ORG.RU

История изменений

Исправление Manhunt, (текущая версия) :

Пример конкретный можно, что должно быть по разному в libc (для ядер 2.6.18+)? API ядра твердокаменный же.

Вот тебе первый попавшийся пример (по идее, таких примеров должно быть много, но мне скучно в этом копаться, так что развивать тему дальше я не буду):


http://man7.org/linux/man-pages/man2/fallocate.2.html


This is a nonportable, Linux-specific system call. For the portable,
POSIX.1-specified method of ensuring that space is allocated for a
file, see posix_fallocate(3).

fallocate() is available on Linux since kernel 2.6.23.


http://man7.org/linux/man-pages/man3/posix_fallocate.3.html


posix_fallocate() is available since glibc 2.1.94.


In the glibc implementation, posix_fallocate() is implemented using
the fallocate(2) system call, which is MT-safe. If the underlying
filesystem does not support fallocate(2), then the operation is
emulated with the following caveats:

* The emulation is inefficient.

* There is a race condition where concurrent writes from another
thread or process could be overwritten with null bytes.

* There is a race condition where concurrent file size increases by
another thread or process could result in a file whose size is
smaller than expected.

* If fd has been opened with the O_APPEND or O_WRONLY flags, the
function will fail with the error EBADF.

Исходная версия Manhunt, :

Пример конкретный можно, что должно быть по разному в libc (для ядер 2.6.18+)? API ядра твердокаменный же.

Вот тебе первый попавшийся пример (по идее, таких примеров должно быть много, но мне скучно в этом копаться, так что развивать тему дальше я не буду):


http://man7.org/linux/man-pages/man2/fallocate.2.html


This is a nonportable, Linux-specific system call. For the portable,
POSIX.1-specified method of ensuring that space is allocated for a
file, see posix_fallocate(3).

fallocate() is available on Linux since kernel 2.6.23.


http://man7.org/linux/man-pages/man2/syscalls.2.html


posix_fallocate() is available since glibc 2.1.94.


In the glibc implementation, posix_fallocate() is implemented using
the fallocate(2) system call, which is MT-safe. If the underlying
filesystem does not support fallocate(2), then the operation is
emulated with the following caveats:

* The emulation is inefficient.

* There is a race condition where concurrent writes from another
thread or process could be overwritten with null bytes.

* There is a race condition where concurrent file size increases by
another thread or process could result in a file whose size is
smaller than expected.

* If fd has been opened with the O_APPEND or O_WRONLY flags, the
function will fail with the error EBADF.