diff --git a/arch/c5471/src/up_initialize.c b/arch/c5471/src/up_initialize.c
index 8b85ecd719bc55710a532b416d36f2accb91d332..bae36548bbe28cdd591503ec39195af83290e543 100644
--- a/arch/c5471/src/up_initialize.c
+++ b/arch/c5471/src/up_initialize.c
@@ -41,6 +41,7 @@
 #include <sys/types.h>
 #include <debug.h>
 #include <nuttx/arch.h>
+#include <nuttx/fs.h>
 #include "up_internal.h"
 
 /************************************************************
diff --git a/arch/c5471/src/up_internal.h b/arch/c5471/src/up_internal.h
index 88ed459f3cef35d06e942de0f5bd96f0d049b0db..b1256130e364bdf5fb6fce8deeadda9cece3138c 100644
--- a/arch/c5471/src/up_internal.h
+++ b/arch/c5471/src/up_internal.h
@@ -110,6 +110,10 @@ extern void up_serialinit(void);
 
 extern void up_timerinit(void);
 
+/* Defined in up_irq.c */
+
+extern void up_maskack_irq(int irq);
+
 #endif /* __ASSEMBLY__ */
 
 #endif  /* __UP_INTERNAL_H */
diff --git a/examples/ostest/cancel.c b/examples/ostest/cancel.c
index d52c596fcfdc0f42d4625f892164f254664a1018..1fda4166c90f9379c9d341eeb3574084f764fea1 100644
--- a/examples/ostest/cancel.c
+++ b/examples/ostest/cancel.c
@@ -48,24 +48,24 @@ static void *thread_waiter(void *parameter)
 
   /* Take the mutex */
 
-  printf("%s: Taking mutex\n", __FUNCTION__);
+  printf("thread_waiter: Taking mutex\n");
   status = pthread_mutex_lock(&mutex);
   if (status != 0)
     {
-       printf("%s: ERROR pthread_mutex_lock failed, status=%d\n", __FUNCTION__, status);
+       printf("thread_waiter: ERROR pthread_mutex_lock failed, status=%d\n", status);
     }
 
-  printf("%s: Starting wait for condition\n", __FUNCTION__);
+  printf("thread_waiter: Starting wait for condition\n");
 
   /* Are we a non-cancelable thread?   Yes, set the non-cancelable state */
 
   if (!parameter)
     {
-      printf("%s: Setting non-cancelable\n", __FUNCTION__);
+      printf("thread_waiter: Setting non-cancelable\n");
       status = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
       if (status != 0)
         {
-           printf("%s: ERROR pthread_setcancelstate failed, status=%d\n", __FUNCTION__, status);
+           printf("thread_waiter: ERROR pthread_setcancelstate failed, status=%d\n", status);
         }
     }
 
@@ -74,28 +74,28 @@ static void *thread_waiter(void *parameter)
   status = pthread_cond_wait(&cond, &mutex);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_cond_wait failed, status=%d\n", __FUNCTION__, status);
+      printf("thread_waiter: ERROR pthread_cond_wait failed, status=%d\n", status);
     }
 
   /* Release the mutex */
 
-  printf("%s: Releasing mutex\n", __FUNCTION__);
+  printf("thread_waiter: Releasing mutex\n");
   status = pthread_mutex_unlock(&mutex);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_mutex_unlock failed, status=%d\n", __FUNCTION__, status);
+      printf("thread_waiter: ERROR pthread_mutex_unlock failed, status=%d\n", status);
     }
 
   /* Set the cancelable state */
 
-  printf("%s: Setting cancelable\n", __FUNCTION__);
+  printf("thread_waiter: Setting cancelable\n");
   status = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_setcancelstate failed, status=%d\n", __FUNCTION__, status);
+      printf("thread_waiter: ERROR pthread_setcancelstate failed, status=%d\n", status);
     }
 
-  printf("%s: Exit with status 0x12345678\n", __FUNCTION__);
+  printf("thread_waiter: Exit with status 0x12345678\n");
   pthread_exit((void*)0x12345678);
   return NULL;
 }
@@ -107,20 +107,20 @@ static void start_thread(pthread_t *waiter, int cancelable)
 
   /* Initialize the mutex */
 
-  printf("%s: Initializing mutex\n", __FUNCTION__);
+  printf("start_thread: Initializing mutex\n");
   status = pthread_mutex_init(&mutex, NULL);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_mutex_init failed, status=%d\n", __FUNCTION__, status);
+      printf("start_thread: ERROR pthread_mutex_init failed, status=%d\n", status);
     }
 
   /* Initialize the condition variable */
 
-  printf("%s: Initializing cond\n", __FUNCTION__);
+  printf("start_thread: Initializing cond\n");
   status = pthread_cond_init(&cond, NULL);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_cond_init failed, status=%d\n", __FUNCTION__, status);
+      printf("start_thread: ERROR pthread_cond_init failed, status=%d\n", status);
     }
 
   /* Set up attributes */
@@ -128,27 +128,27 @@ static void start_thread(pthread_t *waiter, int cancelable)
   status = pthread_attr_init(&attr);
   if (status != 0)
     {
-      printf("%s: pthread_attr_init failed, status=%d\n", __FUNCTION__, status);
+      printf("start_thread: pthread_attr_init failed, status=%d\n", status);
     }
 
   status = pthread_attr_setstacksize(&attr, 16384);
   if (status != 0)
     {
-      printf("%s: pthread_attr_setstacksize failed, status=%d\n", __FUNCTION__, status);
+      printf("start_thread: pthread_attr_setstacksize failed, status=%d\n", status);
     }
 
   /* Start the waiter thread  */
 
-  printf("%s: Starting thread\n", __FUNCTION__);
+  printf("start_thread: Starting thread\n");
   status = pthread_create(waiter, NULL, thread_waiter, (void*)cancelable);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_create failed, status=%d\n", __FUNCTION__, status);
+      printf("start_thread: ERROR pthread_create failed, status=%d\n", status);
     }
 
   /* Make sure that the waiter thread gets a chance to run */
 
-  printf("%s: Yielding\n", __FUNCTION__);
+  printf("start_thread: Yielding\n");
   pthread_yield();
 
 }
@@ -159,25 +159,25 @@ static void restart_thread(pthread_t *waiter, int cancelable)
 
   /* Destroy the condition variable */
 
-  printf("%s: Destroying cond\n", __FUNCTION__);
+  printf("restart_thread: Destroying cond\n");
   status = pthread_cond_destroy(&cond);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_cond_destroy failed, status=%d\n", __FUNCTION__, status);
+      printf("restart_thread: ERROR pthread_cond_destroy failed, status=%d\n", status);
     }
 
   /* Destroy the mutex */
 
-  printf("%s: Destroying mutex\n", __FUNCTION__);
+  printf("restart_thread: Destroying mutex\n");
   status = pthread_cond_destroy(&cond);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_mutex_destroy failed, status=%d\n", __FUNCTION__, status);
+      printf("restart_thread: ERROR pthread_mutex_destroy failed, status=%d\n", status);
     }
 
   /* Then restart the thread */
 
-  printf("%s: Re-starting thread\n", __FUNCTION__);
+  printf("restart_thread: Re-starting thread\n");
   start_thread(waiter, cancelable);
 }
 
@@ -190,44 +190,44 @@ void cancel_test(void)
   /* Test 1: Normal Cancel *********************************************/
   /* Start the waiter thread  */
 
-  printf("%s: Test 1: Normal Cancelation\n", __FUNCTION__);
-  printf("%s: Starting thread\n", __FUNCTION__);
+  printf("cancel_test: Test 1: Normal Cancelation\n");
+  printf("cancel_test: Starting thread\n");
   start_thread(&waiter, 1);
 
   /* Then cancel it.  It should be in the pthread_cond_wait now */
 
-  printf("%s: Canceling thread\n", __FUNCTION__);
+  printf("cancel_test: Canceling thread\n");
   status = pthread_cancel(waiter);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_cancel failed, status=%d\n", __FUNCTION__, status);
+      printf("cancel_test: ERROR pthread_cancel failed, status=%d\n", status);
     }
 
   /* Then join to the thread to pick up the result */
 
-  printf("%s: Joining\n", __FUNCTION__);
+  printf("cancel_test: Joining\n");
   status = pthread_join(waiter, &result);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_join failed, status=%d\n", __FUNCTION__, status);
+      printf("cancel_test: ERROR pthread_join failed, status=%d\n", status);
     }
   else
     {
-      printf("%s: waiter exited with result=%p\n", __FUNCTION__, result);
+      printf("cancel_test: waiter exited with result=%p\n", result);
       if (result != PTHREAD_CANCELED)
         {
-          printf("%s: ERROR expected result=%p\n", __FUNCTION__, PTHREAD_CANCELED);
+          printf("cancel_test: ERROR expected result=%p\n", PTHREAD_CANCELED);
         }
       else
         {
-          printf("%s: PASS thread terminated with PTHREAD_CANCELED\n", __FUNCTION__);
+          printf("cancel_test: PASS thread terminated with PTHREAD_CANCELED\n");
         }
     }
 
   /* Test 2: Cancel Detached Thread ************************************/
 
-  printf("%s: Test 2: Cancelation of detached thread\n", __FUNCTION__);
-  printf("%s: Re-starting thread\n", __FUNCTION__);
+  printf("cancel_test: Test 2: Cancelation of detached thread\n");
+  printf("cancel_test: Re-starting thread\n");
   restart_thread(&waiter, 1);
 
   /* Detach the thread */
@@ -235,39 +235,39 @@ void cancel_test(void)
   status = pthread_detach(waiter);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_detach, status=%d\n", __FUNCTION__, status);
+      printf("cancel_test: ERROR pthread_detach, status=%d\n", status);
     }
 
   /* Then cancel it.  It should be in the pthread_cond_wait now */
 
-  printf("%s: Canceling thread\n", __FUNCTION__);
+  printf("cancel_test: Canceling thread\n");
   status = pthread_cancel(waiter);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_cancel failed, status=%d\n", __FUNCTION__, status);
+      printf("cancel_test: ERROR pthread_cancel failed, status=%d\n", status);
     }
 
   /* Join should now fail */
 
-  printf("%s: Joining\n", __FUNCTION__);
+  printf("cancel_test: Joining\n");
   status = pthread_join(waiter, &result);
   if (status == 0)
     {
-      printf("%s: ERROR pthread_join succeeded\n", __FUNCTION__);
+      printf("cancel_test: ERROR pthread_join succeeded\n");
     }
   else if (status != ESRCH)
     {
-      printf("%s: ERROR pthread_join failed but with wrong status=%d\n", __FUNCTION__, status);
+      printf("cancel_test: ERROR pthread_join failed but with wrong status=%d\n", status);
     }
   else
     {
-      printf("%s: PASS pthread_join failed with status=ESRCH\n", __FUNCTION__);
+      printf("cancel_test: PASS pthread_join failed with status=ESRCH\n");
     }
 
   /* Test 3: Non-cancelable threads ************************************/
 
-  printf("%s: Test 3: Non-cancelable threads\n", __FUNCTION__);
-  printf("%s: Re-starting thread (non-cancelable)\n", __FUNCTION__);
+  printf("cancel_test: Test 3: Non-cancelable threads\n");
+  printf("cancel_test: Re-starting thread (non-cancelable)\n");
   restart_thread(&waiter, 0);
 
   /* Then cancel it.  It should be in the pthread_cond_wait now.  The
@@ -277,11 +277,11 @@ void cancel_test(void)
    * The cancelation should succeed, because the cancelation is pending.
    */
 
-  printf("%s: Canceling thread\n", __FUNCTION__);
+  printf("cancel_test: Canceling thread\n");
   status = pthread_cancel(waiter);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_cancel failed, status=%d\n", __FUNCTION__, status);
+      printf("cancel_test: ERROR pthread_cancel failed, status=%d\n", status);
     }
 
   /* Signal the thread.  It should wake up an restore the cancelable state.
@@ -291,18 +291,18 @@ void cancel_test(void)
   status = pthread_mutex_lock(&mutex);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_mutex_lock failed, status=%d\n", __FUNCTION__, status);
+      printf("cancel_test: ERROR pthread_mutex_lock failed, status=%d\n", status);
     }
 
   status = pthread_cond_signal(&cond);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_cond_signal failed, status=%d\n", __FUNCTION__, status);
+      printf("cancel_test: ERROR pthread_cond_signal failed, status=%d\n", status);
     }
 
   status = pthread_mutex_unlock(&mutex);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_mutex_unlock failed, status=%d\n", __FUNCTION__, status);
+      printf("cancel_test: ERROR pthread_mutex_unlock failed, status=%d\n", status);
     }
 }
diff --git a/examples/ostest/cond.c b/examples/ostest/cond.c
index be995fa080f01e494393ceef9aa3af496ae63f0b..13e7b46697493db00adb8c14ff5e46c6ca92fead 100644
--- a/examples/ostest/cond.c
+++ b/examples/ostest/cond.c
@@ -59,7 +59,7 @@ static void *thread_waiter(void *parameter)
 {
   int status;
 
-  printf("%s: Started\n", __FUNCTION__);
+  printf("waiter_thread: Started\n");
 
   for(;;)
     {
@@ -71,7 +71,7 @@ static void *thread_waiter(void *parameter)
 
       if (status != 0)
         {
-          printf("%s: ERROR pthread_mutex_lock failed, status=%d\n", __FUNCTION__, status);
+          printf("waiter_thread: ERROR pthread_mutex_lock failed, status=%d\n", status);
           waiter_nerrors++;
         }
 
@@ -94,7 +94,7 @@ static void *thread_waiter(void *parameter)
 
            if (status != 0)
              {
-               printf("%s: ERROR pthread_cond_wait failed, status=%d\n", __FUNCTION__, status);
+               printf("waiter_thread: ERROR pthread_cond_wait failed, status=%d\n", status);
                waiter_nerrors++;
              }
            waiter_waits++;
@@ -104,7 +104,7 @@ static void *thread_waiter(void *parameter)
 
       if (!data_available)
         {
-          printf("%s: ERROR data not available after wait\n", __FUNCTION__);
+          printf("waiter_thread: ERROR data not available after wait\n");
           waiter_nerrors++;
         }
 
@@ -117,7 +117,7 @@ static void *thread_waiter(void *parameter)
       status = pthread_mutex_unlock(&mutex);
       if (status != 0)
         {
-          printf("%s: ERROR waiter: pthread_mutex_unlock failed, status=%d\n", __FUNCTION__, status);
+          printf("waiter_thread: ERROR waiter: pthread_mutex_unlock failed, status=%d\n", status);
           waiter_nerrors++;
         }
 
@@ -130,7 +130,7 @@ static void *thread_signaler(void *parameter)
   int status;
   int i;
 
-  printf("%s: Started\n", __FUNCTION__);
+  printf("thread_signaler: Started\n");
   for (i = 0; i < 32; i++)
     {
       /* Take the mutex.  The waiter is higher priority and should
@@ -141,7 +141,7 @@ static void *thread_signaler(void *parameter)
       status = pthread_mutex_lock(&mutex);
       if (status != 0)
         {
-          printf("%s: ERROR pthread_mutex_lock failed, status=%d\n", __FUNCTION__, status);
+          printf("thread_signaler: ERROR pthread_mutex_lock failed, status=%d\n", status);
           signaler_nerrors++;
         }
 
@@ -149,13 +149,13 @@ static void *thread_signaler(void *parameter)
 
       if (waiter_state != COND_WAIT)
         {
-          printf("%s: ERROR waiter state = %d != COND_WAITING\n", __FUNCTION__, waiter_state);
+          printf("thread_signaler: ERROR waiter state = %d != COND_WAITING\n", waiter_state);
           signaler_state++;
         }
 
       if (data_available)
         {
-          printf("%s: ERROR data already available, waiter_state=%d\n", __FUNCTION__, waiter_state);
+          printf("thread_signaler: ERROR data already available, waiter_state=%d\n", waiter_state);
           signaler_already++;
         }
 
@@ -165,7 +165,7 @@ static void *thread_signaler(void *parameter)
       status = pthread_cond_signal(&cond);
       if (status != 0)
         {
-          printf("%s: ERROR pthread_cond_signal failed, status=%d\n", __FUNCTION__, status);
+          printf("thread_signaler: ERROR pthread_cond_signal failed, status=%d\n", status);
           signaler_nerrors++;
         }
 
@@ -174,14 +174,14 @@ static void *thread_signaler(void *parameter)
       status = pthread_mutex_unlock(&mutex);
       if (status != 0)
         {
-          printf("%s: ERROR pthread_mutex_unlock failed, status=%d\n", __FUNCTION__, status);
+          printf("thread_signaler: ERROR pthread_mutex_unlock failed, status=%d\n", status);
           signaler_nerrors++;
         }
 
       signaler_nloops++;
     }
 
-  printf("%s: Terminating\n", __FUNCTION__);
+  printf("thread_signaler: Terminating\n");
   pthread_exit(NULL);
 }
 
@@ -198,29 +198,29 @@ void cond_test(void)
 
   /* Initialize the mutex */
 
