6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2012 by Delphix. All rights reserved.
25 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
26 */
27
28
29 /*
30 * nfs_tbind.c, common part for nfsd and lockd.
31 */
32
33 #include <tiuser.h>
34 #include <fcntl.h>
35 #include <netconfig.h>
36 #include <stropts.h>
37 #include <errno.h>
38 #include <syslog.h>
39 #include <rpc/rpc.h>
40 #include <sys/time.h>
41 #include <sys/resource.h>
42 #include <signal.h>
43 #include <netdir.h>
44 #include <unistd.h>
45 #include <string.h>
1572 break;
1573 else
1574 goto fdclose;
1575 }
1576
1577 case T_DISCONNECT:
1578 #ifdef DEBUG
1579 printf("do_poll_cots_action(%s,%d): T_DISCONNECT event\n", nconf->nc_proto, fd);
1580 #endif
1581 if (t_rcvdis(fd, (struct t_discon *)NULL) == -1)
1582 nfslib_log_tli_error("t_rcvdis", fd, nconf);
1583
1584 /*
1585 * T_DISCONNECT on listen fd's should be ignored.
1586 */
1587 if (is_listen_fd_index(conn_index))
1588 break;
1589 else
1590 goto fdclose;
1591
1592 case T_ERROR:
1593 default:
1594 if (event == T_ERROR || t_errno == TSYSERR) {
1595 if ((errorstr = strerror(errno)) == NULL) {
1596 (void) sprintf(buf,
1597 "Unknown error num %d", errno);
1598 errorstr = (const char *) buf;
1599 }
1600 } else if (event == -1)
1601 errorstr = t_strerror(t_errno);
1602 else
1603 errorstr = "";
1604 syslog(LOG_ERR,
1605 "unexpected TLI event (0x%x) on "
1606 "connection-oriented transport(%s,%d):%s",
1607 event, nconf->nc_proto, fd, errorstr);
1608 fdclose:
1609 num_conns--;
1610 remove_from_poll_list(fd);
1611 (void) t_close(fd);
1612 return (0);
1613 }
1614 }
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2012 by Delphix. All rights reserved.
25 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2014 Gary Mills
27 */
28
29
30 /*
31 * nfs_tbind.c, common part for nfsd and lockd.
32 */
33
34 #include <tiuser.h>
35 #include <fcntl.h>
36 #include <netconfig.h>
37 #include <stropts.h>
38 #include <errno.h>
39 #include <syslog.h>
40 #include <rpc/rpc.h>
41 #include <sys/time.h>
42 #include <sys/resource.h>
43 #include <signal.h>
44 #include <netdir.h>
45 #include <unistd.h>
46 #include <string.h>
1573 break;
1574 else
1575 goto fdclose;
1576 }
1577
1578 case T_DISCONNECT:
1579 #ifdef DEBUG
1580 printf("do_poll_cots_action(%s,%d): T_DISCONNECT event\n", nconf->nc_proto, fd);
1581 #endif
1582 if (t_rcvdis(fd, (struct t_discon *)NULL) == -1)
1583 nfslib_log_tli_error("t_rcvdis", fd, nconf);
1584
1585 /*
1586 * T_DISCONNECT on listen fd's should be ignored.
1587 */
1588 if (is_listen_fd_index(conn_index))
1589 break;
1590 else
1591 goto fdclose;
1592
1593 default:
1594 if (t_errno == TSYSERR) {
1595 if ((errorstr = strerror(errno)) == NULL) {
1596 (void) sprintf(buf,
1597 "Unknown error num %d", errno);
1598 errorstr = (const char *) buf;
1599 }
1600 } else if (event == -1)
1601 errorstr = t_strerror(t_errno);
1602 else
1603 errorstr = "";
1604 syslog(LOG_ERR,
1605 "unexpected TLI event (0x%x) on "
1606 "connection-oriented transport(%s,%d):%s",
1607 event, nconf->nc_proto, fd, errorstr);
1608 fdclose:
1609 num_conns--;
1610 remove_from_poll_list(fd);
1611 (void) t_close(fd);
1612 return (0);
1613 }
1614 }
|