:: Re: [DNG] nlmon (was: A better def…
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Isaac Dunham
Datum:  
To: Rainer Weikusat
CC: dng
Betreff: Re: [DNG] nlmon (was: A better default windows manager)
On Wed, Jul 29, 2015 at 01:21:04PM +0100, Rainer Weikusat wrote:
> Isaac Dunham <ibid.ag@???> writes:
> > Or you can do it with mount, sudo, sh, and nlmon (http://git.r-36.net/nlmon).
>
> Using poll to wait for a message followed by recvmsg for reading it
> offers (in absence of a timeout) no advantages over just doing a
> blocking recv. Since this code neither uses control messages nor looks
> at the returned flags, it can use recvfrom instead of the (more
> complicated) recvmsg. Considering that it checks for message buffer
> overflow via len >= sizeof(buf), the MSG_TRUNC flag should probably be
> used to make the kernel return the real size in case a datagram was
> truncated. Lastly, the message doesn't have to be copied to a 2nd buffer
> just to turn the 0-terminated name=value pairs into \n-terminated ones.
>
> NB: I admit that I mainly did this because it looked like a nice, simple
> programming task.


A few comments:
- I'm not the maintainer, and I don't see why this got sent here.
- There's no reason to factor out print_event_if, and the code it replaced
is clearer and more concise.
- While there's no code here to do it, in general the iovec-based functions
make it simpler to do the right thing. Here, they're probably superfluous.

Thanks,
Isaac Dunham