Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section


   7  *
   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.
  12  *
  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]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  *
  26  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.

  27  */
  28 
  29 #ifndef _SYS_THREAD_H
  30 #define _SYS_THREAD_H
  31 
  32 #include <sys/types.h>
  33 #include <sys/t_lock.h>
  34 #include <sys/klwp.h>
  35 #include <sys/signal.h>  /* expected by including code */
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 /*
  42  * The thread object, its states, and the methods by which it
  43  * is accessed.
  44  */
  45 
  46 /*


  65 struct upimutex;
  66 struct kproject;
  67 struct on_trap_data;
  68 struct waitq;
  69 struct _kcpc_ctx;
  70 struct _kcpc_set;
  71 
  72 /* Definition for kernel thread identifier type */
  73 typedef uint64_t kt_did_t;
  74 
  75 struct _kthread;
  76 typedef struct _kthread *kthread_id_t;
  77 
  78 typedef struct _kthread kthread_t;
  79 
  80 extern  kthread_t       *_curthread(void);      /* returns thread pointer */
  81 #define curthread       (_curthread())          /* current thread pointer */
  82 
  83 #define _KTHREAD_INVALID        ((void *)(uintptr_t)-1)
  84 

  85 
  86 struct proc;
  87 extern struct proc      *_curproc(void);
  88 #define curproc         (_curproc())            /* current proc pointer */
  89 
  90 struct zone;
  91 extern struct zone      *_curzone(void);
  92 #define curzone         (_curzone())            /* current zone pointer */
  93 
  94 extern  kthread_t       *thread_create(
  95         caddr_t         stk,
  96         size_t          stksize,
  97         void            (*proc)(),
  98         void            *arg,
  99         size_t          len,
 100         struct proc     *pp,
 101         int             state,
 102         pri_t           pri);
 103 extern  void    thread_exit(void) __NORETURN;
 104 extern  void    thread_join(kt_did_t);


   7  *
   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.
  12  *
  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]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  *
  26  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  27  * Copyright 2018 Joyent, Inc.
  28  */
  29 
  30 #ifndef _SYS_THREAD_H
  31 #define _SYS_THREAD_H
  32 
  33 #include <sys/types.h>
  34 #include <sys/t_lock.h>
  35 #include <sys/klwp.h>
  36 #include <sys/signal.h>  /* expected by including code */
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 /*
  43  * The thread object, its states, and the methods by which it
  44  * is accessed.
  45  */
  46 
  47 /*


  66 struct upimutex;
  67 struct kproject;
  68 struct on_trap_data;
  69 struct waitq;
  70 struct _kcpc_ctx;
  71 struct _kcpc_set;
  72 
  73 /* Definition for kernel thread identifier type */
  74 typedef uint64_t kt_did_t;
  75 
  76 struct _kthread;
  77 typedef struct _kthread *kthread_id_t;
  78 
  79 typedef struct _kthread kthread_t;
  80 
  81 extern  kthread_t       *_curthread(void);      /* returns thread pointer */
  82 #define curthread       (_curthread())          /* current thread pointer */
  83 
  84 #define _KTHREAD_INVALID        ((void *)(uintptr_t)-1)
  85 
  86 #define THREAD_NAME_MAX (32)
  87 
  88 struct proc;
  89 extern struct proc      *_curproc(void);
  90 #define curproc         (_curproc())            /* current proc pointer */
  91 
  92 struct zone;
  93 extern struct zone      *_curzone(void);
  94 #define curzone         (_curzone())            /* current zone pointer */
  95 
  96 extern  kthread_t       *thread_create(
  97         caddr_t         stk,
  98         size_t          stksize,
  99         void            (*proc)(),
 100         void            *arg,
 101         size_t          len,
 102         struct proc     *pp,
 103         int             state,
 104         pri_t           pri);
 105 extern  void    thread_exit(void) __NORETURN;
 106 extern  void    thread_join(kt_did_t);