OSDN Git Service

(split) Apply minor changes from v3.32 to v3.35 in the upstream.
[linuxjm/LDP_man-pages.git] / draft / man3 / usleep.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified 2001-04-01 by aeb
29 .\" Modified 2003-07-23 by aeb
30 .\"
31 .\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
32 .\"       all rights reserved.
33 .\" Translated Mon Jan 20 18:47:50 JST 1997
34 .\"       by YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
35 .\" Updated Sat May 19 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
36 .\" Updated Mon Sep  1 JST 2003 by Kentaro Shirakata <argrath@ub32.org>
37 .\" Updated 2007-05-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.44
38 .\"
39 .TH USLEEP 3  2010-12-03 "" "Linux Programmer's Manual"
40 .\"O .SH NAME
41 .SH Ì¾Á°
42 .\"O usleep \- suspend execution for interval of microseconds
43 usleep \- ¥Þ¥¤¥¯¥íÉÃñ°Ì¤Ç¼Â¹Ô¤ò±ä´ü¤¹¤ë
44 .\"O .SH SYNOPSIS
45 .SH ½ñ¼°
46 .nf
47 .B "#include <unistd.h>"
48 .sp
49 .BI "int usleep(useconds_t " usec );
50 .fi
51 .sp
52 .in -4n
53 .\"O Feature Test Macro Requirements for glibc (see
54 .\"O .BR feature_test_macros (7)):
55 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
56 .RB ( feature_test_macros (7)
57 »²¾È):
58 .in
59 .sp
60 .BR usleep ():
61 .ad l
62 .RS 4
63 .PD 0
64 .TP 4
65 .\"O Since glibc 2.12:
66 glibc 2.12 °Ê¹ß:
67 .nf
68 _BSD_SOURCE ||
69     (_XOPEN_SOURCE\ >=\ 500 ||
70         _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
71     !(_POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700)
72 .TP 4
73 .fi
74 .\"O Before glibc 2.12:
75 glibc 2.12 ¤è¤êÁ°:
76 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
77 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
78 .PD
79 .RE
80 .ad b
81 .\"O .SH DESCRIPTION
82 .SH ÀâÌÀ
83 .\"O  The
84 .\"O .BR usleep ()
85 .\"O function suspends execution of the calling thread for
86 .\"O (at least) \fIusec\fP microseconds.
87 .\"O The sleep may be lengthened slightly
88 .\"O by any system activity or by the time spent processing the call or by the
89 .\"O granularity of system timers.
90 .BR usleep ()
91 ´Ø¿ô¤Ï
92 (¾¯¤Ê¤¯¤È¤â) \fIusec\fP¥Þ¥¤¥¯¥íÉäδ֡¢
93 ¸Æ¤Ó½Ð¤·¸µ¥¹¥ì¥Ã¥É¤Î¼Â¹Ô¤ò±ä´ü¤¹¤ë¡£
94 ¥·¥¹¥Æ¥à¤ÎÆ°ºî¾õ¶·¤ä¸Æ¤Ó½Ð¤·¤Ë¤è¤ë»þ´Ö¤Î¾ÃÈñ¤ä¥·¥¹¥Æ¥à¥¿¥¤¥Þ¤ÎγÅ٤ˤè¤Ã¤Æ¡¢
95 Ää»ß»þ´Ö¤ÏÀßÄꤷ¤¿Ãͤè¤ê¤â¾¯¤·±ä¤Ð¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
96 .\"O .SH "RETURN VALUE"
97 .SH ÊÖ¤êÃÍ
98 .\"O 0 on success, \-1 on error.
99 À®¸ù¤¹¤ë¤È 0¡¢¥¨¥é¡¼¤Î¾ì¹ç \-1 ¤òÊÖ¤¹¡£
100 .\"O .SH ERRORS
101 .SH ¥¨¥é¡¼
102 .TP
103 .B EINTR
104 .\"O Interrupted by a signal; see
105 .\"O .BR signal (7).
106 ¥·¥°¥Ê¥ë¤Ë¤è¤Ã¤ÆÃæÃǤµ¤ì¤¿¡£
107 .BR signal (7)
108 »²¾È¡£
109 .TP
110 .B EINVAL
111 .\"O \fIusec\fP is not smaller than 1000000.
112 .\"O (On systems where that is considered an error.)
113 \fIusec\fP ¤¬ 1000000 °Ê¾å¤À¤Ã¤¿¡£
114 (¤³¤ì¤ò¥¨¥é¡¼¤È¤ß¤Ê¤¹¥·¥¹¥Æ¥à¤Î¤ß)
115 .\"O .SH "CONFORMING TO"
116 .SH ½àµò
117 4.3BSD, POSIX.1-2001.
118 .\"O POSIX.1-2001 declares this function obsolete; use
119 .\"O .BR nanosleep (2)
120 .\"O instead.
121 POSIX.1-2001 ¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤Ï²áµî¤Î¤â¤Î¤ÈÀë¸À¤µ¤ì¤Æ¤¤¤ë¡£
122 Âå¤ï¤ê¤Ë
123 .BR nanosleep (2)
124 ¤ò»È¤¦¤³¤È¡£
125 .\"O POSIX.1-2008 removes the specification of
126 .\"O .BR usleep ().
127 POSIX.1-2008 ¤Ç¤Ï¡¢
128 .BR usleep ()
129 ¤Îµ¬Ä꤬ºï½ü¤µ¤ì¤Æ¤¤¤ë¡£
130
131 .\"O On the original BSD implementation,
132 .\"O and in glibc before version 2.2.2, the return type of this function is
133 .\"O .IR void .
134 .\"O The POSIX version returns
135 .\"O .IR int ,
136 .\"O and this is also the prototype used since glibc 2.2.2.
137 ¤â¤È¤â¤È¤Î BSD ¤Î¼ÂÁõ¤ä¡¢¥Ð¡¼¥¸¥ç¥ó 2.2.2 ¤è¤êÁ°¤Î glibc ¤Ç¤Ï¡¢
138 ¤³¤Î´Ø¿ô¤ÎÊÖ¤êÃͤη¿¤Ï
139 .I void
140 ¤Ç¤¢¤ë¡£
141 POSIX ÈǤÏ
142 .I int
143 ¤òÊÖ¤·¡¢¤³¤Î¥×¥í¥È¥¿¥¤¥×¤Ï glibc 2.2.2 °Ê¹ß¤Ç»ÈÍѤµ¤ì¤Æ¤¤¤ë¡£
144
145 .\"O Only the
146 .\"O .B EINVAL
147 .\"O error return is documented by SUSv2 and POSIX.1-2001.
148 ¥¨¥é¡¼¤È¤·¤Æ
149 .B EINVAL
150 ¤òÊÖ¤¹¤È¤¤¤¦¤Î¤Ï
151 SUSv2 ¤È POSIX.1-2001 ¤Ç¤Î¤ßʸ½ñ²½¤µ¤ì¤Æ¤¤¤ë¡£
152 .\"O .SH NOTES
153 .SH Ãí°Õ
154 .\"O The type
155 .\"O .I useconds_t
156 .\"O is an unsigned integer type capable of holding integers
157 .\"O in the range [0,1000000].
158 .\"O Programs will be more portable
159 .\"O if they never mention this type explicitly.
160 .\"O Use
161 .I useconds_t
162 ·¿¤Ï [0,1000000] ¤ÎÈϰϤÎÀ°¿ô¤ò°·¤¦¤³¤È¤¬¤Ç¤­¤ë
163 Éä¹æ¤Ê¤·À°¿ô·¿¤Ç¤¢¤ë¡£
164 ÌÀ¼¨Åª¤Ë¤³¤Î·¿¤ò»È¤ï¤Ê¤¤¤³¤È¤Ç¥×¥í¥°¥é¥à¤Î°Ü¿¢À­¤¬¤è¤ê¹â¤Þ¤ë¡£
165 °Ê²¼¤Î¤è¤¦¤Ë»È¤¦¤³¤È¡£
166 .in +4n
167 .nf
168 .sp
169 #include <unistd.h>
170 \&...
171     unsigned int usecs;
172 \&...
173     usleep(usecs);
174 .fi
175 .in
176 .LP
177 .\"O The interaction of this function with the
178 .\"O .B SIGALRM
179 .\"O signal, and with other timer functions such as
180 .\"O .BR alarm (2),
181 .\"O .BR sleep (3),
182 .\"O .BR nanosleep (2),
183 .\"O .BR setitimer (2),
184 .\"O .BR timer_create (2),
185 .\"O .BR timer_delete (2),
186 .\"O .BR timer_getoverrun (2),
187 .\"O .BR timer_gettime (2),
188 .\"O .BR timer_settime (2),
189 .\"O .BR ualarm (3)
190 .\"O is unspecified.
191 ¤³¤Î´Ø¿ô¤È¡¢
192 .B SIGALRM
193 ¥·¥°¥Ê¥ë¤¢¤ë¤¤¤Ï
194 .BR alarm (2),
195 .BR sleep (3),
196 .BR nanosleep (2),
197 .BR setitimer (2),
198 .BR timer_create (2),
199 .BR timer_delete (2),
200 .BR timer_getoverrun (2),
201 .BR timer_gettime (2),
202 .BR timer_settime (2),
203 .BR ualarm (3)
204 ¤È¤¤¤Ã¤¿¤½¤Î¾¤Î¥¿¥¤¥Þ¡¼´Ø¿ô¤òƱ»þ¤Ë»È¤Ã¤¿¾ì¹ç¤ÎÆ°ºî¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£
205 .\"O .SH "SEE ALSO"
206 .SH ´ØÏ¢¹àÌÜ
207 .BR alarm (2),
208 .BR getitimer (2),
209 .BR nanosleep (2),
210 .BR select (2),
211 .BR setitimer (2),
212 .BR sleep (3),
213 .BR ualarm (3),
214 .BR time (7)