gmio_core: in gmio_stream_stdio_size(), use fstat64() when available
This commit is contained in:
parent
35359a2580
commit
2929ea45c5
@ -21,50 +21,37 @@
|
|||||||
|
|
||||||
#if defined(GMIO_HAVE_SYS_TYPES_H) && defined(GMIO_HAVE_SYS_STAT_H)
|
#if defined(GMIO_HAVE_SYS_TYPES_H) && defined(GMIO_HAVE_SYS_STAT_H)
|
||||||
|
|
||||||
/* Activate 64bit variants of stat(), fstat(), ...
|
/* For some platforms maybe it's better to override stat(), fstat(), etc. with
|
||||||
* See:
|
* 64bit variants. See:
|
||||||
* http://linux.die.net/man/2/fstat64
|
* http://linux.die.net/man/2/fstat64
|
||||||
|
* #define _FILE_OFFSET_BITS 64
|
||||||
* https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/fstat.2.html
|
* https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/fstat.2.html
|
||||||
|
* #define _DARWIN_USE_64_BIT_INODE
|
||||||
*/
|
*/
|
||||||
# ifdef GMIO_OS_LINUX
|
|
||||||
# if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS != 64
|
|
||||||
# undef _FILE_OFFSET_BITS
|
|
||||||
# endif
|
|
||||||
# if !defined(_FILE_OFFSET_BITS)
|
|
||||||
# define _FILE_OFFSET_BITS=64
|
|
||||||
# endif
|
|
||||||
# if !defined(_POSIX_C_SOURCE)
|
|
||||||
/* This enables fileno() */
|
|
||||||
# define _POSIX_C_SOURCE
|
|
||||||
# endif
|
|
||||||
# define GMIO_FSTAT64_OVERRIDE
|
|
||||||
# endif /* Linux */
|
|
||||||
|
|
||||||
# ifdef GMIO_OS_MAC
|
|
||||||
# if !defined(_DARWIN_USE_64_BIT_INODE)
|
|
||||||
# define _DARWIN_USE_64_BIT_INODE
|
|
||||||
# endif
|
|
||||||
# define GMIO_FSTAT64_OVERRIDE
|
|
||||||
# endif /* Apple */
|
|
||||||
|
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
|
|
||||||
/* Define wrapper around the stat structure and the fstat() function */
|
/* gmio_stat_t: type alias on the stat structure
|
||||||
# ifdef GMIO_HAVE_WIN__FSTAT64_FUNC
|
* GMIO_FSTAT_FUNC_NAME: alias on the fstat() function
|
||||||
|
*/
|
||||||
|
# if defined(GMIO_HAVE_WIN__FSTAT64_FUNC)
|
||||||
typedef struct __stat64 gmio_stat_t;
|
typedef struct __stat64 gmio_stat_t;
|
||||||
GMIO_INLINE int gmio_fstat(int fd, gmio_stat_t* buf)
|
# define GMIO_FSTAT_FUNC_NAME _fstat64
|
||||||
{ return _fstat64(fd, buf); }
|
|
||||||
# elif defined(GMIO_FSTAT64_OVERRIDE) || !defined(GMIO_HAVE_POSIX_FSTAT64_FUNC)
|
|
||||||
typedef struct stat gmio_stat_t;
|
|
||||||
GMIO_INLINE int gmio_fstat(int fd, gmio_stat_t* buf)
|
|
||||||
{ return fstat(fd, buf); }
|
|
||||||
# elif defined(GMIO_HAVE_POSIX_FSTAT64_FUNC)
|
# elif defined(GMIO_HAVE_POSIX_FSTAT64_FUNC)
|
||||||
typedef struct stat64 gmio_stat_t;
|
typedef struct stat64 gmio_stat_t;
|
||||||
GMIO_INLINE int gmio_fstat(int fd, gmio_stat_t* buf)
|
# define GMIO_FSTAT_FUNC_NAME fstat64
|
||||||
{ return fstat64(fd, buf); }
|
# else
|
||||||
|
typedef struct stat gmio_stat_t;
|
||||||
|
# define GMIO_FSTAT_FUNC_NAME fstat
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
/* Define wrapper around the fstat() function */
|
||||||
|
GMIO_INLINE int gmio_fstat(int fd, gmio_stat_t* buf)
|
||||||
|
{
|
||||||
|
return GMIO_FSTAT_FUNC_NAME(fd, buf);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* GMIO_HAVE_SYS_TYPES_H && GMIO_HAVE_SYS_STAT_H */
|
#endif /* GMIO_HAVE_SYS_TYPES_H && GMIO_HAVE_SYS_STAT_H */
|
||||||
|
|
||||||
gmio_stream_t gmio_stream_null()
|
gmio_stream_t gmio_stream_null()
|
||||||
|
Loading…
Reference in New Issue
Block a user