• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
sleep in the NKE unload function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sleep in the NKE unload function


  • Subject: sleep in the NKE unload function
  • From: Jean Suisse <email@hidden>
  • Date: Sun, 09 Sep 2012 18:33:06 +0200

Hello,

Unloading a network kernel extension that registers a socket filter 
can only be safely done once the sf_unregistered function has been called by the stack 
in response to a previous call to sflt_unregister from the kext.

Thus, when my kext is requested to unload, I first unregister the filter, then I do various cleanup (to gain some time). 
Eventually, I check wether or not sf_unregistered has been called. Unfortunately, most of the time it has not. 
But the timing is really close since sending two unload request in a row (from the terminal) is enough to get a 100% unload success rate on the second attempt.
Bottom line, I should have waited a little longer to give sf_unregistered a chance to be called.

Now, I have a few options:

- I could use msleep (the would originate from the sf_unregistered function).
- I could spin in a tight while loop (is it over yet ? is it over yet ? …) with a timeout exit condition (a few ms for instance).
- Other suggestions on how to deal with this kind of situation...

What do you think ?

Jean

Jean Suisse

Institut de Chimie Moléculaire de l’Université de Bourgogne
(ICMUB) — UMR 6302

U.F.R. Sciences et Techniques, Bâtiment Mirande
Aile B, bureau 411
9, avenue Alain Savary — B.P. 47870
21078 DIJON CEDEX

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: sleep in the NKE unload function
      • From: Jean Suisse <email@hidden>
  • Prev by Date: [SOLVED] static variables and kernel panic
  • Next by Date: Re: sleep in the NKE unload function
  • Previous by thread: [SOLVED] static variables and kernel panic
  • Next by thread: Re: sleep in the NKE unload function
  • Index(es):
    • Date
    • Thread