.\" 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. .\" .\" @(#) chdir. 2 8.2 (Berkeley) 12/11/93 .\" %FreeBSD: src/lib/libc/sys/chdir. 2, v 1.7. 2.5 2001/12/14 18:34:00 ru Exp % .\" .\" $FreeBSD: doc/ja_JP.eucJP/man/man2/chdir. 2, v 1.8 2001/12/23 00:03:41 horikawa Exp $ .Dd December 11, 1993 .Dt CHDIR 2 .Os .Sh ¸íĪ .Nm chdir , .Nm fchdir .Nd ÇöÀçÀÇ ÀÛ¾÷ µð·ºÅ丮¸¦ º¯°æÇÑ´Ù .Sh ÇÁ·Î±×·¥ ¶óÀ̺귯¸® .Lb libc .Sh ¼­½Ä .In unistd.h .Ft int .Fn chdir "const char *path" .Ft int .Fn fchdir "int fd" .Sh ÇØ¼³ .Fa path Àμö´Â, µð·ºÅ丮ÀÇ ÆÐ½º¸íÀ» °¡¸®Åµ´Ï´Ù. .Fn chdir ÇÔ¼ö¿¡ ÀÇÇØ, ÁöÁ¤µÈ µð·ºÅ丮°¡ ÇöÀçÀÇ ÀÛ¾÷ µð·ºÅ丮, Áï slash .Ql / ±×¸®°í °³½ÃÇÏÁö ¾Ê´Â ÆÐ½º¸íÀÇ ÆÐ½º °Ë»öÀÇ °³½ÃÁ¡ÀÌ µË´Ï´Ù. .Pp .Fn fchdir ÇÔ¼ö¿¡ ÀÇÇØ, .Fa fd ÇÏÁö¸¸ ÂüÁ¶ÇÏ´Â µð·ºÅ丮°¡ ÇöÀçÀÇ ÀÛ¾÷ µð·ºÅ丮 (slash .Ql / ±×¸®°í °³½ÃÇÏÁö ¾Ê´Â ÆÐ½º¸íÀÇ ÆÐ½º °Ë»öÀÇ °³½ÃÁ¡)ÀÌ µË´Ï´Ù. .Pp µð·ºÅ丮°¡ ÇöÀçÀÇ ÀÛ¾÷ µð·ºÅ丮°¡ µÇ±â À§Çؼ­(¶§¹®¿¡)´Â, ÇÁ·Î¼¼½º°¡ ±× µð·ºÅ丮¿¡ÀÇ ½ÇÇà (°Ë»ö) ¾×¼¼½º Çã°¡¸¦ °¡Áö°í ÀÖÀ» Çʿ䰡 ÀÖ½À´Ï´Ù. .Sh ¹Ýȯ°ª .Rv -std .Sh ¿¡·¯ ´ÙÀ½ÀÇ 1 °³ ¶Ç´Â º¹¼ö°¡ ÁøÁ¤ÇÑ °æ¿ì, .Fn chdir ÀÇ Ã³¸®´Â ½ÇÆÐÇØ, ÇöÀçÀÇ ÀÛ¾÷ µð·ºÅ丮´Â º¯°æµÇÁö ¾Ê½À´Ï´Ù. .Bl -tag -width Er .It Bq Er ENOTDIR ÆÐ½ºÀÇ ¿ø°¡¿ä¼ÒÁß¿¡ µð·ºÅ丮 ÀÌ¿ÜÀÇ °ÍÀÌ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù. .It Bq Er ENAMETOOLONG ÆÐ½º¸íÀÇ ¿ø°¡¿ä¼Ò°¡ 255 ij¸¯Å͸¦ ³Ñ°í ÀÖ´ÂÁö, ¶Ç´Â ÆÐ½º¸í Àüü°¡ 1023 ij¸¯Å͸¦ ³Ñ°í ÀÖ½À´Ï´Ù. .It Bq Er ENOENT ÁöÁ¤µÈ µð·ºÅ丮°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù. .It Bq Er ELOOP ÆÐ½º¸íÀ» º¯È¯ÇÒ °æ¿ì¿¡ °ËÃâµÈ ±âÈ£ ¿¬°áÀÌ ³Ê¹« ¸¹½À´Ï´Ù. .It Bq Er EACCES ÆÐ½º¸íÀÇ ¿ø°¡¿ä¼ÒÀÇ ¾î´ÀÂÊÀ̵çÀ¸·Î, °Ë»öÀÌ Çã°¡µÇ°í ÀÖÁö ¾Ê½À´Ï´Ù. .It Bq Er EFAULT .Fa path (Àº)´Â, ÇÁ·Î¼¼½º¿¡ ÇÒ´çÇÒ ¼ö ÀÖ¾ú´ø address °ø°£ÀÇ ¹üÀ§¿Ü¸¦ °¡¸®Å°°í ÀÖ½À´Ï´Ù. .It Bq Er EIO ÆÄÀÏ ½Ã½ºÅÛ¿¡ ÀÐ°í ¾²±âÇϰí ÀÖ´Â µ¿¾È¿¡ ÀÔÃâ·Â ¿¡·¯°¡ ¹ß»ýÇß½À´Ï´Ù. .El .Pp ´ÙÀ½ÀÇ 1 °³ ¶Ç´Â º¹¼ö°¡ ÁøÁ¤ÇÑ °æ¿ì, .Fn fchdir ÀÇ Ã³¸®´Â ½ÇÆÐÇØ, ÇöÀçÀÇ ÀÛ¾÷ µð·ºÅ丮´Â º¯°æµÇÁö ¾Ê½À´Ï´Ù. .Bl -tag -width Er .It Bq Er EACCES ÆÄÀÏ ±â¼úÀÚ°¡ ÂüÁ¶ÇÏ´Â µð·ºÅ丮¿¡¼­ °Ë»öÀÌ Çã°¡µÇ°í ÀÖÁö ¾Ê½À´Ï´Ù. .It Bq Er ENOTDIR ÆÄÀÏ ±â¼úÀÚ°¡ µð·ºÅ丮¸¦ ÂüÁ¶Çϰí ÀÖÁö ¾Ê½À´Ï´Ù. .It Bq Er EBADF Àμö .Fa fd ÇÏÁö¸¸ À¯È¿ÇÑ ÆÄÀÏ ±â¼úÀÚ°¡ ¾Æ´Õ´Ï´Ù. .El .Sh °ü·Ã Ç׸ñ .Xr chroot 2 .Sh Ç¥ÁØ .Fn chdir ÇÔ¼ö´Â .St -p1003.1-90 ¿¡ ÁذÅÇϰí ÀÖ½À´Ï´Ù. .Sh ¿ª»ç .Fn chdir ÇÔ¼ö´Â .At v7 ±×¸®°í µîÀåÇß½À´Ï´Ù. .Fn fchdir ÇÔ¼ö´Â .Bx 4.2 ±×¸®°í µîÀåÇß½À´Ï´Ù.