OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / release / man2 / unlinkat.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 2006, Michael Kerrisk
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Japanese Version Copyright (c) 2006 Yuichi SATO
26 .\"         all rights reserved.
27 .\" Translated 2006-08-24 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.39
28 .\"
29 .TH UNLINKAT 2 2009-12-13 "Linux" "Linux Programmer's Manual"
30 .SH 名前
31 unlinkat \- ディレクトリファイルディスクリプタから相対的な位置にあるディレクトリエントリを削除する
32 .SH 書式
33 .nf
34 .B #include <fcntl.h>
35 .sp
36 .BI "int unlinkat(int " dirfd ", const char *" pathname ", int " flags );
37 .fi
38 .sp
39 .in -4n
40 glibc 向けの機能検査マクロの要件
41 .RB ( feature_test_macros (7)
42 参照):
43 .in
44 .sp
45 .BR unlinkat ():
46 .PD 0
47 .ad l
48 .RS 4
49 .TP 4
50 glibc 2.10 以降:
51 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
52 .TP
53 glibc 2.10 より前:
54 _ATFILE_SOURCE
55 .RE
56 .ad
57 .PD
58 .SH 説明
59 .BR unlinkat ()
60 システムコールは、この man ページで説明している違いがある以外は、
61 .RI ( flags
62
63 .B AT_REMOVEDIR
64 フラグが含まれるか否かにより)
65 .BR unlink (2)
66 または
67 .BR rmdir (2)
68 と全く同じように動作する。
69
70 .I pathname
71 で指定されるパス名が相対パス名である場合、
72 ファイルディスクリプタ
73 .I dirfd
74 で参照されるディレクトリからの相対パス名として解釈される
75 .RB ( unlink (2)
76 または
77 .BR rmdir (2)
78 では、相対パスは呼び出し元プロセスの
79 カレントワーキングディレクトリからの相対パスとなる)。
80
81 .I pathname
82 で指定されるパス名が相対パス名であり、かつ
83 .I dirfd
84 が特別な値
85 .B AT_FDCWD
86 である場合、
87 .I pathname
88
89 .RB ( unlink (2)
90 または
91 .BR rmdir (2)
92 と同じように) 呼び出し元プロセスの
93 カレントワーキングディレクトリからの相対パス名として解釈される。
94
95 .I pathname
96 で指定されるパス名が絶対パス名である場合、
97 .I dirfd
98 は無視される。
99
100 .I flags
101 はビットマスクであり、0 または
102 .BR unlinkat ()
103 の操作を制御するフラグ値の OR を指定できる。
104 現在のところ 1 つのフラグだけが定義されている:
105 .TP
106 .B AT_REMOVEDIR
107 デフォルトでは、
108 .BR unlinkat ()
109
110 .I pathname
111 に対して
112 .BR unlink (2)
113 と同じ操作を行う。
114 .B AT_REMOVEDIR
115 フラグが指定されると、
116 .I pathname
117 に対して
118 .BR rmdir (2)
119 と同じ操作を行う。
120 .SH 返り値
121 成功した場合、
122 .BR unlinkat ()
123 は 0 を返す。
124 エラーの場合、\-1 が返されて、
125 .I errno
126 にはエラーを示す値が設定される。
127 .SH エラー
128 .BR unlink (2)
129 または
130 .BR rmdir (2)
131 と同じエラーが
132 .BR unlinkat ()
133 でも起こる。
134 .BR unlinkat ()
135 では、その他に以下のエラーが起こる:
136 .TP
137 .B EBADF
138 .I dirfd
139 が有効なファイルディスクリプタでない。
140 .TP
141 .B EINVAL
142 .I flags
143 に不正なフラグ値が指定された。
144 .TP
145 .B ENOTDIR
146 .I pathname
147 が相対パスで、かつ
148 .I dirfd
149 がディレクトリ以外のファイルを参照するファイルディスクリプタである。
150 .SH バージョン
151 .BR unlinkat ()
152 は Linux カーネル 2.6.16 で追加された。
153 .SH 準拠
154 POSIX.1-2008.
155 Solaris には、これと同じようなシステムコールが存在する。
156 .SH 注意
157 .BR unlinkat ()
158 が必要な理由については、
159 .BR openat (2)
160 を参照すること。
161 .SH 関連項目
162 .BR openat (2),
163 .BR rmdir (2),
164 .BR unlink (2),
165 .BR path_resolution (7)