Explore the core architecture of the operating system, including the kernel, memory management, and process scheduling.

Post

Replies

Boosts

Views

Activity

Request for improved graphics support on MacOS guests (VMs)..
Hi, been exploring macOS VM on both Parallels and UTM and they lack some "GPU/graphics" things vs native MacOS which could be useful on some situations (testing some non trusted graphics apps on a Mac VM) so providing similar usefulness as Windows Sandbox.. Current limitations: 1)In MacOS VM night mode doesn't work.. 2)HDR support isn't exposed even when enabling HDR on host 3)missing GPTK support for the Paravirtual GPU (Paravitual GPU supports Metal but isn't enough for GPTK to work which complains about unsupported GPU).. 4)OpenCL is supported but only the CPU device.. so expose GPU device in addition to current CPU only device.. 5)OpenGL only supports the software renderer.. I assume OpenGL driver on Apple M1-4 GPUs being Metal based, and being Metal supported no reason for software renderer only thanks..
0
0
47
1d
SwiftUI and dragging a file onto the app icon
I'm playing around with using an app to automate some of my personal work flows, and one of the things I wanted to do was to be able to drag a .webloc file onto my app icon in the dock, to launch it. I've got public.data set up as a document type for it in Xcode, which translated to <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Viewer</string> <key>LSHandlerRank</key> <string>Default</string> <key>LSItemContentTypes</key> <array> <string>public.data</string> </array> </dict> </array> in the Info.plist for it, which seems correct. When I drag a .webloc file onto the Dock icon, it appears to be willing to accept it, but nothing seems to happen. In the app, I've got an AppDelegate.swift file which has extension Notification.Name { static let receivedURLsNotification = Notification.Name("ReceivedURLsNotification") } class AppDelegate: NSObject, NSApplicationDelegate { func application(_ application: NSApplication, open urls: [URL]) { guard !urls.isEmpty else { return } NotificationCenter.default.post(name: .receivedURLsNotification, object: nil, userInfo: ["URLs": urls]) } } (I copied it almost verbatim from a Medium post.) In the app swift file, I have @main struct LoggerApp: App, DropDelegate { @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate I set a breakpoint on application(_:NSApplication, open:[URL]), and did my drag, and the breakpoint never triggered. I added the application(didFinishLaunching(_:Notification) method, and that does get invoked when the app launches, so the app delegate does seem to be working. That seems to indicate the problem is somewhere else?
1
0
55
1d
Issue import from file to photo large amount of file
Hi, i’m doing a work. i need to transfer files (photo, raw format) from sd to iphone. On my iPad pro. i need to move photo first on file, then Import to photo. now. If i do this job for few files there is no problem. if i copy more then 300 files job is not done. when i select raw file on file app, and then click on share/ save to my photo option …. Ther‘s no progress bar, no way to conclude copy with success. At least 298 photo are imported. Whitout any error or warning. Someone do the trick? can be possible to copy from file to file or import from file to photo with a progress bar display? it’s very very strange that the basic is turned off. please help me. thank you very much in advance.
0
0
41
1d
SSO extension and NFC tag
Hi, We are developing an Enterprise SSO extension for use by our customers. It is working well for username/password. We would like to use external security tokens such as Yubikey, via NFC. This works well inside the container app. However, it looks like NFC might not be available to the SSO extension? The container app is signed with an NFC entitlement, and has the relevant key in the plist for a prompt to show the user. We use a 3rd party package called Yubikit to communicate with the Yubikey in the container app... all good. In the trial I did, I had the SSO appex configured as a Credential extension. I have a demo/sample host app that uses this service, that mirrors what our customer's apps will do. Currently, due to limitations in the server we are connecting to, instead of relying on a 401 authentication challenge, I am "manually" activating the enterprise SSO credential appex using ASAuthorizationSingleSignOnProvider, then our customer's host app will use the token the SSO appex returns for authenticating its API calls. This is working perfectly for the username/password scenario. However some of our customers are very security conscious and require hardware tokens. When I drive the same code in the contained SSO Enterprise app extension, and attempt to activate the NFC reader the same way, it seems like it doesn't have access to NFC? I attempted to add the entitlement to the appex as well but it wasn't even available on the list of entitlements! This leads me to suspect that iOS doesn't allow the SSO appex process to have access to the NFC reader, and there's no way to do what I'm attempting? Note: it is easy for us to move to using a Redirect extension instead if this is the answer, but it doesn't seem that it's likely to help? What is the recommended approach here? Regards, Carl
0
0
44
1d
Any API for AirPods Pro 2
Hi, May I ask if there is any iOS API or similar way to switch between the transparency and ANC modes of AirPods Pro 2? I know there is one way to configure and activate the shortcut in the APP, which requires an inconvenient manual setting. May I ask for any other advice? Thx in advance!
0
0
21
1d
API to switch the mode of Airpods Pro 2
Hi, May I ask if there is any API or similar way inside the iOS app to set up/switch the transparency and ANC modes of the AirPods Pro 2? One way is to set up one shortcut and activate that shortcut in the app, but it requires manually setting for a shortcut, which is not convenient. Thx for any advice on that!
0
0
17
1d
Apple Watch Modular Ultra issue for YEARS!
Hi. I’m not sure where to post it, but after 1.5 years with the AWU2 the main Watch face is still bugged, missing seconds (two digit) in format. In the attached example it shows “06:30:5” for 10 seconds until it hits ”06:31:00”. I’m not sure if it’s only related to Danish AWU’s. But it is so annoying, and has forced me to change watch to Garmin in the past. PLEASE FIX IT, please please.
0
0
24
1d
2 Requests for Rosetta: support BMI1/2 and F16C and support also AVX1/2 on Rosetta Linux..
Hi, REQUEST 1: seems Microsoft is ahead of Apple in X86 ARM emulation support at least in features supported.. see: https://blogs.windows.com/windows-insider/2024/11/06/announcing-windows-11-insider-preview-build-27744-canary-channel/ x64 emulated applications through Prism will now have support for additional extensions to the x86 instruction set architecture. These extensions include AVX and AVX2, as well as BMI, FMA, F16C BMI1/2 and F16C aren't yet supported by Rosetta.. would be useful for games like Alan Wake 2.. so asking for Rosetta equaling features to Prism emulator.. REQUEST 2: there is no way to currently enable AVX1/2 on Rosetta Linux.. on macOS using export ROSETTA_ADVERTISE_AVX=1 does the trick.. but not on Linux VM's.. tested setting this via: /bin/launchctl setenv ROSETTA_ADVERTISE_AVX 1 on Mac before VM launch and inside Linux VM but AVX2 isn't exposed..
0
1
109
3d
App intermittently disappearing after installation
We're build a pkg with three apps in it from the command line. There is one primary app and two supporting apps. We build a folder structure inside a temp directory like below (some folder names replaced with generic ones): mkdir -p ./tmp/Applications/.hiddenfolder/ mkdir -p ./tmp/Library/Application\ Support/Company/ mkdir -p ./tmp/Library/Preferences/ mkdir -p ./tmp/Library/Logs/Company/ mkdir -p ./tmp/Library/LaunchAgents/ mkdir -p ./tmp/Library/Company/ mkdir -p ./tmp/Library/LaunchDaemons/ #Grant Logs Folder Read-Write Access to All chmod a+rw ./tmp/Library/Logs/Company/ chmod a+rw ./tmp/Library/Application\ Support/Company/ We then build and sign each app dependency and place them into the temporary folder. For each app we're calling: xcodebuild -workspace "$PROJECT" -scheme "$TARGET" -configuration Release -derivedDataPath "$WORKING" clean build codesign --force --deep -o runtime --entitlements "../$TARGET/$APPLICATION.entitlements" --sign "$DEVKEY" "$WORKING/Build/Products/Release/$APPLICATION.app" cp -R "$WORKING/Build/Products/Release/$APPLICATION.app" "$DESTINATION" The primary app is copied into ./tmp/Applications/.hiddenfolder/ . The other two apps are put in ./tmp/Library/Company/ and ./tmp/Applications/ We then create the component list, build, and notarize the final pkg using the script below: Some definitions of the variables used below: IDENTIFIER=com.company.pkg.app1 (not real id but an example) ROOT=./tmp SCRIPTS=./scripts GUI=./pkggui pkgbuild --analyze --identifier "$IDENTIFIER" --version "$VERSION" --root "$ROOT" --scripts "$SCRIPTS" "$NAME-tmp.plist" /usr/libexec/PlistBuddy -c "SET 0:BundleIsRelocatable NO" "$NAME-tmp.plist" /usr/libexec/PlistBuddy -c "SET 1:BundleIsRelocatable NO" "$NAME-tmp.plist" /usr/libexec/PlistBuddy -c "SET 2:BundleIsRelocatable NO" "$NAME-tmp.plist" pkgbuild --identifier "$IDENTIFIER" --version "$PKGVERSION" --root "$ROOT" --scripts "$SCRIPTS" --component-plist "$NAME-tmp.plist" "$NAME-tmp.pkg" productbuild --synthesize --package "$NAME-tmp.pkg" distribution.xml sed -i "" \ -e '$ i\ \ <title>App1</title>' \ -e '$ i\ \ <background file="background.icns" alignment="bottomleft" scaling="proportional" />' \ -e '$ i\ \ <welcome file="welcome.txt" />' \ -e '$ i\ \ <installation-check script="InstallationCheck()"/> \ <script> \ function InstallationCheck(prefix) { \ if (system.compareVersions(system.version.ProductVersion, '12.0') &lt; 0) { \ my.result.message = "This update requires OS X version 12.0 or later."; \ my.result.type = "Fatal"; \ return false; \ } \ return true; \ } \ </script>' \ "distribution.xml" productbuild --distribution distribution.xml --resources "$GUI" --package-path "./$NAME-tmp.pkg" --sign "$DEVKEY" "$NAME.pkg" Once built and notarized this pkg becomes the base for the installers we give to customers. For each customer we have some custom parameters we set in a plist file inside the pkg, which requires us to expand the pkg out, add the plist file to /Library/Preferences/ in the expanded pkg, and then flattent/re-notarize the edited pkg. What we're running into is that the primary app (App1 above) will intermittently disappear after installation. We check all of the files we lay down in the postinstall script, and usually it detects the app in the correct location (/Applications/.hiddenfolder/), so it appears that it is correctly laying the files down but something is removing the app after installation. A couple of times the postinstall script has detected that the app is not in the correct place and fails, but usually the install will finish and only the other two apps remain. So far we've found no logs or evidence of it being moved or deleted; it just ceases to exist after installation. Has anyone else had this issue and found a solution?
0
0
87
3d
Help Needed with Saving Geofence Events Offline (UserDefaults/Core Data)
Hi everyone, I've implemented geofencing in my app, and it works well when the device is connected to the internet. The app successfully triggers region entry and exit events, even when it's in a terminated state, and sends the details to the server. However, I'm facing an issue with offline functionality. I attempted to cache geofence events (region entry/exit) when the device is offline and send them to the server once the device comes back online. I’ve tried using both UserDefaults and Core Data for caching these events, but the offline events are not being stored or processed correctly. Here’s the code that triggers the region events: func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) { if let region = region as? CLCircularRegion { handleRegionEvent(region: region, eventType: "enter") } } func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) { if let region = region as? CLCircularRegion { handleRegionEvent(region: region, eventType: "exit") } } The region entry/exit triggers correctly, and I even receive notifications. However, nothing is being saved to storage. To cache events, I'm using this method: private func cacheEvent(_ event: GeofenceEvent) { var cachedEvents = getCachedEvents() cachedEvents.append(event) if let encoded = try? JSONEncoder().encode(cachedEvents) { UserDefaults.standard.set(encoded, forKey: cachedEventsKey) } } For UserDefaults, we've added the app group and suite name, but it's still not working as expected. Has anyone encountered similar issues or have any suggestions on how to reliably cache and sync geofence events during offline scenarios? Any help would be greatly appreciated!
0
0
55
4d
SIGFPE not raised when dividing by zero
I have an app whose logic is in C++ and rest of the parts (UI) are in Swift and SwiftUI. When an exception is raised by some C++ code, I'm using the Linux signal handler mechanism to trap it. From my previous post, I understand that fatal exceptions like SIGSEGV, SIGBUS, SIGFPE etc., there's nothing much that can be done by the process. My only intent for using a signal handler is to log something, so that it becomes easy to fix during development. Ofc, even that logging can fail, based on the severity of the exception, but that's okay... make an attempt to log - if it works, great, else the process can terminate. I'm registering for SIGSEGV and SIGFPE with the following code // ExceptionHandlingCpp.hpp file struct tSignals { SignalHandlerFunc signalHandlerFunc; uint32_t signal; [[maybe_unused]] uint8_t reserved[4]; }; // ExceptionHandlingCpp.cpp file tSignals ExceptionHandlingCpp::unixSignals[] = { {HandleSignals, SIGFPE, {0}}, {HandleSignals, SIGSEGV, {0}}, {HandleSignals, SIGKILL, {0}}, }; std::string ExceptionHandlingCpp::signalToString(int signal) { switch(signal) { case SIGFPE: return "SIGFPE"; case SIGSEGV: return "SIGSEGV"; case SIGKILL: return "SIGKILL"; default: return "Unknown signal"; } } void ExceptionHandlingCpp::RegisterSignals() { LOG("ExceptionHandlingCpp::RegisterSignals()"); struct sigaction sa; sa.sa_flags = SA_SIGINFO; for(int i = 0; i &lt; sizeof(unixSignals)/sizeof(tSignals); ++i) { sa.sa_sigaction = unixSignals[i].signalHandlerFunc; if(sigaction(unixSignals[i].signal, &amp;sa, nullptr) == 1) { LOG("Failed to set " + signalToString(unixSignals[i].signal) + "'s signal handler!"); } else { LOG(signalToString(unixSignals[i].signal) + "'s signal handler set sucessfully!"); } } } In my signal handler (HandleSignals method), immediately after trapping a signal, I log something and set the default handler... This breaks out of the loop that occurs when returning from the signal handler. // ExceptionHandlingCpp.cpp void ExceptionHandlingCpp::HandleSignals(int pSignal, siginfo_t *pInfo, void *pContext) { LOG("ExceptionHandlingCpp::HandleSignals(int, signinfo_t*, void*)"); LOG("signal = " + signalToString(pSignal)); UnregisterSignals(pSignal); LOG("Returning from exception handler..."); } void ExceptionHandlingCpp::UnregisterSignals(int pSignal) { LOG("UnregisterSignals(int)"); struct sigaction defaultAction {}; defaultAction.sa_handler = SIG_DFL; if(sigaction(pSignal, &amp;defaultAction, nullptr) == -1) { LOG("Error in resetting action for " + signalToString(pSignal)); } else { LOG("Successfully reset " + signalToString(pSignal) + "'s action to default!"); } } When I test this code by raising SIGSEGV (as shown below), void ExceptionHandlingCpp::DereferenceNullPtr () { LOG("DereferenceNullPtr()"); int* ptr = nullptr; LOG("Raising exception..."); int value = *ptr; } everything works as expected. Signal handler is invoked, default handler is set and the process immediately quits. But when I try to raise a SIGFPE, void* ExceptionHandlingCpp::DivisionByZero ([[maybe_unused]] void* pParms) { LOG("DivisionByZero()"); int num1; int num2; int result; num1 = 5; num2 = 0; LOG("Raising exception..."); result = num1 / num2; LOG("Returning from DivisionByZero() method"); return nullptr; } my signal handler is not invoked (as shown in the logs below). The process doesn't terminate either. It seems that the flow simply 'walks over' this division by zero instruction as if nothing happened and returns from that method, which shouldn't have happened, as the process should've terminated after reaching my signal handler. RegisterSignals() SIGFPE's signal handler set sucessfully! SIGSEGV's signal handler set sucessfully! SIGKILL's signal handler set sucessfully! .... DivisionByZero() Raising exception... Returning from DivisionByZero() method .... AppDelegate.applicationWillBecomeActive(_:) AppDelegate.applicationDidBecomeActive(_:) ... // UI is displayed Why is SIGFPE not raised? What am I missing here?
3
0
96
4d
Standard C++ thread sleep timers exceed expected time on ARM based Mac Mini
When executing timing benchmarks on macOs we see a much more variable sleep time relative to Linux on arm64 or Linux on x86_64 . If we have a timing loop firing every 16ms, we frequently see timings of 20+ms. We have turned off timer coalescing using sudo /usr/sbin/sysctl -w kern.timer.coalescing_enabled=0 But we are still seeing lots of spikes in expected period as compared to Linux. Is there anything we can further do to stabilize the timing of our macOs host and improve timer performance? Are there any settings we can alter (similar to the one above) to get more accurate timing performance? Example: These are sleeps that are used with standard C++ functions like std::this_thread::sleep_until() This is measured by having a loop printing the current system time and sleeping as above for (int i = 0; i < ITERATIONS; i++) { printf("%llu\n", current_time_ns()); std::this_thread::sleep_until(std::chrono::steady_clock::now() + std::chrono::milliseconds(16)) } The same code was compiled for arm64 macOS arm64 Linux x86_x64 Linux And was found to be far more variable in the macOS arm64 case.
2
0
84
5d
Unable to Create Files Adjacent to User-Selected File Due to App Sandbox Permissions
I am developing a macOS app that requires the ability to create new files in the same directory as a user-selected file, but I am encountering permission issues due to the App Sandbox restrictions. While the user can select a file (e.g., a.jpg) using a standard open panel, I cannot create an adjacent file (e.g., a.jxl) in the same folder because the sandbox only grants access to the selected file, not to other files in the directory. I understand that full disk access might be an option, but it requires user intervention and isn't suitable for this case. Is there any way to extend access to other files in the directory (including those not selected by the user) while remaining within the App Sandbox environment?
2
0
115
5d
Memory for Apps under Vision OS
I have a Vision OS APP with memory requirement greater than 5120MB, is there any solution other than optimizing resources, dynamic loading and sub-scenarios? My Question: 1. I would like to know what is the maximum running memory of the APP under Vision OS? 2. Is it possible to modify the maximum running memory of an APP? 3. Does Vision OS provide an interface for jumping between apps?
0
0
83
5d
CoreBluetooth CBCentralManager cannot connect to discovered periphearl
I am making an app that communicates between WatchOS and MacOS. I was able to connect and discover service characteristics one night and almost succeeded in showing the bluetooth transmited data on MacOS part, before xcode could no longer install newer app to WatchOS. After I reboot my mac, calling central!.connect(peripheral) on WatchOS will attempt to connect but can't trigger the didConnect call back anymore. I've installed bluetooth packet logger and BT debugging profile, but they are not that helpful for me at least.
3
0
74
5d
copyfile causes NSPOSIXErrorDomain 12 "Cannot allocate memory" when copying symbolic link from NTFS partition
I was able to confirm with a customer of mine that calling copyfile with a source file that is a symbolic link on a NTFS partition always causes the error NSPOSIXErrorDomain 12 Cannot allocate memory They use NTFS drivers from Paragon. They tried copying a symbolic link from NTFS to both APFS and NTFS with the same result. Is this an issue with macOS, or with the NTFS driver? Copying regular files on the other hand always works. Copying manually from the Finder also seems to always work, both with regular files and symbolic links, so I'm wondering how the Finder does it. Here is the sample app that they used to reproduce the issue. The first open panel allows to select the source directory and the second one the destination directory. The variable filename holds the name of the symbolic link to be copied from the source to the destination. Apparently it's not possible to select a symbolic link directly in NSOpenPanel, as it always resolves to the linked file. @main class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ notification: Notification) { let openPanel = NSOpenPanel() openPanel.canChooseDirectories = true openPanel.canChooseFiles = false openPanel.runModal() let filename = "Modules" let source = openPanel.urls[0].appendingPathComponent(filename) openPanel.runModal() let destination = openPanel.urls[0].appendingPathComponent(filename) do { let state = copyfile_state_alloc() defer { copyfile_state_free(state) } var bsize = UInt32(16_777_216) if copyfile_state_set(state, UInt32(COPYFILE_STATE_BSIZE), &amp;bsize) != 0 { throw NSError(domain: NSPOSIXErrorDomain, code: Int(errno)) } if copyfile_state_set(state, UInt32(COPYFILE_STATE_STATUS_CB), unsafeBitCast(copyfileCallback, to: UnsafeRawPointer.self)) != 0 || copyfile_state_set(state, UInt32(COPYFILE_STATE_STATUS_CTX), unsafeBitCast(self, to: UnsafeRawPointer.self)) != 0 || copyfile(source.path, destination.path, state, copyfile_flags_t(COPYFILE_NOFOLLOW)) != 0 { throw NSError(domain: NSPOSIXErrorDomain, code: Int(errno)) } } catch { let error = error as NSError let alert = NSAlert() alert.messageText = "\(error.localizedDescription)\n\(error.domain) \(error.code)" alert.runModal() } } private let copyfileCallback: copyfile_callback_t = { what, stage, state, src, dst, ctx in if what == COPYFILE_COPY_DATA { if stage == COPYFILE_ERR { return COPYFILE_QUIT } var size: off_t = 0 copyfile_state_get(state, UInt32(COPYFILE_STATE_COPIED), &amp;size) } return COPYFILE_CONTINUE } }
1
0
124
6d