micke wrote:
> Hi, Im having a little problem using the priocntl syscall, I want to use the 
> PC_SETXPARMS and PC_GETXPARMS as commands.
> 
> 
>>From the man page of priocntl I get it as I should use is it like this:
> 
> [b]priocntl(P_PID, 0, PC_SETXPARMS, "RT", RT_KY_PRI, 10);[/b]
> 
> If I want to change the class to real-time and priority to 10 of the calling 
> process, but it returns -1, invalid argument, whats wrong here?

Here is some example code, from opensolaris under a CDDL license, that 
uses priocntl to switch to the FX class, which should give you the 
guidance you need:

pcinfo_t pcinfo;
pri_t maxupri;

if (priocntl(P_PID, P_MYID, PC_GETXPARMS, NULL,
     PC_KY_CLNAME, pc_clname, 0) == -1) {
                 perror("priocntl");
}
if ((strcmp("TS", pc_clname) == 0) ||
     (strcmp("IA", pc_clname) == 0)) {
         cryptodebug("current sched class is TS/IA");
         (void) strcpy(pcinfo.pc_clname, "FX");
         if (priocntl(0, 0, PC_GETCID, (caddr_t)&pcinfo) != -1) {
                 maxupri = ((fxinfo_t *)pcinfo.pc_clinfo)->fx_maxupri;
                 if (priocntl(P_LWPID, P_MYID, PC_SETXPARMS, "FX",
                     FX_KY_UPRILIM, maxupri, FX_KY_UPRI, maxupri,
                     FX_KY_TQNSECS, FX_TQINF, NULL) != 0) {
                         perror("priocntl");
                 }
         } else {
             error(LOG_ERR,
                     "Unable to determine parameters for FX scheduler. "
                     "Using system default scheduler.");
         }
}


-- 
Darren J Moffat
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to