From: mreed <mr...@us...> - 2006-07-10 19:24:07
|
Update of /cvsroot/ltp/ltp/testcases/kernel/io/ltp-aiodio In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv403 Modified Files: read_checkzero.c Log Message: A fix submitted to Jacky Malcles that fixes this testcase. The lseek function allows the file offset to be set beyond the end of the existing end-of-file of the file. If data is later written at this point, subsequent reads of the data is in the gap returns bytes of zeros until data is actually written into the gap. Index: read_checkzero.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/io/ltp-aiodio/read_checkzero.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** read_checkzero.c 25 Feb 2004 23:47:05 -0000 1.1 --- read_checkzero.c 10 Jul 2006 19:24:04 -0000 1.2 *************** *** 33,37 **** #include <stdio.h> #include <unistd.h> ! #define NUM_CHILDREN 8 --- 33,37 ---- #include <stdio.h> #include <unistd.h> ! *************** *** 65,77 **** char buf[4096]; ! while ((fd = open(filename, O_RDONLY)) < 0) { ! sleep(1); /* wait for file to be created */ } ! ! for (i = 0 ; i < 10000000; i++) { off_t offset; char *bufoff; ! offset = lseek(fd, SEEK_END, 0); r = read(fd, buf, 4096); if (r > 0) { --- 65,82 ---- char buf[4096]; ! if ((fd = open(filename, O_RDWR)) < 0) { ! fprintf(stderr, "can't open file %s \n",filename); ! exit(1); } ! ! for (i = 0 ; i < 100000; i++) { off_t offset; char *bufoff; ! offset = lseek(fd, 4096, SEEK_END); ! r = write(fd,"A",1); ! ! offset = lseek(fd, offset - 4096 , SEEK_SET); ! r = read(fd, buf, 4096); if (r > 0) { |