2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
27 * Modification History
29 * June 1, 2001 Allan Nathanson <ajn@apple.com>
30 * - public API conversion
32 * March 31, 2000 Allan Nathanson <ajn@apple.com>
44 __SCDynamicStoreNotifyCancel(SCDynamicStoreRef store
)
46 SCDynamicStorePrivateRef storePrivate
= (SCDynamicStorePrivateRef
)store
;
48 SCLog(_configd_verbose
, LOG_DEBUG
, CFSTR("__SCDynamicStoreNotifyCancel:"));
51 return kSCStatusNoStoreSession
; /* you must have an open session to play */
55 * cleanup any mach port based notifications.
57 if (storePrivate
->notifyPort
!= MACH_PORT_NULL
) {
58 (void) mach_port_destroy(mach_task_self(), storePrivate
->notifyPort
);
59 storePrivate
->notifyPort
= MACH_PORT_NULL
;
63 * cleanup any file based notifications.
65 if (storePrivate
->notifyFile
>= 0) {
66 SCLog(_configd_verbose
, LOG_DEBUG
, CFSTR(" closing (notification) fd %d"), storePrivate
->notifyFile
);
67 (void) close(storePrivate
->notifyFile
);
68 storePrivate
->notifyFile
= -1;
72 * cleanup any signal notifications.
74 if (storePrivate
->notifySignal
> 0) {
75 (void) mach_port_destroy(mach_task_self(), storePrivate
->notifySignalTask
);
76 storePrivate
->notifySignal
= 0;
77 storePrivate
->notifySignalTask
= TASK_NULL
;
80 /* remove this session from the to-be-notified list */
81 if (needsNotification
) {
84 num
= CFNumberCreate(NULL
, kCFNumberIntType
, &storePrivate
->server
);
85 CFSetRemoveValue(needsNotification
, num
);
88 if (CFSetGetCount(needsNotification
) == 0) {
89 CFRelease(needsNotification
);
90 needsNotification
= NULL
;
94 /* set notifier inactive */
95 storePrivate
->notifyStatus
= NotifierNotRegistered
;
103 _notifycancel(mach_port_t server
,
106 serverSessionRef mySession
= getSession(server
);
108 if (_configd_verbose
) {
109 SCLog(TRUE
, LOG_DEBUG
, CFSTR("Cancel requested notifications."));
110 SCLog(TRUE
, LOG_DEBUG
, CFSTR(" server = %d"), server
);
114 *sc_status
= kSCStatusNoStoreSession
; /* you must have an open session to play */
118 *sc_status
= __SCDynamicStoreNotifyCancel(mySession
->store
);
119 if (*sc_status
!= kSCStatusOK
) {
120 SCLog(_configd_verbose
, LOG_DEBUG
, CFSTR(" __SCDynamicStoreNotifyCancel(): %s"), SCErrorString(*sc_status
));