Nothing printed from custom /proc/foo

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

 



Hi,

I want to add a virtual file under /proc for my module (kernel 2.4.21). The "registration" seems to work because /proc/foo shows up once my module is loaded. Here's the call:

create_proc_read_entry("foo", 0, NULL, foo_read, NULL);

My problem is that nothing shows up when I read foo with 'cat' or 'less'. Here's foo():

int foo_read(char *buf, char **start, off_t offset, int count, int *eof, void *data)
{
 printk("Got into foo_read\n");
 int len = sprintf(buf, "hello");
 *eof = 1;
 return len;
}

As you can see, I've used printk() in the hope of asserting that foo() is called. Unfortunately, I can't see anything in /var/log/messages. I don't even know if I should expect printk() to work in this context. I tried both with and without with the same result.

What am I missing?
Thanks,
JP



--
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