E xx: xxxx:xx ERR thread 0x536753929472 setscheduler failed Operation not permitted

通过sched_setscheduler设置线程优先级时,发生了“setscheduler failed Operation not permitted”错误。

int ret = sched_setscheduler(pthread_gettid_np((pthread_t)pHandle), SCHED_RR, &prio);

解决方法
在进程启动参数中追加下记内容:

capabilities SYS_NICE

init.target.rc

service xxxxxx /system/vendor/bin/xxxxxx
    class core
    user system
    group camera input graphics
    disabled
    onrestart restart evs_driver
    onrestart restart qcarcam_hal
    capabilities SYS_NICE

你可能感兴趣的:(linux编程,Android,linux,android)