On Sun, Sep 26, 2010 at 1:04 PM, Bond <[email protected]> wrote:
> > > The first read comes in with a *f_pos of 0. If you dont update the file >> pointer, the user space program will keep reading from f_pos 0 indefinitely. >> As file pointer is at offset 0 always because you dont update *f_pos, every >> read(..) called by user space will succeed. So, your command cat /dev/bond >> will never return. user space programs generally look for a specific return >> code to know that it is the end of the file. >> > That is the reason in strace I was getting mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2a2f03b000 write(1, "abcde", 5) = 1 write(1, "bcde", 4) = 1 write(1, "cde", 3) = 1 write(1, "de", 2) = 1 write(1, "e", 1) = 1 close(1) = 0 munmap(0x7f2a2f03b000, 4096) = 0 close(2) = 0 exit_group(0) = ? What should I be reading to the thing you just mentioned in the above paragraph about updating file pointer f_pos meaniing what is happening each time when a user space call to read is done.
