diff options
Diffstat (limited to 'runtime/POSIX/fd_32.c')
-rw-r--r-- | runtime/POSIX/fd_32.c | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/runtime/POSIX/fd_32.c b/runtime/POSIX/fd_32.c index 6246f057..36c5d41f 100644 --- a/runtime/POSIX/fd_32.c +++ b/runtime/POSIX/fd_32.c @@ -6,7 +6,18 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// Contains 32bit definitions of posix file functions +//===--- +#if __GNUC__ +#if __x86_64__ || __ppc64__ +#define ENV64 +#else +#define ENV32 +#endif +#endif + +#include "klee/Config/Version.h" #define _LARGEFILE64_SOURCE #include "fd.h" @@ -41,6 +52,12 @@ static void __stat64_to_stat(struct stat64 *a, struct stat *b) { b->st_ctime = a->st_ctime; b->st_blksize = a->st_blksize; b->st_blocks = a->st_blocks; +#ifdef _BSD_SOURCE + b->st_atim.tv_nsec = a->st_atim.tv_nsec; + b->st_mtim.tv_nsec = a->st_mtim.tv_nsec; + b->st_ctim.tv_nsec = a->st_ctim.tv_nsec; +#endif + } /***/ @@ -59,6 +76,20 @@ int open(const char *pathname, int flags, ...) { return __fd_open(pathname, flags, mode); } +int openat(int fd, const char *pathname, int flags, ...) { + mode_t mode = 0; + + if (flags & O_CREAT) { + /* get mode */ + va_list ap; + va_start(ap, flags); + mode = va_arg(ap, mode_t); + va_end(ap); + } + + return __fd_openat(fd, pathname, flags, mode); +} + off_t lseek(int fd, off_t off, int whence) { return (off_t) __fd_lseek(fd, off, whence); } @@ -173,19 +204,3 @@ __attribute__((weak)) int open64(const char *pathname, int flags, ...) { return __fd_open(pathname, flags, mode); } - -__attribute__((weak)) off64_t lseek64(int fd, off64_t off, int whence) { - return __fd_lseek(fd, off, whence); -} - -__attribute__((weak)) int stat64(const char *path, struct stat64 *buf) { - return __fd_stat(path, buf); -} - -__attribute__((weak)) int lstat64(const char *path, struct stat64 *buf) { - return __fd_lstat(path, buf); -} - -__attribute__((weak)) int fstat64(int fd, struct stat64 *buf) { - return __fd_fstat(fd, buf); -} |