source: rtems/cpukit/posix/src/mqueueunlink.c @ 21789a21

5
Last change on this file since 21789a21 was 21789a21, checked in by Sebastian Huber <sebastian.huber@…>, on 07/28/15 at 12:45:42

score: Rename _POSIX_Absolute_timeout_to_ticks()

Rename _POSIX_Absolute_timeout_to_ticks() to
_TOD_Absolute_timeout_to_ticks() and move it to the score directory.
Delete empty <rtems/posix/time.h>.

  • Property mode set to 100644
File size: 1.6 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-2014.
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
35/*
36 *  15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
37 */
38
39int mq_unlink(
40  const char *name
41)
42{
43  int                                   status;
44  POSIX_Message_queue_Control          *the_mq;
45  Objects_Id                            the_mq_id;
46  size_t                                name_len;
47
48  _Objects_Allocator_lock();
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    _Objects_Allocator_unlock();
55    rtems_set_errno_and_return_minus_one( status );
56   }
57
58  the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
59    &_POSIX_Message_queue_Information,
60    _Objects_Get_index( the_mq_id )
61  );
62
63  the_mq->linked = false;
64  _POSIX_Message_queue_Namespace_remove( the_mq );
65  _POSIX_Message_queue_Delete( the_mq );
66
67  _Thread_Enable_dispatch();
68   _Objects_Allocator_unlock();
69  return 0;
70}
Note: See TracBrowser for help on using the repository browser.