preload/posix: correct errnos in some posix.io functions

 - read()/readv() can't set EOVERFLOW, drop it.
 - pread()/pwrite() can return ENXIO (from lseek(2)), add it.
 - all write functions can return EDQUOT which is quite an important
   error code, add it.

Signed-off-by: Pavel Borzenkov <pavel@voidptr.ru>
preload/posix: add preadv()/pwritev() to posix.io

Signed-off-by: Pavel Borzenkov <pavel@voidptr.ru>
preload/posix: correct sync_file_range() prototype

sync_file_range() always use 64-bit types for offset regardless of host
arch or _FILE_OFFSET_BITS macro.

Signed-off-by: Pavel Borzenkov <pavel@voidptr.ru>
preload/posix: add a way to generate 64-bit counterparts

Some functions (for example, pread()) have their 64-bit counterparts for
the case when off_t is 64-bit on 32-bit system (e.g. FILE_OFFSET_BITS=64
macro is defined). If the macro is defined, a binary will be linked with
<func>64() symbol instead of <func>() and libfiu won't be able to hook
it.

This might not be that important since 32-bit systems are rare now,
but, despite the fact that feature_test_macros(7) man states that there
is no effect on 64-bit system, there actually is. Even on 64-bit systems
when FILE_OFFSET_BITS=64 is defined, <func>64() symbols is used instead
of <func>().

Since it is a good practice to actually define this macro, libfiu can't
hook any of such functions.

To fix this, add a special keyword "variant: off64_t" to function
description and output two variants of a function if such a keyword is
present.

Signed-off-by: Pavel Borzenkov <pavel@voidptr.ru>
preload/posix: mark some functions with 'variant: off64_t'

Mark functions that use off_t type with off64_t to generate their 64-bit
counterparts. Also, define _LARGEFILE64_SOURCE for all the modules to
expose off64_t type.

Signed-off-by: Pavel Borzenkov <pavel@voidptr.ru>
Add tests for pread() and pread64()

This patch adds simple autogenerated tests for pread() and pread64().

Both functions share the same failure point, and are generated using the
off64_t variant mechanism, so this serves as a test for both the variant code
generation as well as the build environment.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
Only generate off64_t variants when using glibc

The off64_t variants only make sense in a glibc environment, because they
serve as a work around for a glibc LFS implementation trick.

This patch adjust the code generation to surround the off64_t variants with

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
preadv() takes off_t, not off64_t

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>