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

Function kern_clock_settime

freebsd/kern/kern_time.c:400–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398 "do not perform possibly restrictive checks on settime(2) args");
399
400int
401kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats)
402{
403 struct timeval atv;
404 int error;
405
406 if ((error = priv_check(td, PRIV_CLOCK_SETTIME)) != 0)
407 return (error);
408 if (clock_id != CLOCK_REALTIME)
409 return (EINVAL);
410 if (ats->tv_nsec < 0 || ats->tv_nsec >= 1000000000 ||
411 ats->tv_sec < 0)
412 return (EINVAL);
413 if (!allow_insane_settime &&
414 (ats->tv_sec > 8000ULL * 365 * 24 * 60 * 60 ||
415 ats->tv_sec < utc_offset()))
416 return (EINVAL);
417 /* XXX Don't convert nsec->usec and back */
418 TIMESPEC_TO_TIMEVAL(&atv, ats);
419 error = settime(td, &atv);
420 return (error);
421}
422
423#ifndef _SYS_SYSPROTO_H_
424struct clock_getres_args {

Callers 1

sys_clock_settimeFunction · 0.85

Calls 3

utc_offsetFunction · 0.85
settimeFunction · 0.85
priv_checkFunction · 0.70

Tested by

no test coverage detected