File indexing completed on 2025-05-11 08:24:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #ifdef HAVE_CONFIG_H
0033 #include "config.h"
0034 #endif
0035
0036 #include <pmacros.h>
0037 #include "tmacros.h"
0038
0039 #include <unistd.h>
0040 #include <errno.h>
0041 #include <sched.h>
0042 #include <time.h> /* time facilities */
0043 #include <stdio.h> /* console facilities */
0044
0045 const char rtems_test_name[] = "PSXTIMER FACE 1";
0046
0047 static void *POSIX_Init (
0048 void *argument
0049 )
0050
0051 {
0052 struct sigevent event;
0053 int status;
0054 timer_t timer;
0055
0056
0057
0058
0059
0060 event.sigev_notify = SIGEV_SIGNAL;
0061 event.sigev_signo = SIGUSR1;
0062
0063 TEST_BEGIN();
0064
0065
0066
0067
0068
0069 puts( "timer_create - CLOCK_REALTIME forbidden - EPERM" );
0070 status = timer_create( CLOCK_REALTIME, &event, &timer );
0071 fatal_posix_service_status_errno( status, EPERM, "not allowed" );
0072
0073
0074
0075
0076
0077 puts( "timer_create - CLOCK_PROCESS_CPUTIME_ID not allowed - EINVAL" );
0078 status = timer_create( CLOCK_PROCESS_CPUTIME_ID, &event, &timer );
0079 fatal_posix_service_status_errno( status, EINVAL, "invalid clock" );
0080
0081
0082
0083
0084
0085 puts( "timer_create - OK" );
0086 status = timer_create( CLOCK_MONOTONIC, &event, &timer );
0087 posix_service_failed( status, "timer_create OK" );
0088
0089
0090
0091
0092 puts( "timer_delete - OK" );
0093 status = timer_delete( timer );
0094 posix_service_failed( status, "timer_delete ok" );
0095
0096
0097
0098 puts( "timer_create - CLOCK_MONOTONIC is allowed - OK" );
0099 status = timer_create( CLOCK_MONOTONIC, &event, &timer );
0100 posix_service_failed( status, "timer_create ok" );
0101
0102 TEST_END();
0103 rtems_test_exit (0);
0104 }
0105
0106
0107
0108 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
0109 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
0110
0111 #define CONFIGURE_POSIX_INIT_THREAD_TABLE
0112
0113 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
0114
0115 #define CONFIGURE_MAXIMUM_POSIX_THREADS 1
0116 #define CONFIGURE_MAXIMUM_POSIX_TIMERS 1
0117
0118 #define CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
0119
0120 #define CONFIGURE_INIT
0121 #include <rtems/confdefs.h>
0122
0123