-  printf("%s: Initializing mutex\n", __FUNCTION__);
+  printf("cond_test: Initializing mutex\n");
   status = pthread_mutex_init(&mutex, NULL);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_mutex_init failed, status=%d\n", __FUNCTION__, status);
+      printf("cond_test: ERROR pthread_mutex_init failed, status=%d\n", status);
     }
 
   /* Initialize the condition variable */
 
-  printf("%s: Initializing cond\n", __FUNCTION__);
+  printf("cond_test: Initializing cond\n");
   status = pthread_cond_init(&cond, NULL);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_condinit failed, status=%d\n", __FUNCTION__, status);
+      printf("cond_test: ERROR pthread_condinit failed, status=%d\n", status);
     }
 
   /* Start the waiter thread at higher priority */
 
-  printf("%s: Starting waiter\n", __FUNCTION__);
+  printf("cond_test: Starting waiter\n");
   status = pthread_attr_init(&attr);
   if (status != 0)
     {
-      printf("%s: pthread_attr_init failed, status=%d\n", __FUNCTION__, status);
+      printf("cond_test: pthread_attr_init failed, status=%d\n", status);
     }
 
   prio_min = sched_get_priority_min(SCHED_FIFO);
@@ -231,54 +231,54 @@ void cond_test(void)
   status = pthread_attr_setschedparam(&attr,&sparam);
   if (status != OK)
     {
-      printf("%s: pthread_attr_setschedparam failed, status=%d\n", __FUNCTION__, status);
+      printf("cond_test: pthread_attr_setschedparam failed, status=%d\n", status);
     }
   else
     {
-      printf("%s: Set thread 1 priority to %d\n", __FUNCTION__, sparam.sched_priority);
+      printf("cond_test: Set thread 1 priority to %d\n", sparam.sched_priority);
     }
 
   status = pthread_create(&waiter, &attr, thread_waiter, NULL);
   if (status != 0)
     {
-      printf("%s: pthread_create failed, status=%d\n", __FUNCTION__, status);
+      printf("cond_test: pthread_create failed, status=%d\n", status);
     }
 
-  printf("%s: Starting signaler\n", __FUNCTION__);
+  printf("cond_test: Starting signaler\n");
   status = pthread_attr_init(&attr);
   if (status != 0)
     {
-      printf("%s: pthread_attr_init failed, status=%d\n", __FUNCTION__, status);
+      printf("cond_test: pthread_attr_init failed, status=%d\n", status);
     }
 
   sparam.sched_priority = (prio_min + prio_mid) / 2;
   status = pthread_attr_setschedparam(&attr,&sparam);
   if (status != OK)
     {
-      printf("%s: pthread_attr_setschedparam failed, status=%d\n", __FUNCTION__, status);
+      printf("cond_test: pthread_attr_setschedparam failed, status=%d\n", status);
     }
   else
     {
-      printf("%s: Set thread 2 priority to %d\n", __FUNCTION__, sparam.sched_priority);
+      printf("cond_test: Set thread 2 priority to %d\n", sparam.sched_priority);
     }
 
   status = pthread_create(&signaler, &attr, thread_signaler, NULL);
   if (status != 0)
     {
-      printf("%s: pthread_create failed, status=%d\n", __FUNCTION__, status);
+      printf("cond_test: pthread_create failed, status=%d\n", status);
     }
 
   /* Wait for the threads to stop */
 
   pthread_join(signaler, NULL);
-  printf("%s: signaler terminated, now cancel the waiter\n", __FUNCTION__);
+  printf("cond_test: signaler terminated, now cancel the waiter\n");
   pthread_detach(waiter);
   pthread_cancel(waiter);
 
-  printf("%s: \tWaiter\tSignaler\n", __FUNCTION__);
-  printf("%s: Loops\t%d\t%d\n", __FUNCTION__, waiter_nloops, signaler_nloops);
-  printf("%s: Errors\t%d\t%d\n", __FUNCTION__, waiter_nerrors, signaler_nerrors);
-  printf("%s: \n%d times, waiter did not have to wait for data\n", __FUNCTION__, waiter_nloops - waiter_waits);
-  printf("%s: %d times, data was already available when the signaler run\n", __FUNCTION__, signaler_already);
-  printf("%s: %d times, the waiter was in an unexpected state when the signaler ran\n", __FUNCTION__, signaler_state);
+  printf("cond_test: \tWaiter\tSignaler\n");
+  printf("cond_test: Loops\t%d\t%d\n", waiter_nloops, signaler_nloops);
+  printf("cond_test: Errors\t%d\t%d\n", waiter_nerrors, signaler_nerrors);
+  printf("cond_test: \n%d times, waiter did not have to wait for data\n", waiter_nloops - waiter_waits);
+  printf("cond_test: %d times, data was already available when the signaler run\n", signaler_already);
+  printf("cond_test: %d times, the waiter was in an unexpected state when the signaler ran\n", signaler_state);
 }
diff --git a/examples/ostest/dev_null.c b/examples/ostest/dev_null.c
index 11d6056c84e6824af703492d5e7702d9f3ab0317..f9ca5623a6caadc0866210cae46a8f4ea77c512d 100644
--- a/examples/ostest/dev_null.c
+++ b/examples/ostest/dev_null.c
@@ -64,27 +64,27 @@ int dev_null(void)
   fd = open("/dev/null", O_RDWR);
   if (fd < 0)
     {
-      fprintf(stderr, "%s: Failed to open /dev/null\n", __FUNCTION__);
+      fprintf(stderr, "dev_null: Failed to open /dev/null\n");
       return -1;
     }
 
   nbytes = read(fd, buffer, 1024);
   if (nbytes < 0)
     {
-      fprintf(stderr, "%s: Failed to read from /dev/null\n", __FUNCTION__);
+      fprintf(stderr, "dev_null: Failed to read from /dev/null\n");
       close(fd);
       return -1;
     }
-  printf("%s: Read %d bytes from /dev/null\n", __FUNCTION__, nbytes);
+  printf("dev_null: Read %d bytes from /dev/null\n", nbytes);
 
   nbytes = write(fd, buffer, 1024);
   if (nbytes < 0)
     {
-      fprintf(stderr, "%s: Failed to write to /dev/null\n", __FUNCTION__);
+      fprintf(stderr, "dev_null: Failed to write to /dev/null\n");
       close(fd);
       return -1;
     }
-  printf("%s: Wrote %d bytes to /dev/null\n", __FUNCTION__, nbytes);
+  printf("dev_null: Wrote %d bytes to /dev/null\n", nbytes);
 
   close(fd);
   return 0;
diff --git a/examples/ostest/main.c b/examples/ostest/main.c
index f6c0c65caf783e6d3bdd72405a82831dcfff990f..3122ef3430f3d83637d4092b2332460cda73b498 100644
--- a/examples/ostest/main.c
+++ b/examples/ostest/main.c
@@ -76,27 +76,27 @@ static int user_main(int argc, char *argv[])
 {
   int i;
 
-  printf("%s: Started with argc=%d\n", __FUNCTION__, argc);
+  printf("user_main: Started with argc=%d\n", argc);
 
   /* Verify passed arguments */
 
   if (argc != NARGS + 1)
     {
-      fprintf(stderr, "%s: Error expected argc=%d got argc=%d\n",
-              __FUNCTION__, NARGS+1, argc);
+      fprintf(stderr, "user_main: Error expected argc=%d got argc=%d\n",
+              NARGS+1, argc);
     }
 
   for (i = 0; i <= NARGS; i++)
     {
-      printf("%s: argv[%d]=\"%s\"\n", __FUNCTION__, i, argv[i]);
+      printf("user_main: argv[%d]=\"%s\"\n", i, argv[i]);
     }
 
   for (i = 1; i <= NARGS; i++)
     {
       if (strcmp(argv[i], args[i-1]) != 0)
         {
-          fprintf(stderr, "%s: ERROR argv[%d]:  Expected \"%s\" found \"%s\"\n",
-                  __FUNCTION__, i, argv[i], args[i-1]);
+          fprintf(stderr, "user_main: ERROR argv[%d]:  Expected \"%s\" found \"%s\"\n",
+                  i, argv[i], args[i-1]);
         }
     }
 
@@ -158,9 +158,9 @@ int user_start(int parm1, int parm2, int parm3, int parm4)
   /* Verify that we can communicate */
 
   write(1, write_data1, sizeof(write_data1));
-  printf("%s: Standard I/O Check: printf\n", __FUNCTION__);
+  printf("user_start: Standard I/O Check: printf\n");
   write(2, write_data2, sizeof(write_data2));
-  fprintf(stderr, "%s: Standard I/O Check: fprintf to stderr\n", __FUNCTION__);
+  fprintf(stderr, "user_start: Standard I/O Check: fprintf to stderr\n");
 
   /* Verify that we can spawn a new task */
 
@@ -168,11 +168,11 @@ int user_start(int parm1, int parm2, int parm3, int parm4)
                        ARG1, ARG2, ARG3, ARG4);
   if (result == ERROR)
     {
-      fprintf(stderr, "%s: Failed to start user_main\n", __FUNCTION__);
+      fprintf(stderr, "user_start: Failed to start user_main\n");
     }
   else
     {
-       printf("%s: Started user_main at PID=%d\n", __FUNCTION__, result);
+       printf("user_start: Started user_main at PID=%d\n", result);
     }
   return 0;
 }
diff --git a/examples/ostest/mqueue.c b/examples/ostest/mqueue.c
index f9e6b6e034350559d59d117829f7fd496f54f18a..acdbea99ebe44680c9be28723b40d12336fed66a 100644
--- a/examples/ostest/mqueue.c
+++ b/examples/ostest/mqueue.c
@@ -85,7 +85,7 @@ static void *sender_thread(void *arg)
   int nerrors = 0;
   int i;
 
-  printf("%s: Starting\n", __FUNCTION__);
+  printf("sender_thread: Starting\n");
 
   /* Fill in attributes for message queue */
 
@@ -107,7 +107,7 @@ static void *sender_thread(void *arg)
   mqfd = mq_open("testmq", O_WRONLY|O_CREAT, 0666, &attr);
   if (mqfd < 0)
     {
-	printf("%s: ERROR mq_open failed\n", __FUNCTION__);
+	printf("sender_thread: ERROR mq_open failed\n");
         pthread_exit((void*)1);
     }
 
@@ -122,12 +122,12 @@ static void *sender_thread(void *arg)
       status = mq_send(mqfd, msg_buffer, TEST_MSGLEN, 42);
       if (status < 0)
         {
-          printf("%s: ERROR mq_send failure=%d on msg %d\n", __FUNCTION__, status, i);
+          printf("sender_thread: ERROR mq_send failure=%d on msg %d\n", status, i);
           nerrors++;
         }
       else
         {
-          printf("%s: mq_send succeeded on msg %d\n", __FUNCTION__, i);
+          printf("sender_thread: mq_send succeeded on msg %d\n", i);
         }
     }
 
@@ -135,10 +135,10 @@ static void *sender_thread(void *arg)
 
   if (mq_close(mqfd) < 0)
     {
-      printf("%s: ERROR mq_close failed\n", __FUNCTION__);
+      printf("sender_thread: ERROR mq_close failed\n");
     }
 
-  printf("%s: returning nerrors=%d\n", __FUNCTION__, nerrors);
+  printf("sender_thread: returning nerrors=%d\n", nerrors);
   return (void*)nerrors;
 }
 
@@ -151,7 +151,7 @@ static void *receiver_thread(void *arg)
   int nerrors = 0;
   int i;
 
-  printf("%s: Starting\n", __FUNCTION__);
+  printf("receiver_thread: Starting\n");
 
   /* Fill in attributes for message queue */
 
@@ -173,7 +173,7 @@ static void *receiver_thread(void *arg)
    mqfd = mq_open("testmq", O_RDONLY|O_CREAT, 0666, &attr);
    if (mqfd < 0)
      {
-       printf("%s: ERROR mq_open failed\n", __FUNCTION__);
+       printf("receiver_thread: ERROR mq_open failed\n");
        pthread_exit((void*)1);
      }
 
@@ -184,33 +184,32 @@ static void *receiver_thread(void *arg)
       nbytes = mq_receive(mqfd, msg_buffer, TEST_MSGLEN, 0);
       if (nbytes < 0)
         {
-          printf("%s: ERROR mq_receive failure on msg %d\n", __FUNCTION__, i);
+          printf("receiver_thread: ERROR mq_receive failure on msg %d\n", i);
           nerrors++;
         }
       else if (nbytes != TEST_MSGLEN)
         {
-          printf("%s: mq_receive return bad size %d on msg %d\n", __FUNCTION__, nbytes, i);
+          printf("receiver_thread: mq_receive return bad size %d on msg %d\n", nbytes, i);
           nerrors++;
         }
       else if (memcmp(TEST_MESSAGE, msg_buffer, nbytes) != 0)
         {
           int j;
 
-          printf("%s: mq_receive returned corrupt message on msg %d\n", __FUNCTION__, i);
-          printf("%s:                  i  Expected Received\n", __FUNCTION__);
+          printf("receiver_thread: mq_receive returned corrupt message on msg %d\n", i);
+          printf("receiver_thread:                  i  Expected Received\n");
 
           for (j = 0; j < TEST_MSGLEN-1; j++)
             {
-              printf("%s:                  %2d %02x (%c) %02x\n",
-                     __FUNCTION__,
+              printf("receiver_thread:                  %2d %02x (%c) %02x\n",
                      j, TEST_MESSAGE[j], TEST_MESSAGE[j], msg_buffer[j] & 0x0ff);
             }
-          printf("%s:                  %2d 00     %02x\n",
-                  __FUNCTION__, j, msg_buffer[j] & 0xff);
+          printf("receiver_thread:                  %2d 00     %02x\n",
+                  j, msg_buffer[j] & 0xff);
         }
       else
         {
-          printf("%s: mq_receive succeeded on msg %d\n", __FUNCTION__, i);
+          printf("receiver_thread: mq_receive succeeded on msg %d\n", i);
         }
     }
 
@@ -218,7 +217,7 @@ static void *receiver_thread(void *arg)
 
   if (mq_close(mqfd) < 0)
     {
-      printf("%s: ERROR mq_close failed\n", __FUNCTION__);
+      printf("receiver_thread: ERROR mq_close failed\n");
       nerrors++;
     }
 
@@ -228,11 +227,11 @@ static void *receiver_thread(void *arg)
 
   if (mq_unlink("testmq") < 0)
     {
-      printf("%s: ERROR mq_close failed\n", __FUNCTION__);
+      printf("receiver_thread: ERROR mq_close failed\n");
       nerrors++;
     }
 
-  printf("%s: returning nerrors=%d\n", __FUNCTION__, nerrors);
+  printf("receiver_thread: returning nerrors=%d\n", nerrors);
   return (void*)nerrors;
 }
 
@@ -250,17 +249,17 @@ void mqueue_test(void)
 
   /* Start the sending thread at higher priority */
 
-  printf("%s: Starting receiver\n", __FUNCTION__);
+  printf("mqueue_test: Starting receiver\n");
   status = pthread_attr_init(&attr);
   if (status != 0)
     {
-      printf("%s: pthread_attr_init failed, status=%d\n", __FUNCTION__, status);
+      printf("mqueue_test: pthread_attr_init failed, status=%d\n", status);
     }
 
   status = pthread_attr_setstacksize(&attr, 16384);
   if (status != 0)
     {
-      printf("%s: pthread_attr_setstacksize failed, status=%d\n", __FUNCTION__, status);
+      printf("mqueue_test: pthread_attr_setstacksize failed, status=%d\n", status);
     }
 
   prio_min = sched_get_priority_min(SCHED_FIFO);
@@ -271,62 +270,62 @@ void mqueue_test(void)
   status = pthread_attr_setschedparam(&attr,&sparam);
   if (status != OK)
     {
-      printf("%s: pthread_attr_setschedparam failed, status=%d\n", __FUNCTION__, status);
+      printf("mqueue_test: pthread_attr_setschedparam failed, status=%d\n", status);
     }
   else
     {
-      printf("%s: Set receiver priority to %d\n", __FUNCTION__, sparam.sched_priority);
+      printf("mqueue_test: Set receiver priority to %d\n", sparam.sched_priority);
     }
 
   status = pthread_create(&receiver, &attr, receiver_thread, NULL);
   if (status != 0)
     {
-      printf("%s: pthread_create failed, status=%d\n", __FUNCTION__, status);
+      printf("mqueue_test: pthread_create failed, status=%d\n", status);
     }
 
   /* Start the sending thread at lower priority */
 
