utimens(2) system call

Variant of utime(2) with struct timespec (with ns precision)
instead of time_t values; also allows for tv_nsec members
the values UTIME_NOW (force update to current time) or
UTIME_OMIT (allow to set either atim or mtim independently.)

Provides a superset of utimes(2), futimes(2), lutimes(2),
and futimens(2).
Provides the same subset of utimensat(2) as does NetBSD 6.
Also import utimens() and lutimeNS() from NetBSD-current.
This commit is contained in:
Antoine Leca
2011-12-24 15:02:54 +01:00
committed by Ben Gras
parent 88414c568c
commit 9131e98a7d
19 changed files with 385 additions and 16 deletions

View File

@@ -185,14 +185,18 @@ struct flock {
/*
* Constants for X/Open Extended API set 2 (a.k.a. C063)
* linkat(2) - also part of Posix-2008/XPG7
*/
#if defined(_INCOMPLETE_XOPEN_C063) || defined(_KERNEL)
#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
defined(_NETBSD_SOURCE)
#if defined(_INCOMPLETE_XOPEN_C063) || defined(_KERNEL) || defined(__minix)
#define AT_FDCWD -100 /* Use cwd for relative link target */
#define AT_EACCESS 0x100 /* Use euig/egid for access checks */
#define AT_EACCESS 0x100 /* Use euid/egid for access checks */
#define AT_SYMLINK_NOFOLLOW 0x200 /* Do not follow symlinks */
#define AT_SYMLINK_FOLLOW 0x400 /* Follow symlinks */
#define AT_REMOVEDIR 0x800 /* Remove directory only */
#endif
#endif
#ifndef _KERNEL

View File

@@ -295,7 +295,6 @@ int lchflags(const char *, unsigned long);
int lchmod(const char *, mode_t);
#endif /* defined(_NETBSD_SOURCE) && !defined(__minix) */
#ifndef __minix
#ifndef __LIBC12_SOURCE__
/*
* X/Open Extended API set 2 (a.k.a. C063)
@@ -315,7 +314,6 @@ int lutimens(const char *, const struct timespec *);
int futimens(int, const struct timespec *);
#endif
#endif
#endif /* !__minix */
__END_DECLS

View File

@@ -283,13 +283,14 @@ int gettimeofday(struct timeval * __restrict, void *__restrict);
int setitimer(int, const struct itimerval * __restrict,
struct itimerval * __restrict) __RENAME(__setitimer50);
#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
int utimes(const char *, const struct timeval [2]) __RENAME(__utimes50);
#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
int adjtime(const struct timeval *, struct timeval *) __RENAME(__adjtime50);
#ifndef __minix
int futimes(int, const struct timeval [2]) __RENAME(__futimes50);
int lutimes(const char *, const struct timeval [2]) __RENAME(__lutimes50);
#endif /* !__minix */
int settimeofday(const struct timeval * __restrict,
const void *__restrict) __RENAME(__settimeofday50);
#endif /* _NETBSD_SOURCE */