• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CFMessagePortCreateRemote, launchd, Bootstrap Namespace, 10.5
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFMessagePortCreateRemote, launchd, Bootstrap Namespace, 10.5


  • Subject: CFMessagePortCreateRemote, launchd, Bootstrap Namespace, 10.5
  • From: Jerry Krinock <email@hidden>
  • Date: Sat, 03 Sep 2011 18:12:36 -0700

Upon further study, forget what I said about the problem being an "app" in my previous message.

The problem is that, on a PowerPC Mac running Mac OS X 10.5, in a command-line tool, CFMessagePortCreateRemote() always fails to connect to a port which is active in a double-clicked app, but only if the tool is launched by launchd.  The tool works OK if invoked from Terminal.

After reading these:

http://developer.apple.com/library/mac/#technotes/tn2083/_index.html
http://lists.apple.com/archives/darwin-development/2002/Jun/msg00350.html

I think that the problem is probably related to Bootstrap Namespaces, but I can't give a one-sentence explanation, and also I find it very odd that Mac OS X 10.5 would be more restrictive than 10.7.

*  *  *

I've created a very simple tool [1] to demo this.

STEPS TO REPRODUCE

• Launch an app which activates the CFMessagePort that the tool [1] will try to connect to.

• Test 1.  Launch the tool by "submitting" it to launchd, like this

PowerbookG4:~ b$ launchctl submit -l mytest -p /Applications/CFMessagePortBugger-Tool

Result: The tool logs that it failed to create the port:

11/09/03 16:13:36  Unknown[5677] Success=0 creating remote port to 'com.mycompany.MyApp.ExtoreFirefox.ToClient'

• Since 'launchctl submit' activates KeepAlive by default, manually end Test 1 by doing this:

PowerbookG4:~ b$ launchctl remove mytest

• Test 2.  Launch the tool by invoking it directly:

PowerbookG4:~ b$ /Applications/CFMessagePortBugger-Tool

Result: The tool logs that, this time, it succeeded in creating the port:

11/09/03 16:14:10  CFMessagePortBugger-Tool[5687] Success=1 creating remote port to 'com.mycompany.MyApp.ExtoreFirefox.ToClient'

• Repeat Test 1 and Test 2 on an Intel Mac running OS X Lion

RESULT: In both tests, the tool logs that it succeeded in creating the port.

*  *  *


How should I fix this?

Thanks,

Jerry


[1]  Code in CFMessagePortBugger-Tool

#import <Cocoa/Cocoa.h>

int main(int argc, char *argv[])
{
    NSString* portName = @"com.mycompany.MyApp.TestPort" ;
    CFMessagePortRef port = CFMessagePortCreateRemote(
                                                      NULL,
                                                      (CFStringRef)portName
                                                      ) ;
    NSLog(@"Success=%d creating remote port to '%@'",
          port != NULL,
          portName) ;
    if (port) {
        CFMessagePortInvalidate(port) ;
        CFRelease(port) ;
    }

    return 0 ;
}


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: CFMessagePortCreateRemote, launchd, Bootstrap Namespace, 10.5
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
References: 
 >CFMessagePortCreateRemote fails, only in .app, on PowerPC 10.5 (From: Jerry Krinock <email@hidden>)

  • Prev by Date: CFMessagePortCreateRemote fails, only in .app, on PowerPC 10.5
  • Next by Date: Re: CFMessagePortCreateRemote, launchd, Bootstrap Namespace, 10.5
  • Previous by thread: CFMessagePortCreateRemote fails, only in .app, on PowerPC 10.5
  • Next by thread: Re: CFMessagePortCreateRemote, launchd, Bootstrap Namespace, 10.5
  • Index(es):
    • Date
    • Thread