sched_setparam() - Unix,Linux系統呼叫 - 技術教學
Tutorials Point


  Unix入門
  Unix Shell程式設計
  高階Unix
  Unix有用參考
  Unix有用資源
  精選閱讀

版權所有 © 2014 tutorialspoint



  首頁     參考     討論論壇     關於TP  

sched_setparam() - Unix,Linux系統呼叫


previous next AddThis Social Bookmark Button

廣告

名稱

sched_setparam, sched_getparam - 設定和獲取排程引數

概要

#include <sched.h> 

int sched_setparam(pid_t pid, const struct sched_param *param);

int sched_getparam(pid_t pid, struct sched_param *param);

struct sched_param { ... int sched_priority; ... };

描述

sched_setparam() 設定與由pid標識的程序的排程策略相關的排程引數。如果pid為零,則設定當前程序的引數。引數param的解釋取決於由pid標識的程序的排程策略。有關Linux支援的排程策略的描述,請參見sched_setscheduler(2)。

sched_getparam() 檢索由pid標識的程序的排程引數。如果pid為零,則檢索當前程序的引數。

sched_setparam() 檢查param對於程序的排程策略的有效性。引數param->sched_priority必須位於sched_get_priority_min(2) 和sched_get_priority_max(2)給定的範圍內。

有關與排程優先順序和策略相關的許可權和資源限制的討論,請參見sched_setscheduler(2)。

sched_setparam() 和sched_getparam() 可用的POSIX系統中,在<unistd.h>中定義了_POSIX_PRIORITY_SCHEDULING

返回值

成功時,sched_setparam() 和sched_getparam() 返回0。發生錯誤時,返回-1,並適當地設定errno

錯誤

標籤描述
EINVAL 引數param對於當前的排程策略沒有意義。
EPERM 呼叫程序沒有適當的許可權(Linux:沒有CAP_SYS_NICE功能)。
ESRCH 找不到ID為pid的程序。

符合標準

POSIX.1-2001。

參見

Bill O. Gallmeister,《面向現實世界的程式設計 - POSIX.4》,O’Reilly & Associates, Inc.,ISBN 1-56592-074-0

previous next Printer Friendly

廣告


  

廣告



廣告
© . All rights reserved.