xref: /freebsd-14.2/lib/libc/sys/mq_unlink.2 (revision bbd421cd)
1.\" Copyright (c) 2021 Fernando Apesteguia <[email protected]>
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions
5.\" are met:
6.\" 1. Redistributions of source code must retain the above copyright
7.\"    notice(s), this list of conditions and the following disclaimer as
8.\"    the first lines of this file unmodified other than the possible
9.\"    addition of one or more copyright notices.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice(s), this list of conditions and the following disclaimer in
12.\"    the documentation and/or other materials provided with the
13.\"    distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
16.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
19.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\" Portions of this text are reprinted and reproduced in electronic form
28.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
29.\" Portable Operating System Interface (POSIX), The Open Group Base
30.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
31.\" Electrical and Electronics Engineers, Inc and The Open Group.  In the
32.\" event of any discrepancy between this version and the original IEEE and
33.\" The Open Group Standard, the original IEEE and The Open Group Standard is
34.\" the referee document.  The original Standard can be obtained online at
35.\"	http://www.opengroup.org/unix/online.html.
36.\"
37.\" $FreeBSD$
38.\"
39.Dd February 15, 2021
40.Dt MQ_UNLINK 2
41.Os
42.Sh NAME
43.Nm mq_unlink
44.Nd "mq_unlink - remove a message queue (REALTIME)"
45.Sh LIBRARY
46.Lb librt
47.Sh SYNOPSIS
48.In mqueue.h
49.Ft int
50.Fn mq_unlink "const char *name"
51.Sh DESCRIPTION
52The
53.Fn mq_unlink
54function removes the message queue named by the string
55.Fa name .
56If one or more processes have the message queue open when
57.Fn mq_unlink
58is called, destruction of the message queue will be postponed
59until all references to the message queue have been closed.
60However, the
61.Fn mq_unlink
62call need not block until all references have been closed; it may return
63immediately.
64.Pp
65After a successful call to
66.Fn mq_unlink ,
67reuse of the name will subsequently cause
68.Xr mq_open 2
69to behave as if no message queue of this name exists.
70.Sh RETURN VALUES
71.Rv -std
72.Sh ERRORS
73The
74.Fn mq_unlink
75system call
76will fail if:
77.Bl -tag -width Er
78.It Bq Er EACCESS
79Permission is denied to unlink the message queue represented by
80.Fa name .
81.It Bq Er EINVAL
82.Fa name
83is invalid.
84.It Bq Er ENAMETOOLONG
85The length of the
86.Fa name
87argument exceeds
88.Brq Dv PATH_MAX
89or
90a pathname component is longer than
91.Brq Dv NAME_MAX .
92.It Bq Er ENOENT
93The message queue does not exist.
94.It Bq Er ENOSYS
95.Xr mqueuefs 5
96module is neither loaded nor included in the kernel.
97.El
98.Sh SEE ALSO
99.Xr mq_open 2
100.Sh STANDARDS
101The
102.Fn mq_unlink
103system call conforms to
104.St -p1003.1-2004 .
105The
106.Bq Er EACCESS
107error code is an extension to the standard.
108.Sh HISTORY
109Support for POSIX message queues first appeared in
110.Fx 7.0 .
111.Sh COPYRIGHT
112Portions of this text are reprinted and reproduced in electronic form
113from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
114Portable Operating System Interface (POSIX), The Open Group Base
115Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
116Electrical and Electronics Engineers, Inc and The Open Group.
117In the event of any discrepancy between this version and the original IEEE and
118The Open Group Standard, the original IEEE and The Open Group Standard is
119the referee document.
120The original Standard can be obtained online at
121http://www.opengroup.org/unix/online.html.
122