UNLINKAT(2)

NAME
unlinkat - remove directory entry or directory file

LIBRARY
libc

SYNOPSIS
#include <fcntl.h>
#include <unistd.h>
int
unlinkat(int fd, const char *path, int flags);

DESCRIPTION
The unlinkat() function operates as the unlink() or rmdir() functions depending on the value of flags.

The values for the flags are constructed by a bitwise-inclusive OR of flags from the following list, defined in <fcntl.h>:

AT_REMOVEDIR
    Remove a directory file instead of a directory entry.

If path specifies a relative path the directory entry or directory file to delete is determined relative to the directory associated with the file descriptor fd instead of the current working directory. If fd is the special value AT_FDCWD the current working directory is used and the behavior is identical to a call to rmdir() or unlink().

RETURN VALUES

ERRORS
The unlinkat() function can fail with the same error codes as unlink() and rmdir(). In addition, unlinkat() can fail with:

[EBADF]
    fd is not a valid file descriptor.

[ENOTDIR]
    path is relative and fd does not point to a directory.

[EINVAL]
    flags contains unsupported flags.

SEE ALSO
rmdir(2), unlink(2)

HISTORY
The unlinkat() system call appeared in DragonFly 2.3.