Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
De-inline spl_kthread_create().
Browse files Browse the repository at this point in the history
The function was defined as a static inline with variable arguments
which causes gcc to generate errors on some distros.

Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tim Chase <[email protected]>
Closes #346
  • Loading branch information
Tim Chase authored and behlendorf committed Apr 10, 2014
1 parent 17a527c commit ed650de
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
30 changes: 2 additions & 28 deletions include/sys/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,33 +59,7 @@ extern kthread_t *__thread_create(caddr_t stk, size_t stksize,
void *args, size_t len, proc_t *pp,
int state, pri_t pri);
extern void __thread_exit(void);

/*
* spl_kthread_create - Wrapper providing pre-3.13 semantics for
* kthread_create() in which it is not killable and less likely
* to return -ENOMEM.
*/
static inline struct task_struct *
spl_kthread_create(int (*func)(void *), void *data, const char namefmt[], ...)
{
struct task_struct *tsk;
va_list args;

va_start(args, namefmt);
do {
tsk = kthread_create_on_node(func, data,
-1, namefmt, args);
if (IS_ERR(tsk)) {
if (signal_pending(current)) {
clear_thread_flag(TIF_SIGPENDING);
continue;
}
if (PTR_ERR(tsk) == -ENOMEM)
continue;
return (NULL);
} else
return (tsk);
} while (1);
}
extern struct task_struct *spl_kthread_create(int (*func)(void *),
void *data, const char namefmt[], ...);

#endif /* _SPL_THREAD_H */
28 changes: 28 additions & 0 deletions module/spl/spl-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,31 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func,
SRETURN((kthread_t *)tsk);
}
EXPORT_SYMBOL(__thread_create);

/*
* spl_kthread_create - Wrapper providing pre-3.13 semantics for
* kthread_create() in which it is not killable and less likely
* to return -ENOMEM.
*/
struct task_struct *
spl_kthread_create(int (*func)(void *), void *data, const char namefmt[], ...)
{
struct task_struct *tsk;
va_list args;

va_start(args, namefmt);
do {
tsk = kthread_create(func, data, namefmt, args);
if (IS_ERR(tsk)) {
if (signal_pending(current)) {
clear_thread_flag(TIF_SIGPENDING);
continue;
}
if (PTR_ERR(tsk) == -ENOMEM)
continue;
return (NULL);
} else
return (tsk);
} while (1);
}
EXPORT_SYMBOL(spl_kthread_create);

0 comments on commit ed650de

Please sign in to comment.