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 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
28 */
29
30 /*
31 * Network SNDR/ncall-ip server - based on nfsd
32 */
33 #include <sys/types.h>
34 #include <rpc/types.h>
35 #include <errno.h>
36 #include <netdb.h>
37 #include <sys/socket.h>
38 #include <netconfig.h>
39 #include <stropts.h>
40 #include <fcntl.h>
41 #include <stdio.h>
42 #include <strings.h>
43 #include <signal.h>
44 #include <unistd.h>
45 #include <stdlib.h>
46 #include <netdir.h>
47 #include <rpc/rpc_com.h>
1261 * listen fd
1262 */
1263 if (!is_listen_fd_index(fd))
1264 break;
1265 else
1266 goto fdclose;
1267 }
1268
1269 case T_DISCONNECT:
1270 if (t_rcvdis(fd, (struct t_discon *)NULL) == -1)
1271 rdcd_log_tli_error("t_rcvdis", fd, nconf);
1272
1273 /*
1274 * T_DISCONNECT on listen fd's should be ignored.
1275 */
1276 if (!is_listen_fd_index(fd))
1277 break;
1278 else
1279 goto fdclose;
1280
1281 case T_ERROR:
1282 default:
1283 if (event == T_ERROR || t_errno == TSYSERR) {
1284 if ((errorstr = strerror(errno)) == NULL) {
1285 (void) snprintf(buf, sizeof (buf),
1286 "Unknown error num %d", errno);
1287 errorstr = (const char *)buf;
1288 }
1289 } else if (event == -1)
1290 errorstr = t_strerror(t_errno);
1291 else
1292 errorstr = "";
1293 #ifdef DEBUG
1294 syslog(LOG_ERR,
1295 "unexpected TLI event (0x%x) on "
1296 "connection-oriented transport(%s, %d):%s",
1297 event, nconf->nc_proto, fd, errorstr);
1298 #endif
1299
1300 fdclose:
1301 num_conns--;
1302 remove_from_poll_list(fd);
1303 (void) t_close(fd);
|
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 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
28 * Copyright 2014 Gary Mills
29 */
30
31 /*
32 * Network SNDR/ncall-ip server - based on nfsd
33 */
34 #include <sys/types.h>
35 #include <rpc/types.h>
36 #include <errno.h>
37 #include <netdb.h>
38 #include <sys/socket.h>
39 #include <netconfig.h>
40 #include <stropts.h>
41 #include <fcntl.h>
42 #include <stdio.h>
43 #include <strings.h>
44 #include <signal.h>
45 #include <unistd.h>
46 #include <stdlib.h>
47 #include <netdir.h>
48 #include <rpc/rpc_com.h>
1262 * listen fd
1263 */
1264 if (!is_listen_fd_index(fd))
1265 break;
1266 else
1267 goto fdclose;
1268 }
1269
1270 case T_DISCONNECT:
1271 if (t_rcvdis(fd, (struct t_discon *)NULL) == -1)
1272 rdcd_log_tli_error("t_rcvdis", fd, nconf);
1273
1274 /*
1275 * T_DISCONNECT on listen fd's should be ignored.
1276 */
1277 if (!is_listen_fd_index(fd))
1278 break;
1279 else
1280 goto fdclose;
1281
1282 default:
1283 if (t_errno == TSYSERR) {
1284 if ((errorstr = strerror(errno)) == NULL) {
1285 (void) snprintf(buf, sizeof (buf),
1286 "Unknown error num %d", errno);
1287 errorstr = (const char *)buf;
1288 }
1289 } else if (event == -1)
1290 errorstr = t_strerror(t_errno);
1291 else
1292 errorstr = "";
1293 #ifdef DEBUG
1294 syslog(LOG_ERR,
1295 "unexpected TLI event (0x%x) on "
1296 "connection-oriented transport(%s, %d):%s",
1297 event, nconf->nc_proto, fd, errorstr);
1298 #endif
1299
1300 fdclose:
1301 num_conns--;
1302 remove_from_poll_list(fd);
1303 (void) t_close(fd);
|