Get the host name via C at kernel level

Discussion in 'macOS' started by eddyq, Sep 13, 2009.

  1. eddyq macrumors member

    Joined:
    Jun 10, 2009
    #1
    Is there a way to get the host name via a C program (while in kernel level)?
     
  2. electroshock macrumors 6502a

    electroshock

    Joined:
    Sep 7, 2009
    #2
    You may have better luck by asking your query in the MacOS X programming forum.

    Sounds like you're writing a kext? Mach's host_info isn't exported (made visible) to the OS X kernel frameworks so you can't call that. The easiest way, even if it's a less-than-elegant workaround, may be to have a user-mode helper stub that gets this information through more conventional library calls and then notifies the kext what the hostname is.
     
  3. eddyq thread starter macrumors member

    Joined:
    Jun 10, 2009
    #3
    Ok, thanks. I'll check with the MacOS X programming forum. If there is nothing directly available in the kernel then I'll just forget it.
     

Share This Page