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

Posts under Core OS subtopic

Post

Replies

Boosts

Views

Activity

Request for Rosetta: support optionally faster x87 emulation (via some env variable similar to AVX) like Rosettax87 project..
Hi, Since recently there is interest in having faster x87 translation speeds than Rosetta offers.. mainly some old PC games getting stuck at less than 5fps using Wine that uses Rosetta..( some world of warcraft game for ex.).. so main case right now, is games using old fmodex library versions (dll or statically)that uses heavy x87 instructions for audio processing , and such games not being threaded ,stalls the render threead, which is the same thread.. Luckily there is a hack, see: https://github.com/Lifeisawful/rosettax87 ”This is an experimental project that modifies Apple's Rosetta technology to use less precise but significantly faster x87 instruction handlers. The benchmarks show approximately 4-5x performance improvement for x87 floating-point operations.” but limitations are: 1)it runs only on specific Mac version (15.4.1) due to searching some fixed offsets in current rosetta library that may change with mac updates.. 2)requires to run two binaries (a server and the launcher program).. 3)currently doesn’t seem to accelerating x87 instruction on Linux programs/binaries i.e. lacking support for Rosetta on Linux if Apple supports similar technology, it could providing some enviroment variable like ROSETTA_FAST_X87 for enabling/disabling this fast emulation similar to how Rosetta AVX support not enabled by default.. thanks..
3
0
164
Apr ’25
Is it possible to use the Matter.xcframework without using the MatterSupport extension for onboarding a device to our ecosystem?
Is it possible to use the Matter.xcframework without the MatterSupport extension for onboarding a Matter device to our own ecosystem(own OTBR and matter controller) for an official App Store release? Currently, we can achieve this in developer mode by adding the Bluetooth Central Matter Client Developer mode profile (as outlined here https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/darwin.md). For an official release, what entitlements or capabilities do we need to request approval from Apple to replace the Bluetooth Central Matter Client Developer mode profile? Thank you for your assistance.
1
2
74
Apr ’25
why can a dylib missing dependency still be loaded?
good.load_commands.txt I bad.load_commands.txt have two dylibs built with different parameters on different machines. Both have the same dependency(@rpath/libc++.dylib). When @rpath/libc++.dylib is missing, one of them can still be laoded via dlopen with RTLD_NOW, and I want to understand why. Additional infomation: Both dylibs are the same architecture(arm64) They had identical LC_RPATH settings. But I've removed them via install_name_tool just to simplify the problem. Through otool -l to view load commands, I can't find any differnent between them except they had different libSystem.B.dylib version. And then,I through setting DYLD_PRINT_SEARCHING=1 and load them. I found differenes in their dependency search processes, but' I'm unsure what causes this discrepancy. these are outputs: ./a.out libchrome_zlib.dylib.good dyld[37001]: find path "/usr/lib/libc++.1.dylib" dyld[37001]: possible path(original path on disk): "/usr/lib/libc++.1.dylib" dyld[37001]: possible path(cryptex prefix): "/System/Volumes/Preboot/Cryptexes/OS/usr/lib/libc++.1.dylib" dyld[37001]: possible path(original path): "/usr/lib/libc++.1.dylib" dyld[37001]: found: dylib-from-cache: (0x000A) "/usr/lib/libc++.1.dylib" dyld[37001]: find path "/usr/lib/libSystem.B.dylib" dyld[37001]: possible path(original path on disk): "/usr/lib/libSystem.B.dylib" dyld[37001]: possible path(cryptex prefix): "/System/Volumes/Preboot/Cryptexes/OS/usr/lib/libSystem.B.dylib" dyld[37001]: possible path(original path): "/usr/lib/libSystem.B.dylib" dyld[37001]: found: dylib-from-cache: (0x00AB) "/usr/lib/libSystem.B.dylib" dyld[37001]: find path "libchrome_zlib.dylib.good" dyld[37001]: possible path(original path on disk): "libchrome_zlib.dylib.good" dyld[37001]: found: dylib-from-disk: "libchrome_zlib.dylib.good" dyld[37001]: find path "@rpath/libc++.dylib" dyld[37001]: possible path(default fallback): "/usr/local/lib/libc++.dylib" dyld[37001]: possible path(default fallback): "/usr/lib/libc++.dylib" dyld[37001]: found: dylib-from-cache: (0x000A) "/usr/lib/libc++.dylib" ./a.out libchrome_zlib.dylib.bad dyld[41256]: find path "/usr/lib/libc++.1.dylib" dyld[41256]: possible path(original path on disk): "/usr/lib/libc++.1.dylib" dyld[41256]: possible path(cryptex prefix): "/System/Volumes/Preboot/Cryptexes/OS/usr/lib/libc++.1.dylib" dyld[41256]: possible path(original path): "/usr/lib/libc++.1.dylib" dyld[41256]: found: dylib-from-cache: (0x000A) "/usr/lib/libc++.1.dylib" dyld[41256]: find path "/usr/lib/libSystem.B.dylib" dyld[41256]: possible path(original path on disk): "/usr/lib/libSystem.B.dylib" dyld[41256]: possible path(cryptex prefix): "/System/Volumes/Preboot/Cryptexes/OS/usr/lib/libSystem.B.dylib" dyld[41256]: possible path(original path): "/usr/lib/libSystem.B.dylib" dyld[41256]: found: dylib-from-cache: (0x00AB) "/usr/lib/libSystem.B.dylib" dyld[41256]: find path "libchrome_zlib.dylib.bad" dyld[41256]: possible path(original path on disk): "libchrome_zlib.dylib.bad" dyld[41256]: found: dylib-from-disk: "libchrome_zlib.dylib.bad" dyld[41256]: find path "@rpath/libc++.dylib" dyld[41256]: not found: "@rpath/libc++.dylib" dlopen failed: dlopen(libchrome_zlib.dylib.bad, 0x0002): Library not loaded: @rpath/libc++.dylib Referenced from: <42E93041-7B58-365B-9967-04AE754AA9F0> /Users/jiangzh/dlopen/libchrome_zlib.dylib.bad Reason: no LC_RPATH's found
2
0
125
Apr ’25
Is it possible for iOS to continue BLE scanning even when the app goes into the background?
Nice to meet you, I'm currently trying to create an app like a data logger using BLE. When a user uses the above app, they will probably put the app in the background and lock their iPhone if they want to collect data for a long period of time. Therefore, the app I want to create needs to continue scanning for BLE even when it goes into the background. The purpose is to continue to obtain data from the same device at precise time intervals for a long period of time (24 hours). In that case, can I use the above function to continue to read and record advertising data from the same device periodically (at intervals of 10 seconds, 1 minute, or 5 minutes) after the app goes into the background? Any advice, no matter how small, is welcome. Please feel free to reply. Also, if you have the same question in this forum and it has already been answered, I would appreciate it if you could let me know.
3
0
161
Apr ’25
Missing /usr/lib/libc++.1.dylib
I'm trying to run a simple C++ script, but for some reason I keep getting an error. Where /usr/lib/libc++.1.dylib cannot be found. Specifically, dyld[2012]: dyld cache '(null)' not loaded: syscall to map cache into shared region failed dyld[2012]: Library not loaded: /usr/lib/libc++.1.dylib Reason: tried: '/usr/lib/libc++.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/libc++.1.dylib' (no such file), '/usr/lib/libc++.1.dylib' (no such file, no dyld cache) I tried reinstalling Xcode with no success. Can I get some help?
1
0
139
Apr ’25
How to prevent holes from being created by cluster_write() in files
A filesystem of my own making exibits the following undesirable behaviour. ClientA % echo line1 >>echo.txt % od -Ax -ctx1 echo.txt 0000000 l i n e 1 \n 6c 69 6e 65 31 0a 0000006 ClientB % od -Ax -ctx1 echo.txt 0000000 l i n e 1 \n 6c 69 6e 65 31 0a 0000006 % echo line2 >>echo.txt % od -Ax -ctx1 echo.txt 0000000 l i n e 1 \n l i n e 2 \n 6c 69 6e 65 31 0a 6c 69 6e 65 32 0a 000000c ClientA % od -Ax -ctx1 echo.txt 0000000 l i n e 1 \n l i n e 2 \n 6c 69 6e 65 31 0a 6c 69 6e 65 32 0a 000000c % echo line3 >>echo.txt ClientB % echo line4 >>echo.txt ClientA % echo line5 >>echo.txt ClientB % od -Ax -ctx1 echo.txt 0000000 l i n e 1 \n l i n e 2 \n l i n e 6c 69 6e 65 31 0a 6c 69 6e 65 32 0a 6c 69 6e 65 0000010 3 \n l i n e 4 \n \0 \0 \0 \0 \0 \0 33 0a 6c 69 6e 65 34 0a 00 00 00 00 00 00 000001e ClientA % od -Ax -ctx1 echo.txt 0000000 l i n e 1 \n l i n e 2 \n l i n e 6c 69 6e 65 31 0a 6c 69 6e 65 32 0a 6c 69 6e 65 0000010 3 \n \0 \0 \0 \0 \0 \0 l i n e 5 \n 33 0a 00 00 00 00 00 00 6c 69 6e 65 35 0a 000001e ClientB % od -Ax -ctx1 echo.txt 0000000 l i n e 1 \n l i n e 2 \n l i n e 6c 69 6e 65 31 0a 6c 69 6e 65 32 0a 6c 69 6e 65 0000010 3 \n \0 \0 \0 \0 \0 \0 l i n e 5 \n 33 0a 00 00 00 00 00 00 6c 69 6e 65 35 0a 000001e The first write on clientA is done via the following call chain: vnop_write()->vnop_close()->cluster_push_err()->vnop_blockmap()->vnop_strategy() The first write on clientB first does a read, which is expected: vnop_write()->cluster_write()->vnop_blockmap()->vnop_strategy()->myfs_read() Followed by a write: vnop_write()->vnop_close()->cluster_push_err()->vnop_blockmap()->vnop_strategy() The final write on clientA calls cluster_write(), which doesn't do that initial read before doing a write. I believe it is this write that introduces the hole. What I don't understand is why this happens and how this may be prevented. Any pointers on how to combat this would be much appreciated.
2
0
115
Apr ’25
Failed to create folder using Swift in VisionOS
When creating a folder in the code, it prompts that the file creation is successful, but when the folder does not exist in the "Download Container" file, do you have any permissions when creating the folder in VisionOS? static func getFileManager() -&gt; URL { let documentsDirectory = FileManager.default.urls( for: .documentDirectory, in: .userDomainMask ).first! return documentsDirectory.appendingPathComponent("SGKJ_LIBRARY") } static func createFileLibrary() { let folderUrl = getFileManager() let fileManager = FileManager.default do { try fileManager.createDirectory( at: folderUrl, withIntermediateDirectories: true, attributes: nil ) print("Folder created successfully: \(folderUrl.path)") } catch { print("Failed to create folder: \(error.localizedDescription)") } }
1
0
52
Apr ’25
Storing logs from application written in Swift visible on real device
I folks, I have an application that is already available in production and I would like to store some logs to the app, so that on real device I will see outputs for better tracing. iOS13 would be fine, but I can migrate it into e.g. iOS 14. The next question is where to find logs on real devices, so that users can send me for tracing. Thanks Petr
1
0
54
Apr ’25
What does VZError code=12 mean when restoring VM state?
Hi, I'm trying save and restore features of VZ Framework with saveMachineStateTo and restoreMachineStateFrom(vzvmsaveFilePath) with completionHandler. Saving feature works well without any errors, .vzvmsave file created on my local mac, but the problem occurs on restore. After creating VM with the same volume mounts I used to make .vzvmsave, restoreMachineStateFrom method sends error. Failed to load VM from .vzvmsave file with Error Domain=VZErrorDomain Code=12 UserInfo={NSLocalizedFailure=<private>, NSLocalizedFailureReason=<private>} Because Localized Failure and its reason are both 'private', I cannot get what exactly happened to this VM app. Only thing I know here is the Code of VZError but nobody summarized what exactly the error code means. Could anyone give me the list of VZError code list please?
6
0
116
Apr ’25
unable to set gid for user root
Hi, I am using a compile version of binay file on MacOS 15.1 I run it as one user and try to become another user The binary is working on other Linux distrvtuions, but not in MacOS, it have setuid + setgid and the owner of the binary is root [ri-mac02:~] dvcm% ls -l /dv/sbtools/mca64/bin/wscho -rwsr-sr-x 1 root wheel 51826 Apr 7 12:47 /dv/sbtools/mca64/bin/wscho When running it failed on the following error: ri-mac02:~] dvcm% /dv/sbtools/mca64/bin/wscho alexr /dv/p4pusers05ri/alexr/alexr_ri_agile /dv/sbtools/mca64/bin/wscho: unable to set gid for user root [0] (Operation not permitted) Please help to address it Thanks, Amir
4
0
39
Apr ’25
Is that possible to allocate virtual memory space between 0~4GB?
I tried to use the following code to get a virtual address within 4GB memory space int size = 4 * 1024; int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT; void* addr = mmap(NULL, size, PROT_READ | PROT_WRITE, flags, -1, 0); I also tried MAP_FIXED and pass an address for the first argument of mmap. However neither of them can get what I want. Is there a way to get a virtual memory address within 4GB on arm64 on MacOS?
1
0
46
Apr ’25
What's the non-sandboxed path to Downloads folder on the iPhone
I'm trying to construct a URL that, when tapped, would launch Files app and open the Downloads folder on the iPhone (not in iCloud Drive). I know the URL scheme is shareddocuments but I can't figure out the path. I have tried a few things including writing a simple iOS app and using Scriptable app. But I always get a sandboxed path such as /private/var/mobile/Containers/Data/Application/87CC2F48-AF1C-4C80-8D75-B6CC1FC642E3/Downloads/. But that wouldn't work across devices. Does anyone happen to know the path or a method to obtain the non-sandboxed path? Thanks. PS I already figured out the Downloads folder in iCloud Drive, which is shareddocuments:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/Downloads. But what I need is the one on the iPhone.
1
0
68
Apr ’25
PushToTalk Microphone Permission Issues After Force Quit
Hello Apple Developer Community, We're implementing the PushToTalk framework as recommended. According to Apple engineers in previous forum responses : the framework allows your app to continue receiving push notifications even after your app is terminated or the device is rebooted. Implementation: We've properly implemented: Early initialization of PTChannelManager via channelManager(delegate:restorationDelegate:completionHandler:) Channel joining with requestJoinChannel(channelUUID:descriptor:) when foregrounded All required delegate methods Issue After a user force quits our app, PushToTalk functionality works briefly but fails after some time (minutes to hours). The system logs show: AudioSessionServerImpCommon.mm:105 { "action":"cm_session_begin_interruption", "error":"translating CM session error", "session":{"ID":"0x72289","name":"getcha(2958)"}, "details":{ "calling_line":997, "error_code":-12988, "error_string":"Missing entitlement" } } We suspect that entitlement after force-quitting the app, there's a permission cache that temporarily allows functionality, but once this cache is cleared, the features stop working. Without this entitlement, both audio playback and recording fail, completely breaking the PTT functionality. Questions Which specific entitlement is missing according to this error? Is there a permission caching mechanism that expires after force quit? How can we ensure reliable PTT operation after force quit as stated in documentation? This behavior contradicts Apple's guidance that PushToTalk should work reliably after termination. Any insights would be greatly appreciated. Thank you!
4
0
118
Apr ’25
SecStaticCodeCreateWithPath failed with Operation not permitted error
We have a launch daemon which can check for team identifier and some other signing information of any application on machine and match it with provided information to confirm the validity of the application/binary. We use SecStaticCodeCreateWithPath to read the signing information of the app/binary which works in most cases. However, for some third party daemon processes, the static code creation fails with error "Operation not permitted". We are having difficult time identifying why static code creation would fail specially when our process is running with root privileges. Can you please help us understand in what scenario can this API fail with this error? Can there be any process or rule which can deny creating static code of a process like endpoint security extensions/daemon? We are using default flags in SecStaticCodeCreateWithPath.
7
1
121
Apr ’25
Best way to pass a HomeKit or Matter setup code to the Home App Programatically
Apologies in advance for the long post. I'm new to HomeKit and Matter but not to development, I'm trying to write a SwiftUI app for my smart home to store all of my HomeKit and Matter setup barcodes along with other bits of information. The intention is to scan the QR codes with my App and then save that QR payload in a simple Database along with other manually entered device details. Example payloads: X-HM://00GWIN0B5PHPG <-- Eufy V120 HomeKit Camera MT:GE.01-C-03FOPP6B110 <-- Moes GU10 Matter Bulb I have it 99% working, my app is even able to discern the manual pairing code from the above payloads. However one of the key feature of this is that I want to open a device entry in my app and tap the HomeKit or Matter code displayed in my app and and either: a) Ideally pass it off to the Apple Home app to initiate pairing just like the native Camera App can. b) Create a custom flow in my app using the HomeKit or Matter API's to initiate paring from within my app. So ideally just like the flow that happens when you scan a setup QR with the normal camera and tap "Open in Home". However I want to trigger this flow with just knowing the Payload and not with scanning it via the camera. I was hoping there might be something as simple as a URL scheme that I could call with the payload as a variable and it then deep links and switches to the Home app, but I haven't found any info relating to this that actually works. This is some code I have tried with the HomeKit API but this also results in an error: import HomeKit func startHomePairing(with setupCode: String) { // Handle HomeKit setup guard let payload = HMAccessorySetupPayload(url: URL(string: setupCode)!) else { print("Invalid HomeKit setup code or format.") return } let setupRequest = HMAccessorySetupRequest() setupRequest.payload = payload let setupManager = HMAccessorySetupManager() // Perform the setup request and handle the result setupManager.performAccessorySetup(using: setupRequest) { result, error in if let error = error { // Error handling: print the error details print("Error starting setup: \(error.localizedDescription)") // Print more details for debugging print("Full Error: \(error)") } else { // Success: pairing was successful print("Successfully launched Home app for HomeKit setup.") } } } But when passing in the QR payloads above it give the following .. HomeKit Code [0CAB3B05] Failed to perform accessory setup using request: Error Domain=HMErrorDomain Code=17 "(null)" Matter Code Failed to create HMSetupAccessoryPayload from setup payload URL MT:GE.01-C-03FOPP6B110: Error Domain=HMErrorDomain Code=3 "(null)" I have added the "HomeKit" and "Matter Allow Setup Payload" capabilities to my app, I have also ensured I have these in the .plist .. <key>NSHomeKitUsageDescription</key> <string>Access required to HomeKit to initiate pairing for new accessories</string> I also added a call to ensure my app appears in the Settings / Privacy / HomeKit section. I originally thought was a seemingly simple task, but I am really struggling with how to make it work!
4
0
110
Apr ’25
Matter commissioning issue with Matter support extension
My team has developed an app with a Matter commissioner feature (for own ecosystem) using the Matter framework on the MatterSupport extension. Recently, we've noticed that commissioning Matter devices with the MatterSupport extension has become very unstable. Occasionally, the HomeUIService stops the flow after commissioning to the first fabric successfully, displaying the error: "Failed to perform Matter device setup: Error Domain=HMErrorDomain Code=2." (normally, it should send open commissioning window to the device and then add the device to the 2nd fabric). The issue is never seen before until recently few weeks and there is no code changes in the app. We are suspected that there is some data that fail to download from the icloud or apple account that cause this problem. For evaluation, we tried removing the HomeSupport extension and run the Matter framework directly in developer mode, this issue disappears, and commissioning works without any problems.
12
0
301
Apr ’25
Detect if a file or folder is synced by cloud providers (Google Drive, iCloud, OneDrive, Dropbox, etc.) in iOS (all versions)
Hi all, I’m building an iOS app where I need to determine user picked files or folders using UIDocumentPickerViewController, whether the selected item is synced or managed by a cloud storage provider such as: Google Drive iCloud Drive OneDrive Dropbox or any third-party File Provider extension My intent is to detect this and optionally warn the user that the item may be subject to syncing behavior. So far, I’ve tried a few different approaches: Extended Attributes (listxattr / getxattr) While this does not give reliable outcome. Heuristically search for keywords like 'Drive', 'GoogleDrive' etc But this is also not reliable. Question Is there any possible reliable and documented way to detect programmatically if a file/folder is cloud-synced or managed by a File Provider from within a regular iOS app (not an extension), especially for: Google Drive OneDrive Dropbox iCloud Other third-party providers? Also, is there any recommended fallback strategy for iOS versions prior to 17 where NSFileProviderManager may have limitations? Any input from Apple engineers or those who have tackled this would be hugely appreciated! Thanks in advance 🙌
1
0
89
Apr ’25
Resize disk image with hdiutil in sandbox environment
I am using macOS virtualization farmework and able to create nad and run VMS. I need to resize the disk images using hdiutil in app sandbox environment. Is that possible? i tried disabling sandbox and it worked ok. But with sandbox i get the error message device is not configured. If this cant be done in sandbox what could be the alternative way to to achive this in sandboxed app. thanks
6
0
74
Apr ’25