Search code examples
c++cmacoskernelmach

uuid.h in kernel space of OSX?


After I look around, I haven't find a built in function for UUID creation within OSX kernel space. (which is limited to Kernel.framework)

Are there any alternatives I could use? Or should I just use time hash (MD5/SHA1)?


Solution

  • These should help:

    void uuid_generate(uuid_t out);
    void uuid_generate_random(uuid_t out);
    void uuid_generate_time(uuid_t out);
    

    They're declared in <uuid/uuid.h>, and linkage is defined in Libkern.exports, i.e. your kext's OSBundleLibraries property must list com.apple.kpi.libkern - which it probably already does.