xref: /dflybsd-src/lib/libc/sys/unlinkat.2 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino.\" Copyright (c) 2009 The DragonFly Project.  All rights reserved.
286d7f5d3SJohn Marino.\"
386d7f5d3SJohn Marino.\" This code is derived from software contributed to The DragonFly Project
486d7f5d3SJohn Marino.\" by Nicolas Thery <nthery@gmail.com>
586d7f5d3SJohn Marino.\"
686d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without
786d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions
886d7f5d3SJohn Marino.\" are met:
986d7f5d3SJohn Marino.\"
1086d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
1186d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
1286d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
1386d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer in
1486d7f5d3SJohn Marino.\"    the documentation and/or other materials provided with the
1586d7f5d3SJohn Marino.\"    distribution.
1686d7f5d3SJohn Marino.\" 3. Neither the name of The DragonFly Project nor the names of its
1786d7f5d3SJohn Marino.\"    contributors may be used to endorse or promote products derived
1886d7f5d3SJohn Marino.\"    from this software without specific, prior written permission.
1986d7f5d3SJohn Marino.\"
2086d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2186d7f5d3SJohn Marino.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2286d7f5d3SJohn Marino.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2386d7f5d3SJohn Marino.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
2486d7f5d3SJohn Marino.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2586d7f5d3SJohn Marino.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
2686d7f5d3SJohn Marino.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2786d7f5d3SJohn Marino.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2886d7f5d3SJohn Marino.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2986d7f5d3SJohn Marino.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
3086d7f5d3SJohn Marino.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3186d7f5d3SJohn Marino.\" SUCH DAMAGE.
3286d7f5d3SJohn Marino.\"
3386d7f5d3SJohn Marino.Dd August 18, 2009
3486d7f5d3SJohn Marino.Dt UNLINKAT 2
3586d7f5d3SJohn Marino.Os
3686d7f5d3SJohn Marino.Sh NAME
3786d7f5d3SJohn Marino.Nm unlinkat
3886d7f5d3SJohn Marino.Nd remove directory entry or directory file
3986d7f5d3SJohn Marino.Sh LIBRARY
4086d7f5d3SJohn Marino.Lb libc
4186d7f5d3SJohn Marino.Sh SYNOPSIS
4286d7f5d3SJohn Marino.In fcntl.h
4386d7f5d3SJohn Marino.In unistd.h
4486d7f5d3SJohn Marino.Ft int
4586d7f5d3SJohn Marino.Fn unlinkat "int fd" "const char *path" "int flags"
4686d7f5d3SJohn Marino.Sh DESCRIPTION
4786d7f5d3SJohn MarinoThe
4886d7f5d3SJohn Marino.Fn unlinkat
4986d7f5d3SJohn Marinofunction
5086d7f5d3SJohn Marinooperates as the
5186d7f5d3SJohn Marino.Fn unlink
5286d7f5d3SJohn Marinoor
5386d7f5d3SJohn Marino.Fn rmdir
5486d7f5d3SJohn Marinofunctions depending on the value of
5586d7f5d3SJohn Marino.Fa flags .
5686d7f5d3SJohn Marino.Pp
5786d7f5d3SJohn MarinoThe values for the
5886d7f5d3SJohn Marino.Fa flags
5986d7f5d3SJohn Marinoare constructed by a bitwise-inclusive OR of flags from the following list,
6086d7f5d3SJohn Marinodefined in
6186d7f5d3SJohn Marino.In fcntl.h :
6286d7f5d3SJohn Marino.Bl -tag -width indent
6386d7f5d3SJohn Marino.It Dv AT_REMOVEDIR
6486d7f5d3SJohn MarinoRemove a directory file instead of a directory entry.
6586d7f5d3SJohn Marino.El
6686d7f5d3SJohn Marino.Pp
6786d7f5d3SJohn MarinoIf
6886d7f5d3SJohn Marino.Fa path
6986d7f5d3SJohn Marinospecifies a relative path the directory entry or directory file to delete is
7086d7f5d3SJohn Marinodetermined relative to the directory associated with the file descriptor
7186d7f5d3SJohn Marino.Fa fd
7286d7f5d3SJohn Marinoinstead of the current working directory.
7386d7f5d3SJohn MarinoIf
7486d7f5d3SJohn Marino.Fa fd
7586d7f5d3SJohn Marinois the special value
7686d7f5d3SJohn Marino.Dv AT_FDCWD
7786d7f5d3SJohn Marinothe current working directory is used and the behavior is identical to a call to
7886d7f5d3SJohn Marino.Fn rmdir
7986d7f5d3SJohn Marinoor
8086d7f5d3SJohn Marino.Fn unlink .
8186d7f5d3SJohn Marino.Sh RETURN VALUES
8286d7f5d3SJohn Marino.Rv -std unlinkat
8386d7f5d3SJohn Marino.Sh ERRORS
8486d7f5d3SJohn MarinoThe
8586d7f5d3SJohn Marino.Fn unlinkat
8686d7f5d3SJohn Marinofunction can fail with the same error codes as
8786d7f5d3SJohn Marino.Fn unlink
8886d7f5d3SJohn Marinoand
8986d7f5d3SJohn Marino.Fn rmdir .
9086d7f5d3SJohn MarinoIn addition,
9186d7f5d3SJohn Marino.Fn unlinkat
9286d7f5d3SJohn Marinocan fail with:
9386d7f5d3SJohn Marino.Bl -tag -width Er
9486d7f5d3SJohn Marino.It Bq Er EBADF
9586d7f5d3SJohn Marino.Fa fd
9686d7f5d3SJohn Marinois not a valid file descriptor.
9786d7f5d3SJohn Marino.It Bq Er ENOTDIR
9886d7f5d3SJohn Marino.Fa path
9986d7f5d3SJohn Marinois relative and
10086d7f5d3SJohn Marino.Fa fd
10186d7f5d3SJohn Marinodoes not point to a directory.
10286d7f5d3SJohn Marino.It Bq Er EINVAL
10386d7f5d3SJohn Marino.Fa flags
10486d7f5d3SJohn Marinocontains unsupported flags.
10586d7f5d3SJohn Marino.El
10686d7f5d3SJohn Marino.Sh SEE ALSO
10786d7f5d3SJohn Marino.Xr rmdir 2 ,
10886d7f5d3SJohn Marino.Xr unlink 2
10986d7f5d3SJohn Marino.Sh HISTORY
11086d7f5d3SJohn MarinoThe
11186d7f5d3SJohn Marino.Fn unlinkat
11286d7f5d3SJohn Marinosystem call appeared in
11386d7f5d3SJohn Marino.Dx 2.3 .
114