OSDN Git Service

75fecf037b3150f1ddba2f4f22ebe75bbfe89f40
[linuxjm/LDP_man-pages.git] / release / man2 / clock_nanosleep.2
1 .\" Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk
2 .\" <mtk.manpages@gmail.com>
3 .\"
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\"
24 .\" Japanese Version Copyright (c) 2008  Akihiro MOTOKI
25 .\"         all rights reserved.
26 .\" Translated 2008-08-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.04
27 .\" 
28 .TH CLOCK_NANOSLEEP 2 2010-09-10 "Linux" "Linux Programmer's Manual"
29 .SH Ì¾Á°
30 clock_nanosleep \- »ØÄꤷ¤¿¥¯¥í¥Ã¥¯¤Ç¤Î¹âÀºÅ٤ʼ¹ÔÄä»ß (sleep)
31 .SH ½ñ¼°
32 .B #include <time.h>
33 .nf
34 .sp
35 .BI "int clock_nanosleep(clockid_t " clock_id ", int " flags ,
36 .BI "                    const struct timespec *" request ,
37 .BI "                    struct timespec *" remain );
38 .fi
39 .sp
40 \fI\-lrt\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
41 .sp
42 .ad l
43 .in -4n
44 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
45 .RB ( feature_test_macros (7)
46 »²¾È):
47 .in
48 .sp
49 .BR clock_nanosleep ():
50 .RS 4
51 _XOPEN_SOURCE\ >=\ 600 || _POSIX_C_SOURCE\ >=\ 200112L
52 .RE
53 .ad
54 .SH ÀâÌÀ
55 .BR clock_nanosleep ()
56 ¤ò»È¤¦¤È¡¢
57 .BR nanosleep (2)
58 ƱÍÍ¡¢¥Ê¥ÎÉäÎÀºÅ٤ǻØÄꤵ¤ì¤¿´ü´Ö¤À¤±¸Æ¤Ó½Ð¤·¤¿¥¹¥ì¥Ã¥É¤Î¼Â¹Ô¤ò
59 Ää»ß¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
60 .BR nanosleep (2)
61 ¤È°ã¤¦¤Î¤Ï¡¢¸Æ¤Ó½Ð¤·Â¦¤¬Ää»ß´ü´Ö¤ò¤É¤Î¥¯¥í¥Ã¥¯¤ËÂФ·¤Æ·×¬¤¹¤ë¤Î¤«¤òÁªÂò
62 ¤Ç¤­¤ëÅÀ¤È¡¢Ää»ß´ü´Ö¤òÀäÂÐÃͤǤâÁêÂÐÃͤǤâ»ØÄê¤Ç¤­¤ëÅÀ¤Ç¤¢¤ë¡£
63
64 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ËÅϤ·¤¿¤ê¡¢¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬ÊÖ¤·¤¿¤ê¤¹¤ë»þ´Ö¤ÎÃͤÏ
65 .I timespec
66 ¹½Â¤ÂΤò»È¤Ã¤Æ»ØÄꤵ¤ì¤ë¡£¤³¤Î¹½Â¤ÂΤÎÄêµÁ¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë¡£
67 .sp
68 .in +4n
69 .nf
70 struct timespec {
71     time_t tv_sec;        /* seconds */
72     long   tv_nsec;       /* nanoseconds [0 .. 999999999] */
73 };
74 .fi
75 .in
76
77 .I clock_id
78 °ú¤­¿ô¤Ç¡¢Ää»ß´ü´Ö¤ò¤É¤Î¥¯¥í¥Ã¥¯¤ËÂФ·¤Æ·×¬¤¹¤ë¤«¤ò»ØÄꤹ¤ë¡£
79 ¤³¤Î°ú¤­¿ô¤Ë¤Ï°Ê²¼¤ÎÃͤΤ¤¤º¤ì¤«°ì¤Ä¤ò»ØÄê¤Ç¤­¤ë¡£
80 .TP 17
81 .BR CLOCK_REALTIME
82 ¥·¥¹¥Æ¥àÁ´ÂΤǻȤï¤ì¤ë¼Â»þ´Ö¥¯¥í¥Ã¥¯¡£
83 ¤³¤Î¥¯¥í¥Ã¥¯¤ÏÊѹ¹²Äǽ¤Ç¤¢¤ë¡£
84 .TP
85 .BR CLOCK_MONOTONIC
86 ²áµî¤Î¤¢¤ë»þÅÀ¤«¤é¤Î»þ´Ö¤ò·×¬¤¹¤ë¡¢Ã±Ä´Áý²Ã¤Î¥¯¥í¥Ã¥¯¡£
87 µ¯ÅÀ¤È¤Ê¤ë»þÅÀ¤Ï¥·¥¹¥Æ¥àµ¯Æ°¸å¤Ë¤ÏÊѹ¹¤µ¤ì¤Ê¤¤¡£
88 ¤³¤Î¥¯¥í¥Ã¥¯¤ÏÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£
89 .\" Linux ¤Ç¤Ï¡¢¤³¤Î¥¯¥í¥Ã¥¯¤Ïµ¯Æ°¤«¤é¤Î»þ´Ö¤ò·×¬¤¹¤ë¡£
90 .TP
91 .BR CLOCK_PROCESS_CPUTIME_ID
92 ¤½¤Î¥×¥í¥»¥¹¤ÎÁ´¥¹¥ì¥Ã¥É¤Ç¾ÃÈñ¤µ¤ì¤ë CPU »þ´Ö¤ò·×¬¤¹¤ë¥×¥í¥»¥¹Ã±°Ì¤Î
93 ¥¯¥í¥Ã¥¯¡£¤³¤Î¥¯¥í¥Ã¥¯¤ÏÀßÄê²Äǽ¤Ç¤¢¤ë¡£
94 .\" There is some trickery between glibc and the kernel
95 .\" to deal with the CLOCK_PROCESS_CPUTIME_ID case.
96 .PP
97 ¤³¤ì¤é¤Î¥¯¥í¥Ã¥¯¤Î¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï
98 .BR clock_getres (2)
99 ¤ò»²¾È¡£
100
101 .I flags
102 ¤¬ 0 ¤Î¾ì¹ç¡¢
103 .I request
104 ¤Ë»ØÄꤵ¤ì¤¿ÃͤÏ
105 .I clock_id
106 ¤Ç»ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯¤Î¸½ºß¤ÎÃͤ«¤é¤ÎÁêÂÐŪ¤Ê´ü´Ö¤È²ò¼á¤µ¤ì¤ë¡£
107
108 .I flags
109 ¤¬
110 .B TIMER_ABSTIME
111 ¤Î¾ì¹ç¡¢
112 .I request
113 ¤Ï»ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯¤Ç·×¬¤µ¤ì¤ëÀäÂлþ¹ï¤È²ò¼á¤µ¤ì¤ë¡£
114 .I request
115 ¤¬»ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯¤Î¸½ºß¤ÎÃͰʲ¼¤Î¾ì¹ç¡¢
116 .BR clock_nanosleep ()
117 ¤Ï¡¢¸Æ¤Ó½Ð¤·¤¿¥¹¥ì¥Ã¥É¤ÎÄä»ß¤ò¹Ô¤ï¤º¡¢¤¹¤°¤ËÊ֤롣
118
119 .BR clock_nanosleep ()
120 ¤Ï¡¢¾¯¤Ê¤¯¤È¤â
121 .I request
122 ¤Ç»ØÄꤵ¤ì¤¿»þ´Ö¤¬·Ð²á¤¹¤ë¤Þ¤Ç¡¢¸Æ¤Ó½Ð¤·¤¿¥¹¥ì¥Ã¥É¤Î¼Â¹Ô¤òÄä»ß¤¹¤ë¡£
123 ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿¤ê¡¢¤½¤Î¥×¥í¥»¥¹¤ò½ªÎ»¤µ¤»¤ë¤è¤¦¤Ê
124 ¥·¥°¥Ê¥ë¤¬ÇÛÁ÷¤µ¤ì¤¿¤ê¤·¤¿¾ì¹ç¤Ë¤â¡¢¥¹¥ì¥Ã¥É¤Î¼Â¹ÔÄä»ß¤Ï½ªÎ»¤¹¤ë¡£
125
126 ¸Æ¤Ó½Ð¤·¤¬¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤Ã¤Æ³ä¤ê¹þ¤Þ¤ì¤¿¾ì¹ç¡¢
127 .BR clock_nanosleep ()
128 ¤Ï¥¨¥é¡¼
129 .B EINTR
130 ¤Ç¼ºÇÔ¤¹¤ë¡£¤µ¤é¤Ë¡¢
131 .I remain
132 ¤¬ NULL ¤Ç¤Ê¤¯¡¢¤«¤Ä
133 .I flags
134 ¤¬
135 .B TIMER_ABSTIME
136 ¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢
137 .I remain
138 ¤Ë»Ä¤ê¤ÎÄä»ß»þ´Ö¤¬ÊÖ¤µ¤ì¤ë¡£
139 ¤³¤ÎÃͤò»È¤Ã¤Æ
140 .BR clock_nanosleep ()
141 ¤òºÆÅٸƤӽФ¹¤³¤È¤Ç¡¢(ÁêÂÐŪ¤Ê´ü´Ö¤Î) Ää»ß¤ò´°Î»¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
142 .SH ÊÖ¤êÃÍ
143 Í׵ᤵ¤ì¤¿´ü´Ö¤ÎÄä»ß¤ËÀ®¸ù¤¹¤ë¤È¡¢
144 .BR clock_nanosleep ()
145 ¤Ï 0 ¤òÊÖ¤¹¡£
146 ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ç³ä¤ê¹þ¤Þ¤ì¤¿¤ê¡¢¥¨¥é¡¼¤¬È¯À¸¤·¤¿¤ê¤·¤¿¾ì¹ç¡¢
147 ¡Ö¥¨¥é¡¼¡×¤ÎÀá¤Î¥ê¥¹¥È¤Ë¤¢¤ëÀµ¤Î¥¨¥é¡¼ÈÖ¹æ¤Î¤¤¤º¤ì¤«°ì¤Ä¤òÊÖ¤¹¡£
148 .SH ¥¨¥é¡¼
149 .TP
150 .B EFAULT
151 .I request
152 ¤ä
153 .I remain
154 ¤Ë̵¸ú¤Ê¥¢¥É¥ì¥¹¤¬»ØÄꤵ¤ì¤¿¡£
155 .TP
156 .B EINTR
157 Ää»ß¤¬¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤ê³ä¤ê¹þ¤Þ¤ì¤¿¡£
158 .TP
159 .B EINVAL
160 .I tv_nsec
161 ¥Õ¥£¡¼¥ë¥É¤ÎÃͤ¬ 0 ¤«¤é 999999999 ¤ÎÈϰϤǤʤ¤¤«¡¢
162 .I tv_sec
163 ¤ÎÃͤ¬Éé¤Ç¤¢¤Ã¤¿¡£
164 .TP
165 .B EINVAL
166 .I clock_id
167 ¤¬Ìµ¸ú¤Ç¤¢¤Ã¤¿
168 .RB ( CLOCK_THREAD_CPUTIME_ID
169 ¤¬
170 .I clock_id
171 ¤È¤·¤ÆÍ­¸ú¤ÊÃͤǤϤʤ¤)¡£
172 .SH ¥Ð¡¼¥¸¥ç¥ó
173 .BR clock_nanosleep ()
174 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux 2.6 ¤Ç½é¤á¤ÆÅо줷¤¿¡£
175 glibc ¤Ç¤Ï¥Ð¡¼¥¸¥ç¥ó 2.1 °Ê¹ß¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
176 .SH ½àµò
177 POSIX.1-2001.
178 .SH Ãí°Õ
179 .I request
180 ¤Ç»ØÄꤵ¤ì¤¿Ää»ß´ü´Ö¤¬¡¢»þ´Ö¤Î·×¬¤Ë»ÈÍѤµ¤ì¤ë¥¯¥í¥Ã¥¯
181 .RB ( time (7)
182 »²¾È) ¤ÎÀºÅÙ¤ÎÇÜ¿ô¤Á¤ç¤¦¤É¤Ç¤Ê¤¤¾ì¹ç¡¢Ää»ß´ü´Ö¤Ï°ìÈֶᤤ¼¡¤ÎÇÜ¿ô¤Ë
183 ÀÚ¤ê¾å¤²¤é¤ì¤ë¡£¤µ¤é¤Ë¡¢Ää»ß¤¬´°Î»¤·¤¿¸å¤Ë¡¢CPU ¤¬¸Æ¤Ó½Ð¤·¤¿¥¹¥ì¥Ã¥É¤ò
184 ¤â¤¦°ìÅټ¹ԤǤ­¤ë¤è¤¦¤Ë¤Ê¤ë¤Þ¤Ç¤Ë¤Ï¡¢Ãٱ䤬Æþ¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
185
186 ÀäÂÐÃÍ»ØÄê¤Î¥¿¥¤¥Þ¤ò»È¤¦¤Î¤Ï¡¢
187 .BR nanosleep (2)
188 ¤Ë½ñ¤«¤ì¤Æ¤¤¤ëÎà¤Î¥¿¥¤¥Þ¤Î¤º¤ì¤ÎÌäÂê¤òËɻߤ¹¤ë¤Î¤ËÌòΩ¤Ä
189 (¤³¤Î¼ï¤ÎÌäÂê¤Ï¡¢¥·¥°¥Ê¥ë¤Ë³ä¤ê¹þ¤Þ¤ì¤¿ºÝ¤ËÁêÂлØÄê¤ÎÄä»ß¤ò
190 ·«¤êÊÖ¤·ºÆ³«¤·¤è¤¦¤È¤¹¤ë¥×¥í¥°¥é¥à¤Ç¤Ï¡¢¤«¤¨¤Ã¤Æ°­²½¤¹¤ë)¡£
191 ¤³¤ì¤é¤ÎÌäÂê¤ò²óÈò¤·¤ÆÁêÂлØÄê¤ÎÄä»ß¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢
192 ´õ˾¤¹¤ë¥¯¥í¥Ã¥¯¤Ç
193 .BR clock_gettime (2)
194 ¤ò¸Æ¤Ó½Ð¤·¡¢¤½¤ÎÊÖ¤êÃͤλþ¹ïÃͤ˴õ˾¤¹¤ë´ü´Ö¤ò²Ã»»¤·¤Æ¤«¤é¡¢
195 .B TIMER_ABSTIME
196 ¥Õ¥é¥°¤ò»ØÄꤷ¤Æ
197 .BR clock_nanosleep ()
198 ¤ò¸Æ¤Ó½Ð¤¹¡£
199
200 .BR sigaction (2)
201 ¤Ç
202 .BR SA_RESTART
203 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤«¤Ë´Ø¤ï¤é¤º¡¢
204 ¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤ê³ä¤ê¹þ¤Þ¤ì¤¿¸å¤Ë
205 .BR clock_nanosleep ()
206 ¤¬ºÆ³«¤µ¤ì¤ë¤³¤È¤Ï·è¤·¤Æ¤Ê¤¤¡£
207
208 .I flags
209 ¤¬
210 .B TIMER_ABSTIME
211 ¤Î¾ì¹ç¡¢
212 .I remain
213 °ú¤­¿ô¤Ï»ÈÍѤµ¤ì¤º¡¢ÉÔÍפǤ¢¤ë
214 (ÀäÂÐÃͤǤÎÄä»ß¤Ç¤Ï¡¢Æ±¤¸
215 .I request
216 °ú¤­¿ô¤ò»È¤Ã¤ÆºÆÅٸƤӽФ¹¤³¤È¤¬¤Ç¤­¤ë)¡£
217
218 POSIX.1 ¤Îµ¬Äê¤Ç¤Ï¡¢
219 .BR clock_nanosleep ()
220 ¤Ï¥·¥°¥Ê¥ë¤Î½èÍýÊýË¡¤ä¥·¥°¥Ê¥ë¥Þ¥¹¥¯¤Ë±Æ¶Á¤òÍ¿¤¨¤Ê¤¤¡¢¤È¤µ¤ì¤Æ¤¤¤ë¡£
221
222 POSIX.1 ¤Îµ¬Äê¤Ç¤Ï¡¢
223 .BR clock_settime (2)
224 ¤Ç
225 .B CLOCK_REALTIME
226 ¥¯¥í¥Ã¥¯¤ÎÃͤòÊѹ¹¤·¤¿¸å¤Ï¡¢ÀäÂÐÃÍ»ØÄê¤Î
227 .BR clock_nanosleep ()
228 ¤ÇÄä»ß¤·¤Æ¤¤¤ë¥¹¥ì¥Ã¥É¤òµ¯Æ°¤µ¤»¤ë»þ¹ï¤ÎȽÄê¤Ï¡¢
229 ¿·¤·¤¤¥¯¥í¥Ã¥¯Ãͤò»È¤Ã¤Æ¹Ô¤ï¤ì¤ë¡¢¤È¤µ¤ì¤Æ¤¤¤ë¡£
230 ¿·¤·¤¤¥¯¥í¥Ã¥¯Ãͤˤª¤¤¤ÆÄä»ß´ü´Ö¤Î½ªÎ»»þ¹ï¤¬²áµî¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢
231 .BR clock_nanosleep ()
232 ¤Ï¤¹¤°¤ËÊ֤뤳¤È¤Ë¤Ê¤ë¡£
233
234 POSIX.1 ¤Îµ¬Äê¤Ç¤Ï¡¢
235 .BR clock_settime (2)
236 ¤Ç
237 .B CLOCK_REALTIME
238 ¥¯¥í¥Ã¥¯¤ÎÃͤòÊѹ¹¤·¤Æ¤â¡¢ÁêÂÐÃÍ»ØÄê¤Î
239 .BR clock_nanosleep ()
240 ¤ÇÄä»ß¤·¤Æ¤¤¤ë¥¹¥ì¥Ã¥É¤Ë¤Ï±Æ¶Á¤òÍ¿¤¨¤Ê¤¤¡¢¤È¤µ¤ì¤Æ¤¤¤ë¡£
241 .SH ´ØÏ¢¹àÌÜ
242 .BR clock_getres (2),
243 .BR nanosleep (2),
244 .BR timer_create (2),
245 .BR sleep (3),
246 .BR usleep (3),
247 .BR time (7)