in reply to Re^4: assigning a name to every threads
in thread assigning a name to every threads

There's a reason I said Linux... :)

The problem is that setting $0 is not implemented for Solaris, at least not in a way that would work.  AFAIK, that's because (a) there is no system support for it (in the form of setproctitle(), etc.), so you'd have to resort to manipulating argv[] directly at the C level, and (b) the normal tools like ps (i.e. /usr/bin/ps) or ptree don't read the command+args from argv[] anyway, but rather from some other, harder to manipulate location, so you'd have to use /usr/ucb/ps (whose output can - to some degree - be influenced by a modified argv[]).

In case I have the time later, I'll see whether I can whip up a little XS routine which would allow to change the command name as it's shown by /usr/ucb/ps...

Replies are listed 'Best First'.
Re^6: assigning a name to every threads
by ajeet@perl (Acolyte) on May 03, 2010 at 08:15 UTC
    Thanks again almut....
Re^6: assigning a name to every threads
by Anonymous Monk on May 03, 2010 at 09:09 UTC
    Does Sys::Prctl work on solaris?
    use Sys::Prctl(prctl_name); # Process name is now "My long process name" my $oldname = prctl_name(); prctl_name("My long process name");
      $ /usr/local/bin/perl Makefile.PL # running Build.PL /usr/local/bin/perl Build.PL OS unsupported! Patches welcome :) at Build.PL line 5, <DATA> line 547 +. ... $ uname -a SunOS solaris10 5.10 Generic sun4u sparc SUNW,Sun-Blade-2500