define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / compiler / clib / __ioerr2errno.c
blob8cac7b6a9ea501d00d0ec0a568d8b76a37106a3d
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: errno internals
6 Lang: english
7 */
9 #include <dos/dos.h>
10 #include <dos/dosasl.h>
11 #include <dos/filesystem.h>
12 #include "__errno.h"
14 int IoErr2errno (int ioerr)
16 switch (ioerr)
18 case 0:
19 return 0;
21 case ERROR_OBJECT_WRONG_TYPE:
22 return EINVAL;
24 case ERROR_NO_FREE_STORE:
25 return ENOMEM;
27 case ERROR_DEVICE_NOT_MOUNTED:
28 case ERROR_OBJECT_NOT_FOUND:
29 return ENOENT;
31 case ERROR_WOULD_BLOCK:
32 return EAGAIN;
34 case ERROR_BROKEN_PIPE:
35 return EPIPE;
37 case ERROR_OBJECT_EXISTS:
38 return EEXIST;
40 case ERROR_BUFFER_OVERFLOW:
41 return ENOBUFS;
43 case ERROR_BREAK:
44 return EINTR;
46 case ERROR_FILE_NOT_OBJECT:
47 case ERROR_NOT_EXECUTABLE:
48 return ENOEXEC;
50 case ERROR_OBJECT_IN_USE:
51 return EBUSY;
53 case ERROR_DIR_NOT_FOUND:
54 return ENOTDIR;
56 case ERROR_RENAME_ACROSS_DEVICES:
57 return EXDEV;
60 return MAX_ERRNO+ioerr;
61 } /* IoErr2errno */