man.bsd.lv manual page server

Manual Page Search Parameters

UNLINKAT(2) System Calls Manual UNLINKAT(2)

unlinkatremove directory entry or directory file

library “libc”

#include <fcntl.h>
#include <unistd.h>

int
unlinkat(int fd, const char *path, int flags);

The () function operates as the () 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>:

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 () or ().

The unlinkat() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

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

[]
fd is not a valid file descriptor.
[]
path is relative and fd does not point to a directory.
[]
flags contains unsupported flags.

rmdir(2), unlink(2)

The unlinkat() system call appeared in DragonFly 2.3.

August 18, 2009 DragonFly-5.6.1