<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-01-08)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-01-08 Alin Rus <alin.codejunkie@gmail.com>

        * posix/src/aio_misc.c: Fix rtems_aio_remove_req did not iterate
        over chain.
        * posix/src/aio_cancel.c: Add debug information. Add check for
        bad file descriptor. Add else branch for cancel request on empty
        IQ chain.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2673&r2=text&tr2=1.2674&diff_format=h">M</a></td><td width='1%'>1.2674</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/posix/src/aio_cancel.c.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>cpukit/posix/src/aio_cancel.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/posix/src/aio_misc.c.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>cpukit/posix/src/aio_misc.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/posix/src/aio_read.c.diff?r1=text&tr1=1.4&r2=text&tr2=1.5&diff_format=h">M</a></td><td width='1%'>1.5</td><td width='100%'>cpukit/posix/src/aio_read.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2673 rtems/cpukit/ChangeLog:1.2674
--- rtems/cpukit/ChangeLog:1.2673       Tue Jan  4 13:53:14 2011
+++ rtems/cpukit/ChangeLog      Sat Jan  8 15:01:32 2011
</font><font color='#997700'>@@ -1,3 +1,11 @@
</font><font color='#000088'>+2011-01-08    Alin Rus <alin.codejunkie@gmail.com>
+<span style="background-color: #FF0000">       </span>
+       * posix/src/aio_misc.c: Fix rtems_aio_remove_req did not iterate
+       over chain.
+       * posix/src/aio_cancel.c: Add debug information. Add check for<span style="background-color: #FF0000"> </span>
+       bad file descriptor. Add else branch for cancel request on empty
+       IQ chain.
+
</font> 2011-01-04        Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * libcsupport/src/error.c: Scheduler Simulator compilation always

<font color='#006600'>diff -u rtems/cpukit/posix/src/aio_cancel.c:1.5 rtems/cpukit/posix/src/aio_cancel.c:1.6
--- rtems/cpukit/posix/src/aio_cancel.c:1.5     Tue Jan  4 12:38:58 2011
+++ rtems/cpukit/posix/src/aio_cancel.c Sat Jan  8 15:01:32 2011
</font><font color='#997700'>@@ -43,84 +43,85 @@
</font>   
   pthread_mutex_lock (&aio_request_queue.mutex);
 
