Get the host name via C/C++ at kernel level

Discussion in 'Mac Programming' started by eddyq, Sep 13, 2009.

  1. eddyq macrumors member

    Joined:
    Jun 10, 2009
    #1
    Is there a way to get the host name while in a KEXT? I can use C++ or C.
     
  2. pilotError macrumors 68020

    pilotError

    Joined:
    Apr 12, 2006
    Location:
    Long Island
    #2
    I'm sure there's a few ways...

    getenv("$HOSTNAME");

    might be one way.

    char myhost[20];
    gethostname(&myhost, sizeof(myhost));

    is another...

    There may be some more Mac specific API calls to do this as well...
     
  3. eddyq thread starter macrumors member

    Joined:
    Jun 10, 2009
    #3
    Are you sure these can be called from kernel level? When I try it they are not found.
     

Share This Page