FreeBSD Bugzilla – Attachment 109141 Details for
Bug 150095
[kernel] [patch] Account for reserved itimers which shouldn't count against _SC_TIMER_MAX
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.60 KB, created by
Enji Cooper
on 2010-08-29 23:00:04 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Enji Cooper
Created:
2010-08-29 23:00:04 UTC
Size:
2.60 KB
patch
obsolete
>Index: sys/kern/kern_time.c >=================================================================== >--- sys/kern/kern_time.c (revision 211794) >+++ sys/kern/kern_time.c (working copy) >@@ -356,9 +356,9 @@ > struct timeval tv; > int error; > >- if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000) >+ if (rqt->tv_sec < 0 || (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000)) > return (EINVAL); >- if (rqt->tv_sec < 0 || (rqt->tv_sec == 0 && rqt->tv_nsec == 0)) >+ if (rqt->tv_sec == 0 && rqt->tv_nsec == 0) > return (0); > getnanouptime(&ts); > timespecadd(&ts, rqt); >@@ -995,7 +995,8 @@ > > PROC_LOCK(p); > if (preset_id != -1) { >- KASSERT(preset_id >= 0 && preset_id < 3, ("invalid preset_id")); >+ KASSERT(preset_id >= 0 && preset_id < TIMER_RESERVED, >+ ("invalid preset_id")); > id = preset_id; > if (p->p_itimers->its_timers[id] != NULL) { > PROC_UNLOCK(p); >@@ -1007,10 +1008,11 @@ > * Find a free timer slot, skipping those reserved > * for setitimer(). > */ >- for (id = 3; id < TIMER_MAX; id++) >+ for (id = TIMER_RESERVED; id < (TIMER_RESERVED + TIMER_MAX); >+ id++) > if (p->p_itimers->its_timers[id] == NULL) > break; >- if (id == TIMER_MAX) { >+ if (id == (TIMER_RESERVED + TIMER_MAX)) { > PROC_UNLOCK(p); > error = EAGAIN; > goto out; >@@ -1144,7 +1146,7 @@ > ovalp = NULL; > > PROC_LOCK(p); >- if (uap->timerid < 3 || >+ if (uap->timerid < TIMER_RESERVED || > (it = itimer_find(p, uap->timerid)) == NULL) { > PROC_UNLOCK(p); > error = EINVAL; >@@ -1176,7 +1178,7 @@ > int error; > > PROC_LOCK(p); >- if (uap->timerid < 3 || >+ if (uap->timerid < TIMER_RESERVED || > (it = itimer_find(p, uap->timerid)) == NULL) { > PROC_UNLOCK(p); > error = EINVAL; >@@ -1206,7 +1208,7 @@ > int error ; > > PROC_LOCK(p); >- if (uap->timerid < 3 || >+ if (uap->timerid < TIMER_RESERVED || > (it = itimer_find(p, uap->timerid)) == NULL) { > PROC_UNLOCK(p); > error = EINVAL; >@@ -1483,7 +1485,7 @@ > * by new image. > */ > if (event == ITIMER_EV_EXEC) >- i = 3; >+ i = TIMER_RESERVED; > else if (event == ITIMER_EV_EXIT) > i = 0; > else >Index: sys/sys/timers.h >=================================================================== >--- sys/sys/timers.h (revision 211794) >+++ sys/sys/timers.h (working copy) >@@ -83,6 +83,8 @@ > > #define ITCF_ONWORKLIST 0x01 > >+/* Clocks reserved by setitimer */ >+#define TIMER_RESERVED 3 > #define TIMER_MAX 32 > > #define ITIMER_LOCK(it) mtx_lock(&(it)->it_mtx) >@@ -94,7 +96,7 @@ > struct itimerlist its_virtual; > struct itimerlist its_prof; > TAILQ_HEAD(, itimer) its_worklist; >- struct itimer *its_timers[TIMER_MAX]; >+ struct itimer *its_timers[TIMER_RESERVED + TIMER_MAX]; > }; > > struct kclock {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 150095
:
109141
|
109142