source: rtems/testsuites/psxtests/psxkey01/init.c @ 5a556e4e

4.115
Last change on this file since 5a556e4e was 317ee8d, checked in by Sebastian Huber <sebastian.huber@…>, on 07/17/12 at 08:19:16

score: Change greedy allocation API

  • Property mode set to 100644
File size: 1.3 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.com/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
19/* forward declarations to avoid warnings */
20void *POSIX_Init(void *argument);
21void Key_destructor(void *key_data);
22
23void Key_destructor(void *key_data)
24{
25}
26
27void *POSIX_Init(
28  void *argument
29)
30{
31  int    status;
32
33  puts( "\n\n*** POSIX KEY 01 TEST ***" );
34
35  /* set the time of day, and print our buffer in multiple ways */
36
37  set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
38
39  /* get id of this thread */
40
41  Init_id = pthread_self();
42  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
43
44  rtems_workspace_greedy_allocate( NULL, 0 );
45
46  puts("Init: pthread_key_create - ENOMEM (Workspace not available)");
47  empty_line();
48  status = pthread_key_create( &Key_id[0], Key_destructor );
49  fatal_directive_check_status_only( status, ENOMEM, "no workspace available" );
50
51  puts( "*** END OF POSIX KEY 01 TEST ***" );
52  rtems_test_exit( 0 );
53
54  return NULL; /* just so the compiler thinks we returned something */
55}
Note: See TracBrowser for help on using the repository browser.