Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2008-10-10 (05:00)
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:

You can see the gory details here:

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. =)