os/ossrv/genericopenlibs/openenvcore/include/sys/resource.dosc
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/sys/resource.dosc	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,338 @@
     1.4 +/** @file ../include/sys/resource.h
     1.5 +@internalComponent
     1.6 +*/
     1.7 +
     1.8 +/** @fn  getpriority(int which, int who)
     1.9 +@param which
    1.10 +@param who
    1.11 +
    1.12 +Note: This description also covers the following functions -
    1.13 + setpriority() 
    1.14 +
    1.15 +@return   Since getpriority can legitimately return the value -1, it is necessary
    1.16 +to clear the external variable errno prior to the
    1.17 +call, then check it afterward to determine
    1.18 +if a -1 is an error or a legitimate value. The setpriority returns 0 on success and -1 on error with the errno set.
    1.19 +
    1.20 +  The scheduling
    1.21 +priority of the process, process group, or user, as indicated by which and who is obtained with the getpriority system call and set with the setpriority system call.
    1.22 +The which argument
    1.23 +is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER, and who is interpreted relative to which (a process identifier for PRIO_PROCESS, process group
    1.24 +identifier for PRIO_PGRP, and a user ID for PRIO_USER ). A zero value of who denotes the current process, process group, or user.
    1.25 +The prio argument
    1.26 +is a value in the range -20 to 20.
    1.27 +The default priority is 0;
    1.28 +lower priorities cause more favorable scheduling.
    1.29 +
    1.30 +
    1.31 +
    1.32 + If the prio is greater than the greatest priority supported, it is set to the greatest priority supported.
    1.33 +If the prio is lesser than the least priority supported, it is set to the least priority supported.
    1.34 +
    1.35 +Examples:
    1.36 +@code
    1.37 +#include<sys/resource.h>        
    1.38 +#include<unistd.h>
    1.39 +#include<stdio.h>
    1.40 +int test_getpriority()
    1.41 +{
    1.42 +   int retVal;
    1.43 +   errno = 0;
    1.44 +   retVal = getpriority(PRIO_PROCESS, 0);
    1.45 +   if((retVal == -1) && (errno == ENOSYS))
    1.46 +   {
    1.47 +      printf("Failed");
    1.48 +      return -1;
    1.49 +   }
    1.50 +   else
    1.51 +   {
    1.52 +      printf("getpriority passed");
    1.53 +      printf("
    1.54 +priority = %d ", retVal);
    1.55 +   }    
    1.56 +   return 0;
    1.57 +}
    1.58 +
    1.59 +@endcode
    1.60 + Output
    1.61 +@code
    1.62 +getpriority passed
    1.63 +priority = 0
    1.64 +
    1.65 +@endcode
    1.66 +@code
    1.67 +#include<sys/resource.h>        
    1.68 +#include<unistd.h>
    1.69 +#include<stdio.h>
    1.70 +int test_setpriority()
    1.71 +{
    1.72 +   int retVal;
    1.73 +   errno = 0;
    1.74 +   retVal = setpriority(PRIO_PROCESS, 0, 0);
    1.75 +  
    1.76 +   if((retVal == -1) && (errno == ENOSYS))
    1.77 +   {
    1.78 +      printf("Failed");
    1.79 +      return -1;
    1.80 +   }
    1.81 +   else
    1.82 +   {
    1.83 +      printf("Setpriority passed");
    1.84 +      printf(" getpriority now: %d", getpriority(PRIO_PROCESS,0))
    1.85 +    }   
    1.86 +   return 0;
    1.87 +}
    1.88 +
    1.89 +@endcode
    1.90 + Output
    1.91 +@code
    1.92 +Setpriority passed
    1.93 +getpriority now: 0
    1.94 +
    1.95 +@endcode
    1.96 +
    1.97 +Limitations:
    1.98 +
    1.99 +1. The values PRIO_PGRP and PRIO_USER for the which and any value other than 0 for who are not supported, when given return ENOSYS. 
   1.100 +2. To effectively increase or decrease the priority of the process, one should consider the following:  
   1.101 +Highest                                                                 -16 to -20         Above Normal                                                     -6 to -15         Normal                                                                          +4 to -5         Below Normal                                                    +14 to +5         Lowest                                                                    +20 to +15 3. 
   1.102 +The setting of the priority to values -16 to -20 is not supported, the use of which sets errno to EINVAL.
   1.103 +
   1.104 +@see nice()
   1.105 +
   1.106 +
   1.107 + 
   1.108 +
   1.109 +@publishedAll
   1.110 +@externallyDefinedApi
   1.111 +*/
   1.112 +
   1.113 +/** @fn  setpriority(int which, int who, int value)
   1.114 +@param which
   1.115 +@param who
   1.116 +@param value
   1.117 +
   1.118 +Refer to  getpriority() for the documentation
   1.119 +
   1.120 +@see nice()
   1.121 +
   1.122 +
   1.123 + 
   1.124 +
   1.125 +@publishedAll
   1.126 +@externallyDefinedApi
   1.127 +*/
   1.128 +
   1.129 +
   1.130 +/** @struct rlimit
   1.131 +
   1.132 +Contains the following members,
   1.133 +
   1.134 +@publishedAll
   1.135 +@externallyDefinedApi
   1.136 +*/
   1.137 +
   1.138 +/** @var rlimit::rlim_cur
   1.139 +current (soft) limit
   1.140 +*/
   1.141 +
   1.142 +/** @var rlimit::rlim_max
   1.143 +maximum value for rlim_cur
   1.144 +*/
   1.145 +
   1.146 +/** @struct rusage 
   1.147 +
   1.148 +Contains the following members,
   1.149 +
   1.150 +@publishedAll
   1.151 +@externallyDefinedApi
   1.152 +*/
   1.153 +
   1.154 +/** @var rusage::ru_utime
   1.155 +user time used
   1.156 +*/
   1.157 +
   1.158 +/** @var rusage::ru_stime
   1.159 +system time used
   1.160 +*/
   1.161 +
   1.162 +/** @var rusage::ru_maxrss
   1.163 +max resident set size
   1.164 +*/
   1.165 +
   1.166 +/** @var rusage::ru_ixrss
   1.167 +integral shared memory size
   1.168 +*/
   1.169 +
   1.170 +/** @var rusage::ru_idrss
   1.171 +integral unshared data
   1.172 +*/
   1.173 +
   1.174 +/** @var rusage::ru_isrss
   1.175 +integral unshared stack
   1.176 +*/
   1.177 +
   1.178 +/** @var rusage::ru_minflt
   1.179 +page reclaims
   1.180 +*/
   1.181 +
   1.182 +/** @var rusage::ru_majflt
   1.183 +page faults
   1.184 +*/
   1.185 +
   1.186 +/** @var rusage::ru_nswap
   1.187 +(c + j) swaps
   1.188 +*/
   1.189 +
   1.190 +/** @var rusage::ru_inblock
   1.191 +block input operations
   1.192 +*/
   1.193 +
   1.194 +/** @var rusage::ru_oublock
   1.195 +block output operations
   1.196 +*/
   1.197 +
   1.198 +/** @var rusage::ru_msgsnd
   1.199 +messages sent
   1.200 +*/
   1.201 +
   1.202 +/** @var rusage::ru_msgrcv
   1.203 + messages received 
   1.204 +*/
   1.205 +
   1.206 +/** @var rusage::ru_nsignals
   1.207 +signals received
   1.208 +*/
   1.209 +
   1.210 +/** @var rusage::ru_nvcsw
   1.211 +voluntary context switches
   1.212 +*/
   1.213 +
   1.214 +/** @var rusage::ru_nivcsw
   1.215 +involuntary
   1.216 +*/
   1.217 +
   1.218 +
   1.219 +/** @typedef typedef	__rlim_t	rlim_t
   1.220 +
   1.221 +Unsigned integer type used for limit values.
   1.222 +
   1.223 +@publishedAll
   1.224 +@externallyDefinedApi
   1.225 +*/
   1.226 +
   1.227 +
   1.228 +/** @def RLIM_INFINITY
   1.229 +
   1.230 +unsigned long int
   1.231 +
   1.232 +@publishedAll
   1.233 +@externallyDefinedApi
   1.234 +*/
   1.235 +
   1.236 +/** @def RLIMIT_CORE
   1.237 +
   1.238 +core file size 
   1.239 +
   1.240 +@publishedAll
   1.241 +@externallyDefinedApi
   1.242 +*/
   1.243 +
   1.244 +/** @def RLIMIT_CPU
   1.245 +
   1.246 +cpu time in milliseconds
   1.247 +
   1.248 +@publishedAll
   1.249 +@externallyDefinedApi
   1.250 +*/
   1.251 +
   1.252 +/** @def RLIMIT_DATA
   1.253 +
   1.254 +data size
   1.255 +
   1.256 +@publishedAll
   1.257 +@externallyDefinedApi
   1.258 +*/
   1.259 +
   1.260 +/** @def RLIMIT_FSIZE
   1.261 +
   1.262 +maximum file size
   1.263 +
   1.264 +@publishedAll
   1.265 +@externallyDefinedApi
   1.266 +*/
   1.267 +
   1.268 +
   1.269 +/** @def RLIMIT_NOFILE
   1.270 +
   1.271 +number of open files
   1.272 +
   1.273 +@publishedAll
   1.274 +@externallyDefinedApi
   1.275 +*/
   1.276 +
   1.277 +/** @def RLIMIT_STACK
   1.278 +
   1.279 +stack size
   1.280 +
   1.281 +@publishedAll
   1.282 +@externallyDefinedApi
   1.283 +*/
   1.284 +
   1.285 +/** @def RLIMIT_AS
   1.286 +
   1.287 +standard name for RLIMIT_VMEM
   1.288 +
   1.289 +@publishedAll
   1.290 +@externallyDefinedApi
   1.291 +*/
   1.292 +
   1.293 +/** @def RUSAGE_SELF
   1.294 +
   1.295 +Resource utilization information.
   1.296 +
   1.297 +@publishedAll
   1.298 +@externallyDefinedApi
   1.299 +*/
   1.300 +
   1.301 +/** @def RUSAGE_CHILDREN
   1.302 +
   1.303 +Resource utilization information.
   1.304 +
   1.305 +@publishedAll
   1.306 +@externallyDefinedApi
   1.307 +*/
   1.308 +
   1.309 +
   1.310 +/** @def PRIO_PROCESS
   1.311 +
   1.312 +Process priority specifications to get or set priority.
   1.313 +
   1.314 +@publishedAll
   1.315 +@externallyDefinedApi
   1.316 +*/
   1.317 +
   1.318 +/** @def PRIO_PGRP
   1.319 +
   1.320 +Process priority specifications to get or set priority.
   1.321 +
   1.322 +@publishedAll
   1.323 +@externallyDefinedApi
   1.324 +*/
   1.325 +
   1.326 +/** @def PRIO_USER
   1.327 +
   1.328 +Process priority specifications to get or set priority.
   1.329 +
   1.330 +@publishedAll
   1.331 +@externallyDefinedApi
   1.332 +*/
   1.333 +
   1.334 +
   1.335 +
   1.336 +
   1.337 +
   1.338 +
   1.339 +
   1.340 +
   1.341 +