Resources cleanup upon using received data

ferran ranker72 at gmail.com
Fri Jun 12 08:24:51 PDT 2015


Hello everyone,
I have some issues at managing resources used to query wireless
statistics, I hope you can help me.

Currently I successfully query cfg80211 to get statistics about wireless
devices such as tx bitrate, every 10 seconds. My problem is that I have
been unable to do this without leaking file descriptors and memory. The
code I use is inherited and I am trying to fix it, but I can't manage to
release the resources without losing the retrieved data. Until now, I
have read the documentation, compared with implementation examples found
here and there, and consulted frequently the doxygen reference. However,
I still need some more help.

Issue 1: 'nl_recvmsgs_default()' will block until receiving a message if
socket is configured as blocking (default), but won't wait for the
callback to finish, right? So how could I possibly release the resources
just after nl_recvmsgs if the callback needs the received data?

Issue 2: I have sumarized  the code so that you can check the run flow
and the memory management, it's posted in pastebin:
http://pastebin.com/EYADmDpy
Could you have a look to it, please? It's less than 100 lines, comments
included. How should I release the resources used by the nl socket and
nl message?

Thank you for your time,
Ferran



More information about the libnl mailing list