[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9329.0. "problem with priocntl()" by HYDRA::KENYON (The Foundation of Science...Fiction) Fri Mar 28 1997 15:55

    A SW partner has snet us a question in an area we don't have experience
    in supporting, so I am hoping for some help regarding the following
    issue with the priocntl() call.
    
    I have already asked him for the OS rev, and whether he has the SYSV
    environment installed which is not clear from the attached note.
    
    Thanks,
    
    Jeff Kenyon
    
I'm trying to use priocntl to change my process's scheduling class to
real-time. I run the program under root but receive errno 35 (EAGAIN) when
priocntl is called with the PC_GETCID command.  In this call, I am trying to
obtain the class ID for the "RT" (real-time) scheduling class.  Once I have
the class ID, I can then re-issue the system call with the PC_SETPARMS
command to change the scheduler class.  Here's an extract of all applicable
source code from my program:

#include <sys/priocntl.h>
#include <sys/rtpriocntl.h>

pcinfo_t sinfo;
pcparms_t sparms;
rtinfo_t *rtinfo;
rtparms_t *rtparms;

strcpy (sinfo.pc_clname, "RT");
rc = priocntl (0, 0, PC_GETCID, (caddr_t) &sinfo);
if (rc != 0)
{
  fprintf(stderr, "ERROR: PD: System call priocntl returned: = %d\n", errno);
}

The EAGAIN errno is described as follows by the priocntl man page and makes
it sound as if something isn't configured in the kernel:
   
[EAGAIN]  An attempt to change the class of a process failed because of
          insufficient resources other than memory (for example, class-
          specific kernel data structures).

By replacing the fourth argument with a null pointer, the priocntl system
call returns a 5 indicating there are 5 scheduling classes defined (right?).
I've talked with our system administration staff and they have verified that
real-time preemption has been enabled in the kernel.  Is there something
we're missing?  Any help you could provide would be greatly appreciated. 
T.RTitleUserPersonal
Name
DateLines
9329.1SMURF::DENHAMDigital UNIX KernelFri Mar 28 1997 17:1910
    Jeff,
    
    priocntl has got to be the most horrendously arcane api ever, ever
    invented. It worse even than the system V semaphore and message
    apis.
    
    That said, I'll try out the test program and figure out what's
    up. You might consider filing a problem report for tracking this,
    but you can certainly wait till I confirm this isn't user
    error and not my error....
9329.2thanksHYDRA::KENYONThe Foundation of Science...FictionFri Apr 04 1997 11:215
    Thanks -- any status as of today?
    
    thanks,
    
    -jeff
9329.3SMURF::DENHAMDigital UNIX KernelFri Apr 04 1997 14:002
    It's still in the to-do list but moving up. Hasn't been a good week or so
    for this sort of investigation...
9329.4SMURF::DENHAMDigital UNIX KernelMon Apr 07 1997 12:1053
    OK, tried it. Cut the bits out of the base note, added a few missing
    variables, and ran the problem. No problem, as root or as a 
    regular user.
    
    I get back 5 as a return value (number of classes), and sifno.pc_clname
    comes back as "RT". 
    
    Does they customer have all these defs in his config file?
    
    #
    # Standard options.
    #
    options         UNIX_LOCKS
    options         SER_COMPAT
    options         RT_PREEMPT
    options         RT_SCHED
    options         RT_SCHED_RQ
    options         RT_PML
    options         RT_TIMER
    options         RT_SEM
    options         RT_CSEM
    options         RT_IPC
    
    The one that really matters for priocntl, is RT_SCHED_RQ. If it's
    not defined, I believe you'll get back EINVAL, no EAGAIN.
    
    If fact, I can't find anywhere in the GETCID code path where
    EAGAIN can be returned. Have they confirmed that this
    code fragment alone fails on there test system?
    
    #include <stdio.h>
    #include <sys/errno.h>
    #include <sys/priocntl.h>
    #include <sys/rtpriocntl.h>
    
    main()
    {
            int rc;
            pcinfo_t sinfo;
            pcparms_t sparms;
            rtinfo_t *rtinfo;
            rtparms_t *rtparms;
    
            strcpy (sinfo.pc_clname, "RT");
            rc = priocntl (0, 0, PC_GETCID, (caddr_t) &sinfo);
            if (rc != 0) {
                    fprintf(stderr, "ERROR: PD: System call"
                            " priocntl returned: = %d, errno %d\n", rc,
    				errno);
            }
            printf("Class name: %s\n", sinfo.pc_clname);
    }