source: rtems/testsuites/psxtests/psxmsgq02/init.c @ 39615f4

4.104.115
Last change on this file since 39615f4 was 39615f4, checked in by Ralf Corsepius <ralf.corsepius@…>, on 10/27/09 at 14:10:54

Use PRIxpthread_t to print pthread_t's.

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