writes to /dev/kmsg

writes to /dev/kmsg

Constantine Shulyupin const at makelinux.co.il
Wed Feb 20 11:43:40 IST 2019


        stderr = fopen("/dev/kmsg", "w+");
        fprintf(stderr, "%s:%i %s ", __FILE__, __LINE__, __func__);

Call a driver. In the driver:
        #undef pr_fmt
        #define pr_fmt(fmt)    "%s.c:%d %s " fmt, KBUILD_MODNAME, __LINE__,
__func__
        pr_debug("...");
or
        printk("%s:%i %s ", __FILE__, __LINE__, __func__);

then from UM:
        fprintf(stderr, "%s:%i %s ", __FILE__, __LINE__, __func__);

Thanks

On Wed, Feb 20, 2019 at 11:23 AM Lev Olshvang <levonshe at yandex.com> wrote:

> Can you please elaborate, what you are trying to synchronize, I suppose
> messages from your driver are uniquely identified?
>
>
> 19.02.2019, 19:42, "Constantine Shulyupin" <const at makelinux.co.il>:
>
> I write to /dev/kmsg when it is need to synchronize UM and driver's logs.
>
> On Tue, Feb 19, 2019 at 3:34 PM Lev Olshvang <levonshe at yandex.com> wrote:
>
> Kernel documentation describes interface
> https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg
>
> I wonder what kind of applications use it?
> Why somebody need to use kmsg instead of syslog?
>
> Can anybody give example of such application?
>
> Regards,
> Lev
>
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
>
>
> --
> Constantine Shulyupin
> http://www.MakeLinux.co.il/
> Embedded Linux Systems
> Tel Aviv
>
>

-- 
Constantine Shulyupin
http://www.MakeLinux.co.il/
Embedded Linux Systems
Tel Aviv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20190220/2831ec9f/attachment.html>


More information about the Linux-il mailing list