All of lore.kernel.org
 help / color / mirror / Atom feed
* userspace notification from module
@ 2010-01-02 12:18 Bartłomiej Zimoń
  2010-01-02 12:36 ` Daniel Borkmann
  0 siblings, 1 reply; 5+ messages in thread
From: Bartłomiej Zimoń @ 2010-01-02 12:18 UTC (permalink / raw)
  To: linux-kernel

Hi List!
My name is Bartłomiej Zimoń.

Need some clue to find solution for above topic.
Have written small kernel module to notify userspace about couple events.

The problem is to choose proper way to send data to userspace.

Use inotify from userspace could be interesting for such data,
but looks like sysfs/procfs doesn't send signal about data changed in file or maybe i'm wrong?

If sysfs/procfs is wrong for that so must create device file, but here secound problem 
how to notify that file/buffer has new data?

Please give me some light for such case.
Links to working solutions are also good.

Thanks in advice.

Bartłomiej Zimoń
PLD Linux devel, Kadu Team devel



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: userspace notification from module
  2010-01-02 12:18 userspace notification from module Bartłomiej Zimoń
@ 2010-01-02 12:36 ` Daniel Borkmann
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2010-01-02 12:36 UTC (permalink / raw)
  To: Bartłomiej Zimoń; +Cc: linux-kernel

Hi Bartłomiej,

Bartłomiej Zimoń wrote:
> Use inotify from userspace could be interesting for such data,
> but looks like sysfs/procfs doesn't send signal about data changed in file or maybe i'm wrong?
> 
> If sysfs/procfs is wrong for that so must create device file, but here secound problem 
> how to notify that file/buffer has new data?

Actually, the file content of a procfs file is volatile and generated on
the fly, just have a look at some device drivers or at the API.

Did you have a look at the netlink protocol for communication from
kernel to userspace?

Cheers,
Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: userspace notification from module
  2010-01-02 13:29 Bartłomiej Zimoń
@ 2010-01-02 14:04 ` Daniel Borkmann
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2010-01-02 14:04 UTC (permalink / raw)
  To: Bartłomiej Zimoń; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]

Hi Bartłomiej,

Bartłomiej Zimoń wrote:
> Dnia 2 stycznia 2010 13:36 	Daniel Borkmann <llug.dan@googlemail.com> napisał(a):
> I will explain more what i'm going to do.
> The idea is simple. Kernel before suspend/resume sends notification to 
> registered kernel objects. So i have written small module to register
> there and want now pass these data to /dev/file. It is 1byte so not a big deal.
> 
> I'm searching now for notification about new byte in buffer, as it is almost 
> clear for async: http://www.xml.com/ldd/chapter/book/ch05.html#t4
> but for sync still haven't find.

This sounds very interesting... a "hack" could be the following:

Register your pids to the kernel module, e.g. via ioctl, and if the
(intra-kernel) notification will be delivered to your module you just
send a signal to your registered processes via kill_proc_info(). Guess
this is at least better than polling a file or sth similar.

I guess netlink could be the "cleaner" solution, but with more overhead?!

Cheers,
Daniel


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: userspace notification from module
@ 2010-01-02 13:29 Bartłomiej Zimoń
  2010-01-02 14:04 ` Daniel Borkmann
  0 siblings, 1 reply; 5+ messages in thread
From: Bartłomiej Zimoń @ 2010-01-02 13:29 UTC (permalink / raw)
  To: linux-kernel

Dnia 2 stycznia 2010 13:36 	Daniel Borkmann <llug.dan@googlemail.com> napisał(a):

> Hi Bartłomiej,
> 
> Bartłomiej Zimoń wrote:
> > Use inotify from userspace could be interesting for such data,
> > but looks like sysfs/procfs doesn't send signal about data changed in file or maybe i'm wrong?
> > 
> > If sysfs/procfs is wrong for that so must create device file, but here secound problem 
> > how to notify that file/buffer has new data?
> 
> Actually, the file content of a procfs file is volatile and generated on
> the fly, just have a look at some device drivers or at the API.
> 

As I fought. Reading now sources of some char drivers.

> Did you have a look at the netlink protocol for communication from
> kernel to userspace?
> 

Ok i will :)

I will explain more what i'm going to do.
The idea is simple. Kernel before suspend/resume sends notification to 
registered kernel objects. So i have written small module to register
there and want now pass these data to /dev/file. It is 1byte so not a big deal.

I'm searching now for notification about new byte in buffer, as it is almost 
clear for async: http://www.xml.com/ldd/chapter/book/ch05.html#t4
but for sync still haven't find.

It could be interesting for NetworkManager to hook on such event.

Looks like my post arrives 2nd time in lkml.

Thx for reply.

Best Regards.
Bartłomiej Zimoń
PLD Linux, Kadu Team


^ permalink raw reply	[flat|nested] 5+ messages in thread

* userspace notification from module
@ 2010-01-02 12:02 Bartłomiej Zimoń
  0 siblings, 0 replies; 5+ messages in thread
From: Bartłomiej Zimoń @ 2010-01-02 12:02 UTC (permalink / raw)
  To: linux-kernel

Hi List!
My name is Bartłomiej Zimoń.

Need some clue to find solution for above topic.
Have written small wrapper module to notify userspace about couple events.

The problem is to choose proper way to send data to userspace.

Use inotify from userspace could be interesting for such data,
but looks like sysfs/procfs doesn't send signal about data changed in file or maybe i'm wrong?

If sysfs/procfs is wrong for that so must create device file, but here secound problem 
how to notify that file was changed?

Please give me some light for such case.
Links to working solutions are also good.

Thanks in advice.

Bartłomiej Zimoń
PLD Linux devel, Kadu Team devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-02 14:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-02 12:18 userspace notification from module Bartłomiej Zimoń
2010-01-02 12:36 ` Daniel Borkmann
  -- strict thread matches above, loose matches on Subject: below --
2010-01-02 13:29 Bartłomiej Zimoń
2010-01-02 14:04 ` Daniel Borkmann
2010-01-02 12:02 Bartłomiej Zimoń

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.