Lines Matching refs:fd

128 static int	setopt(int fd, int level, int name, int value);
129 static int get_opt(int fd, int level, int name);
130 static void nfslib_set_sockbuf(int fd);
140 int fd; in nfslib_transport_open() local
152 fd = t_open(nconf->nc_device, O_RDWR, (struct t_info *)NULL); in nfslib_transport_open()
153 if (fd == -1) { in nfslib_transport_open()
157 fd = t_open(nconf->nc_device, O_RDWR, in nfslib_transport_open()
160 if (fd == -1) { in nfslib_transport_open()
171 if (ioctl(fd, I_POP, 0) < 0) { in nfslib_transport_open()
173 (void) t_close(fd); in nfslib_transport_open()
180 if (ioctl(fd, I_PUSH, "rpcmod") < 0) { in nfslib_transport_open()
182 (void) t_close(fd); in nfslib_transport_open()
192 if (ioctl(fd, I_STR, &strioc) < 0) { in nfslib_transport_open()
194 (void) t_close(fd); in nfslib_transport_open()
202 if (ioctl(fd, I_PUSH, "timod") < 0) { in nfslib_transport_open()
204 (void) t_close(fd); in nfslib_transport_open()
212 __rpc_tli_set_options(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, 1); in nfslib_transport_open()
214 __rpc_tli_set_options(fd, IPPROTO_IP, IP_RECVDSTADDR, 1); in nfslib_transport_open()
216 return (fd); in nfslib_transport_open()
248 nfslib_set_sockbuf(int fd) in nfslib_set_sockbuf() argument
254 curval = get_opt(fd, SOL_SOCKET, SO_SNDBUF); in nfslib_set_sockbuf()
258 if (setopt(fd, SOL_SOCKET, SO_SNDBUF, val) < 0) { in nfslib_set_sockbuf()
267 curval = get_opt(fd, SOL_SOCKET, SO_RCVBUF); in nfslib_set_sockbuf()
271 if (setopt(fd, SOL_SOCKET, SO_RCVBUF, val) < 0) { in nfslib_set_sockbuf()
285 int fd; in nfslib_bindit() local
295 if ((fd = nfslib_transport_open(nconf)) == -1) { in nfslib_bindit()
316 (void) t_close(fd); in nfslib_bindit()
329 if (reuseaddr(fd) == -1) { in nfslib_bindit()
337 if (recvucred(fd) == -1) { in nfslib_bindit()
347 if (anonmlp(fd) == -1) { in nfslib_bindit()
355 (void) t_close(fd); in nfslib_bindit()
366 ntb = (struct t_bind *)t_alloc(fd, T_BIND, T_ALL); in nfslib_bindit()
369 (void) t_close(fd); in nfslib_bindit()
382 if (t_bind(fd, &tb, ntb) == -1) { in nfslib_bindit()
386 (void) t_close(fd); in nfslib_bindit()
397 (void) t_close(fd); in nfslib_bindit()
409 (*Mysvc4)(fd, NULL, nconf, NFS4_SETPORT, &ntb->addr); in nfslib_bindit()
437 if (t_optmgmt(fd, &req, &resp) < 0 || in nfslib_bindit()
444 nfslib_set_sockbuf(fd); in nfslib_bindit()
447 return (fd); in nfslib_bindit()
451 get_opt(int fd, int level, int name) in get_opt() argument
472 if (t_optmgmt(fd, &req, &res) < 0 || res.flags != T_SUCCESS) { in get_opt()
480 setopt(int fd, int level, int name, int value) in setopt() argument
502 if (t_optmgmt(fd, &req, &resp) < 0 || resp.flags != T_SUCCESS) { in setopt()
510 reuseaddr(int fd) in reuseaddr() argument
512 return (setopt(fd, SOL_SOCKET, SO_REUSEADDR, 1)); in reuseaddr()
516 recvucred(int fd) in recvucred() argument
518 return (setopt(fd, SOL_SOCKET, SO_RECVUCRED, 1)); in recvucred()
522 anonmlp(int fd) in anonmlp() argument
524 return (setopt(fd, SOL_SOCKET, SO_ANON_MLP, 1)); in anonmlp()
528 nfslib_log_tli_error(char *tli_name, int fd, struct netconfig *nconf) in nfslib_log_tli_error() argument
539 tli_name, fd, nconf->nc_proto); in nfslib_log_tli_error()
543 tli_name, fd, nconf->nc_proto, t_errno); in nfslib_log_tli_error()
729 poll_array[i].fd, i); in poll_for_action()
732 poll_array[i].fd, i); in poll_for_action()
745 poll_array[i].fd, in poll_for_action()
747 (void) t_close(poll_array[i].fd); in poll_for_action()
748 remove_from_poll_list(poll_array[i].fd); in poll_for_action()
764 add_to_poll_list(int fd, struct netconfig *nconf) in add_to_poll_list() argument
813 poll_array[num_fds].fd = fd; in add_to_poll_list()
827 if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) { in add_to_poll_list()
841 remove_from_poll_list(int fd) in remove_from_poll_list() argument
847 if (poll_array[i].fd == fd) { in remove_from_poll_list()
872 do_poll_clts_action(int fd, int conn_index) in do_poll_clts_action() argument
906 if (oldfd != fd) { in do_poll_clts_action()
907 oldfd = fd; in do_poll_clts_action()
924 unitdata = (struct t_unitdata *)t_alloc(fd, T_UNITDATA, T_ALL); in do_poll_clts_action()
936 fd, nconf->nc_proto); in do_poll_clts_action()
941 fd, nconf->nc_proto, t_errno); in do_poll_clts_action()
963 ret = t_rcvudata(fd, unitdata, &flags); in do_poll_clts_action()
967 fd, nconf->nc_proto, unitdata->udata.len); in do_poll_clts_action()
993 fd, nconf->nc_proto); in do_poll_clts_action()
1000 fd, nconf->nc_proto, t_errno); in do_poll_clts_action()
1004 ret = t_look(fd); in do_poll_clts_action()
1022 fd, nconf->nc_proto); in do_poll_clts_action()
1027 fd, nconf->nc_proto, t_errno); in do_poll_clts_action()
1034 fd, nconf->nc_proto, ret, T_UDERR); in do_poll_clts_action()
1039 uderr = (struct t_uderr *)t_alloc(fd, T_UDERROR, T_ALL); in do_poll_clts_action()
1051 fd, nconf->nc_proto); in do_poll_clts_action()
1056 fd, nconf->nc_proto, t_errno); in do_poll_clts_action()
1061 ret = t_rcvuderr(fd, uderr); in do_poll_clts_action()
1078 fd, nconf->nc_proto); in do_poll_clts_action()
1131 fd, nconf->nc_proto); in do_poll_clts_action()
1136 fd, nconf->nc_proto, t_errno); in do_poll_clts_action()
1149 fd, nconf->nc_proto); in do_poll_clts_action()
1161 ret = getmsg(fd, ctl, data, &flags); in do_poll_clts_action()
1172 int fd; in conn_close_oldest() local
1187 num_conns, poll_array[i1].fd); in conn_close_oldest()
1190 num_conns, poll_array[i1].fd); in conn_close_oldest()
1192 fd = poll_array[i1].fd; in conn_close_oldest()
1198 (void) t_snddis(fd, (struct t_call *)0); in conn_close_oldest()
1200 remove_from_poll_list(fd); in conn_close_oldest()
1201 (void) t_close(fd); in conn_close_oldest()
1208 if (t_sndrel(fd) == 0) in conn_close_oldest()
1214 conn_get(int fd, struct netconfig *nconf, struct conn_ind **connp) in conn_get() argument
1226 conn->conn_call = (struct t_call *)t_alloc(fd, T_CALL, T_ALL); in conn_get()
1229 nfslib_log_tli_error("t_alloc", fd, nconf); in conn_get()
1233 if (t_listen(fd, conn->conn_call) == -1) { in conn_get()
1234 nfslib_log_tli_error("t_listen", fd, nconf); in conn_get()
1246 (void) t_snddis(fd, conn->conn_call); in conn_get()
1266 discon_get(int fd, struct netconfig *nconf, struct conn_ind **connp) in discon_get() argument
1273 if (t_rcvdis(fd, &discon) == -1) { in discon_get()
1274 nfslib_log_tli_error("t_rcvdis", fd, nconf); in discon_get()
1303 cots_listen_event(int fd, int conn_index) in cots_listen_event() argument
1318 (void) conn_get(fd, nconf, &conn_head); in cots_listen_event()
1348 (void) t_snddis(fd, call); in cots_listen_event()
1359 (void) t_snddis(fd, call); in cots_listen_event()
1365 while (t_accept(fd, new_fd, call) == -1) { in cots_listen_event()
1368 nfslib_log_tli_error("t_accept", fd, nconf); in cots_listen_event()
1371 (void) t_snddis(fd, call); in cots_listen_event()
1376 while (event = t_look(fd)) { in cots_listen_event()
1383 (void) conn_get(fd, nconf, &conn_head); in cots_listen_event()
1391 (void) discon_get(fd, nconf, in cots_listen_event()
1399 (void) t_snddis(fd, call); in cots_listen_event()
1480 do_poll_cots_action(int fd, int conn_index) in do_poll_cots_action() argument
1490 while (event = t_look(fd)) { in do_poll_cots_action()
1494 printf("do_poll_cots_action(%s,%d): T_LISTEN event\n", nconf->nc_proto, fd); in do_poll_cots_action()
1496 cots_listen_event(fd, conn_index); in do_poll_cots_action()
1501 printf("do_poll_cots_action(%d,%s): T_DATA event\n", fd, nconf->nc_proto); in do_poll_cots_action()
1506 i1 = t_rcv(fd, buf, sizeof (buf), &flags); in do_poll_cots_action()
1525 printf("do_poll_cots_action(%s,%d): ", nconf->nc_proto, fd); in do_poll_cots_action()
1530 (void) t_snddis(fd, (struct t_call *)0); in do_poll_cots_action()
1540 if (t_sndrel(fd) == -1) { in do_poll_cots_action()
1552 printf("do_poll_cots_action(%s,%d): T_ORDREL event\n", nconf->nc_proto, fd); in do_poll_cots_action()
1555 if (t_rcvrel(fd) == 0) { in do_poll_cots_action()
1558 (void) t_sndrel(fd); in do_poll_cots_action()
1566 nfslib_log_tli_error("t_rcvrel", fd, nconf); in do_poll_cots_action()
1580 printf("do_poll_cots_action(%s,%d): T_DISCONNECT event\n", nconf->nc_proto, fd); in do_poll_cots_action()
1582 if (t_rcvdis(fd, (struct t_discon *)NULL) == -1) in do_poll_cots_action()
1583 nfslib_log_tli_error("t_rcvdis", fd, nconf); in do_poll_cots_action()
1607 event, nconf->nc_proto, fd, errorstr); in do_poll_cots_action()
1610 remove_from_poll_list(fd); in do_poll_cots_action()
1611 (void) t_close(fd); in do_poll_cots_action()
1707 set_addrmask(int fd, in set_addrmask() argument
1716 if (t_getinfo(fd, &info) < 0) { in set_addrmask()