Lines Matching defs:sp

228 	struct sactab *sp;	/* working pointer */
238 for (sp = Sactab; sp; sp = sp->sc_next) {
239 if (checklock(sp)) {
241 sp->sc_sstate = sp->sc_pstate = UNKNOWN;
242 sp->sc_ok = 1;
243 sp->sc_exit = 0;
244 (void) sprintf(Scratch, "%s/_pmpipe", sp->sc_tag);
245 sp->sc_fd = open(Scratch, O_RDWR);
246 if (sp->sc_fd < 0) {
252 * sane state. By setting sp->sc_ok to 0, this will look like a poll failure
253 * and if sp->rs_rsmax > 0, PM will be restarted.
258 sp->sc_tag);
260 (void) sendsig(sp, SIGTERM);
261 sp->sc_ok = 0;
275 for (sp = Sactab; sp; sp = sp->sc_next) {
276 if (sp->sc_flags & X_FLAG) {
280 (void) startpm(sp);
301 struct sactab *sp; /* working pointer */
316 sp = findpm(uxp->ut_user);
317 if (sp && (sp->sc_sstate == UNKNOWN)) {
319 (void) memcpy(sp->sc_utid, uxp->ut_id, IDLEN);
320 sp->sc_pid = uxp->ut_pid;
332 for (sp = Sactab; sp; sp = sp->sc_next) {
333 if (strncmp(uxp->ut_user, sp->sc_tag,
340 sp->sc_tag);
344 savesp = sp;
365 * args: sp - pointer to sac's port monitor information for
370 startpm(struct sactab *sp)
380 if (checklock(sp)) {
382 "could not start <%s> - _pid file locked", sp->sc_tag);
387 (void) sprintf(Scratch, "%s/_pmpipe", sp->sc_tag);
394 sp->sc_tag, errno);
399 sp->sc_fd = open(Scratch, O_RDWR);
400 if (sp->sc_fd < 0) {
403 sp->sc_tag, errno);
415 "Could not fork port monitor <%s>", sp->sc_tag);
419 startit(sp);
427 cleanutx(sp);
433 account(sp, pid);
434 sp->sc_pstate = STARTING;
435 if (sp->sc_lstate == NOTRUNNING)
436 sp->sc_sstate = (sp->sc_flags & D_FLAG) ? DISABLED : ENABLED;
438 sp->sc_sstate = sp->sc_lstate;
439 sp->sc_ok = 1;
440 sp->sc_exit = 0;
441 sp->sc_pid = pid;
451 * args: sp - pointer to sac's port monitor information for
457 cleanutx(struct sactab *sp)
475 zerocheck += sp->sc_utid[i];
480 pid = sp->sc_pid;
506 up->ut_exit.e_termination = WTERMSIG(sp->sc_exit);
507 up->ut_exit.e_exit = WEXITSTATUS(sp->sc_exit);
508 if (sp->sc_utid != NULL)
509 (void) memcpy(up->ut_id, sp->sc_utid,
535 account(struct sactab *sp, pid_t pid)
541 (void) strncpy(up->ut_user, sp->sc_tag, sizeof (up->ut_user));
551 (void) memset(sp->sc_utid, '\0', IDLEN);
553 (void) memcpy(sp->sc_utid, up->ut_id, IDLEN);
562 * args: sp - pointer to sac's port monitor information for
568 startit(struct sactab *sp)
583 if (chdir(sp->sc_tag) < 0) {
586 HOME, sp->sc_tag);
604 sp->sc_tag);
610 sp->sc_tag, ret);
620 if (sp->sc_lstate == NOTRUNNING)
622 (sp->sc_flags & D_FLAG) ? "disabled" : "enabled");
625 (sp->sc_lstate == DISABLED) ? "disabled" : "enabled");
629 sp->sc_tag);
633 (void) sprintf(pmtag, "PMTAG=%s", sp->sc_tag);
637 sp->sc_tag);
646 argvp = mkargv(sp);
648 (void) sprintf(Scratch, "starting port monitor <%s>", sp->sc_tag);
659 (void) sprintf(Scratch, "exec of port monitor <%s> failed", sp->sc_tag);
669 * args: sp - pointer to sac's port monitor information for
680 mkargv(struct sactab *sp)
683 char *p = sp->sc_cmd; /* working pointer */
721 sp->sc_tag);
769 struct sactab *sp; /* working pointer */
775 for (sp = Sactab; sp; sp = sp->sc_next) {
776 if (sp->sc_pstate == NOTRUNNING || sp->sc_pstate == FAILED) {
780 if (sp->sc_ok == 0) {
782 pollfail(sp, RESP);
791 if (sp->sc_sstate == sp->sc_pstate) {
795 switch (sp->sc_sstate) {
823 sendpmmsg(sp, &sacmsg);
824 sp->sc_ok = 0;
839 struct sactab *sp; /* working pointer */
844 for (sp = Sactab; sp; sp = sp->sc_next) {
845 if (sp->sc_pid == pid)
848 if (sp == NULL) {
852 sp->sc_exit = status;
854 if (sp->sc_pstate != NOTRUNNING && sp->sc_pstate != FAILED)
855 pollfail(sp, DEATH);
862 * args: sp - pointer to sac's port monitor information for
869 pollfail(struct sactab *sp, int reason)
881 cleanutx(sp);
883 if (sp->sc_pstate == STOPPING) {
884 (void) sprintf(buf, "<%s> has stopped", sp->sc_tag);
886 sp->sc_pstate = NOTRUNNING;
887 sp->sc_lstate = NOTRUNNING;
888 (void) close(sp->sc_fd);
903 (void) sendsig(sp, SIGKILL);
904 if (sp->sc_rscnt < sp->sc_rsmax) {
909 sp->sc_tag);
913 sp->sc_tag);
915 sp->sc_rscnt++;
916 (void) close(sp->sc_fd);
917 (void) startpm(sp);
919 sp->sc_sstate = sp->sc_pstate = FAILED;
920 (void) close(sp->sc_fd);
921 (void) sprintf(buf, "<%s> has FAILED", sp->sc_tag);
939 struct sactab *sp; /* working pointer */
993 sp = findpm(pp->pm_tag);
994 if (sp == NULL) {
1002 sp->sc_tag);
1014 sp->sc_tag);
1017 if (sp->sc_sstate == sp->sc_pstate) {
1019 if (sp->sc_sstate == UNKNOWN) {
1021 sp->sc_sstate = pp->pm_state;
1022 sp->sc_pstate = pp->pm_state;
1026 sp->sc_lstate = pp->pm_state;
1028 if (pp->pm_state != sp->sc_pstate) {
1034 sp->sc_pstate = pp->pm_state;
1036 } else if (sp->sc_sstate == pp->pm_state) {
1040 sp->sc_tag, pstate(sp->sc_pstate),
1043 sp->sc_pstate = pp->pm_state;
1044 } else if (sp->sc_pstate != pp->pm_state) {
1051 if (sp->sc_pstate != STOPPING)
1052 sp->sc_pstate = pp->pm_state;
1058 sp->sc_tag);
1063 sp->sc_ok = 1;
1065 sp->sc_maxclass = pp->pm_maxclass;