int posix_timer_event(struct k_itimer *timr, int si_private) { struct task_struct *task; int shared, ret = -1; /* * FIXME: if ->sigq is queued we can race with * dequeue_signal()->do_schedule_next_timer(). * * If dequeue_signal() sees the "right" value of * si_sys_private it calls do_schedule_next_timer(). * We re-queue ->sigq and drop ->it_lock(). * do_schedule_next_timer() locks the timer * and re-schedules it while ->sigq is pending. * Not really bad, but not that we want. */ timr->sigq->info.si_sys_private = si_private; rcu_read_lock(); task = pid_task(timr->it_pid, PIDTYPE_PID); if (task) { shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID); ret = send_sigqueue(timr->sigq, task, shared); } rcu_read_unlock(); /* If we failed to send the signal the timer stops. */ return ret > 0; }
int posix_timer_event(struct k_itimer *timr,int si_private) { memset(&timr->sigq->info, 0, sizeof(siginfo_t)); timr->sigq->info.si_sys_private = si_private; /* Send signal to the process that owns this timer.*/ timr->sigq->info.si_signo = timr->it_sigev_signo; timr->sigq->info.si_errno = 0; timr->sigq->info.si_code = SI_TIMER; timr->sigq->info.si_tid = timr->it_id; timr->sigq->info.si_value = timr->it_sigev_value; if (timr->it_sigev_notify & SIGEV_THREAD_ID) { struct task_struct *leader; int ret = send_sigqueue(timr->it_sigev_signo, timr->sigq, timr->it_process); if (likely(ret >= 0)) return ret; timr->it_sigev_notify = SIGEV_SIGNAL; leader = timr->it_process->group_leader; put_task_struct(timr->it_process); timr->it_process = leader; } return send_group_sigqueue(timr->it_sigev_signo, timr->sigq, timr->it_process); }
int posix_timer_event(struct k_itimer *timr, int si_private) { struct task_struct *task; int shared, ret = -1; timr->sigq->info.si_sys_private = si_private; rcu_read_lock(); task = pid_task(timr->it_pid, PIDTYPE_PID); if (task) { shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID); ret = send_sigqueue(timr->sigq, task, shared); } rcu_read_unlock(); return ret > 0; }