Mittwoch, 14. Juli 2010

kernel 3 time bases :「 掉哪媽 」被鏟走 捍衞廣東話

kernel 3 time bases

1. ITIMER_REAL
2. ITIMER_VIRTUAL
3. ITIMER_PROF

see : kernel/itimer.c


「掉哪媽」被鏟走 捍 衞廣東話

廣東話,頂硬上!
http://hk.apple.nextmedia.com/template/apple/art_main.php?iss_id=20100714&sec_id=15335&subsec_id=15336&art_id=14237328

打壓廣東話升級, 明代名將雕像成犧牲品, 袁崇煥熱血名句, 遭官方下令鏟走

http://hkwalker.net/v3/archives/3699

http://lxr.linux.no/#linux+v2.6.34.1/kernel/itimer.c#L185

/*
186 * Returns true if the timeval is in canonical form
187 */
188#define timeval_valid(t) \
189 (((t)->tv_sec >= 0) && (((unsigned long) (t)->tv_usec) < USEC_PER_SEC))
190
191int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
192{
193 struct task_struct *tsk = current;
194 struct hrtimer *timer;
195 ktime_t expires;
196
197 /*
198 * Validate the timevals in value.
199 */
200 if (!timeval_valid(&value->it_value) ||
201 !timeval_valid(&value->it_interval))
202 return -EINVAL;
203
204 switch (which) {
205 case ITIMER_REAL:
206again:
207 spin_lock_irq(&tsk->sighand->siglock);
208 timer = &tsk->signal->real_timer;
209 if (ovalue) {
210 ovalue->it_value = itimer_get_remtime(timer);
211 ovalue->it_interval
212 = ktime_to_timeval(tsk->signal->it_real_incr);
213 }
214 /* We are sharing ->siglock with it_real_fn() */
215 if (hrtimer_try_to_cancel(timer) < 0) {
216 spin_unlock_irq(&tsk->sighand->siglock);
217 goto again;
218 }
219 expires = timeval_to_ktime(value->it_value);
220 if (expires.tv64 != 0) {
221 tsk->signal->it_real_incr =
222 timeval_to_ktime(value->it_interval);
223 hrtimer_start(timer, expires, HRTIMER_MODE_REL);
224 } else
225 tsk->signal->it_real_incr.tv64 = 0;
226
227 trace_itimer_state(ITIMER_REAL, value, 0);
228 spin_unlock_irq(&tsk->sighand->siglock);
229 break;
230 case ITIMER_VIRTUAL:
231 set_cpu_itimer(tsk, CPUCLOCK_VIRT, value, ovalue);
232 break;
233 case ITIMER_PROF:
234 set_cpu_itimer(tsk, CPUCLOCK_PROF, value, ovalue);
235 break;
236 default:
237 return -EINVAL;
238 }
239 return 0;
240}

Keine Kommentare: