Mercurial > minori
comparison dep/animia/src/util/osx.cc @ 249:6b2441c776dd
*: merge
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 24 Jan 2024 20:18:59 -0500 |
parents | a7d0d543b334 |
children |
comparison
equal
deleted
inserted
replaced
248:cf47a8f687c0 | 249:6b2441c776dd |
---|---|
6 #include <sys/sysctl.h> | 6 #include <sys/sysctl.h> |
7 #include <libproc.h> | 7 #include <libproc.h> |
8 | 8 |
9 namespace animia::internal::osx::util { | 9 namespace animia::internal::osx::util { |
10 | 10 |
11 #ifdef HAVE_COREFOUNDATION | |
12 /* all of these LaunchServices things use *internal functions* that are subject | 11 /* all of these LaunchServices things use *internal functions* that are subject |
13 * to change. Granted, it's not very likely that these will change very much | 12 * to change. Granted, it's not very likely that these will change very much |
14 * because I'm fairly sure Apple uses them lots in their own internal code. | 13 * because I'm fairly sure Apple uses them lots in their own internal code. |
15 */ | 14 */ |
16 typedef CFTypeRef (*LSASNCreateWithPidSpec)(CFAllocatorRef, pid_t); | 15 typedef CFTypeRef (*LSASNCreateWithPidSpec)(CFAllocatorRef, pid_t); |
102 if (!CFStringGetCString(string, &result.front(), result.length(), kCFStringEncodingUTF8)) | 101 if (!CFStringGetCString(string, &result.front(), result.length(), kCFStringEncodingUTF8)) |
103 return false; | 102 return false; |
104 | 103 |
105 return true; | 104 return true; |
106 } | 105 } |
107 #endif // HAVE_COREFOUNDATION | |
108 | 106 |
109 static bool GetProcessArgs(pid_t pid, std::string& args) { | 107 static bool GetProcessArgs(pid_t pid, std::string& args) { |
110 /* sysctl shouldn't touch these, so we define them as const */ | 108 /* sysctl shouldn't touch these, so we define them as const */ |
111 const int mib[3] = {CTL_KERN, KERN_PROCARGS2, static_cast<int>(pid)}; | 109 const int mib[3] = {CTL_KERN, KERN_PROCARGS2, static_cast<int>(pid)}; |
112 const size_t mib_size = sizeof(mib)/sizeof(*mib); | 110 const size_t mib_size = sizeof(mib)/sizeof(*mib); |