Lines Matching refs:kcp
779 struct key_call_private *kcp = (struct key_call_private *)vp;
781 if (kcp != NULL && kcp->client != NULL) {
782 (void) check_rdev(kcp);
783 clnt_destroy(kcp->client);
784 free(kcp);
793 struct key_call_private *kcp;
795 if ((kcp = pthread_getspecific(key_call_key)) != NULL) {
796 key_call_destroy(kcp);
807 struct key_call_private *kcp = NULL;
810 kcp = thr_get_storage(&key_call_key, sizeof (*kcp), key_call_destroy);
811 if (kcp == NULL) {
820 if (kcp->client &&
821 (!check_rdev(kcp) || kcp->pid != getpid() || stale)) {
822 clnt_destroy(kcp->client);
823 kcp->client = NULL;
825 if (kcp->client) {
830 clnt_control(kcp->client, CLSET_VERS, (void *)&vers);
831 if (!_update_did(kcp->client, vers)) {
837 /* Update fd in kcp because it was reopened in _update_did */
838 if (clnt_control(kcp->client, CLGET_FD, (void *)&fd) &&
841 kcp->fd = fd;
842 return (kcp->client);
845 if ((kcp->client = clnt_door_create(KEY_PROG, vers, 0)) == NULL)
848 kcp->pid = getpid();
849 set_rdev(kcp);
850 (void) fcntl(kcp->fd, F_SETFD, FD_CLOEXEC); /* close on exec */
852 return (kcp->client);
974 set_rdev(struct key_call_private *kcp)
979 if (clnt_control(kcp->client, CLGET_FD, (char *)&fd) != TRUE ||
982 kcp->fd = -1;
985 kcp->fd = fd;
986 kcp->rdev = stbuf.st_rdev;
990 check_rdev(struct key_call_private *kcp)
994 if (kcp->fd == -1)
997 if (fstat(kcp->fd, &stbuf) == -1) {
998 syslog(LOG_DEBUG, "keyserv_client: can't stat %d", kcp->fd);
1001 clnt_control(kcp->client, CLSET_FD_NCLOSE, NULL);
1005 if (kcp->rdev != stbuf.st_rdev) {
1008 kcp->fd, kcp->rdev, stbuf.st_rdev);
1010 clnt_control(kcp->client, CLSET_FD_NCLOSE, NULL);