Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/unlink.2
Show All 22 Lines | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)unlink.2 8.1 (Berkeley) 6/4/93 | .\" @(#)unlink.2 8.1 (Berkeley) 6/4/93 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd September 23, 2020 | .Dd February 23, 2021 | ||||
.Dt UNLINK 2 | .Dt UNLINK 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm unlink , | .Nm unlink , | ||||
.Nm unlinkat , | .Nm unlinkat , | ||||
.Nm funlinkat | .Nm funlinkat | ||||
.Nd remove directory entry | .Nd remove directory entry | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
.In fcntl.h : | .In fcntl.h : | ||||
.Bl -tag -width indent | .Bl -tag -width indent | ||||
.It Dv AT_REMOVEDIR | .It Dv AT_REMOVEDIR | ||||
Remove the directory entry specified by | Remove the directory entry specified by | ||||
.Fa fd | .Fa fd | ||||
and | and | ||||
.Fa path | .Fa path | ||||
as a directory, not a normal file. | as a directory, not a normal file. | ||||
.It Dv AT_BENEATH | |||||
Only unlink files and directories which are beneath of the topping | |||||
directory. | |||||
See the description of the | |||||
.Dv O_BENEATH | |||||
flag in the | |||||
.Xr open 2 | |||||
manual page. | |||||
.It Dv AT_RESOLVE_BENEATH | .It Dv AT_RESOLVE_BENEATH | ||||
Only walks paths below the topping directory. | Only walks paths below the directory specified by the | ||||
.Ar fd | |||||
descriptor. | |||||
See the description of the | See the description of the | ||||
.Dv O_RESOLVE_BENEATH | .Dv O_RESOLVE_BENEATH | ||||
flag in the | flag in the | ||||
.Xr open 2 | .Xr open 2 | ||||
manual page. | manual page. | ||||
.El | .El | ||||
.Pp | .Pp | ||||
If | If | ||||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | |||||
.Dv AT_FDCWD | .Dv AT_FDCWD | ||||
nor a file descriptor associated with a directory. | nor a file descriptor associated with a directory. | ||||
.It Bq Er ENOTCAPABLE | .It Bq Er ENOTCAPABLE | ||||
.Fa path | .Fa path | ||||
is an absolute path, | is an absolute path, | ||||
or contained a ".." component leading to a | or contained a ".." component leading to a | ||||
directory outside of the directory hierarchy specified by | directory outside of the directory hierarchy specified by | ||||
.Fa fd , | .Fa fd , | ||||
and the process is in capability mode. | and the process is in capability mode or the | ||||
.It Bq Er ENOTCAPABLE | .Dv AT_RESOLVE_BENEATH | ||||
The | flag was specified. | ||||
.Dv AT_BENEATH | |||||
flag was provided to | |||||
.Fn unlinkat , | |||||
and the absolute | |||||
.Fa path | |||||
does not have its tail fully contained under the topping directory, | |||||
or the relative | |||||
.Fa path | |||||
escapes it. | |||||
.El | .El | ||||
.Pp | .Pp | ||||
In addition to the errors returned by | In addition to the errors returned by | ||||
.Fn unlinkat , | .Fn unlinkat , | ||||
.Fn funlinkat | .Fn funlinkat | ||||
may fail if: | may fail if: | ||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||
.It Bq Er EDEADLK | .It Bq Er EDEADLK | ||||
Show All 31 Lines |