12extern int read(
int,
char *,
int);
13extern int write(
int,
char *,
int);
32void doit(
int fdleft,
int fdright)
53 io0->events = IOPAUSE_READ;
59 ioleft->events = IOPAUSE_WRITE;
65 ioright->fd = fdright;
66 ioright->events = IOPAUSE_READ;
72 io1->events = IOPAUSE_WRITE;
76 taia_uint(&deadline,3600);
77 taia_add(&deadline,&stamp,&deadline);
78 riop = iopause(x,xlen,&deadline,&stamp);
80 if (riop > 0 && io0 && io0->revents) {
90 for (i = 0; i < r; ++i) {
101 if (ioleft && ioleft->revents) {
108 if (ioright && ioright->revents) {
114 for (i = 0;i < r;++i) {
123 if (io1 && io1->revents) {
134int main(
int argc,
char **argv,
char **envp)
140 logmsg(
WHO,100,USAGE,
"program [ arg ... ]");
143 if (
pipe(piin) == -1)
144 logmsg(
WHO,111,FATAL,
"unable to create pipe");
145 if (
pipe(piout) == -1)
146 logmsg(
WHO,111,FATAL,
"unable to create pipe");
150 logmsg(
WHO,111,FATAL,
"unable to fork");
152 sig_ignore(sig_pipe);
155 doit(piin[1],piout[0]);
160 if (fd_move(0,piin[0]) == -1)
161 logmsg(
WHO,111,FATAL,
"unable to move descriptors");
162 if (fd_move(1,piout[1]) == -1)
163 logmsg(
WHO,111,FATAL,
"unable to move descriptors");
165 pathexec_run(argv[1],argv + 1,envp);
166 logmsg(
WHO,111,FATAL,B(
"unable to run: ",argv[1]));
int read(int, char *, int)
void doit(int fdleft, int fdright)
int write(int, char *, int)