Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I wrote a module that makes use of netlink sockets to talk to a user-space application among other things and I'm having some trouble getting rmmod to work once it is up. I believe it is caused by my implementation of the netlink sockets since rmmod works just fine when I don't launch the user-space application it talks to but it fails when I do. The reason it provides for the inability to rmmod is that the resource is temporarily unavailable. An lsmod shows that the module is used by 1 other process.
In my implementation I have tried to close the socket connection in the module's exit function by performing both netlink_kernel_release(nl_sock) and sock_release(nl_sock->socket). The first compiles fine and is what I have been testing and runs into the problem. The second is not compiling and the error the compiler gives me is that I'm dereferencing a pointer to an incomplete type.
One other possible source of the problem that has crossed my mind is earlier in testing after I unicasted a message I freed the corresponding skb which caused the kernel to try and access a NULL address which was clearly all bad. Am I supposed to keep track of this skb and free it at a later time?
Just ran another quick test to see more about the relationship to the user-space process was-I brought up the two and established the link, killed the user-space process and then the module was free to rmmod.
Maybe there's some sort of netlink socket command I can use to disconnect before I release the socket?
//detach from listener