source: rtems/testsuites/psxtests/psxmsgq02/init.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
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.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#define CONFIGURE_INIT
15#include "system.h"
16#include <errno.h>
17#include "tmacros.h"
18#include <mqueue.h>
19#include <sched.h>
20#include <fcntl.h>
21#include <time.h>
22#include <tmacros.h>
23#include <signal.h>   /* signal facilities */
24#include "test_support.h"
25
26/* forward declarations to avoid warnings */
27void *POSIX_Init(void *argument);
28
29pthread_t        Init_id;
30
31void *POSIX_Init(
32  void *argument
33)
34{
35  struct mq_attr         attr;
36  mqd_t                  mq;
37
38  puts( "\n\n*** POSIX MESSAGE QUEUE 02 TEST ***" );
39
40
41  /* set the time of day, and print our buffer in multiple ways */
42
43  set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
44
45  /* get id of this thread */
46
47  Init_id = pthread_self();
48  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
49
50  rtems_workspace_greedy_allocate( NULL, 0 );
51
52  attr.mq_maxmsg  = MAXMSG;
53  attr.mq_msgsize = MSGSIZE;
54  puts("Init: mq_open - Workspace not available - ENOMEM");
55  mq = mq_open( Get_Longest_Name(), O_CREAT, 0x777, &attr );
56  fatal_posix_service_status_errno(mq, ENOMEM, "no workspace available");
57
58  puts( "*** END OF POSIX MESSAGE QUEUE 02 TEST ***" );
59  rtems_test_exit( 0 );
60
61  return NULL; /* just so the compiler thinks we returned something */
62}
Note: See TracBrowser for help on using the repository browser.