source: rtems/cpukit/posix/src/mqueueunlink.c @ 92f4671

4.104.115
Last change on this file since 92f4671 was 9184270, checked in by Joel Sherrill <joel.sherrill@…>, on 02/06/08 at 23:54:55

2008-02-06 Joel Sherrill <joel.sherrill@…>

  • posix/src/mqueueunlink.c, score/Makefile.am, score/include/rtems/score/object.h, score/inline/rtems/score/object.inl: Enhance _Objects_Namespace_remove() to handle freeing object names which are strings. All changed _Objects_Close() to call _Objects_Namespace_remove(). The resulting code was then moved from inline routines to function calls.
  • score/src/objectclose.c, score/src/objectnamespaceremove.c: New files.
  • Property mode set to 100644
File size: 2.0 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-2007.
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
43/*PAGE
44 *
45 *  15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
46 */
47
48int mq_unlink(
49  const char *name
50)
51{
52  int                                   status;
53  register POSIX_Message_queue_Control *the_mq;
54  Objects_Id                            the_mq_id;
55
56  _Thread_Disable_dispatch();
57
58  status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
59   if ( status != 0 ) {
60    _Thread_Enable_dispatch();
61    rtems_set_errno_and_return_minus_one( status );
62   }
63
64  the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
65    &_POSIX_Message_queue_Information,
66    _Objects_Get_index( the_mq_id )
67  );
68
69  the_mq->linked = FALSE;
70  _POSIX_Message_queue_Namespace_remove( the_mq );
71  _POSIX_Message_queue_Delete( the_mq );
72
73  _Thread_Enable_dispatch();
74  return 0;
75}
Note: See TracBrowser for help on using the repository browser.