Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: compaudit allows owner of executable
On Wed, Jan 30, 2013 at 09:11:48PM +0000, Peter Stephenson wrote:
> I couldn't think of a reasonably safe, standard way of finding out who
> owns the executable, however. So I've done it using the /proc file
> system. I've also assumed zstat is available from zsh/stat.
> Suggestions for improvements welcome.
On Solaris, the path would be /proc/$$/object/a.out. From the code, I
think that'll work as far back as Solaris 2.6, but I don't have any old
machines to verify that on.
Solaris also has a "getexecname()" library call, also introduced in 2.6,
but that would require writing C code, and making it available from shell
code, which seems like it's more work (if slightly more stable an
interface). There also are ways to get this information on Solaris with
dlinfo(), which may be more portable on other systems than getexecname().
http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe
has more, if you hadn't already gone looking.
Danek
Messages sorted by:
Reverse Date,
Date,
Thread,
Author