Back to index

glibc  2.9
error.h
Go to the documentation of this file.
00001 /*  err_hurd added by roland@gnu.ai.mit.edu for GNU Hurd.
00002  *
00003  * Mach Operating System
00004  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
00005  * All Rights Reserved.
00006  *
00007  * Permission to use, copy, modify and distribute this software and its
00008  * documentation is hereby granted, provided that both the copyright
00009  * notice and this permission notice appear in all copies of the
00010  * software, derivative works or modified versions, and any portions
00011  * thereof, and that both notices appear in supporting documentation.
00012  *
00013  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
00014  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
00015  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
00016  *
00017  * Carnegie Mellon requests users of this software to return to
00018  *
00019  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
00020  *  School of Computer Science
00021  *  Carnegie Mellon University
00022  *  Pittsburgh PA 15213-3890
00023  *
00024  * any improvements or extensions that they make and grant Carnegie Mellon
00025  * the rights to redistribute these changes.
00026  */
00027 /*
00028  * (pre-GNU) HISTORY
00029  *
00030  * Revision 2.6  93/01/14  17:41:31  danner
00031  *     Standardized include symbol name.
00032  *     [92/06/10            pds]
00033  *
00034  * Revision 2.5  92/03/31  15:18:11  rpd
00035  *     Added err_bootstrap for bootstrap errors.
00036  *     [92/03/09            rpd]
00037  *
00038  * Revision 2.4  91/05/14  16:51:24  mrt
00039  *     Correcting copyright
00040  *
00041  * Revision 2.3  91/02/05  17:31:48  mrt
00042  *     Changed to new Mach copyright
00043  *     [91/02/01  17:16:50  mrt]
00044  *
00045  * Revision 2.2  90/06/02  14:57:47  rpd
00046  *     Added err_mach_ipc for new IPC.
00047  *     [90/03/26  22:28:42  rpd]
00048  *
00049  * Revision 2.1  89/08/03  16:02:07  rwd
00050  * Created.
00051  *
00052  * Revision 2.4  89/02/25  18:13:18  gm0w
00053  *     Changes for cleanup.
00054  *
00055  * Revision 2.3  89/02/07  00:51:57  mwyoung
00056  * Relocated from sys/error.h
00057  *
00058  * Revision 2.2  88/10/18  00:37:31  mwyoung
00059  *     Added {system,sub and code}_emask
00060  *     [88/10/17  17:06:58  mrt]
00061  *
00062  *     Added {system,sub and code}_emask
00063  *
00064  *  12-May-88 Mary Thompson (mrt) at Carnegie Mellon
00065  *     Changed mach_error_t from unsigned int to kern_return_t
00066  *     which is a 32 bit integer regardless of machine type.
00067  *      unsigned int was incompatible with old usages of mach_error.
00068  *
00069  *  10-May-88 Douglas Orr (dorr) at Carnegie-Mellon University
00070  *     Missing endif replaced
00071  *
00072  *   5-May-88 Mary Thompson (mrt) at Carnegie Mellon
00073  *     Changed typedef of mach_error_t from long to unsigned int
00074  *     to keep our Camelot users happy. Also moved the nonkernel
00075  *     function declarations from here to mach_error.h.
00076  *
00077  *  10-Feb-88 Douglas Orr (dorr) at Carnegie-Mellon University
00078  *     Created.
00079  *
00080  */
00081 /*
00082  * File:      mach/error.h
00083  * Purpose:
00084  *     error module definitions
00085  *
00086  */
00087 
00088 #ifndef       _MACH_ERROR_H_
00089 #define _MACH_ERROR_H_
00090 #include <mach/kern_return.h>
00091 
00092 /*
00093  *     error number layout as follows:
00094  *
00095  *     hi                                 lo
00096  *     | system(6) | subsystem(12) | code(14) |
00097  */
00098 
00099 
00100 #define       err_none             (mach_error_t)0
00101 #define ERR_SUCCESS         (mach_error_t)0
00102 #define       ERR_ROUTINE_NIL             (mach_error_fn_t)0
00103 
00104 
00105 #define       err_system(x)        (((x)&0x3f)<<26)
00106 #define err_sub(x)          (((x)&0xfff)<<14)
00107 
00108 #define err_get_system(err) (((err)>>26)&0x3f)
00109 #define err_get_sub(err)    (((err)>>14)&0xfff)
00110 #define err_get_code(err)   ((err)&0x3fff)
00111 
00112 #define system_emask        (err_system(0x3f))
00113 #define sub_emask           (err_sub(0xfff))
00114 #define code_emask          (0x3fff)
00115 
00116 
00117 /*     major error systems  */
00118 #define       err_kern             err_system(0x0)             /* kernel */
00119 #define       err_us               err_system(0x1)             /* user space library */
00120 #define       err_server           err_system(0x2)             /* user space servers */
00121 #define       err_ipc                     err_system(0x3)             /* old ipc errors */
00122 #define err_mach_ipc        err_system(0x4)             /* mach-ipc errors */
00123 #define err_bootstrap              err_system(0x5)             /* bootstrap errors */
00124 #define err_hurd            err_system(0x10) /* GNU Hurd server errors */
00125 #define err_local           err_system(0x3e)     /* user defined errors */
00126 #define       err_ipc_compat              err_system(0x3f)     /* (compatibility) mach-ipc errors */
00127 
00128 #define       err_max_system              0x3f
00129 
00130 
00131 /*     unix errors get lumped into one subsystem  */
00132 #define       unix_err(errno)             (err_kern|err_sub(3)|errno)
00133 
00134 typedef       kern_return_t mach_error_t;
00135 /* typedef mach_error_t     (* mach_error_fn_t)(); */
00136 
00137 #endif /* _MACH_ERROR_H_ */