On Mon, Apr 02, 2012 at 03:21:06PM +0200, Samuel Thibault wrote: > Because there is code in GNU Mach that uses mach_port_t as a pointer, > see e.g. kdportdeath(), which just casts mach_port_t into ipc_port_t, or > ipc_kmsg_copyin_header which casts back the just-resolved object into > mach_port_t. Such code might have to simply use the ipc_port_t type > instead, I don't know. What I know for sure, however, is that xnu does > typedef ipc_port_t mach_port_t, which makes me tend to think that in the > kernel, mach_port_t is supposed to be a pointer, while mach_port_name_t > is for the port names.
Keeping names-to-pointer casts wouldn't be the cleanest way, but it may save some effort. Using ipc_port_t seems better to me, but as it's completely internal to the kernel, it doesn't matter much. To answer your inital question, yes, it doesn't hurt much and makes sense to use a 32-bit type for port names, whatever the word size. -- Richard Braun