Lines Matching refs:con

113 	if (!(state.con = newof(0, Connection_t, state.fdtotal, 0)))
114 error(3, "out of space [con]");
115 state.con[0].type = POLL;
171 if (!state.indirect.con && state.home->idle)
237 if (state.indirect.con)
239 state.con[fd].type = INIT;
240 state.con[fd].info.user.fds[0] = fd;
241 state.con[fd].info.user.fds[1] = -1;
242 state.con[fd].info.user.fds[2] = -1;
245 else state.con[fd].type = IDENT;
246 state.con[fd].info.user.flags = USER_IDENT;
247 state.con[fd].info.user.home = 0;
248 state.con[fd].info.user.pump = 0;
249 state.con[fd].info.user.expr = 0;
295 switch (state.con[fd].type)
300 if (state.con[fd].flags >= 0 && fcntl(fd, F_SETFL, state.con[fd].flags|O_NONBLOCK) < 0)
301 state.con[fd].flags = -1;
305 if (state.con[fd].flags >= 0 && fcntl(fd, F_SETFL, state.con[fd].flags) < 0)
306 state.con[fd].flags = -1;
312 state.con[fd].error++;
324 sp = state.con[fd].info.shell;
372 state.con[fd].type = SHELL;
373 state.con[fd].info.shell = sp;
443 if (csread(fd, s = state.buf, 13, CS_EXACT) != 13 || s[0] != '#' || (jp = state.job + (int)strtol(s + 1, NiL, 10)) > state.jobmax || fstat(state.con[fd].info.pass.fd = (int)strtol(s + 7, NiL, 10), &st))
447 state.con[fd].type = PASS;
448 state.con[fd].info.pass.job = jp->pid ? jp : 0;
449 state.con[fd].info.pass.serialize = (jp->flags & CO_SERIALIZE) ? sfstropen() : (Sfio_t*)0;
462 state.con[n].info.user.flags = 0;
469 state.con[n].info.user.flags = USER_IDENT;
470 state.con[n].info.user.home = 0;
471 state.con[n].info.user.pump = 0;
473 state.con[fds[0]].type = UCMD;
474 state.con[fds[1]].type = UOUT;
475 state.con[fds[2]].type = UERR;
476 state.con[n].type = INIT;
477 state.con[n].info.user.pid = id.pid;
478 for (i = 0; i < elementsof(state.con[n].info.user.fds); i++)
481 state.con[n].info.user.fds[i] = fds[i];
497 state.con[fd].info.user.attr.label[0] = 0;
521 else if (state.indirect.con)
524 state.con[fd].info.user.flags &= ~USER_IDENT;
526 state.con[fd].info.user.flags |= USER_DUP;
528 (state.con[fd].info.user.home = sp)->home++;
530 state.con[fd].info.user.pump = strdup(s + sizeof(CO_OPT_INDIRECT));
535 if (state.indirect.con && (state.con[fd].info.user.flags & (USER_IDENT|USER_INIT)) == USER_IDENT)
537 state.con[fd].info.user.flags |= USER_INIT;
540 if (x) state.con[fd].info.user.expr = strdup(x);
541 attributes(x, &state.con[fd].info.user.attr, NiL);
542 state.con[fd].info.user.attr.set &= ~SETLABEL;
543 if (state.indirect.con)
545 if (!state.con[fd].info.user.pump ||
546 (state.con[fd].info.user.fds[1] = csopen(state.con[fd].info.user.pump, 0)) < 0 ||
547 cswrite(state.con[fd].info.user.fds[1], "#00001\n", 7) != 7)
554 nonblocking(state.con[fd].info.user.fds[1]);
555 state.con[state.con[fd].info.user.fds[1]].type = UOUT;
557 if (state.con[fd].info.user.flags & USER_DUP) state.con[fd].info.user.fds[2] = state.con[fd].info.user.fds[1];
558 else if ((state.con[fd].info.user.fds[2] = csopen(state.con[fd].info.user.pump, 0)) < 0 ||
559 cswrite(state.con[fd].info.user.fds[2], "#00002\n", 7) != 7)
564 else state.con[state.con[fd].info.user.fds[2]].type = UERR;
566 else if (!fstat(state.con[fd].info.user.fds[1], &st) && !fstat(state.con[fd].info.user.fds[2], &ts) && st.st_ino == ts.st_ino && st.st_dev == ts.st_dev)
568 drop(state.con[fd].info.user.fds[2]);
569 state.con[fd].info.user.fds[2] = state.con[fd].info.user.fds[1];
571 if (state.con[fd].info.user.flags & USER_IDENT)
575 if (state.indirect.con) s += sfsprintf(s, state.buflen - (s - state.buf), ",%s", CO_OPT_INDIRECT);
578 if (cswrite(state.con[fd].info.user.fds[0], state.buf, i) != i)
584 state.con[fd].info.user.running = 0;
585 state.con[fd].info.user.total = 0;
586 state.con[fd].type = USER;
596 state.con[i].type = ANON;
597 state.con[i].info.shell = 0;
599 state.con[i].flags = fcntl(fd, F_GETFL, 0);
613 n = state.con[fd].info.pass.fd;
614 jp = state.con[fd].info.pass.job;
615 if (state.con[n].info.ident.shell != jp->shell || state.con[n].info.ident.pid != jp->pid)
617 state.con[n].info.ident.shell = jp->shell;
618 state.con[n].info.ident.pid = jp->pid;
620 if (*(s = state.con[jp->fd].info.user.attr.label))
622 if (*(s = state.con[fd].info.pass.job->label))
628 cswrite(state.con[fd].info.pass.fd, cmd, n);
631 if (state.con[fd].info.pass.serialize)
633 if (sfwrite(state.con[fd].info.pass.serialize, state.buf, i) != i)
636 else if (cswrite(state.con[fd].info.pass.fd, state.buf, i) != i)
644 state.con[i].type = DEST;
673 if (!(state.home = state.con[fd].info.user.home))
688 message((-1, "kill state.con=%d rid=%d sig=%d", fd, n1, n2));
705 error(ERROR_OUTPUT|2, state.con[fd].info.user.fds[2], "%c: unknown op", i);
712 cswrite(state.con[fd].info.user.fds[0], state.buf, n);
744 csfd(state.indirect.con, CS_POLL_READ);
745 pass[state.indirect.con] = state.indirect.msg;
747 pass[state.indirect.cmd] = state.indirect.con;
845 if (!strmatch(s, "/dev/fdp/*")) state.indirect.con = 1;
887 if (!state.indirect.con)
899 if ((state.indirect.con || !cssend(fd, fds, i)) && csread(fd, s, 7, CS_EXACT) == 7 && s[0] == '#' && !(errno = (int)strtol(s + 1, NiL, 10))) do
901 if (state.indirect.con)
910 if (state.indirect.con)
932 if (state.indirect.con)
939 state.indirect.con = pfd;
948 csfd(state.indirect.con = fd, 0);