summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxsem01/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-22 15:37:54 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-22 15:37:54 +0000
commit17e3808dd59cc7843f23a620780e01a2e5f27bb7 (patch)
tree4cf8f8a6ad114704bd5530cc1e33f69ba65f3336 /testsuites/psxtests/psxsem01/init.c
parent2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-17e3808dd59cc7843f23a620780e01a2e5f27bb7.tar.bz2
2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxsem01/Makefile.am, psxsem01/init.c: Much clean up. * psxsem01/system.h: Removed.
Diffstat (limited to 'testsuites/psxtests/psxsem01/init.c')
-rw-r--r--testsuites/psxtests/psxsem01/init.c42
1 files changed, 36 insertions, 6 deletions
diff --git a/testsuites/psxtests/psxsem01/init.c b/testsuites/psxtests/psxsem01/init.c
index f57ba05b39..5f067bb16f 100644
--- a/testsuites/psxtests/psxsem01/init.c
+++ b/testsuites/psxtests/psxsem01/init.c
@@ -1,11 +1,25 @@
-#define CONFIGURE_INIT
-#include "system.h"
+/*
+ * COPYRIGHT (c) 1989-2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
#include <sched.h>
+#include <semaphore.h>
+#include <errno.h>
#include <fcntl.h>
#include <time.h>
#include <tmacros.h>
+#include <pmacros.h>
#include "test_support.h"
+#define MAX_SEMS 10
+
void *POSIX_Init(
void *argument
)
@@ -13,7 +27,7 @@ void *POSIX_Init(
int status;
int value;
int i;
- sem_t sems[CONFIGURE_MAXIMUM_POSIX_SEMAPHORES];
+ sem_t sems[MAX_SEMS];
sem_t sem2;
sem_t *n_sem1;
sem_t *n_sem2;
@@ -28,7 +42,7 @@ void *POSIX_Init(
fatal_posix_service_status( errno, EINVAL, "sem_init errorno EINVAL" );
puts( "Init: sem_init - SUCCESSFUL" );
- for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
+ for (i = 0; i < MAX_SEMS; i++) {
status = sem_init(&sems[i], 0, i);
sprintf(failure_msg, "sem_init %d", i );
fatal_posix_service_status( status, 0, failure_msg);
@@ -44,7 +58,7 @@ void *POSIX_Init(
fatal_posix_service_status( errno, ENOSYS, "sem_init errno set to ENOSYS");
puts( "Init: sem_getvalue - SUCCESSFUL ");
- for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
+ for (i = 0; i < MAX_SEMS; i++) {
status = sem_getvalue(&sems[i], &value);
sprintf( failure_msg, "sem_getvalue %d", i );
fatal_posix_service_status( status, 0, failure_msg );
@@ -143,7 +157,7 @@ void *POSIX_Init(
fatal_posix_service_status( errno, EINVAL, "sem_post errno EINVAL");
puts( "Init: sem_destroy - SUCCESSFUL" );
- for (i = 1; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
+ for (i = 1; i < MAX_SEMS; i++) {
status = sem_destroy(&sems[i]);
sprintf( failure_msg, "sem_destroy %d", i );
fatal_posix_service_status( status, 0, failure_msg );
@@ -287,3 +301,19 @@ void *POSIX_Init(
return NULL; /* just so the compiler thinks we returned something */
}
+
+/* configuration information */
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES MAX_SEMS
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
+ (RTEMS_MINIMUM_STACK_SIZE * 4)
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>