On Fri, Jun 6, 2008 at 10:28 AM, radj <[EMAIL PROTECTED]> wrote:
> Hello again.
>
> I have another problem now and it is how to set off DTrace from within the
> application. This is my code:
>
> // SNIPPET START
>
> int pid = [[NSProcessInfo processInfo] processIdentifier];
>
> NSArray *arguments = [NSArray arrayWithObjects: @"-w", // permit destructive
> actions
>                                                    @"-o /tmp/DTraceLog", //
> output file
>                                                    @"-s /tmp/DTrace.d", //
> D script

These are not your immediate problem, but they will break next. These
arguments are incorrect. You're passing the flag plus the value as a
*single* argument. This is equivalent to quoting it in the shell. You
don't want that. Pass them as separate arguments. See:

http://www.cocoadev.com/index.pl?NSTaskArguments

>                                                    [NSNumber
> numberWithInt:pid], // feed in PID for macro $1
>                                                    nil];
>
> NSTask *task;
> task = [[NSTask alloc] init];
> [task setLaunchPath: @"/dev/dtrace"];

This won't work. /dev is for "devices", not "developer". /dev/dtrace
is a dtrace kernel device, *not* the dtrace binary. Use "which dtrace"
in the shell to find out the path to the dtrace executable.

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to