-
-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathvirtualization_helper.m
More file actions
45 lines (40 loc) · 1.19 KB
/
virtualization_helper.m
File metadata and controls
45 lines (40 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// virtualization_helper.m
//
// Created by codehex.
//
#import "virtualization_helper.h"
#ifdef __arm64__
#define TARGET_ARM64 1
#else
#define TARGET_ARM64 0
#endif
NSDictionary *dumpProcessinfo()
{
NSString *osVersionString = [[NSProcessInfo processInfo] operatingSystemVersionString];
return @{
@"LLVM (Clang) Version" : @__VERSION__,
@"Target for arm64" : @TARGET_ARM64,
// The version of the macOS on which the process is executing.
@"Running OS Version" : osVersionString,
#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
@"Max Allowed OS Version" : @__MAC_OS_X_VERSION_MAX_ALLOWED,
#endif
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
@"Min Required OS Version" : @__MAC_OS_X_VERSION_MIN_REQUIRED,
#endif
};
}
NSFileHandle *newFileHandleDupFd(int fileDescriptor, void **error)
{
int dupedFd = dup(fileDescriptor);
if (dupedFd < 0) {
if (error != nil) {
*error = [NSError errorWithDomain:NSPOSIXErrorDomain
code:errno
userInfo:nil];
}
return nil;
}
return [[NSFileHandle alloc] initWithFileDescriptor:dupedFd closeOnDealloc:true];
}