45int SysUtime(
const char *path,
const struct utimbuf *ptimes)
49 struct utimbuf sptimes;
66 }
else if (ret > PATH_MAX) {
68 PRINT_ERR(
"%s[%d], path exceeds maxlen: %d\n", __FUNCTION__, __LINE__, PATH_MAX);
79 ret =
utime(spath, ptimes ? &sptimes : NULL);
95 ret =
time(tloc ? &stloc : NULL);
108int SysSetiTimer(
int which,
const struct itimerval *value,
struct itimerval *ovalue)
111 struct itimerval svalue;
112 struct itimerval sovalue;
124 ret =
setitimer(which, &svalue, &sovalue);
140 struct itimerval svalue;
166 if (timerID == NULL) {
176 ret =
OsTimerCreate(clockID, evp ? &ksevp : NULL, &stimerID);
192 struct itimerspec svalue;
212int SysTimerSettime(timer_t timerID,
int flags,
const struct itimerspec *value,
struct itimerspec *oldValue)
215 struct itimerspec svalue;
216 struct itimerspec soldValue;
233 if (oldValue &&
LOS_ArchCopyToUser(oldValue, &soldValue,
sizeof(
struct itimerspec))) {
331int SysClockNanoSleep(clockid_t clk,
int flags,
const struct timespec *req,
struct timespec *rem)
334 struct timespec sreq;
335 struct timespec srem = { 0 };
358 struct timespec srqtp;
359 struct timespec srmtp;
371 ret =
nanosleep(&srqtp, rmtp ? &srmtp : NULL);
409 struct timespec64 stp;
421 if (stp.tv_sec > UINT32_MAX) {
425 t.tv_sec = stp.tv_sec;
426 t.tv_nsec = stp.tv_nsec;
439 struct timespec64 stp;
451 stp.tv_sec = t.tv_sec;
452 stp.tv_nsec = t.tv_nsec;
466 struct timespec64 stp;
478 stp.tv_sec = t.tv_sec;
479 stp.tv_nsec = t.tv_nsec;
493 struct timespec rm = { 0 };
494 struct timespec64 sreq;
495 struct timespec64 srem = { 0 };
503 rq.tv_sec = (sreq.tv_sec > UINT32_MAX) ? UINT32_MAX : sreq.tv_sec;
504 rq.tv_nsec = sreq.tv_nsec;
513 srem.tv_sec = rm.tv_sec;
514 srem.tv_nsec = rm.tv_nsec;
527 struct itimerspec val;
528 struct itimerspec64 svalue;
540 svalue.it_interval.tv_sec = val.it_interval.tv_sec;
541 svalue.it_interval.tv_nsec = val.it_interval.tv_nsec;
542 svalue.it_value.tv_sec = val.it_value.tv_sec;
543 svalue.it_value.tv_nsec = val.it_value.tv_nsec;
553int SysTimerSettime64(timer_t timerID,
int flags,
const struct itimerspec64 *value,
struct itimerspec64 *oldValue)
556 struct itimerspec val;
557 struct itimerspec oldVal;
558 struct itimerspec64 svalue;
559 struct itimerspec64 soldValue;
571 if (svalue.it_interval.tv_sec > UINT32_MAX || svalue.it_value.tv_sec > UINT32_MAX) {
576 val.it_interval.tv_sec = svalue.it_interval.tv_sec;
577 val.it_interval.tv_nsec = svalue.it_interval.tv_nsec;
578 val.it_value.tv_sec = svalue.it_value.tv_sec;
579 val.it_value.tv_nsec = svalue.it_value.tv_nsec;
581 ret =
timer_settime(timerID, flags, &val, oldValue ? &oldVal : NULL);
586 if (oldValue != NULL) {
587 soldValue.it_interval.tv_sec = oldVal.it_interval.tv_sec;
588 soldValue.it_interval.tv_nsec = oldVal.it_interval.tv_nsec;
589 soldValue.it_value.tv_sec = oldVal.it_value.tv_sec;
590 soldValue.it_value.tv_nsec = oldVal.it_value.tv_nsec;
VOID * LOS_MemAlloc(VOID *pool, UINT32 size)
从指定内存池中申请size长度的内存,注意这可不是从内核堆空间中申请内存
UINT32 LOS_MemFree(VOID *pool, VOID *ptr)
释放从指定动态内存中申请的内存
UINT8 * m_aucSysMem0
异常交互动态内存池地址的起始地址,当不支持异常交互特性时,m_aucSysMem0等于m_aucSysMem1。
INT32 LOS_StrncpyFromUser(CHAR *dst, const CHAR *src, INT32 count)
int timer_delete(timer_t timerID)
int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem)
int clock_settime(clockid_t clockID, const struct timespec *tp)
int getitimer(int which, struct itimerval *value)
int timer_settime(timer_t timerID, int flags, const struct itimerspec *value, struct itimerspec *oldValue)
int clock_getres(clockid_t clockID, struct timespec *tp)
clock_t times(struct tms *buf)
int timer_gettime(timer_t timerID, struct itimerspec *value)
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
int timer_getoverrun(timer_t timerID)
int clock_gettime(clockid_t clockID, struct timespec *tp)
当用户程序进行特定系统调用时(例如clock_gettime(CLOCK_REALTIME_COARSE, &ts)),VDSO代码页会将其拦截;
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
int OsTimerCreate(clockid_t, struct ksigevent *__restrict, timer_t *__restrict)
int SysClockSettime64(clockid_t clockID, const struct timespec64 *tp)
int SysGetiTimer(int which, struct itimerval *value)
time_t SysTime(time_t *tloc)
int SysClockNanoSleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem)
int SysTimerCreate(clockid_t clockID, struct ksigevent *evp, timer_t *timerID)
int SysTimerSettime(timer_t timerID, int flags, const struct itimerspec *value, struct itimerspec *oldValue)
int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ovalue)
clock_t SysTimes(struct tms *buf)
int SysUtime(const char *path, const struct utimbuf *ptimes)
int SysClockGetres(clockid_t clockID, struct timespec *tp)
int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
int SysTimerGettime64(timer_t timerID, struct itimerspec64 *value)
int SysClockGetres64(clockid_t clockID, struct timespec64 *tp)
int SysClockGettime64(clockid_t clockID, struct timespec64 *tp)
int SysClockNanoSleep64(clockid_t clk, int flags, const struct timespec64 *req, struct timespec64 *rem)
int SysTimerDelete(timer_t timerID)
int SysTimerGettime(timer_t timerID, struct itimerspec *value)
int SysTimerSettime64(timer_t timerID, int flags, const struct itimerspec64 *value, struct itimerspec64 *oldValue)
int SysTimerGetoverrun(timer_t timerID)
int SysClockSettime(clockid_t clockID, const struct timespec *tp)
int SysClockGettime(clockid_t clockID, struct timespec *tp)
获取系统时间
size_t LOS_ArchCopyToUser(void *dst, const void *src, size_t len)
从内核空间拷贝到用户空间
size_t LOS_ArchCopyFromUser(void *dst, const void *src, size_t len)
int utime(const char *path, const struct utimbuf *ptimes)