X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..c6bf4f310a33a9262d455ea4d3f0630b1255e3fe:/osfmk/kern/ipc_misc.c?ds=sidebyside diff --git a/osfmk/kern/ipc_misc.c b/osfmk/kern/ipc_misc.c index 655d385e8..16c3c5a51 100644 --- a/osfmk/kern/ipc_misc.c +++ b/osfmk/kern/ipc_misc.c @@ -52,27 +52,8 @@ extern void fileport_releasefg(struct fileglob *); ipc_port_t fileport_alloc(struct fileglob *fg) { - ipc_port_t fileport; - ipc_port_t sendport; - ipc_port_t notifyport; - - fileport = ipc_port_alloc_kernel(); - if (fileport == IP_NULL) { - goto out; - } - - ipc_kobject_set(fileport, (ipc_kobject_t)fg, IKOT_FILEPORT); - ip_lock(fileport); /* unlocked by ipc_port_nsrequest */ - notifyport = ipc_port_make_sonce_locked(fileport); - ipc_port_nsrequest(fileport, 1, notifyport, ¬ifyport); - - sendport = ipc_port_make_send(fileport); - if (!IP_VALID(sendport)) { - panic("Couldn't allocate send right for fileport!\n"); - } - -out: - return fileport; + return ipc_kobject_alloc_port((ipc_kobject_t)fg, IKOT_FILEPORT, + IPC_KOBJECT_ALLOC_MAKE_SEND | IPC_KOBJECT_ALLOC_NSREQUEST); } @@ -174,7 +155,8 @@ fileport_invoke(task_t task, mach_port_name_t name, struct fileglob *fg; kr = ipc_object_copyin(task->itk_space, name, - MACH_MSG_TYPE_COPY_SEND, (ipc_object_t *)&fileport); + MACH_MSG_TYPE_COPY_SEND, (ipc_object_t *)&fileport, 0, NULL, + IPC_KMSG_FLAGS_ALLOW_IMMOVABLE_SEND); if (kr != KERN_SUCCESS) { return kr; }