setpriority函数
时间: 2023-12-30 22:03:48 浏览: 34
setpriority函数是一个用于设置进程、进程组和用户的进程执行优先级的函数。它的函数原型为int setpriority(int which, int who, int prio)。其中,which参数有三种可能的取值,who参数的具体含义取决于which的取值。prio参数表示进程的执行优先级,取值范围为-20至20,数值越低代表有较高的优先次序。只有超级用户(root)允许降低此值。函数执行成功时返回0,如果有错误发生则返回-1,错误原因存储在errno中。常见的错误包括参数which或who可能有误而找不到符合的进程(ESRCH)、参数which值错误(EINVAL)、权限不够无法完成设置(EPERM)以及一般用户无法降低优先级(EACCES)。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* *2* [setuid()函数,setgid()函数,getpriority()函数,setpriority()函数,nice()函数](https://blog.csdn.net/whoamiyang/article/details/50884008)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [setpriority](https://blog.csdn.net/Michaelwubo/article/details/41444855)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)