Something went wrong. Try again.
Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
1.5 kB · 54 lines
C++
at vchroot
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455#include <unistd.h>#include <sys/types.h>#include <stdlib.h>#include <pwd.h>#include <sys/utsname.h>//#include "log.h"
#include <CoreFoundation/CFString.h>#include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
#define MAX_PASSENTRY_LENGTH 4096
CFStringRef SCDynamicStoreCopyComputerName (SCDynamicStoreRef store, CFStringEncoding *nameEncoding){ //LOG << "fixme: SCDynamicStoreCopyComputerName() - stub" << std::endl; return NULL;}
CFStringRef SCDynamicStoreCopyConsoleUser (SCDynamicStoreRef store, uid_t *uid, gid_t *gid){ struct passwd pwent, *pwentp; char buffer[MAX_PASSENTRY_LENGTH]; char *user;
if (uid) *uid = getuid(); if (gid) *gid = getgid();
user = getenv("USER"); if (user) return CFStringCreateWithCString(NULL, user, kCFStringEncodingUTF8);
if (getpwuid_r(getuid(), &pwent, buffer, MAX_PASSENTRY_LENGTH, &pwentp)) return CFStringCreateWithCString(NULL, pwentp->pw_name, kCFStringEncodingUTF8);
return NULL;}
CFStringRef SCDynamicStoreCopyLocalHostName (SCDynamicStoreRef store){ struct utsname info;
if (uname(&info) != 0) return NULL;
return CFStringCreateWithCString(NULL, info.nodename, kCFStringEncodingUTF8);}
CFStringRef SCDynamicStoreCopyLocation (SCDynamicStoreRef store){ //LOG << "fixme: SCDynamicStoreCopyLocation() - stub" << std::endl; return NULL;}
CFDictionaryRef SCDynamicStoreCopyProxies (SCDynamicStoreRef store){ //LOG << "fixme: SCDynamicStoreCopyComputerName() - stub" << std::endl; /* No Proxy support yet */ return NULL;}