FSEvents: Provide the PID of Process That Triggered An Event
| Originator: | bdkjones | ||
| Number: | rdar://20791255 | Date Originated: | 2 May 2015 |
| Status: | Open | Resolved: | No |
| Product: | OS X | Product Version: | All |
| Classification: | Enhancement | Reproducible: | Always |
Summary: Currently, The FSEvents API does not return the process ID of the process that triggered an event. The most we can do is pass the 'kFSEventStreamCreateFlagMarkSelf' flag, which tags events caused by our own process. This is not sufficient in many cases. For example, my app watches JavaScript files and, when they are saved, processes them into minified files. My users are web developers and they rely on Git. Frequently, they will switch branches or merge/rebase in Git. This can trigger many hundreds of file-change events simultaneously and, if my app attempts to respond to them as they occur, it finds the filesystem still mutating underneath it and all sorts of bad results occur. If FSEvents allowed me to inspect the PID of the process responsible for an event, I could isolate changes caused by Git and ignore them. Currently, this is not possible. As a workaround, I have trained my users to pause my app's file-watching ability before performing Git actions. But that is hit-or-miss at best (people forget). Filling this request is not a lot of work, as the private FSEvents header (available as part of Apple's open source disclosures) makes it clear that the process ID is already being recorded; it's just not exposed as part of the public API. It would be amazing if we could change that. Steps to Reproduce: N/A Expected Results: The FSEvents API should provide the PID of the process that triggered an event. Actual Results: The FSEvents API does not currently provide a way to determine which process triggered an event. Version: All. Notes: Configuration: All configurations; all versions of OS X.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!