source: rtems/cpukit/posix/src/mqueuedeletesupp.c @ 5cc6bf4

5
Last change on this file since 5cc6bf4 was 5cc6bf4, checked in by Sebastian Huber <sebastian.huber@…>, on 04/17/16 at 13:47:33

score: Simplify _CORE_message_queue_Close()

Drop status parameter since each caller used
CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED.

Remove superfluous _CORE_message_queue_Flush().

  • 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#if defined(RTEMS_DEBUG)
35  #include <rtems/bspIo.h>
36#endif
37
38void _POSIX_Message_queue_Delete(
39  POSIX_Message_queue_Control *the_mq
40)
41{
42  if ( !the_mq->linked && !the_mq->open_count ) {
43      Objects_Control *the_object = &the_mq->Object;
44
45      #if defined(RTEMS_DEBUG)
46        /*
47         *  the name memory will have been freed by unlink.
48         */
49        if ( the_object->name.name_p ) {
50          printk(
51            "POSIX MQ name (%p) not freed by unlink\n",
52            (void *)the_object->name.name_p
53          );
54          _Workspace_Free( (void *)the_object->name.name_p );
55        }
56      #endif
57
58      _Objects_Close( &_POSIX_Message_queue_Information, the_object );
59
60      _CORE_message_queue_Close(
61        &the_mq->Message_queue,
62        NULL,        /* no MP support */
63        0
64      );
65
66    _POSIX_Message_queue_Free( the_mq );
67
68  }
69}
Note: See TracBrowser for help on using the repository browser.