Current working directory (path string) of another process without triggering a getattr() on the inode
Hi, Cheers, Jakob _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com I would like to figure out the current working directories of other running processes. I have been looking at libproc, and proc_pidinfo with PROC_PIDVNODEPATHINFO almost does what I need. The problem is that it not only returns the path string but also a struct stat of the corresponding file system entry. In my use case this approach results in a dead lock. I run the code from inside a fuse file system in order to figure out the current working directories that reside on that very fuse filesystem. In order to avoid a race with newly spawned processes or processes changing their working directory, the fuse module blocks all VFS callbacks prior to enumerating the current working directories. I was also hoping that sysctl with KERN_VNODE might help but this functionally has been removed from newer XNU kernels. Would there be another, block-free way of enumerating the paths of the current working directories? Ideally, I'm looking for something that works like a readlink on /proc/PID/cwd under Linux.
participants (1)
-
Jakob Blomer