Fix sched_setscheduler undefined on kernel 5.9
sched_setscheduler is no more exported:
https://lkml.org/lkml/2020/4/22/1071
This commit is contained in:
parent
7fd991bec7
commit
2600c89390
|
|
@ -1447,6 +1447,20 @@ void ec_master_nanosleep(const unsigned long nsecs)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* compatibility for priority changes */
|
||||
static inline void set_normal_priority(struct task_struct *p, int nice)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
|
||||
sched_set_normal(p, nice);
|
||||
#else
|
||||
struct sched_param param = { .sched_priority = 0 };
|
||||
sched_setscheduler(p, SCHED_NORMAL, ¶m);
|
||||
set_user_nice(p, nice);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Execute slave FSMs.
|
||||
*/
|
||||
void ec_master_exec_slave_fsms(
|
||||
|
|
@ -1666,8 +1680,6 @@ static int ec_master_operation_thread(void *priv_data)
|
|||
*/
|
||||
void ec_master_eoe_start(ec_master_t *master /**< EtherCAT master */)
|
||||
{
|
||||
struct sched_param param = { .sched_priority = 0 };
|
||||
|
||||
if (master->eoe_thread) {
|
||||
EC_MASTER_WARN(master, "EoE already running!\n");
|
||||
return;
|
||||
|
|
@ -1693,8 +1705,7 @@ void ec_master_eoe_start(ec_master_t *master /**< EtherCAT master */)
|
|||
return;
|
||||
}
|
||||
|
||||
sched_setscheduler(master->eoe_thread, SCHED_NORMAL, ¶m);
|
||||
set_user_nice(master->eoe_thread, 0);
|
||||
set_normal_priority(master->eoe_thread, 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Reference in New Issue