caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Savanni D'Gerinel <savanni@alyra.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Writing to argv[0]
Date: Thu, 9 Oct 2008 10:43:34 -0500	[thread overview]
Message-ID: <B6E6E9F5-F20E-49E9-8F98-E1522970837C@alyra.org> (raw)
In-Reply-To: <48EE23BF.3080300@starynkevitch.net>

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

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.

"The setproctitle() function is implicitly non-standard.  Other  
methods of
causing the ps(1) command line to change, including copying over the
argv[0] string are also implicitly non-portable.  It is preferable to  
use
an operating system supplied setproctitle() if present."

I do not know whether there is an OCaml function to do this, and it  
might actually be complicated because of the variable length argument  
list.  I have not written enough ocaml -> C bindings to have any idea  
how to handle that.

--
Savanni

On Oct 9, 2008, at 10:31 AM, Basile STARYNKEVITCH wrote:

> Dave Benjamin wrote:
>> Hi,
>> 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.
>
> Regards.
>
> -- 
> Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
> email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
> 8, rue de la Faiencerie, 92340 Bourg La Reine, France
> *** opinions {are only mines, sont seulement les miennes} ***
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 188 bytes --]

  reply	other threads:[~2008-10-09 15:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09 15:26 Dave Benjamin
2008-10-09 15:31 ` [Caml-list] " Basile STARYNKEVITCH
2008-10-09 15:43   ` Savanni D'Gerinel [this message]
2008-10-10  4:58     ` Dave Benjamin
2008-10-10  4:53   ` Dave Benjamin
2008-10-10 13:26     ` Dave Benjamin
2008-10-10 18:48       ` Jason Noakes
2008-10-10 20:11         ` Dave Benjamin
2008-10-10 15:11   ` Richard Jones
2008-10-10 16:33     ` Dave Benjamin
2008-10-10 16:59       ` Richard Jones
2008-10-10 20:19         ` Dave Benjamin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B6E6E9F5-F20E-49E9-8F98-E1522970837C@alyra.org \
    --to=savanni@alyra.org \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).