Read current executable even if it's been deleted?
Read current executable even if it's been deleted?
- Subject: Read current executable even if it's been deleted?
- From: Alec Mocatta <email@hidden>
- Date: Tue, 03 Jul 2018 00:34:59 +0100
Linux has a path in the /proc filesystem – /proc/self/exe – which lets one
read the contents of ones own executable, even if it has since been deleted
or was exec'd in an atypical manner (e.g. execve("/proc/self/fd/123", ...)).
On Darwin/macOS I can use _NSGetExecutablePath() to get the path to the
current executable. The problem is this breaks in the aforementioned cases:
namely deletion/moving.
Is there a way to read the contents of ones own executable, that works in
the face of deletion/moving?
Thanks,
Alec
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden