Lines Matching defs:pdom
149 register struct domain *pdom;
180 for (pdom = known_domains; pdom != (struct domain *)NULL;
181 pdom = pdom->dom_pnext) {
183 if (pdom->dom_broadcaster_pid == pid) {
186 "ypbind event_handler: got match %s\n", pdom->dom_name);
189 broadcast_setup(pdom);
191 if (pdom->broadcaster_pipe != 0) {
192 xdr_destroy(&(pdom->broadcaster_xdr));
193 fclose(pdom->broadcaster_pipe);
194 pdom->broadcaster_pipe = 0;
195 pdom->broadcaster_fd = -1;
197 pdom->dom_broadcaster_pid = 0;
207 broadcast_setup(pdom)
208 struct domain *pdom;
213 if (pdom->broadcaster_pipe) {
214 pdom->dom_report_success = -1;
215 if (xdr_ypbind_setdom(&(pdom->broadcaster_xdr), &req)) {
222 gettimeofday(&(pdom->lastping), NULL);
962 register struct domain *pdom;
965 for (pdom = known_domains; pdom != (struct domain *)NULL;
966 pdom = pdom->dom_pnext) {
967 if (strcmp(pname, pdom->dom_name) == 0)
968 return (pdom);
973 if (pdom = (struct domain *)calloc(1, sizeof (struct domain))) {
974 pdom->dom_name = strdup(pname);
975 if (pdom->dom_name == NULL) {
976 free((char *)pdom);
981 pdom->dom_pnext = known_domains;
982 known_domains = pdom;
983 pdom->dom_boundp = FALSE;
984 pdom->dom_vers = YPVERS; /* This doesn't talk to old ypserv */
985 pdom->dom_binding = NULL;
986 pdom->dom_error = YPBIND_ERR_NOSERV;
987 pdom->ping_clnt = (CLIENT *)NULL;
988 pdom->dom_report_success = -1;
989 pdom->dom_broadcaster_pid = 0;
990 pdom->broadcaster_pipe = 0;
991 pdom->bindfile = -1;
992 pdom->lastping.tv_sec = 0;
993 pdom->lastping.tv_usec = 0; /* require ping */
994 pdom->cache_fp = 0;
995 sprintf(buf, "%s/%s/cache_binding", BINDING, pdom->dom_name);
996 pdom->cache_file = strdup(buf);
998 * We don't give an error if pdom->cache_file is not set.
1007 return (pdom);
1011 ypbind_ping(pdom)
1012 struct domain *pdom;
1018 if (pdom->dom_boundp == FALSE)
1020 vers = pdom->dom_vers;
1022 if (pdom->ping_clnt == (CLIENT *) NULL) {
1023 pdom->ping_clnt = __nis_clnt_create(RPC_ANYFD,
1024 pdom->dom_binding->ypbind_nconf, 0,
1025 pdom->dom_binding->ypbind_svcaddr, 0,
1029 if (pdom->ping_clnt == (CLIENT *) NULL) {
1032 pdom->dom_boundp = FALSE;
1033 pdom->dom_error = YPBIND_ERR_NOSERV;
1043 if (clnt_call(pdom->ping_clnt,
1045 (char *)&pdom->dom_name, xdr_int, (char *)&isok,
1047 pdom->dom_boundp = isok;
1048 pdom->dom_binding->ypbind_lo_vers = vers;
1049 pdom->dom_binding->ypbind_hi_vers = vers;
1053 pdom->dom_binding->ypbind_lo_vers,
1054 pdom->dom_binding->ypbind_hi_vers);
1057 clnt_perror(pdom->ping_clnt, "ping");
1058 pdom->dom_boundp = FALSE;
1059 pdom->dom_error = YPBIND_ERR_NOSERV;
1061 (void) gettimeofday(&(pdom->lastping), NULL);
1062 if (pdom->ping_clnt)
1063 clnt_destroy(pdom->ping_clnt);
1064 pdom->ping_clnt = (CLIENT *)NULL;
1065 if (pdom->dom_boundp)
1066 cache_binding(pdom);
1261 cache_binding(pdom)
1262 struct domain *pdom;
1273 if (pdom->cache_file == 0)
1284 if (pdom->cache_fp) {
1285 fclose(pdom->cache_fp); /* automatically unlocks */
1286 unlink(pdom->cache_file);
1287 pdom->cache_fp = 0;
1290 fd = open(pdom->cache_file, O_CREAT|O_WRONLY, 0444);
1294 pdom->cache_fp = fdopen(fd, "w");
1295 if (pdom->cache_fp == 0) {
1300 xdrstdio_create(&xdrs, pdom->cache_fp, XDR_ENCODE);
1302 resp.ypbind_resp_u.ypbind_bindinfo = pdom->dom_binding;
1306 unlink(pdom->cache_file);
1307 fclose(pdom->cache_fp);
1308 pdom->cache_fp = 0;
1317 unlink(pdom->cache_file);
1318 fclose(pdom->cache_fp);
1319 pdom->cache_fp = 0;
1324 uncache_binding(pdom)
1325 struct domain *pdom;
1330 if (pdom->cache_fp != 0) {
1331 unlink(pdom->cache_file);
1332 fclose(pdom->cache_fp);
1333 pdom->cache_fp = 0;
1451 struct domain *pdom;
1457 for (pdom = known_domains; pdom != (struct domain *)NULL;
1458 pdom = pdom->dom_pnext) {
1459 if (pdom->cache_file)
1460 unlink(pdom->cache_file);