.\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#) pipe. 2 8.1 (Berkeley) 6/4/93 .\" %FreeBSD: src/lib/libc/sys/pipe. 2, v 1.13. 2.5 2001/12/14 18:34:01 ru Exp % .\" .\" $FreeBSD: doc/ja_JP.eucJP/man/man2/pipe. 2, v 1.9 2001/12/23 00:03:42 horikawa Exp $ .Dd June 4, 1993 .Dt PIPE 2 .Os .Sh ¸íĪ .Nm pipe .Nd ÇÁ·Î¼¼½º°£ Åë½ÅÀ» À§ÇÑ ±â¼úÀÚÀÇ Æä¾î¸¦ ÀÛ¼ºÇÑ´Ù .Sh ÇÁ·Î±×·¥ ¶óÀ̺귯¸® .Lb libc .Sh ¼­½Ä .In unistd.h .Ft int .Fn pipe "int *fildes" .Sh ÇØ¼³ .Fn pipe ÇÔ¼ö´Â ½Ö¹æÇâÀÇ µ¥ÀÌÅÍ Ç÷οì(flow)¸¦ °¡´ÉÀ¸·Î ÇÏ´Â ¿ÀºêÁ§Æ®ÀÌ´Ù .Em pipe (À»)¸¦ ÀÛ¼ºÇØ, Æä¾îÀÇ ÆÄÀÏ ±â¼úÀÚ¸¦ ÇÒ´çÇÕ´Ï´Ù. .Pp °ü½À¿¡ ÀÇÇØ, Åë»óÀº 1 ¹øÂ°ÀÇ ±â¼úÀÚ°¡ ÆÄÀÌÇÁÀÇ .Em ÀбâÃø (À¸)·Î¼­ »ç¿ëµÇ¾î 2 ¹øÂ°ÀÇ ±â¼úÀÚ°¡ .Em ±â·ÏÃø (À¸)·Î¼­ »ç¿ëµË´Ï´Ù. ±×·¯¹Ç·Î, .Fa fildes[1] ¿¡ ¾²±âµ¥ÀÌÅͰ¡ .Fa fildes[0] ¿¡ ³ªÅ¸³³´Ï´Ù (Áï, .Fa fildes[0] (À¸)·ÎºÎÅÍ µ¶ÇØ). À̰ÍÀ» »ç¿ëÇϸé 1 °³ÀÇ ÇÁ·Î±×·¥ÀÇ Ãâ·ÂÀ» ´Ù¸¥ ÇÁ·Î±×·¥¿¡ ¼Û½ÅÇÒ ¼ö ÀÖ½À´Ï´Ù. ¼Û½ÅÃøÀÇ Ç¥ÁØ Ãâ·ÂÀ» ÆÄÀÌÇÁÀÇ ±â·ÏÃøÀ¸·Î¼­ ¼Â¾÷ ÇØ, ¼ö½ÅÃøÀÇ Ç¥ÁØ ÀÔ·ÂÀ» ÆÄÀÌÇÁÀÇ ÀбâÃøÀ¸·Î¼­ ¼Â¾÷ ÇØ ÁÖ¼¼¿ä. ÆÄÀÌÇÁ ÀÚü´Â, ¸ðµç ´ëÀÀÇÏ´Â ±â¼úÀÚ°¡ Ŭ·Î¿ìÁî µÉ ¶§±îÁö Áö¼ÓÇÕ´Ï´Ù. .Pp ÀÏ´ÜÀÌ ´Ý°í ÀÖ´Â ÆÄÀÌÇÁ´Â .Em widowed (»ó´ë¸¦ ÀÒ¾ú´Ù)(ÀÌ)¶ó°í º¸¿©Áý´Ï´Ù. ÀÌ·¯ÇÑ ÆÄÀÌÇÁ¿¡ ±â·ÏÀ» Çϸé(ÀÚ), ±â·Ï ÇÁ·Î¼¼½º´Â .Dv SIGPIPE ½Ã±×³ÎÀ» ¼ö½ÅÇÕ´Ï´Ù. Àбâ Ãø¿¡ ÆÄÀÏÀÇ Á¾·á¸¦ ÀüÇÏ´Â ¹æ¹ýÀº, ±â·ÏÃøÀÇ ÆÄÀÌÇÁ¸¦ Ŭ·Î¿ìÁî ÇÒ ¼ö ¹Û¿¡ ¾ø½À´Ï´Ù. ÀбâÃøÀÌ ¹öÆÛ¿¡ µé¾î°¡ ÀÖ´Â µ¥ÀÌÅ͸¦ ´Ù »ç¿ëÇÑ ÈÄ, »ó´ë¸¦ ÀÒÀº ÆÄÀÌÇÁ¸¦ µ¶ÇØ¿Í 0 Ä«¿îÆ®°¡ µ¹·ÁÁÖ¾îÁý´Ï´Ù. .Pp ÀÌ ÆÄÀÌÇÁÀÇ ½ÇÀå¿¡ À־ÀÇ ½Ö¹æÇâÀ̶ó°í ÇÏ´Â ¼ºÁúÀº, ³°Àº ½Ã½ºÅÛ°ú ȣȯ¼ºÀÌ ¾ø½À´Ï´Ù. ±×·¯¹Ç·Î, ÆÄÀÌÇÁ¸¦ ÇѹæÇâ ¹Û¿¡ »ç¿ëÇÏÁö ¾ÊÀ» ¶§¿¡´Â, Á¾·¡ÀÇ ¹æ¹ýÀ¸·Î ´Ü Á¡À» »ç¿ëÇÏ´Â ÀÌ °ü½À¿¡ µû¸£´Â °ÍÀ» ÃßõÇÕ´Ï´Ù. .Sh ¹Ýȯ°ª .Rv -std pipe .Sh ¿¡·¯ .Fn pipe È£ÃâÀº ´ÙÀ½ÀÇ °æ¿ì¿¡ ½ÇÆÐÇÕ´Ï´Ù. .Bl -tag -width Er .It Bq Er EMFILE ¾×ƼºêÇÑ ±â¼úÀÚ°¡ ³Ê¹« ¸¹½À´Ï´Ù. .It Bq Er ENFILE ½Ã½ºÅÛ ÆÄÀÏ Å×À̺íÀÌ ¸¸¹èÀÔ´Ï´Ù. .It Bq Er EFAULT .Fa fildes ¹öÆÛ°¡ ÇÁ·Î¼¼½ºÀÇ address °ø°£ÀÇ ºÎÁ¤ÇÑ area¿¡ ÀÖ½À´Ï´Ù. .El .Sh °ü·Ã Ç׸ñ .Xr sh 1 , .Xr fork 2 , .Xr read 2 , .Xr socketpair 2 , .Xr write 2 .Sh ¿ª»ç .Fn pipe ÇÔ¼ö´Â .At v3 ±×¸®°í µîÀåÇß½À´Ï´Ù. .Pp ½Ö¹æÇâ ÆÄÀÌÇÁ´Â óÀ½ .At V. 4 ±×¸®°í »ç¿ëµÇ¾ú½À´Ï´Ù.