diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/os/freebsd/spl/sys/proc.h | 9 | ||||
-rw-r--r-- | include/os/linux/spl/sys/thread.h | 5 | ||||
-rw-r--r-- | include/sys/zfs_context.h | 3 | ||||
-rw-r--r-- | include/sys/zthr.h | 9 |
4 files changed, 19 insertions, 7 deletions
diff --git a/include/os/freebsd/spl/sys/proc.h b/include/os/freebsd/spl/sys/proc.h index fdb2126d6..e52d37593 100644 --- a/include/os/freebsd/spl/sys/proc.h +++ b/include/os/freebsd/spl/sys/proc.h @@ -65,7 +65,7 @@ extern struct proc *zfsproc; static __inline kthread_t * 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) + size_t len, proc_t *pp, int state, pri_t pri, const char *name) { kthread_t *td = NULL; int error; @@ -78,7 +78,7 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, ASSERT(state == TS_RUN); error = kproc_kthread_add(proc, arg, &zfsproc, &td, - RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "solthread %p", proc); + RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "%s", name); if (error == 0) { thread_lock(td); sched_prio(td, pri); @@ -90,8 +90,11 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, return (td); } +#define thread_create_named(name, stk, stksize, proc, arg, len, \ + pp, state, pri) \ + do_thread_create(stk, stksize, proc, arg, len, pp, state, pri, name) #define thread_create(stk, stksize, proc, arg, len, pp, state, pri) \ - do_thread_create(stk, stksize, proc, arg, len, pp, state, pri) + do_thread_create(stk, stksize, proc, arg, len, pp, state, pri, #proc) #define thread_exit() kthread_exit() int uread(proc_t *, void *, size_t, uintptr_t); diff --git a/include/os/linux/spl/sys/thread.h b/include/os/linux/spl/sys/thread.h index 3762717da..72dcf9f05 100644 --- a/include/os/linux/spl/sys/thread.h +++ b/include/os/linux/spl/sys/thread.h @@ -45,6 +45,11 @@ typedef void (*thread_func_t)(void *); +#define thread_create_named(name, stk, stksize, func, arg, len, \ + pp, state, pri) \ + __thread_create(stk, stksize, (thread_func_t)func, \ + name, arg, len, pp, state, pri) + /* BEGIN CSTYLED */ #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ __thread_create(stk, stksize, (thread_func_t)func, \ diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index ccae941b4..2abdb3e44 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -218,6 +218,9 @@ typedef pthread_t kthread_t; #define kpreempt(x) yield() #define getcomm() "unknown" +#define thread_create_named(name, stk, stksize, func, arg, len, \ + pp, state, pri) \ + zk_thread_create(func, arg, stksize, state) #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ zk_thread_create(func, arg, stksize, state) #define thread_exit() pthread_exit(NULL) diff --git a/include/sys/zthr.h b/include/sys/zthr.h index 0a05f5225..ae8c57e9e 100644 --- a/include/sys/zthr.h +++ b/include/sys/zthr.h @@ -24,10 +24,11 @@ typedef struct zthr zthr_t; typedef void (zthr_func_t)(void *, zthr_t *); typedef boolean_t (zthr_checkfunc_t)(void *, zthr_t *); -extern zthr_t *zthr_create(zthr_checkfunc_t checkfunc, - zthr_func_t *func, void *arg); -extern zthr_t *zthr_create_timer(zthr_checkfunc_t *checkfunc, - zthr_func_t *func, void *arg, hrtime_t nano_wait); +extern zthr_t *zthr_create(const char *zthr_name, + zthr_checkfunc_t checkfunc, zthr_func_t *func, void *arg); +extern zthr_t *zthr_create_timer(const char *zthr_name, + zthr_checkfunc_t *checkfunc, zthr_func_t *func, void *arg, + hrtime_t nano_wait); extern void zthr_destroy(zthr_t *t); extern void zthr_wakeup(zthr_t *t); |