Print this page
NEX-4083 Upstream changes from illumos 5917 and 5995
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
SMB-50 User-mode SMB server
 Includes work by these authors:
 Thomas Keiser <thomas.keiser@nexenta.com>
 Albert Lee <trisk@nexenta.com>
re #13613 rb4516 Tunables needs volatile keyword


  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 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 /*
  26  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  * Copyright 2016 Nexenta Systems, Inc.
  29  */



  30 
  31 #ifndef _SYS_SYSTM_H
  32 #define _SYS_SYSTM_H
  33 
  34 #include <sys/types.h>
  35 #include <sys/t_lock.h>
  36 #include <sys/proc.h>
  37 #include <sys/dditypes.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 /*
  44  * The pc_t is the type of the kernel's program counter.  In general, a
  45  * pc_t is a uintptr_t -- except for a sparcv9 kernel, in which case all
  46  * instruction text is below 4G, and a pc_t is thus a uint32_t.
  47  */
  48 #ifdef __sparcv9
  49 typedef uint32_t pc_t;


  54 /*
  55  * Random set of variables used by more than one routine.
  56  */
  57 
  58 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
  59 #include <sys/types32.h>
  60 #include <sys/varargs.h>
  61 #include <sys/uadmin.h>
  62 
  63 extern int hz;                  /* system clock rate */
  64 extern struct vnode *rootdir;   /* pointer to vnode of root directory */
  65 extern struct vnode *devicesdir;        /* pointer to /devices vnode */
  66 extern int interrupts_unleashed;        /* set after the spl0() in main() */
  67 
  68 extern char runin;              /* scheduling flag */
  69 extern char runout;             /* scheduling flag */
  70 extern char wake_sched;         /* causes clock to wake swapper on next tick */
  71 extern char wake_sched_sec;     /* causes clock to wake swapper after a sec */
  72 
  73 extern pgcnt_t  maxmem;         /* max available memory (pages) */
  74 extern pgcnt_t  physmem;        /* physical memory (pages) on this CPU */
  75 extern pfn_t    physmax;        /* highest numbered physical page present */
  76 extern pgcnt_t  physinstalled;  /* physical pages including PROM/boot use */
  77 
  78 extern caddr_t  s_text;         /* start of kernel text segment */
  79 extern caddr_t  e_text;         /* end of kernel text segment */
  80 extern caddr_t  s_data;         /* start of kernel text segment */
  81 extern caddr_t  e_data;         /* end of kernel text segment */
  82 
  83 extern pgcnt_t  availrmem;      /* Available resident (not swapable)    */
  84                                 /* memory in pages.                     */
  85 extern pgcnt_t  availrmem_initial;      /* initial value of availrmem   */
  86 extern pgcnt_t  segspt_minfree; /* low water mark for availrmem in seg_spt */

  87 extern pgcnt_t  freemem;        /* Current free memory.                 */
  88 
  89 extern dev_t    rootdev;        /* device of the root */
  90 extern struct vnode *rootvp;    /* vnode of root device */
  91 extern boolean_t root_is_ramdisk;       /* root is boot_archive ramdisk */
  92 extern uint32_t  ramdisk_size;          /* (KB) set only for sparc netboots */
  93 extern char *volatile panicstr; /* panic string pointer */
  94 extern va_list  panicargs;      /* panic arguments */
  95 extern volatile int quiesce_active;     /* quiesce(9E) is in progress */
  96 
  97 extern int      rstchown;       /* 1 ==> restrictive chown(2) semantics */
  98 extern int      klustsize;
  99 
 100 extern int      abort_enable;   /* Platform input-device abort policy */
 101 
 102 extern int      audit_active;   /* Solaris Auditing module state */
 103 
 104 extern int      avenrun[];      /* array of load averages */
 105 
 106 extern char *isa_list;          /* For sysinfo's isalist option */
 107 
 108 extern int noexec_user_stack;           /* patchable via /etc/system */
 109 extern int noexec_user_stack_log;       /* patchable via /etc/system */
 110 
 111 /*
 112  * Use NFS client operations in the global zone only.  Under contract with
 113  * admin/install; do not change without coordinating with that consolidation.
 114  */
 115 extern int nfs_global_client_only;
 116 
 117 extern void report_stack_exec(proc_t *, caddr_t);
 118 
 119 extern void startup(void);
 120 extern void clkstart(void);
 121 extern void post_startup(void);
 122 extern void kern_setup1(void);
 123 extern void ka_init(void);
 124 extern void nodename_set(void);
 125 
 126 /*
 127  * for tod fault detection
 128  */


 291 extern void sync_data_memory(caddr_t, size_t);
 292 extern void hot_patch_kernel_text(caddr_t, uint32_t, uint_t);
 293 
 294 void _insque(caddr_t, caddr_t);
 295 void _remque(caddr_t);
 296 
 297 /* casts to keep lint happy */
 298 #define insque(q, p)    _insque((caddr_t)q, (caddr_t)p)
 299 #define remque(q)       _remque((caddr_t)q)
 300 
 301 #pragma unknown_control_flow(on_fault)
 302 
 303 struct timeval;
 304 extern void     uniqtime(struct timeval *);
 305 struct timeval32;
 306 extern void     uniqtime32(struct timeval32 *);
 307 
 308 uint_t page_num_pagesizes(void);
 309 size_t page_get_pagesize(uint_t n);
 310 
 311 extern int maxusers;
 312 extern int pidmax;
 313 
 314 extern void param_preset(void);
 315 extern void param_calc(int);
 316 extern void param_init(void);
 317 extern void param_check(void);
 318 
 319 #endif /* _KERNEL */
 320 
 321 /*
 322  * Structure of the system-entry table.
 323  *
 324  *      Changes to struct sysent should maintain binary compatibility with
 325  *      loadable system calls, although the interface is currently private.
 326  *
 327  *      This means it should only be expanded on the end, and flag values
 328  *      should not be reused.
 329  *
 330  *      It is desirable to keep the size of this struct a power of 2 for quick
 331  *      indexing.
 332  */




  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 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 /*
  26  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  * Copyright 2016 Nexenta Systems, Inc.
  29  */
  30 /*
  31  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  32  */
  33 
  34 #ifndef _SYS_SYSTM_H
  35 #define _SYS_SYSTM_H
  36 
  37 #include <sys/types.h>
  38 #include <sys/t_lock.h>
  39 #include <sys/proc.h>
  40 #include <sys/dditypes.h>
  41 
  42 #ifdef  __cplusplus
  43 extern "C" {
  44 #endif
  45 
  46 /*
  47  * The pc_t is the type of the kernel's program counter.  In general, a
  48  * pc_t is a uintptr_t -- except for a sparcv9 kernel, in which case all
  49  * instruction text is below 4G, and a pc_t is thus a uint32_t.
  50  */
  51 #ifdef __sparcv9
  52 typedef uint32_t pc_t;


  57 /*
  58  * Random set of variables used by more than one routine.
  59  */
  60 
  61 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
  62 #include <sys/types32.h>
  63 #include <sys/varargs.h>
  64 #include <sys/uadmin.h>
  65 
  66 extern int hz;                  /* system clock rate */
  67 extern struct vnode *rootdir;   /* pointer to vnode of root directory */
  68 extern struct vnode *devicesdir;        /* pointer to /devices vnode */
  69 extern int interrupts_unleashed;        /* set after the spl0() in main() */
  70 
  71 extern char runin;              /* scheduling flag */
  72 extern char runout;             /* scheduling flag */
  73 extern char wake_sched;         /* causes clock to wake swapper on next tick */
  74 extern char wake_sched_sec;     /* causes clock to wake swapper after a sec */
  75 
  76 extern pgcnt_t  maxmem;         /* max available memory (pages) */
  77 extern volatile pgcnt_t physmem; /* physical memory (pages) on this CPU */
  78 extern pfn_t    physmax;        /* highest numbered physical page present */
  79 extern pgcnt_t  physinstalled;  /* physical pages including PROM/boot use */
  80 
  81 extern caddr_t  s_text;         /* start of kernel text segment */
  82 extern caddr_t  e_text;         /* end of kernel text segment */
  83 extern caddr_t  s_data;         /* start of kernel text segment */
  84 extern caddr_t  e_data;         /* end of kernel text segment */
  85 
  86 extern pgcnt_t  availrmem;      /* Available resident (not swapable)    */
  87                                 /* memory in pages.                     */
  88 extern pgcnt_t  availrmem_initial;      /* initial value of availrmem   */
  89 extern volatile pgcnt_t segspt_minfree; /* low water mark for availrmem */
  90                                         /* in seg_spt                   */
  91 extern pgcnt_t  freemem;        /* Current free memory.                 */
  92 
  93 extern dev_t    rootdev;        /* device of the root */
  94 extern struct vnode *rootvp;    /* vnode of root device */
  95 extern boolean_t root_is_ramdisk;       /* root is boot_archive ramdisk */
  96 extern uint32_t  ramdisk_size;          /* (KB) set only for sparc netboots */
  97 extern char *volatile panicstr; /* panic string pointer */
  98 extern va_list  panicargs;      /* panic arguments */
  99 extern volatile int quiesce_active;     /* quiesce(9E) is in progress */
 100 
 101 extern volatile int rstchown;   /* 1 ==> restrictive chown(2) semantics */
 102 extern int      klustsize;
 103 
 104 extern int      abort_enable;   /* Platform input-device abort policy */
 105 
 106 extern int      audit_active;   /* Solaris Auditing module state */
 107 
 108 extern int      avenrun[];      /* array of load averages */
 109 
 110 extern char *isa_list;          /* For sysinfo's isalist option */
 111 
 112 extern volatile int noexec_user_stack;  /* patchable via /etc/system */
 113 extern int noexec_user_stack_log;       /* patchable via /etc/system */
 114 
 115 /*
 116  * Use NFS client operations in the global zone only.  Under contract with
 117  * admin/install; do not change without coordinating with that consolidation.
 118  */
 119 extern int nfs_global_client_only;
 120 
 121 extern void report_stack_exec(proc_t *, caddr_t);
 122 
 123 extern void startup(void);
 124 extern void clkstart(void);
 125 extern void post_startup(void);
 126 extern void kern_setup1(void);
 127 extern void ka_init(void);
 128 extern void nodename_set(void);
 129 
 130 /*
 131  * for tod fault detection
 132  */


 295 extern void sync_data_memory(caddr_t, size_t);
 296 extern void hot_patch_kernel_text(caddr_t, uint32_t, uint_t);
 297 
 298 void _insque(caddr_t, caddr_t);
 299 void _remque(caddr_t);
 300 
 301 /* casts to keep lint happy */
 302 #define insque(q, p)    _insque((caddr_t)q, (caddr_t)p)
 303 #define remque(q)       _remque((caddr_t)q)
 304 
 305 #pragma unknown_control_flow(on_fault)
 306 
 307 struct timeval;
 308 extern void     uniqtime(struct timeval *);
 309 struct timeval32;
 310 extern void     uniqtime32(struct timeval32 *);
 311 
 312 uint_t page_num_pagesizes(void);
 313 size_t page_get_pagesize(uint_t n);
 314 
 315 extern volatile int maxusers;
 316 extern volatile int pidmax;
 317 
 318 extern void param_preset(void);
 319 extern void param_calc(int);
 320 extern void param_init(void);
 321 extern void param_check(void);
 322 
 323 #endif /* _KERNEL */
 324 
 325 /*
 326  * Structure of the system-entry table.
 327  *
 328  *      Changes to struct sysent should maintain binary compatibility with
 329  *      loadable system calls, although the interface is currently private.
 330  *
 331  *      This means it should only be expanded on the end, and flag values
 332  *      should not be reused.
 333  *
 334  *      It is desirable to keep the size of this struct a power of 2 for quick
 335  *      indexing.
 336  */