From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id B963ABB84 for ; Fri, 10 Oct 2008 19:00:17 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmcDAHsn70hQRFuwiGdsb2JhbACTWwEBARUiqSaBbA X-IronPort-AV: E=Sophos;i="4.33,390,1220220000"; d="scan'208";a="30191146" Received: from furbychan.cocan.org ([80.68.91.176]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-SHA; 10 Oct 2008 18:59:47 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1KoLL7-00058k-1Y; Fri, 10 Oct 2008 17:59:45 +0100 Date: Fri, 10 Oct 2008 17:59:44 +0100 To: Dave Benjamin Cc: Basile STARYNKEVITCH , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Writing to argv[0] Message-ID: <20081010165944.GB16402@annexia.org> References: <48EE22B0.3090404@ramenlabs.com> <48EE23BF.3080300@starynkevitch.net> <20081010151143.GA15400@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Spam: no; 0.00; argv:01 0200,:01 basile:01 ocaml:01 argv:01 cvsweb:01 utils:01 argc:01 ocaml:01 10,:98 wrote:01 wrote:01 caml-list:01 posix:01 benjamin:01 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. > > > >http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/misc/ps_status.c?rev=1.33.2.1;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. Rich. [1] http://www.gnu.org/software/gnulib/ -- Richard Jones Red Hat