Skip to contentSkip to conversation

posix-timers: move the initialization of timer->sigq from send to create path

PATCH New Oleg Nesterov 1 participant 1 message Aug 4, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 posix-timers: move the initialization of timer->sigq from send to create path

posix_timer_event() always populates timer->sigq with the same numbers, move this code into sys_timer_create().

Note that with this patch we can kill it_sigev_signo and it_sigev_value.

kernel/posix-timers.c renamed from kernel/posix-timers.c~6_SIGQ_INIT +5 -5
@@ -312,11 +312,6 @@ int posix_timer_event(struct k_itimer *t
 	 */
 	timr->sigq->info.si_sys_private = si_private;
 
-	timr->sigq->info.si_signo = timr->it_sigev_signo;
-	timr->sigq->info.si_code = SI_TIMER;
-	timr->sigq->info.si_tid = timr->it_id;
-	timr->sigq->info.si_value = timr->it_sigev_value;
-
 	shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID);
 	ret = send_sigqueue(timr->sigq, timr->it_process, shared);
 	/* If we failed to send the signal the timer stops. */
@@ -537,6 +532,11 @@ sys_timer_create(const clockid_t which_c
 		get_task_struct(process);
 	}
 
+	new_timer->sigq->info.si_code  = SI_TIMER;
+	new_timer->sigq->info.si_tid   = new_timer->it_id;
+	new_timer->sigq->info.si_signo = new_timer->it_sigev_signo;
+	new_timer->sigq->info.si_value = new_timer->it_sigev_value;
+
 	spin_lock_irq(&current->sighand->siglock);
 	new_timer->it_process = process;
 	list_add(&new_timer->list, &current->signal->posix_timers);