Re: Copying kernel module error messages to userspace

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

 



why u must use a law to limit your solution?
And u can hack kernel and dig the hole and do what u want......

Lin

2009/9/14 Leonidas . <leonidas137@xxxxxxxxx>:
>
>
> On Mon, Sep 14, 2009 at 2:19 PM, Leonidas . <leonidas137@xxxxxxxxx> wrote:
>>
>>
>> On Mon, Sep 14, 2009 at 1:57 PM, Pei Lin <telent997@xxxxxxxxx> wrote:
>>>
>>> SO u can use the first method,write files from the kernel space.....
>>> See the hyperlink i give.
>>>
>>> Lin
>>>
>>> 2009/9/14 Leonidas . <leonidas137@xxxxxxxxx>:
>>> >
>>> >
>>> > On Mon, Sep 14, 2009 at 1:22 PM, Leonidas . <leonidas137@xxxxxxxxx>
>>> > wrote:
>>> >>
>>> >>
>>> >> Hi List
>>> >>
>>> >> I have written a kernel module which implements a char device. An
>>> >> userspace app
>>> >> is supposed to get data from my module and then dump it into a file
>>> >> for
>>> >> further processing.
>>> >>
>>> >> The kind of data which kernel module is going to pass to userspace is
>>> >> going to be a 4K buffer,
>>> >> and the data traffic is not going to be really heavy, meaning may be a
>>> >> 4K
>>> >> buffer every 1 min or so.
>>> >> I am not very sure though, but certainly not heavy traffic the way
>>> >> they
>>> >> describe for network traffic etc.
>>> >>
>>> >> And this data needs to be logged to a file either from kernel or
>>> >> userspace
>>> >> and an userspace all will work
>>> >> on that data. This data needs to be logged as soon as it arrives
>>> >> meaning,
>>> >> I might not be able to write it to
>>> >> /proc since from module I can update /proc only when user actually
>>> >> accesses it. This data needs to be
>>> >> static in nature, meaning I get one error and I write it to a file
>>> >> somehow
>>> >> and user can see it anytime.
>>> >>
>>> >> I hope I have described the situation clearly. I have explored some
>>> >> mechanism like ioctls, mmaping the
>>> >> kernel buffer etc but all these would require the user module to poll
>>> >> or
>>> >> notified somehow by kernel that
>>> >> the data is available. I dont want the user module to poll.
>>> >>
>>> >>
>>> >> -Leo.
>>> >>
>>> >
>>> > When we do a printk it writes to kernel log buffer, correct? This is
>>> > real in
>>> > time operation i.e. as soon as we do a
>>> > printk the messages get logged. Now this log file can be accesses from
>>> > /var/log/messages right? How is this done?
>>> >
>>> > I want to so something similar, so I can log my messages to a seprate
>>> > file
>>> > which is going to stay around so user can
>>> > see at across reboots as well.
>>> >
>>> >
>>> >
>>> > -Leo.
>>> >
>>> >
>>
>>
>> No, Greg KH mentions that is should not be done!
>> And I have been reading that 'It is a bad..bad thing to access files from
>> kernel space'
>> since I started doing Linux stuff.
>>
>> _Leo.
>
>
> I am aware of other legitimate mechanisms as I have described on my origianl
> post.
> It is just that I have certain constraints under which I cant use many of
> the methods
> since I dont want to user space entity to do polling or get signal from
> kernel.
>
> -Leo.
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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