]>
Commit | Line | Data |
---|---|---|
5958d7c0 A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | ||
23 | #include "configd.h" | |
24 | #include "session.h" | |
25 | ||
26 | boolean_t | |
27 | notify_server(mach_msg_header_t *request, mach_msg_header_t *reply) | |
28 | { | |
29 | mach_no_senders_notification_t *notify = (mach_no_senders_notification_t *)request; | |
30 | ||
31 | if ((notify->not_header.msgh_id > MACH_NOTIFY_LAST) || | |
32 | (notify->not_header.msgh_id < MACH_NOTIFY_FIRST)) { | |
33 | return FALSE; /* if this is not a notification message */ | |
34 | } | |
35 | ||
36 | switch (notify->not_header.msgh_id) { | |
37 | case MACH_NOTIFY_NO_SENDERS : | |
38 | SCDLog(LOG_DEBUG, CFSTR("No more senders for port %d, closing."), | |
39 | notify->not_header.msgh_local_port); | |
40 | cleanupSession(notify->not_header.msgh_local_port); | |
41 | ||
42 | (void) mach_port_destroy(mach_task_self(), notify->not_header.msgh_local_port); | |
43 | ||
44 | notify->not_header.msgh_remote_port = MACH_PORT_NULL; | |
45 | return TRUE; | |
46 | case MACH_NOTIFY_DEAD_NAME : | |
47 | SCDLog(LOG_DEBUG, CFSTR("Dead name for port %d, closing."), | |
48 | notify->not_header.msgh_local_port); | |
49 | cleanupSession(notify->not_header.msgh_local_port); | |
50 | ||
51 | (void) mach_port_destroy(mach_task_self(), notify->not_header.msgh_local_port); | |
52 | ||
53 | notify->not_header.msgh_remote_port = MACH_PORT_NULL; | |
54 | return TRUE; | |
55 | default : | |
56 | break; | |
57 | } | |
58 | ||
59 | SCDLog(LOG_DEBUG, CFSTR("HELP!, Received notification: port=%d, msgh_id=%d"), | |
60 | notify->not_header.msgh_local_port, | |
61 | notify->not_header.msgh_id); | |
62 | ||
63 | return FALSE; | |
64 | } |