change log for rtems (2011-01-08)
rtems-vc at rtems.org
rtems-vc at rtems.org
Sat Jan 8 21:10:52 UTC 2011
*joel*:
2011-01-08 Alin Rus <alin.codejunkie at 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.
M 1.2674 cpukit/ChangeLog
M 1.6 cpukit/posix/src/aio_cancel.c
M 1.6 cpukit/posix/src/aio_misc.c
M 1.5 cpukit/posix/src/aio_read.c
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
@@ -1,3 +1,11 @@
+2011-01-08 Alin Rus <alin.codejunkie at 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.
+
2011-01-04 Joel Sherrill <joel.sherrill at oarcorp.com>
* libcsupport/src/error.c: Scheduler Simulator compilation always
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
@@ -43,84 +43,85 @@
pthread_mutex_lock (&aio_request_queue.mutex);
- if (aiocbp == NULL)
- {
- if (fcntl (fildes, F_GETFL) < 0) {
- pthread_mutex_unlock(&aio_request_queue.mutex);
- rtems_set_errno_and_return_minus_one (EBADF);
+ 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");
+
+ 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);
+ 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;
}
- 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);
- 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;
- }
+ pthread_mutex_unlock (&aio_request_queue.mutex);
+ return AIO_ALLDONE;
+ }
- 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);
+ 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) {
pthread_mutex_unlock (&aio_request_queue.mutex);
- return AIO_CANCELED;
+ rtems_set_errno_and_return_minus_one (EINVAL);
}
- else
- {
- if (aiocbp->aio_fildes != fildes) {
- pthread_mutex_unlock (&aio_request_queue.mutex);
- rtems_set_errno_and_return_minus_one (EINVAL);
- }
- 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);
- rtems_set_errno_and_return_minus_one (EINVAL);
- }
-
- result = rtems_aio_remove_req (&r_chain->perfd, aiocbp);
- pthread_mutex_unlock (&aio_request_queue.mutex);
- return result;
+ 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);
+ rtems_set_errno_and_return_minus_one (EINVAL);
+ }
+
+ AIO_printf ("Request on [IQ]\n");
+
+ 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;
+ }
- }
+ AIO_printf ("Request on [WQ]\n");
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;
-
}
-
+ }
return AIO_ALLDONE;
}
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
@@ -179,7 +179,6 @@
{
rtems_chain_control *chain;
rtems_chain_node *node;
-
chain = &r_chain->perfd;
node = rtems_chain_first (chain);
@@ -187,6 +186,7 @@
{
rtems_chain_extract (node);
rtems_aio_request *req = (rtems_aio_request *) node;
+ node = rtems_chain_next (node);
req->aiocbp->error_code = ECANCELED;
req->aiocbp->return_value = -1;
free (req);
@@ -211,6 +211,9 @@
int rtems_aio_remove_req (rtems_chain_control *chain, struct aiocb *aiocbp)
{
+ if (rtems_chain_is_empty (chain))
+ return AIO_ALLDONE;
+
rtems_chain_node *node = rtems_chain_first (chain);
rtems_aio_request *current;
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
@@ -47,7 +47,7 @@
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);
-
+
if (aiocbp->aio_reqprio < 0 || aiocbp->aio_reqprio > AIO_PRIO_DELTA_MAX)
rtems_aio_set_errno_return_minus_one (EINVAL, aiocbp);
*joel*:
2011-01-08 Alin Rus <alin.codejunkie at gmail.com>
* psxaio02/init.c: Improve aio_cancel() coverage.
M 1.326 testsuites/psxtests/ChangeLog
M 1.3 testsuites/psxtests/psxaio02/init.c
M 1.2 testsuites/psxtests/psxaio02/system.h
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
@@ -1,3 +1,7 @@
+2011-01-08 Alin Rus <alin.codejunkie at gmail.com>
+
+ * psxaio02/init.c: Improve aio_cancel() coverage.
+
2011-01-02 Joel Sherrill <joel.sherrilL at OARcorp.com>
* psx05/init.c: Spacing.
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
@@ -22,7 +22,8 @@
#include <rtems/chain.h>
#define BUFSIZE 32
-#define MAX 7
+#define MAX 10
+#define WRONG_FD 666
struct aiocb *
create_aiocb (int fd)
@@ -51,12 +52,17 @@
POSIX_Init (void *argument)
{
int fd[MAX];
- struct aiocb *aiocbp[MAX+2];
- int status, i;
+ struct aiocb *aiocbp[MAX+1];
+ int status, i, policy = SCHED_FIFO;
char filename[BUFSIZE];
+ struct sched_param param;
status = rtems_aio_init ();
rtems_test_assert (status == 0);
+
+ param.sched_priority = 30;
+ status = pthread_setschedparam (pthread_self(), policy, ¶m);
+ rtems_test_assert (status == 0);
status = mkdir ("/tmp", S_IRWXU);
rtems_test_assert (!status);
@@ -113,10 +119,52 @@
rtems_test_assert (status != -1);
puts (" Init: [IQ] aio_read on 7th file add by priority ");
- aiocbp[8] = create_aiocb (fd[6]);
+ aiocbp[8] = create_aiocb (fd[6]);
status = aio_read (aiocbp[8]);
rtems_test_assert (status != -1);
+ puts (" Init: [WQ] aio_sync on 1st file add by priority ");
+ aiocbp[9] = create_aiocb (fd[0]);
+ 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 );
+
+ 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);
+
puts ("\n\n*** POSIX AIO TEST 02 ***");
puts ("*** END OF POSIX AIO TEST 01 ***");
@@ -127,7 +175,6 @@
free_aiocb (aiocbp[i]);
}
free_aiocb (aiocbp[i]);
- free_aiocb (aiocbp[i+1]);
rtems_test_exit (0);
return NULL;
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
@@ -38,10 +38,8 @@
#define CONFIGURE_EXTRA_TASK_STACKS (10 * RTEMS_MINIMUM_STACK_SIZE)
#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (10 * RTEMS_MINIMUM_STACK_SIZE)
-
#define CONFIGURE_MALLOC_STATISTICS
-
#include <rtems/confdefs.h>
/* global variables */
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110108/02fffd55/attachment.html>
More information about the vc
mailing list