MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / setSocketNonBlock

Method setSocketNonBlock

libapp2sys/src/main/cpp/localsocket.h:43–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41
42
43 static int setSocketNonBlock(int fd) {
44 int flags = fcntl(fd, F_GETFL, 0);
45 if (flags < 0) {
46 perr("setSocketNonBlock fcntl F_GETFL failed, fd:%d, flag:%d", fd, flags);
47 return -1;
48 }
49 int ret = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
50 if (ret < 0) {
51 perr("setSocketNonBlock fcntl F_SETFL failed, fd:%d, ret:%d ", fd, ret);
52 return -2;
53 }
54 return 0;
55 }
56
57 static int checkCanWrite(int fd) {
58 fd_set fdset;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected