critical impact:
priocntl, priocntlset - not available (CrUn169)
Problem description
The priocntl and priocntlset routines exist on Tru64 UNIX, but not on HP-UX. These routines are being considered, but are not committed for a future release of HP-UX.
The priocntl routine is used to change the class, priority, and other scheduling properties of one or more active processes.
The priocntlset routine is used to change the scheduling properties of a running process or group of processes. While the priocntl routine performs the same tasks, this function enables you to specify the process or set of processes that will change in a less complicated manner.
Identifiers
 priocntl |
 priocntlset |
|
|
Old behavior
The following example shows how to use the priocntl routine when setting the priority to the maximum:
void set_max_priority (pri)
{
int pid;
int class;
pcinfo_t info;
pcparms_t parms;
rtinfo_t rtinfo;
rtparms_r rtparam;
.
.
.
strcpy(info.pc_clname, "RT");
class = priocntl(P_PID, pid, PC_GETCID, (void *)&info);
.
.
.
bcopy(info.pc_clinfo, &rtinfo, sizeof(rtinfo_t));
.
.
.
rtparam.rt_pri = rtinfo.rt_maxpri - pri;
rtparam,rt_tqsecs = 0;
rtparam.rt_tqnsecs = RT_TQDEF;
parms.pc_cid = info.pc_cid;
bcopy(&rtparam, parms.pc_clparms, sizeof(rtparms_t));
ret = priocntl(P_PID, pid, PC_SETPARMS, (void *)&parms);
.
.
.
}
See also
Solution description
The priocntl and priocntlset routine functionality is similar to the functionality of the sched_[gs]etparam, sched_[gs]etscheduler, and rtprio routines on both HP-UX and Tru64 UNIX.
New behavior
The sched_setscheduler routine is available on both Tru64 UNIX and HP-UX. You can use the sched_setscheduler routine in place of the priocntl routine when setting the priority to the
maximum, as follows:
void set_max_priority (pri)
{
struct sched_param scp;
/*
* Verify that scheduling is available
*/
if (sysconf(_SC_PRIORITY_SCHEDULING) == -1) {
errmsg("WARNING: RR-scheduler not available, disabling.\n");
return(-1);
}
.
.
.
bzero(&scp, sizeof(scp));
scp.sched_priority = sched_get_priority_max(SCHED_RR) - pri;
sched_setscheduler(0, SCHED_RR, &scp);
.
.
.
}
See also
Problem summary
| classifications |
source types |
OS release |
severity |
type |
| SEC |
C, C++ |
any HP-UX 11i version |
critical |
unavailable |
|