Print this page
7127  remove -Wno-missing-braces from Makefile.uts


  57 #include <sys/sdt.h>
  58 #include <sys/cpupart.h>
  59 #include <vm/rm.h>
  60 #include <vm/seg_kmem.h>
  61 #include <sys/modctl.h>
  62 #include <sys/cpucaps.h>
  63 
  64 static pri_t ts_init(id_t, int, classfuncs_t **);
  65 
  66 static struct sclass csw = {
  67         "TS",
  68         ts_init,
  69         0
  70 };
  71 
  72 static struct modlsched modlsched = {
  73         &mod_schedops, "time sharing sched class", &csw
  74 };
  75 
  76 static struct modlinkage modlinkage = {
  77         MODREV_1, (void *)&modlsched, NULL
  78 };
  79 
  80 int
  81 _init()
  82 {
  83         return (mod_install(&modlinkage));
  84 }
  85 
  86 int
  87 _fini()
  88 {
  89         return (EBUSY);         /* don't remove TS for now */
  90 }
  91 
  92 int
  93 _info(struct modinfo *modinfop)
  94 {
  95         return (mod_info(&modlinkage, modinfop));
  96 }
  97 


 222 static int      ia_getclpri(pcpri_t *);
 223 static int      ia_parmsin(void *);
 224 static int      ia_vaparmsin(void *, pc_vaparms_t *);
 225 static int      ia_vaparmsout(void *, pc_vaparms_t *);
 226 static int      ia_parmsset(kthread_t *, void *, id_t, cred_t *);
 227 static void     ia_parmsget(kthread_t *, void *);
 228 static void     ia_set_process_group(pid_t, pid_t, pid_t);
 229 
 230 static void     ts_change_priority(kthread_t *, tsproc_t *);
 231 
 232 extern pri_t    ts_maxkmdpri;   /* maximum kernel mode ts priority */
 233 static pri_t    ts_maxglobpri;  /* maximum global priority used by ts class */
 234 static kmutex_t ts_dptblock;    /* protects time sharing dispatch table */
 235 static kmutex_t ts_list_lock[TS_LISTS]; /* protects tsproc lists */
 236 static tsproc_t ts_plisthead[TS_LISTS]; /* dummy tsproc at head of lists */
 237 
 238 static gid_t    IA_gid = 0;
 239 
 240 static struct classfuncs ts_classfuncs = {
 241         /* class functions */
 242         ts_admin,
 243         ts_getclinfo,
 244         ts_parmsin,
 245         ts_parmsout,
 246         ts_vaparmsin,
 247         ts_vaparmsout,
 248         ts_getclpri,
 249         ts_alloc,
 250         ts_free,
 251 
 252         /* thread functions */
 253         ts_enterclass,
 254         ts_exitclass,
 255         ts_canexit,
 256         ts_fork,
 257         ts_forkret,
 258         ts_parmsget,
 259         ts_parmsset,
 260         ts_nullsys,     /* stop */
 261         ts_exit,
 262         ts_nullsys,     /* active */
 263         ts_nullsys,     /* inactive */
 264         ts_swapin,
 265         ts_swapout,
 266         ts_trapret,
 267         ts_preempt,
 268         ts_setrun,
 269         ts_sleep,
 270         ts_tick,
 271         ts_wakeup,
 272         ts_donice,
 273         ts_globpri,
 274         ts_nullsys,     /* set_process_group */
 275         ts_yield,
 276         ts_doprio,
 277 };
 278 
 279 /*
 280  * ia_classfuncs is used for interactive class threads; IA threads are stored
 281  * on the same class list as TS threads, and most of the class functions are
 282  * identical, but a few have different enough functionality to require their
 283  * own functions.
 284  */
 285 static struct classfuncs ia_classfuncs = {
 286         /* class functions */
 287         ts_admin,
 288         ia_getclinfo,
 289         ia_parmsin,
 290         ts_parmsout,
 291         ia_vaparmsin,
 292         ia_vaparmsout,
 293         ia_getclpri,
 294         ts_alloc,
 295         ts_free,
 296 
 297         /* thread functions */
 298         ts_enterclass,
 299         ts_exitclass,
 300         ts_canexit,
 301         ts_fork,
 302         ts_forkret,
 303         ia_parmsget,
 304         ia_parmsset,
 305         ts_nullsys,     /* stop */
 306         ts_exit,
 307         ts_nullsys,     /* active */
 308         ts_nullsys,     /* inactive */
 309         ts_swapin,
 310         ts_swapout,
 311         ts_trapret,
 312         ts_preempt,
 313         ts_setrun,
 314         ts_sleep,
 315         ts_tick,
 316         ts_wakeup,
 317         ts_donice,
 318         ts_globpri,
 319         ia_set_process_group,
 320         ts_yield,
 321         ts_doprio,
 322 };
 323 
 324 
 325 /*
 326  * Time sharing class initialization.  Called by dispinit() at boot time.
 327  * We can ignore the clparmsz argument since we know that the smallest
 328  * possible parameter buffer is big enough for us.
 329  */
 330 /* ARGSUSED */
 331 static pri_t
 332 ts_init(id_t cid, int clparmsz, classfuncs_t **clfuncspp)
 333 {
 334         int i;
 335         extern pri_t ts_getmaxumdpri(void);
 336 
 337         ts_dptbl = ts_getdptbl();
 338         ts_kmdpris = ts_getkmdpris();
 339         ts_maxumdpri = ts_getmaxumdpri();
 340         ts_maxglobpri = MAX(ts_kmdpris[0], ts_dptbl[ts_maxumdpri].ts_globpri);
 341 




  57 #include <sys/sdt.h>
  58 #include <sys/cpupart.h>
  59 #include <vm/rm.h>
  60 #include <vm/seg_kmem.h>
  61 #include <sys/modctl.h>
  62 #include <sys/cpucaps.h>
  63 
  64 static pri_t ts_init(id_t, int, classfuncs_t **);
  65 
  66 static struct sclass csw = {
  67         "TS",
  68         ts_init,
  69         0
  70 };
  71 
  72 static struct modlsched modlsched = {
  73         &mod_schedops, "time sharing sched class", &csw
  74 };
  75 
  76 static struct modlinkage modlinkage = {
  77         MODREV_1, { (void *)&modlsched, NULL }
  78 };
  79 
  80 int
  81 _init()
  82 {
  83         return (mod_install(&modlinkage));
  84 }
  85 
  86 int
  87 _fini()
  88 {
  89         return (EBUSY);         /* don't remove TS for now */
  90 }
  91 
  92 int
  93 _info(struct modinfo *modinfop)
  94 {
  95         return (mod_info(&modlinkage, modinfop));
  96 }
  97 


 222 static int      ia_getclpri(pcpri_t *);
 223 static int      ia_parmsin(void *);
 224 static int      ia_vaparmsin(void *, pc_vaparms_t *);
 225 static int      ia_vaparmsout(void *, pc_vaparms_t *);
 226 static int      ia_parmsset(kthread_t *, void *, id_t, cred_t *);
 227 static void     ia_parmsget(kthread_t *, void *);
 228 static void     ia_set_process_group(pid_t, pid_t, pid_t);
 229 
 230 static void     ts_change_priority(kthread_t *, tsproc_t *);
 231 
 232 extern pri_t    ts_maxkmdpri;   /* maximum kernel mode ts priority */
 233 static pri_t    ts_maxglobpri;  /* maximum global priority used by ts class */
 234 static kmutex_t ts_dptblock;    /* protects time sharing dispatch table */
 235 static kmutex_t ts_list_lock[TS_LISTS]; /* protects tsproc lists */
 236 static tsproc_t ts_plisthead[TS_LISTS]; /* dummy tsproc at head of lists */
 237 
 238 static gid_t    IA_gid = 0;
 239 
 240 static struct classfuncs ts_classfuncs = {
 241         /* class functions */
 242         {   ts_admin,
 243             ts_getclinfo,
 244             ts_parmsin,
 245             ts_parmsout,
 246             ts_vaparmsin,
 247             ts_vaparmsout,
 248             ts_getclpri,
 249             ts_alloc,
 250             ts_free },
 251 
 252         /* thread functions */
 253         {   ts_enterclass,
 254             ts_exitclass,
 255             ts_canexit,
 256             ts_fork,
 257             ts_forkret,
 258             ts_parmsget,
 259             ts_parmsset,
 260             ts_nullsys, /* stop */
 261             ts_exit,
 262             ts_nullsys, /* active */
 263             ts_nullsys, /* inactive */
 264             ts_swapin,
 265             ts_swapout,
 266             ts_trapret,
 267             ts_preempt,
 268             ts_setrun,
 269             ts_sleep,
 270             ts_tick,
 271             ts_wakeup,
 272             ts_donice,
 273             ts_globpri,
 274             ts_nullsys, /* set_process_group */
 275             ts_yield,
 276             ts_doprio },
 277 };
 278 
 279 /*
 280  * ia_classfuncs is used for interactive class threads; IA threads are stored
 281  * on the same class list as TS threads, and most of the class functions are
 282  * identical, but a few have different enough functionality to require their
 283  * own functions.
 284  */
 285 static struct classfuncs ia_classfuncs = {
 286         /* class functions */
 287         {   ts_admin,
 288             ia_getclinfo,
 289             ia_parmsin,
 290             ts_parmsout,
 291             ia_vaparmsin,
 292             ia_vaparmsout,
 293             ia_getclpri,
 294             ts_alloc,
 295             ts_free },
 296 
 297         /* thread functions */
 298         {   ts_enterclass,
 299             ts_exitclass,
 300             ts_canexit,
 301             ts_fork,
 302             ts_forkret,
 303             ia_parmsget,
 304             ia_parmsset,
 305             ts_nullsys, /* stop */
 306             ts_exit,
 307             ts_nullsys, /* active */
 308             ts_nullsys, /* inactive */
 309             ts_swapin,
 310             ts_swapout,
 311             ts_trapret,
 312             ts_preempt,
 313             ts_setrun,
 314             ts_sleep,
 315             ts_tick,
 316             ts_wakeup,
 317             ts_donice,
 318             ts_globpri,
 319             ia_set_process_group,
 320             ts_yield,
 321             ts_doprio },
 322 };
 323 
 324 
 325 /*
 326  * Time sharing class initialization.  Called by dispinit() at boot time.
 327  * We can ignore the clparmsz argument since we know that the smallest
 328  * possible parameter buffer is big enough for us.
 329  */
 330 /* ARGSUSED */
 331 static pri_t
 332 ts_init(id_t cid, int clparmsz, classfuncs_t **clfuncspp)
 333 {
 334         int i;
 335         extern pri_t ts_getmaxumdpri(void);
 336 
 337         ts_dptbl = ts_getdptbl();
 338         ts_kmdpris = ts_getkmdpris();
 339         ts_maxumdpri = ts_getmaxumdpri();
 340         ts_maxglobpri = MAX(ts_kmdpris[0], ts_dptbl[ts_maxumdpri].ts_globpri);
 341