xref: /netbsd-src/lib/librt/mq_unlink.3 (revision a973b3648672c82fea3adf859ae478382ab03e9d)
1.\"	$NetBSD: mq_unlink.3,v 1.4 2012/03/15 19:04:47 njoly Exp $
2.\"
3.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
4.\"
5.Dd June 7, 2009
6.Dt MQ_UNLINK 3
7.Os
8.Sh NAME
9.Nm mq_unlink
10.Nd remove a message queue (REALTIME)
11.Sh LIBRARY
12.Lb librt
13.Sh SYNOPSIS
14.In mqueue.h
15.Ft int
16.Fn mq_unlink "const char *name"
17.Sh DESCRIPTION
18The
19.Fn mq_unlink
20function removes the message queue named by the pathname
21.Fa name .
22After a successful call to
23.Fn mq_unlink
24with
25.Fa name ,
26a call to
27.Xr mq_open 3
28with
29.Fa name
30fails if the flag
31.Dv O_CREAT
32is not set in
33.Fa flags .
34If one or more processes have the message queue open when
35.Fn mq_unlink
36is called, destruction of the message queue will be postponed until
37all references to the message queue have been closed.
38.Pp
39Calls to
40.Xr mq_open 3
41to recreate the message queue may fail until the message queue is
42actually removed.
43However, the
44.Fn mq_unlink
45call need not block until all references have been closed;
46it may return immediately.
47.Sh RETURN VALUES
48Upon successful completion, the function returns a value of zero.
49Otherwise, the named message queue will be unchanged by this function call,
50and the function returns a value of \-1 and sets the global variable
51.Va errno
52to indicate the error.
53.Sh ERRORS
54The
55.Fn mq_unlink
56function fails if:
57.Bl -tag -width Er
58.It Bq Er EACCES
59Permission is denied to unlink the named message queue.
60.It Bq Er ENAMETOOLONG
61The length of the name argument exceeds
62.Brq Dv PATH_MAX
63or a pathname
64component is longer than
65.Brq Dv NAME_MAX .
66.It Bq Er ENOENT
67The named message queue does not exist.
68.El
69.Sh SEE ALSO
70.Xr mq 3 ,
71.Xr mq_open 3
72.Sh STANDARDS
73This function conforms to the
74.St -p1003.1-2001
75standard.
76.Sh HISTORY
77The
78.Fn mq_unlink
79function first appeared in
80.Nx 5.0 .
81.Sh COPYRIGHT
82Portions of this text are reprinted and reproduced in electronic form
83from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
84-- Portable Operating System Interface (POSIX), The Open Group Base
85Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
86Electrical and Electronics Engineers, Inc and The Open Group.
87In the
88event of any discrepancy between this version and the original IEEE and
89The Open Group Standard, the original IEEE and The Open Group Standard
90is the referee document.
91The original Standard can be obtained online at
92.Lk http://www.opengroup.org/unix/online.html .
93