Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KUNCExecute problems



I tried doing something very similar to the listing below, but I still can't get it to work. I'm hoping I'm just being dense and one of you guys can help me out. I created a test shell script, and put it at /usr/bin/test, and ran chmod 755 on it. Line endings are unix. I can run ./test in the terminal and the script runs as expected. The script itself looks like this:

echo "This is a test"
open /Applications/TextEdit.app

In my driver's user client, when I get the client died message, I do this:

kern_return_t result;
result = KUNCExecute("/usr/bin/test", kOpenAppAsRoot, kOpenApplicationPath);

If I then kill one of my client apps, I do get the client died message (which I log to the console right before the KUNCExecute call), but the script doesn't appear to be running. I don't see the text output, and TextEdit doesn't launch.

Is there anything obvious that I'm doing wrong here?

Thanks,
Jim

At 9:22 AM -0400 4/29/05, Andrew Gallatin wrote:
Jim Wintermyre writes:
 > I'm trying to use KUNCExecute from my IOKit driver in order to launch
 > a user-space app to do some stuff that can't happen at kernel level.
 > I'm running into a few snags:
 >
 > 1) It seems that KUNCExceute will only launch an application that
 > actually lives in the /Applications folder.  I'd like to include the

FWIW, I use KUNCExecute() to launch a shell script which lives in my
installation directory (which defaults to /opt/mx), and I've had no
problems.  However, I don't get any helpful info when the script is
not present.

Perhaps you could launch your app via a shell script?

Here is my launching code:

int
mx_start_mapper(mx_instance_state_t *is)
{
  kern_return_t ret;
  char *exec_path = "/opt/mx/etc/mx_macosx_start_mapper.sh";

  if (mx_mapper_path != NULL)
    exec_path = mx_mapper_path;
  MX_INFO(("Starting usermode helper: %s\n", exec_path));
  ret = KUNCExecute(exec_path, kOpenAppAsRoot, kOpenApplicationPath);
  if (ret != 0) {
    MX_INFO(("Problem starting usermode mapper, ret = %d\n", ret));
  }
  return ret;
}


Cheers,

Drew

_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-drivers mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.