source: rtems/cpukit/posix/src/mqueuedeletesupp.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief POSIX Delete Message Queue
5 *  @ingroup POSIX_MQUEUE
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2009.
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.org/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#if defined(RTEMS_DEBUG)
36  #include <rtems/bspIo.h>
37#endif
38
39void _POSIX_Message_queue_Delete(
40  POSIX_Message_queue_Control *the_mq
41)
42{
43  if ( !the_mq->linked && !the_mq->open_count ) {
44      Objects_Control *the_object = &the_mq->Object;
45
46      #if defined(RTEMS_DEBUG)
47        /*
48         *  the name memory will have been freed by unlink.
49         */
50        if ( the_object->name.name_p ) {
51          printk(
52            "POSIX MQ name (%p) not freed by unlink\n",
53            (void *)the_object->name.name_p
54          );
55          _Workspace_Free( (void *)the_object->name.name_p );
56        }
57      #endif
58
59      _Objects_Close( &_POSIX_Message_queue_Information, the_object );
60
61      _CORE_message_queue_Close(
62        &the_mq->Message_queue,
63        NULL,        /* no MP support */
64        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
65      );
66
67    _POSIX_Message_queue_Free( the_mq );
68
69  }
70}
Note: See TracBrowser for help on using the repository browser.