| 1 | module net |
| 2 | |
| 3 | #include <unistd.h> |
| 4 | #include <sys/select.h> |
| 5 | // inet.h is needed for inet_ntop on macos |
| 6 | #include <arpa/inet.h> |
| 7 | #include <netdb.h> |
| 8 | #include <errno.h> |
| 9 | #include <fcntl.h> |
| 10 | #include <netinet/tcp.h> |
| 11 | |
| 12 | #flag solaris -lsocket |
| 13 | |
| 14 | const is_windows = false |
| 15 | |
| 16 | pub fn error_code() int { |
| 17 | return C.errno |
| 18 | } |
| 19 | |
| 20 | fn init() { |
| 21 | } |
| 22 | |
| 23 | pub const msg_nosignal = C.MSG_NOSIGNAL |
| 24 | pub const msg_dontwait = C.MSG_DONTWAIT |
| 25 | |
| 26 | pub const error_ewouldblock = int(C.EWOULDBLOCK) |
| 27 | pub const error_einprogress = int(C.EINPROGRESS) |
| 28 | pub const error_eagain = int(C.EAGAIN) |
| 29 | pub const error_eintr = int(C.EINTR) |
| 30 | |
| 31 | fn C.unlink(&char) i32 |
| 32 | |