Hi,

I'm trying to turn off the "priority coupling" feature for a specific Xenomai task in our application. (The task in question is a communications thread, and the only time it goes into secondary mode is when it calls read() or write() on a TCP socket. At that time, it will not be holding the RT_MUTEX that protects the data it shares with the other xenomai tasks, so it should not impact the scheduling of the other real time tasks in the system.  But giving Linux a real time priority could starve out other equal- and lower-priority real time tasks in the system.)

Anyway, turning off the CONFIG_XENO_OPT_PRIOCPL kernel option works fine, and seems to do want I want. But there's a note in the config documentation that says I should be able to leave that option On, and just turn off priority coupling for a specific task at runtime.  According to the API docs, it seems I should be able to write:

    int prevMode = 0;
    int err = rt_task_set_mode( 0, T_RPIOFF, &prevMode );


from the context of the xenomai task.  (I've also tried passing 0 instead of &prevMode.)  Either way, it always seems to return -EINVAL (meaning "either setmask or clrmask specifies invalid bits.")

So I have two questions:
1.  Is there a bug here, or am I misreading the docs? How do I turn off priority coupling at runtime?
2.  Is there any reason I would want to leave CONFIG_XENO_OPT_PRIOCPL enabled?

I'm using Xenomai 2.4.10 on x86 with Linux 2.6.28.9 and ipipe 2.6.28.9-x86-2.2-07.  (I've also tested with Linux 2.6.30.8 and ipipe 2.6.30.8-x86-2.4-06, with the same result.)

Thanks for your help,
Josh