this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at vchroot 56 lines 1.1 kB view raw
1#include "bsd.h" 2#include "service.h" 3#include <cstring> 4#include <cstdio> 5#include <sys/types.h> 6#include <dirent.h> 7#include "constants.h" 8extern "C" { 9#include <CoreFoundation/CFString.h> 10} 11 12std::string DarlingTranslateBSDName(const char* name); 13bool DarlingFindBSDName(const char* name, char* path); 14 15#if 0 16CFMutableDictionaryRef IOBSDNameMatching(void* iokitPort, unsigned int options, const char* bsdName) 17{ 18 // Search /sys/class/* for a device called bsdName 19 bsdName = DarlingTranslateBSDName(bsdName); 20 21 char path[PATH_MAX]; 22 23 if (DarlingFindBSDName(bsdName, path)) 24 return IOServiceSysPath(path); 25 else 26 return NULL; 27} 28#endif 29 30 31std::string DarlingTranslateBSDName(const char* name) 32{ 33 int num; 34 char linuxName[100]; 35 36 // Macbooks have en0 = eth0, en1 = wlan0 37 // We don't handle that yet 38 if (sscanf(name, "en%d", &num) == 1) 39 { 40 sprintf(linuxName, "eth%d", num); 41 return linuxName; 42 } 43 if (sscanf(name, "lo%d", &num) == 1) 44 { 45 return "lo"; 46 } 47 if (sscanf(name, "stf%d", &num) == 1) 48 { 49 sprintf(linuxName, "sit%d", num); 50 return linuxName; 51 } 52 53 return name; 54} 55 56