4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
32 #include <sys/types.h>
33 #include <sys/t_lock.h>
35 #include <sys/signal.h> /* expected by including code */
42 * The thread object, its states, and the methods by which it
47 * Values that t_state may assume. Note that t_state cannot have more
48 * than one of these flags set at a time.
50 #define TS_FREE 0x00 /* Thread at loose ends */
51 #define TS_SLEEP 0x01 /* Awaiting an event */
52 #define TS_RUN 0x02 /* Runnable, but not yet on a processor */
53 #define TS_ONPROC 0x04 /* Thread is being run on a processor */
54 #define TS_ZOMB 0x08 /* Thread has died but hasn't been reaped */
55 #define TS_STOPPED 0x10 /* Stopped, initial state */
56 #define TS_WAIT 0x20 /* Waiting to become runnable */
60 /* afd_t needed by sys/file.h via sys/t_lock.h */
61 typedef struct _afd_not_used afd_t
;
64 struct panic_trap_info
;
72 /* Definition for kernel thread identifier type */
73 typedef uint64_t kt_did_t
;
76 typedef struct _kthread
*kthread_id_t
;
78 typedef struct _kthread kthread_t
;
80 extern kthread_t
*_curthread(void); /* returns thread pointer */
81 #define curthread (_curthread()) /* current thread pointer */
83 #define _KTHREAD_INVALID ((void *)(uintptr_t)-1)
87 extern struct proc
*_curproc(void);
88 #define curproc (_curproc()) /* current proc pointer */
91 extern struct zone
*_curzone(void);
92 #define curzone (_curzone()) /* current zone pointer */
94 extern kthread_t
*thread_create(
103 extern void thread_exit(void) __NORETURN
;
104 extern void thread_join(kt_did_t
);
106 extern kthread_t
*zthread_create(caddr_t
, size_t, void (*)(), void *, size_t,
108 extern void zthread_exit(void) __NORETURN
;
114 #endif /* _SYS_THREAD_H */