Free Electron
error.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __platform_error_h__
8 #define __platform_error_h__
9 
10 #if FE_OS==FE_WIN32 || FE_OS==FE_WIN64
11 
12 #define FE_ERRNO WSAGetLastError()
13 #define FE_BEGIN_SIGNAL_REDO_LOOP(); do{
14 #define FE_END_SIGNAL_REDO_LOOP(if_error) } while ((if_error) && (FE_ERRNO == WSAEINTR))
15 #define FE_UNDEFINED_ERROR 0xFFF0
16 #define FE_EWOULDBLOCK WSAEWOULDBLOCK
17 #define FE_EBADF WSAEBADF
18 #define FE_ENOTSOCK WSAENOTSOCK
19 #define FE_EINTR WSAEINTR
20 #define FE_ENODEV FE_UNDEFINED_ERROR+0
21 #define FE_EOPNOTSUPP WSAEOPNOTSUPP
22 #define FE_EPROTO FE_UNDEFINED_ERROR+1
23 #define FE_ENOMEM FE_UNDEFINED_ERROR+2
24 #define FE_ENOSR FE_UNDEFINED_ERROR+3
25 #define FE_EACCES WSAEACCES
26 #define FE_EADDRINUSE WSAEADDRINUSE
27 #define FE_EADDRNOTAVAIL WSAEADDRNOTAVAIL
28 #define FE_EAFNOSUPPORT WSAEAFNOSUPPORT
29 #define FE_ENOENT FE_UNDEFINED_ERROR+4
30 #define FE_ECONNREFUSED WSAECONNREFUSED
31 #define FE_EINPROGRESS WSAEINPROGRESS
32 #define FE_EINVAL WSAEINVAL
33 #define FE_EIO FE_UNDEFINED_ERROR+5
34 #define FE_ENXIO FE_UNDEFINED_ERROR+6
35 #define FE_ECONNRESET WSAECONNRESET
36 #define FE_EISCONN WSAEISCONN
37 #define FE_ENETUNREACH WSAENETUNREACH
38 #define FE_ETIMEDOUT WSAETIMEDOUT
39 #define FE_EMFILE WSAEMFILE
40 #define FE_EPROTONOSUPPORT WSAEPROTONOSUPPORT
41 #define FE_ESTALE WSAESTALE
42 #define FE_EMSGSIZE WSAEMSGSIZE
43 #define FE_EPIPE FE_UNDEFINED_ERROR+7
44 #define FE_ENOTINIT WSANOTINITIALISED
45 #endif
46 
47 //* GENERAL LINUX
48 #if FE_OS==FE_LINUX || FE_OS==FE_OSX
49 
50 #define GLAPIENTRY
51 //#define GLAPI
52 
53 #define FE_ERRNO errno
54 #define FE_BEGIN_SIGNAL_REDO_LOOP(); do{
55 #define FE_END_SIGNAL_REDO_LOOP(if_error) } while ((if_error) && (FE_ERRNO == EINTR))
56 #define FE_EWOULDBLOCK EWOULDBLOCK
57 #define FE_EBADF EBADF
58 #define FE_ENOTSOCK ENOTSOCK
59 #define FE_EINTR EINTR
60 #define FE_ENODEV ENODEV
61 #define FE_EOPNOTSUPP EOPNOTSUPP
62 #define FE_EPROTO EPROTO
63 #define FE_ENOMEM ENOMEM
64 #define FE_ENOSR ENOSR
65 #define FE_EACCES EACCES
66 #define FE_EADDRINUSE EADDRINUSE
67 #define FE_EADDRNOTAVAIL EADDRNOTAVAIL
68 #define FE_EAFNOSUPPORT EAFNOSUPPORT
69 #define FE_ENOENT ENOENT
70 #define FE_ECONNREFUSED ECONNREFUSED
71 #define FE_EINPROGRESS EINPROGRESS
72 #define FE_EINVAL EINVAL
73 #define FE_EIO EIO
74 #define FE_ENXIO ENXIO
75 #define FE_ECONNRESET ECONNRESET
76 #define FE_EISCONN EISCONN
77 #define FE_ENETUNREACH ENETUNREACH
78 #define FE_ETIMEDOUT ETIMEDOUT
79 #define FE_EMFILE EMFILE
80 #define FE_EPROTONOSUPPORT EPROTONOSUPPORT
81 #define FE_ESTALE ESTALE
82 #define FE_EMSGSIZE EMSGSIZE
83 #define FE_EPIPE EPIPE
84 #define FE_ENOTINIT FE_UNDEFINED_ERROR
85 #endif
86 
87 
88 //* SYSTEM DEPENDENT FUNCTION NAMES
89 #if FE_OS==FE_WIN32 || FE_OS==FE_WIN64
90 #define FE_VSNPRINTF _vsnprintf
91 #define FE_SNPRINTF _snprintf
92 #endif
93 
94 #if FE_OS==FE_LINUX || FE_OS==FE_OSX
95 #define FE_VSNPRINTF vsnprintf
96 #define FE_SNPRINTF snprintf
97 #endif
98 
99 #endif /* __platform_error_h__ */