cpusetSetCPULimits(3x)cpusetSetCPULimits(3x)NAMEcpusetSetCPULimits - set the count limits for a cpuset
SYNOPSIS
#include <cpuset.h>
int cpusetSetCPULimits(cpuset_QueueDef_t *qdef, int advisory,
int mandatory);
DESCRIPTION
The cpusetSetCPULimits function is used to set the advisory and mandatory
CPU counts that will constrain the conditions under which the cpuset will
be created. The advisory and mandatory CPU count limits will be copied
into a memory location referenced by the qdef argument. Consult the
cpusetAllocQueueDef(3x) man page for additional information about the
cpuset_QueueDef_t type.
The advisory limit indicates that if the total number of CPUs is below
that limit, a warning will be set in errno, but the cpuset will be
created. The mandatory limit indicates that if the total number of CPUs
in the cpuset is below that limit, this results in a failure condition
being set in errno, and the cpuset will fail to be created. Both of
these limit conditions are checked at cpuset creation time, and the
warning or error condition will be occur during the call to
cpusetCreate(3x)..
The return value of the function indicates if the function was
successfully executed.
EXAMPLES
This example prints out the advisory and mandatory memory sizes used when
creating the cpuset mpi_set.
char *qname = "mpi_set";
cpuset_QueueDef_t *qdef = NULL;
int cpuadv = 128;
int cpuman = 64;
/* Alloc queue definition structure, for 10 CPUs */
qdef = cpusetAllocQueueDef(128);
/* Set the limits else print error & exit */
if (!cpusetSetCPULimits(qdef, cpuadv, cpuman)) ) {
perror("cpusetSetCPULimits");
exit(1);
}
...... /* Set all the other attributes for cpuset */
if (!cpusetCreate(qdef)) {
perror("cpusetCreate");
exit(1);
}
if (errno == ECPUWARN) {
printf("Memory: %s\n", strerror(errno));
Page 1
cpusetSetCPULimits(3x)cpusetSetCPULimits(3x)
}
NOTEScpusetSetCPULimits is found in the library "libcpuset.so", and will be
loaded if the option -lcpuset is used with cc(1) or ld(1).
SEE ALSOcpuset(1), cpusetAllocQueueDef(3x), cpusetCreate(3x),
cpusetGetCPULimits(3x), cpuset(5).
DIAGNOSTICS
If successful, cpusetSetCPULimits returns 1. If cpusetSetCPULimits
fails, it returns 0 and errno is set to indicate the error.
Page 2