bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

needless seek and re-read


From: scott douglass
Subject: needless seek and re-read
Date: Tue, 09 Dec 2003 13:19:02 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007

Hello,

I built the following code with gcc 3.3.2 and linked it with a glibc 2.3.2 that 
I had built myself (so I could debug it) on Red Hat 9.  Using strace I can see 
a needless seek and re-read marked '@@@ why?' below,

#include <stdio.h>

int main() {
 FILE* me = fopen(__FILE__, "rb");
/* open("foo.c", O_RDONLY)                 = 3 */
/* fstat64(3, {st_mode=S_IFREG|0664, st_size=605, ...}) = 0 */
/* old_mmap(NULL, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0x40017000 */
 getc(me);
/* read(3, "#include <stdio.h>\n\nint main() {"..., 32768) = 605 */
 getc(me);
 getc(me);
 ftell(me);
/* _llseek(3, -602, [3], SEEK_CUR)         = 0 */  /* @@@ why? */
 getc(me);
/* read(3, "clude <stdio.h>\n\nint main() {\n  "..., 32768) = 602 */  /* @@@ 
why? */
 fclose(me);
/* close(3)                                = 0 */
 return 0;
}

I tried to report this at www-gnats.gnu.org and bugs.gnu.org but I haven't been 
able to connect to them for about a week.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]