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 (17:00)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Writing to argv[0]
On Fri, Oct 10, 2008 at 09:33:17AM -0700, Dave Benjamin wrote:
> On Fri, 10 Oct 2008, Richard Jones wrote:
> >On Thu, Oct 09, 2008 at 05:31:11PM +0200, Basile STARYNKEVITCH wrote:
> >>Dave Benjamin wrote:
> >>>Is there any way for an OCaml program to change its name in the process
> >>>table? Assigning to Sys.argv.(0) has no effect.
> >>
> >>Write a C wrapper for that. And this trick seems Linux specific (it has
> >>no sense in Posix) -maybe working on few other OSes.
> >
> >;content-type=text%2Fplain
> >
> >PostgreSQL offers this code to change the proc title on many different
> >platforms.
> Thanks, Rich - this looks very comprehensive - they even go out of their 
> way to support Windows! =) However, unless I'm mistaken, I still have the 
> problem of not being able to access "argc" and "argv" to pass into 
> save_ps_display_args(). I suppose I could embed OCaml in a C program...

Yes, it was intended more as a joke rather than a serious suggestion :-)

I was also talking to Jim Meyering about the possibility of adding
this code to gnulib[1] which would make it more widely available to
all programs.



Richard Jones
Red Hat