1*9131e98aSAntoine Leca /* $NetBSD: utimens.c,v 1.1 2012/11/03 19:39:21 christos Exp $ */
2*9131e98aSAntoine Leca
3*9131e98aSAntoine Leca /*-
4*9131e98aSAntoine Leca * Copyright (c) 2012 The NetBSD Foundation, Inc.
5*9131e98aSAntoine Leca * All rights reserved.
6*9131e98aSAntoine Leca *
7*9131e98aSAntoine Leca * This code is derived from software contributed to The NetBSD Foundation
8*9131e98aSAntoine Leca * by Christos Zoulas.
9*9131e98aSAntoine Leca *
10*9131e98aSAntoine Leca * Redistribution and use in source and binary forms, with or without
11*9131e98aSAntoine Leca * modification, are permitted provided that the following conditions
12*9131e98aSAntoine Leca * are met:
13*9131e98aSAntoine Leca * 1. Redistributions of source code must retain the above copyright
14*9131e98aSAntoine Leca * notice, this list of conditions and the following disclaimer.
15*9131e98aSAntoine Leca * 2. Redistributions in binary form must reproduce the above copyright
16*9131e98aSAntoine Leca * notice, this list of conditions and the following disclaimer in the
17*9131e98aSAntoine Leca * documentation and/or other materials provided with the distribution.
18*9131e98aSAntoine Leca *
19*9131e98aSAntoine Leca * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*9131e98aSAntoine Leca * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*9131e98aSAntoine Leca * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*9131e98aSAntoine Leca * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*9131e98aSAntoine Leca * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*9131e98aSAntoine Leca * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*9131e98aSAntoine Leca * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*9131e98aSAntoine Leca * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*9131e98aSAntoine Leca * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*9131e98aSAntoine Leca * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*9131e98aSAntoine Leca * POSSIBILITY OF SUCH DAMAGE.
30*9131e98aSAntoine Leca */
31*9131e98aSAntoine Leca
32*9131e98aSAntoine Leca #include <sys/cdefs.h>
33*9131e98aSAntoine Leca #if defined(LIBC_SCCS) && !defined(lint)
34*9131e98aSAntoine Leca __RCSID("$NetBSD: utimens.c,v 1.1 2012/11/03 19:39:21 christos Exp $");
35*9131e98aSAntoine Leca #endif /* LIBC_SCCS and not lint */
36*9131e98aSAntoine Leca
37*9131e98aSAntoine Leca #include "namespace.h"
38*9131e98aSAntoine Leca
39*9131e98aSAntoine Leca #define _INCOMPLETE_XOPEN_C063
40*9131e98aSAntoine Leca #include <fcntl.h>
41*9131e98aSAntoine Leca #include <sys/stat.h>
42*9131e98aSAntoine Leca
43*9131e98aSAntoine Leca int
utimens(const char * path,const struct timespec * times)44*9131e98aSAntoine Leca utimens(const char *path, const struct timespec *times)
45*9131e98aSAntoine Leca {
46*9131e98aSAntoine Leca return utimensat(AT_FDCWD, path, times, 0);
47*9131e98aSAntoine Leca }
48*9131e98aSAntoine Leca
49*9131e98aSAntoine Leca int
lutimens(const char * path,const struct timespec * times)50*9131e98aSAntoine Leca lutimens(const char *path, const struct timespec *times)
51*9131e98aSAntoine Leca {
52*9131e98aSAntoine Leca return utimensat(AT_FDCWD, path, times, AT_SYMLINK_NOFOLLOW);
53*9131e98aSAntoine Leca }
54