The OpenD Programming Language

1 /**
2  * D header file for the Solaris priocntl(2) and priocntlset(2) functions.
3  *
4  * Copyright:   Copyright 2014 Jason King.
5  * License:     $(HTTP www.boost.org/LICENSE_1.0.txt, Boost License 1.0).
6  * Authors:     Jason King
7  */
8 
9 /*
10  * Copyright 2014 Jason King.
11  * Distributed under the Boost Software License, Version 1.0.
12  * See accompanying file LICENSE or copy at
13  *  http://www.boost.org/LICENSE_1_0.txt
14  */
15 module core.sys.solaris.sys.priocntl;
16 
17 version (Solaris):
18 nothrow:
19 @nogc:
20 extern (C):
21 
22 import core.sys.posix.sys.types : caddr_t, id_t;
23 import core.sys.posix.sys.wait : idtype_t;
24 import core.stdc.config : c_long;
25 import core.sys.solaris.sys.procset;
26 import core.sys.solaris.sys.types : pri_t;
27 
28 c_long priocntl(idtype_t, id_t, int, ...);
29 c_long priocntlset(procset_t*, int, ...);
30 
31 
32 enum PC_GETCID       = 0;       /* Get class ID */
33 enum PC_GETCLINFO    = 1;       /* Get info about a configured class */
34 enum PC_SETPARMS     = 2;       /* Set scheduling parameters */
35 enum PC_GETPARMS     = 3;       /* Get scheduling parameters */
36 enum PC_ADMIN        = 4;       /* Scheduler administration (used by */
37                                 /* dispadmin(1M), not for general use) */
38 enum PC_GETPRIRANGE  = 5;       /* Get priority range for a class */
39                                 /* posix.4; scheduling, not for general use */
40 enum PC_DONICE       = 6;       /* Set or get nice value */
41 enum PC_SETXPARMS    = 7;       /* Set extended scheduling parameters */
42 enum PC_GETXPARMS    = 8;       /* Get extended scheduling parameters */
43 enum PC_SETDFLCL     = 9;       /* Set default class, not for general use */
44 enum PC_GETDFLCL     = 10;      /* Get default class, not for general use */
45 enum PC_DOPRIO       = 11;      /* Set or get priority, not for general use */
46 
47 enum PC_CLNULL       = -1;
48 
49 enum PC_CLNMSZ       = 16;
50 enum PC_CLINFOSZ     = (32 / int.sizeof);
51 enum PC_CLPARMSZ     = (32 / int.sizeof);
52 
53 enum PC_GETNICE = 0;
54 enum PC_SETNICE = 1;
55 
56 enum PC_GETPRIO      = 0;
57 enum PC_SETPRIO      = 1;
58 
59 struct pcinfo_t
60 {
61     id_t                pc_cid;     // class id
62     char[PC_CLNMSZ]     pc_clname=0;// class name
63     int[PC_CLINFOSZ]    pc_clinfo;  // class information
64 }
65 
66 struct pcparms_t
67 {
68     id_t                pc_cid;     // process class
69     int[PC_CLPARMSZ]    pc_clparms; //class specific parameters
70 }
71 
72 struct pcnice_t
73 {
74     int pc_val; // nice value
75     int pc_op;  // type of operation, set or get
76 }
77 
78 struct pcprio_t
79 {
80     int     pc_op;  // type of operation, set or get
81     id_t    pc_cid; // class id
82     int     pc_val; // priority value
83 }
84 
85 // Used by the priocntl varargs interface
86 // PC_SETXPARMS and PC_GETXPARMS
87 enum PC_VAPARMCNT = 8;  // max # of kv pairs
88 enum PC_KY_NULL   = 0;  // kv chain terminator
89 enum PC_KY_CLNAME = 1;  // get the class name of a process or LWP
90 
91 struct pc_vaparm_t
92 {
93     int     pc_key;
94     ulong   pc_parm;
95 }
96 
97 struct pc_vaparms_t
98 {
99     int                         pc_vaparmscnt; // # of kv pairs
100     pc_vaparm_t[PC_VAPARMCNT]   pc_parm;
101 }
102 
103 // Not for general use
104 struct pcpri_t
105 {
106     id_t    pc_cid;
107     pri_t   pc_clpmax;
108     pri_t   pc_clpmin;
109 }
110 
111 struct pcadmin_t
112 {
113     id_t    pc_cid;
114     caddr_t pc_cladmin;
115 }