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