#include<stdio.h>
#include<sys/resource.h>
#include<errno.h>
#include<string.h>
int main()
{
errno = 0;
int p = getpriority(PRIO_PROCESS, 0);
if(p == -1 && errno != 0)
{
printf("get priortiy fail,error:[%s]\n", strerror(errno));
return;
}
printf("get ok, prio=[%d]\n", p);
}[liudong2@hebe21 test]$ ./tpriority
get ok, prio=[-4]
评论