라이브러리
표준 C 라이브러리
(libc, -lc)
요약
#include <unistd.h>
int rmdir(const char *pathname);
설명
rmdir() 는 디렉토리(꼭
비어 있어야만한다.)를
삭제한다.
반환값
On success, zero is returned. On error, -1 is returned, and
errno is set to indicate the error.
에러
- EACCES
- Write access to the directory containing pathname was not allowed,
or one of the directories in the path prefix of pathname did not
allow search permission. (See also path_resolution(7).)
- EBUSY
- pathname is currently in use by the system or some process that
prevents its removal. On Linux, this means pathname is currently
used as a mount point or is the root directory of the calling
process.
- EFAULT
- pathname 가 접근할수 있는
주소 공간외를
가리키고 있다.
- EINVAL
- pathname has . as last component.
- ELOOP
- pathname 의 링크가 너무
많다.
- ENAMETOOLONG
- pathname이 너무 길다.
- ENOENT
- pathname 에 있는 디렉토리
요소가 존재하지
않거나 붙어다니는
상징 연결이다.
- ENOMEM
- 이용할수 있는 커널
메모리가 충분하지
않다.
- ENOTDIR
- pathname, 이나 pathname 의
디렉토리가 사실
디렉토리가 아니다.
- ENOTEMPTY
- pathname contains entries other than . and .. ; or,
pathname has .. as its final component. POSIX.1 also allows
EEXIST for this condition.
- EPERM
- The directory containing pathname has the sticky bit
(S_ISVTX) set and the process's effective user ID is neither the
user ID of the file to be deleted nor that of the directory containing it,
and the process is not privileged (Linux: does not have the
CAP_FOWNER capability).
- EPERM
- pathname을 포함한 파일
시스템이 디렉토리
삭제를 지원하지
않는다.
- EROFS
- pathname refers to a directory on a read-only filesystem.
표준
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
버그
NFS프로토콜의
부적적한 표현은 현재
쓰고 있는 디렉토리의
기대하지 않은 소실을
야기 할 수 있다.
추가 참조
rm(1), rmdir(1), chdir(2), chmod(2),
mkdir(2), rename(2), unlink(2), unlinkat(2)