about summary refs log tree commit diff homepage
path: root/runtime/POSIX/fd_32.c
diff options
context:
space:
mode:
authorPaul Marinescu <paul.marinescu@imperial.ac.uk>2013-08-29 15:59:16 +0100
committerPaul Marinescu <paul.marinescu@imperial.ac.uk>2013-08-29 15:59:16 +0100
commitb6939ec17b8341b3e0c9b56475e5986750380991 (patch)
treec44ae0525b1fc3ed752d235e9921d7548f65769a /runtime/POSIX/fd_32.c
parent821b6f6473334eaa6c78205603faf14a2c1aca41 (diff)
downloadklee-b6939ec17b8341b3e0c9b56475e5986750380991.tar.gz
Added some of the common *at functions to the model
Diffstat (limited to 'runtime/POSIX/fd_32.c')
-rw-r--r--runtime/POSIX/fd_32.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/runtime/POSIX/fd_32.c b/runtime/POSIX/fd_32.c
index 338d9ba2..5d311206 100644
--- a/runtime/POSIX/fd_32.c
+++ b/runtime/POSIX/fd_32.c
@@ -41,6 +41,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 +65,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);
 }