| 1 | #include "pthread_impl.h" |
| 2 | #include "lock.h" |
| 3 | |
| 4 | int pthread_getschedparam(pthread_t t, int *restrict policy, struct sched_param *restrict param) |
| 5 | { |
| 6 | 	int r; |
| 7 | 	sigset_t set; |
| 8 | 	__block_app_sigs(&set); |
| 9 | 	LOCK(t->killlock); |
| 10 | 	if (!t->tid) { |
| 11 | 		r = ESRCH; |
| 12 | 	} else { |
| 13 | 		r = -__syscall(SYS_sched_getparam, t->tid, param); |
| 14 | 		if (!r) { |
| 15 | 			*policy = __syscall(SYS_sched_getscheduler, t->tid); |
| 16 | 		} |
| 17 | 	} |
| 18 | 	UNLOCK(t->killlock); |
| 19 | 	__restore_sigs(&set); |
| 20 | 	return r; |
| 21 | } |