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=none autolearn=disabled version=3.1.3 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 3F2BABB84 for ; Fri, 10 Oct 2008 07:00:06 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEADB+7kjOe3NG/2dsb2JhbAC+AYFq X-IronPort-AV: E=Sophos;i="4.33,386,1220220000"; d="scan'208";a="18510518" Received: from spoomusic.com ([206.123.115.70]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Oct 2008 07:00:05 +0200 Received: (qmail 27699 invoked by uid 89); 10 Oct 2008 05:00:04 -0000 Received: from unknown (HELO ?192.168.1.99?) (98.165.129.233) by 0 with ESMTPS (DHE-RSA-AES256-SHA encrypted); 10 Oct 2008 05:00:04 -0000 Message-ID: <48EEE107.10004@ramenlabs.com> Date: Thu, 09 Oct 2008 21:58:47 -0700 From: Dave Benjamin User-Agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: Savanni D'Gerinel Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Writing to argv[0] References: <48EE22B0.3090404@ramenlabs.com> <48EE23BF.3080300@starynkevitch.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; argv:01 non-standard:01 argv:01 cpan:01 cpan:01 ocaml:01 libc:01 0.03:98 0.03:98 wrote:01 defines:01 caml-list:01 benjamin:01 linking:02 library:03 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