xref: /freebsd/lib/libsys/mq_close.2 (revision 8aac90f18aef7c9eea906c3ff9a001ca7b94f375)
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.Dd November 29, 2005
39.Dt MQ_CLOSE 2
40.Os
41.Sh NAME
42.Nm mq_close
43.Nd "close a message queue (REALTIME)"
44.Sh LIBRARY
45.Lb librt
46.Sh SYNOPSIS
47.In mqueue.h
48.Ft int
49.Fn mq_close "mqd_t mqdes"
50.Sh DESCRIPTION
51The
52.Fn mq_close
53system call removes the association between the message queue descriptor,
54.Fa mqdes ,
55and its message queue.
56The results of using this message queue descriptor
57after successful return from this
58.Fn mq_close ,
59and until the return of this message queue descriptor from a subsequent
60.Fn mq_open ,
61are undefined.
62.Pp
63If the process has successfully attached a notification request to the
64message queue via this
65.Fa mqdes ,
66this attachment will be removed, and the message queue is available for
67another process to attach for notification.
68.Sh RETURN VALUES
69.Rv -std
70.Sh ERRORS
71The
72.Fn mq_close
73system call
74will fail if:
75.Bl -tag -width Er
76.It Bq Er EBADF
77The
78.Fa mqdes
79argument is not a valid message queue descriptor.
80.El
81.Sh SEE ALSO
82.Xr mq_open 2 ,
83.Xr mq_unlink 2
84.Sh STANDARDS
85The
86.Fn mq_close
87system call conforms to
88.St -p1003.1-2004 .
89.Sh HISTORY
90Support for
91.Tn POSIX
92message queues first appeared in
93.Fx 7.0 .
94.Sh COPYRIGHT
95Portions of this text are reprinted and reproduced in electronic form
96from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
97Portable Operating System Interface (POSIX), The Open Group Base
98Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
99Electrical and Electronics Engineers, Inc and The Open Group.  In the
100event of any discrepancy between this version and the original IEEE and
101The Open Group Standard, the original IEEE and The Open Group Standard is
102the referee document.  The original Standard can be obtained online at
103http://www.opengroup.org/unix/online.html.
104