OSDN Git Service

6ad54237a6e6f9e3b68e01282c9ea9b270100659
[linuxjm/LDP_man-pages.git] / release / man2 / chdir.2
1 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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 .\" %%%LICENSE_END
24 .\"
25 .\" Modified by Michael Haardt <michael@moria.de>
26 .\" Modified 1993-07-21 by Rik Faith <faith@cs.unc.edu>
27 .\" Modified 1995-04-15 by Michael Chastain <mec@shell.portal.com>:
28 .\"   Added 'fchdir'. Fixed bugs in error section.
29 .\" Modified 1996-10-21 by Eric S. Raymond <esr@thyrsus.com>
30 .\" Modified 1997-08-21 by Joseph S. Myers <jsm28@cam.ac.uk>
31 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
32 .\"
33 .\"*******************************************************************
34 .\"
35 .\" This file was generated with po4a. Translate the source file.
36 .\"
37 .\"*******************************************************************
38 .TH CHDIR 2 2010\-11\-25 Linux "Linux Programmer's Manual"
39 .SH 名前
40 chdir, fchdir \- 作業ディレクトリの変更
41 .SH 書式
42 \fB#include <unistd.h>\fP
43 .sp
44 \fBint chdir(const char *\fP\fIpath\fP\fB);\fP
45 .br
46 \fBint fchdir(int \fP\fIfd\fP\fB);\fP
47 .sp
48 .in -4n
49 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
50 .in
51 .sp
52 \fBfchdir\fP():
53 .PD 0
54 .ad l
55 .RS 4
56 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
57 .br
58 || /* glibc 2.12 以降: */ _POSIX_C_SOURCE\ >=\ 200809L
59 .RE
60 .ad
61 .PD
62 .SH 説明
63 \fBchdir\fP()  は、呼び出し元プロセスの現在の作業ディレクトリ (current working directory) を、 \fIpath\fP
64 に指定されたディレクトリに変更する。
65 .PP
66 \fBfchdir\fP()  は、ディレクトリがオープンされたファイル・ディスクリプターとして 指定される以外は、 \fBchdir\fP()  と同じである。
67 .SH 返り値
68 成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
69 .SH エラー
70 ファイルシステムによっては他のエラーが返される事がある。 \fBchdir\fP()  で一般的なエラーを以下に挙げる:
71 .TP 
72 \fBEACCES\fP
73 \fIpath\fP の構成要素のいずれかに検索許可 (search permission) がない (\fBpath_resolution\fP(7)
74 も参照すること)。
75 .TP 
76 \fBEFAULT\fP
77 \fIpath\fP がアクセスできるアドレス空間外を指している。
78 .TP 
79 \fBEIO\fP
80 I/O エラーが発生した。
81 .TP 
82 \fBELOOP\fP
83 \fIpath\fP を解決する際に遭遇したシンボリック・リンクが多過ぎる。
84 .TP 
85 \fBENAMETOOLONG\fP
86 \fIpath\fP が長過ぎる。
87 .TP 
88 \fBENOENT\fP
89 ファイルが存在しない。
90 .TP 
91 \fBENOMEM\fP
92 カーネルに十分なメモリがない。
93 .TP 
94 \fBENOTDIR\fP
95 \fIpath\fP の構成要素がディレクトリではない。
96 .PP
97 \fBfchdir\fP()  で一般的なエラーを以下に挙げる:
98 .TP 
99 \fBEACCES\fP
100 \fIfd\fP をディレクトリとしてオープンするための検索許可がない。
101 .TP 
102 \fBEBADF\fP
103 \fIfd\fP が適切なファイル・ディスクリプターでない。
104 .SH 準拠
105 SVr4, 4.4BSD, POSIX.1\-2001.
106 .SH 注意
107 現在の作業ディレクトリは、相対パス名 (\(aq/\(aq) で始まっていないパス名) を 解釈する際の開始点である。
108
109 \fBfork\fP(2)  で作成された子プロセスは、親プロセスの現在の作業ディレクトリを 継承する。 \fBexecve\fP(2)
110 の前後で、現在の作業ディレクトリは変更されない。
111 .SH 関連項目
112 \fBchroot\fP(2), \fBgetcwd\fP(3), \fBpath_resolution\fP(7)
113 .SH この文書について
114 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
115 である。プロジェクトの説明とバグ報告に関する情報は
116 http://www.kernel.org/doc/man\-pages/ に書かれている。