OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / release / man2 / splice.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 2006 Jens Axboe
4 .\" and Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" Japanese Version Copyright (c) 2007  Akihiro MOTOKI
27 .\"         all rights reserved.
28 .\" Translated 2007-02-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
29 .\" Updated 2008-11-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.13
30 .\" 
31 .TH SPLICE 2 2009-09-15 "Linux" "Linux Programmer's Manual"
32 .SH Ì¾Á°
33 splice \- ¥Ñ¥¤¥×¤È¤Î´Ö¤Ç¥Ç¡¼¥¿¤ò·Ñ¤®¹ç¤ï¤»¤ë
34 .SH ½ñ¼°
35 .nf
36 .B #define _GNU_SOURCE
37 .B #include <fcntl.h>
38
39 .BI "ssize_t splice(int " fd_in ", loff_t *" off_in ", int " fd_out ,
40 .BI "               loff_t *" off_out ", size_t " len \
41 ", unsigned int " flags );
42 .fi
43 .\" Return type was long before glibc 2.7
44 .SH ÀâÌÀ
45 .BR splice ()
46 ¤Ï¡¢¥«¡¼¥Í¥ë¥¢¥É¥ì¥¹¶õ´Ö¤È¥æ¡¼¥¶¥¢¥É¥ì¥¹¶õ´Ö¤È¤Î´Ö¤Î¥³¥Ô¡¼¤òȼ¤ï¤º¤Ë¡¢
47 2 ¤Ä¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿´Ö¤Ç¥Ç¡¼¥¿¤Î°ÜÆ°¤ò¹Ô¤¦¡£
48 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
49 .I fd_in
50 ¤«¤é¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
51 .I fd_out
52 ¤ØºÇÂç
53 .I len
54 ¥Ð¥¤¥È¤òžÁ÷¤¹¤ë¡£
55 2 ¤Ä¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¤¦¤Á°ì¤Ä¤Ï
56 ¥Ñ¥¤¥×¤ò»²¾È¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
57 .PP
58 .I fd_in
59 ¤¬¥Ñ¥¤¥×¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¡¢
60 .I off_in
61 ¤Ï NULL ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
62 .I fd_in
63 ¤¬¥Ñ¥¤¥×¤ò»²¾È¤·¤Æ¤ª¤é¤º¡¢
64 .I off_in
65 ¤¬ NULL ¤Î¾ì¹ç¡¢
66 .I fd_in
67 ¤Î¸½ºß¤Î¥Õ¥¡¥¤¥ë¥ª¥Õ¥»¥Ã¥È¤«¤é»Ï¤Þ¤ë¥Ð¥¤¥È¤òÆɤ߽Ф¹¡£
68 ¸½ºß¤Î¥Õ¥¡¥¤¥ë¥ª¥Õ¥»¥Ã¥È¤ÏŬÀÚ¤ËÄ´À°¤µ¤ì¤ë¡£
69 .I fd_in
70 ¤¬¥Ñ¥¤¥×¤ò»²¾È¤·¤Æ¤ª¤é¤º¡¢
71 .I off_in
72 ¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢
73 .I off_in
74 ¤Ï
75 .I fd_in
76 ¤«¤é¤Î¥Ç¡¼¥¿Æɤ߽Ф·¤ò³«»Ï¤¹¤ëÀèƬ¥ª¥Õ¥»¥Ã¥È¤ò³ÊǼ¤·¤¿¥Ð¥Ã¥Õ¥¡
77 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤³¤Î¾ì¹ç¡¢
78 .I fd_in
79 ¤Î¸½ºß¤Î¥Õ¥¡¥¤¥ë¥ª¥Õ¥»¥Ã¥È¤ÏÊѹ¹¤µ¤ì¤Ê¤¤¡£
80 .I fd_out
81 ¤È
82 .I off_out
83 ¤Ë´Ø¤·¤Æ¤âƱÍͤǤ¢¤ë¡£
84 .PP
85 .I flags
86 °ú¤­¿ô¤Ë¤Ï¡¢°Ê²¼¤ÎÃͤΠ0 ¸Ä°Ê¾å¤Î¥Ó¥Ã¥Èñ°Ì¤ÎÏÀÍýϤò
87 ¤È¤Ã¤¿¤â¤Î¤ò»ØÄꤹ¤ë:
88 .TP 1.9i
89 .B SPLICE_F_MOVE
90 ¥Ú¡¼¥¸¤Î¥³¥Ô¡¼¤Ç¤Ê¤¯°ÜÆ°¤ò»î¤ß¤ë¡£
91 ¤³¤ì¤Ï¥«¡¼¥Í¥ë¤ËÂФ¹¤ë¥Ò¥ó¥È¤Ç¤·¤«¤Ê¤¤¡£
92 ¤Ä¤Þ¤ê¡¢¥«¡¼¥Í¥ë¤¬¥Ñ¥¤¥×¤«¤é¥Ú¡¼¥¸¤ò°ÜÆ°¤Ç¤­¤Ê¤¤¾ì¹ç¤ä¡¢
93 ¥Ñ¥¤¥×¥Ð¥Ã¥Õ¥¡¤¬¥Ú¡¼¥¸Á´Éô¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢
94 ¥Ú¡¼¥¸¤Î¥³¥Ô¡¼¤¬¹Ô¤ï¤ì¤ë¤³¤È¤â¤¢¤ë¡£
95 ¤³¤Î¥Õ¥é¥°¤ÎºÇ½é¤Î¼ÂÁõ¤Ë¤Ï¥Ð¥°¤¬¤¢¤Ã¤¿¡£¤½¤Î¤¿¤á¡¢
96 Linux 2.6.21 °Ê¹ß¤Ç¤Ï¤³¤Î¥Õ¥é¥°¤ÎÁàºî¤Ï¤Ç¤­¤Ê¤¤¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë
97 (¤¿¤À¤·¡¢
98 .BR splice ()
99 ¥³¡¼¥ë¤Ç¤³¤Î¥Õ¥é¥°¤ò»ØÄꤹ¤ë¤³¤È¤Ïº£¤âǧ¤á¤é¤ì¤Æ¤¤¤ë)¡£
100 ¾­Íè¡¢Àµ¤·¤¤¼ÂÁõ¤¬¹Ô¤ï¤ì¤ë¤³¤È¤À¤í¤¦¡£
101 .TP
102 .B SPLICE_F_NONBLOCK
103 Æþ½ÐÎÏ»þ¤ËÄä»ß (block) ¤·¤Ê¤¤¡£
104 ¤³¤Î¥Õ¥é¥°¤ò»ØÄꤹ¤ë¤È¡¢
105 splice ¤Ë¤è¤ë¥Ñ¥¤¥×Áàºî¤òÈóÄä»ß¥â¡¼¥É (nonblocking) ¤Ç
106 ¹Ô¤ª¤¦¤È¤¹¤ë¤¬¡¢¤½¤Î¾ì¹ç¤Ç¤â
107 .BR splice ()
108 ¤ÏÄä»ß¤¹¤ë¤³¤È¤â¤¢¤ë¡£¤Ê¤¼¤Ê¤é¡¢¥Ç¡¼¥¿¤Î¤ä¤ê¼è¤ê¤ò¹Ô¤¦
109 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï
110 .RB ( O_NONBLOCK
111 ¥Õ¥é¥°¤ò¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç) Ää»ß¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¤«¤é¤Ç¤¢¤ë¡£
112 .TP
113 .B SPLICE_F_MORE
114 ¤³¤Î¸å¤Î splice ¤Ç¤µ¤é¤ËžÁ÷¤µ¤ì¤ë¥Ç¡¼¥¿¤¬¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
115 ¤³¤Î¥Õ¥é¥°¤Ï
116 .I fd_out
117 ¤¬¥½¥±¥Ã¥È¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¤ËÍ­ÍѤʥҥó¥È¤È¤Ê¤ë
118 .RB ( send (2)
119 ¤Î
120 .B MSG_MORE
121 ¤ä
122 .BR tcp (7)
123 ¤Î
124 .B TCP_CORK
125 ¤ÎÀâÌÀ¤â»²¾È)¡£
126 .TP
127 .B SPLICE_F_GIFT
128 .BR splice ()
129 ¤Ç¤Ï»ÈÍѤ·¤Ê¤¤¡£
130 .BR vmsplice (2)
131 »²¾È¡£
132 .SH ÊÖ¤êÃÍ
133 À®¸ù¤·¤Æ´°Î»¤¹¤ë¤È¡¢
134 .BR splice ()
135 ¤Ï¥Ñ¥¤¥×¤«¤é½Ð¤·Æþ¤ì¤·¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
136 ÊÖ¤êÃÍ 0 ¤Ï¥Ç¡¼¥¿¤ÎžÁ÷¤¬¹Ô¤ï¤Ê¤«¤Ã¤¿¤³¤È¤ò¼¨¤¹¡£
137 ¤³¤Î¾ì¹ç¡¢½èÍý¤òÄä»ß (block) ¤·¤Æ¤â̵°ÕÌ£¤Ç¤¢¤ë¡£
138 ¤Ê¤¼¤Ê¤é¡¢
139 .I fd_in
140 ¤¬»²¾È¤¹¤ë¥Ñ¥¤¥×¤Î½ñ¤­¹þ¤ß¦¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¼Ô¤¬¤¤¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£
141 .PP
142 ¥¨¥é¡¼¤Î¾ì¹ç¡¢
143 .BR splice ()
144 ¤Ï \-1 ¤òÊÖ¤·¡¢
145 .I errno
146 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹ÃͤòÀßÄꤹ¤ë¡£
147 .SH ¥¨¥é¡¼
148 .TP
149 .B EBADF
150 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î°ìÊý¤Þ¤¿¤ÏξÊý¤¬Í­¸ú¤Ç¤Ï¤Ê¤¤¡¢
151 ¤â¤·¤¯¤ÏŬÀڤʠread-write ¥â¡¼¥É¤Ç¤Ï¤Ê¤¤¡£
152 .TP
153 .B EINVAL
154 ÂоݤΥե¡¥¤¥ë¥·¥¹¥Æ¥à¤¬ splice ¤ËÂбþ¤·¤Æ¤¤¤Ê¤¤¡¢
155 ¤Þ¤¿¤ÏÂоݤΥե¡¥¤¥ë¤¬Äɵ­¥â¡¼¥É¤Ç¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¡¢
156 .\" Äɵ­¥â¡¼¥É¤Ç¤Î¥¨¥é¡¼¤Ï 2.6.27 °Ê¹ß¤ÇȯÀ¸¤¹¤ë¡£
157 .\" ¤½¤ì¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤ÏÄɵ­¥â¡¼¥É¤Ç¤Î splice() ¤ÏÀµ¤·¤¯Æ°ºî¤·¤Ê¤¤¡£
158 ¤Þ¤¿¤Ï¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¤É¤Á¤é¤â¥Ñ¥¤¥×¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤¡¢
159 ¤Þ¤¿¤Ï seek ¤Ç¤­¤Ê¤¤¥Ç¥Ð¥¤¥¹¤ËÂФ·¤Æ¥ª¥Õ¥»¥Ã¥È¤¬»ØÄꤵ¤ì¤¿¡£
160 .TP
161 .B ENOMEM
162 ¥á¥â¥êÉÔ­¡£
163 .TP
164 .B ESPIPE
165 .I off_in
166 ¤«
167 .I off_out
168 ¤Î¤¤¤º¤ì¤«¤¬ NULL ¤Ç¤Ï¤Ê¤¤¤¬¡¢Âбþ¤¹¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬
169 ¥Ñ¥¤¥×¤ò»²¾È¤·¤Æ¤¤¤ë¡£
170 .SH ¥Ð¡¼¥¸¥ç¥ó
171 .BR splice ()
172 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux 2.6.17 ¤Ç½é¤á¤ÆÅо줷¤¿¡£
173 .SH ½àµò
174 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux ¸ÇÍ­¤Ç¤¢¤ë¡£
175 .SH Ãí°Õ
176 3 ¤Ä¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë
177 .RB ( splice (),
178 .BR vmsplice (2),
179 .BR tee (2))
180 ¤ò»È¤¦¤È¡¢¥æ¡¼¥¶¶õ´Ö¥×¥í¥°¥é¥à¤ÏǤ°Õ¤Î¥«¡¼¥Í¥ë¥Ð¥Ã¥Õ¥¡¤ËÂФ¹¤ë
181 ´°Á´¤ÊÀ©¸æ¤¬¤Ç¤­¤ë¡£¥«¡¼¥Í¥ë¥Ð¥Ã¥Õ¥¡¤Ï¡¢¥Ñ¥¤¥×¤Ë»ÈÍѤµ¤ì¤Æ¤¤¤ë¤Î¤È
182 Ʊ¼ï¤Î¥Ð¥Ã¥Õ¥¡¤ò»È¤Ã¤Æ¥«¡¼¥Í¥ëÆâ¤Ë¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¡£
183 Âç¤Þ¤«¤Ë¤¤¤¦¤È¡¢¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï°Ê²¼¤Î»Å»ö¤ò¹Ô¤¦:
184 .TP 1.2i
185 .BR splice ()
186 ¥Ð¥Ã¥Õ¥¡¤«¤éǤ°Õ¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ä¡¢¤½¤ÎµÕÊý¸þ¡¢
187 ¤â¤·¤¯¤Ï¤¢¤ë¥Ð¥Ã¥Õ¥¡¤«¤éÊ̤ΥХåե¡¤Ø¤Î¡¢¥Ç¡¼¥¿°ÜÆ°¤ò¹Ô¤¦¡£
188 .TP
189 .BR tee (2)
190 ¤¢¤ë¥Ð¥Ã¥Õ¥¡¤«¤éÊ̤ΥХåե¡¤Ø¤Î¥Ç¡¼¥¿¡Ö¥³¥Ô¡¼¡×¤ò¹Ô¤¦¡£
191 .TP
192 .BR vmsplice (2)
193 ¥æ¡¼¥¶¶õ´Ö¤«¤é¥Ð¥Ã¥Õ¥¡¤Ø¤Î¥Ç¡¼¥¿¡Ö¥³¥Ô¡¼¡×¤ò¹Ô¤¦¡£
194 .PP
195 ¤³¤³¤Ç¤Ï¥³¥Ô¡¼¤ÎÏäò¤·¤Æ¤¤¤ë¤¬¡¢¼ÂºÝ¤Î¥³¥Ô¡¼¤Ï°ìÈÌŪ¤Ë²óÈò¤µ¤ì¤ë¡£
196 ¥«¡¼¥Í¥ë¤Ï¡¢¥Ñ¥¤¥×¡¦¥Ð¥Ã¥Õ¥¡¤ò¥«¡¼¥Í¥ë¥á¥â¥ê¤Î¥Ú¡¼¥¸¤Ø¤Î¥Ý¥¤¥ó¥¿½¸¹ç¤È¤·¤Æ
197 ¼ÂÁõ¤·¡¢¥Ú¡¼¥¸¤Ø¤Î»²¾È²ó¿ô¤ò´ÉÍý¤¹¤ë¤³¤È¤Ç¡¢¤³¤ì¤ò¼Â¸½¤·¤Æ¤¤¤ë¡£
198 ¥«¡¼¥Í¥ë¤Ï¡¢ÂоݤȤʤë¥Ú¡¼¥¸¤ò»²¾È¤¹¤ë (½ÐÎϥХåե¡ÍѤÎ) ¥Ý¥¤¥ó¥¿¤ò
199 ¿·µ¬¤ËºîÀ®¤¹¤ë¤³¤È¤Ç¥Ð¥Ã¥Õ¥¡Æâ¤Î¥Ú¡¼¥¸¤Î¡Ö¥³¥Ô¡¼¡×¤òºîÀ®¤·¡¢
200 ¤½¤Î¥Ú¡¼¥¸¤Î»²¾È²ó¿ô¤òÁý¤ä¤¹¡£¤Ä¤Þ¤ê¡¢¥Ý¥¤¥ó¥¿¤À¤±¤¬¥³¥Ô¡¼¤µ¤ì¡¢
201 ¥Ð¥Ã¥Õ¥¡¤Î¥Ú¡¼¥¸¤Ï¥³¥Ô¡¼¤µ¤ì¤Ê¤¤¡£
202 .\"
203 .\" Linus: Now, imagine using the above in a media server, for example.
204 .\" Let's say that a year or two has passed, so that the video drivers
205 .\" have been updated to be able to do the splice thing, and what can
206 .\" you do? You can:
207 .\"
208 .\" - splice from the (mpeg or whatever - let's just assume that the video
209 .\"   input is either digital or does the encoding on its own - like they
210 .\"   pretty much all do) video input into a pipe (remember: no copies - the
211 .\"   video input will just DMA directly into memory, and splice will just
212 .\"   set up the pages in the pipe buffer)
213 .\" - tee that pipe to split it up
214 .\" - splice one end to a file (ie "save the compressed stream to disk")
215 .\" - splice the other end to a real-time video decoder window for your
216 .\"   real-time viewing pleasure.
217 .\"
218 .\" Linus: Now, the advantage of splice()/tee() is that you can
219 .\" do zero-copy movement of data, and unlike sendfile() you can
220 .\" do it on _arbitrary_ data (and, as shown by "tee()", it's more
221 .\" than just sending the data to somebody else: you can duplicate
222 .\" the data and choose to forward it to two or more different
223 .\" users - for things like logging etc.).
224 .\"
225 .SH Îã
226 .BR tee (2)
227 »²¾È¡£
228 .SH ´ØÏ¢¹àÌÜ
229 .BR sendfile (2),
230 .BR tee (2),
231 .BR vmsplice (2),
232 .BR feature_test_macros (7)