-  printf("%s: Starting sender\n", __FUNCTION__);
+  printf("mqueue_test: Starting sender\n");
   status = pthread_attr_init(&attr);
   if (status != 0)
     {
-      printf("%s: pthread_attr_init failed, status=%d\n", __FUNCTION__, status);
+      printf("mqueue_test: pthread_attr_init failed, status=%d\n", status);
     }
 
   status = pthread_attr_setstacksize(&attr, 16384);
   if (status != 0)
     {
-      printf("%s: pthread_attr_setstacksize failed, status=%d\n", __FUNCTION__, status);
+      printf("mqueue_test: pthread_attr_setstacksize failed, status=%d\n", status);
     }
 
   sparam.sched_priority = (prio_min + prio_mid) / 2;
   status = pthread_attr_setschedparam(&attr,&sparam);
   if (status != OK)
     {
-      printf("%s: pthread_attr_setschedparam failed, status=%d\n", __FUNCTION__, status);
+      printf("mqueue_test: pthread_attr_setschedparam failed, status=%d\n", status);
     }
   else
     {
-      printf("%s: Set sender thread priority to %d\n", __FUNCTION__, sparam.sched_priority);
+      printf("mqueue_test: Set sender thread priority to %d\n", sparam.sched_priority);
     }
 
   status = pthread_create(&sender, &attr, sender_thread, NULL);
   if (status != 0)
     {
-      printf("%s: pthread_create failed, status=%d\n", __FUNCTION__, status);
+      printf("mqueue_test: pthread_create failed, status=%d\n", status);
     }
 
   pthread_join(sender, &result);
   if (result != (void*)0)
     {
-      printf("%s: ERROR sender thread exited with %d errors\n", __FUNCTION__, (int)result);
+      printf("mqueue_test: ERROR sender thread exited with %d errors\n", (int)result);
     }
 
   pthread_cancel(receiver);
   pthread_join(receiver, &result);
   if (result != (void*)0)
     {
-      printf("%s: ERROR receiver thread exited with %d errors\n", __FUNCTION__, (int)result);
+      printf("mqueue_test: ERROR receiver thread exited with %d errors\n", (int)result);
     }
 }
 
diff --git a/examples/ostest/mutex.c b/examples/ostest/mutex.c
index d6cad9e39fcc71a3d03a83914f23a08130f2ce91..cb8996053c8fa97bba6b361b92d281b8344552a8 100644
--- a/examples/ostest/mutex.c
+++ b/examples/ostest/mutex.c
@@ -60,14 +60,14 @@ static void *thread_func(void *parameter)
       if (status != 0)
         {
           printf("ERROR thread %d: pthread_mutex_lock failed, status=%d\n",
-                      id, status);
+                  id, status);
         }
 
       if (my_mutex == 1)
         {
           printf("ERROR thread=%d: "
-                      "my_mutex should be zero, instead my_mutex=%d\n",
-                       id, my_mutex);
+                 "my_mutex should be zero, instead my_mutex=%d\n",
+                  id, my_mutex);
           nerrors[ndx]++;
         }
 
@@ -82,7 +82,7 @@ static void *thread_func(void *parameter)
       if (status != 0)
         {
           printf("ERROR thread %d: pthread_mutex_unlock failed, status=%d\n",
-                       id, status);
+                 id, status);
         }
     }
   pthread_exit(NULL);
@@ -114,7 +114,7 @@ void mutex_test(void)
   pthread_join(thread1, NULL);
   pthread_join(thread2, NULL);
 
-  printf("%s:\t\tThread1\tThread2\n", __FUNCTION__);
-  printf("%s:\tLoops\t%ld\t%ld\n", __FUNCTION__, nloops[0], nloops[1]);
-  printf("%s:\tErrors\t%ld\t%ld\n", __FUNCTION__, nerrors[0], nerrors[1]);
+  printf("\t\tThread1\tThread2\n");
+  printf("\tLoops\t%ld\t%ld\n", nloops[0], nloops[1]);
+  printf("\tErrors\t%ld\t%ld\n", nerrors[0], nerrors[1]);
 }
diff --git a/examples/ostest/ostest.h b/examples/ostest/ostest.h
index 3871ecc67b8912d28654947fea549ec7930e9a0e..8d567cb37a5888a9ece744c33efbf1122d359e56 100644
--- a/examples/ostest/ostest.h
+++ b/examples/ostest/ostest.h
@@ -88,4 +88,8 @@ extern void cancel_test(void);
 
 extern void timedwait_test(void);
 
+/* sighand.c ************************************************/
+
+extern void sighand_test(void);
+
 #endif /* __OSTEST_H */
diff --git a/examples/ostest/sem.c b/examples/ostest/sem.c
index 0b532982dc4cb52159bd52a2ad3e5ce821ae299b..73be6910e36debda17805ea6e6b40fcefc4ba6c2 100644
--- a/examples/ostest/sem.c
+++ b/examples/ostest/sem.c
@@ -52,39 +52,39 @@ static void *waiter_func(void *parameter)
   int status;
   int value;
 
-  printf("%s: Thread %d Started\n", __FUNCTION__, id);
+  printf("waiter_func: Thread %d Started\n",  id);
 
   /* Take the semaphore */
 
   status = sem_getvalue(&sem, &value);
   if (status < 0)
     {
-      printf("%s: ERROR thread %d could not get semaphore value\n", __FUNCTION__, id);
+      printf("waiter_func: ERROR thread %d could not get semaphore value\n",  id);
     }
   else
     {
-      printf("%s: Thread %d initial semaphore value = %d\n", __FUNCTION__, id, value);
+      printf("waiter_func: Thread %d initial semaphore value = %d\n",  id, value);
     }
 
-  printf("%s: Thread %d aiting on semaphore\n", __FUNCTION__, id);
+  printf("waiter_func: Thread %d aiting on semaphore\n",  id);
   status = sem_wait(&sem);
   if (status != 0)
     {
-      printf("%s: ERROR thread %d sem_wait failed\n", __FUNCTION__, id);
+      printf("waiter_func: ERROR thread %d sem_wait failed\n",  id);
     }
-  printf("%s: Thread %d awakened\n", __FUNCTION__, id);
+  printf("waiter_func: Thread %d awakened\n",  id);
 
   status = sem_getvalue(&sem, &value);
   if (status < 0)
     {
-      printf("%s: ERROR thread %d could not get semaphore value\n", __FUNCTION__, id);
+      printf("waiter_func: ERROR thread %d could not get semaphore value\n",  id);
     }
   else
     {
-      printf("%s: Thread %d new semaphore value = %d\n", __FUNCTION__, id, value);
+      printf("waiter_func: Thread %d new semaphore value = %d\n",  id, value);
     }
 
-  printf("%s: Thread %d done\n", __FUNCTION__, id);
+  printf("waiter_func: Thread %d done\n",  id);
   return NULL;
 }
 
@@ -94,7 +94,7 @@ static void *poster_func(void *parameter)
   int status;
   int value;
 
-  printf("%s: Thread %d started\n", __FUNCTION__, id);
+  printf("poster_func: Thread %d started\n",  id);
 
   /* Take the semaphore */
 
@@ -103,20 +103,20 @@ static void *poster_func(void *parameter)
       status = sem_getvalue(&sem, &value);
       if (status < 0)
         {
-          printf("%s: ERROR thread %d could not get semaphore value\n", __FUNCTION__, id);
+          printf("poster_func: ERROR thread %d could not get semaphore value\n",  id);
         }
       else
         {
-          printf("%s: Thread %d semaphore value = %d\n", __FUNCTION__, id, value);
+          printf("poster_func: Thread %d semaphore value = %d\n",  id, value);
         }
 
       if (value < 0)
         {
-          printf("%s: Thread %d posting semaphore\n", __FUNCTION__, id);
+          printf("poster_func: Thread %d posting semaphore\n",  id);
           status = sem_post(&sem);
           if (status != 0)
             {
-              printf("%s: ERROR thread %d sem_wait failed\n", __FUNCTION__, id);
+              printf("poster_func: ERROR thread %d sem_wait failed\n",  id);
             }
 
           pthread_yield();
@@ -124,17 +124,17 @@ static void *poster_func(void *parameter)
           status = sem_getvalue(&sem, &value);
           if (status < 0)
             {
-              printf("%s: ERROR thread %d could not get semaphore value\n", __FUNCTION__, id);
+              printf("poster_func: ERROR thread %d could not get semaphore value\n",  id);
             }
           else
             {
-              printf("%s: Thread %d new semaphore value = %d\n", __FUNCTION__, id, value);
+              printf("poster_func: Thread %d new semaphore value = %d\n",  id, value);
             }
         }
     }
   while (value < 0);
 
-  printf("%s: Thread %d done\n", __FUNCTION__, id);
+  printf("poster_func: Thread %d done\n",  id);
   return NULL;
 
 }
@@ -151,16 +151,16 @@ void sem_test(void)
   pthread_attr_t attr;
   int status;
 
-  printf("%s: Initializing semaphore to 0\n", __FUNCTION__);
+  printf("sem_test: Initializing semaphore to 0\n");
   sem_init(&sem, 0, 0);
 
   /* Start two waiter thread instances */
 
-  printf("%s: Starting waiter thread 1\n", __FUNCTION__);
+  printf("sem_test: Starting waiter thread 1\n");
   status = pthread_attr_init(&attr);
   if (status != OK)
     {
-      printf("%s: pthread_attr_init failed, status=%d\n", __FUNCTION__, status);
+      printf("sem_test: pthread_attr_init failed, status=%d\n",  status);
     }
 
   prio_min = sched_get_priority_min(SCHED_FIFO);
@@ -171,65 +171,65 @@ void sem_test(void)
   status = pthread_attr_setschedparam(&attr,&sparam);
   if (status != OK)
     {
-      printf("%s: pthread_attr_setschedparam failed, status=%d\n", __FUNCTION__, status);
+      printf("sem_test: pthread_attr_setschedparam failed, status=%d\n",  status);
     }
   else
     {
-      printf("%s: Set thread 1 priority to %d\n", __FUNCTION__, sparam.sched_priority);
+      printf("sem_test: Set thread 1 priority to %d\n",  sparam.sched_priority);
     }
 
   status = pthread_create(&waiter_thread1, &attr, waiter_func, (void*)1);
   if (status != 0)
     {
-      printf("%s: Error in thread 1 creation, status=%d\n", __FUNCTION__, status);
+      printf("sem_test: Error in thread 1 creation, status=%d\n",  status);
     }
 
-  printf("%s: Starting waiter thread 2\n", __FUNCTION__);
+  printf("sem_test: Starting waiter thread 2\n");
   status = pthread_attr_init(&attr);
   if (status != 0)
     {
-      printf("%s: pthread_attr_init failed, status=%d\n", __FUNCTION__, status);
+      printf("sem_test: pthread_attr_init failed, status=%d\n",  status);
     }
 
   sparam.sched_priority = prio_mid;
   status = pthread_attr_setschedparam(&attr,&sparam);
   if (status != OK)
     {
-      printf("%s: pthread_attr_setschedparam failed, status=%d\n", __FUNCTION__, status);
+      printf("sem_test: pthread_attr_setschedparam failed, status=%d\n",  status);
     }
   else
     {
-      printf("%s: Set thread 2 priority to %d\n", __FUNCTION__, sparam.sched_priority);
+      printf("sem_test: Set thread 2 priority to %d\n",  sparam.sched_priority);
     }
 
   status = pthread_create(&waiter_thread2, &attr, waiter_func, (void*)2);
   if (status != 0)
     {
-      printf("%s: Error in thread 2 creation, status=%d\n", __FUNCTION__, status);
+      printf("sem_test: Error in thread 2 creation, status=%d\n",  status);
     }
 
-  printf("%s: Starting poster thread 3\n", __FUNCTION__);
+  printf("sem_test: Starting poster thread 3\n");
   status = pthread_attr_init(&attr);
   if (status != 0)
     {
-      printf("%s: pthread_attr_init failed, status=%d\n", __FUNCTION__, status);
+      printf("sem_test: pthread_attr_init failed, status=%d\n",  status);
     }
 
   sparam.sched_priority = (prio_min + prio_mid) / 2;
   status = pthread_attr_setschedparam(&attr,&sparam);
   if (status != OK)
     {
-      printf("%s: pthread_attr_setschedparam failed, status=%d\n", __FUNCTION__, status);
+      printf("sem_test: pthread_attr_setschedparam failed, status=%d\n",  status);
     }
   else
     {
-      printf("%s: Set thread 3 priority to %d\n", __FUNCTION__, sparam.sched_priority);
+      printf("sem_test: Set thread 3 priority to %d\n",  sparam.sched_priority);
     }
 
   status = pthread_create(&poster_thread, &attr, poster_func, (void*)3);
   if (status != 0)
     {
-      printf("%s: Error in thread 3 creation, status=%d\n", __FUNCTION__, status);
+      printf("sem_test: Error in thread 3 creation, status=%d\n",  status);
     }
 
   pthread_join(waiter_thread1, NULL);
diff --git a/examples/ostest/sighand.c b/examples/ostest/sighand.c
index 9ffd166f4685f0a77fbd4fa913a3e2fc8b7fcee8..ada7d88364b1bb3b5900d9a80847f517e5a655de 100644
--- a/examples/ostest/sighand.c
+++ b/examples/ostest/sighand.c
@@ -60,7 +60,7 @@ static void wakeup_action(int signo, siginfo_t *info, void *ucontext)
   sigset_t allsigs;
   int status;
 
-  printf("%s: Received signal %d\n", __FUNCTION__, signo);
+  printf("wakeup_action: Received signal %d\n" , signo);
 
   sigreceived = TRUE;
 
@@ -68,32 +68,32 @@ static void wakeup_action(int signo, siginfo_t *info, void *ucontext)
 
   if (signo != WAKEUP_SIGNAL)
     {
-      printf("%s: ERROR expected signo=%d\n",  __FUNCTION__, WAKEUP_SIGNAL);
+      printf("wakeup_action: ERROR expected signo=%d\n" , WAKEUP_SIGNAL);
     }
 
   /* Check siginfo */
 
   if (info->si_value.sival_int != SIGVALUE_INT)
     {
-      printf("%s: ERROR sival_int=%d expected %d\n",
-             __FUNCTION__, info->si_value.sival_int, SIGVALUE_INT);
+      printf("wakeup_action: ERROR sival_int=%d expected %d\n",
+              info->si_value.sival_int, SIGVALUE_INT);
     }
   else
     {
-      printf("%s: sival_int=%d\n", __FUNCTION__, info->si_value.sival_int);
+      printf("wakeup_action: sival_int=%d\n" , info->si_value.sival_int);
     }
 
   if (info->si_signo != WAKEUP_SIGNAL)
     {
-      printf("%s: ERROR expected si_signo=%d, got=%d\n",
-              __FUNCTION__, WAKEUP_SIGNAL, info->si_signo);
+      printf("wakeup_action: ERROR expected si_signo=%d, got=%d\n",
+               WAKEUP_SIGNAL, info->si_signo);
     }
 
-  printf("%s: si_code=%d\n", __FUNCTION__, info->si_code);
+  printf("wakeup_action: si_code=%d\n" , info->si_code);
 
   /* Check ucontext_t */
 
-  printf("%s: ucontext=%p\n", __FUNCTION__, ucontext);
+  printf("wakeup_action: ucontext=%p\n" , ucontext);
 
   /* Check sigprocmask */
 
@@ -101,14 +101,14 @@ static void wakeup_action(int signo, siginfo_t *info, void *ucontext)
   status = sigprocmask(SIG_SETMASK, NULL, &oldset);
   if (status != OK)
     {
-      printf("%s: ERROR sigprocmask failed, status=%d\n",
-             __FUNCTION__, status);
+      printf("wakeup_action: ERROR sigprocmask failed, status=%d\n",
+              status);
     }
 
   if (oldset != allsigs)
     {
-      printf("%s: ERROR sigprocmask=%x expected=%x\n",
-             __FUNCTION__, oldset, allsigs);
+      printf("wakeup_action: ERROR sigprocmask=%x expected=%x\n",
+              oldset, allsigs);
     }
 
 }
@@ -120,19 +120,19 @@ static int waiter_main(int argc, char *argv[])
   struct sigaction oact;
   int status;
 
-  printf("%s: Waiter started\n", __FUNCTION__);
+  printf("wakeup_action: Waiter started\n" );
 
-  printf("%s: Unmasking signal %d\n", __FUNCTION__, WAKEUP_SIGNAL);
+  printf("waiter_main: Unmasking signal %d\n" , WAKEUP_SIGNAL);
   (void)sigemptyset(&sigset);
   (void)sigaddset(&sigset, WAKEUP_SIGNAL);
   status = sigprocmask(SIG_UNBLOCK, &sigset, NULL);
   if (status != OK)
     {
-      printf("%s: ERROR sigprocmask failed, status=%d\n",
-             __FUNCTION__, status);
+      printf("waiter_main: ERROR sigprocmask failed, status=%d\n",
+              status);
     }
 
