diff options
author | jhb <jhb@FreeBSD.org> | 2005-02-07 18:36:21 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2005-02-07 18:36:21 +0000 |
commit | 6e2f7d4c8e667f4ffedef65ce2be19a5ecceff15 (patch) | |
tree | 5d4d982ed93cc0385ae42e1ae92cbf69a31825e0 /sys | |
parent | 96fc58f2b29aba17286a254011aa314e647abfa4 (diff) | |
download | FreeBSD-src-6e2f7d4c8e667f4ffedef65ce2be19a5ecceff15.zip FreeBSD-src-6e2f7d4c8e667f4ffedef65ce2be19a5ecceff15.tar.gz |
Use kern_setitimer() to implement linux_alarm() instead of fondling the
real interval timer directly.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index cb77fe3..40762cb 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -184,8 +184,7 @@ int linux_alarm(struct thread *td, struct linux_alarm_args *args) { struct itimerval it, old_it; - struct timeval tv; - struct proc *p; + int error; #ifdef DEBUG if (ldebug(alarm)) @@ -193,32 +192,21 @@ linux_alarm(struct thread *td, struct linux_alarm_args *args) #endif if (args->secs > 100000000) - return EINVAL; + return (EINVAL); it.it_value.tv_sec = (long)args->secs; it.it_value.tv_usec = 0; it.it_interval.tv_sec = 0; it.it_interval.tv_usec = 0; - p = td->td_proc; - PROC_LOCK(p); - old_it = p->p_realtimer; - getmicrouptime(&tv); - if (timevalisset(&old_it.it_value)) - callout_stop(&p->p_itcallout); - if (it.it_value.tv_sec != 0) { - callout_reset(&p->p_itcallout, tvtohz(&it.it_value), - realitexpire, p); - timevaladd(&it.it_value, &tv); - } - p->p_realtimer = it; - PROC_UNLOCK(p); - if (timevalcmp(&old_it.it_value, &tv, >)) { - timevalsub(&old_it.it_value, &tv); + error = kern_setitimer(td, ITIMER_REAL, &it, &old_it); + if (error) + return (error); + if (timevalisset(&old_it.it_value)) { if (old_it.it_value.tv_usec != 0) old_it.it_value.tv_sec++; td->td_retval[0] = old_it.it_value.tv_sec; } - return 0; + return (0); } #endif /*!__alpha__*/ |