#include <linux/timer.h>
#include <linux/signal.h>
#include <linux/sched.h>
+#include <linux/kthread.h>
#include <linux/miscdevice.h>
#include <libcfs/linux/portals_compat25.h>
#define cfs_waitq_timedwait(l, s, t) schedule_timeout(t)
#define cfs_schedule_timeout(s, t) schedule_timeout(t)
#define cfs_schedule() schedule()
+#define cfs_kthread_run(fn, data, fmt, arg...) kthread_run(fn, data, fmt, ##arg)
/* Kernel thread */
typedef int (*cfs_thread_t)(void *);
void cfs_waitq_init(struct cfs_waitq *waitq);
void cfs_waitlink_init(struct cfs_waitlink *link);
void cfs_waitq_add(struct cfs_waitq *waitq, struct cfs_waitlink *link);
-void cfs_waitq_add_exclusive(struct cfs_waitq *waitq,
+void cfs_waitq_add_exclusive(struct cfs_waitq *waitq,
struct cfs_waitlink *link);
void cfs_waitq_forward(struct cfs_waitlink *link, struct cfs_waitq *waitq);
void cfs_waitq_del(struct cfs_waitq *waitq, struct cfs_waitlink *link);
static inline void cfs_pause(cfs_duration_t d)
{
struct timespec s;
-
+
cfs_duration_nsec(d, &s);
nanosleep(&s, NULL);
}
#define cfs_sigfillset(l) do {} while (0)
#define cfs_recalc_sigpending(l) do {} while (0)
#define cfs_kernel_thread(l,m,n) LBUG()
+#define cfs_kthread_run(fn,d,fmt,...) LBUG()
#ifdef HAVE_LIBPTHREAD
typedef int (*cfs_thread_t)(void *);
int libcfs_debug_dumplog_thread(void *arg)
{
- cfs_daemonize("");
libcfs_debug_dumplog_internal(arg);
cfs_waitq_signal(&debug_ctlwq);
return 0;
void libcfs_debug_dumplog(void)
{
- int rc;
cfs_waitlink_t wait;
+ cfs_task_t *dumper;
ENTRY;
/* we're being careful to ensure that the kernel thread is
set_current_state(TASK_INTERRUPTIBLE);
cfs_waitq_add(&debug_ctlwq, &wait);
- rc = cfs_kernel_thread(libcfs_debug_dumplog_thread,
- (void *)(long)cfs_curproc_pid(),
- CLONE_VM | CLONE_FS | CLONE_FILES);
- if (rc < 0)
+ dumper = cfs_kthread_run(libcfs_debug_dumplog_thread,
+ (void*)(long)cfs_curproc_pid(),
+ "libcfs_debug_dumper");
+ if (IS_ERR(dumper))
printk(KERN_ERR "LustreError: cannot start log dump thread: "
- "%d\n", rc);
+ "%ld\n", PTR_ERR(dumper));
else
cfs_waitq_wait(&wait, CFS_TASK_INTERRUPTIBLE);