change log for rtems (2010-11-01)
rtems-vc at rtems.org
rtems-vc at rtems.org
Mon Nov 1 18:10:45 UTC 2010
*joel*:
2010-11-01 Alin Rus <alin.codejunkie at gmail.com>
* posix/include/rtems/posix/aio_misc.h, posix/src/aio_misc.c: Small
fixes.
M 1.2640 cpukit/ChangeLog
M 1.6 cpukit/posix/include/rtems/posix/aio_misc.h
M 1.5 cpukit/posix/src/aio_misc.c
diff -u rtems/cpukit/ChangeLog:1.2639 rtems/cpukit/ChangeLog:1.2640
--- rtems/cpukit/ChangeLog:1.2639 Thu Oct 21 17:27:16 2010
+++ rtems/cpukit/ChangeLog Mon Nov 1 12:32:52 2010
@@ -1,3 +1,8 @@
+2010-11-01 Alin Rus <alin.codejunkie at gmail.com>
+
+ * posix/include/rtems/posix/aio_misc.h, posix/src/aio_misc.c: Small
+ fixes.
+
2010-10-21 Joel Sherrill <joel.sherrill at oarcorp.com>
* posix/src/psignalunblockthread.c: Formatting.
diff -u rtems/cpukit/posix/include/rtems/posix/aio_misc.h:1.5 rtems/cpukit/posix/include/rtems/posix/aio_misc.h:1.6
--- rtems/cpukit/posix/include/rtems/posix/aio_misc.h:1.5 Fri Aug 20 09:37:08 2010
+++ rtems/cpukit/posix/include/rtems/posix/aio_misc.h Mon Nov 1 12:32:53 2010
@@ -29,20 +29,20 @@
/* Actual request being processed */
typedef struct
{
+ rtems_chain_node next_prio; /* chain requests in order of priority */
int policy; /* If _POSIX_PRIORITIZED_IO and
_POSIX_PRIORITY_SCHEDULING are defined */
int priority; /* see above */
- rtems_chain_node next_prio; /* chain requests in order of priority */
pthread_t caller_thread; /* used for notification */
struct aiocb *aiocbp; /* aio control block */
} rtems_aio_request;
typedef struct
{
- int fildes; /* file descriptor to be processed */
- int new_fd; /* if this is a newly created chain */
rtems_chain_node next_fd; /* order fd chains in queue */
rtems_chain_control perfd; /* chain of requests for this fd */
+ int fildes; /* file descriptor to be processed */
+ int new_fd; /* if this is a newly created chain */
pthread_mutex_t mutex;
pthread_cond_t cond;
diff -u rtems/cpukit/posix/src/aio_misc.c:1.4 rtems/cpukit/posix/src/aio_misc.c:1.5
--- rtems/cpukit/posix/src/aio_misc.c:1.4 Fri Aug 20 09:37:08 2010
+++ rtems/cpukit/posix/src/aio_misc.c Mon Nov 1 12:32:53 2010
@@ -94,11 +94,11 @@
rtems_aio_request_chain *r_chain;
rtems_chain_node *node;
- node = chain->first;
+ node = rtems_chain_first (chain);
r_chain = (rtems_aio_request_chain *) node;
while (r_chain->fildes < fildes && !rtems_chain_is_tail (chain, node)) {
- node = node->next;
+ node = rtems_chain_next (node);
r_chain = (rtems_aio_request_chain *) node;
}
@@ -114,9 +114,10 @@
if (rtems_chain_is_empty (chain))
rtems_chain_prepend (chain, &r_chain->next_fd);
else
- rtems_chain_insert (node->previous, &r_chain->next_fd);
+ rtems_chain_insert (rtems_chain_previous (node), &r_chain->next_fd);
r_chain->new_fd = 1;
+ r_chain->fildes = fildes;
}
}
return r_chain;
@@ -142,7 +143,7 @@
rtems_chain_node *node;
AIO_printf ("FD exists \n");
- node = chain->first;
+ node = rtems_chain_first (chain);
if (rtems_chain_is_empty (chain)) {
AIO_printf ("First in chain \n");
@@ -153,7 +154,7 @@
while (req->aiocbp->aio_reqprio > prio &&
!rtems_chain_is_tail (chain, node)) {
- node = node->next;
+ node = rtems_chain_next (node);
prio = ((rtems_aio_request *) node)->aiocbp->aio_reqprio;
}
@@ -180,7 +181,7 @@
rtems_chain_node *node;
chain = &r_chain->perfd;
- node = chain->first;
+ node = rtems_chain_first (chain);
while (!rtems_chain_is_tail (chain, node))
{
@@ -210,13 +211,13 @@
int rtems_aio_remove_req (rtems_chain_control *chain, struct aiocb *aiocbp)
{
- rtems_chain_node *node = chain->first;
+ rtems_chain_node *node = rtems_chain_first (chain);
rtems_aio_request *current;
current = (rtems_aio_request *) node;
while (!rtems_chain_is_tail (chain, node) && current->aiocbp != aiocbp) {
- node = node->next;
+ node = rtems_chain_next (node);
current = (rtems_aio_request *) node;
}
@@ -257,7 +258,7 @@
struct sched_param param;
/* The queue should be initialized */
- AIO_assert (aio_request_queue.initialized != AIO_QUEUE_INITIALIZED);
+ AIO_assert (aio_request_queue.initialized == AIO_QUEUE_INITIALIZED);
result = pthread_mutex_lock (&aio_request_queue.mutex);
if (result != 0) {
@@ -288,7 +289,7 @@
pthread_mutex_init (&r_chain->mutex, NULL);
pthread_cond_init (&r_chain->cond, NULL);
- AIO_printf ("New thread");
+ AIO_printf ("New thread \n");
result = pthread_create (&thid, &aio_request_queue.attr,
rtems_aio_handle, (void *) r_chain);
if (result != 0) {
@@ -328,11 +329,13 @@
if (r_chain->new_fd == 1) {
/* If this is a new fd chain we signal the idle threads that
might be waiting for requests */
+ AIO_printf (" New chain on waiting queue \n ");
rtems_chain_prepend (&r_chain->perfd, &req->next_prio);
r_chain->new_fd = 0;
pthread_mutex_init (&r_chain->mutex, NULL);
pthread_cond_init (&r_chain->cond, NULL);
pthread_cond_signal (&aio_request_queue.new_req);
+ ++aio_request_queue.idle_threads;
} else
/* just insert the request in the existing fd chain */
rtems_aio_insert_prio (&r_chain->perfd, req);
@@ -387,7 +390,7 @@
requests to this fd chain */
if (!rtems_chain_is_empty (chain)) {
- node = chain->first;
+ node = rtems_chain_first (chain);
req = (rtems_aio_request *) node;
/* See _POSIX_PRIORITIZE_IO and _POSIX_PRIORITY_SCHEDULING
@@ -481,7 +484,7 @@
/* Otherwise move this chain to the working chain and
start the loop all over again */
--aio_request_queue.idle_threads;
- node = aio_request_queue.idle_req.first;
+ node = rtems_chain_first (&aio_request_queue.idle_req);
rtems_chain_extract (node);
r_chain = rtems_aio_search_fd (&aio_request_queue.work_req,
((rtems_aio_request_chain *)node)->fildes,
*joel*:
2010-11-01 Alin Rus <alin.codejunkie at gmail.com>
* psxaio01/init.c, psxaio02/init.c: Improve coverage.
M 1.324 testsuites/psxtests/ChangeLog
M 1.2 testsuites/psxtests/psxaio01/init.c
M 1.2 testsuites/psxtests/psxaio02/init.c
diff -u rtems/testsuites/psxtests/ChangeLog:1.323 rtems/testsuites/psxtests/ChangeLog:1.324
--- rtems/testsuites/psxtests/ChangeLog:1.323 Thu Oct 21 17:09:44 2010
+++ rtems/testsuites/psxtests/ChangeLog Mon Nov 1 12:33:06 2010
@@ -1,3 +1,7 @@
+2010-11-01 Alin Rus <alin.codejunkie at gmail.com>
+
+ * psxaio01/init.c, psxaio02/init.c: Improve coverage.
+
2010-10-21 Joel Sherrill <joel.sherrill at oarcorp.com>
* psx05/init.c: Check for correct status returned.
diff -u rtems/testsuites/psxtests/psxaio01/init.c:1.1 rtems/testsuites/psxtests/psxaio01/init.c:1.2
--- rtems/testsuites/psxtests/psxaio01/init.c:1.1 Mon Aug 16 08:29:48 2010
+++ rtems/testsuites/psxtests/psxaio01/init.c Mon Nov 1 12:33:08 2010
@@ -24,7 +24,7 @@
#define WRONG_FD 404
struct aiocb *
-create_aiocb (void)
+create_aiocb (int fd)
{
struct aiocb *aiocbp;
@@ -34,7 +34,7 @@
aiocbp->aio_nbytes = BUFSIZE;
aiocbp->aio_offset = 0;
aiocbp->aio_reqprio = 0;
- aiocbp->aio_fildes = open ("aio_fildes", O_RDWR | O_CREAT);
+ aiocbp->aio_fildes = fd;
return aiocbp;
}
@@ -49,101 +49,145 @@
void *
POSIX_Init (void *argument)
{
- int result, policy;
+ int result, fd;
struct aiocb *aiocbp;
- rtems_status_code status;
- struct sched_param param;
+ int status;
+
+ rtems_aio_init ();
+
+ status = mkdir ("/tmp", S_IRWXU);
+ rtems_test_assert (!status);
+
+ fd = open ("/tmp/aio_fildes", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
+ rtems_test_assert ( fd != -1);
puts ("\n\n*** POSIX AIO TEST 01 ***");
- puts ("\n*** POSIX aio_write() test ***");
+ puts (" Init: EBADF TESTS ");
- /* Request canceled */
- puts ("Init: aio_write - ECANCELED");
+ aiocbp = create_aiocb (WRONG_FD);
+ status = aio_write (aiocbp);
+ rtems_test_assert (status == -1);
+
+ /* Bad file descriptor */
+ puts ("Init: aio_write() - EBADF ");
- aiocbp = create_aiocb ();
- aio_write (aiocbp);
- aio_cancel (aiocbp->aio_fildes, aiocbp);
result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
+ rtems_test_assert (result == -1);
status = aio_error (aiocbp);
- rtems_test_assert (status != ECANCELED);
- free_aiocb (aiocbp);
+ rtems_test_assert (status == EBADF);
- /* Successfull added request to queue */
- puts ("Init: aio_write - SUCCESSFUL");
- aiocbp = create_aiocb ();
- aiocbp->aio_fildes = WRONG_FD;
- status = aio_write (aiocbp);
- rtems_test_assert (!status);
+ status = aio_read (aiocbp);
+ rtems_test_assert (status == -1);
+
+ /* Bad file descriptor */
+ puts ("Init: aio_read() - EBADF ");
- pthread_getschedparam (pthread_self (), &policy, ¶m);
- policy = SCHED_RR;
- param.sched_priority = 30;
- pthread_setschedparam (pthread_self (), policy, ¶m);
- sleep (1);
+ result = aio_return (aiocbp);
+ rtems_test_assert (result == -1);
+ status = aio_error (aiocbp);
+ rtems_test_assert (status == EBADF);
- while (aio_error (aiocbp) == EINPROGRESS);
+ status = aio_cancel (WRONG_FD, NULL);
+ rtems_test_assert (status == -1);
/* Bad file descriptor */
- puts ("Init: aio_write() - EBADF ");
+ puts ("Init: aio_cancel() - EBADF ");
+
+ result = aio_return (aiocbp);
+ rtems_test_assert (result == -1);
+ status = aio_error (aiocbp);
+ rtems_test_assert (status == EBADF);
+
+ status = aio_fsync (O_SYNC, aiocbp);
+ rtems_test_assert (status == -1);
+
+ /* Bad file descriptor */
+ puts ("Init: aio_fsync() - EBADF ");
result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
+ rtems_test_assert (result == -1);
status = aio_error (aiocbp);
- rtems_test_assert (status != EBADF);
+ rtems_test_assert (status == EBADF);
+
free_aiocb (aiocbp);
/* Invalid offset */
puts ("Init: aio_write() - EINVAL [aio_offset]");
- aiocbp = create_aiocb ();
+ aiocbp = create_aiocb (fd);
aiocbp->aio_offset = -1;
- aio_write (aiocbp);
- sleep (1);
+ status = aio_write (aiocbp);
+ rtems_test_assert (status == -1);
+
+ result = aio_return (aiocbp);
+ rtems_test_assert (result == -1);
+ status = aio_error (aiocbp);
+ rtems_test_assert (status == EINVAL);
- while (aio_error (aiocbp) == EINPROGRESS);
+ /* Invalid offset */
+ puts ("Init: aio_read() - EINVAL [aio_offset]");
+
+ status = aio_read (aiocbp);
+ rtems_test_assert (status == -1);
result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
+ rtems_test_assert (result == -1);
status = aio_error (aiocbp);
- rtems_test_assert (status != EINVAL);
+ rtems_test_assert (status == EINVAL);
+
free_aiocb (aiocbp);
/* Invalid request priority */
puts ("Init: aio_write() - EINVAL [aio_reqprio]");
- aiocbp = create_aiocb ();
+ aiocbp = create_aiocb (fd);
aiocbp->aio_reqprio = AIO_PRIO_DELTA_MAX + 1;
- aio_write (aiocbp);
- sleep (1);
+ status = aio_write (aiocbp);
+ rtems_test_assert (status == -1);
+
+ result = aio_return (aiocbp);
+ rtems_test_assert (result == -1);
+ status = aio_error (aiocbp);
+ rtems_test_assert (status == EINVAL);
+
+ /* Invalid request priority */
+ puts ("Init: aio_read() - EINVAL [aio_reqprio]");
- while (aio_error (aiocbp) == EINPROGRESS);
+ status = aio_read (aiocbp);
+ rtems_test_assert (status == -1);
result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
+ rtems_test_assert (result == -1);
status = aio_error (aiocbp);
- rtems_test_assert (status != EINVAL);
- free_aiocb (aiocbp);
+ rtems_test_assert (status == EINVAL);
- /* aio_nbytes > 0 and aio_offset >= SEEK_END */
- puts ("Init: aio_write() - EFBIG");
- aiocbp = create_aiocb ();
- aiocbp->aio_nbytes = 1;
- aiocbp->aio_offset = lseek (aiocbp->aio_fildes, 0, SEEK_END) + 1;
- aio_write (aiocbp);
- sleep (1);
+ /* Invalid request aio_cancel */
+ puts ("Init: aio_cancel() - EINVAL ");
- while (aio_error (aiocbp) == EINPROGRESS);
+ status = aio_cancel (WRONG_FD, aiocbp);
+ rtems_test_assert (status == -1);
result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
+ rtems_test_assert (result == -1);
status = aio_error (aiocbp);
- rtems_test_assert (status != EFBIG);
+ rtems_test_assert (status == EINVAL);
+
+ /* Invalid operation to aio_fsync */
+ puts ("Init: aio_fsync() - EINVAL ");
+ status = aio_fsync (-1, aiocbp);
+ rtems_test_assert (status == -1);
+
+ result = aio_return (aiocbp);
+ rtems_test_assert (result == -1);
+ status = aio_error (aiocbp);
+ rtems_test_assert (status == EINVAL);
+
free_aiocb (aiocbp);
puts ("*** END OF POSIX AIO TEST 01 ***");
+ close (fd);
rtems_test_exit (0);
return NULL;
diff -u rtems/testsuites/psxtests/psxaio02/init.c:1.1 rtems/testsuites/psxtests/psxaio02/init.c:1.2
--- rtems/testsuites/psxtests/psxaio02/init.c:1.1 Mon Aug 16 08:29:48 2010
+++ rtems/testsuites/psxtests/psxaio02/init.c Mon Nov 1 12:33:08 2010
@@ -19,12 +19,13 @@
#include <stdio.h>
#include <sched.h>
#include <fcntl.h>
+#include <rtems/chain.h>
-#define BUFSIZE 512
-#define WRONG_FD 404
+#define BUFSIZE 32
+#define MAX 7
struct aiocb *
-create_aiocb (void)
+create_aiocb (int fd)
{
struct aiocb *aiocbp;
@@ -34,7 +35,7 @@
aiocbp->aio_nbytes = BUFSIZE;
aiocbp->aio_offset = 0;
aiocbp->aio_reqprio = 0;
- aiocbp->aio_fildes = open ("aio_fildes", O_RDWR | O_CREAT);
+ aiocbp->aio_fildes = fd;
return aiocbp;
}
@@ -49,101 +50,84 @@
void *
POSIX_Init (void *argument)
{
- int result, policy;
- struct aiocb *aiocbp;
- rtems_status_code status;
- struct sched_param param;
-
+ int fd[MAX];
+ struct aiocb *aiocbp[MAX+2];
+ int status, i;
+ char filename[BUFSIZE];
+
+ status = rtems_aio_init ();
+ rtems_test_assert (status == 0);
+
+ status = mkdir ("/tmp", S_IRWXU);
+ rtems_test_assert (!status);
+
puts ("\n\n*** POSIX AIO TEST 02 ***");
+
+ puts (" Init: Open files ");
- puts ("\n*** POSIX aio_read() test ***");
-
- /* Request canceled */
- puts ("Init: aio_read - ECANCELED");
+ for (i=0; i<MAX; i++)
+ {
+ sprintf (filename, "/tmp/aio_fildes%d",i);
+ fd[i] = open (filename, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
+ rtems_test_assert ( fd[i] != -1);
+ }
+
+ puts (" Init: [WQ] aio_write on 1st file ");
+ aiocbp[0] = create_aiocb (fd[0]);
+ status = aio_write (aiocbp[0]);
+ rtems_test_assert (status != -1);
+
+ puts (" Init: [WQ] aio_write on 2nd file ");
+ aiocbp[1] = create_aiocb (fd[1]);
+ status = aio_write (aiocbp[1]);
+ rtems_test_assert (status != -1);
+
+ puts (" Init: [WQ] aio_read on 2nd file add by priority ");
+ aiocbp[2] = create_aiocb (fd[1]);
+ status = aio_read (aiocbp[2]);
+ rtems_test_assert (status != -1);
+
+ puts (" Init: [WQ] aio_write on 3rd file ");
+ aiocbp[3] = create_aiocb (fd[2]);
+ status = aio_write (aiocbp[3]);
+ rtems_test_assert (status != -1);
+
+ puts (" Init: [WQ] aio_write on 4th file ");
+ aiocbp[4] = create_aiocb (fd[3]);
+ status = aio_write (aiocbp[4]);
+ rtems_test_assert (status != -1);
+
+ puts (" Init: [WQ] aio_write on 5th file -- [WQ] full ");
+ aiocbp[5] = create_aiocb (fd[4]);
+ status = aio_write (aiocbp[5]);
+ rtems_test_assert (status != -1);
+
+ puts (" Init: [IQ] aio_write on 6th file ");
+ aiocbp[6] = create_aiocb (fd[5]);
+ status = aio_write (aiocbp[6]);
+ rtems_test_assert (status != -1);
+
+ puts (" Init: [IQ] aio_write on 7th file ");
+ aiocbp[7] = create_aiocb (fd[6]);
+ status = aio_write (aiocbp[7]);
+ rtems_test_assert (status != -1);
+
+ puts (" Init: [IQ] aio_read on 7th file add by priority ");
+ aiocbp[8] = create_aiocb (fd[6]);
+ status = aio_read (aiocbp[8]);
+ rtems_test_assert (status != -1);
- aiocbp = create_aiocb ();
- aio_read (aiocbp);
- aio_cancel (aiocbp->aio_fildes, aiocbp);
- result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
- status = aio_error (aiocbp);
- rtems_test_assert (status != ECANCELED);
- free_aiocb (aiocbp);
-
- /* Successfull added request to queue */
- puts ("Init: aio_read - SUCCESSFUL");
- aiocbp = create_aiocb ();
- aiocbp->aio_fildes = WRONG_FD;
- status = aio_read (aiocbp);
- rtems_test_assert (!status);
-
- pthread_getschedparam (pthread_self (), &policy, ¶m);
- policy = SCHED_RR;
- param.sched_priority = 30;
- pthread_setschedparam (pthread_self (), policy, ¶m);
- sleep (1);
-
- while (aio_error (aiocbp) == EINPROGRESS);
-
- /* Bad file descriptor */
- puts ("Init: aio_read() - EBADF ");
-
- result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
- status = aio_error (aiocbp);
- rtems_test_assert (status != EBADF);
- free_aiocb (aiocbp);
-
- /* Invalid offset */
- puts ("Init: aio_read() - EINVAL [aio_offset]");
-
- aiocbp = create_aiocb ();
- aiocbp->aio_offset = -1;
- aio_read (aiocbp);
- sleep (1);
-
- while (aio_error (aiocbp) == EINPROGRESS);
-
- result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
- status = aio_error (aiocbp);
- rtems_test_assert (status != EINVAL);
- free_aiocb (aiocbp);
-
- /* Invalid request priority */
- puts ("Init: aio_read() - EINVAL [aio_reqprio]");
-
- aiocbp = create_aiocb ();
- aiocbp->aio_reqprio = AIO_PRIO_DELTA_MAX + 1;
- aio_read (aiocbp);
- sleep (1);
-
- while (aio_error (aiocbp) == EINPROGRESS);
-
- result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
- status = aio_error (aiocbp);
- rtems_test_assert (status != EINVAL);
- free_aiocb (aiocbp);
-
- /* aio_nbytes > 0 && aio_nbytes + aio_offset > max offset of aio_fildes */
- puts ("Init: aio_read() - OVERFLOW");
- aiocbp = create_aiocb ();
- aiocbp->aio_nbytes = 10;
- aiocbp->aio_offset = lseek (aiocbp->aio_fildes, 0, SEEK_END);
- aio_read (aiocbp);
- sleep (1);
-
- while (aio_error (aiocbp) == EINPROGRESS);
-
- result = aio_return (aiocbp);
- rtems_test_assert (result != -1);
- status = aio_error (aiocbp);
- rtems_test_assert (status != EFBIG);
- free_aiocb (aiocbp);
+ puts ("\n\n*** POSIX AIO TEST 02 ***");
puts ("*** END OF POSIX AIO TEST 01 ***");
+ for (i = 0; i < MAX; i++)
+ {
+ close (fd[i]);
+ free_aiocb (aiocbp[i]);
+ }
+ free_aiocb (aiocbp[i]);
+ free_aiocb (aiocbp[i+1]);
rtems_test_exit (0);
return NULL;
--
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/20101101/38432108/attachment.html>
More information about the vc
mailing list