Re: procfs-problem with linux 2.4.24

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

 



On Monday 07 February 2005 18:46, Joerg Hoh wrote:
> Hi
> 
> I have a problem regarding a procfs entry.
> 
> I created one and added a read_func. If I do a
> "cat /proc/.../my_entry", debug-printk's show me, that my read function is
> called 3 times. It returns 21,19 and 21 bytes.
> 
> A "strace cat /proc/.../my_entry" has the following output
> 
> ...
> open("/proc/.../my_entry")  = 3
> ...
> read(3,"21 bytes output ...",4096) = 21
> write(1,"21 bytes output ...")  = 21
> read(3,"",4096)    = 0
> ...
> close(3)
> 
> 
> I have no clue what happens. My module shows me 3 calls of the read function,
> but strace shows only 2 (and a return value which is never returned from the
> read function). Can anyone explain me what happens here?


You never set 'start'.  It is a pointer into 'page' corresponding to the
offset, 'off' in the virtual file that the read is trying to resolve.
I believe you are misusing 'off'.  It is the offset into the virtual
file - not the offset into 'page'.  snprintf() might return -1.  Looks
like you are doing bad things with the semaphore as well.  I don't think
you can assume your routine will get called until EOF.




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux