[PVFS2-CVS] commit by neill in pvfs2/test/kernel/linux-2.6: threaded_write.c

CVS commit program cvs at parl.clemson.edu
Tue Jul 20 13:13:12 EDT 2004


Update of /projects/cvsroot/pvfs2/test/kernel/linux-2.6
In directory parlweb:/tmp/cvs-serv25716

Modified Files:
	threaded_write.c 
Log Message:
- try to grab the errno value on failed writes in this test
  (this way, for example, i can verify that removing the test file
  being written to during a run emits EBADF errno values)


Index: threaded_write.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/kernel/linux-2.6/threaded_write.c,v
diff -p -u -r1.3 -r1.4
--- threaded_write.c	19 Jul 2004 21:13:16 -0000	1.3
+++ threaded_write.c	20 Jul 2004 16:13:12 -0000	1.4
@@ -53,7 +53,11 @@ void *write_file(void *ptr)
             fprintf(stderr, "thread %d writing data (%d bytes))\n",
                     info->index, info->size);
 
-            info->error_code = writev(info->fd, iov, 2);
+            if (writev(info->fd, iov, 2) == -1)
+            {
+                /* at least *try* to capture the errno */
+                info->error_code = errno;
+            }
             free(buf);
         }
         fprintf(stderr, "thread %d returning\n", info->index);
@@ -107,9 +111,10 @@ int main(int argc, char **argv)
     for(i = 0; i < num_threads; i++)
     {
         pthread_join(threads[i], NULL);
-        if (info[i].error_code == -1)
+        if (info[i].error_code)
         {
-            fprintf(stderr, "Thread %d failed to write\n", i);
+            fprintf(stderr, "Thread %d failed to write (%x)\n", i,
+                    info[i].error_code);
         }
     }
 



More information about the PVFS2-CVS mailing list