1*699cd480SApple OSS Distributions /*
2*699cd480SApple OSS Distributions * Copyright (c) 2000-2019 Apple Inc. All rights reserved.
3*699cd480SApple OSS Distributions *
4*699cd480SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*699cd480SApple OSS Distributions *
6*699cd480SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code
7*699cd480SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License
8*699cd480SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in
9*699cd480SApple OSS Distributions * compliance with the License. The rights granted to you under the License
10*699cd480SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of,
11*699cd480SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to
12*699cd480SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any
13*699cd480SApple OSS Distributions * terms of an Apple operating system software license agreement.
14*699cd480SApple OSS Distributions *
15*699cd480SApple OSS Distributions * Please obtain a copy of the License at
16*699cd480SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*699cd480SApple OSS Distributions *
18*699cd480SApple OSS Distributions * The Original Code and all software distributed under the License are
19*699cd480SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*699cd480SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*699cd480SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*699cd480SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*699cd480SApple OSS Distributions * Please see the License for the specific language governing rights and
24*699cd480SApple OSS Distributions * limitations under the License.
25*699cd480SApple OSS Distributions *
26*699cd480SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*699cd480SApple OSS Distributions */
28*699cd480SApple OSS Distributions
29*699cd480SApple OSS Distributions #include <mach/port.h>
30*699cd480SApple OSS Distributions #include <mach/message.h>
31*699cd480SApple OSS Distributions #include <mach/kern_return.h>
32*699cd480SApple OSS Distributions #include <mach/host_priv.h>
33*699cd480SApple OSS Distributions
34*699cd480SApple OSS Distributions #include <kern/kern_types.h>
35*699cd480SApple OSS Distributions #include <kern/kalloc.h>
36*699cd480SApple OSS Distributions #include <kern/host.h>
37*699cd480SApple OSS Distributions #include <kern/ipc_kobject.h>
38*699cd480SApple OSS Distributions
39*699cd480SApple OSS Distributions #include <ipc/ipc_port.h>
40*699cd480SApple OSS Distributions
41*699cd480SApple OSS Distributions #include <UserNotification/UNDTypes.h>
42*699cd480SApple OSS Distributions #include <UserNotification/UNDRequest.h>
43*699cd480SApple OSS Distributions #include <UserNotification/UNDReplyServer.h>
44*699cd480SApple OSS Distributions #include <UserNotification/KUNCUserNotifications.h>
45*699cd480SApple OSS Distributions
46*699cd480SApple OSS Distributions #ifdef KERNEL_CF
47*699cd480SApple OSS Distributions // external
48*699cd480SApple OSS Distributions #include <IOKit/IOCFSerialize.h>
49*699cd480SApple OSS Distributions #include <IOKit/IOCFUnserialize.h>
50*699cd480SApple OSS Distributions #endif
51*699cd480SApple OSS Distributions
52*699cd480SApple OSS Distributions #if CONFIG_USER_NOTIFICATION
53*699cd480SApple OSS Distributions /*
54*699cd480SApple OSS Distributions * DEFINES AND STRUCTURES
55*699cd480SApple OSS Distributions */
56*699cd480SApple OSS Distributions
57*699cd480SApple OSS Distributions struct UNDReply {
58*699cd480SApple OSS Distributions decl_lck_mtx_data(, lock); /* UNDReply lock */
59*699cd480SApple OSS Distributions int userLandNotificationKey;
60*699cd480SApple OSS Distributions KUNCUserNotificationCallBack callback;
61*699cd480SApple OSS Distributions boolean_t inprogress;
62*699cd480SApple OSS Distributions ipc_port_t self_port; /* Our port */
63*699cd480SApple OSS Distributions };
64*699cd480SApple OSS Distributions
65*699cd480SApple OSS Distributions static void
66*699cd480SApple OSS Distributions UNDReply_no_senders(ipc_port_t port, mach_port_mscount_t mscount);
67*699cd480SApple OSS Distributions
68*699cd480SApple OSS Distributions IPC_KOBJECT_DEFINE(IKOT_UND_REPLY,
69*699cd480SApple OSS Distributions .iko_op_stable = true,
70*699cd480SApple OSS Distributions .iko_op_no_senders = UNDReply_no_senders);
71*699cd480SApple OSS Distributions
72*699cd480SApple OSS Distributions #define UNDReply_lock(reply) lck_mtx_lock(&reply->lock)
73*699cd480SApple OSS Distributions #define UNDReply_unlock(reply) lck_mtx_unlock(&reply->lock)
74*699cd480SApple OSS Distributions
75*699cd480SApple OSS Distributions LCK_GRP_DECLARE(UNDLckGrp, "UND");
76*699cd480SApple OSS Distributions
77*699cd480SApple OSS Distributions static UNDServerRef
UNDServer_reference(void)78*699cd480SApple OSS Distributions UNDServer_reference(void)
79*699cd480SApple OSS Distributions {
80*699cd480SApple OSS Distributions UNDServerRef UNDServer;
81*699cd480SApple OSS Distributions kern_return_t kr;
82*699cd480SApple OSS Distributions
83*699cd480SApple OSS Distributions kr = host_get_user_notification_port(host_priv_self(), &UNDServer);
84*699cd480SApple OSS Distributions assert(kr == KERN_SUCCESS);
85*699cd480SApple OSS Distributions return UNDServer;
86*699cd480SApple OSS Distributions }
87*699cd480SApple OSS Distributions
88*699cd480SApple OSS Distributions static void
UNDServer_deallocate(UNDServerRef UNDServer)89*699cd480SApple OSS Distributions UNDServer_deallocate(
90*699cd480SApple OSS Distributions UNDServerRef UNDServer)
91*699cd480SApple OSS Distributions {
92*699cd480SApple OSS Distributions if (IP_VALID(UNDServer)) {
93*699cd480SApple OSS Distributions ipc_port_release_send(UNDServer);
94*699cd480SApple OSS Distributions }
95*699cd480SApple OSS Distributions }
96*699cd480SApple OSS Distributions
97*699cd480SApple OSS Distributions /*
98*699cd480SApple OSS Distributions * UND Mig Callbacks
99*699cd480SApple OSS Distributions */
100*699cd480SApple OSS Distributions
101*699cd480SApple OSS Distributions kern_return_t
UNDAlertCompletedWithResult_rpc(UNDReplyRef reply,int result,xmlData_t keyRef,mach_msg_type_number_t keyLen)102*699cd480SApple OSS Distributions UNDAlertCompletedWithResult_rpc(
103*699cd480SApple OSS Distributions UNDReplyRef reply,
104*699cd480SApple OSS Distributions int result,
105*699cd480SApple OSS Distributions xmlData_t keyRef, /* raw XML bytes */
106*699cd480SApple OSS Distributions #ifdef KERNEL_CF
107*699cd480SApple OSS Distributions mach_msg_type_number_t keyLen)
108*699cd480SApple OSS Distributions #else
109*699cd480SApple OSS Distributions __unused mach_msg_type_number_t keyLen)
110*699cd480SApple OSS Distributions #endif
111*699cd480SApple OSS Distributions {
112*699cd480SApple OSS Distributions #ifdef KERNEL_CF
113*699cd480SApple OSS Distributions CFStringRef xmlError = NULL;
114*699cd480SApple OSS Distributions CFDictionaryRef dict = NULL;
115*699cd480SApple OSS Distributions #else
116*699cd480SApple OSS Distributions const void *dict = (const void *)keyRef;
117*699cd480SApple OSS Distributions #endif
118*699cd480SApple OSS Distributions
119*699cd480SApple OSS Distributions if (reply == UND_REPLY_NULL || !reply->inprogress) {
120*699cd480SApple OSS Distributions return KERN_INVALID_ARGUMENT;
121*699cd480SApple OSS Distributions }
122*699cd480SApple OSS Distributions
123*699cd480SApple OSS Distributions /*
124*699cd480SApple OSS Distributions * JMM - No C vesion of the Unserialize code in-kernel
125*699cd480SApple OSS Distributions * and no C type for a CFDictionary either. For now,
126*699cd480SApple OSS Distributions * just pass the raw keyRef through.
127*699cd480SApple OSS Distributions */
128*699cd480SApple OSS Distributions #ifdef KERNEL_CF
129*699cd480SApple OSS Distributions if (keyRef && keyLen) {
130*699cd480SApple OSS Distributions dict = IOCFUnserialize(keyRef, NULL, NULL, &xmlError);
131*699cd480SApple OSS Distributions }
132*699cd480SApple OSS Distributions
133*699cd480SApple OSS Distributions if (xmlError) {
134*699cd480SApple OSS Distributions CFShow(xmlError);
135*699cd480SApple OSS Distributions CFRelease(xmlError);
136*699cd480SApple OSS Distributions }
137*699cd480SApple OSS Distributions #endif /* KERNEL_CF */
138*699cd480SApple OSS Distributions
139*699cd480SApple OSS Distributions if (reply->callback) {
140*699cd480SApple OSS Distributions (reply->callback)((int)(KUNCUserNotificationID)reply, result, dict);
141*699cd480SApple OSS Distributions }
142*699cd480SApple OSS Distributions
143*699cd480SApple OSS Distributions UNDReply_lock(reply);
144*699cd480SApple OSS Distributions reply->inprogress = FALSE;
145*699cd480SApple OSS Distributions reply->userLandNotificationKey = -1;
146*699cd480SApple OSS Distributions UNDReply_unlock(reply);
147*699cd480SApple OSS Distributions
148*699cd480SApple OSS Distributions return KERN_SUCCESS;
149*699cd480SApple OSS Distributions }
150*699cd480SApple OSS Distributions
151*699cd480SApple OSS Distributions /*
152*699cd480SApple OSS Distributions * Routine: UNDNotificationCreated_rpc
153*699cd480SApple OSS Distributions *
154*699cd480SApple OSS Distributions * Intermediate routine. Allows the kernel mechanism
155*699cd480SApple OSS Distributions * to be informed that the notification request IS
156*699cd480SApple OSS Distributions * being processed by the user-level daemon, and how
157*699cd480SApple OSS Distributions * to identify that request.
158*699cd480SApple OSS Distributions */
159*699cd480SApple OSS Distributions kern_return_t
UNDNotificationCreated_rpc(UNDReplyRef reply,int userLandNotificationKey)160*699cd480SApple OSS Distributions UNDNotificationCreated_rpc(
161*699cd480SApple OSS Distributions UNDReplyRef reply,
162*699cd480SApple OSS Distributions int userLandNotificationKey)
163*699cd480SApple OSS Distributions {
164*699cd480SApple OSS Distributions if (reply == UND_REPLY_NULL) {
165*699cd480SApple OSS Distributions return KERN_INVALID_ARGUMENT;
166*699cd480SApple OSS Distributions }
167*699cd480SApple OSS Distributions
168*699cd480SApple OSS Distributions UNDReply_lock(reply);
169*699cd480SApple OSS Distributions if (reply->inprogress || reply->userLandNotificationKey != -1) {
170*699cd480SApple OSS Distributions UNDReply_unlock(reply);
171*699cd480SApple OSS Distributions return KERN_INVALID_ARGUMENT;
172*699cd480SApple OSS Distributions }
173*699cd480SApple OSS Distributions reply->userLandNotificationKey = userLandNotificationKey;
174*699cd480SApple OSS Distributions UNDReply_unlock(reply);
175*699cd480SApple OSS Distributions return KERN_SUCCESS;
176*699cd480SApple OSS Distributions }
177*699cd480SApple OSS Distributions
178*699cd480SApple OSS Distributions /*
179*699cd480SApple OSS Distributions * KUNC Functions
180*699cd480SApple OSS Distributions */
181*699cd480SApple OSS Distributions
182*699cd480SApple OSS Distributions
183*699cd480SApple OSS Distributions KUNCUserNotificationID
KUNCGetNotificationID(void)184*699cd480SApple OSS Distributions KUNCGetNotificationID(void)
185*699cd480SApple OSS Distributions {
186*699cd480SApple OSS Distributions UNDReplyRef reply;
187*699cd480SApple OSS Distributions
188*699cd480SApple OSS Distributions reply = kalloc_type(struct UNDReply, Z_WAITOK | Z_ZERO | Z_NOFAIL);
189*699cd480SApple OSS Distributions reply->self_port = ipc_kobject_alloc_port((ipc_kobject_t)reply,
190*699cd480SApple OSS Distributions IKOT_UND_REPLY, IPC_KOBJECT_ALLOC_NSREQUEST);
191*699cd480SApple OSS Distributions lck_mtx_init(&reply->lock, &UNDLckGrp, LCK_ATTR_NULL);
192*699cd480SApple OSS Distributions reply->userLandNotificationKey = -1;
193*699cd480SApple OSS Distributions reply->inprogress = FALSE;
194*699cd480SApple OSS Distributions
195*699cd480SApple OSS Distributions return (KUNCUserNotificationID) reply;
196*699cd480SApple OSS Distributions }
197*699cd480SApple OSS Distributions
198*699cd480SApple OSS Distributions static void
UNDReply_no_senders(ipc_port_t port,mach_port_mscount_t mscount)199*699cd480SApple OSS Distributions UNDReply_no_senders(ipc_port_t port, mach_port_mscount_t mscount)
200*699cd480SApple OSS Distributions {
201*699cd480SApple OSS Distributions UNDReplyRef reply;
202*699cd480SApple OSS Distributions
203*699cd480SApple OSS Distributions reply = ipc_kobject_dealloc_port(port, mscount, IKOT_UND_REPLY);
204*699cd480SApple OSS Distributions lck_mtx_destroy(&reply->lock, &UNDLckGrp);
205*699cd480SApple OSS Distributions kfree_type(struct UNDReply, reply);
206*699cd480SApple OSS Distributions }
207*699cd480SApple OSS Distributions
208*699cd480SApple OSS Distributions kern_return_t
KUNCExecute(char executionPath[1024],int uid,int gid)209*699cd480SApple OSS Distributions KUNCExecute(char executionPath[1024], int uid, int gid)
210*699cd480SApple OSS Distributions {
211*699cd480SApple OSS Distributions UNDServerRef UNDServer;
212*699cd480SApple OSS Distributions
213*699cd480SApple OSS Distributions UNDServer = UNDServer_reference();
214*699cd480SApple OSS Distributions if (IP_VALID(UNDServer)) {
215*699cd480SApple OSS Distributions kern_return_t kr;
216*699cd480SApple OSS Distributions kr = UNDExecute_rpc(UNDServer, executionPath, uid, gid);
217*699cd480SApple OSS Distributions UNDServer_deallocate(UNDServer);
218*699cd480SApple OSS Distributions return kr;
219*699cd480SApple OSS Distributions }
220*699cd480SApple OSS Distributions return MACH_SEND_INVALID_DEST;
221*699cd480SApple OSS Distributions }
222*699cd480SApple OSS Distributions
223*699cd480SApple OSS Distributions kern_return_t
KUNCUserNotificationDisplayNotice(int noticeTimeout,unsigned flags,char * iconPath,char * soundPath,char * localizationPath,char * alertHeader,char * alertMessage,char * defaultButtonTitle)224*699cd480SApple OSS Distributions KUNCUserNotificationDisplayNotice(
225*699cd480SApple OSS Distributions int noticeTimeout,
226*699cd480SApple OSS Distributions unsigned flags,
227*699cd480SApple OSS Distributions char *iconPath,
228*699cd480SApple OSS Distributions char *soundPath,
229*699cd480SApple OSS Distributions char *localizationPath,
230*699cd480SApple OSS Distributions char *alertHeader,
231*699cd480SApple OSS Distributions char *alertMessage,
232*699cd480SApple OSS Distributions char *defaultButtonTitle)
233*699cd480SApple OSS Distributions {
234*699cd480SApple OSS Distributions UNDServerRef UNDServer;
235*699cd480SApple OSS Distributions
236*699cd480SApple OSS Distributions UNDServer = UNDServer_reference();
237*699cd480SApple OSS Distributions if (IP_VALID(UNDServer)) {
238*699cd480SApple OSS Distributions kern_return_t kr;
239*699cd480SApple OSS Distributions kr = UNDDisplayNoticeSimple_rpc(UNDServer,
240*699cd480SApple OSS Distributions noticeTimeout,
241*699cd480SApple OSS Distributions flags,
242*699cd480SApple OSS Distributions iconPath,
243*699cd480SApple OSS Distributions soundPath,
244*699cd480SApple OSS Distributions localizationPath,
245*699cd480SApple OSS Distributions alertHeader,
246*699cd480SApple OSS Distributions alertMessage,
247*699cd480SApple OSS Distributions defaultButtonTitle);
248*699cd480SApple OSS Distributions UNDServer_deallocate(UNDServer);
249*699cd480SApple OSS Distributions return kr;
250*699cd480SApple OSS Distributions }
251*699cd480SApple OSS Distributions return MACH_SEND_INVALID_DEST;
252*699cd480SApple OSS Distributions }
253*699cd480SApple OSS Distributions
254*699cd480SApple OSS Distributions kern_return_t
KUNCUserNotificationDisplayAlert(int alertTimeout,unsigned flags,char * iconPath,char * soundPath,char * localizationPath,char * alertHeader,char * alertMessage,char * defaultButtonTitle,char * alternateButtonTitle,char * otherButtonTitle,unsigned * responseFlags)255*699cd480SApple OSS Distributions KUNCUserNotificationDisplayAlert(
256*699cd480SApple OSS Distributions int alertTimeout,
257*699cd480SApple OSS Distributions unsigned flags,
258*699cd480SApple OSS Distributions char *iconPath,
259*699cd480SApple OSS Distributions char *soundPath,
260*699cd480SApple OSS Distributions char *localizationPath,
261*699cd480SApple OSS Distributions char *alertHeader,
262*699cd480SApple OSS Distributions char *alertMessage,
263*699cd480SApple OSS Distributions char *defaultButtonTitle,
264*699cd480SApple OSS Distributions char *alternateButtonTitle,
265*699cd480SApple OSS Distributions char *otherButtonTitle,
266*699cd480SApple OSS Distributions unsigned *responseFlags)
267*699cd480SApple OSS Distributions {
268*699cd480SApple OSS Distributions UNDServerRef UNDServer;
269*699cd480SApple OSS Distributions
270*699cd480SApple OSS Distributions UNDServer = UNDServer_reference();
271*699cd480SApple OSS Distributions if (IP_VALID(UNDServer)) {
272*699cd480SApple OSS Distributions kern_return_t kr;
273*699cd480SApple OSS Distributions kr = UNDDisplayAlertSimple_rpc(UNDServer,
274*699cd480SApple OSS Distributions alertTimeout,
275*699cd480SApple OSS Distributions flags,
276*699cd480SApple OSS Distributions iconPath,
277*699cd480SApple OSS Distributions soundPath,
278*699cd480SApple OSS Distributions localizationPath,
279*699cd480SApple OSS Distributions alertHeader,
280*699cd480SApple OSS Distributions alertMessage,
281*699cd480SApple OSS Distributions defaultButtonTitle,
282*699cd480SApple OSS Distributions alternateButtonTitle,
283*699cd480SApple OSS Distributions otherButtonTitle,
284*699cd480SApple OSS Distributions responseFlags);
285*699cd480SApple OSS Distributions UNDServer_deallocate(UNDServer);
286*699cd480SApple OSS Distributions return kr;
287*699cd480SApple OSS Distributions }
288*699cd480SApple OSS Distributions return MACH_SEND_INVALID_DEST;
289*699cd480SApple OSS Distributions }
290*699cd480SApple OSS Distributions
291*699cd480SApple OSS Distributions kern_return_t
KUNCUserNotificationDisplayFromBundle(KUNCUserNotificationID id,char * bundlePath,char * fileName,char * fileExtension,char * messageKey,char * tokenString,KUNCUserNotificationCallBack callback,__unused int contextKey)292*699cd480SApple OSS Distributions KUNCUserNotificationDisplayFromBundle(
293*699cd480SApple OSS Distributions KUNCUserNotificationID id,
294*699cd480SApple OSS Distributions char *bundlePath,
295*699cd480SApple OSS Distributions char *fileName,
296*699cd480SApple OSS Distributions char *fileExtension,
297*699cd480SApple OSS Distributions char *messageKey,
298*699cd480SApple OSS Distributions char *tokenString,
299*699cd480SApple OSS Distributions KUNCUserNotificationCallBack callback,
300*699cd480SApple OSS Distributions __unused int contextKey)
301*699cd480SApple OSS Distributions {
302*699cd480SApple OSS Distributions UNDReplyRef reply = (UNDReplyRef)id;
303*699cd480SApple OSS Distributions UNDServerRef UNDServer;
304*699cd480SApple OSS Distributions ipc_port_t reply_port;
305*699cd480SApple OSS Distributions
306*699cd480SApple OSS Distributions if (reply == UND_REPLY_NULL) {
307*699cd480SApple OSS Distributions return KERN_INVALID_ARGUMENT;
308*699cd480SApple OSS Distributions }
309*699cd480SApple OSS Distributions UNDReply_lock(reply);
310*699cd480SApple OSS Distributions if (reply->inprogress == TRUE || reply->userLandNotificationKey != -1) {
311*699cd480SApple OSS Distributions UNDReply_unlock(reply);
312*699cd480SApple OSS Distributions return KERN_INVALID_ARGUMENT;
313*699cd480SApple OSS Distributions }
314*699cd480SApple OSS Distributions reply->inprogress = TRUE;
315*699cd480SApple OSS Distributions reply->callback = callback;
316*699cd480SApple OSS Distributions reply_port = ipc_kobject_make_send(reply->self_port, reply, IKOT_UND_REPLY);
317*699cd480SApple OSS Distributions UNDReply_unlock(reply);
318*699cd480SApple OSS Distributions
319*699cd480SApple OSS Distributions UNDServer = UNDServer_reference();
320*699cd480SApple OSS Distributions if (IP_VALID(UNDServer)) {
321*699cd480SApple OSS Distributions kern_return_t kr;
322*699cd480SApple OSS Distributions
323*699cd480SApple OSS Distributions kr = UNDDisplayCustomFromBundle_rpc(UNDServer,
324*699cd480SApple OSS Distributions reply_port,
325*699cd480SApple OSS Distributions bundlePath,
326*699cd480SApple OSS Distributions fileName,
327*699cd480SApple OSS Distributions fileExtension,
328*699cd480SApple OSS Distributions messageKey,
329*699cd480SApple OSS Distributions tokenString);
330*699cd480SApple OSS Distributions UNDServer_deallocate(UNDServer);
331*699cd480SApple OSS Distributions return kr;
332*699cd480SApple OSS Distributions }
333*699cd480SApple OSS Distributions return MACH_SEND_INVALID_DEST;
334*699cd480SApple OSS Distributions }
335*699cd480SApple OSS Distributions
336*699cd480SApple OSS Distributions /*
337*699cd480SApple OSS Distributions * Routine: convert_port_to_UNDReply
338*699cd480SApple OSS Distributions *
339*699cd480SApple OSS Distributions * MIG helper routine to convert from a mach port to a
340*699cd480SApple OSS Distributions * UNDReply object.
341*699cd480SApple OSS Distributions *
342*699cd480SApple OSS Distributions * Assumptions:
343*699cd480SApple OSS Distributions * Nothing locked.
344*699cd480SApple OSS Distributions */
345*699cd480SApple OSS Distributions UNDReplyRef
convert_port_to_UNDReply(ipc_port_t port)346*699cd480SApple OSS Distributions convert_port_to_UNDReply(
347*699cd480SApple OSS Distributions ipc_port_t port)
348*699cd480SApple OSS Distributions {
349*699cd480SApple OSS Distributions UNDReplyRef reply = NULL;
350*699cd480SApple OSS Distributions if (IP_VALID(port)) {
351*699cd480SApple OSS Distributions reply = ipc_kobject_get_stable(port, IKOT_UND_REPLY);
352*699cd480SApple OSS Distributions }
353*699cd480SApple OSS Distributions
354*699cd480SApple OSS Distributions return reply;
355*699cd480SApple OSS Distributions }
356*699cd480SApple OSS Distributions #endif
357*699cd480SApple OSS Distributions
358*699cd480SApple OSS Distributions /*
359*699cd480SApple OSS Distributions * User interface for setting the host UserNotification Daemon port.
360*699cd480SApple OSS Distributions */
361*699cd480SApple OSS Distributions
362*699cd480SApple OSS Distributions kern_return_t
host_set_UNDServer(host_priv_t host_priv,UNDServerRef server)363*699cd480SApple OSS Distributions host_set_UNDServer(
364*699cd480SApple OSS Distributions host_priv_t host_priv,
365*699cd480SApple OSS Distributions UNDServerRef server)
366*699cd480SApple OSS Distributions {
367*699cd480SApple OSS Distributions #if CONFIG_USER_NOTIFICATION
368*699cd480SApple OSS Distributions return host_set_user_notification_port(host_priv, server);
369*699cd480SApple OSS Distributions #else
370*699cd480SApple OSS Distributions #pragma unused(host_priv, server)
371*699cd480SApple OSS Distributions return KERN_NOT_SUPPORTED;
372*699cd480SApple OSS Distributions #endif
373*699cd480SApple OSS Distributions }
374*699cd480SApple OSS Distributions
375*699cd480SApple OSS Distributions /*
376*699cd480SApple OSS Distributions * User interface for retrieving the UserNotification Daemon port.
377*699cd480SApple OSS Distributions */
378*699cd480SApple OSS Distributions
379*699cd480SApple OSS Distributions kern_return_t
host_get_UNDServer(host_priv_t host_priv,UNDServerRef * serverp)380*699cd480SApple OSS Distributions host_get_UNDServer(
381*699cd480SApple OSS Distributions host_priv_t host_priv,
382*699cd480SApple OSS Distributions UNDServerRef *serverp)
383*699cd480SApple OSS Distributions {
384*699cd480SApple OSS Distributions #if CONFIG_USER_NOTIFICATION
385*699cd480SApple OSS Distributions return host_get_user_notification_port(host_priv, serverp);
386*699cd480SApple OSS Distributions #else
387*699cd480SApple OSS Distributions #pragma unused(host_priv, serverp)
388*699cd480SApple OSS Distributions return KERN_NOT_SUPPORTED;
389*699cd480SApple OSS Distributions #endif
390*699cd480SApple OSS Distributions }
391