Version française
Home     About     Download     Resources     Contact us    
Browse thread
Writing to argv[0]
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dave Benjamin <dave@r...>
Subject: Re: [Caml-list] Writing to argv[0]
Savanni D'Gerinel wrote:
> One possibility is setproctitle.  It appears to be non-standard, but 
> maybe a bit more standard than overwriting argv[0].  I know it works on 
> Linux, and I see a FreeBSD man page for it.

Thanks, this was an interesting idea, though apparently setproctitle is 
not available on Linux, only BSD. There have been some attempts to 
expose it to Linux, including this one for Perl:

http://search.cpan.org/~opi/Sys-Proctitle-0.03/

You can see the gory details here:

http://search.cpan.org/src/OPI/Sys-Proctitle-0.03/libsetproctitle/setproctitle.c

It appears that it is possible to do this with OCaml, but it involves 
building and linking in a shared library that defines the obsolete _init 
method, fiddles around with memory relocating the environment and a 
bunch of other nasty stuff I don't even want to understand. If it was 
something simple like wrapping a libc function, I'd go for it, but this 
is all too complicated for such a simple, stupid hack. =)

Thanks,
Dave