]>
Commit | Line | Data |
---|---|---|
715f6251 | 1 | /* |
2 | * This file is part of the SPL: Solaris Porting Layer. | |
3 | * | |
4 | * Copyright (c) 2008 Lawrence Livermore National Security, LLC. | |
5 | * Produced at Lawrence Livermore National Laboratory | |
6 | * Written by: | |
7 | * Brian Behlendorf <behlendorf1@llnl.gov>, | |
8 | * Herb Wartens <wartens2@llnl.gov>, | |
9 | * Jim Garlick <garlick@llnl.gov> | |
10 | * UCRL-CODE-235197 | |
11 | * | |
12 | * This is free software; you can redistribute it and/or modify it | |
13 | * under the terms of the GNU General Public License as published by | |
14 | * the Free Software Foundation; either version 2 of the License, or | |
15 | * (at your option) any later version. | |
16 | * | |
17 | * This is distributed in the hope that it will be useful, but WITHOUT | |
18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
19 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
20 | * for more details. | |
21 | * | |
22 | * You should have received a copy of the GNU General Public License along | |
23 | * with this program; if not, write to the Free Software Foundation, Inc., | |
24 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
25 | */ | |
26 | ||
09b414e8 | 27 | #ifndef _SPL_THREAD_H |
28 | #define _SPL_THREAD_H | |
f1ca4da6 | 29 | |
30 | #ifdef __cplusplus | |
31 | extern "C" { | |
32 | #endif | |
33 | ||
f1b59d26 | 34 | #include <linux/module.h> |
f1ca4da6 | 35 | #include <linux/mm.h> |
36 | #include <linux/spinlock.h> | |
968eccd1 | 37 | #include <linux/kthread.h> |
f4b37741 | 38 | #include <sys/types.h> |
14c5326c | 39 | #include <sys/sysmacros.h> |
f1ca4da6 | 40 | |
41 | /* | |
42 | * Thread interfaces | |
43 | */ | |
44 | #define TP_MAGIC 0x53535353 | |
45 | ||
46 | #define TS_SLEEP TASK_INTERRUPTIBLE | |
47 | #define TS_RUN TASK_RUNNING | |
48 | #define TS_ZOMB EXIT_ZOMBIE | |
49 | #define TS_STOPPED TASK_STOPPED | |
50 | #if 0 | |
51 | #define TS_FREE 0x00 /* No clean linux mapping */ | |
52 | #define TS_ONPROC 0x04 /* No clean linux mapping */ | |
53 | #define TS_WAIT 0x20 /* No clean linux mapping */ | |
54 | #endif | |
55 | ||
51f443a0 | 56 | typedef void (*thread_func_t)(void *); |
57 | ||
f1ca4da6 | 58 | #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ |
51f443a0 | 59 | __thread_create(stk, stksize, (thread_func_t)func, \ |
968eccd1 | 60 | #func, arg, len, pp, state, pri) |
f1ca4da6 | 61 | #define thread_exit() __thread_exit() |
62 | #define curthread get_current() | |
63 | ||
f1b59d26 | 64 | extern kthread_t *__thread_create(caddr_t stk, size_t stksize, |
968eccd1 | 65 | thread_func_t func, const char *name, |
66 | void *args, size_t len, int *pp, | |
67 | int state, pri_t pri); | |
f1b59d26 | 68 | extern void __thread_exit(void); |
f1ca4da6 | 69 | |
70 | #ifdef __cplusplus | |
71 | } | |
72 | #endif | |
73 | ||
09b414e8 | 74 | #endif /* _SPL_THREAD_H */ |
f1ca4da6 | 75 |