| 135 | #if defined(__linux__) |
| 136 | |
| 137 | Status Socket::Init(int family, int flags) { |
| 138 | int nonblocking_flag = (flags & FLAG_NONBLOCKING) ? SOCK_NONBLOCK : 0; |
| 139 | Reset(::socket(family, SOCK_STREAM | SOCK_CLOEXEC | nonblocking_flag, 0)); |
| 140 | if (fd_ < 0) { |
| 141 | int err = errno; |
| 142 | return Status::NetworkError("error opening socket", ErrnoToString(err), err); |
| 143 | } |
| 144 | |
| 145 | return Status::OK(); |
| 146 | } |
| 147 | |
| 148 | #else |
| 149 |