MCPcopy Create free account
hub / github.com/F-Stack/f-stack / getutimes

Function getutimes

freebsd/kern/vfs_syscalls.c:3045–3072  ·  view source on GitHub ↗

* Common implementation code for utimes(), lutimes(), and futimes(). */

Source from the content-addressed store, hash-verified

3043 * Common implementation code for utimes(), lutimes(), and futimes().
3044 */
3045static int
3046getutimes(const struct timeval *usrtvp, enum uio_seg tvpseg,
3047 struct timespec *tsp)
3048{
3049 struct timeval tv[2];
3050 const struct timeval *tvp;
3051 int error;
3052
3053 if (usrtvp == NULL) {
3054 vfs_timestamp(&tsp[0]);
3055 tsp[1] = tsp[0];
3056 } else {
3057 if (tvpseg == UIO_SYSSPACE) {
3058 tvp = usrtvp;
3059 } else {
3060 if ((error = copyin(usrtvp, tv, sizeof(tv))) != 0)
3061 return (error);
3062 tvp = tv;
3063 }
3064
3065 if (tvp[0].tv_usec < 0 || tvp[0].tv_usec >= 1000000 ||
3066 tvp[1].tv_usec < 0 || tvp[1].tv_usec >= 1000000)
3067 return (EINVAL);
3068 TIMEVAL_TO_TIMESPEC(&tvp[0], &tsp[0]);
3069 TIMEVAL_TO_TIMESPEC(&tvp[1], &tsp[1]);
3070 }
3071 return (0);
3072}
3073
3074/*
3075 * Common implementation code for futimens(), utimensat().

Callers 3

kern_utimesatFunction · 0.85
kern_lutimesFunction · 0.85
kern_futimesFunction · 0.85

Calls 2

vfs_timestampFunction · 0.85
copyinFunction · 0.50

Tested by

no test coverage detected