readv.2, pthread_tryjoin_np.3, stailq.3, strlen.3, wcslen.3: Arrange .SH sections...
[man-pages.git] / man3 / mq_close.3
blob8a84e9b0ded60983cc1d30e22422d34326f94592
1 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH MQ_CLOSE 3 2021-03-22 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 mq_close \- close a message queue descriptor
28 .SH SYNOPSIS
29 .nf
30 .B #include <mqueue.h>
31 .PP
32 .BI "int mq_close(mqd_t " mqdes );
33 .fi
34 .PP
35 Link with \fI\-lrt\fP.
36 .SH DESCRIPTION
37 .BR mq_close ()
38 closes the message queue descriptor
39 .IR mqdes .
40 .PP
41 If the calling process has attached a notification request (see
42 .RB ( mq_notify (3))
43 to this message queue via
44 .IR mqdes ,
45 then this request is removed,
46 and another process can now attach a notification request.
47 .SH RETURN VALUE
48 On success
49 .BR mq_close ()
50 returns 0; on error, \-1 is returned, with
51 .I errno
52 set to indicate the error.
53 .SH ERRORS
54 .TP
55 .B EBADF
56 The message queue descriptor specified in
57 .I mqdes
58 is invalid.
59 .SH ATTRIBUTES
60 For an explanation of the terms used in this section, see
61 .BR attributes (7).
62 .ad l
63 .nh
64 .TS
65 allbox;
66 lbx lb lb
67 l l l.
68 Interface       Attribute       Value
70 .BR mq_close ()
71 T}      Thread safety   MT-Safe
72 .TE
73 .hy
74 .ad
75 .sp 1
76 .SH CONFORMING TO
77 POSIX.1-2001, POSIX.1-2008.
78 .SH NOTES
79 All open message queues are automatically closed on process termination,
80 or upon
81 .BR execve (2).
82 .SH SEE ALSO
83 .BR mq_getattr (3),
84 .BR mq_notify (3),
85 .BR mq_open (3),
86 .BR mq_receive (3),
87 .BR mq_send (3),
88 .BR mq_unlink (3),
89 .BR mq_overview (7)