- 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);