2003-03-04 19:50:17

by SA

[permalink] [raw]
Subject: kill_fasync usage


Dear list,

quick advice please,

I wnat to use kill_fasync(struct fasync_struct *PTR,...) to notify userland of
events. Can I just call kill_fasync regardless of the state of PTR or does
PTR actually have to point to something valid.

In my code PTR=NULL initially and may or may not be set or unset during use. I
would like to know if I can call kill_fasync without testing what is in PTR.
If I have to test what would PTR be if there isn't anything in the queue?
If I can't test PTR how can I find out from the arguments to my fasync method
if I am adding (or removing) processes from the list?

Thanks SA


2003-03-04 20:51:54

by Manfred Spraul

[permalink] [raw]
Subject: Re: kill_fasync usage

SA wrote:

>I wnat to use kill_fasync(struct fasync_struct *PTR,...) to notify userland of
>events. Can I just call kill_fasync regardless of the state of PTR or does
>PTR actually have to point to something valid.
>
>
kill_fasync receives the _address_ of the variable that contains the
list of processes that need notifications. It must not be NULL. (I
assume you look at 2.4 or 2.5 - 2.2 had a different interface)

Check linux/drivers/char/busmouse.c for an example, the interface is
simple: call fasync_helper to register and kill_fasync for the actual
notification.

--
Manfred