xref: /freebsd/lib/libsys/mq_unlink.2 (revision e2257b31)
1.\" Copyright (c) 2021 Fernando Apesteguia <fernape@FreeBSD.org>
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.Dd February 15, 2021
38.Dt MQ_UNLINK 2
39.Os
40.Sh NAME
41.Nm mq_unlink
42.Nd "mq_unlink - remove a message queue (REALTIME)"
43.Sh LIBRARY
44.Lb librt
45.Sh SYNOPSIS
46.In mqueue.h
47.Ft int
48.Fn mq_unlink "const char *name"
49.Sh DESCRIPTION
50The
51.Fn mq_unlink
52function removes the message queue named by the string
53.Fa name .
54If one or more processes have the message queue open when
55.Fn mq_unlink
56is called, destruction of the message queue will be postponed
57until all references to the message queue have been closed.
58However, the
59.Fn mq_unlink
60call need not block until all references have been closed; it may return
61immediately.
62.Pp
63After a successful call to
64.Fn mq_unlink ,
65reuse of the name will subsequently cause
66.Xr mq_open 2
67to behave as if no message queue of this name exists.
68.Sh RETURN VALUES
69.Rv -std
70.Sh ERRORS
71The
72.Fn mq_unlink
73system call
74will fail if:
75.Bl -tag -width Er
76.It Bq Er EACCESS
77Permission is denied to unlink the message queue represented by
78.Fa name .
79.It Bq Er EINVAL
80.Fa name
81is invalid.
82.It Bq Er ENAMETOOLONG
83The length of the
84.Fa name
85argument exceeds
86.Brq Dv PATH_MAX
87or
88a pathname component is longer than
89.Brq Dv NAME_MAX .
90.It Bq Er ENOENT
91The message queue does not exist.
92.It Bq Er ENOSYS
93.Xr mqueuefs 5
94module is neither loaded nor included in the kernel.
95.El
96.Sh SEE ALSO
97.Xr mq_open 2
98.Sh STANDARDS
99The
100.Fn mq_unlink
101system call conforms to
102.St -p1003.1-2004 .
103The
104.Bq Er EACCESS
105error code is an extension to the standard.
106.Sh HISTORY
107Support for POSIX message queues first appeared in
108.Fx 7.0 .
109.Sh COPYRIGHT
110Portions of this text are reprinted and reproduced in electronic form
111from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
112Portable Operating System Interface (POSIX), The Open Group Base
113Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
114Electrical and Electronics Engineers, Inc and The Open Group.
115In the event of any discrepancy between this version and the original IEEE and
116The Open Group Standard, the original IEEE and The Open Group Standard is
117the referee document.
118The original Standard can be obtained online at
119http://www.opengroup.org/unix/online.html.
120