Deadlock in My KEXT with NKE
Hi all, I have done alot of researching on this and can't find a way to do this. I have my KEXT which is a NKE, and I am specifically playing with the send function so that I can monitor and control all outgoing traffic from my computer. I have succeeded in finishing my program, but after using it for a little bit it goes into Deadlock. I look at my code and I can see why. In my send function I have it surrounded by the the thread_tunnel involving network_flock as to make sure only one send function is being dealed with at a time, After which my send function signals a global static variable work_to_do = 1, that informs the daemon which is polling using sysctlbyname(...), that there is work to be done, and then in the KEXT's NKE's send function it does a while(conditional_val == 0) { the functions that causes it to sleep; } then when the dameon is finished with the work, it signals by sysctlbyname that conditional_val = 1 which causes the NKE's send function to get out of the while loop. This way is working pretty well, except after awhile of using it, it gums up and creates deadlock and also the CFUserNotificationCreate in my Daemon stops popping up windows asking for input on what to do for a connection, And finally the only thing i can do then is hold down the poser button to reboot. I know probably the while loop is very stupid and dangerous to use in the KEXT, it brings up questions like, what if the Daemon failed, then it would be in a inifinite loop forever. So any suggestions of what to do now, of how to know if the Daemon is running and also to block the send function until my dameon is done with work and then to notify the NKE. Presently my daemon when it first starts up it signals to the KEXT it is running and sets that global static variable, but if the daemon were to die, the KEXT wouldn't know. Thanks for listening to my blabbing on. Matt P.S. I really did research this but I can't find anything on it, yeah maybe I don't know how to search well, but please help. I hope I explained this as best as possible. _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Matt Jaffa