Re: logging data to a file.

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

 



On 11/4/05, Thomas Petazzoni <thomas.petazzoni@xxxxxxxx> wrote:
> Hi,
>
> Jesper Juhl wrote:
>
> > Get the data to userspace via printk/sysfs/netlink or some such, then
> > write the data to a file in userspace.
>
> I don't think sysfs is designed to transfer data from the kernel to
> userspace applications, it's dedicated to exporting attributes of
> devices to userspace.
>
That's right, but it can be perverted to export other data as well...
Not what it's intended for, but if you just need to get some data out
while debugging it can work for that purpose.


> Concerning Netlink, as far as I know the number of communication
> channels is limited, and one can create its own simply (that's why the
> Netfilter guys introduced nf_netlink, which multiplexes the
> Netfilter-reserved Netlink socket). Am I wrong ?
>
According to the docs I've read "Each netlink family has a set of 32
multicast groups." so yeah, you are right, there's a limit. But it
still might be suitable for what Bahadir has in mind.


> To transfer large amount of data from the kernel to user space, 2.6.14
> introduced "relayfs" [1], primarly used by the Linux Trace Toolkit, but
> that can be used for other purposes.
>
Looks like a good fit for the purpose. I was not aware of relayfs -
thank you for pointing that out.


For small amounts of data I still find a simple printk() to be the
easiest way to get data to userspace.



--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

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