<font color='#880000'>-  if (aiocbp == NULL)
-    {
-      if (fcntl (fildes, F_GETFL) < 0) {
-        pthread_mutex_unlock(&aio_request_queue.mutex);
-       rtems_set_errno_and_return_minus_one (EBADF);
</font><font color='#000088'>+  if (fcntl (fildes, F_GETFD) < 0) {
+    pthread_mutex_unlock(&aio_request_queue.mutex);
+    rtems_set_errno_and_return_minus_one (EBADF);
+  }
+
+  /* if aiocbp is NULL remove all request for given file descriptor */
+  if (aiocbp == NULL) {
+    AIO_printf ("Cancel all requests\n");<span style="background-color: #FF0000">        </span>
+<span style="background-color: #FF0000">         </span>
+    r_chain = rtems_aio_search_fd (&aio_request_queue.work_req, fildes, 0);
+    if (r_chain == NULL) {
+      AIO_printf ("Request chain not on [WQ]\n");
+
+      if (!rtems_chain_is_empty (&aio_request_queue.idle_req)) {
+        r_chain = rtems_aio_search_fd (&aio_request_queue.idle_req, fildes, 0);
+        if (r_chain == NULL) {
+          pthread_mutex_unlock(&aio_request_queue.mutex);
+          return AIO_ALLDONE;
+        }
+
+        AIO_printf ("Request chain on [IQ]\n");
+
+        rtems_chain_extract (&r_chain->next_fd);<span style="background-color: #FF0000">        </span>
+        rtems_aio_remove_fd (r_chain);
+        pthread_mutex_destroy (&r_chain->mutex);
+        pthread_cond_destroy (&r_chain->mutex);
+        free (r_chain);
+
+        pthread_mutex_unlock (&aio_request_queue.mutex);
+        return AIO_CANCELED;
</font>       }
 
<font color='#880000'>-      r_chain = rtems_aio_search_fd (&aio_request_queue.work_req,
-                                    fildes,
-                                    0);
-      if (r_chain == NULL)
-       {
-         if (!rtems_chain_is_empty (&aio_request_queue.idle_req))
-           {
-             r_chain = rtems_aio_search_fd (&aio_request_queue.idle_req,
-                                            fildes,
-                                            0);
-             if (r_chain == NULL) {
-               pthread_mutex_unlock(&aio_request_queue.mutex);
-               return AIO_ALLDONE;
-              }
-
-             rtems_chain_extract (&r_chain->next_fd);<span style="background-color: #FF0000">   </span>
-             rtems_aio_remove_fd (r_chain);
-             pthread_mutex_destroy (&r_chain->mutex);
-             pthread_cond_destroy (&r_chain->mutex);
-             free (r_chain);
-
-             pthread_mutex_unlock (&aio_request_queue.mutex);
-             return AIO_CANCELED;
-           }
-
-         pthread_mutex_unlock (&aio_request_queue.mutex);
-         return AIO_ALLDONE;
-       }
</font><font color='#000088'>+      pthread_mutex_unlock (&aio_request_queue.mutex);
+      return AIO_ALLDONE;
+    }
</font> 
<font color='#880000'>-      pthread_mutex_lock (&r_chain->mutex);
-      rtems_chain_extract (&r_chain->next_fd);
-      rtems_aio_remove_fd (r_chain);
-      pthread_mutex_unlock (&r_chain->mutex);
</font><font color='#000088'>+    AIO_printf ("Request chain on [WQ]\n");
+
+    pthread_mutex_lock (&r_chain->mutex);
+    rtems_chain_extract (&r_chain->next_fd);
+    rtems_aio_remove_fd (r_chain);
+    pthread_mutex_unlock (&r_chain->mutex);
+    pthread_mutex_unlock (&aio_request_queue.mutex);
+    return AIO_CANCELED;
+  } else {
+    AIO_printf ("Cancel request\n");
+
+    if (aiocbp->aio_fildes != fildes) {
</font>       pthread_mutex_unlock (&aio_request_queue.mutex);
<font color='#880000'>-      return AIO_CANCELED;
</font><font color='#000088'>+      rtems_set_errno_and_return_minus_one (EINVAL);
</font>     }
<font color='#880000'>-  else<span style="background-color: #FF0000"> </span>
-    {
-      if (aiocbp->aio_fildes != fildes) {
-         pthread_mutex_unlock (&aio_request_queue.mutex);
-         rtems_set_errno_and_return_minus_one (EINVAL);
-       }
</font>       
<font color='#880000'>-      r_chain = rtems_aio_search_fd (&aio_request_queue.work_req,
-                                    fildes,
-                                    0);
-      if (r_chain == NULL)
-       if (!rtems_chain_is_empty (&aio_request_queue.idle_req))
-         {
-           r_chain = rtems_aio_search_fd (&aio_request_queue.idle_req,
-                                          fildes,
-                                          0);
-           if (r_chain == NULL)
-             {<span style="background-color: #FF0000"> </span>
-               pthread_mutex_unlock (&aio_request_queue.mutex);
-               rtems_set_errno_and_return_minus_one (EINVAL);
-             }<span style="background-color: #FF0000">      </span>
-
-           result = rtems_aio_remove_req (&r_chain->perfd, aiocbp);
-           pthread_mutex_unlock (&aio_request_queue.mutex);
-           return result;
</font><font color='#000088'>+    r_chain = rtems_aio_search_fd (&aio_request_queue.work_req, fildes, 0);
+    if (r_chain == NULL) {
+      if (!rtems_chain_is_empty (&aio_request_queue.idle_req)) {
+        r_chain = rtems_aio_search_fd (&aio_request_queue.idle_req, fildes, 0);
+        if (r_chain == NULL) {<span style="background-color: #FF0000"> </span>
+          pthread_mutex_unlock (&aio_request_queue.mutex);
+          rtems_set_errno_and_return_minus_one (EINVAL);
+        }<span style="background-color: #FF0000">      </span>
+<span style="background-color: #FF0000">           </span>
+        AIO_printf ("Request on [IQ]\n");<span style="background-color: #FF0000">                     </span>
+<span style="background-color: #FF0000">   </span>
+        result = rtems_aio_remove_req (&r_chain->perfd, aiocbp);
+        pthread_mutex_unlock (&aio_request_queue.mutex);
+        return result;
+      } else {
+        pthread_mutex_unlock (&aio_request_queue.mutex);
+        return AIO_ALLDONE;
+      }
</font> 
<font color='#880000'>-     }
</font><font color='#000088'>+      AIO_printf ("Request on [WQ]\n");
</font>       
       pthread_mutex_lock (&r_chain->mutex);
       result = rtems_aio_remove_req (&r_chain->perfd, aiocbp);
       pthread_mutex_unlock (&r_chain->mutex);
       pthread_mutex_unlock (&aio_request_queue.mutex);
       return result;
<font color='#880000'>-<span style="background-color: #FF0000">   </span>
</font>     }
<font color='#880000'>-<span style="background-color: #FF0000">  </span>
</font><font color='#000088'>+  }
</font>   return AIO_ALLDONE;
 }

<font color='#006600'>diff -u rtems/cpukit/posix/src/aio_misc.c:1.5 rtems/cpukit/posix/src/aio_misc.c:1.6
--- rtems/cpukit/posix/src/aio_misc.c:1.5       Mon Nov  1 12:32:53 2010
+++ rtems/cpukit/posix/src/aio_misc.c   Sat Jan  8 15:01:32 2011
</font><font color='#997700'>@@ -179,7 +179,6 @@
</font> {
   rtems_chain_control *chain;
   rtems_chain_node *node;
<font color='#880000'>-
</font>   chain = &r_chain->perfd;
   node = rtems_chain_first (chain);
   
<font color='#997700'>@@ -187,6 +186,7 @@
</font>     {
       rtems_chain_extract (node);
       rtems_aio_request *req = (rtems_aio_request *) node;
<font color='#000088'>+      node = rtems_chain_next (node);
</font>       req->aiocbp->error_code = ECANCELED;
       req->aiocbp->return_value = -1;
       free (req);
<font color='#997700'>@@ -211,6 +211,9 @@
</font> 
 int rtems_aio_remove_req (rtems_chain_control *chain, struct aiocb *aiocbp)
 {
<font color='#000088'>+  if (rtems_chain_is_empty (chain))
+    return AIO_ALLDONE;
+
</font>   rtems_chain_node *node = rtems_chain_first (chain);
   rtems_aio_request *current;
   

<font color='#006600'>diff -u rtems/cpukit/posix/src/aio_read.c:1.4 rtems/cpukit/posix/src/aio_read.c:1.5
--- rtems/cpukit/posix/src/aio_read.c:1.4       Tue Aug 24 06:50:35 2010
+++ rtems/cpukit/posix/src/aio_read.c   Sat Jan  8 15:01:32 2011
</font><font color='#997700'>@@ -47,7 +47,7 @@
</font>   mode = fcntl (aiocbp->aio_fildes, F_GETFL);
   if (!(((mode & O_ACCMODE) == O_RDONLY) || ((mode & O_ACCMODE) == O_RDWR)))
     rtems_aio_set_errno_return_minus_one (EBADF, aiocbp);
<font color='#880000'>-
</font><font color='#000088'>+<span style="background-color: #FF0000">  </span>
</font>   if (aiocbp->aio_reqprio < 0 || aiocbp->aio_reqprio > AIO_PRIO_DELTA_MAX)
     rtems_aio_set_errno_return_minus_one (EINVAL, aiocbp);
   
</pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-01-08 Alin Rus <alin.codejunkie@gmail.com>

        * psxaio02/init.c: Improve aio_cancel() coverage.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/ChangeLog.diff?r1=text&tr1=1.325&r2=text&tr2=1.326&diff_format=h">M</a></td><td width='1%'>1.326</td><td width='100%'>testsuites/psxtests/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psxaio02/init.c.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>testsuites/psxtests/psxaio02/init.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psxaio02/system.h.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>testsuites/psxtests/psxaio02/system.h</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/testsuites/psxtests/ChangeLog:1.325 rtems/testsuites/psxtests/ChangeLog:1.326
--- rtems/testsuites/psxtests/ChangeLog:1.325   Sun Jan  2 19:59:22 2011
+++ rtems/testsuites/psxtests/ChangeLog Sat Jan  8 15:01:47 2011
</font><font color='#997700'>@@ -1,3 +1,7 @@
</font><font color='#000088'>+2011-01-08    Alin Rus <alin.codejunkie@gmail.com>
+
+       * psxaio02/init.c: Improve aio_cancel() coverage.
+
</font> 2011-01-02        Joel Sherrill <joel.sherrilL@OARcorp.com>
 
        * psx05/init.c: Spacing.

<font color='#006600'>diff -u rtems/testsuites/psxtests/psxaio02/init.c:1.2 rtems/testsuites/psxtests/psxaio02/init.c:1.3
--- rtems/testsuites/psxtests/psxaio02/init.c:1.2       Mon Nov  1 12:33:08 2010
+++ rtems/testsuites/psxtests/psxaio02/init.c   Sat Jan  8 15:01:47 2011
</font><font color='#997700'>@@ -22,7 +22,8 @@
</font> #include <rtems/chain.h>
 
 #define BUFSIZE 32
<font color='#880000'>-#define MAX 7
</font><font color='#000088'>+#define MAX 10
+#define WRONG_FD 666
</font> 
 struct aiocb *
 create_aiocb (int fd)
<font color='#997700'>@@ -51,12 +52,17 @@
</font> POSIX_Init (void *argument)
 {
   int fd[MAX];
<font color='#880000'>-  struct aiocb *aiocbp[MAX+2];
-  int status, i;
</font><font color='#000088'>+  struct aiocb *aiocbp[MAX+1];
+  int status, i, policy = SCHED_FIFO;
</font>   char filename[BUFSIZE];
<font color='#000088'>+  struct sched_param param;
</font> 
   status = rtems_aio_init ();
   rtems_test_assert (status == 0);
<font color='#000088'>+
+  param.sched_priority = 30;
+  status = pthread_setschedparam (pthread_self(), policy, &param);
+  rtems_test_assert (status == 0);
</font>  
   status = mkdir ("/tmp", S_IRWXU);
   rtems_test_assert (!status);
<font color='#997700'>@@ -113,10 +119,52 @@
</font>   rtems_test_assert (status != -1);
 
   puts (" Init: [IQ] aio_read on 7th file add by priority ");
<font color='#880000'>-  aiocbp[8] = create_aiocb (fd[6]);
</font><font color='#000088'>+  aiocbp[8] = create_aiocb (fd[6]);<span style="background-color: #FF0000"> </span>
</font>   status = aio_read (aiocbp[8]);
   rtems_test_assert (status != -1);
 
<font color='#000088'>+  puts (" Init: [WQ] aio_sync on 1st file add by priority ");
+  aiocbp[9] = create_aiocb (fd[0]);<span style="background-color: #FF0000"> </span>
+  status = aio_fsync (O_SYNC, aiocbp[9]);
+  rtems_test_assert (status != -1);
+
+  puts (" Init: [NONE] aio_cancel aiocbp=NULL and invalid fildes ");
+  status = aio_cancel (WRONG_FD, NULL);
+  rtems_test_assert (status == -1);
+
+  puts (" Init: [NONE] aio_cancel aiocbp=NULL valid fildes not in queue ");
+  status = aio_cancel (fd[7], NULL);
+  rtems_test_assert (status == AIO_ALLDONE);
+
+  puts (" Init: [WQ] aio_cancel aiocbp=NULL fildes=fd[1] ");
+  status = aio_cancel (fd[1], NULL);
+  rtems_test_assert (status == AIO_CANCELED);
+
+  puts (" Init: [IQ] aio_cancel aiocbp=NULL fildes=fd[6] ");
+  status = aio_cancel (fd[6], NULL);
+  rtems_test_assert (status == AIO_CANCELED);
+
+  puts (" Init: [NONE] aio_cancel aiocbp->aio_fildes != fildes ");
+  status = aio_cancel (fd[4],aiocbp[4]);
+  rtems_test_assert (status == -1 );
+<span style="background-color: #FF0000"> </span>
+  puts (" Init: [NONE] aio_cancel FD on [IQ], aiocb not on chain ");
+  aiocbp[10] = create_aiocb (fd[9]);
+  status = aio_cancel (fd[9], aiocbp[10]);
+  rtems_test_assert (status == -1);
+
+  puts (" Init: [IQ] aio_cancel 6th file only one request ");
+  status = aio_cancel (fd[5], aiocbp[6]);
+  rtems_test_assert (status == AIO_CANCELED);
+
+  puts (" Init: [WQ] aio_cancel 1st file only one request ");
+  status = aio_cancel (fd[0], aiocbp[9]);
+  rtems_test_assert (status == AIO_CANCELED);
+
+  puts (" Init: [NONE] aio_cancel empty [IQ] ");
+  status = aio_cancel (fd[5], aiocbp[6]);
+  rtems_test_assert (status == AIO_ALLDONE);
+
</font>   puts ("\n\n*** POSIX AIO TEST 02 ***");
 
   puts ("*** END OF POSIX AIO TEST 01 ***");
<font color='#997700'>@@ -127,7 +175,6 @@
</font>       free_aiocb (aiocbp[i]);<span style="background-color: #FF0000">      </span>
     }
   free_aiocb (aiocbp[i]);
<font color='#880000'>-  free_aiocb (aiocbp[i+1]);
</font>   rtems_test_exit (0);
 
   return NULL;

<font color='#006600'>diff -u rtems/testsuites/psxtests/psxaio02/system.h:1.1 rtems/testsuites/psxtests/psxaio02/system.h:1.2
--- rtems/testsuites/psxtests/psxaio02/system.h:1.1     Mon Aug 16 08:29:49 2010
+++ rtems/testsuites/psxtests/psxaio02/system.h Sat Jan  8 15:01:47 2011
</font><font color='#997700'>@@ -38,10 +38,8 @@
</font> #define CONFIGURE_EXTRA_TASK_STACKS         (10 * RTEMS_MINIMUM_STACK_SIZE)
 #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (10 * RTEMS_MINIMUM_STACK_SIZE)
 
<font color='#880000'>-
</font> #define CONFIGURE_MALLOC_STATISTICS
 
<font color='#880000'>-
</font> #include <rtems/confdefs.h>
 
 /* global variables */
</pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>