xref: /csrg-svn/lib/libc/sys/rmdir.2 (revision 61183)
1*61183Sbostic.\" Copyright (c) 1983, 1991, 1993
2*61183Sbostic.\"	The Regents of the University of California.  All rights reserved.
320253Smckusick.\"
443568Strent.\" %sccs.include.redist.man%
520253Smckusick.\"
6*61183Sbostic.\"     @(#)rmdir.2	8.1 (Berkeley) 06/04/93
738053Sbostic.\"
847208Scael.Dd
947208Scael.Dt RMDIR 2
1047208Scael.Os BSD 4.2
1147208Scael.Sh NAME
1247208Scael.Nm rmdir
1347208Scael.Nd remove a directory file
1447208Scael.Sh SYNOPSIS
1547208Scael.Fd #include <unistd.h>
1647208Scael.Ft int
1747208Scael.Fn rmdir "const char *path"
1847208Scael.Sh DESCRIPTION
1947208Scael.Fn Rmdir
2020253Smckusickremoves a directory file
2120253Smckusickwhose name is given by
2247208Scael.Fa path .
2320253SmckusickThe directory must not have any entries other
2447208Scaelthan
2547208Scael.Ql \&.
2647208Scaeland
2747208Scael.Ql \&.. .
2847208Scael.Sh RETURN VALUES
2947208ScaelA 0 is returned if the remove succeeds; otherwise a -1 is
3047208Scaelreturned and an error code is stored in the global location
3147208Scael.Va errno .
3247208Scael.Sh ERRORS
3347208ScaelThe named file is removed unless:
3447208Scael.Bl -tag -width [ENAMETOOLONG]
3547208Scael.It Bq Er ENOTDIR
3621004SmckusickA component of the path is not a directory.
3747208Scael.It Bq Er EINVAL
3820253SmckusickThe pathname contains a character with the high-order bit set.
3947208Scael.It Bq Er ENAMETOOLONG
4021004SmckusickA component of a pathname exceeded 255 characters,
4121004Smckusickor an entire path name exceeded 1023 characters.
4247208Scael.It Bq Er ENOENT
4321004SmckusickThe named directory does not exist.
4447208Scael.It Bq Er ELOOP
4521004SmckusickToo many symbolic links were encountered in translating the pathname.
4647208Scael.It Bq Er ENOTEMPTY
4747208ScaelThe named directory contains files other than
4847208Scael.Ql \&.
4947208Scaeland
5047208Scael.Ql \&..
5147208Scaelin it.
5247208Scael.It Bq Er EACCES
5321004SmckusickSearch permission is denied for a component of the path prefix.
5447208Scael.It Bq Er EACCES
5520253SmckusickWrite permission is denied on the directory containing the link
5620253Smckusickto be removed.
5747208Scael.It Bq Er EPERM
5824440SmckusickThe directory containing the directory to be removed is marked sticky,
5924440Smckusickand neither the containing directory nor the directory to be removed
6024440Smckusickare owned by the effective user ID.
6147208Scael.It Bq Er EBUSY
6220253SmckusickThe directory to be removed is the mount point
6320253Smckusickfor a mounted file system.
6447208Scael.It Bq Er EIO
6521004SmckusickAn I/O error occurred while deleting the directory entry
6621004Smckusickor deallocating the inode.
6747208Scael.It Bq Er EROFS
6820253SmckusickThe directory entry to be removed resides on a read-only file system.
6947208Scael.It Bq Er EFAULT
7047208Scael.Fa Path
7120253Smckusickpoints outside the process's allocated address space.
7247208Scael.El
7347208Scael.Sh SEE ALSO
7447208Scael.Xr mkdir 2 ,
7547208Scael.Xr unlink 2
7647208Scael.Sh HISTORY
7747208ScaelThe
7847208Scael.Nm
7947208Scaelfunction call appeared in
8047208Scael.Bx 4.2 .
81