]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
de355530 A |
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. | |
1c79356b | 11 | * |
de355530 A |
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 | |
1c79356b A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
de355530 A |
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. | |
1c79356b A |
19 | * |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * @OSF_COPYRIGHT@ | |
24 | */ | |
25 | /* | |
26 | * HISTORY | |
27 | * | |
28 | * Revision 1.1.1.1 1998/09/22 21:05:29 wsanchez | |
29 | * Import of Mac OS X kernel (~semeria) | |
30 | * | |
31 | * Revision 1.1.1.1 1998/03/07 02:26:16 wsanchez | |
32 | * Import of OSF Mach kernel (~mburg) | |
33 | * | |
34 | * Revision 1.2.6.1 1994/09/23 02:14:23 ezf | |
35 | * change marker to not FREE | |
36 | * [1994/09/22 21:31:33 ezf] | |
37 | * | |
38 | * Revision 1.2.2.4 1993/08/03 18:29:18 gm | |
39 | * CR9596: Change KERNEL to MACH_KERNEL. | |
40 | * [1993/08/02 16:11:07 gm] | |
41 | * | |
42 | * Revision 1.2.2.3 1993/07/22 16:18:15 rod | |
43 | * Add ANSI prototypes. CR #9523. | |
44 | * [1993/07/22 13:34:22 rod] | |
45 | * | |
46 | * Revision 1.2.2.2 1993/06/09 02:33:38 gm | |
47 | * Added to OSF/1 R1.3 from NMK15.0. | |
48 | * [1993/06/02 21:11:41 jeffc] | |
49 | * | |
50 | * Revision 1.2 1993/04/19 16:23:26 devrcs | |
51 | * Untyped ipc merge: | |
52 | * Support for logging and tracing within the MIG stubs | |
53 | * [1993/02/24 14:49:29 travos] | |
54 | * | |
55 | * $EndLog$ | |
56 | */ | |
57 | ||
58 | #ifdef MACH_KERNEL | |
59 | #include <mig_debug.h> | |
60 | #endif | |
61 | ||
62 | #include <mach/message.h> | |
63 | #include <mach/mig_log.h> | |
64 | ||
65 | int mig_tracing, mig_errors, mig_full_tracing; | |
66 | ||
67 | /* | |
68 | * Tracing facilities for MIG generated stubs. | |
69 | * | |
70 | * At the moment, there is only a printf, which is | |
71 | * activated through the runtime switch: | |
72 | * mig_tracing to call MigEventTracer | |
73 | * mig_errors to call MigEventErrors | |
74 | * For this to work, MIG has to run with the -L option, | |
75 | * and the mig_debug flags has to be selected | |
76 | * | |
77 | * In the future, it will be possible to collect infos | |
78 | * on the use of MACH IPC with an application similar | |
79 | * to netstat. | |
80 | * | |
81 | * A new option will be generated accordingly to the | |
82 | * kernel configuration rules, e.g | |
83 | * #include <mig_log.h> | |
84 | */ | |
85 | ||
86 | void | |
87 | MigEventTracer( | |
88 | mig_who_t who, | |
89 | mig_which_event_t what, | |
90 | mach_msg_id_t msgh_id, | |
91 | unsigned int size, | |
92 | unsigned int kpd, | |
93 | unsigned int retcode, | |
94 | unsigned int ports, | |
95 | unsigned int oolports, | |
96 | unsigned int ool, | |
97 | char *file, | |
98 | unsigned int line) | |
99 | { | |
100 | printf("%d|%d|%d", who, what, msgh_id); | |
101 | if (mig_full_tracing) | |
102 | printf(" -- sz%d|kpd%d|ret(0x%x)|p%d|o%d|op%d|%s, %d", | |
103 | size, kpd, retcode, ports, oolports, ool, file, line); | |
104 | printf("\n"); | |
105 | } | |
106 | ||
107 | void | |
108 | MigEventErrors( | |
109 | mig_who_t who, | |
110 | mig_which_error_t what, | |
111 | void *par, | |
112 | char *file, | |
113 | unsigned int line) | |
114 | { | |
115 | if (what == MACH_MSG_ERROR_UNKNOWN_ID) | |
116 | printf("%d|%d|%d -- %s %d\n", who, what, *(int *)par, file, line); | |
117 | else | |
118 | printf("%d|%d|%s -- %s %d\n", who, what, (char *)par, file, line); | |
119 | } |