1.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice(s), this list of conditions and the following disclaimer as
9.\"    the first lines of this file unmodified other than the possible
10.\"    addition of one or more copyright notices.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice(s), this list of conditions and the following disclaimer in
13.\"    the documentation and/or other materials provided with the
14.\"    distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
17.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
20.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\"
28.\" Portions of this text are reprinted and reproduced in electronic form
29.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
30.\" Portable Operating System Interface (POSIX), The Open Group Base
31.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
32.\" Electrical and Electronics Engineers, Inc and The Open Group.  In the
33.\" event of any discrepancy between this version and the original IEEE and
34.\" The Open Group Standard, the original IEEE and The Open Group Standard is
35.\" the referee document.  The original Standard can be obtained online at
36.\"	http://www.opengroup.org/unix/online.html.
37.\"
38.\" $FreeBSD: stable/10/lib/libc/sys/mq_close.2 208914 2010-06-08 16:48:59Z uqs $
39.\"
40.Dd November 29, 2005
41.Dt MQ_CLOSE 2
42.Os
43.Sh NAME
44.Nm mq_close
45.Nd "close a message queue (REALTIME)"
46.Sh LIBRARY
47.Lb librt
48.Sh SYNOPSIS
49.In mqueue.h
50.Ft int
51.Fn mq_close "mqd_t mqdes"
52.Sh DESCRIPTION
53The
54.Fn mq_close
55system call removes the association between the message queue descriptor,
56.Fa mqdes ,
57and its message queue.
58The results of using this message queue descriptor
59after successful return from this
60.Fn mq_close ,
61and until the return of this message queue descriptor from a subsequent
62.Fn mq_open ,
63are undefined.
64.Pp
65If the process has successfully attached a notification request to the
66message queue via this
67.Fa mqdes ,
68this attachment will be removed, and the message queue is available for
69another process to attach for notification.
70.Sh RETURN VALUES
71.Rv -std
72.Sh ERRORS
73The
74.Fn mq_close
75system call
76will fail if:
77.Bl -tag -width Er
78.It Bq Er EBADF
79The
80.Fa mqdes
81argument is not a valid message queue descriptor.
82.El
83.Sh SEE ALSO
84.Xr mq_open 2 ,
85.Xr mq_unlink 2
86.Sh STANDARDS
87The
88.Fn mq_close
89system call conforms to
90.St -p1003.1-2004 .
91.Sh HISTORY
92Support for
93.Tn POSIX
94message queues first appeared in
95.Fx 7.0 .
96.Sh COPYRIGHT
97Portions of this text are reprinted and reproduced in electronic form
98from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
99Portable Operating System Interface (POSIX), The Open Group Base
100Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
101Electrical and Electronics Engineers, Inc and The Open Group.  In the
102event of any discrepancy between this version and the original IEEE and
103The Open Group Standard, the original IEEE and The Open Group Standard is
104the referee document.  The original Standard can be obtained online at
105http://www.opengroup.org/unix/online.html.
106