bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH gnumach 1/3] Use Mach native error codes instead of POSIX errno E


From: Guillem Jover
Subject: [PATCH gnumach 1/3] Use Mach native error codes instead of POSIX errno E* ones
Date: Thu, 1 Sep 2011 20:24:56 +0200

* device/errno.h: Remove file.
* Makefrag.am (libkernel_a_SOURCES): Remove `device/errno.h'.
* i386/i386at/com.c: Include <device/device_types.h> instead of
<device/errno.h>.
(comopen): Replace ENXIO with D_NO_SUCH_DEVICE.
* i386/i386at/kd_event.c: Include <device/device_types.h> instead of
<device/errno.h>.
* i386/i386at/kd_mouse.c: Likewise.
(mouseopen): Replace ENODEV with D_NO_SUCH_DEVICE and EBUSY with
D_ALREADY_OPEN.
* i386/i386at/lpr.c: Include <device/device_types.h> instead of
<device/errno.h>.
(lpropen): Replace ENXIO with D_NO_SUCH_DEVICE and EBUSY with
D_ALREADY_OPEN.
---
 Makefrag.am            |    1 -
 device/errno.h         |   45 ---------------------------------------------
 i386/i386at/com.c      |    6 +++---
 i386/i386at/kd_event.c |    2 +-
 i386/i386at/kd_mouse.c |    6 +++---
 i386/i386at/lpr.c      |    6 +++---
 6 files changed, 10 insertions(+), 56 deletions(-)
 delete mode 100644 device/errno.h

diff --git a/Makefrag.am b/Makefrag.am
index 5e26aa7..fc82b2c 100644
--- a/Makefrag.am
+++ b/Makefrag.am
@@ -280,7 +280,6 @@ libkernel_a_SOURCES += \
        device/device_types_kernel.h \
        device/ds_routines.c \
        device/ds_routines.h \
-       device/errno.h \
        device/if_ether.h \
        device/if_hdr.h \
        device/io_req.h \
diff --git a/device/errno.h b/device/errno.h
deleted file mode 100644
index e65aa98..0000000
--- a/device/errno.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
- *  School of Computer Science
- *  Carnegie Mellon University
- *  Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the  rights to redistribute these changes.
- */
-/*
- *     Author: David B. Golub, Carnegie Mellon University
- *     Date:   8/89
- *
- *     Old names for new error codes, for compatibility.
- */
-
-#ifndef        _ERRNO_
-#define        _ERRNO_
-
-#include <device/device_types.h>       /* the real error names */
-
-#define        EIO             D_IO_ERROR
-#define        ENXIO           D_NO_SUCH_DEVICE
-#define        EINVAL          D_INVALID_SIZE  /* XXX */
-#define        EBUSY           D_ALREADY_OPEN
-#define        ENOTTY          D_INVALID_OPERATION
-#define ENOMEM         D_NO_MEMORY
-
-#endif /* _ERRNO_ */
diff --git a/i386/i386at/com.c b/i386/i386at/com.c
index b1406f0..9ffe874 100644
--- a/i386/i386at/com.c
+++ b/i386/i386at/com.c
@@ -35,7 +35,7 @@
 #include <kern/mach_clock.h>
 #include <sys/time.h>
 #include <device/conf.h>
-#include <device/errno.h>
+#include <device/device_types.h>
 #include <device/tty.h>
 #include <device/io_req.h>
 
@@ -335,13 +335,13 @@ io_return_t comopen(
        io_return_t     result;
 
        if (unit >= NCOM)
-           return ENXIO;       /* no such device */
+           return D_NO_SUCH_DEVICE;    /* no such device */
        if ((isai = cominfo[unit]) == 0 || isai->alive == 0) {
            /*
             *  Try to probe it again
             */
            if (!com_reprobe(unit))
-               return ENXIO;
+               return D_NO_SUCH_DEVICE;
        }
        tp = &com_tty[unit];
 
diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c
index 3983a11..8ea313b 100644
--- a/i386/i386at/kd_event.c
+++ b/i386/i386at/kd_event.c
@@ -61,7 +61,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 #ifdef MACH_KERNEL
 #include <device/ds_routines.h>
-#include <device/errno.h>
+#include <device/device_types.h>
 #include <device/io_req.h>
 #else  /* MACH_KERNEL */
 #include <sys/file.h>
diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c
index 640209c..770a3fe 100644
--- a/i386/i386at/kd_mouse.c
+++ b/i386/i386at/kd_mouse.c
@@ -69,7 +69,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <kern/printf.h>
 #ifdef MACH_KERNEL
 #include <device/ds_routines.h>
-#include <device/errno.h>
+#include <device/device_types.h>
 #include <device/io_req.h>
 #include <device/subrs.h>
 #else  /* MACH_KERNEL */
@@ -179,10 +179,10 @@ mouseopen(dev, flags)
 #ifdef MACH_KERNEL
 #else  /* MACH_KERNEL */
        if (flags & FWRITE)
-               return(ENODEV);
+               return (D_NO_SUCH_DEVICE);
 #endif /* MACH_KERNEL */
        if (mouse_in_use)
-               return(EBUSY);
+               return (D_ALREADY_OPEN);
        mouse_in_use = TRUE;            /* locking? */
        kdq_reset(&mouse_queue);
        lastbuttons = MOUSE_ALL_UP;
diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c
index 8d077d5..cf76da2 100644
--- a/i386/i386at/lpr.c
+++ b/i386/i386at/lpr.c
@@ -37,7 +37,7 @@
 #include <kern/mach_clock.h>
 #include <sys/time.h>
 #include <device/conf.h>
-#include <device/errno.h>
+#include <device/device_types.h>
 #include <device/tty.h>
 #include <device/io_req.h>
 #else  /* MACH_KERNEL */
@@ -140,11 +140,11 @@ struct tty *tp;
 u_short addr;
   
        if (unit >= NLPR || (isai = lprinfo[unit]) == 0 || isai->alive == 0)
-               return(ENXIO);
+               return (D_NO_SUCH_DEVICE);
        tp = &lpr_tty[unit];
 #ifndef        MACH_KERNEL
        if (tp->t_state & TS_XCLUDE && u.u_uid != 0)
-               return(EBUSY);
+               return (D_ALREADY_OPEN);
 #endif /* MACH_KERNEL */
        addr = (u_short) isai->address;
        tp->t_dev = dev;
-- 
1.7.5.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]