DragonFly On-Line Manual Pages

Search: Section:  

UNLINKAT(2)              DragonFly System Calls Manual             UNLINKAT(2)


unlinkat -- remove directory entry or directory file


Standard C Library (libc, -lc)


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


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


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: [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.


rmdir(2), unlink(2)


The unlinkat() system call appeared in DragonFly 2.3. DragonFly 3.5 August 18, 2009 DragonFly 3.5

Search: Section: