[racket] Can raco exe assign a name other than "racket"?

From: Gregory Woodhouse (gregwoodhouse at me.com)
Date: Sat Mar 26 22:20:09 EDT 2011

Could it be that the issue is not argv[0] at all, but the way the program is launched by xinetd? I'm guessing that this is a daemon process. 

Sent from my iPad

On Mar 26, 2011, at 2:28 PM, Hugh Myers <hsmyers at gmail.com> wrote:

> Don't know about 'do by default', but since command line switches are
> already being used; '-o', the cost of one more seems slight and
> reasonably safe as it would be backwardly compatible and forwardly
> useful...
> 
> On Sat, Mar 26, 2011 at 1:13 PM, Neil Van Dyke <neil at neilvandyke.org> wrote:
>> Greg Hendershott wrote at 03/26/2011 12:14 PM:
>>> 
>>> $ raco exe -o foo foo.rkt
>>> $ ./foo &
>>> $ ps  #shows it as "racket" not as "foo".
>>> $ top  #shows it as "racket" not as "foo".
>>> 
>>> Is there way I can make it show up as "foo"?
>>> 
>> 
>> You can often do this in C on Unix variants by mutating the string buffers
>> pointed to by "argv" argument as passed to the "main" function.
>> To do this for executables created in the manner above, I suspect that
>> someone would have to modify the C code for Racket, but I have not verified
>> this.  (I started to look at the 5.0.2 code just now, and didn't immediately
>> see an obvious way without modifying the C code, but I have to run to
>> something now, so you might see a way if you read through the code.)
>> 
>> Use this feature with discretion, since the effect can be confusing to
>> people trying to debug.  (Some daemons have been known to abuse this feature
>> to show application-specific status, preventing you from seeing the original
>> command line arguments.  A colleague once hacked an old Unix game to show up
>> in the process table as "vi resume" on time-sharing systems, back when
>> employers were more motivated to keep employees happy.)  And exercise the
>> usual system programming caution, since you don't want to stomp on the wrong
>> memory here, nor corrupt the info that "ps" and other tools will be looking
>> at.
>> 
>> In the case of the original "raco exe" question, perhaps this is something
>> that Racket should be changed to do by default?  I have no opinion on that.
>> 
>> --
>> http://www.neilvandyke.org/
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>> 
> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


Posted on the users mailing list.