[Pvfs2-cvs] commit by kunkel in pvfs2/src/io/trove/trove-dbpf: dbpf-bstream-threaded.c

CVS commit program cvs at parl.clemson.edu
Wed Aug 2 18:14:22 EDT 2006


Update of /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf
In directory parlweb1:/tmp/cvs-serv3429/src/io/trove/trove-dbpf

Modified Files:
      Tag: kunkel-branch
	dbpf-bstream-threaded.c 
Log Message:
Added pread pwrite macros to handle interrupted write / read syscalls.


Index: dbpf-bstream-threaded.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/Attic/dbpf-bstream-threaded.c,v
diff -p -u -r1.1.2.10 -r1.1.2.11
--- dbpf-bstream-threaded.c	2 Aug 2006 21:56:59 -0000	1.1.2.10
+++ dbpf-bstream-threaded.c	2 Aug 2006 22:14:22 -0000	1.1.2.11
@@ -66,11 +66,11 @@ inline int PREAD(int fd, void *buf, size
     int ret = 0;
     int retSize = 0;
     do{
-        ret = pread(fd, buf, count, offset);
+        ret = pread(fd, buf, count - retSize, offset + retSize);
         if (ret){
             retSize +=ret;
         }
-    }while(ret == -1 && errno == EINTR);
+    }while( (ret == -1 && errno == EINTR) || (retSize < count && ret > 0) );
     return retSize;
 }
 
@@ -78,11 +78,11 @@ inline int PWRITE(int fd, const void *bu
     int ret = 0;
     int retSize = 0;
     do{
-        ret = pwrite(fd, buf, count, offset);
+        ret = pwrite(fd, buf, count - retSize, offset + retSize);
         if (ret){
             retSize +=ret;
         }
-    }while(ret == -1 && errno == EINTR);
+    }while( (ret == -1 && errno == EINTR)  || (retSize < count && ret > 0) );
     return retSize;
 }
 



More information about the Pvfs2-cvs mailing list