source: rtems/cpukit/posix/src/mqueueunlink.c @ ce19f1fa

4.104.114.95
Last change on this file since ce19f1fa was ce19f1fa, checked in by Joel Sherrill <joel.sherrill@…>, on 01/23/08 at 22:57:43

2008-01-23 Joel Sherrill <joel.sherrill@…>

  • itron/include/rtems/itron/object.h, itron/src/cre_tsk.c, libblock/src/show_bdbuf.c, libmisc/capture/capture-cli.c, libmisc/capture/capture.c, libmisc/monitor/mon-manager.c, libmisc/stackchk/check.c, posix/src/condinit.c, posix/src/keycreate.c, posix/src/mqueuecreatesupp.c, posix/src/mqueuedeletesupp.c, posix/src/mqueuenametoid.c, posix/src/mqueueopen.c, posix/src/mqueueunlink.c, posix/src/mutexinit.c, posix/src/pbarrierinit.c, posix/src/prwlockinit.c, posix/src/pspininit.c, posix/src/pthreadcreate.c, posix/src/pthreadexit.c, posix/src/semaphorecreatesupp.c, posix/src/semaphorenametoid.c, posix/src/timercreate.c, rtems/src/barrierident.c, rtems/src/dpmemident.c, rtems/src/msgqident.c, rtems/src/partident.c, rtems/src/ratemonident.c, rtems/src/regionident.c, rtems/src/semident.c, rtems/src/taskident.c, rtems/src/timerident.c, sapi/src/extensionident.c, score/Makefile.am, score/include/rtems/score/object.h, score/inline/rtems/score/object.inl, score/src/apimutexallocate.c, score/src/objectextendinformation.c, score/src/objectgetnameasstring.c, score/src/objectmp.c, score/src/objectnametoid.c: Convert the Objects_Name type from a simple type to a union of an unsigned 32 bit integer and a pointer. This should help eliminate weird casts between u32 and pointers in various places. The APIs now have to explicitly call _u32 or _string versions of helper routines. This should also simplify things and eliminate the need for ugly casts in some cases.
  • score/src/objectclearname.c, score/src/objectcomparenameraw.c, score/src/objectcomparenamestring.c, score/src/objectcopynameraw.c, score/src/objectcopynamestring.c: Removed.
  • 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-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  if ( the_mq->Object.name.name_p )
71    _Workspace_Free( (void *)the_mq->Object.name.name_p );
72  _POSIX_Message_queue_Namespace_remove( the_mq );
73  _POSIX_Message_queue_Delete( the_mq );
74
75  _Thread_Enable_dispatch();
76  return 0;
77}
Note: See TracBrowser for help on using the repository browser.