source: rtems/cpukit/posix/src/mqueueunlink.c @ 972a5c5f

4.115
Last change on this file since 972a5c5f was 972a5c5f, checked in by Sebastian Huber <sebastian.huber@…>, on 07/18/13 at 13:12:05

posix: Create message queue implementation header

Move implementation specific parts of mqueue.h and mqueue.inl into new
header file mqueueimpl.h. The mqueue.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * @file
3 *
4 * @brief Remove a Message Queue
5 * @ingroup POSIX_MQUEUE Message Queues
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <stdarg.h>
22
23#include <pthread.h>
24#include <limits.h>
25#include <errno.h>
26#include <fcntl.h>
27#include <mqueue.h>
28
29#include <rtems/system.h>
30#include <rtems/score/watchdog.h>
31#include <rtems/score/wkspace.h>
32#include <rtems/seterr.h>
33#include <rtems/posix/mqueueimpl.h>
34#include <rtems/posix/time.h>
35
36/*
37 *  15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
38 */
39
40int mq_unlink(
41  const char *name
42)
43{
44  int                                   status;
45  register POSIX_Message_queue_Control *the_mq;
46  Objects_Id                            the_mq_id;
47  size_t                                name_len;
48
49  _Thread_Disable_dispatch();
50
51  status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id, &name_len );
52   if ( status != 0 ) {
53    _Thread_Enable_dispatch();
54    rtems_set_errno_and_return_minus_one( status );
55   }
56
57  the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
58    &_POSIX_Message_queue_Information,
59    _Objects_Get_index( the_mq_id )
60  );
61
62  the_mq->linked = false;
63  _POSIX_Message_queue_Namespace_remove( the_mq );
64  _POSIX_Message_queue_Delete( the_mq );
65
66  _Thread_Enable_dispatch();
67  return 0;
68}
Note: See TracBrowser for help on using the repository browser.