Post

Replies

Boosts

Views

Activity

Reply to Endpoint Security Framework and signals
I was very curious why I'd never seen eslogger and it turns out it's because it was introduced more recently than my older systems. πŸ˜„ Confirmed that it shows the expected behavior on one machine, so I'll be poking at it. At least I know that it does show SIGKILL actions. Although I guess that's notification, not authorization...
1w
Reply to SwiftUI and dragging a file onto the app icon
So it does help to drag the file to the right icon... (since I was debugging it under Xcode, but had the "real" one in my dock). That seems to do it better, but weirdly, it's not happening the first time I drag a file onto the icon. Also, I have this in the main view: .handlesExternalEvents(preferring: ["my-scheme"], allowing: ["my-scheme"]) // activate existing window if exists .onOpenURL { url in // stuff } and both the .openURL and the app delegate method are being triggered. I think this is probably due to confusion on my part, though.
3w
Reply to task_for_pid error 5
Don't need it, obviously! (Of possible interest, though, I'm only interested in finding out information about our own processes, so I assume there's a way to get a task handle for those, even if it involves setting up some XPC between them.)
Nov ’24
Reply to task_for_pid error 5
Sorry to hijack, but that didn't work for me. I'm trying a command-line utility, doing: static size_t get_thread_count(pid_t pid) { mach_port_t me = mach_task_self(); mach_port_t task; kern_return_t res; thread_array_t threads; mach_msg_type_number_t n_threads; res = task_for_pid(me, pid, &task); if (res != KERN_SUCCESS) { fprintf(stderr, "Unable to get task for pid %d: %d\n", pid, res); return 0; } res = task_threads(task, &threads, &n_threads); if (res != KERN_SUCCESS) { fprintf(stderr, "Could not get threads: %d\n", res); return 0; } res = vm_deallocate(me, (vm_address_t)threads, n_threads * sizeof(*threads)); // Ignore error return n_threads; }``` and using an entitlements plist of and using codesign --sign - --entitlements ./ent.plist --deep ./t3 --force to get it in there, but it fails with error 5. (Even when run as root. πŸ˜„) This could be how I'm codesigning it, of course; I was just doing a simple CLI tool test first.
Nov ’24
Reply to More DispatchIO problems -- cleanup handler isn't called
I didn't really solve it -- it's a hacky work-around. When I call dio?.close()... it should close. It doesn't. And because it's busy doing one byte of I/O at a time, there was pending data; I had to change it to close it after a delay (0.5 seconds). I don't know what amount the other side is sending. My read-length is 1024 (this is my go-to length when I'm reading from a network), my sample case is 18 bytes in my unit test, it's written all at once, but because of the water marks, the read handler is called 18 times. Well, 19 because of the delayed .close(flags: .stop). If I set the water-marks to something other than 1, then it always waits until the length is available. Which doesn't work when the connection is interactive. Thus: Also, I really wish it would get the data available at once for the read, rather than 1 at a time.)
Nov ’24