summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorMarcel Telka <marcel.telka@nexenta.com>2014-04-27 10:53:19 +0200
committerGordon Ross <gwr@nexenta.com>2014-04-30 20:55:41 -0400
commit9a634533d15821efb93a491af59ea24d69227322 (patch)
treeec2e89f00f356c53f2db22321f33263d72b879bf /usr/src
parentc5953fd0a23d8a0dc9475dfa76ad0dfd07663717 (diff)
downloadillumos-joyent-9a634533d15821efb93a491af59ea24d69227322.tar.gz
4812 libnsl: Some nisplus leftovers
Reviewed by: Andy Stormont <AStormont@racktopsystems.com> Reviewed by: Dan McDonald <danmcd@omniti.com> Approved by: Gordon Ross <gwr@nexenta.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libnsl/common/llib-lnsl5
-rw-r--r--usr/src/lib/libnsl/common/mapfile-vers7
-rw-r--r--usr/src/lib/libnsl/rpc/svc_vc.c189
3 files changed, 3 insertions, 198 deletions
diff --git a/usr/src/lib/libnsl/common/llib-lnsl b/usr/src/lib/libnsl/common/llib-lnsl
index 106dab70d6..582eecef95 100644
--- a/usr/src/lib/libnsl/common/llib-lnsl
+++ b/usr/src/lib/libnsl/common/llib-lnsl
@@ -23,7 +23,7 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
@@ -836,9 +836,6 @@ int rpc_reg(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
/* svc_vc.c */
SVCXPRT *svc_vc_create(int fd, uint_t sendsize, uint_t recvsize);
SVCXPRT *svc_fd_create(int fd, uint_t sendsize, uint_t recvsize);
-void __svc_nisplus_fdcleanup_hack(void);
-void __svc_nisplus_enable_timestamps(void);
-void __svc_nisplus_purge_since(long since);
bool_t __svc_vc_dupcache_init(SVCXPRT *xprt, void *condition, int basis);
int __svc_vc_dup(struct svc_req *req, caddr_t *resp_buf, uint_t *resp_bufsz);
int __svc_vc_dupdone(struct svc_req *req, caddr_t resp_buf, uint_t resp_bufsz,
diff --git a/usr/src/lib/libnsl/common/mapfile-vers b/usr/src/lib/libnsl/common/mapfile-vers
index f875cd99fc..c8fa67b625 100644
--- a/usr/src/lib/libnsl/common/mapfile-vers
+++ b/usr/src/lib/libnsl/common/mapfile-vers
@@ -20,7 +20,7 @@
#
#
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+# Copyright 2014 Nexenta Systems, Inc. All rights reserved.
#
#
@@ -467,8 +467,8 @@ $endif
SYMBOL_VERSION SUNWprivate_1.5 {
global:
- inet_matchaddr;
clnt_create_service_timed;
+ inet_matchaddr;
} SUNWprivate_1.4;
SYMBOL_VERSION SUNWprivate_1.4 {
@@ -663,9 +663,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
svc_get_local_cred;
_svc_getreqset_proc;
__svc_get_svcauth;
- __svc_nisplus_enable_timestamps;
- __svc_nisplus_fdcleanup_hack;
- __svc_nisplus_purge_since;
__svc_set_proc_cleanup_cb;
__svc_vc_dup;
__svc_vc_dupcache_init;
diff --git a/usr/src/lib/libnsl/rpc/svc_vc.c b/usr/src/lib/libnsl/rpc/svc_vc.c
index e98c2b2028..bd001a43b8 100644
--- a/usr/src/lib/libnsl/rpc/svc_vc.c
+++ b/usr/src/lib/libnsl/rpc/svc_vc.c
@@ -77,7 +77,6 @@ extern SVCXPRT **svc_xports;
extern int __td_setnodelay(int);
extern bool_t __xdrrec_getbytes_nonblock(XDR *, enum xprt_stat *);
extern bool_t __xdrrec_set_conn_nonblock(XDR *, uint32_t);
-extern int _t_do_ioctl(int, char *, int, int, int *);
extern int __rpc_legal_connmaxrec(int);
/* Structure used to initialize SVC_XP_AUTH(xprt).svc_ah_ops. */
extern struct svc_auth_ops svc_auth_any_ops;
@@ -90,7 +89,6 @@ static bool_t svc_vc_nonblock(SVCXPRT *, SVCXPRT *);
static int read_vc(SVCXPRT *, caddr_t, int);
static int write_vc(SVCXPRT *, caddr_t, int);
static SVCXPRT *makefd_xprt(int, uint_t, uint_t, t_scalar_t, char *);
-static bool_t fd_is_dead(int);
static void update_nonblock_timestamps(SVCXPRT *);
struct cf_rendezvous { /* kept in xprt->xp_p1 for rendezvouser */
@@ -126,9 +124,6 @@ extern int __xdrrec_setfirst(XDR *);
extern int __xdrrec_resetfirst(XDR *);
extern int __is_xdrrec_first(XDR *);
-void __svc_nisplus_enable_timestamps(void);
-void __svc_timeout_nonblock_xprt(void);
-
/*
* This is intended as a performance improvement on the old string handling
* stuff by read only moving data into the text segment.
@@ -155,14 +150,6 @@ static const char no_fcntl_getfl_str[] = "could not get status flags and modes";
static const char no_nonblock_str[] = "could not set transport non-blocking";
/*
- * Records a timestamp when data comes in on a descriptor. This is
- * only used if timestamps are enabled with __svc_nisplus_enable_timestamps().
- */
-static long *timestamps;
-static int ntimestamps; /* keep track how many timestamps */
-static mutex_t timestamp_lock = DEFAULTMUTEX;
-
-/*
* Used to determine whether the time-out logic should be executed.
*/
static bool_t check_nonblock_timestamps = FALSE;
@@ -1192,12 +1179,6 @@ _svc_vc_destroy_private(SVCXPRT *xprt, bool_t lock_not_held)
__xprt_unregister_private(xprt, lock_not_held);
(void) t_close(xprt->xp_fd);
- (void) mutex_lock(&timestamp_lock);
- if (timestamps && xprt->xp_fd < ntimestamps) {
- timestamps[xprt->xp_fd] = 0;
- }
- (void) mutex_unlock(&timestamp_lock);
-
if (svc_mt_mode != RPC_SVC_MT_NONE) {
svc_xprt_destroy(xprt);
} else {
@@ -1285,43 +1266,11 @@ rendezvous_control(SVCXPRT *xprt, const uint_t rq, void *in)
/*
* All read operations timeout after 35 seconds.
* A timeout is fatal for the connection.
- * update_timestamps() is used by nisplus operations,
* update_nonblock_timestamps() is used for nonblocked
* connection fds.
*/
#define WAIT_PER_TRY 35000 /* milliseconds */
-static void
-update_timestamps(int fd)
-{
- (void) mutex_lock(&timestamp_lock);
- if (timestamps) {
- struct timeval tv;
-
- (void) gettimeofday(&tv, NULL);
- while (fd >= ntimestamps) {
- long *tmp_timestamps = timestamps;
-
- /* allocate more timestamps */
- tmp_timestamps = realloc(timestamps, sizeof (long) *
- (ntimestamps + FD_INCREMENT));
- if (tmp_timestamps == NULL) {
- (void) mutex_unlock(&timestamp_lock);
- syslog(LOG_ERR,
- "update_timestamps: out of memory");
- return;
- }
-
- timestamps = tmp_timestamps;
- (void) memset(&timestamps[ntimestamps], 0,
- sizeof (long) * FD_INCREMENT);
- ntimestamps += FD_INCREMENT;
- }
- timestamps[fd] = tv.tv_sec;
- }
- (void) mutex_unlock(&timestamp_lock);
-}
-
static void
update_nonblock_timestamps(SVCXPRT *xprt_conn)
{
@@ -1371,7 +1320,6 @@ read_vc(SVCXPRT *xprt, caddr_t buf, int len)
*/
if ((len = t_rcvnonblock(xprt, buf, len)) >= 0) {
if (len > 0) {
- update_timestamps(fd);
update_nonblock_timestamps(xprt);
}
return (len);
@@ -1401,7 +1349,6 @@ read_vc(SVCXPRT *xprt, caddr_t buf, int len)
}
(void) __xdrrec_resetfirst(xdrs);
if ((len = t_rcvall(fd, buf, len)) > 0) {
- update_timestamps(fd);
return (len);
}
@@ -1865,142 +1812,6 @@ svc_vc_rendezvous_ops(void)
}
/*
- * PRIVATE RPC INTERFACE
- *
- * This is a hack to let NIS+ clean up connections that have already been
- * closed. This problem arises because rpc.nisd forks a child to handle
- * existing connections when it does checkpointing. The child may close
- * some of these connections. But the descriptors still stay open in the
- * parent, and because TLI descriptors don't support persistent EOF
- * condition (like sockets do), the parent will never detect that these
- * descriptors are dead.
- *
- * The following internal procedure __svc_nisplus_fdcleanup_hack() - should
- * be removed as soon as rpc.nisd is rearchitected to do the right thing.
- * This procedure should not find its way into any header files.
- *
- * This procedure should be called only when rpc.nisd knows that there
- * are no children servicing clients.
- */
-
-static bool_t
-fd_is_dead(int fd)
-{
- struct T_info_ack inforeq;
- int retval;
-
- inforeq.PRIM_type = T_INFO_REQ;
- if (!_t_do_ioctl(fd, (caddr_t)&inforeq, sizeof (struct T_info_req),
- TI_GETINFO, &retval))
- return (TRUE);
- if (retval != (int)sizeof (struct T_info_ack))
- return (TRUE);
-
- switch (inforeq.CURRENT_state) {
- case TS_UNBND:
- case TS_IDLE:
- return (TRUE);
- default:
- break;
- }
- return (FALSE);
-}
-
-void
-__svc_nisplus_fdcleanup_hack(void)
-{
- SVCXPRT *xprt;
- SVCXPRT *dead_xprt[CLEANUP_SIZE];
- int i, fd_idx = 0, dead_idx = 0;
-
- if (svc_xports == NULL)
- return;
- for (;;) {
- (void) rw_wrlock(&svc_fd_lock);
- for (dead_idx = 0; fd_idx < svc_max_pollfd; fd_idx++) {
- if ((xprt = svc_xports[fd_idx]) == NULL)
- continue;
-/* LINTED pointer alignment */
- if (svc_type(xprt) != SVC_CONNECTION)
- continue;
- if (fd_is_dead(fd_idx)) {
- dead_xprt[dead_idx++] = xprt;
- if (dead_idx >= CLEANUP_SIZE)
- break;
- }
- }
-
- for (i = 0; i < dead_idx; i++) {
- /* Still holding svc_fd_lock */
- _svc_vc_destroy_private(dead_xprt[i], FALSE);
- }
- (void) rw_unlock(&svc_fd_lock);
- if (fd_idx++ >= svc_max_pollfd)
- return;
- }
-}
-
-void
-__svc_nisplus_enable_timestamps(void)
-{
- (void) mutex_lock(&timestamp_lock);
- if (!timestamps) {
- timestamps = calloc(FD_INCREMENT, sizeof (long));
- if (timestamps != NULL)
- ntimestamps = FD_INCREMENT;
- else {
- (void) mutex_unlock(&timestamp_lock);
- syslog(LOG_ERR, "__svc_nisplus_enable_timestamps: "
- "out of memory");
- return;
- }
- }
- (void) mutex_unlock(&timestamp_lock);
-}
-
-void
-__svc_nisplus_purge_since(long since)
-{
- SVCXPRT *xprt;
- SVCXPRT *dead_xprt[CLEANUP_SIZE];
- int i, fd_idx = 0, dead_idx = 0;
-
- if (svc_xports == NULL)
- return;
- for (;;) {
- (void) rw_wrlock(&svc_fd_lock);
- (void) mutex_lock(&timestamp_lock);
- for (dead_idx = 0; fd_idx < svc_max_pollfd; fd_idx++) {
- if ((xprt = svc_xports[fd_idx]) == NULL) {
- continue;
- }
- /* LINTED pointer cast */
- if (svc_type(xprt) != SVC_CONNECTION) {
- continue;
- }
- if (fd_idx >= ntimestamps) {
- break;
- }
- if (timestamps[fd_idx] &&
- timestamps[fd_idx] < since) {
- dead_xprt[dead_idx++] = xprt;
- if (dead_idx >= CLEANUP_SIZE)
- break;
- }
- }
- (void) mutex_unlock(&timestamp_lock);
-
- for (i = 0; i < dead_idx; i++) {
- /* Still holding svc_fd_lock */
- _svc_vc_destroy_private(dead_xprt[i], FALSE);
- }
- (void) rw_unlock(&svc_fd_lock);
- if (fd_idx++ >= svc_max_pollfd)
- return;
- }
-}
-
-/*
* dup cache wrapper functions for vc requests. The set of dup
* functions were written with the view that they may be expanded
* during creation of a generic svc_vc_enablecache routine