Print this page
    
8158 Want named threads API
9857 proc manpages should have LIBRARY section
    
      
        | Split | Close | 
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/lib/libfakekernel/common/sys/thread.h
          +++ new/usr/src/lib/libfakekernel/common/sys/thread.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  
    | ↓ open down ↓ | 16 lines elided | ↑ open up ↑ | 
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   *
  26   26   * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       27 + * Copyright 2018 Joyent, Inc.
  27   28   */
  28   29  
  29   30  #ifndef _SYS_THREAD_H
  30   31  #define _SYS_THREAD_H
  31   32  
  32   33  #include <sys/types.h>
  33   34  #include <sys/t_lock.h>
  34   35  #include <sys/klwp.h>
  35   36  #include <sys/signal.h>  /* expected by including code */
  36   37  
  37   38  #ifdef  __cplusplus
  38   39  extern "C" {
  39   40  #endif
  40   41  
  41   42  /*
  42   43   * The thread object, its states, and the methods by which it
  43   44   * is accessed.
  44   45   */
  45   46  
  46   47  /*
  47   48   * Values that t_state may assume. Note that t_state cannot have more
  48   49   * than one of these flags set at a time.
  49   50   */
  50   51  #define TS_FREE         0x00    /* Thread at loose ends */
  51   52  #define TS_SLEEP        0x01    /* Awaiting an event */
  52   53  #define TS_RUN          0x02    /* Runnable, but not yet on a processor */
  53   54  #define TS_ONPROC       0x04    /* Thread is being run on a processor */
  54   55  #define TS_ZOMB         0x08    /* Thread has died but hasn't been reaped */
  55   56  #define TS_STOPPED      0x10    /* Stopped, initial state */
  56   57  #define TS_WAIT         0x20    /* Waiting to become runnable */
  57   58  
  58   59  /* ctxop_t */
  59   60  
  60   61  /* afd_t needed by sys/file.h via sys/t_lock.h */
  61   62  typedef struct _afd_not_used afd_t;
  62   63  
  63   64  struct turnstile;
  64   65  struct panic_trap_info;
  65   66  struct upimutex;
  66   67  struct kproject;
  67   68  struct on_trap_data;
  68   69  struct waitq;
  69   70  struct _kcpc_ctx;
  70   71  struct _kcpc_set;
  71   72  
  72   73  /* Definition for kernel thread identifier type */
  73   74  typedef uint64_t kt_did_t;
  74   75  
  
    | ↓ open down ↓ | 38 lines elided | ↑ open up ↑ | 
  75   76  struct _kthread;
  76   77  typedef struct _kthread *kthread_id_t;
  77   78  
  78   79  typedef struct _kthread kthread_t;
  79   80  
  80   81  extern  kthread_t       *_curthread(void);      /* returns thread pointer */
  81   82  #define curthread       (_curthread())          /* current thread pointer */
  82   83  
  83   84  #define _KTHREAD_INVALID        ((void *)(uintptr_t)-1)
  84   85  
       86 +#define THREAD_NAME_MAX (32)
  85   87  
  86   88  struct proc;
  87   89  extern struct proc      *_curproc(void);
  88   90  #define curproc         (_curproc())            /* current proc pointer */
  89   91  
  90   92  struct zone;
  91   93  extern struct zone      *_curzone(void);
  92   94  #define curzone         (_curzone())            /* current zone pointer */
  93   95  
  94   96  extern  kthread_t       *thread_create(
  95   97          caddr_t         stk,
  96   98          size_t          stksize,
  97   99          void            (*proc)(),
  98  100          void            *arg,
  99  101          size_t          len,
 100  102          struct proc     *pp,
 101  103          int             state,
 102  104          pri_t           pri);
 103  105  extern  void    thread_exit(void) __NORETURN;
 104  106  extern  void    thread_join(kt_did_t);
 105  107  
 106  108  extern kthread_t *zthread_create(caddr_t, size_t, void (*)(), void *, size_t,
 107  109      pri_t);
 108  110  extern void zthread_exit(void) __NORETURN;
 109  111  
 110  112  #ifdef  __cplusplus
 111  113  }
 112  114  #endif
 113  115  
 114  116  #endif /* _SYS_THREAD_H */
  
    | ↓ open down ↓ | 20 lines elided | ↑ open up ↑ | 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX