diff options
author | ed <ed@FreeBSD.org> | 2015-08-17 12:51:46 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2015-08-17 12:51:46 +0000 |
commit | 77458f0d7cb617f5b07d6e249e961647e6ba84e1 (patch) | |
tree | 7836b9cb3f95fd1b60c6d1a2643dd55032438521 /sys/cddl/compat | |
parent | 88549d1bce98dce7ec4a3a5342c9129f0380ca6b (diff) | |
download | FreeBSD-src-77458f0d7cb617f5b07d6e249e961647e6ba84e1.zip FreeBSD-src-77458f0d7cb617f5b07d6e249e961647e6ba84e1.tar.gz |
MFC r285715:
Add an API for easily creating userspace threads in kernelspace.
This change refactors the existing create_thread() function to be more
generic. It replaces almost all of its arguments by a callback that can
be used to extract the thread ID and copy it out to the right place, but
also to perform additional initialization steps, such as setting the
trapframe. This also makes the difference between thr_new() and
thr_create() more clear in my opinion.
This function is going to be used by the CloudABI compatibility layer.
It looks like the OpenSolaris compatibility framework already provides a
function called thread_create(). Rename this function to
do_thread_create() and use a macro to deal with the namespacing
conflict. A similar approach is already used for thread_exit().
Diffstat (limited to 'sys/cddl/compat')
-rw-r--r-- | sys/cddl/compat/opensolaris/sys/proc.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/proc.h b/sys/cddl/compat/opensolaris/sys/proc.h index 9f26f61..1fe2e9a 100644 --- a/sys/cddl/compat/opensolaris/sys/proc.h +++ b/sys/cddl/compat/opensolaris/sys/proc.h @@ -63,7 +63,7 @@ typedef struct proc proc_t; extern struct proc *zfsproc; static __inline kthread_t * -thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, +do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, size_t len, proc_t *pp, int state, pri_t pri) { kthread_t *td = NULL; @@ -88,6 +88,8 @@ thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, return (td); } +#define thread_create(stk, stksize, proc, arg, len, pp, state, pri) \ + do_thread_create(stk, stksize, proc, arg, len, pp, state, pri) #define thread_exit() kthread_exit() #endif /* _KERNEL */ |