| 1 |
/* Set file access and modification times. |
| 2 |
|
| 3 |
Copyright 2012-2024 Free Software Foundation, Inc. |
| 4 |
|
| 5 |
This file is free software: you can redistribute it and/or modify |
| 6 |
it under the terms of the GNU Lesser General Public License as |
| 7 |
published by the Free Software Foundation, either version 3 of the |
| 8 |
License, or (at your option) any later version. |
| 9 |
|
| 10 |
This file is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU Lesser General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU Lesser General Public License |
| 16 |
along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 17 |
|
| 18 |
/* Written by Paul Eggert. */ |
| 19 |
|
| 20 |
/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */ |
| 21 |
#if !_GL_CONFIG_H_INCLUDED |
| 22 |
#error "Please include config.h first." |
| 23 |
#endif |
| 24 |
|
| 25 |
#include <time.h> |
| 26 |
|
| 27 |
#if HAVE_UTIMENS || HAVE_LUTIMENS |
| 28 |
# include <sys/time.h> |
| 29 |
#endif |
| 30 |
|
| 31 |
#ifdef __cplusplus |
| 32 |
extern "C" { |
| 33 |
#endif |
| 34 |
|
| 35 |
int fdutimens (int, char const *, struct timespec const [2]); |
| 36 |
|
| 37 |
#if HAVE_UTIMENS |
| 38 |
# define utimens rpl_utimens |
| 39 |
#endif |
| 40 |
int utimens (char const *, struct timespec const [2]); |
| 41 |
|
| 42 |
#if HAVE_LUTIMENS |
| 43 |
# define lutimens rpl_lutimens |
| 44 |
#endif |
| 45 |
int lutimens (char const *, struct timespec const [2]); |
| 46 |
|
| 47 |
#ifdef __cplusplus |
| 48 |
} |
| 49 |
#endif |
| 50 |
|
| 51 |
|
| 52 |
#if GNULIB_FDUTIMENSAT |
| 53 |
|
| 54 |
# include <fcntl.h> |
| 55 |
# include <sys/stat.h> |
| 56 |
|
| 57 |
_GL_INLINE_HEADER_BEGIN |
| 58 |
#ifndef _GL_UTIMENS_INLINE |
| 59 |
# define _GL_UTIMENS_INLINE _GL_INLINE |
| 60 |
#endif |
| 61 |
|
| 62 |
#ifdef __cplusplus |
| 63 |
extern "C" { |
| 64 |
#endif |
| 65 |
|
| 66 |
int fdutimensat (int fd, int dir, char const *name, struct timespec const [2], |
| 67 |
int atflag); |
| 68 |
|
| 69 |
/* Using this function makes application code slightly more readable. */ |
| 70 |
_GL_UTIMENS_INLINE int |
| 71 |
lutimensat (int dir, char const *file, struct timespec const times[2]) |
| 72 |
{ |
| 73 |
return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW); |
| 74 |
} |
| 75 |
|
| 76 |
#ifdef __cplusplus |
| 77 |
} |
| 78 |
#endif |
| 79 |
|
| 80 |
_GL_INLINE_HEADER_END |
| 81 |
|
| 82 |
#endif |