-  printf("%s: Registering signal handler\n", __FUNCTION__);
+  printf("waiter_main: Registering signal handler\n" );
   act.sa_sigaction = wakeup_action;
   act.sa_flags  = SA_SIGINFO;
 
@@ -142,15 +142,15 @@ static int waiter_main(int argc, char *argv[])
   status = sigaction(WAKEUP_SIGNAL, &act, &oact);
   if (status != OK)
     {
-      printf("%s: ERROR sigaction failed, status=%d\n", __FUNCTION__, status);
+      printf("waiter_main: ERROR sigaction failed, status=%d\n" , status);
     }
 
-  printf("%s: oact.sigaction=%p oact.sa_flags=%x oact.sa_mask=%x\n",
-         __FUNCTION__, oact.sa_sigaction, oact.sa_flags, oact.sa_mask);
+  printf("waiter_main: oact.sigaction=%p oact.sa_flags=%x oact.sa_mask=%x\n",
+          oact.sa_sigaction, oact.sa_flags, oact.sa_mask);
 
   /* Take the semaphore */
 
-  printf("%s: Waiting on semaphore\n", __FUNCTION__);
+  printf("waiter_main: Waiting on semaphore\n" );
   fflush(stdout);
   status = sem_wait(&sem);
   if (status != 0)
@@ -158,19 +158,19 @@ static int waiter_main(int argc, char *argv[])
       int error = *get_errno_ptr();
       if (error == EINTR)
         {
-          printf("%s: sem_wait() successfully interrupted by signal\n", __FUNCTION__);
+          printf("waiter_main: sem_wait() successfully interrupted by signal\n" );
         }
       else
         {
-          printf("%s: ERROR sem_wait failed, errno=%d\n", __FUNCTION__, error);
+          printf("waiter_main: ERROR sem_wait failed, errno=%d\n" , error);
         }
     }
   else
     {
-      printf("%s: ERROR awakened with no error!\n", __FUNCTION__);
+      printf("waiter_main: ERROR awakened with no error!\n" );
     }
 
-  printf("%s: done\n", __FUNCTION__);
+  printf("waiter_main: done\n" );
   fflush(stdout);
   threadexited = TRUE;
   return 0;
@@ -184,25 +184,25 @@ void sighand_test(void)
   int policy;
   int status;
 
-  printf("%s: Initializing semaphore to 0\n", __FUNCTION__);
+  printf("waiter_main: Initializing semaphore to 0\n" );
   sem_init(&sem, 0, 0);
 
   /* Start waiter thread  */
 
-  printf("%s: Starting waiter task\n", __FUNCTION__);
+  printf("sighand_test: Starting waiter task\n" );
 
 
   status = sched_getparam (0, &param);
   if (status != OK)
     {
-      printf("%s: ERROR sched_getparam() failed\n", __FUNCTION__);
+      printf("sighand_test: ERROR sched_getparam() failed\n" );
       param.sched_priority = PTHREAD_DEFAULT_PRIORITY;
     }
 
   policy = sched_getscheduler(0);
   if (policy == ERROR)
     {
-      printf("%s: ERROR sched_getscheduler() failed\n", __FUNCTION__);
+      printf("sighand_test: ERROR sched_getscheduler() failed\n" );
       policy = SCHED_FIFO;
     }
 
@@ -210,11 +210,11 @@ void sighand_test(void)
                            PTHREAD_STACK_DEFAULT, waiter_main, 0, 0, 0, 0);
   if (waiterpid == ERROR)
     {
-      printf("%s: ERROR failed to start waiter_main\n", __FUNCTION__);
+      printf("sighand_test: ERROR failed to start waiter_main\n" );
     }
   else
     {
-       printf("%s: Started waiter_main pid=%d\n", __FUNCTION__, waiterpid);
+       printf("sighand_test: Started waiter_main pid=%d\n" , waiterpid);
     }
 
   /* Wait a bit */
@@ -228,7 +228,7 @@ void sighand_test(void)
   status = sigqueue(waiterpid, WAKEUP_SIGNAL, sigvalue);
   if (status != OK)
     {
-      printf("%s: ERROR sigqueue failed\n", __FUNCTION__);
+      printf("sighand_test: ERROR sigqueue failed\n" );
       task_delete(waiterpid);
     }
 
@@ -241,14 +241,14 @@ void sighand_test(void)
 
   if (!threadexited)
     {
-      printf("%s: ERROR waiter task did not exit\n", __FUNCTION__);
+      printf("sighand_test: ERROR waiter task did not exit\n" );
     }
 
   if (!sigreceived)
     {
-      printf("%s: ERROR signal handler did not run\n", __FUNCTION__);
+      printf("sighand_test: ERROR signal handler did not run\n" );
     }
 
-  printf("%s: done\n", __FUNCTION__);
+  printf("sighand_test: done\n" );
   fflush(stdout);
 }
diff --git a/examples/ostest/timedwait.c b/examples/ostest/timedwait.c
index 9f3e61eae26eb45300e65e8b547b16ac4a1f0b5e..b01b352fff754328ad4c6f7496d16e53fe8ee69f 100644
--- a/examples/ostest/timedwait.c
+++ b/examples/ostest/timedwait.c
@@ -49,19 +49,19 @@ static void *thread_waiter(void *parameter)
 
   /* Take the mutex */
 
-  printf("%s: Taking mutex\n", __FUNCTION__);
+  printf("thread_waiter: Taking mutex\n");
   status = pthread_mutex_lock(&mutex);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_mutex_lock failed, status=%d\n", __FUNCTION__, status);
+      printf("thread_waiter: ERROR pthread_mutex_lock failed, status=%d\n", status);
     }
 
-  printf("%s: Starting 5 second wait for condition\n", __FUNCTION__);
+  printf("thread_waiter: Starting 5 second wait for condition\n");
 
   status = clock_gettime(CLOCK_REALTIME, &time);
   if (status != 0)
     {
-      printf("%s: ERROR clock_gettime failed\n", __FUNCTION__);
+      printf("thread_waiter: ERROR clock_gettime failed\n");
     }
   time.tv_sec += 5;
 
@@ -70,19 +70,19 @@ static void *thread_waiter(void *parameter)
   status = pthread_cond_timedwait(&cond, &mutex, &time);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_cond_timedwait failed, status=%d\n", __FUNCTION__, status);
+      printf("thread_waiter: ERROR pthread_cond_timedwait failed, status=%d\n", status);
     }
 
   /* Release the mutex */
 
-  printf("%s: Releasing mutex\n", __FUNCTION__);
+  printf("thread_waiter: Releasing mutex\n");
   status = pthread_mutex_unlock(&mutex);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_mutex_unlock failed, status=%d\n", __FUNCTION__, status);
+      printf("thread_waiter: ERROR pthread_mutex_unlock failed, status=%d\n", status);
     }
 
-  printf("%s: Exit with status 0x12345678\n", __FUNCTION__);
+  printf("thread_waiter: Exit with status 0x12345678\n");
   pthread_exit((void*)0x12345678);
   return NULL;
 }
@@ -98,36 +98,36 @@ void timedwait_test(void)
 
   /* Initialize the mutex */
 
-  printf("%s: Initializing mutex\n", __FUNCTION__);
+  printf("thread_waiter: Initializing mutex\n");
   status = pthread_mutex_init(&mutex, NULL);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_mutex_init failed, status=%d\n", __FUNCTION__, status);
+      printf("timedwait_test:  ERROR pthread_mutex_init failed, status=%d\n", status);
     }
 
   /* Initialize the condition variable */
 
-  printf("%s: Initializing cond\n", __FUNCTION__);
+  printf("timedwait_test:  Initializing cond\n");
   status = pthread_cond_init(&cond, NULL);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_condinit failed, status=%d\n", __FUNCTION__, status);
+      printf("timedwait_test:  ERROR pthread_condinit failed, status=%d\n", status);
     }
 
   /* Start the waiter thread at higher priority */
 
-  printf("%s: Starting waiter\n", __FUNCTION__);
+  printf("timedwait_test:  Starting waiter\n");
   status = pthread_attr_init(&attr);
   if (status != 0)
     {
-      printf("%s: pthread_attr_init failed, status=%d\n", __FUNCTION__, status);
+      printf("timedwait_test:  pthread_attr_init failed, status=%d\n", status);
     }
 
   prio_max = sched_get_priority_max(SCHED_FIFO);
   status = sched_getparam (getpid(), &sparam);
   if (status != 0)
     {
-      printf("%s: sched_getparam failed\n", __FUNCTION__);
+      printf("timedwait_test:  sched_getparam failed\n");
       sparam.sched_priority = PTHREAD_DEFAULT_PRIORITY;
     }
 
@@ -135,27 +135,27 @@ void timedwait_test(void)
   status = pthread_attr_setschedparam(&attr,&sparam);
   if (status != OK)
     {
-      printf("%s: pthread_attr_setschedparam failed, status=%d\n", __FUNCTION__, status);
+      printf("timedwait_test:  pthread_attr_setschedparam failed, status=%d\n", status);
     }
   else
     {
-      printf("%s: Set thread 2 priority to %d\n", __FUNCTION__, sparam.sched_priority);
+      printf("timedwait_test:  Set thread 2 priority to %d\n", sparam.sched_priority);
     }
 
   status = pthread_create(&waiter, &attr, thread_waiter, NULL);
   if (status != 0)
     {
-      printf("%s: pthread_create failed, status=%d\n", __FUNCTION__, status);
+      printf("timedwait_test:  pthread_create failed, status=%d\n", status);
     }
 
-  printf("%s: Joining\n", __FUNCTION__);
+  printf("timedwait_test:  Joining\n");
   status = pthread_join(waiter, &result);
   if (status != 0)
     {
-      printf("%s: ERROR pthread_join failed, status=%d\n", __FUNCTION__, status);
+      printf("timedwait_test:  ERROR pthread_join failed, status=%d\n", status);
     }
   else
     {
-      printf("%s: waiter exited with result=%p\n", __FUNCTION__, result);
+      printf("timedwait_test:  waiter exited with result=%p\n", result);
     }
 }
diff --git a/include/ctype.h b/include/ctype.h
index c9acca9e7029cd379729fe706ef14e4e321b5597..9b62034ff714ee2bfa145e50ca56e3f8fdc850b8 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -49,7 +49,7 @@
 #include <sys/types.h>
 
 /************************************************************
- * Public Type Definitions
+ * Definitions
  ************************************************************/
 
 /************************************************************
@@ -63,18 +63,9 @@
  *
  ************************************************************/
 
-static inline int isspace(int c)
-{
-  if (c == ' '  || c == '\t' || c == '\n' || \
-      c == '\r' || c == '\f' || c == '\v')
-    {
-      return TRUE;
-    }
-  else
-    {
-      return FALSE;
-    }
-}
+#define isspace(c) \
+  (c == ' '  || c == '\t' || c == '\n' || \
+   c == '\r' || c == '\f' || c== '\v')
 
 /************************************************************
  * Function:  isdigit
@@ -84,10 +75,8 @@ static inline int isspace(int c)
  *
  ************************************************************/
 
-static inline int isdigit(int c)
-{
-  return (c >= '0' && c <= '9');
-}
+#define isdigit(c) \
+  (c >= '0' && c <= '9')
 
 /************************************************************
  * Function:  isascii
@@ -98,14 +87,11 @@ static inline int isdigit(int c)
  *
  ************************************************************/
 
-static inline int isascii(int c)
-{
-  return (c >= 0 && c <= 0177);
-}
-
+#define isascii(c) \
+  (c >= 0 && c <= 0177);
 
 /************************************************************
- * Function:  isascii
+ * Function:  isxdigit
  *
  * Description:
  *   isxdigit() checks for a hexadecimal digits, i.e. one of
@@ -113,60 +99,36 @@ static inline int isascii(int c)
  *
  ************************************************************/
 
-static inline int isxdigit(int c)
-{
-  if ((c >= '0' && c <= '9') ||
-      (c >= 'a' && c <= 'f') ||
-      (c >= 'A' && c <= 'F'))
-    {
-      return 1;
-    }
-  else
-    {
-
-      return 0;
-    }
-}
+#define isxdigit(c) \
+  ((c >= '0' && c <= '9') || \
+   (c >= 'a' && c <= 'f') || \
+   (c >= 'A' && c <= 'F'))
 
 /************************************************************
- * Function:  isascii
+ * Function:  toupper
  *
  * Description:
  *   toupper() converts the letter c to upper case, if possible.
  *
  ************************************************************/
 
-static inline int toupper(int c)
-{
-  if (c >= 'a' && c <= 'z')
-    {
-      return c - 'a' + 'A';
-    }
-  else
-    {
-      return c;
-    }
-}
+#define toupper(c) \
+  ((c >= 'a' && c <= 'z') ? ((c) - 'a' + 'A') : (c))
 
 /************************************************************
- * Function:  isascii
+ * Function:  tolower
  *
  * Description:
  *   tolower() converts the letter c to lower case, if possible.
  *
  ************************************************************/
 
-static inline int tolower(int c)
-{
-  if (c >= 'A' && c <= 'Z')
-    {
-      return c - 'A' + 'a';
-    }
-  else
-    {
-      return c;
-    }
-}
+#define tolower(c) \
+  ((c >= 'A' && c <= 'Z') ? ((c) - 'A' + 'a') : (c))
+
+/************************************************************
+ * Public Type Definitions
+ ************************************************************/
 
 /************************************************************
  * Public Functions
diff --git a/include/debug.h b/include/debug.h
index db47bf6b121f19cdc4f0014f1eae7d34fbea7622..2055fb9db67beeb1895d36682c3e199f72000d2a 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -48,17 +48,28 @@
 
 /* Debug macros to runtime filter the opsys debug messages */
 
+#ifdef __GNUC__
+# define EXTRA_FMT "%s: "
+# define EXTRA_ARG ,__FUNCTION__
+#else
+# define EXTRA_FMT
+# define EXTRA_ARG
+#endif
+
 #ifdef CONFIG_DEBUG
