示例#1
0
void *POSIX_Init(
  void *argument
)
{
  struct mq_attr         attr;
  mqd_t                  mq;

  puts( "\n\n*** POSIX MESSAGE QUEUE 02 TEST ***" );


  /* set the time of day, and print our buffer in multiple ways */

  set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );

  /* get id of this thread */

  Init_id = pthread_self();
  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );

  Allocate_majority_of_workspace(NAME_MAX);

  attr.mq_maxmsg  = MAXMSG;
  attr.mq_msgsize = MSGSIZE;
  puts("Init: mq_open - Workspace not available - ENOMEM");
  mq = mq_open( Get_Longest_Name(), O_CREAT, 0x777, &attr );
  fatal_posix_service_status_errno(mq, ENOMEM, "no workspace available");

  puts( "*** END OF POSIX MESSAGE QUEUE 02 TEST ***" );
  rtems_test_exit( 0 );

  return NULL; /* just so the compiler thinks we returned something */
}
void *POSIX_Init(
  void *argument
)
{
  int                    status;

  puts( "\n\n*** POSIX KEY 01 TEST ***" );

  /* set the time of day, and print our buffer in multiple ways */

  set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );

  /* get id of this thread */

  Init_id = pthread_self();
  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );

  Allocate_majority_of_workspace(84);

  puts("Init: pthread_key_create - ENOMEM (Workspace not available)");
  empty_line();
  status = pthread_key_create( &Key_id[0], Key_destructor );
  fatal_directive_check_status_only( status, ENOMEM, "no workspace available" );

  puts( "*** END OF POSIX KEY 01 TEST ***" );
  rtems_test_exit( 0 );

  return NULL; /* just so the compiler thinks we returned something */
}