Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\time\posix-cpu-timers.c Create Date:2022-07-28 10:47:48
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Guts of sys_timer_settime for CPU timers.* This is called with the timer locked and interrupts disabled.* If we return TIMER_RETRY, it's necessary to release the timer's lock* and try again. (This happens when the timer is in the middle of firing.)

Proto:static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags, struct itimerspec64 *new, struct itimerspec64 *old)

Type:int

Parameter:

TypeParameterName
struct k_itimer *timer
inttimer_flags
struct itimerspec64 *new
struct itimerspec64 *old
564  clkid = CPUCLOCK_WHICH(it_clock)
566  ctmr = cpu
567  p = task
570  ret = 0
572  If WARN_ON_ONCE(!p) Then Return -EINVAL
579  new_expires = Convert ktime_t to nanoseconds
585  sighand = lock_task_sighand(p, & flags)
590  If Value for the false possibility is greater at compile time(sighand == NULL) Then Return -ESRCH
596  old_incr = it_interval
597  old_expires = cpu_timer_getexpires(ctmr)
599  If Value for the false possibility is greater at compile time(firing) Then
600  firing = -1
601  ret = SPDX-License-Identifier: GPL-2.0
602  Else
603  cpu_timer_dequeue(ctmr)
614  If CPUCLOCK_PERTHREAD(it_clock) Then val = Sample a per-thread clock for the given task. clkid is validated.
616  Else val = Sample a process (thread group) clock for the given task clkid. If the* group's cputime accounting is already enabled, read the atomic* store. Otherwise a full update is required. Task's sighand lock must be
619  If old Then
620  If old_expires == 0 Then
621  seconds = 0
622  nanoseconds = 0
623  Else
633  If val < exp Then
636  Else
637  nanoseconds = 1
638  seconds = 0
643  If Value for the false possibility is greater at compile time(ret) Then
650  unlock_task_sighand(p, & flags)
651  Go to out
654  If new_expires != 0 && Not (timer_flags & The various flags for setting POSIX.1b interval timers:) Then
655  new_expires += val
663  cpu_timer_setexpires(ctmr, new_expires)
664  If new_expires != 0 && val < new_expires Then
665  Insert the timer on the appropriate list before any timers that* expire later. This must be called with the sighand lock held.
668  unlock_task_sighand(p, & flags)
673  it_interval = vert a timespec64 to ktime_t format:
680  it_requeue_pending = it_requeue_pending + 2 & ~REQUEUE_PENDING
682  it_overrun_last = 0
683  it_overrun = -1
685  If new_expires != 0 && Not (val < new_expires) Then
691  The timer is locked, fire it and arrange for its reload.
694  ret = 0
695  out :
696  If old Then it_interval = s_to_timespec64 - Convert nanoseconds to timespec64*@nsec: the nanoseconds value to be converted* Returns the timespec64 representation of the nsec parameter.
699  Return ret
Caller
NameDescribe
do_cpu_nanosleep