View | Details | Raw Unified | Return to bug 150095 | Differences between
and this patch

Collapse All | Expand All

(-)sys/kern/kern_time.c (-7 / +9 lines)
Lines 995-1001 Link Here
995
995
996
	PROC_LOCK(p);
996
	PROC_LOCK(p);
997
	if (preset_id != -1) {
997
	if (preset_id != -1) {
998
		KASSERT(preset_id >= 0 && preset_id < 3, ("invalid preset_id"));
998
		KASSERT(preset_id >= 0 && preset_id < TIMER_RESERVED,
999
		    ("invalid preset_id"));
999
		id = preset_id;
1000
		id = preset_id;
1000
		if (p->p_itimers->its_timers[id] != NULL) {
1001
		if (p->p_itimers->its_timers[id] != NULL) {
1001
			PROC_UNLOCK(p);
1002
			PROC_UNLOCK(p);
Lines 1007-1016 Link Here
1007
		 * Find a free timer slot, skipping those reserved
1008
		 * Find a free timer slot, skipping those reserved
1008
		 * for setitimer().
1009
		 * for setitimer().
1009
		 */
1010
		 */
1010
		for (id = 3; id < TIMER_MAX; id++)
1011
		for (id = TIMER_RESERVED; id < (TIMER_RESERVED + TIMER_MAX);
1012
		    id++)
1011
			if (p->p_itimers->its_timers[id] == NULL)
1013
			if (p->p_itimers->its_timers[id] == NULL)
1012
				break;
1014
				break;
1013
		if (id == TIMER_MAX) {
1015
		if (id == (TIMER_RESERVED + TIMER_MAX)) {
1014
			PROC_UNLOCK(p);
1016
			PROC_UNLOCK(p);
1015
			error = EAGAIN;
1017
			error = EAGAIN;
1016
			goto out;
1018
			goto out;
Lines 1144-1150 Link Here
1144
		ovalp = NULL;
1146
		ovalp = NULL;
1145
1147
1146
	PROC_LOCK(p);
1148
	PROC_LOCK(p);
1147
	if (uap->timerid < 3 ||
1149
	if (uap->timerid < TIMER_RESERVED ||
1148
	    (it = itimer_find(p, uap->timerid)) == NULL) {
1150
	    (it = itimer_find(p, uap->timerid)) == NULL) {
1149
		PROC_UNLOCK(p);
1151
		PROC_UNLOCK(p);
1150
		error = EINVAL;
1152
		error = EINVAL;
Lines 1176-1182 Link Here
1176
	int error;
1178
	int error;
1177
1179
1178
	PROC_LOCK(p);
1180
	PROC_LOCK(p);
1179
	if (uap->timerid < 3 ||
1181
	if (uap->timerid < TIMER_RESERVED ||
1180
	   (it = itimer_find(p, uap->timerid)) == NULL) {
1182
	   (it = itimer_find(p, uap->timerid)) == NULL) {
1181
		PROC_UNLOCK(p);
1183
		PROC_UNLOCK(p);
1182
		error = EINVAL;
1184
		error = EINVAL;
Lines 1206-1212 Link Here
1206
	int error ;
1208
	int error ;
1207
1209
1208
	PROC_LOCK(p);
1210
	PROC_LOCK(p);
1209
	if (uap->timerid < 3 ||
1211
	if (uap->timerid < TIMER_RESERVED ||
1210
	    (it = itimer_find(p, uap->timerid)) == NULL) {
1212
	    (it = itimer_find(p, uap->timerid)) == NULL) {
1211
		PROC_UNLOCK(p);
1213
		PROC_UNLOCK(p);
1212
		error = EINVAL;
1214
		error = EINVAL;
Lines 1483-1489 Link Here
1483
		 * by new image.
1485
		 * by new image.
1484
		 */
1486
		 */
1485
		if (event == ITIMER_EV_EXEC)
1487
		if (event == ITIMER_EV_EXEC)
1486
			i = 3;
1488
			i = TIMER_RESERVED;
1487
		else if (event == ITIMER_EV_EXIT)
1489
		else if (event == ITIMER_EV_EXIT)
1488
			i = 0;
1490
			i = 0;
1489
		else
1491
		else
(-)sys/sys/timers.h (-1 / +3 lines)
Lines 83-88 Link Here
83
83
84
#define	ITCF_ONWORKLIST	0x01
84
#define	ITCF_ONWORKLIST	0x01
85
85
86
/* Clocks reserved by setitimer */
87
#define TIMER_RESERVED	3
86
#define	TIMER_MAX	32
88
#define	TIMER_MAX	32
87
89
88
#define	ITIMER_LOCK(it)		mtx_lock(&(it)->it_mtx)
90
#define	ITIMER_LOCK(it)		mtx_lock(&(it)->it_mtx)
Lines 94-100 Link Here
94
	struct itimerlist	its_virtual;
96
	struct itimerlist	its_virtual;
95
	struct itimerlist	its_prof;
97
	struct itimerlist	its_prof;
96
	TAILQ_HEAD(, itimer)	its_worklist;
98
	TAILQ_HEAD(, itimer)	its_worklist;
97
	struct itimer		*its_timers[TIMER_MAX];
99
	struct itimer		*its_timers[TIMER_RESERVED + TIMER_MAX];
98
};
100
};
99
101
100
struct	kclock {
102
struct	kclock {

Return to bug 150095