In preparation for switching linuxulator to the use the native 1:1
threads introduce kern_thr_alloc() which will be used later in the linux_clone(). Differential Revision: https://reviews.freebsd.org/D1029 Reviewed by: trasz
This commit is contained in:
parent
95be6d2b1f
commit
09baafb471
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283373
@ -162,12 +162,6 @@ create_thread(struct thread *td, mcontext_t *ctx,
|
|||||||
|
|
||||||
p = td->td_proc;
|
p = td->td_proc;
|
||||||
|
|
||||||
/* Have race condition but it is cheap. */
|
|
||||||
if (p->p_numthreads >= max_threads_per_proc) {
|
|
||||||
++max_threads_hits;
|
|
||||||
return (EPROCLIM);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rtp != NULL) {
|
if (rtp != NULL) {
|
||||||
switch(rtp->type) {
|
switch(rtp->type) {
|
||||||
case RTP_PRIO_REALTIME:
|
case RTP_PRIO_REALTIME:
|
||||||
@ -197,11 +191,9 @@ create_thread(struct thread *td, mcontext_t *ctx,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize our td */
|
/* Initialize our td */
|
||||||
newtd = thread_alloc(0);
|
error = kern_thr_alloc(p, 0, &newtd);
|
||||||
if (newtd == NULL) {
|
if (error)
|
||||||
error = ENOMEM;
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
|
||||||
|
|
||||||
cpu_set_upcall(newtd, td);
|
cpu_set_upcall(newtd, td);
|
||||||
|
|
||||||
@ -566,3 +558,20 @@ sys_thr_set_name(struct thread *td, struct thr_set_name_args *uap)
|
|||||||
PROC_UNLOCK(p);
|
PROC_UNLOCK(p);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
kern_thr_alloc(struct proc *p, int pages, struct thread **ntd)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Have race condition but it is cheap. */
|
||||||
|
if (p->p_numthreads >= max_threads_per_proc) {
|
||||||
|
++max_threads_hits;
|
||||||
|
return (EPROCLIM);
|
||||||
|
}
|
||||||
|
|
||||||
|
*ntd = thread_alloc(pages);
|
||||||
|
if (*ntd == NULL)
|
||||||
|
return (ENOMEM);
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
@ -214,6 +214,7 @@ int kern_ktimer_settime(struct thread *td, int timer_id, int flags,
|
|||||||
int kern_ktimer_gettime(struct thread *td, int timer_id,
|
int kern_ktimer_gettime(struct thread *td, int timer_id,
|
||||||
struct itimerspec *val);
|
struct itimerspec *val);
|
||||||
int kern_ktimer_getoverrun(struct thread *td, int timer_id);
|
int kern_ktimer_getoverrun(struct thread *td, int timer_id);
|
||||||
|
int kern_thr_alloc(struct proc *, int pages, struct thread **);
|
||||||
int kern_thr_exit(struct thread *td);
|
int kern_thr_exit(struct thread *td);
|
||||||
int kern_thr_new(struct thread *td, struct thr_param *param);
|
int kern_thr_new(struct thread *td, struct thr_param *param);
|
||||||
int kern_thr_suspend(struct thread *td, struct timespec *tsp);
|
int kern_thr_suspend(struct thread *td, struct timespec *tsp);
|
||||||
|
Loading…
Reference in New Issue
Block a user