-# define dbg(format, arg...) lib_rawprintf(format, ##arg)
+# define dbg(format, arg...) \
+  lib_rawprintf(EXTRA_FMT format EXTRA_ARG, ##arg)
 
 # ifdef CONFIG_ARCH_LOWPUTC
-#  define lldbg(format, arg...) lib_lowprintf(format, ##arg)
+#  define lldbg(format, arg...) \
+     lib_lowprintf(EXTRA_FMT format EXTRA_ARG, ##arg)
 # else
 #  define lldbg(x...)
 # endif
 
 # ifdef CONFIG_DEBUG_VERBOSE
-#  define vdbg(format, arg...) lib_rawprintf(format, ##arg)
+#  define vdbg(format, arg...) \
+     lib_rawprintf(EXTRA_FMT format EXTRA_ARG, ##arg)
 # else
 #  define vdbg(x...)
 # endif
diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h
index a5731b7a0ee3e9aae70e759d7e5c5bbda23ef067..1299b53f0f9f6a13e29058098d9d26441e0704ed 100644
--- a/include/nuttx/arch.h
+++ b/include/nuttx/arch.h
@@ -405,7 +405,7 @@ EXTERN void sched_process_timer(void);
  *
  ***********************************************************/
 
-EXTERN void irq_dispatch(int irq, struct xcptcontext *xcp);
+EXTERN void irq_dispatch(int irq, void *context);
 
 /************************************************************
  * Debug interfaces exported by the architecture-specific
diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h
index 5ada38075e0619bf5e13a14d04a82c06bd7b8b3a..1916d8b9c59ecfb99e335879667b2ed2243f7a19 100644
--- a/include/nuttx/compiler.h
+++ b/include/nuttx/compiler.h
@@ -49,7 +49,7 @@
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
 # define weak_function __attribute__ ((weak))
 # define weak_const_function __attribute__ ((weak, __const__))
-# define noreturn_function
+# define noreturn_function __attribute__ ((noreturn))
 #else
 # define weak_alias(name, aliasname)
 # define weak_function
diff --git a/include/nuttx/irq.h b/include/nuttx/irq.h
index e1b1c5a65c2222f36cefbd3721f9f5919e0f1dd0..0e29e2476f7c01966d8adb42fad5bc073edc4e1f 100644
--- a/include/nuttx/irq.h
+++ b/include/nuttx/irq.h
@@ -60,11 +60,9 @@
 /* This struct defines the way the registers are stored */
 
 #ifndef __ASSEMBLY__
-struct xcptcontext; /* forward reference */
-
-typedef int (*xcpt_t)(int irq, struct xcptcontext *xcp);
+typedef int (*xcpt_t)(int irq, void *context);
 typedef int (*swint_t)(uint32 code, uint32 parm2, uint32 parm3,
-                        struct xcptcontext *xcp);
+                       void *context);
 #endif
 
 /* Now include architecture-specific types */
diff --git a/include/pthread.h b/include/pthread.h
index c15cf3e0f6abd21a61b64418a38b48bbda54d123..c03e2a5fad9c3e8c00f07eb8b651b3700f723635 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -40,10 +40,11 @@
  * Included Files
  ************************************************************/
 
-#include <nuttx/config.h> /* Default settings */
-#include <sys/types.h>    /* Needed for general types */
-#include <semaphore.h>    /* Needed for sem_t */
-#include <time.h>         /* Needed for struct timespec */
+#include <nuttx/config.h>   /* Default settings */
+#include <sys/types.h>      /* Needed for general types */
+#include <semaphore.h>      /* Needed for sem_t */
+#include <time.h>           /* Needed for struct timespec */
+#include <nuttx/compiler.h> /* For noreturn_function */
 
 /************************************************************
  * Compilation Switches
@@ -117,11 +118,7 @@ struct pthread_addr_s
 };
 typedef struct pthread_addr_s pthread_attr_t;
 
-struct pthread_s
-{
-  int pid;
-};
-typedef struct pthread_s pthread_t;
+typedef pid_t pthread_t;
 
 typedef int pthread_condattr_t;
 
@@ -215,7 +212,7 @@ EXTERN int pthread_detach(pthread_t thread);
  * execution of another thread.
  *----------------------------------------------------------*/
 
-EXTERN void pthread_exit(pthread_addr_t pvValue) __attribute__ ((noreturn));
+EXTERN void pthread_exit(pthread_addr_t pvValue) noreturn_function;
 EXTERN int  pthread_cancel(pthread_t thread);
 EXTERN int  pthread_setcancelstate(int state, int *oldstate);
 EXTERN void pthread_testcancel(void);
@@ -238,7 +235,7 @@ EXTERN void pthread_yield(void);
  * A thread may obtain a copy of its own thread handle.
  *----------------------------------------------------------*/
 
-EXTERN pthread_t pthread_self(void);
+#define pthread_self() ((pthread_t)getpid())
 
 /*----------------------------------------------------------*
  * Thread scheduling parameters
diff --git a/include/signal.h b/include/signal.h
index 67236fd6c560314bc920ceb2ddcb76b38a4e2070..621a6d5f35ece011c51b1ed5ccfa07b7076a1412 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -40,6 +40,7 @@
  * Included Files
  ************************************************************/
 
+#include <nuttx/config.h>
 #include <time.h>      /* Needed for struct timespec */
 #include <sys/types.h> /* Needed for, e.g., sigset_t */
 
@@ -164,8 +165,12 @@ EXTERN int sigwaitinfo(const sigset_t *set,
 EXTERN int sigtimedwait(const sigset_t *set,
 			struct siginfo *value,
 			const struct timespec *timeout);
+#ifdef CONFIG_CAN_PASS_STRUCTS
 EXTERN int sigqueue(int tid, int signo,
 		    const union sigval value);
+#else
+EXTERN int sigqueue(int tid, int signo, void *sival_ptr);
+#endif
 
 #undef EXTERN
 #ifdef __cplusplus
diff --git a/include/stdio.h b/include/stdio.h
index b210dc708e823ce8f3df031b595e950f927b4690..0cc8639b465edde7bcdd3fb4e460453e3853ea7b 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -200,6 +200,7 @@ typedef void DIR;
 
 /* Used to reference stdin, stdout, and stderr */
 
+#ifdef CONFIG_HAVE_INLINE
 static inline FILE *__stdfile(int fd)
 {
   if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS)
@@ -212,6 +213,9 @@ static inline FILE *__stdfile(int fd)
     }
   return NULL;
 }
+#else
+extern FILE *__stdfile(int fd);
+#endif
 
 /************************************************************
  * Public Function Prototypes
diff --git a/include/stdlib.h b/include/stdlib.h
index c5cf3edda31421da5fe9cae2109b6195e8c9424a..ba4f2b502a15f3ea9e8dbe9fc993127baf5e80f6 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -97,7 +97,7 @@ EXTERN int    atexit(void (*func)(void));
 /* String to binary conversions */
 #define atoi(nptr) strtol((nptr), (char**)NULL, 10)
 EXTERN long   strtol(const char *, char **, int);
-EXTERN double strtod(const char *, char **);
+EXTERN double_t strtod(const char *, char **);
 
 /* Memory Management */
 EXTERN void  *malloc(size_t);
diff --git a/include/sys/types.h b/include/sys/types.h
index 4cebb48a94c3c038c12aef97941ef59cb6f0389f..82f7046d2cff40b75d0e3b69893e15ec2cc1e22f 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -40,6 +40,7 @@
  * Included Files
  ************************************************************/
 
+#include <nuttx/config.h>
 #include <arch/types.h>
 
 /************************************************************
@@ -110,6 +111,12 @@
  * Type Declarations
  ************************************************************/
 
+#ifndef CONFIG_HAVE_DOUBLE
+typedef float  double_t;
+#else
+typedef double double_t;
+#endif
+
 /* Misc. scalar types */
 
 typedef uint32        mode_t;
diff --git a/include/unistd.h b/include/unistd.h
index d68b0e28b262da406fcf54c49bfbcb820faa7a9c..e6c787ecc9f5ea229edee283b771bab6d17918da 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -41,6 +41,7 @@
  ************************************************************/
 
 #include <sys/types.h>
+#include <nuttx/compiler.h>
 
 /************************************************************
  * Definitions
@@ -67,7 +68,7 @@ extern "C" {
 /* Task Control Interfaces (based on ANSII APIs) */
 
 EXTERN pid_t getpid( void );
-EXTERN void _exit(int status) __attribute__ ((noreturn));
+EXTERN void _exit(int status) noreturn_function;
 EXTERN unsigned int sleep(unsigned int seconds);
 EXTERN void usleep(unsigned long usec);
 
diff --git a/lib/lib_libvsprintf.c b/lib/lib_libvsprintf.c
index da03f7f3186e40fb4b9a43f523ca7f4238f85d52..2e60ffa22f102ad6e529684ee9431ba7c11c8917 100644
--- a/lib/lib_libvsprintf.c
+++ b/lib/lib_libvsprintf.c
@@ -807,7 +807,7 @@ int lib_vsprintf(struct lib_stream_s *obj, const char *src, va_list ap)
                   char tmpfmt[40];
                   const char *psrc;
                   char *pdst;
-                  double dbl;
+                  double_t dbl;
 
                   /* Reconstruct the floating point format. */
 
@@ -818,7 +818,7 @@ int lib_vsprintf(struct lib_stream_s *obj, const char *src, va_list ap)
 
                   /* Extract the floating point number. */
 
-                  dbl = va_arg(ap, double);
+                  dbl = va_arg(ap, double_t);
 
                   /* Then let the lib_sprintf do the work. */
 
diff --git a/lib/lib_rand.c b/lib/lib_rand.c
index 5ce708bc82c6197bb6470bcdc34d9d87277284de..5dde2dd8ce80b302f66afe12446354f31ba05a00 100644
--- a/lib/lib_rand.c
+++ b/lib/lib_rand.c
@@ -81,11 +81,11 @@
  ************************************************************/
 
 static unsigned int nrand(unsigned int nLimit);
-static double frand1(void);
+static double_t frand1(void);
 #if (RND_ORDER > 1)
-static double frand2(void);
+static double_t frand2(void);
 #if (RND_ORDER > 2)
-static double frand3(void);
+static double_t frand3(void);
 #endif
 #endif
 
@@ -140,7 +140,7 @@ int rand(void)
 static unsigned int nrand(unsigned int nLimit)
 {
   unsigned long nResult;
-  double fRatio;
+  double_t fRatio;
 
   /* Loop to be sure a legal random number is generated */
   do {
@@ -155,7 +155,7 @@ static unsigned int nrand(unsigned int nLimit)
 #endif
 
     /* Then, produce the return-able value */
-    nResult = (unsigned long)(((double)nLimit) * fRatio);
+    nResult = (unsigned long)(((double_t)nLimit) * fRatio);
 
   } while (nResult >= (unsigned long)nLimit);
 
@@ -163,7 +163,7 @@ static unsigned int nrand(unsigned int nLimit)
 
 } /* end nrand */
 
-static double frand1(void)
+static double_t frand1(void)
 {
   unsigned long nRandInt;
 
@@ -172,12 +172,12 @@ static double frand1(void)
   g_nRandInt1 = nRandInt;
 
   /* Construct an floating point value in the range from 0.0 up to 1.0 */
-  return ((double)nRandInt) / ((double)RND_CONSTP);
+  return ((double_t)nRandInt) / ((double_t)RND_CONSTP);
 
 } /* end frand */
 
 #if (RND_ORDER > 1)
-static double frand2(void)
+static double_t frand2(void)
 {
   unsigned long nRandInt;
 
@@ -188,12 +188,12 @@ static double frand2(void)
   g_nRandInt1 = nRandInt;
 
   /* Construct an floating point value in the range from 0.0 up to 1.0 */
-  return ((double)nRandInt) / ((double)RND_CONSTP);
+  return ((double_t)nRandInt) / ((double_t)RND_CONSTP);
 
 } /* end frand */
 
 #if (RND_ORDER > 2)
-static double frand(void)
+static double_t frand(void)
 {
   unsigned long nRandInt;
 
@@ -205,7 +205,7 @@ static double frand(void)
   g_nRandInt1 = nRandInt;
 
   /* Construct an floating point value in the range from 0.0 up to 1.0 */
-  return ((double)nRandInt) / ((double)RND_CONSTP);
+  return ((double_t)nRandInt) / ((double_t)RND_CONSTP);
 
 } /* end frand */
 #endif
diff --git a/lib/lib_rint.c b/lib/lib_rint.c
index f747eea8636aee89b2b67ab436ac1c66adce6766..73600f6bfe2aba183cf822d1ba621c3fc158b97a 100644
--- a/lib/lib_rint.c
+++ b/lib/lib_rint.c
@@ -72,9 +72,9 @@
  * Private Variables
  ************************************************************/
 
-double rint(double x)
+double_t rint(double x)
 {
-  double retValue;
+  double_t retValue;
 
 /* If the current rounding mode rounds toward negative
  * infinity, rint() is identical to floor().  If the current
@@ -93,7 +93,7 @@ double rint(double x)
    * |rint(x)-x|=1/2, then rint(x) is even. */
 
   long dwInteger = (long)x;
-  double fRemainder = x - (double)dwInteger;
+  double_t fRemainder = x - (double_t)dwInteger;
 
   if (x < 0.0) {
 
@@ -116,7 +116,7 @@ double rint(double x)
     } /* end if */
   } /* end else */
 
-  retValue = (double)dwInteger;
+  retValue = (double_t)dwInteger;
 #endif
 
   return retValue;
diff --git a/lib/lib_sscanf.c b/lib/lib_sscanf.c
index 4f100c8cabb47b8a1797d1af52aada33183a13f3..efd4ebcfaac73dd172db4d62ca22f51c3057bbe2 100644
--- a/lib/lib_sscanf.c
+++ b/lib/lib_sscanf.c
@@ -286,7 +286,7 @@ int vsscanf(char *buf, const char *s, va_list ap)
 		{
 		  /* strtod always returns a double */
 
-		  double dvalue = strtod(tmp, NULL);
+		  double_t dvalue = strtod(tmp, NULL);
 		  void *pv = va_arg(ap, void*);
 
 		  vdbg("vsscanf: Return %f to 0x%p\n", dvalue, pv);
@@ -295,11 +295,13 @@ int vsscanf(char *buf, const char *s, va_list ap)
 		   * float or a double.
 		   */
 
+#ifdef CONFIG_HAVE_DOUBLE
 		  if (lflag)
 		    {
-		      *((double*)pv) = dvalue;
+		      *((double_t*)pv) = dvalue;
 		    }
 		  else
+#endif
 		    {
 		      *((float*)pv) = (float)dvalue;
 		    }
diff --git a/mm/mm_memalign.c b/mm/mm_memalign.c
index b91625d0a22c63583779ccf17854891dedaf7324..18f3b295a098dd67561a0995ab10e57d69902872 100644
--- a/mm/mm_memalign.c
+++ b/mm/mm_memalign.c
@@ -97,8 +97,6 @@ void *memalign(size_t alignment, size_t size)
   size      = MM_ALIGN_UP(size);   /* Make mutliples of our granule size */
   allocsize = size + 2*alignment;  /* Add double full alignment size */
 
-  /* If the alignment is small
-
   /* Then malloc that size */
 
   rawchunk = (uint32)malloc(allocsize);
diff --git a/mm/mm_sem.c b/mm/mm_sem.c
index be3a2c1b0e80c60cf8e8d45e3f1e6dd67e8a5297..3a790de1e04a2f2414020908a70341b2e652bd03 100644
--- a/mm/mm_sem.c
+++ b/mm/mm_sem.c
@@ -113,7 +113,7 @@ void mm_takesemaphore(void)
     {
       /* Take the semaphore (perhaps waiting) */
 
-      msemdbg("%s: PID=%d taking\n", __FUNCTION__, my_pid);
+      msemdbg("PID=%d taking\n", my_pid);
       while (sem_wait(&g_mm_semaphore) != 0)
        {
          /* The only case that an error should occur here is if
@@ -129,8 +129,8 @@ void mm_takesemaphore(void)
       g_counts_held = 1;
     }
 
-  msemdbg("%s: Holder=%d count=%d\n",
-          __FUNCTION__, g_holder, g_counts_held);
+  msemdbg("Holder=%d count=%d\n",
+          g_holder, g_counts_held);
 }
 
 /************************************************************
@@ -152,14 +152,14 @@ void mm_givesemaphore(void)
       /* Yes, just release one count and return */
 
       g_counts_held--;
-      msemdbg("%s: Holder=%d count=%d\n",
-              __FUNCTION__, g_holder, g_counts_held);
+      msemdbg("Holder=%d count=%d\n",
+              g_holder, g_counts_held);
     }
   else
     {
       /* Nope, this is the last reference I have */
 
-      msemdbg("%s: PID=%d giving\n", __FUNCTION__, my_pid);
+      msemdbg("PID=%d giving\n", my_pid);
       g_holder = -1;
       g_counts_held = 0;
       ASSERT(sem_post(&g_mm_semaphore) == 0);
diff --git a/sched/Makefile b/sched/Makefile
index ebc27785d5fb5a7345ad8e13aa2450e28c629920..9872c7f02bdc862228b16b58e3b50bd5efc0972b 100644
--- a/sched/Makefile
+++ b/sched/Makefile
@@ -76,8 +76,7 @@ PTHREAD_SRCS	= pthread_attrinit.c pthread_attrdestroy.c \
 		  pthread_attrsetstacksize.c pthread_attrgetstacksize.c \
 		  pthread_attrsetschedparam.c pthread_attrgetschedparam.c \
 		  pthread_create.c pthread_exit.c pthread_join.c pthread_detach.c \
-		  pthread_yield.c pthread_self.c \
-		  pthread_getschedparam.c pthread_setschedparam.c \
+		  pthread_yield.c pthread_getschedparam.c pthread_setschedparam.c \
 		  pthread_mutexattrinit.c pthread_mutexattrdestroy.c \
 		  pthread_mutexattrgetpshared.c pthread_mutexattrsetpshared.c \
 		  pthread_mutexinit.c pthread_mutexdestroy.c \
diff --git a/sched/clock_getres.c b/sched/clock_getres.c
index 5cf07f24991b88232d1b75abf8b99bb7cfc5f955..b3d6247db6cdb40827d94cd4ab9f2ca81b79c204 100644
--- a/sched/clock_getres.c
+++ b/sched/clock_getres.c
@@ -88,13 +88,13 @@ int clock_getres(clockid_t clock_id, struct timespec *res)
   uint32 time_res;
   int    ret = OK;
 
-  dbg("%s: clock_id=%d\n", __FUNCTION__, clock_id);
+  dbg("clock_id=%d\n", clock_id);
 
   /* Only CLOCK_REALTIME is supported */
 
   if (clock_id != CLOCK_REALTIME)
     {
-      dbg("%s: Returning ERROR\n", __FUNCTION__);
+      dbg("Returning ERROR\n");
       *get_errno_ptr() = EINVAL;
       ret = ERROR;
     }
@@ -109,8 +109,7 @@ int clock_getres(clockid_t clock_id, struct timespec *res)
       res->tv_sec  = 0;
       res->tv_nsec = time_res;
 
-      dbg("%s: Returning res=(%d,%d) time_res=%d\n",
-          __FUNCTION__,
+      dbg("Returning res=(%d,%d) time_res=%d\n",
           (int)res->tv_sec, (int)res->tv_nsec,
           (int)time_res);
     }
diff --git a/sched/clock_gettime.c b/sched/clock_gettime.c
index ac9270975ceb0cacc4fae77f90ecfc25bf336e53..941d49e297805e8df7a904a295e2acec358224ce 100644
--- a/sched/clock_gettime.c
+++ b/sched/clock_gettime.c
@@ -90,13 +90,13 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
   uint32 nsecs;
   int ret = OK;
 
-  dbg("%s: clock_id=%d\n", __FUNCTION__, clock_id);
+  dbg("clock_id=%d\n", clock_id);
 
   /* Only CLOCK_REALTIME is supported */
 
   if (clock_id != CLOCK_REALTIME)
     {
-      dbg("%s: Returning ERROR\n", __FUNCTION__);
+      dbg("Returning ERROR\n");
 
       *get_errno_ptr() = EINVAL;
       ret = ERROR;
@@ -109,7 +109,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
 
       msecs = MSEC_PER_TICK * (g_system_timer - g_tickbias);
 
-      dbg("%s: msecs = %d g_tickbias=%d\n", __FUNCTION__,
+      dbg("msecs = %d g_tickbias=%d\n",
           (int)msecs, (int)g_tickbias);
 
       /* Get the elapsed time in seconds and nanoseconds. */
@@ -117,7 +117,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
       secs  = msecs / MSEC_PER_SEC;
       nsecs = (msecs - (secs * MSEC_PER_SEC)) * NSEC_PER_MSEC;
 
-      dbg("%s: secs = %d + %d nsecs = %d + %d\n", __FUNCTION__,
+      dbg("secs = %d + %d nsecs = %d + %d\n",
           (int)msecs, (int)g_basetime.tv_sec,
           (int)nsecs, (int)g_basetime.tv_nsec);
 
@@ -140,7 +140,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
       tp->tv_sec  = (time_t)secs;
       tp->tv_nsec = (long)nsecs;
 
-      dbg("%s: Returning tp=(%d,%d)\n", __FUNCTION__,
+      dbg("Returning tp=(%d,%d)\n",
           (int)tp->tv_sec, (int)tp->tv_nsec);
     }
 
diff --git a/sched/clock_settime.c b/sched/clock_settime.c
index c57fb28088650d57700b2b87c0ec610a542cf4ac..5f565ea36b40eab66981a94c929e880b1c6481fa 100644
--- a/sched/clock_settime.c
+++ b/sched/clock_settime.c
@@ -87,13 +87,13 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp)
 {
   int ret = OK;
 
-  dbg("%s: clock_id=%d\n", __FUNCTION__, clock_id);
+  dbg("clock_id=%d\n", clock_id);
 
   /* Only CLOCK_REALTIME is supported */
 
   if (clock_id != CLOCK_REALTIME || !tp) 
     {
-      dbg("%s: Returning ERROR\n", __FUNCTION__);
+      dbg("Returning ERROR\n");
       *get_errno_ptr() = EINVAL;
       ret = ERROR;
     }
@@ -109,8 +109,7 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp)
 
       g_tickbias = g_system_timer;
 
-      dbg("%s: basetime=(%d,%d) tickbias=%d\n",
-          __FUNCTION__,
+      dbg("basetime=(%d,%d) tickbias=%d\n",
           (int)g_basetime.tv_sec, (int)g_basetime.tv_nsec,
           (int)g_tickbias);
   }
diff --git a/sched/gmtime_r.c b/sched/gmtime_r.c
index 8661d73b7b0267ff67f929902119611f7dbdf546..bf9923bb34a2553deecf81765c584449638624f1 100644
--- a/sched/gmtime_r.c
+++ b/sched/gmtime_r.c
@@ -177,7 +177,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *result)
   /* Get the seconds since the EPOCH */
 
   time = *clock;
-  dbg("%s: clock=%d\n", __FUNCTION__, (int)time);
+  dbg("clock=%d\n", (int)time);
 
   /* Convert to days, hours, minutes, and seconds since the EPOCH */
 
@@ -192,14 +192,14 @@ struct tm *gmtime_r(const time_t *clock, struct tm *result)
 
   sec   = time;
 
-  dbg("%s: hour=%d min=%d sec=%d\n", __FUNCTION__,
+  dbg("hour=%d min=%d sec=%d\n",
       (int)hour, (int)min, (int)sec);
 
   /* Convert the days since the EPOCH to calendar day */
 
   clock_utc2calendar(jdn, &year, &month, &day);
 
-  dbg("%s: jdn=%d year=%d month=%d day=%d\n", __FUNCTION__,
+  dbg("jdn=%d year=%d month=%d day=%d\n",
       (int)jdn, (int)year, (int)month, (int)day);
 
   /* Then return the struct tm contents */
diff --git a/sched/irq_dispatch.c b/sched/irq_dispatch.c
index f783b2f54de5b65abff4633d249cd1cd89ea55a6..d6466cbc0d9016de7d907f3a39c1fed106daccee 100644
--- a/sched/irq_dispatch.c
+++ b/sched/irq_dispatch.c
@@ -76,7 +76,7 @@
  *
  ***********************************************************/
 
-void irq_dispatch(int irq, struct xcptcontext *xcp)
+void irq_dispatch(int irq, void *context)
 {
   xcpt_t vector;
 
@@ -93,6 +93,6 @@ void irq_dispatch(int irq, struct xcptcontext *xcp)
 
   /* Then dispatch to the interrupt handler */
 
-  vector(irq, xcp);
+  vector(irq, context);
 }
 
diff --git a/sched/irq_internal.h b/sched/irq_internal.h
index a11120f55c78cdd1219f51b094d293937cc7e035..211779bc370f0e14fca61c9918ebbc73edb74dfe 100644
--- a/sched/irq_internal.h
+++ b/sched/irq_internal.h
@@ -71,7 +71,7 @@ extern "C" {
 #endif
 
 EXTERN void weak_function irq_initialize(void);
-EXTERN int irq_unexpected_isr(int irq, struct xcptcontext *xcp);
+EXTERN int irq_unexpected_isr(int irq, void *context);
 
 #undef EXTERN
 #ifdef __cplusplus
diff --git a/sched/irq_unexpectedisr.c b/sched/irq_unexpectedisr.c
index c235c53a88e6c91c8a7712a3ec028a8c91104727..6ca3e1da83125f648a1858df6dcb6545081f3a9a 100644
--- a/sched/irq_unexpectedisr.c
+++ b/sched/irq_unexpectedisr.c
@@ -75,7 +75,7 @@
  *
  ************************************************************/
 
-int irq_unexpected_isr(int irq, struct xcptcontext *xcp)
+int irq_unexpected_isr(int irq, void *context)
 {
   (void)irqsave();
    PANIC(OSERR_UNEXPECTEDISR);
diff --git a/sched/mktime.c b/sched/mktime.c
index 9c849646330194b33d2936e7f83e73d57edbde71..a0ed379f1a5a514ebab6b5f2cac3c5cea5e4649a 100644
--- a/sched/mktime.c
+++ b/sched/mktime.c
@@ -126,14 +126,14 @@ time_t mktime(struct tm *tp)
    */
 
   jdn = clock_calendar2utc(tp->tm_year+1900, tp->tm_mon+1, tp->tm_mday);
-  dbg("%s: jdn=%d tm_year=%d tm_mon=%d tm_mday=%d\n",
-      __FUNCTION__, (int)jdn, tp->tm_year, tp->tm_mon, tp->tm_mday);
+  dbg("jdn=%d tm_year=%d tm_mon=%d tm_mday=%d\n",
+      (int)jdn, tp->tm_year, tp->tm_mon, tp->tm_mday);
 
   /* Return the seconds into the julian day. */
 
   ret = ((jdn*24 + tp->tm_hour)*60 + tp->tm_min)*60 + tp->tm_sec;
   dbg("%s:\tret=%d tm_hour=%d tm_min=%d tm_sec=%d\n",
-      __FUNCTION__, (int)ret, tp->tm_hour, tp->tm_min, tp->tm_sec);
+      (int)ret, tp->tm_hour, tp->tm_min, tp->tm_sec);
 
   return ret;
 }
diff --git a/sched/mq_internal.h b/sched/mq_internal.h
index 5768bbd706b4f61902c461fa0e432371c93cfb74..226835d21eadbf6f8c8d5cbfb98e05f0af0625db 100644
--- a/sched/mq_internal.h
+++ b/sched/mq_internal.h
@@ -138,10 +138,6 @@ struct mq_des
   int            oflags;      /* Flags set when message queue was opened */
 };
 
-/* This is the handle used to reference a message queue */
-
-typedef struct mq_des *mqd_t;
-
 /************************************************************
  * Global Variables
  ************************************************************/
diff --git a/sched/mq_send.c b/sched/mq_send.c
index b5dda827865edadf29b46bb367cba9a3ddd34bbc..431d8613c98d64de7d23b81a7f63845179187bd4 100644
--- a/sched/mq_send.c
+++ b/sched/mq_send.c
@@ -145,7 +145,7 @@ mqmsg_t *mq_msgalloc(void)
 
           else
             {
-              dbg("%s: Out of messages\n", __FUNCTION__);
+              dbg("Out of messages\n");
               PANIC((uint32)OSERR_OUTOFMESSAGES);
             }
         }
diff --git a/sched/os_start.c b/sched/os_start.c
index 1b249a5b91437e9003203227009508dfd1619ee2..b96a650cbe0d7ee766a8caf5407b60d75fcfec2f 100644
--- a/sched/os_start.c
+++ b/sched/os_start.c
@@ -192,7 +192,7 @@ void os_start(void)
   int init_taskid;
   int i;
 
-  lldbg("%s: Entry\n", __FUNCTION__);
+  lldbg("Entry\n");
 
   /* Initialize all task lists */
 
@@ -349,7 +349,7 @@ void os_start(void)
    * started by spawning the user init thread of execution.
    */
 
-  dbg("%s: Starting init thread\n", __FUNCTION__);
+  dbg("Starting init thread\n");
   init_taskid = task_create("init", SCHED_PRIORITY_DEFAULT,
                             CONFIG_PROC_STACK_SIZE,
                             (main_t)user_start, 0, 0, 0, 0);
@@ -357,7 +357,7 @@ void os_start(void)
 
   /* When control is return to this point, the system is idle. */
 
-  dbg("%s: Beginning Idle Loop\n", __FUNCTION__);
+  dbg("Beginning Idle Loop\n");
   for (;;)
     {
       /* Check if there is anything in the delayed deallocation list. */
diff --git a/sched/pthread_attrdestroy.c b/sched/pthread_attrdestroy.c
index 9bb86268c629df7a78713b4e6d3eb6b52b3132ee..c71fa6271fa75e23f4dd5e30b96d5ea54b8b7cc9 100644
--- a/sched/pthread_attrdestroy.c
+++ b/sched/pthread_attrdestroy.c
@@ -89,7 +89,7 @@ int pthread_attr_destroy(pthread_attr_t *attr)
 {
   int ret;
 
-  dbg("%s: attr=0x%p\n", __FUNCTION__, attr);
+  dbg("attr=0x%p\n", attr);
 
   if (!attr)
     {
@@ -101,7 +101,7 @@ int pthread_attr_destroy(pthread_attr_t *attr)
       ret = OK;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_attrgetinheritsched.c b/sched/pthread_attrgetinheritsched.c
index d0d3143e75c84ab91500f3a4245b1777469a3239..e1c69346cb4568f4deb9d6b304fb7ec2e5482d9d 100644
--- a/sched/pthread_attrgetinheritsched.c
+++ b/sched/pthread_attrgetinheritsched.c
@@ -92,8 +92,7 @@ int pthread_attr_getinheritsched(const pthread_attr_t *attr,
 {
   int ret;
 
-  dbg("%s: attr=0x%p inheritsched=0x%p\n",
-      __FUNCTION__,  attr, inheritsched);
+  dbg("attr=0x%p inheritsched=0x%p\n", attr, inheritsched);
 
   if (!attr || !inheritsched)
     {
@@ -105,7 +104,7 @@ int pthread_attr_getinheritsched(const pthread_attr_t *attr,
       ret = OK;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_attrgetschedparam.c b/sched/pthread_attrgetschedparam.c
index 2285895e7f8d7d3a3acb891cbe820f648abbb83d..defed57e61ae8503bc79b4cc1052beaeda1f6c0f 100644
--- a/sched/pthread_attrgetschedparam.c
+++ b/sched/pthread_attrgetschedparam.c
@@ -89,7 +89,7 @@ int pthread_attr_getschedparam(pthread_attr_t *attr,
 {
   int ret;
 
-  dbg("%s: attr=0x%p param=0x%p\n", __FUNCTION__, attr, param);
+  dbg("attr=0x%p param=0x%p\n", attr, param);
 
   if (!attr || !param)
     {
@@ -101,7 +101,7 @@ int pthread_attr_getschedparam(pthread_attr_t *attr,
       ret = OK;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_attrgetschedpolicy.c b/sched/pthread_attrgetschedpolicy.c
index 801226c9826f7532b498bbf60a83700c0e5047d5..67948cd953b74029a417fbcf0eabbc587e3f3d78 100644
--- a/sched/pthread_attrgetschedpolicy.c
+++ b/sched/pthread_attrgetschedpolicy.c
@@ -89,7 +89,7 @@ int pthread_attr_getschedpolicy(pthread_attr_t *attr, int *policy)
 {
   int ret;
 
-  dbg("%s: attr=0x%p policy=0x%p\n", __FUNCTION__, attr, policy);
+  dbg("attr=0x%p policy=0x%p\n", attr, policy);
 
   if (!attr || !policy)
     {
@@ -101,6 +101,6 @@ int pthread_attr_getschedpolicy(pthread_attr_t *attr, int *policy)
       ret = OK;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_attrgetstacksize.c b/sched/pthread_attrgetstacksize.c
index d36ae172e8b1ffba2bf8031927c55f0c9ff2a204..9b160ead63a51da22f842dae65a6aa12d76318cf 100644
--- a/sched/pthread_attrgetstacksize.c
+++ b/sched/pthread_attrgetstacksize.c
@@ -88,7 +88,7 @@ int pthread_attr_getstacksize(pthread_attr_t *attr, long *stacksize)
 {
   int ret;
 
-  dbg("%s: attr=0x%p stacksize=0x%p\n", __FUNCTION__, attr, stacksize);
+  dbg("attr=0x%p stacksize=0x%p\n", attr, stacksize);
 
   if (!stacksize)
     {
@@ -100,7 +100,7 @@ int pthread_attr_getstacksize(pthread_attr_t *attr, long *stacksize)
       ret = OK;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_attrinit.c b/sched/pthread_attrinit.c
index 51d2ea5250de1929b9d6d2e0116d57a438204640..7f6639b9c42a701d1c8cefd644c3f26747867cd3 100644
--- a/sched/pthread_attrinit.c
+++ b/sched/pthread_attrinit.c
@@ -90,7 +90,7 @@ int pthread_attr_init(pthread_attr_t *attr)
 {
   int ret = OK;
 
-  dbg("%s: attr=0x%p\n", __FUNCTION__, attr);
+  dbg("attr=0x%p\n", attr);
   if (!attr)
     {
       ret = ENOMEM;
@@ -105,7 +105,7 @@ int pthread_attr_init(pthread_attr_t *attr)
       memcpy(attr, &g_default_pthread_attr, sizeof(pthread_attr_t));
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_attrsetinheritsched.c b/sched/pthread_attrsetinheritsched.c
index e83d13d73df64baf87dc7d6d211cdd616fc7b859..75468aad33aa0da84f054ddc2498b04fd0bbfda4 100644
--- a/sched/pthread_attrsetinheritsched.c
+++ b/sched/pthread_attrsetinheritsched.c
@@ -92,7 +92,7 @@ int pthread_attr_setinheritsched(pthread_attr_t *attr,
 {
   int ret;
 
-  dbg("%s: inheritsched=%d\n", __FUNCTION__, inheritsched);
+  dbg("inheritsched=%d\n", inheritsched);
 
   if (!attr ||
       (inheritsched != PTHREAD_INHERIT_SCHED &&
@@ -106,7 +106,7 @@ int pthread_attr_setinheritsched(pthread_attr_t *attr,
       ret = OK;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_attrsetschedparam.c b/sched/pthread_attrsetschedparam.c
index 4a0d983483b486e5aecdb2f3f41d88ad0b8e5231..77dfa1ccc0b35e18d51bc0818c86791bc40a0c26 100644
--- a/sched/pthread_attrsetschedparam.c
+++ b/sched/pthread_attrsetschedparam.c
@@ -89,7 +89,7 @@ int pthread_attr_setschedparam(pthread_attr_t *attr,
 {
   int ret;
 
-  dbg("%s: attr=0x%p param=0x%p\n", __FUNCTION__, attr, param);
+  dbg("attr=0x%p param=0x%p\n", attr, param);
 
   if (!attr || !param)
     {
@@ -100,7 +100,7 @@ int pthread_attr_setschedparam(pthread_attr_t *attr,
       attr->priority = (short)param->sched_priority;
       ret = OK;
     }
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_attrsetschedpolicy.c b/sched/pthread_attrsetschedpolicy.c
index d750cf6fd41011894f20c933fd63d85d57d712bd..2ba20db517d1636fe6566a4d1d0a0625f9c90794 100644
--- a/sched/pthread_attrsetschedpolicy.c
+++ b/sched/pthread_attrsetschedpolicy.c
@@ -89,7 +89,7 @@ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
 {
   int ret;
 
-  dbg("%s: attr=0x%p policy=%d\n", __FUNCTION__, attr, policy);
+  dbg("attr=0x%p policy=%d\n", attr, policy);
 
 #if CONFIG_RR_INTERVAL > 0
   if (!attr || (policy != SCHED_FIFO && policy != SCHED_RR))
@@ -105,6 +105,6 @@ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
       ret = OK;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_attrsetstacksize.c b/sched/pthread_attrsetstacksize.c
index b33b75e63548ba9420f4624039e7d5d9ba5318fb..c62093f234292a3757556957e471866f05125f89 100644
--- a/sched/pthread_attrsetstacksize.c
+++ b/sched/pthread_attrsetstacksize.c
@@ -88,8 +88,7 @@ int pthread_attr_setstacksize(pthread_attr_t *attr, long stacksize)
 {
   int ret;
 
-  dbg("%s: attr=0x%p stacksize=%ld\n",
-      __FUNCTION__, attr, stacksize);
+  dbg("attr=0x%p stacksize=%ld\n", attr, stacksize);
 
   if (!attr || stacksize < PTHREAD_STACK_MIN)
     {
@@ -101,7 +100,7 @@ int pthread_attr_setstacksize(pthread_attr_t *attr, long stacksize)
       ret = OK;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_cancel.c b/sched/pthread_cancel.c
index d34c29ae3d08a769a4658c91fdd7e9f990bf927f..8b8c36c99150568b1e4cd8246dfd7eb93fd4a266 100644
--- a/sched/pthread_cancel.c
+++ b/sched/pthread_cancel.c
@@ -77,7 +77,7 @@ int pthread_cancel(pthread_t thread)
 
   /* First, make sure that the handle references a valid thread */
 
-  if (!thread.pid)
+  if (!thread)
     {
       /* pid == 0 is the IDLE task.  Callers cannot cancel the
        * IDLE task.
@@ -86,7 +86,7 @@ int pthread_cancel(pthread_t thread)
       return ESRCH;
     }
 
-  tcb = sched_gettcb(thread.pid);
+  tcb = sched_gettcb((pid_t)thread);
   if (!tcb)
     {
       /* The pid does not correspond to any known thread */
@@ -132,11 +132,11 @@ int pthread_cancel(pthread_t thread)
 
   /* Complete pending join operations */
 
-  (void)pthread_completejoin(thread.pid, PTHREAD_CANCELED);
+  (void)pthread_completejoin((pid_t)thread, PTHREAD_CANCELED);
 
   /* Then let pthread_delete do the real work */
 
-  task_delete(thread.pid);
+  task_delete((pid_t)thread);
   return OK;
 }
 
diff --git a/sched/pthread_completejoin.c b/sched/pthread_completejoin.c
index a5e7651e01a2fdd93be5e126b1d73d00a5cb3557..8e57ada8bab9dbeebf3fb134594ad52d62bcf3f0 100644
--- a/sched/pthread_completejoin.c
+++ b/sched/pthread_completejoin.c
@@ -79,7 +79,7 @@ static void pthread_destroyjoininfo(join_t *pjoin)
   int ntasks_waiting;
   int status;
 
-  dbg("%s: pjoin=0x%p\n", __FUNCTION__, pjoin);
+  dbg("pjoin=0x%p\n", pjoin);
 
   /* Are any tasks waiting for our exit value? */
 
@@ -150,7 +150,7 @@ int pthread_completejoin(pid_t pid, void *exit_value)
   join_t *pjoin;
   boolean detached = FALSE;
 
-  dbg("%s: process_id=%d exit_value=%p\n", __FUNCTION__, pid, exit_value);
+  dbg("process_id=%d exit_value=%p\n", pid, exit_value);
 
   /* First, find thread's structure in the private data set. */
 
@@ -170,7 +170,7 @@ int pthread_completejoin(pid_t pid, void *exit_value)
       detached = pjoin->detached;
       if (detached)
         {
-          dbg("%s: Detaching\n", __FUNCTION__);
+          dbg("Detaching\n");
 
           /* If so, then remove the thread's structure from the private
            * data set. After this point, no other thread can perform a join
diff --git a/sched/pthread_condattrdestroy.c b/sched/pthread_condattrdestroy.c
index a12c3f57c0f3ccd14b84ecdbcd2828d31365509c..8cc524ae5e073bb41d95c28a3dd4436362a69711 100644
--- a/sched/pthread_condattrdestroy.c
+++ b/sched/pthread_condattrdestroy.c
@@ -67,14 +67,14 @@ int pthread_condattr_destroy(pthread_condattr_t *attr)
 {
   int ret = OK;
 
-  dbg("%s: attr=0x%p\n", __FUNCTION__, attr);
+  dbg("attr=0x%p\n", attr);
 
   if (!attr)
     {
       ret = EINVAL;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_condattrinit.c b/sched/pthread_condattrinit.c
index 739b703ff0f016d1cef533ab9da9063f2f69de06..0d341dbc8febaf9e6c0b436cd0256061dde1122a 100644
--- a/sched/pthread_condattrinit.c
+++ b/sched/pthread_condattrinit.c
@@ -67,7 +67,7 @@ int pthread_condattr_init(pthread_condattr_t *attr)
 {
   int ret = OK;
 
-  dbg("%s: attr=0x%p\n", __FUNCTION__, attr);
+  dbg("attr=0x%p\n", attr);
 
   if (!attr)
     {
@@ -78,7 +78,7 @@ int pthread_condattr_init(pthread_condattr_t *attr)
       *attr = 0;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_condbroadcast.c b/sched/pthread_condbroadcast.c
index 322a4d288bc9a09b3d9379ef5a51d66dcc2e00a3..1fd129248564ce3a495322f1ca3a92872a8a3893 100644
--- a/sched/pthread_condbroadcast.c
+++ b/sched/pthread_condbroadcast.c
@@ -89,7 +89,7 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
   int ret = OK;
   int sval;
 
-  dbg("%s: cond=0x%p\n", __FUNCTION__, cond);
+  dbg("cond=0x%p\n", cond);
 
   if (!cond)
     {
@@ -135,7 +135,7 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
       sched_unlock();
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_conddestroy.c b/sched/pthread_conddestroy.c
index 5272008570a7aebde62482dc6a1bdf5a92de5a77..5c95577a96616c2b71f8aead5afc1b4799409539 100644
--- a/sched/pthread_conddestroy.c
+++ b/sched/pthread_conddestroy.c
@@ -67,7 +67,7 @@ int pthread_cond_destroy(pthread_cond_t *cond)
 {
   int ret = OK;
 
-  dbg("%s: cond=0x%p\n", __FUNCTION__, cond);
+  dbg("cond=0x%p\n", cond);
 
   if (!cond)
     {
@@ -81,7 +81,7 @@ int pthread_cond_destroy(pthread_cond_t *cond)
       ret = EINVAL;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_condinit.c b/sched/pthread_condinit.c
index 9dac4692fe88e1b9f37fd3fbaa01634fc41954d1..90ee127827314055bb16f77e13df710e9e78ac96 100644
--- a/sched/pthread_condinit.c
+++ b/sched/pthread_condinit.c
@@ -67,7 +67,7 @@ int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr)
 {
   int ret = OK;
 
-  dbg("%s: cond=0x%p attr=0x%p\n", __FUNCTION__, cond, attr);
+  dbg("cond=0x%p attr=0x%p\n", cond, attr);
 
   if (!cond)
     {
@@ -83,7 +83,7 @@ int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr)
       ret = EINVAL;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_condsignal.c b/sched/pthread_condsignal.c
index f9ee3781d2e51263d34ac8e24120f3513ec087d8..90698ce2aa093697c4b758b5f3185760ddb69713 100644
--- a/sched/pthread_condsignal.c
+++ b/sched/pthread_condsignal.c
@@ -88,7 +88,7 @@ int pthread_cond_signal(pthread_cond_t *cond)
   int ret = OK;
   int sval;
 
-  dbg("%s: cond=0x%p\n", __FUNCTION__, cond);
+  dbg("cond=0x%p\n", cond);
 
   if (!cond)
     {
@@ -110,16 +110,16 @@ int pthread_cond_signal(pthread_cond_t *cond)
 
       else
         {
-          dbg("%s: sval=%d\n", __FUNCTION__, sval);
+          dbg("sval=%d\n", sval);
           if (sval < 0)
             {
-              dbg("%s: Signalling...\n", __FUNCTION__);
+              dbg("Signalling...\n");
               ret = pthread_givesemaphore((sem_t*)&cond->sem);
             }
         }
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_condtimedwait.c b/sched/pthread_condtimedwait.c
index f6512269982910766184ccddf6098c73f88d7b7e..59d92921e8161fcbd4e26e277dd96bbb4a7c2764 100644
--- a/sched/pthread_condtimedwait.c
+++ b/sched/pthread_condtimedwait.c
@@ -116,8 +116,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
   int             int_state;
   int             status;
 
-  dbg("%s: cond=0x%p mutex=0x%p abstime=0x%p\n",
-      __FUNCTION__, cond, mutex, abstime);
+  dbg("cond=0x%p mutex=0x%p abstime=0x%p\n", cond, mutex, abstime);
 
   /* Make sure that non-NULL references were provided. */
 
@@ -153,7 +152,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
         }
       else
         {
-          dbg("%s: Give up mutex...\n", __FUNCTION__);
+          dbg("Give up mutex...\n");
 
           /* We must disable pre-emption and interrupts here so that
            * the time stays valid until the wait begins.   This adds
@@ -263,7 +262,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
 
                           if (*get_errno_ptr() == EINTR)
                             {
-                              dbg("%s: Timedout!\n", __FUNCTION__);
+                              dbg("Timedout!\n");
                               ret = ETIMEDOUT;
                             }
                           else
@@ -275,7 +274,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
 
                   /* Reacquire the mutex (retaining the ret). */
 
-                  dbg("%s: Re-locking...\n", __FUNCTION__);
+                  dbg("Re-locking...\n");
                   status = pthread_takesemaphore((sem_t*)&mutex->sem);
                   if (!status)
                     {
@@ -300,7 +299,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
         }
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_condwait.c b/sched/pthread_condwait.c
index 555d3d06ff585e55f505bcb8a3b5248ad3149fa2..cbfacf2a3257bfa6cbe346d8f529ca3b8d0a6510 100644
--- a/sched/pthread_condwait.c
+++ b/sched/pthread_condwait.c
@@ -90,7 +90,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
 {
   int ret;
 
-  dbg("%s: cond=0x%p mutex=0x%p\n", __FUNCTION__, cond, mutex);
+  dbg("cond=0x%p mutex=0x%p\n", cond, mutex);
 
   /* Make sure that non-NULL references were provided. */
 
@@ -110,7 +110,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
     {
       /* Give up the mutex */
 
-      dbg("%s: Give up mutex / take cond\n", __FUNCTION__);
+      dbg("Give up mutex / take cond\n");
 
       sched_lock();
       mutex->pid = 0;
@@ -123,7 +123,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
 
       /* Reacquire the mutex */
 
-      dbg("%s: Reacquire mutex...\n", __FUNCTION__);
+      dbg("Reacquire mutex...\n");
       ret |= pthread_takesemaphore((sem_t*)&mutex->sem);
       if (!ret)
         {
@@ -131,7 +131,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
         }
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_create.c b/sched/pthread_create.c
index c8ec604d1ae3fba89bf761c8bf0a88017040ec33..5d9104c754b209e95544aab1a7699baffe1a46da 100644
--- a/sched/pthread_create.c
+++ b/sched/pthread_create.c
@@ -297,7 +297,7 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr,
    */
 
   pid = (int)ptcb->pid;
-  pjoin->thread.pid = pid;
+  pjoin->thread = (pthread_t)pid;
 
   /* Initialize the semaphores in the join structure to zero. */
 
@@ -322,7 +322,7 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr,
 
       /* Return the thread information to the caller */
 
-      if (thread) thread->pid = pid;
+      if (thread) *thread = (pthread_t)pid;
       if (!pjoin->started) status = ERROR;
 
       sched_unlock();
diff --git a/sched/pthread_detach.c b/sched/pthread_detach.c
index 967ed237f92dfcc721794e9d0f5f0dc7f95507d6..4306b28e44ef5375306848cf25a173f25cda9f03 100644
--- a/sched/pthread_detach.c
+++ b/sched/pthread_detach.c
@@ -90,15 +90,15 @@ int pthread_detach(pthread_t thread)
   join_t *pjoin;
   int ret;
 
-  dbg("%s: Thread=%d\n", __FUNCTION__, thread.pid);
+  dbg("Thread=%d\n", thread);
 
   /* Find the entry associated with this pthread. */
 
   (void)pthread_takesemaphore(&g_join_semaphore);
-  pjoin = pthread_findjoininfo(thread.pid);
+  pjoin = pthread_findjoininfo((pid_t)thread);
   if (!pjoin)
     {
-      dbg("%s: Could not find thread entry\n", __FUNCTION__);
+      dbg("Could not find thread entry\n");
       ret = EINVAL;
     }
   else
@@ -109,7 +109,7 @@ int pthread_detach(pthread_t thread)
         {
           /* YES.. just remove the thread entry. */
 
-          (void)pthread_removejoininfo(thread.pid);
+          (void)pthread_removejoininfo((pid_t)thread);
           sched_free(pjoin);
           pjoin = NULL;
         }
@@ -129,6 +129,6 @@ int pthread_detach(pthread_t thread)
     }
   (void)pthread_givesemaphore(&g_join_semaphore);
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_exit.c b/sched/pthread_exit.c
index 5330ee3f07bfe4e3154945c33565a16e1098c08f..e6ed040d49cba6cad5c30ee75f669c93efa89618 100644
--- a/sched/pthread_exit.c
+++ b/sched/pthread_exit.c
@@ -91,7 +91,7 @@ void pthread_exit(void *exit_value)
   int error_code = (int)exit_value;
   int status;
 
-  dbg("%s: exit_value=%p\n", __FUNCTION__, exit_value);
+  dbg("exit_value=%p\n", exit_value);
 
   /* Complete pending join operations */
 
diff --git a/sched/pthread_findjoininfo.c b/sched/pthread_findjoininfo.c
index 48871cf80c88a4a3791765af6dfe2f3c76481e4f..1d33c50e0077d3df19779f69f9dc57afdcb06228 100644
--- a/sched/pthread_findjoininfo.c
+++ b/sched/pthread_findjoininfo.c
@@ -81,14 +81,14 @@
  *
  ************************************************************/
 
-join_t *pthread_findjoininfo(int pid)
+join_t *pthread_findjoininfo(pid_t pid)
 {
   join_t *pjoin;
 
   /* Find the entry with the matching pid */
 
   for (pjoin = g_pthread_head;
-       (pjoin && pjoin->thread.pid != pid);
+       (pjoin && (pid_t)pjoin->thread != pid);
        pjoin = pjoin->next);
 
   /* and return it */
diff --git a/sched/pthread_getschedparam.c b/sched/pthread_getschedparam.c
index 0a30fba8f6d79b9e8fe0a7ba9974f100447f05c4..0e410ef9ed6f14c0830903a2951eb629d0aceab0 100644
--- a/sched/pthread_getschedparam.c
+++ b/sched/pthread_getschedparam.c
@@ -91,8 +91,7 @@ int pthread_getschedparam(pthread_t thread, int *policy,
 {
   int ret;
 
-  dbg("%s: thread ID=%d policy=0x%p param=0x%p\n",
-      __FUNCTION__, thread.pid, policy, param);
+  dbg("Thread ID=%d policy=0x%p param=0x%p\n", thread, policy, param);
 
   if (!policy || !param)
     {
@@ -102,7 +101,7 @@ int pthread_getschedparam(pthread_t thread, int *policy,
     {
       /* Get the schedparams of the thread. */
 
-      ret = sched_getparam(thread.pid, param);
+      ret = sched_getparam((pid_t)thread, param);
       if (ret != OK)
         {
           ret = EINVAL;
@@ -110,14 +109,14 @@ int pthread_getschedparam(pthread_t thread, int *policy,
 
       /* Return the policy. */
 
-      *policy = sched_getscheduler(thread.pid);
+      *policy = sched_getscheduler((pid_t)thread);
       if (*policy == ERROR)
         {
           ret = *get_errno_ptr();
         }
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_internal.h b/sched/pthread_internal.h
index d0b1cdeb9e9421c3e8d1bd95a3e1ba5103b9746d..f23bafe5cbb9cea3ed0d51c8394bd434e52043b1 100644
--- a/sched/pthread_internal.h
+++ b/sched/pthread_internal.h
@@ -115,9 +115,9 @@ extern "C" {
 
 EXTERN void weak_function pthread_initialize(void);
 EXTERN int                pthread_completejoin(pid_t pid, void *exit_value);
-EXTERN join_t            *pthread_findjoininfo(int pid);
+EXTERN join_t            *pthread_findjoininfo(pid_t pid);
 EXTERN int                pthread_givesemaphore(sem_t *sem);
-EXTERN join_t            *pthread_removejoininfo(int pid);
+EXTERN join_t            *pthread_removejoininfo(pid_t pid);
 EXTERN int                pthread_takesemaphore(sem_t *sem);
 
 #undef EXTERN
diff --git a/sched/pthread_join.c b/sched/pthread_join.c
index 4e956777c9bb1455d13b1413b196f2f7ca455493..28c8bf1c9d6230b38823d2f79ec8255bbc6539eb 100644
--- a/sched/pthread_join.c
+++ b/sched/pthread_join.c
@@ -98,13 +98,13 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value)
   join_t *pjoin;
   int ret;
 
-  dbg("%s: thread=%d\n", __FUNCTION__, thread.pid);
+  dbg("thread=%d\n", thread);
 
   /* First make sure that this is not an attempt to join to
    * ourself.
    */
 
-  if (thread.pid == getpid())
+  if ((pid_t)thread == getpid())
     {
       return EDEADLK;
     }
@@ -124,14 +124,14 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value)
    * was detached and has exitted.
    */
 
-  pjoin = pthread_findjoininfo(thread.pid);
+  pjoin = pthread_findjoininfo((pid_t)thread);
   if (!pjoin)
     {
       /* Determine what kind of error to return */
 
-      _TCB *tcb = sched_gettcb(thread.pid);
+      _TCB *tcb = sched_gettcb((pthread_t)thread);
 
-      dbg("%s: Could not find thread data\n", __FUNCTION__);
+      dbg("Could not find thread data\n");
 
       /* Case (1) or (3) -- we can't tell which.  Assume (3) */
 
@@ -153,26 +153,26 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value)
     }
   else if (pjoin->terminated)
     {
-      dbg("%s: Thread has terminated\n", __FUNCTION__);
+      dbg("Thread has terminated\n");
 
       /* Get the thread exit value from the terminated thread. */
 
       if (pexit_value)
         {
-          dbg("%s: exit_value=0x%p\n", __FUNCTION__, pjoin->exit_value);
+          dbg("exit_value=0x%p\n", pjoin->exit_value);
           *pexit_value = pjoin->exit_value;
         }
 
       /* Then remove and deallocate the thread entry. */
 
-      (void)pthread_removejoininfo(thread.pid);
+      (void)pthread_removejoininfo((pid_t)thread);
       (void)pthread_givesemaphore(&g_join_semaphore);
       sched_free(pjoin);
       ret = OK;
     }
   else
     {
-      dbg("%s: Thread is still running\n", __FUNCTION__);
+      dbg("Thread is still running\n");
 
       /* Relinquish the data set semaphore, making certain that
        * no task has the opportunity to run between the time
@@ -192,7 +192,7 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value)
       if (pexit_value)
         {
           *pexit_value = pjoin->exit_value;
-          dbg("%s: exit_value=0x%p\n", __FUNCTION__, pjoin->exit_value);
+          dbg("exit_value=0x%p\n", pjoin->exit_value);
         }
 
       /* Post the thread's join semaphore so that exitting thread
@@ -208,6 +208,6 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value)
       ret = OK;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_mutexattrdestroy.c b/sched/pthread_mutexattrdestroy.c
index 8e3abdb47bdd20caead4a1140e3d648375b198b8..a61b60c8764315f07f5bb1a2d616ea1df925ce7d 100644
--- a/sched/pthread_mutexattrdestroy.c
+++ b/sched/pthread_mutexattrdestroy.c
@@ -88,7 +88,7 @@ int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
 {
   int ret = OK;
 
-  dbg("%s: attr=0x%p\n", __FUNCTION__, attr);
+  dbg("attr=0x%p\n", attr);
 
   if (!attr)
     {
@@ -99,6 +99,6 @@ int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
       attr->pshared = 0;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_mutexattrgetpshared.c b/sched/pthread_mutexattrgetpshared.c
index 1d54b901273ea537acee67123c1c561a3e0d190f..82198dfddb11ecdab358294a5272b7b3f8a129e4 100644
--- a/sched/pthread_mutexattrgetpshared.c
+++ b/sched/pthread_mutexattrgetpshared.c
@@ -88,7 +88,7 @@ int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared)
 {
   int ret = OK;
 
-  dbg("%s: attr=0x%p pshared=0x%p\n", __FUNCTION__, attr, pshared);
+  dbg("attr=0x%p pshared=0x%p\n", attr, pshared);
 
   if (!attr || !pshared)
     {
@@ -99,6 +99,6 @@ int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared)
       *pshared = attr->pshared;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_mutexattrinit.c b/sched/pthread_mutexattrinit.c
index 920ccf0ee4f42d7b359107f00ccee576fcf0a3c9..6bddd19f441634b306298d198c778628f0cbb4ad 100644
--- a/sched/pthread_mutexattrinit.c
+++ b/sched/pthread_mutexattrinit.c
@@ -87,7 +87,7 @@ int pthread_mutexattr_init(pthread_mutexattr_t *attr)
 {
   int ret = OK;
 
-  dbg("%s: attr=0x%p\n", __FUNCTION__, attr);
+  dbg("attr=0x%p\n", attr);
 
   if (!attr)
     {
@@ -98,6 +98,6 @@ int pthread_mutexattr_init(pthread_mutexattr_t *attr)
       attr->pshared = 0;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_mutexattrsetpshared.c b/sched/pthread_mutexattrsetpshared.c
index a9ddd0c3c9f67445c8bc60bbcef22d87b0df2722..f25ed4639b2b89fe0c188879ac71b43594c8e80e 100644
--- a/sched/pthread_mutexattrsetpshared.c
+++ b/sched/pthread_mutexattrsetpshared.c
@@ -88,7 +88,7 @@ int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
 {
   int ret = OK;
 
-  dbg("%s: attr=0x%p pshared=%d\n",  __FUNCTION__, attr, pshared);
+  dbg("attr=0x%p pshared=%d\n", attr, pshared);
 
   if (!attr || (pshared != 0 && pshared != 1))
     {
@@ -99,6 +99,6 @@ int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
       attr->pshared = pshared;
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_mutexdestroy.c b/sched/pthread_mutexdestroy.c
index bf82d4f4369cbb5a7795a6ace0389ed2c847509f..14b5727c050263767acb0d999b051aecbf015dc0 100644
--- a/sched/pthread_mutexdestroy.c
+++ b/sched/pthread_mutexdestroy.c
@@ -90,7 +90,7 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex)
   int ret = OK;
   int status;
 
-  dbg("%s: mutex=0x%p\n", __FUNCTION__, mutex);
+  dbg("mutex=0x%p\n", mutex);
 
   if (!mutex)
     {
@@ -123,6 +123,6 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex)
       sched_unlock();
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_mutexinit.c b/sched/pthread_mutexinit.c
index faa06f227d11889f8b9870b6460d9f21de6190e6..a91a0339d4aca038d5f21061a0725b393e07590e 100644
--- a/sched/pthread_mutexinit.c
+++ b/sched/pthread_mutexinit.c
@@ -89,7 +89,7 @@ int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
   int pshared = 0;
   int status;
 
-  dbg("%s: mutex=0x%p attr=0x%p\n", __FUNCTION__, mutex, attr);
+  dbg("mutex=0x%p attr=0x%p\n", mutex, attr);
 
   if (!mutex)
     {
@@ -117,6 +117,6 @@ int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
         }
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
diff --git a/sched/pthread_mutexlock.c b/sched/pthread_mutexlock.c
index 43e7c835627f67ebabd3ac0117ed5b96133106a5..64a6632190659df75d43c19782ce4c5e7999d99c 100644
--- a/sched/pthread_mutexlock.c
+++ b/sched/pthread_mutexlock.c
@@ -90,7 +90,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex)
   int mypid = (int)getpid();
   int ret = OK;
 
-  dbg("%s: mutex=0x%p\n", __FUNCTION__, mutex);
+  dbg("mutex=0x%p\n", mutex);
 
   if (!mutex)
     {
@@ -108,7 +108,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex)
 
       if (mutex->pid == mypid)
         {
-          dbg("%s: Returning EDEADLK\n", __FUNCTION__);
+          dbg("Returning EDEADLK\n");
           ret = EDEADLK;
         }
       else
@@ -129,7 +129,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex)
       sched_unlock();
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_mutextrylock.c b/sched/pthread_mutextrylock.c
index 010c85f805cbd2c0fdcd379ba11b5cde4672b868..6474579a10ac0293c3a5ee3a71ecd1572870e5c4 100644
--- a/sched/pthread_mutextrylock.c
+++ b/sched/pthread_mutextrylock.c
@@ -90,7 +90,7 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex)
 {
   int ret = OK;
 
-  dbg("%s: mutex=0x%p\n", __FUNCTION__, mutex);
+  dbg("mutex=0x%p\n", mutex);
 
   if (!mutex)
     {
@@ -129,7 +129,7 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex)
       sched_unlock();
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_mutexunlock.c b/sched/pthread_mutexunlock.c
index 133dc1a94204bc1b2edc834ca4b11b5550a45ddb..2bc63eb26465d13896c4e1e639533e542be9a78e 100644
--- a/sched/pthread_mutexunlock.c
+++ b/sched/pthread_mutexunlock.c
@@ -89,7 +89,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex)
 {
   int ret = OK;
 
-  dbg("%s: mutex=0x%p\n", __FUNCTION__, mutex);
+  dbg("mutex=0x%p\n", mutex);
 
   if (!mutex)
     {
@@ -107,7 +107,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex)
 
       if (mutex->pid != (int)getpid())
         {
-          dbg("%s: Holder=%d Returning EPERM\n", __FUNCTION__, mutex->pid);
+          dbg("Holder=%d returning EPERM\n", mutex->pid);
           ret = EPERM;
         }
       else
@@ -120,7 +120,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex)
       sched_unlock();
     }
 
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
+  dbg("Returning %d\n", ret);
   return ret;
 }
 
diff --git a/sched/pthread_removejoininfo.c b/sched/pthread_removejoininfo.c
index ecdc6d99e15d400279bf80e8686989898379fc2e..33fb2439189d9889ae78e2346c2f33e5b7c833bb 100644
--- a/sched/pthread_removejoininfo.c
+++ b/sched/pthread_removejoininfo.c
@@ -81,7 +81,7 @@
  *
  ************************************************************/
 
-join_t *pthread_removejoininfo(int pid)
+join_t *pthread_removejoininfo(pid_t pid)
 {
   join_t *prev;
   join_t *join;
@@ -89,7 +89,7 @@ join_t *pthread_removejoininfo(int pid)
   /* Find the entry with the matching pid */
 
   for (prev = NULL, join = g_pthread_head;
-       (join && join->thread.pid != pid);
+       (join && (pid_t)join->thread != pid);
        prev = join, join = join->next);
 
   /* Remove it from the data set. */
diff --git a/sched/pthread_self.c b/sched/pthread_self.c
deleted file mode 100644
index 55ceddbddd8a0ad399b22b43939a2e0f99912809..0000000000000000000000000000000000000000
--- a/sched/pthread_self.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/************************************************************
- * pthread_self.c
- *
- *   Copyright (C) 2007 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <spudmonkey@racsa.co.cr>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************/
-
-/************************************************************
- * Included Files
- ************************************************************/
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <pthread.h>
-#include "pthread_internal.h"
-
-/************************************************************
- * Definitions
- ************************************************************/
-
-/************************************************************
- * Private Type Declarations
- ************************************************************/
-
-/************************************************************
- * Global Variables
- ************************************************************/
-
-/************************************************************
- * Private Variables
- ************************************************************/
-
-/************************************************************
- * Private Functions
- ************************************************************/
-
-/************************************************************
- * Public Functions
- ************************************************************/
-
-/************************************************************
- * Function:  pthread_self
- *
- * Description:
- *   A thread may obtain a copy of its own thread handle.
- *
- * Parameters:
- *   None
- *
- * Return Value:
- *   A copy of this threads handle
- *
- * Assumptions:
- *
- ************************************************************/
-
-pthread_t pthread_self(void)
-{
-  pthread_t thread;
-  thread.pid = (int)getpid();
-  return thread;
-}
-
diff --git a/sched/pthread_setschedparam.c b/sched/pthread_setschedparam.c
index 5d0f913c253440cd408e9468c07c2d0ea01c7381..bb0435aa03ed46375a7cd9060ac57ca6b13ce448 100644
--- a/sched/pthread_setschedparam.c
+++ b/sched/pthread_setschedparam.c
@@ -89,15 +89,9 @@
 int pthread_setschedparam(pthread_t thread, int policy,
                           const struct sched_param *param)
 {
-  int ret;
-
-  dbg("%s: thread ID=%d policy=%d param=0x%p\n",
-      __FUNCTION__, thread.pid, policy, param);
+  dbg("thread ID=%d policy=%d param=0x%p\n", thread, policy, param);
 
   /* Let sched_setscheduler do all of the work */
 
-  ret = sched_setscheduler(thread.pid, policy, param);
-
-  dbg("%s: Returning %d\n", __FUNCTION__, ret);
-  return ret;
+  return sched_setscheduler((pid_t)thread, policy, param);
 }
diff --git a/sched/sched_getscheduler.c b/sched/sched_getscheduler.c
index 9406d9774c7d4d3627f42119c6ff760513cff9a7..ae973918547b05bdf9b67d3561fb566703192732 100644
--- a/sched/sched_getscheduler.c
+++ b/sched/sched_getscheduler.c
@@ -103,7 +103,7 @@ int sched_getscheduler(pid_t pid)
 
   /* Verify that the pid corresponds to a real task */
 
-  if (pid = 0)
+  if (!pid)
     {
       tcb = (_TCB*)g_readytorun.head;
     }
diff --git a/sched/sem_internal.h b/sched/sem_internal.h
index dd15ae6df7bbb3ec2b5ccc5eb7238d355f707085..460b358fc618dffcfec5b9af6cb49711ecdfab9e 100644
--- a/sched/sem_internal.h
+++ b/sched/sem_internal.h
@@ -87,7 +87,7 @@ extern "C" {
 #endif
 
 EXTERN void weak_function sem_initialize(void);
-EXTERN void weak_function sem_waitirq(_TCB *wtcb);
+EXTERN void               sem_waitirq(_TCB *wtcb);
 EXTERN nsem_t            *sem_findnamed(const char *name);
 
 #undef EXTERN
diff --git a/sched/task_create.c b/sched/task_create.c
index dd7da112e40c8951cf98dd8e2cdb82e3e07f0a5a..c1cf11772543e1e616b2e7dabc303f60a44182a6 100644
--- a/sched/task_create.c
+++ b/sched/task_create.c
@@ -226,8 +226,6 @@ STATUS _task_init(_TCB *tcb, char *name, int priority,
 {
   STATUS ret;
 
-  vdbg("%s: Entry\n", __FUNCTION__);
-
   /* Assign a unique task ID to the task. */
 
   ret = task_assignpid(tcb);
@@ -382,8 +380,6 @@ STATUS task_activate(_TCB *tcb)
   uint32  flags;
 #endif
 
-  vdbg("%s: Entry\n", __FUNCTION__);
-
 #ifdef CONFIG_SCHED_INSTRUMENTATION
   flags = irqsave();
 
@@ -449,8 +445,6 @@ int task_create(char *name, int priority,
   STATUS status;
   pid_t pid;
 
-  vdbg("%s: Entry\n", __FUNCTION__);
-
   /* Allocate a TCB for the new task. */
 
   tcb = (_TCB*)kzmalloc(sizeof(_TCB));
diff --git a/sched/wd_internal.h b/sched/wd_internal.h
index 9198387ccacb3b7fa2520a8620a1d276de29cbc8..212c68619222e8e065bc71f67dd410af13cb9b51 100644
--- a/sched/wd_internal.h
+++ b/sched/wd_internal.h
@@ -70,7 +70,6 @@ struct wdog_s
 };
 
 typedef struct wdog_s wdog_t;
-typedef struct wdog_s *WDOG_ID;
 
 /************************************************************
  * Public Variables