Re: Getting hostname info from within kernel code
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Alexander Kluyev writes:
Hi guys,
Is there way to get hostname (MachineName, ComputerName) from within my KEXT I'm writing? It seems I saw "some useful global variables like hostname, hostnamelen" description somewhere in documentation. However I cannot find it once again. Does anyone have experience regarding that? Thank you.
You're not allowed to access these variables directly, as they are not exported. The last I checked, you cannot use sysctl to access them from inside the kernel, and sysctlbyname does not work for kern.hostname. I had to get around this by launching a usermode helper which then told my kext what the hostname was. Talk about Rube Goldburg... Drew _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Andrew Gallatin