netdev
[Top] [All Lists]

Re: [Lse-tech] Re: A common layer for Accounting packages

To: Thomas Graf <tgraf@xxxxxxx>
Subject: Re: [Lse-tech] Re: A common layer for Accounting packages
From: jamal <hadi@xxxxxxxxxx>
Date: 28 Feb 2005 08:40:10 -0500
Cc: Andrew Morton <akpm@xxxxxxxx>, Guillaume Thouvenin <guillaume.thouvenin@xxxxxxxx>, kaigai@xxxxxxxxxxxxx, marcelo.tosatti@xxxxxxxxxxxx, "David S. Miller" <davem@xxxxxxxxxx>, jlan@xxxxxxx, lse-tech@xxxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, elsa-devel@xxxxxxxxxxxxxxxxxxxxx
In-reply-to: <20050228132051.GO31837@xxxxxxxxxxxxxx>
Organization: jamalopolous
References: <421CEC38.7010008@xxxxxxx> <421EB299.4010906@xxxxxxxxxxxxx> <20050224212839.7953167c.akpm@xxxxxxxx> <20050227094949.GA22439@xxxxxxxxxx> <4221E548.4000008@xxxxxxxxxxxxx> <20050227140355.GA23055@xxxxxxxxxx> <42227AEA.6050002@xxxxxxxxxxxxx> <1109575236.8549.14.camel@xxxxxxxxxxxxxxxxxxxxxxxx> <20050227233943.6cb89226.akpm@xxxxxxxx> <1109592658.2188.924.camel@xxxxxxxxxxxxxxxx> <20050228132051.GO31837@xxxxxxxxxxxxxx>
Reply-to: hadi@xxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
netlink broadcast or a wrapper around it.
Why even bother doing the check with netlink_has_listeners()?

cheers,
jamal

On Mon, 2005-02-28 at 08:20, Thomas Graf wrote:
> > Havent seen the beginnings of this thread. But whatever you are trying
> > to do seems to suggest some complexity that you are trying to
> > workaround. What was wrong with just going ahead and just always
> > invoking your netlink_send()?
> 
> I guess parts of the wheel are broken and need to be reinvented ;->
> 
> > If there are nobody in user space (or kernel) listening, it wont go 
> > anywhere.
> 
> Additional you may want to extend netlink a bit to check whether
> there is a listener before creating the messages. The method to do so
> depends on whether you use netlink_send() or netlink_brodacast(). The
> latter is more flexiable because you can add more groups later on
> and the userspace applications can decicde which ones they want to
> listen to. Both methods handle dying clients perfectly fine, the
> association to the netlink socket gets destroyed as soon as the socket
> is closed. Therefore you can simply check mc_list of the netlink
> protocol you use to see if there are any listeners registered:
> 
> static inline int netlink_has_listeners(struct sock *sk)
> {
>       int ret;
> 
>       read_lock(&nl_table_lock);
>       ret = list_empty(&nl_table[sk->sk_protocol].mc_list)
>       read_unlock(&nl_table_lock);
> 
>       return !ret;
> }
> 
> This is simplified and ignores the actual group assignments, i.e. you
> might want to extend it to have it check if there are listeners for
> a certain group.
> 


<Prev in Thread] Current Thread [Next in Thread>