source: rtems/testsuites/psxtests/psxmsgq04/init.c @ 0376d08

4.104.11
Last change on this file since 0376d08 was 0376d08, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 29, 2009 at 8:27:27 PM

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

  • psxmsgq04/init.c: Add call to mq_unlink.
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#include <pmacros.h>
13#include <unistd.h>
14#include <errno.h>
15#include <tmacros.h>
16
17#include <fcntl.h>           /* For O_* constants */
18#include <sys/stat.h>        /* For mode constants */
19#include <mqueue.h>
20
21#include "test_support.h"
22
23void *POSIX_Init(
24  void *argument
25)
26{
27  struct mq_attr   attr;
28  mqd_t            Queue;
29  int              sc;
30
31  puts( "\n\n*** POSIX MESSAGE QUEUE TEST 4 ***" );
32
33  attr.mq_maxmsg  = 1;
34  attr.mq_msgsize = sizeof(int);
35
36  puts( "Init - Open message queue" );
37  Queue = mq_open( "Queue", O_CREAT | O_RDWR, 0x777, &attr );
38  if ( Queue == (-1) )
39    perror( "mq_open failed" );
40  assert( Queue != (-1) );
41
42  puts( "Init - Unlink message queue" );
43  sc = mq_unlink( "Queue" );
44  if ( sc != 0 )
45    perror( "mq_unlink failed" );
46  assert( sc == 0 );
47
48  puts( "Init - Close message queue" );
49  sc = mq_close( Queue );
50  if ( sc != 0 )
51    perror( "mq_close failed" );
52  assert( sc == 0 );
53
54  puts( "*** END OF POSIX MESSAGE QUEUE TEST 4 ***" );
55  rtems_test_exit( 0 );
56
57  return NULL; /* just so the compiler thinks we returned something */
58}
59
60/* configuration information */
61
62#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
63#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
64
65#define CONFIGURE_POSIX_INIT_THREAD_TABLE
66
67#define CONFIGURE_MAXIMUM_POSIX_THREADS        1
68#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
69
70#define CONFIGURE_POSIX_INIT_THREAD_TABLE
71
72#define CONFIGURE_INIT
73#include <rtems/confdefs.h>
74/* end of include file */
Note: See TracBrowser for help on using the repository browser.