Lines Matching refs:fd

111     int fd);
115 static int nxt_unit_incoming_mmap(nxt_unit_ctx_t *ctx, pid_t pid, int fd);
172 static ssize_t nxt_unit_sendmsg(nxt_unit_ctx_t *ctx, int fd,
186 nxt_inline int nxt_unit_close(int fd);
187 static int nxt_unit_fd_blocking(int fd);
231 int fd[2]; member
986 recv_msg.fd[0] = -1; in nxt_unit_process_msg()
987 recv_msg.fd[1] = -1; in nxt_unit_process_msg()
989 rc = nxt_socket_msg_oob_get_fds(&rbuf->oob, recv_msg.fd); in nxt_unit_process_msg()
1015 recv_msg.fd[0], recv_msg.fd[1]); in nxt_unit_process_msg()
1046 recv_msg.fd[0] = -1; in nxt_unit_process_msg()
1047 recv_msg.fd[1] = -1; in nxt_unit_process_msg()
1086 port_msg->stream, recv_msg.fd[0]); in nxt_unit_process_msg()
1088 if (dup2(recv_msg.fd[0], lib->log_fd) == -1) { in nxt_unit_process_msg()
1090 port_msg->stream, recv_msg.fd[0], lib->log_fd, in nxt_unit_process_msg()
1101 if (nxt_slow_path(recv_msg.fd[0] < 0)) { in nxt_unit_process_msg()
1103 port_msg->stream, recv_msg.fd[0]); in nxt_unit_process_msg()
1109 rc = nxt_unit_incoming_mmap(ctx, port_msg->pid, recv_msg.fd[0]); in nxt_unit_process_msg()
1158 if (recv_msg.fd[0] != -1) { in nxt_unit_process_msg()
1159 nxt_unit_close(recv_msg.fd[0]); in nxt_unit_process_msg()
1162 if (recv_msg.fd[1] != -1) { in nxt_unit_process_msg()
1163 nxt_unit_close(recv_msg.fd[1]); in nxt_unit_process_msg()
1196 if (nxt_slow_path(recv_msg->fd[0] < 0)) { in nxt_unit_process_new_port()
1198 recv_msg->stream, recv_msg->fd[0]); in nxt_unit_process_new_port()
1207 (int) new_port_msg->id, recv_msg->fd[0], recv_msg->fd[1]); in nxt_unit_process_new_port()
1209 if (nxt_slow_path(nxt_unit_fd_blocking(recv_msg->fd[0]) != NXT_UNIT_OK)) { in nxt_unit_process_new_port()
1216 new_port.out_fd = recv_msg->fd[0]; in nxt_unit_process_new_port()
1219 MAP_SHARED, recv_msg->fd[1], 0); in nxt_unit_process_new_port()
1222 nxt_unit_alert(ctx, "mmap(%d) failed: %s (%d)", recv_msg->fd[1], in nxt_unit_process_new_port()
1230 recv_msg->fd[0] = -1; in nxt_unit_process_new_port()
1348 req->content_fd = recv_msg->fd[0]; in nxt_unit_process_req_headers()
1349 recv_msg->fd[0] = -1; in nxt_unit_process_req_headers()
1447 req->content_fd = recv_msg->fd[0]; in nxt_unit_process_req_body()
1448 recv_msg->fd[0] = -1; in nxt_unit_process_req_body()
3747 int i, fd, rc; in nxt_unit_new_mmap() local
3762 fd = nxt_unit_shm_open(ctx, PORT_MMAP_SIZE); in nxt_unit_new_mmap()
3763 if (nxt_slow_path(fd == -1)) { in nxt_unit_new_mmap()
3767 mem = mmap(NULL, PORT_MMAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in nxt_unit_new_mmap()
3769 nxt_unit_alert(ctx, "mmap(%d) failed: %s (%d)", fd, in nxt_unit_new_mmap()
3772 nxt_unit_close(fd); in nxt_unit_new_mmap()
3800 rc = nxt_unit_send_mmap(ctx, port, fd); in nxt_unit_new_mmap()
3810 nxt_unit_close(fd); in nxt_unit_new_mmap()
3829 int fd; in nxt_unit_shm_open() local
3842 fd = syscall(SYS_memfd_create, name, MFD_CLOEXEC); in nxt_unit_shm_open()
3843 if (nxt_slow_path(fd == -1)) { in nxt_unit_shm_open()
3850 nxt_unit_debug(ctx, "memfd_create(%s): %d", name, fd); in nxt_unit_shm_open()
3854 fd = shm_open(SHM_ANON, O_RDWR, S_IRUSR | S_IWUSR); in nxt_unit_shm_open()
3855 if (nxt_slow_path(fd == -1)) { in nxt_unit_shm_open()
3867 fd = shm_open(name, O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR); in nxt_unit_shm_open()
3868 if (nxt_slow_path(fd == -1)) { in nxt_unit_shm_open()
3886 if (nxt_slow_path(ftruncate(fd, size) == -1)) { in nxt_unit_shm_open()
3887 nxt_unit_alert(ctx, "ftruncate(%d) failed: %s (%d)", fd, in nxt_unit_shm_open()
3890 nxt_unit_close(fd); in nxt_unit_shm_open()
3895 return fd; in nxt_unit_shm_open()
3900 nxt_unit_send_mmap(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port, int fd) in nxt_unit_send_mmap() argument
3906 int fds[2] = {fd, -1}; in nxt_unit_send_mmap()
3999 nxt_unit_incoming_mmap(nxt_unit_ctx_t *ctx, pid_t pid, int fd) in nxt_unit_incoming_mmap() argument
4013 nxt_unit_debug(ctx, "incoming_mmap: fd %d from process %d", fd, (int) pid); in nxt_unit_incoming_mmap()
4015 if (fstat(fd, &mmap_stat) == -1) { in nxt_unit_incoming_mmap()
4016 nxt_unit_alert(ctx, "incoming_mmap: fstat(%d) failed: %s (%d)", fd, in nxt_unit_incoming_mmap()
4023 MAP_SHARED, fd, 0); in nxt_unit_incoming_mmap()
4660 fds[1].fd = lib->shared_port->in_fd; in nxt_unit_read_buf()
4669 fds[0].fd = ctx_impl->read_port->in_fd; in nxt_unit_read_buf()
4684 fds[0].fd, fds[1].fd, strerror(err), err); in nxt_unit_read_buf()
4692 fds[0].fd, fds[1].fd, nevents, fds[0].revents, in nxt_unit_read_buf()
4714 fds[0].fd, fds[1].fd, nevents, fds[0].revents, in nxt_unit_read_buf()
5995 nxt_unit_sendmsg(nxt_unit_ctx_t *ctx, int fd, in nxt_unit_sendmsg() argument
6007 n = nxt_sendmsg(fd, iov, 1, oob); in nxt_unit_sendmsg()
6021 fd, (int) buf_size, strerror(err), err); in nxt_unit_sendmsg()
6024 nxt_unit_debug(ctx, "sendmsg(%d, %d, %d): %d", fd, (int) buf_size, in nxt_unit_sendmsg()
6194 int fd, err; in nxt_unit_port_recv() local
6222 fd = port->in_fd; in nxt_unit_port_recv()
6226 rbuf->size = nxt_recvmsg(fd, iov, 1, &rbuf->oob); in nxt_unit_port_recv()
6237 fd, strerror(err), err); in nxt_unit_port_recv()
6243 fd, strerror(err), err); in nxt_unit_port_recv()
6248 nxt_unit_debug(ctx, "recvmsg(%d): %d", fd, (int) rbuf->size); in nxt_unit_port_recv()
6327 nxt_unit_close(int fd) in nxt_unit_close() argument
6331 res = close(fd); in nxt_unit_close()
6335 fd, strerror(errno), errno); in nxt_unit_close()
6338 nxt_unit_debug(NULL, "close(%d): %d", fd, res); in nxt_unit_close()
6346 nxt_unit_fd_blocking(int fd) in nxt_unit_fd_blocking() argument
6352 if (nxt_slow_path(ioctl(fd, FIONBIO, &nb) == -1)) { in nxt_unit_fd_blocking()
6354 fd, strerror(errno), errno); in nxt_unit_fd_blocking()