|
||
Interface status: | externallyDefinedApi |
PRIO_PROCESS 0
Process priority specifications to get or set priority.
Interface status: | externallyDefinedApi |
PRIO_PGRP 1
Process priority specifications to get or set priority.
Interface status: | externallyDefinedApi |
PRIO_USER 2
Process priority specifications to get or set priority.
Interface status: | externallyDefinedApi |
RUSAGE_CHILDREN -1
Resource utilization information.
Interface status: | externallyDefinedApi |
RLIMIT_AS RLIMIT_VMEM
standard name for RLIMIT_VMEM
Interface status: | externallyDefinedApi |
RLIM_INFINITY ((rlim_t)(((uint64_t)1 << 63) - 1))
unsigned long int
Interface status: | externallyDefinedApi |
typedef __rlim_t rlim_t;
Unsigned integer type used for limit values.
Interface status: | externallyDefinedApi |
IMPORT_C int getpriority(int, int);
The scheduling 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. The which argument 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 identifier for PRIO_PGRP, and a user ID for PRIO_USER ). A zero value of who denotes the current process, process group, or user. The prio argument is a value in the range -20 to 20. The default priority is 0; lower priorities cause more favorable scheduling.
If the prio is greater than the greatest priority supported, it is set to the greatest priority supported. If the prio is lesser than the least priority supported, it is set to the least priority supported.
Examples:
#include<sys/resource.h>
#include<unistd.h>
#include<stdio.h>
int test_getpriority()
{
int retVal;
errno = 0;
retVal = getpriority(PRIO_PROCESS, 0);
if((retVal == -1) && (errno == ENOSYS))
{
printf("Failed");
return -1;
}
else
{
printf("getpriority passed");
printf("
priority = %d ", retVal);
}
return 0;
}
Output
getpriority passed
priority = 0
#include<sys/resource.h>
#include<unistd.h>
#include<stdio.h>
int test_setpriority()
{
int retVal;
errno = 0;
retVal = setpriority(PRIO_PROCESS, 0, 0);
if((retVal == -1) && (errno == ENOSYS))
{
printf("Failed");
return -1;
}
else
{
printf("Setpriority passed");
printf(" getpriority now: %d", getpriority(PRIO_PROCESS,0))
}
return 0;
}
Output
Setpriority passed
getpriority now: 0
Limitations:
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. 2. To effectively increase or decrease the priority of the process, one should consider the following: Highest -16 to -20 Above Normal -6 to -15 Normal +4 to -5 Below Normal +14 to +5 Lowest +20 to +15 3. The setting of the priority to values -16 to -20 is not supported, the use of which sets errno to EINVAL.
|
|
Interface status: | externallyDefinedApi |
IMPORT_C int setpriority(int, int, int);
|
|