From d0be7c8f9a06b3ca8ea7647ea35c8f9dc63f0fe1 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 8 Aug 2013 17:13:33 -0700 Subject: Add futimens. Bug: 10239370 Change-Id: I518340084103dc339ef8a065d4837d6258a1381d --- libc/Android.mk | 1 + libc/bionic/futimens.cpp | 34 ++++++++++++++++++++++++++++++++++ libc/include/sys/stat.h | 3 ++- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 libc/bionic/futimens.cpp (limited to 'libc') 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 +#include + +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 -- cgit v1.1