summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-08-08 17:13:33 -0700
committerElliott Hughes <enh@google.com>2013-08-08 17:13:33 -0700
commitd0be7c8f9a06b3ca8ea7647ea35c8f9dc63f0fe1 (patch)
treea17df28516ef00c47859728418e9b7c7ef26c1ba /libc
parent632fd5183a611b80e009be36f881f572acc41619 (diff)
downloadbionic-d0be7c8f9a06b3ca8ea7647ea35c8f9dc63f0fe1.zip
bionic-d0be7c8f9a06b3ca8ea7647ea35c8f9dc63f0fe1.tar.gz
bionic-d0be7c8f9a06b3ca8ea7647ea35c8f9dc63f0fe1.tar.bz2
Add futimens.
Bug: 10239370 Change-Id: I518340084103dc339ef8a065d4837d6258a1381d
Diffstat (limited to 'libc')
-rw-r--r--libc/Android.mk1
-rw-r--r--libc/bionic/futimens.cpp34
-rw-r--r--libc/include/sys/stat.h3
3 files changed, 37 insertions, 1 deletions
diff --git a/libc/Android.mk b/libc/Android.mk
index f353c41..db97a74 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -190,6 +190,7 @@ libc_bionic_src_files := \
bionic/eventfd_read.cpp \
bionic/eventfd_write.cpp \
bionic/__fgets_chk.cpp \
+ bionic/futimens.cpp \
bionic/getauxval.cpp \
bionic/getcwd.cpp \
bionic/libc_init_common.cpp \
diff --git a/libc/bionic/futimens.cpp b/libc/bionic/futimens.cpp
new file mode 100644
index 0000000..1ca8eb5
--- /dev/null
+++ b/libc/bionic/futimens.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <sys/stat.h>
+
+int futimens(int fd, const struct timespec times[2]) {
+ return utimensat(fd, NULL, times, 0);
+}
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index c7715a3..10627b9 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -168,7 +168,8 @@ extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char
# define UTIME_NOW ((1l << 30) - 1l)
# define UTIME_OMIT ((1l << 30) - 2l)
-extern int utimensat (int fd, const char *path, const struct timespec times[2], int flags);
+extern int utimensat(int fd, const char *path, const struct timespec times[2], int flags);
+extern int futimens(int fd, const struct timespec times[2]);
__END_DECLS