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

4.115
Last change on this file since 77998753 was 77998753, checked in by Sebastian Huber <sebastian.huber@…>, on 02/17/12 at 15:54:23

Use alternative API

Replaced Allocate_majority_of_workspace() with
rtems_workspace_allocate(). Replaced Allocate_majority_of_heap() with
rtems_heap_greedy_allocate().

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