Lines Matching refs:sp

226 	struct sactab *sp;	/* working pointer */  in startpms()  local
236 for (sp = Sactab; sp; sp = sp->sc_next) { in startpms()
237 if (checklock(sp)) { in startpms()
239 sp->sc_sstate = sp->sc_pstate = UNKNOWN; in startpms()
240 sp->sc_ok = 1; in startpms()
241 sp->sc_exit = 0; in startpms()
242 (void) sprintf(Scratch, "%s/_pmpipe", sp->sc_tag); in startpms()
243 sp->sc_fd = open(Scratch, O_RDWR); in startpms()
244 if (sp->sc_fd < 0) { in startpms()
256 sp->sc_tag); in startpms()
258 (void) sendsig(sp, SIGTERM); in startpms()
259 sp->sc_ok = 0; in startpms()
273 for (sp = Sactab; sp; sp = sp->sc_next) { in startpms()
274 if (sp->sc_flags & X_FLAG) { in startpms()
278 (void) startpm(sp); in startpms()
299 struct sactab *sp; /* working pointer */ in readutmpx() local
314 sp = findpm(uxp->ut_user); in readutmpx()
315 if (sp && (sp->sc_sstate == UNKNOWN)) { in readutmpx()
317 (void) memcpy(sp->sc_utid, uxp->ut_id, IDLEN); in readutmpx()
318 sp->sc_pid = uxp->ut_pid; in readutmpx()
330 for (sp = Sactab; sp; sp = sp->sc_next) { in readutmpx()
331 if (strncmp(uxp->ut_user, sp->sc_tag, in readutmpx()
338 "<%.8s>", sp->sc_tag); in readutmpx()
342 savesp = sp; in readutmpx()
368 startpm(struct sactab *sp) in startpm() argument
378 if (checklock(sp)) { in startpm()
380 "could not start <%s> - _pid file locked", sp->sc_tag); in startpm()
385 (void) sprintf(Scratch, "%s/_pmpipe", sp->sc_tag); in startpm()
392 sp->sc_tag, errno); in startpm()
397 sp->sc_fd = open(Scratch, O_RDWR); in startpm()
398 if (sp->sc_fd < 0) { in startpm()
400 "monitor <%s>, errno is %d", sp->sc_tag, errno); in startpm()
412 "Could not fork port monitor <%s>", sp->sc_tag); in startpm()
416 startit(sp); in startpm()
424 cleanutx(sp); in startpm()
430 account(sp, pid); in startpm()
431 sp->sc_pstate = STARTING; in startpm()
432 if (sp->sc_lstate == NOTRUNNING) in startpm()
433 sp->sc_sstate = (sp->sc_flags & D_FLAG) ? DISABLED : ENABLED; in startpm()
435 sp->sc_sstate = sp->sc_lstate; in startpm()
436 sp->sc_ok = 1; in startpm()
437 sp->sc_exit = 0; in startpm()
438 sp->sc_pid = pid; in startpm()
454 cleanutx(struct sactab *sp) in cleanutx() argument
472 zerocheck += sp->sc_utid[i]; in cleanutx()
477 pid = sp->sc_pid; in cleanutx()
503 up->ut_exit.e_termination = WTERMSIG(sp->sc_exit); in cleanutx()
504 up->ut_exit.e_exit = WEXITSTATUS(sp->sc_exit); in cleanutx()
505 (void) memcpy(up->ut_id, sp->sc_utid, in cleanutx()
531 account(struct sactab *sp, pid_t pid) in account() argument
537 (void) strncpy(up->ut_user, sp->sc_tag, sizeof (up->ut_user)); in account()
547 (void) memset(sp->sc_utid, '\0', IDLEN); in account()
549 (void) memcpy(sp->sc_utid, up->ut_id, IDLEN); in account()
564 startit(struct sactab *sp) in startit() argument
579 if (chdir(sp->sc_tag) < 0) { in startit()
582 HOME, sp->sc_tag); in startit()
600 sp->sc_tag); in startit()
606 sp->sc_tag, ret); in startit()
616 if (sp->sc_lstate == NOTRUNNING) in startit()
618 (sp->sc_flags & D_FLAG) ? "disabled" : "enabled"); in startit()
621 (sp->sc_lstate == DISABLED) ? "disabled" : "enabled"); in startit()
625 sp->sc_tag); in startit()
629 (void) sprintf(pmtag, "PMTAG=%s", sp->sc_tag); in startit()
633 sp->sc_tag); in startit()
642 argvp = mkargv(sp); in startit()
644 (void) sprintf(Scratch, "starting port monitor <%s>", sp->sc_tag); in startit()
655 (void) sprintf(Scratch, "exec of port monitor <%s> failed", sp->sc_tag); in startit()
676 mkargv(struct sactab *sp) in mkargv() argument
679 char *p = sp->sc_cmd; /* working pointer */ in mkargv()
719 sp->sc_tag); in mkargv()
767 struct sactab *sp; /* working pointer */ in pollpms() local
773 for (sp = Sactab; sp; sp = sp->sc_next) { in pollpms()
774 if (sp->sc_pstate == NOTRUNNING || sp->sc_pstate == FAILED) { in pollpms()
778 if (sp->sc_ok == 0) { in pollpms()
780 pollfail(sp, RESP); in pollpms()
789 if (sp->sc_sstate == sp->sc_pstate) { in pollpms()
793 switch (sp->sc_sstate) { in pollpms()
821 sendpmmsg(sp, &sacmsg); in pollpms()
822 sp->sc_ok = 0; in pollpms()
837 struct sactab *sp; /* working pointer */ in reap() local
842 for (sp = Sactab; sp; sp = sp->sc_next) { in reap()
843 if (sp->sc_pid == pid) in reap()
846 if (sp == NULL) { in reap()
850 sp->sc_exit = status; in reap()
852 if (sp->sc_pstate != NOTRUNNING && sp->sc_pstate != FAILED) in reap()
853 pollfail(sp, DEATH); in reap()
867 pollfail(struct sactab *sp, int reason) in pollfail() argument
879 cleanutx(sp); in pollfail()
881 if (sp->sc_pstate == STOPPING) { in pollfail()
882 (void) sprintf(buf, "<%s> has stopped", sp->sc_tag); in pollfail()
884 sp->sc_pstate = NOTRUNNING; in pollfail()
885 sp->sc_lstate = NOTRUNNING; in pollfail()
886 (void) close(sp->sc_fd); in pollfail()
901 (void) sendsig(sp, SIGKILL); in pollfail()
902 if (sp->sc_rscnt < sp->sc_rsmax) { in pollfail()
907 sp->sc_tag); in pollfail()
911 sp->sc_tag); in pollfail()
913 sp->sc_rscnt++; in pollfail()
914 (void) close(sp->sc_fd); in pollfail()
915 (void) startpm(sp); in pollfail()
917 sp->sc_sstate = sp->sc_pstate = FAILED; in pollfail()
918 (void) close(sp->sc_fd); in pollfail()
919 (void) sprintf(buf, "<%s> has FAILED", sp->sc_tag); in pollfail()
937 struct sactab *sp; /* working pointer */ in readpipe() local
990 sp = findpm(pp->pm_tag); in readpipe()
991 if (sp == NULL) { in readpipe()
999 sp->sc_tag); in readpipe()
1010 "reporting invalid state", sp->sc_tag); in readpipe()
1013 if (sp->sc_sstate == sp->sc_pstate) { in readpipe()
1015 if (sp->sc_sstate == UNKNOWN) { in readpipe()
1017 sp->sc_sstate = pp->pm_state; in readpipe()
1018 sp->sc_pstate = pp->pm_state; in readpipe()
1022 sp->sc_lstate = pp->pm_state; in readpipe()
1024 if (pp->pm_state != sp->sc_pstate) { in readpipe()
1030 sp->sc_pstate = pp->pm_state; in readpipe()
1032 } else if (sp->sc_sstate == pp->pm_state) { in readpipe()
1036 sp->sc_tag, pstate(sp->sc_pstate), in readpipe()
1039 sp->sc_pstate = pp->pm_state; in readpipe()
1040 } else if (sp->sc_pstate != pp->pm_state) { in readpipe()
1047 if (sp->sc_pstate != STOPPING) in readpipe()
1048 sp->sc_pstate = pp->pm_state; in readpipe()
1053 "invalid message - ignoring it", sp->sc_tag); in readpipe()
1058 sp->sc_ok = 1; in readpipe()
1060 sp->sc_maxclass = pp->pm_maxclass; in readpipe()