1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
.\" man2/sched_setaffinity.2 - sched_setaffinity and sched_getaffinity man page
.\"
.\" Copyright (C) 2002 Robert Love
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
.\" USA.
.\"
.\" 2002-11-19 Robert Love <rml@tech9.net> - initial version
.\" 2004-04-20 mtk - fixed description of return value
.\" 2004-04-22 aeb - added glibc prototype history
.\"
.\" Japanese Version Copyright (c) 2003, 2005 Yuichi SATO
.\" all rights reserved.
.\" Translated Thu Jan 23 02:47:31 JST 2003
.\" by Yuichi SATO <ysato444@yahoo.co.jp>
.\" Updated & Modified Tue Sep 23 19:32:36 JST 2003 by Yuichi SATO
.\" Updated & Modified Mon Jan 3 03:27:58 JST 2005 by Yuichi SATO
.\"
.\"WORD: affinity
.\"WORD: most significant bit Ǿ̥ӥå
.\"WORD: least significant bit Dz̥ӥå
.\"WORD: capability
.\"
.TH SCHED_SETAFFINITY 2 2004-04-22 "Linux" "Linux Programmer's Manual"
.SH ̾
sched_setaffinity, sched_getaffinity \- ץ CPU affinity ޥꡦ
.SH
.B #include <sched.h>
.sp
.BI "int sched_setaffinity(pid_t " pid ", unsigned int " len ,
.BI "unsigned long *" mask );
.sp
.BI "int sched_getaffinity(pid_t " pid ", unsigned int " len ,
.BI "unsigned long *" mask );
.SH
.B sched_setaffinity
.I pid
Ǽץ CPU affinity () ޥꤹ롣
.I pid
0 ξ硢ȥץȤ롣
.sp
affinity ޥ
.I mask
ꤵӥåȥޥɽ롣
Dz̥ӥåȤϥƥκǽץåֹб
Ǿ̥ӥåȤϺǸץåֹб롣
ꤵ줿ӥåȤб CPU ؤΥ塼ϵĤ졢
ꤵʤӥåȤб CPU ؤΥ塼϶ػߤ롣
СץбӥåȤꤵƤ
ץåΤߤ˷դ졢
ΥץåǤΤ¹Ԥ롣
̾
.I mask
ƤΥӥåȤꤵ롣
.sp
.I len
.I mask
ǻؤƤǡĹ (Хñ) Ǥ롣
̾盧ĹϥƥΥĹǤ롣
ĹѹǽΤǡ
Linux ͥȤθߴݤĤˤϡ
ꤵӥåȥޥĹ
ͥ affinity ޥĹʾȤʤФʤʤ
.sp
ؿ
.B sched_getaffinity
Ĺ
.I len
Υݥ
.I mask
˥ץ
.I pid
affinity ޥࡣ
.I pid
0 ξ硢ȥץΥޥ֤롣
.SH ֤
硢
.B sched_setaffinity
0 ֤
顼ξϡ\-1 ֤졢
.I errno
Ŭڤꤵ롣
硢
.B sched_getaffinity
ϥͥˤäƻѤ affinitiy ޥΥ
(Хñ) ֤
顼ξ \-1 ֤졢
.I errno
Ŭڤꤵ롣
.SH 顼
.TP
.B EFAULT
ꤵ줿ϤǤ롣
.TP
.B EINVAL
affinity ӥåȥޥ
.I mask
˥ƥ˼ºݤ¸ߤץåбӥåȤʤ
ޤϥޥĹ
.I len
ͥǻȤƤ affinity ޥû
.TP
.B EPERM
ƤӽФ¦ץŬڤøʤä
.B sched_setaffinity
ƤӽФץϡ¸桼 ID
.I pid
Ǽ̤ץΥ桼 ID ޤϼ¸桼 ID ƱǤ뤫
.IR CAP_SYS_NICE
ѥӥƥ (capability) ʤФʤʤ
.TP
.B ESRCH
ץ ID \fIpid\fR ΥץĤʤä
.SH
affinity ƥॳ Linux kernel 2.5.8 Ƴ줿
Υ饤֥ꥳ glibc 2.3 Ƴ졢glibc 2.3.2 ˤޤ¸ߤ롣
glibc 2.3.2 ȯСǤϡե
.I len
եɤʤȤѹꡢ
ˤʹߤΥСǤϸᤵ줿
glibc ΥץȥפϸߤΤȤʲΤ褦ˤʤäƤ롣
.sp
.nf
/* CPU affinity ꤹ롣*/
extern int sched_setaffinity (pid_t pid, size_t cpusetsize,
const cpu_set_t *cpuset);
.sp
/* CPU affinity 롣*/
extern int sched_getaffinity (pid_t pid, size_t cpusetsize,
cpu_set_t *cpuset);
.fi
.SH Ϣ
.BR getpriority (2),
.BR nice (2),
.BR sched_get_priority_max (2),
.BR sched_get_priority_min (2),
.BR sched_getscheduler (2),
.BR sched_setscheduler (2),
.BR setpriority (2),
.BR capabilities (7)
.PP
.BR sched_setscheduler (2)
Ǥ Linux ˤ륹塼γάҤƤ롣
|