| 1 | #ifndef __IPHLWRAP_H__
|
|---|
| 2 | #define __IPHLWRAP_H__
|
|---|
| 3 |
|
|---|
| 4 | #include <sys\socket.h>
|
|---|
| 5 | #include <sys\ioctl.h>
|
|---|
| 6 | #include <netdb.h>
|
|---|
| 7 | #include <netinet\in.h>
|
|---|
| 8 | #include <netinet\tcp.h>
|
|---|
| 9 | #include <nerrno.h>
|
|---|
| 10 |
|
|---|
| 11 | int _System os2_ioctl (int, unsigned long, char *, int);
|
|---|
| 12 |
|
|---|
| 13 | inline int _os2_ioctl (int a, unsigned long b, char *c, int d)
|
|---|
| 14 | {
|
|---|
| 15 | int yyrc;
|
|---|
| 16 | USHORT sel = RestoreOS2FS();
|
|---|
| 17 |
|
|---|
| 18 | yyrc = os2_ioctl(a, b, c, d);
|
|---|
| 19 | SetFS(sel);
|
|---|
| 20 |
|
|---|
| 21 | return yyrc;
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | #undef os2_ioctl
|
|---|
| 25 | #define os2_ioctl _os2_ioctl
|
|---|
| 26 |
|
|---|
| 27 | inline int _ioctl(int a, int b, char *c, int d)
|
|---|
| 28 | {
|
|---|
| 29 | int yyrc;
|
|---|
| 30 | USHORT sel = RestoreOS2FS();
|
|---|
| 31 |
|
|---|
| 32 | yyrc = ioctl(a, b, c, d);
|
|---|
| 33 | SetFS(sel);
|
|---|
| 34 |
|
|---|
| 35 | return yyrc;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | #undef ioctl
|
|---|
| 39 | #define ioctl _ioctl
|
|---|
| 40 |
|
|---|
| 41 | inline int _res_init(void)
|
|---|
| 42 | {
|
|---|
| 43 | int yyrc;
|
|---|
| 44 | USHORT sel = RestoreOS2FS();
|
|---|
| 45 |
|
|---|
| 46 | yyrc = res_init();
|
|---|
| 47 | SetFS(sel);
|
|---|
| 48 |
|
|---|
| 49 | return yyrc;
|
|---|
| 50 | }
|
|---|
| 51 | #undef res_init
|
|---|
| 52 | #define res_init _res_init
|
|---|
| 53 |
|
|---|
| 54 | inline int _sock_init()
|
|---|
| 55 | {
|
|---|
| 56 | int yyrc;
|
|---|
| 57 | USHORT sel = RestoreOS2FS();
|
|---|
| 58 |
|
|---|
| 59 | yyrc = sock_init();
|
|---|
| 60 | SetFS(sel);
|
|---|
| 61 |
|
|---|
| 62 | return yyrc;
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | #undef sock_init
|
|---|
| 66 | #define sock_init _sock_init
|
|---|
| 67 |
|
|---|
| 68 | inline int _sock_errno()
|
|---|
| 69 | {
|
|---|
| 70 | int yyrc;
|
|---|
| 71 | USHORT sel = RestoreOS2FS();
|
|---|
| 72 |
|
|---|
| 73 | yyrc = sock_errno();
|
|---|
| 74 | SetFS(sel);
|
|---|
| 75 |
|
|---|
| 76 | return yyrc;
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | #undef sock_errno
|
|---|
| 80 | #define sock_errno _sock_errno
|
|---|
| 81 |
|
|---|
| 82 | inline void _psock_errno(char *a)
|
|---|
| 83 | {
|
|---|
| 84 | USHORT sel = RestoreOS2FS();
|
|---|
| 85 |
|
|---|
| 86 | psock_errno(a);
|
|---|
| 87 | SetFS(sel);
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | #undef psock_errno
|
|---|
| 91 | #define psock_errno _psock_errno
|
|---|
| 92 |
|
|---|
| 93 | inline int _socket(int a, int b, int c)
|
|---|
| 94 | {
|
|---|
| 95 | int yyrc;
|
|---|
| 96 | USHORT sel = RestoreOS2FS();
|
|---|
| 97 |
|
|---|
| 98 | yyrc = socket(a, b, c);
|
|---|
| 99 | SetFS(sel);
|
|---|
| 100 |
|
|---|
| 101 | return yyrc;
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | #undef socket
|
|---|
| 105 | #define socket _socket
|
|---|
| 106 |
|
|---|
| 107 | inline int _soclose(int a)
|
|---|
| 108 | {
|
|---|
| 109 | int yyrc;
|
|---|
| 110 | USHORT sel = RestoreOS2FS();
|
|---|
| 111 |
|
|---|
| 112 | yyrc = soclose(a);
|
|---|
| 113 | SetFS(sel);
|
|---|
| 114 |
|
|---|
| 115 | return yyrc;
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | #undef soclose
|
|---|
| 119 | #define soclose _soclose
|
|---|
| 120 |
|
|---|
| 121 | inline int _so_cancel(int a)
|
|---|
| 122 | {
|
|---|
| 123 | int yyrc;
|
|---|
| 124 | USHORT sel = RestoreOS2FS();
|
|---|
| 125 |
|
|---|
| 126 | yyrc = so_cancel(a);
|
|---|
| 127 | SetFS(sel);
|
|---|
| 128 |
|
|---|
| 129 | return yyrc;
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | #undef so_cancel
|
|---|
| 133 | #define so_cancel _so_cancel
|
|---|
| 134 |
|
|---|
| 135 | inline int _gethostname(char *a, int b)
|
|---|
| 136 | {
|
|---|
| 137 | int yyrc;
|
|---|
| 138 | USHORT sel = RestoreOS2FS();
|
|---|
| 139 |
|
|---|
| 140 | yyrc = gethostname(a, b);
|
|---|
| 141 | SetFS(sel);
|
|---|
| 142 |
|
|---|
| 143 | return yyrc;
|
|---|
| 144 | }
|
|---|
| 145 |
|
|---|
| 146 | #undef gethostname
|
|---|
| 147 | #define gethostname _gethostname
|
|---|
| 148 |
|
|---|
| 149 | inline struct hostent *_gethostbyname(char *a)
|
|---|
| 150 | {
|
|---|
| 151 | struct hostent * yyrc;
|
|---|
| 152 | USHORT sel = RestoreOS2FS();
|
|---|
| 153 |
|
|---|
| 154 | yyrc = gethostbyname(a);
|
|---|
| 155 | SetFS(sel);
|
|---|
| 156 |
|
|---|
| 157 | return yyrc;
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 | #undef gethostbyname
|
|---|
| 161 | #define gethostbyname _gethostbyname
|
|---|
| 162 |
|
|---|
| 163 | inline struct hostent *_gethostbyaddr(char *a, int b, int c)
|
|---|
| 164 | {
|
|---|
| 165 | struct hostent * yyrc;
|
|---|
| 166 | USHORT sel = RestoreOS2FS();
|
|---|
| 167 |
|
|---|
| 168 | yyrc = gethostbyaddr(a, b, c);
|
|---|
| 169 | SetFS(sel);
|
|---|
| 170 |
|
|---|
| 171 | return yyrc;
|
|---|
| 172 | }
|
|---|
| 173 |
|
|---|
| 174 | #undef gethostbyaddr
|
|---|
| 175 | #define gethostbyaddr _gethostbyaddr
|
|---|
| 176 |
|
|---|
| 177 | #endif
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|