Lines Matching refs:fd
54 int fd;
60 fd = socket(AF_INET, SOCK_STREAM, 0);
61 if (fd == -1)
71 (void) setsockopt(fd, IPPROTO_TCP, TCP_ANONPRIVBIND, &on, sizeof (on));
81 if (bind(fd, (struct sockaddr *)&sin, sizeof (sin)) == -1)
90 if (connect(fd, (struct sockaddr *)&sin, sizeof (sin)) == -1) {
92 (void) close(fd);
101 flags = fcntl(fd, F_GETFL, 0);
103 (void) fcntl(fd, F_SETFL, flags | O_NONBLOCK);
105 *fdp = fd;
109 (void) close(fd);
115 * Read the TLV triplet from descriptor `fd' and store its type, length and
121 ipmp_readtlv(int fd, ipmp_infotype_t *typep, size_t *lenp, void **valuep,
127 retval = ipmp_read(fd, typep, sizeof (*typep), endtp);
131 retval = ipmp_read(fd, lenp, sizeof (*lenp), endtp);
143 (void) ipmp_read(fd, value, *lenp, endtp);
147 retval = ipmp_read(fd, value, *lenp, endtp);
158 * Write `buflen' bytes from `buffer' to open file `fd'. Returns IPMP_SUCCESS
162 ipmp_write(int fd, const void *buffer, size_t buflen)
169 nbytes = write(fd, &buf[nwritten], buflen - nwritten);
184 * `fd'. Returns an IPMP error code.
187 ipmp_writetlv(int fd, ipmp_infotype_t type, size_t len, void *value)
191 retval = ipmp_write(fd, &type, sizeof (type));
195 retval = ipmp_write(fd, &len, sizeof (len));
199 return (ipmp_write(fd, value, len));
203 * Attempt to read `buflen' worth of bytes from `fd' into the buffer pointed
208 ipmp_read(int fd, void *buffer, size_t buflen, const struct timeval *endtp)
237 pfd.fd = fd;
253 prbytes = read(fd, (caddr_t)buffer + nbytes, buflen - nbytes);