Lines Matching defs:fd

187 dhcp_ipc_recv_msg(int fd, void **msg, uint32_t base_length, int msec)
193 retval = dhcp_ipc_timed_read(fd, &length, sizeof (uint32_t), &msec);
204 retval = dhcp_ipc_timed_read(fd, *msg, length, &msec);
239 dhcp_ipc_recv_request(int fd, dhcp_ipc_request_t **request, int msec)
243 retval = dhcp_ipc_recv_msg(fd, (void **)request, DHCP_IPC_REQUEST_SIZE,
265 dhcp_ipc_recv_reply(int fd, dhcp_ipc_reply_t **reply, int32_t timeout)
290 return (dhcp_ipc_recv_msg(fd, (void **)reply, DHCP_IPC_REPLY_SIZE,
304 dhcp_ipc_send_msg(int fd, void *msg, uint32_t message_length)
313 if (writev(fd, iovec, sizeof (iovec) / sizeof (*iovec)) == -1)
328 dhcp_ipc_send_reply(int fd, dhcp_ipc_reply_t *reply)
330 return (dhcp_ipc_send_msg(fd, reply, DHCP_IPC_REPLY_SIZE +
343 dhcp_ipc_send_request(int fd, dhcp_ipc_request_t *request)
353 return (dhcp_ipc_send_msg(fd, request, DHCP_IPC_REQUEST_SIZE +
372 int fd, on, retval;
375 fd = socket(AF_INET, SOCK_STREAM, 0);
376 if (fd == -1)
384 (void) setsockopt(fd, IPPROTO_TCP, TCP_ANONPRIVBIND, &on, sizeof (on));
388 if (bind(fd, (struct sockaddr *)&sinv, sizeof (sinv)) == -1) {
389 (void) dhcp_ipc_close(fd);
395 retval = connect(fd, (struct sockaddr *)&sinv, sizeof (sinv));
397 (void) dhcp_ipc_close(fd);
403 retval = dhcp_ipc_send_request(fd, request);
405 retval = dhcp_ipc_recv_reply(fd, reply, timeout);
407 (void) dhcp_ipc_close(fd);
468 dhcp_ipc_accept(int listen_fd, int *fd, int *is_priv)
488 *fd = accept(listen_fd, (struct sockaddr *)&sin_peer, &sin_len);
489 if (*fd == -1)
504 if ((sockflags = fcntl(*fd, F_GETFL, 0)) == -1) {
505 (void) close(*fd);
509 if (fcntl(*fd, F_SETFL, sockflags | O_NONBLOCK) == -1) {
510 (void) close(*fd);
525 dhcp_ipc_close(int fd)
527 return ((close(fd) == -1) ? DHCP_IPC_E_CLOSE : 0);
973 dhcp_ipc_timed_read(int fd, void *buffer, unsigned int length, int *msec)
981 pollfd.fd = fd;
1015 n_read = read(fd, (caddr_t)buffer + n_total, length - n_total);