source: rtems/cpukit/posix/src/mqueuedeletesupp.c @ 59efe76b

4.104.115
Last change on this file since 59efe76b was 59efe76b, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 29, 2009 at 8:26:42 PM

2009-07-29 Joel Sherrill <joel.sherrill@…>

  • posix/src/mqueuedeletesupp.c: Mark unreachable section as RTEMS_DEBUG.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  NOTE:  The structure of the routines is identical to that of POSIX
3 *         Message_queues to leave the option of having unnamed message
4 *         queues at a future date.  They are currently not part of the
5 *         POSIX standard but unnamed message_queues are.  This is also
6 *         the reason for the apparently unnecessary tracking of
7 *         the process_shared attribute.  [In addition to the fact that
8 *         it would be trivial to add pshared to the mq_attr structure
9 *         and have process private message queues.]
10 *
11 *         This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open
12 *         time.
13 *
14 *  COPYRIGHT (c) 1989-2009.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.com/license/LICENSE.
20 *
21 *  $Id$
22 */
23
24#if HAVE_CONFIG_H
25#include "config.h"
26#endif
27
28#include <stdarg.h>
29
30#include <pthread.h>
31#include <limits.h>
32#include <errno.h>
33#include <fcntl.h>
34#include <mqueue.h>
35
36#include <rtems/system.h>
37#include <rtems/score/watchdog.h>
38#include <rtems/score/wkspace.h>
39#include <rtems/seterr.h>
40#include <rtems/posix/mqueue.h>
41#include <rtems/posix/time.h>
42#if defined(RTEMS_DEBUG)
43  #include <rtems/bspIo.h>
44#endif
45
46/*PAGE
47 *
48 *  _POSIX_Message_queue_Delete
49 */
50
51void _POSIX_Message_queue_Delete(
52  POSIX_Message_queue_Control *the_mq
53)
54{
55  if ( !the_mq->linked && !the_mq->open_count ) {
56      Objects_Control *the_object = &the_mq->Object;
57
58      #if defined(RTEMS_DEBUG)
59        /*
60         *  the name memory will have been freed by unlink.
61         */
62        if ( the_object->name.name_p ) {
63          printk(
64            "POSIX MQ name (%p) not freed by unlink\n",
65            (void *)the_object->name.name_p
66          );
67          _Workspace_Free( (void *)the_object->name.name_p );
68        }
69      #endif
70
71      _Objects_Close( &_POSIX_Message_queue_Information, the_object );
72
73      _CORE_message_queue_Close(
74        &the_mq->Message_queue,
75        NULL,        /* no MP support */
76        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
77      );
78
79    _POSIX_Message_queue_Free( the_mq );
80
81  }
82}
Note: See TracBrowser for help on using the repository browser.