• 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
Re: Getting info on Mach Messages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting info on Mach Messages


  • Subject: Re: Getting info on Mach Messages
  • From: Jason Bobier <email@hidden>
  • Date: Sat, 1 Dec 2001 10:26:39 -0800

Unfortunately this isn't possible at the moment in DO. I've had a long time request in with Apple to make this possible because we need it in PGP.

As a work around I create an NSMachPort in the client task for the mach task:

sTask = [[NSMachPort alloc] initWithMachPort:mach_task_self()];

and pass it into each DO call. On the server side I use task_info to get information about the calling task. For example:

kern_return_t kerr;
security_token_t tok;
mach_msg_type_number_t cnt = TASK_SECURITY_TOKEN_COUNT;

kerr = task_info([inPort machPort], TASK_SECURITY_TOKEN, reinterpret_cast<task_info_t>(&tok), &cnt);

gets the security token (uid & gid) for the calling task.

I'm pretty sure that this is secure, but is quite a bit of extra code to get info that is already present but not accessible in the DO message.

Jason


On Friday, November 30, 2001, at 10:15 PM, cocoa-dev-
email@hidden wrote:

Date: Fri, 30 Nov 2001 18:47:29 -0700
Subject: Getting info on Mach Messages
From: email@hidden (mikevannorsdel)
To: Cocoa Dev <email@hidden>

I'm trying to find attributes of the sender of an incoming mach message.
I'm using DO to do inter-task communications and I need to be able to get
reliable info, like a pid, of the sender of an incoming mach message. Is
this possible? I was looking at NSMachPort's handleMachMessage: to get info
on the incoming mach message. However, I'm not sure what the incoming data
is. The docs say it starts with a msg_header_t struct, but that's all. Can
I get info on the sending task from here? If so, how do I take the raw
(void*) data that comes to handleMachMessage: and get readable data from it?

--
Jason A. Bobier email@hidden
Tech Lead, PGP Macintosh Products http://www.prismatix.com/
Network Associates, Inc. Nothing's constant

PGPKey: <http://keys.pgp.com:11371/pks/lookup?op=get&search=0xF6F83318>
Fingerprint: 7809 7E6E BCCA 903D 4618 9740 EB10 9DF9 F6F8 3318


  • Prev by Date: Re: Automated user-interaction regression testing tools?
  • Next by Date: Re: Drawing NSImage in grayscale
  • Previous by thread: Re: Automated user-interaction regression testing tools?
  • Next by thread: Re: Drawing NSImage in grayscale
  • Index(es):
    • Date
    • Thread