Lines Matching refs:fd
33 * peek up to siz chars from fd into buf
34 * -1 returned if fd not peekable
36 * NOTE: cspeek() caches the peek state of fd
41 cspeek(register Cs_t* state, int fd, void* buf, size_t siz)
48 if (fd == -1)
59 if (fd != state->nostream)
68 if ((n = ioctl(fd, I_PEEK, &pk)) >= 0)
74 messagef((state->id, NiL, -1, "peek: %d: ioctl I_PEEK error", fd));
75 state->nostream = fd;
79 if (fd != state->nosocket)
81 if ((n = recv(fd, (char*)buf, siz, MSG_PEEK)) >= 0)
86 messagef((state->id, NiL, -1, "peek: %d: recv MSG_PEEK error", fd));
87 state->nosocket = fd;
90 messagef((state->id, NiL, -1, "peek: %d: no peek", fd));
95 _cs_peek(int fd, void* buf, size_t siz)
97 return cspeek(&cs, fd, buf, siz);