'sched_setscheduler always returns EPERM before login

sched_setscheduler always return EPERM(errno 1) before login. but After login, sched_setscheduler returns OK.

The process of calling sched_setscheduler has the following information.

  • uid : 0
  • gid : 0
  • euid : 0
  • all of capability is on

But I don't find out the relation between sched_setscheduler and login.

login means that id/password have been entered to console's login.

login:

password:

The following is how to call sched_setscheduler call

void pthread_entry(void args) {

struct sched_param param = {0};
param.sched_priority = 30;
int ret = sched_setscheduler(0, SCHED_RR, &param);

}

Before login, sched_setcheduler always return EPERM(errno). After login, sched_setcheduler return ok value

sched_setcheduler want to have cap_sys_nice capablity and I've confirmed that cap_sys_nice is on from process.

but I guess that login make cap_sys_nice to be allowed



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source