2008-05-26 04:38:26 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the SPL: Solaris Porting Layer.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2008 Lawrence Livermore National Security, LLC.
|
|
|
|
* Produced at Lawrence Livermore National Laboratory
|
|
|
|
* Written by:
|
|
|
|
* Brian Behlendorf <behlendorf1@llnl.gov>,
|
|
|
|
* Herb Wartens <wartens2@llnl.gov>,
|
|
|
|
* Jim Garlick <garlick@llnl.gov>
|
|
|
|
* UCRL-CODE-235197
|
|
|
|
*
|
|
|
|
* This is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2008-02-28 00:52:31 +00:00
|
|
|
#ifndef _SPL_THREAD_H
|
|
|
|
#define _SPL_THREAD_H
|
2008-02-26 20:36:04 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-02-27 19:09:51 +00:00
|
|
|
#include <linux/module.h>
|
2008-02-26 20:36:04 +00:00
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/spinlock.h>
|
2008-04-04 04:44:16 +00:00
|
|
|
#include <linux/kthread.h>
|
2008-03-01 00:45:59 +00:00
|
|
|
#include <sys/types.h>
|
2008-03-04 18:22:31 +00:00
|
|
|
#include <sys/sysmacros.h>
|
2008-02-26 20:36:04 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Thread interfaces
|
|
|
|
*/
|
|
|
|
#define TP_MAGIC 0x53535353
|
|
|
|
|
|
|
|
#define TS_SLEEP TASK_INTERRUPTIBLE
|
|
|
|
#define TS_RUN TASK_RUNNING
|
|
|
|
#define TS_ZOMB EXIT_ZOMBIE
|
|
|
|
#define TS_STOPPED TASK_STOPPED
|
|
|
|
#if 0
|
|
|
|
#define TS_FREE 0x00 /* No clean linux mapping */
|
|
|
|
#define TS_ONPROC 0x04 /* No clean linux mapping */
|
|
|
|
#define TS_WAIT 0x20 /* No clean linux mapping */
|
|
|
|
#endif
|
|
|
|
|
2008-03-10 19:25:20 +00:00
|
|
|
typedef void (*thread_func_t)(void *);
|
|
|
|
|
2008-02-26 20:36:04 +00:00
|
|
|
#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
|
2008-03-10 19:25:20 +00:00
|
|
|
__thread_create(stk, stksize, (thread_func_t)func, \
|
2008-04-04 04:44:16 +00:00
|
|
|
#func, arg, len, pp, state, pri)
|
2008-02-26 20:36:04 +00:00
|
|
|
#define thread_exit() __thread_exit()
|
|
|
|
#define curthread get_current()
|
|
|
|
|
2008-02-27 19:09:51 +00:00
|
|
|
extern kthread_t *__thread_create(caddr_t stk, size_t stksize,
|
2008-04-04 04:44:16 +00:00
|
|
|
thread_func_t func, const char *name,
|
|
|
|
void *args, size_t len, int *pp,
|
|
|
|
int state, pri_t pri);
|
2008-02-27 19:09:51 +00:00
|
|
|
extern void __thread_exit(void);
|
2008-02-26 20:36:04 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-02-28 00:52:31 +00:00
|
|
|
#endif /* _SPL_THREAD_H */
|
2008-02-26 20:36:04 +00:00
|
|
|
|