xref: /trueos/sys/sys/mach/mig_errors.h (revision d3afb205b654fcba59c50d3989e3e2c2235797a6)
1 /*
2  * Copyright 1991-1998 by Open Software Foundation, Inc.
3  *              All Rights Reserved
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both the copyright notice and this permission notice appear in
9  * supporting documentation.
10  *
11  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
12  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13  * FOR A PARTICULAR PURPOSE.
14  *
15  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
16  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
18  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
19  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 /*
22  * MkLinux
23  */
24 /* CMU_HIST */
25 /*
26  * Revision 2.5.3.1  92/03/03  16:22:20  jeffreyh
27  * 	Changes from TRUNK
28  * 	[92/02/26  12:10:53  jeffreyh]
29  *
30  * Revision 2.7  92/01/15  13:44:38  rpd
31  * 	Changed MACH_IPC_COMPAT conditionals to default to not present.
32  *
33  * Revision 2.6  92/01/03  20:21:52  dbg
34  * 	Add mig_routine_t.
35  * 	[91/11/11            dbg]
36  *
37  * Revision 2.5  91/08/28  11:15:31  jsb
38  * 	Added MIG_SERVER_DIED.
39  * 	[91/08/21            rpd]
40  *
41  * Revision 2.4  91/05/14  16:56:33  mrt
42  * 	Correcting copyright
43  *
44  * Revision 2.3  91/02/05  17:34:20  mrt
45  * 	Changed to new Mach copyright
46  * 	[91/02/01  17:19:44  mrt]
47  *
48  * Revision 2.2  90/06/02  14:59:14  rpd
49  * 	Converted to new IPC.
50  * 	[90/03/26  22:37:01  rpd]
51  *
52  * Revision 2.1  89/08/03  16:03:33  rwd
53  * Created.
54  *
55  * Revision 2.4  89/02/25  18:38:41  gm0w
56  * 	Changes for cleanup.
57  *
58  * Revision 2.3  89/02/07  01:01:21  mwyoung
59  * Relocated from sys/mig_errors.h
60  *
61  * Revision 2.2  88/07/20  21:05:51  rpd
62  * Added definition of mig_symtab_t.
63  *
64  *  2-Dec-87  David Golub (dbg) at Carnegie-Mellon University
65  *	Added MIG_ARRAY_TOO_LARGE.
66  *
67  * 25-May-87  Richard Draves (rpd) at Carnegie-Mellon University
68  *	Added definition of death_pill_t.
69  *
70  * 31-Jul-86  Michael Young (mwyoung) at Carnegie-Mellon University
71  *	Created.
72  *
73  */
74 /* CMU_ENDHIST */
75 /*
76  * Mach Operating System
77  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
78  * All Rights Reserved.
79  *
80  * Permission to use, copy, modify and distribute this software and its
81  * documentation is hereby granted, provided that both the copyright
82  * notice and this permission notice appear in all copies of the
83  * software, derivative works or modified versions, and any portions
84  * thereof, and that both notices appear in supporting documentation.
85  *
86  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
87  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
88  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
89  *
90  * Carnegie Mellon requests users of this software to return to
91  *
92  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
93  *  School of Computer Science
94  *  Carnegie Mellon University
95  *  Pittsburgh PA 15213-3890
96  *
97  * any improvements or extensions that they make and grant Carnegie Mellon
98  * the rights to redistribute these changes.
99  */
100 /*
101  */
102 /*
103  * Mach Interface Generator errors
104  *
105  */
106 
107 #ifndef	_MACH_MIG_ERRORS_H_
108 #define _MACH_MIG_ERRORS_H_
109 
110 #include <sys/mach/kern_return.h>
111 #include <sys/mach/message.h>
112 #include <sys/mach/rpc.h>
113 #include <sys/mach/vm_types.h>
114 
115 /*
116  *	These error codes should be specified as system 4, subsytem 2.
117  *	But alas backwards compatibility makes that impossible.
118  *	The problem is old clients of new servers (eg, the kernel)
119  *	which get strange large error codes when there is a Mig problem
120  *	in the server.  Unfortunately, the IPC system doesn't have
121  *	the knowledge to convert the codes in this situation.
122  */
123 
124 #define MIG_TYPE_ERROR		-300	/* client type check failure */
125 #define MIG_REPLY_MISMATCH	-301	/* wrong reply message ID */
126 #define MIG_REMOTE_ERROR	-302	/* server detected error */
127 #define MIG_BAD_ID		-303	/* bad request message ID */
128 #define MIG_BAD_ARGUMENTS	-304	/* server type check failure */
129 #define MIG_NO_REPLY		-305	/* no reply should be send */
130 #define MIG_EXCEPTION		-306	/* server raised exception */
131 #define MIG_ARRAY_TOO_LARGE	-307	/* array not large enough */
132 #define MIG_SERVER_DIED		-308	/* server died */
133 #define MIG_TRAILER_ERROR       -309    /* trailer has an unknown format */
134 
135 #include <sys/mach/ndr.h>
136 
137 #pragma pack(4)
138 typedef struct {
139 	mach_msg_header_t	Head;
140 	NDR_record_t		NDR;
141 	kern_return_t		RetCode;
142 } mig_reply_error_t;
143 #pragma pack()
144 
145 typedef struct mig_symtab {
146 	char	*ms_routine_name;
147 	int	ms_routine_number;
148 	void    (*ms_routine)(void);	/* Since the functions in the
149 					 * symbol table have unknown
150 					 * signatures, this is the best
151 					 * we can do...
152 					 */
153 } mig_symtab_t;
154 
155 /* Client side reply port allocate */
156 extern mach_port_t mig_get_reply_port(void);
157 
158 /* Client side reply port deallocate */
159 extern void mig_dealloc_reply_port(mach_port_t reply_port);
160 
161 /* Client side reply port "deallocation" */
162 extern void mig_put_reply_port(mach_port_t reply_port);
163 
164 /* Allocate memory for out-of-stack mig structures */
165 extern char *mig_user_allocate(vm_size_t size);
166 
167 /* Deallocate memory used for out-of-stack mig structures */
168 extern void mig_user_deallocate(char *data, vm_size_t size);
169 
170 /* Bounded string copy */
171 extern int mig_strncpy(
172 	char	*dest,
173 	char	*src,
174 	int	len);
175 
176 #endif	/* _MACH_MIG_ERRORS_H_ */
177