This commit is contained in:
Oliver Lehmann 1989-01-24 18:05:09 +00:00
parent 82156416e4
commit 1ab047d549
4 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# include <stdio.h>
# include "gen.h"
# include "../h/pipes.h"
/*
** COPY PIPES
**
** Copys pipe 'fromd' to pipe 'tod' using pipe buffers 'fromb'
** and 'tob'.
**
** Neither pipe is primed or otherwise set up. The end of pipe
** is copied.
*/
copypipes(fromb, fromd, tob, tod)
register struct pipfrmt *fromb;
register struct pipfrmt *tob;
int fromd;
int tod;
{
register int i;
char buf[PBUFSIZ];
while ((i = rdpipe(P_NORM, fromb, fromd, buf, sizeof buf)) > 0)
wrpipe(P_NORM, tob, tod, buf, i);
wrpipe(P_END, tob, tod);
}

View File

@ -0,0 +1,26 @@
# include <stdio.h>
# include "gen.h"
# include "../h/pipes.h"
/*
** ENDJOB -- default end of job processing
**
** This routine is called on a clean exit from the system. It is
** supposed to do any cleanup processing and the like. This copy
** is a default version, which just returns zero.
**
** The value of end_job() is passed as the exit status, and should
** normally be zero.
**
** Returns:
** exit status for process.
** (zero for this dummy version).
**
** Side Effects:
** as needed by user who redefines this, but none in
** this copy.
*/
end_job()
{
return (0);
}

View File

@ -0,0 +1,26 @@
# include <stdio.h>
# include "gen.h"
# include "../h/pipes.h"
/*
** DEFAULT PROC_ERROR ROUTINE
**
** This routine handles the processing of errors for a typical
** process. Please feel free to redefine it if you need other
** features.
*/
proc_error(s, fd)
register struct pipfrmt *s;
register int fd;
{
struct pipfrmt t;
if (fd != R_down)
AAsyserr(15027);
wrpipe(P_PRIME, &t, s->exec_id, (char *) 0, s->func_id);
t.err_id = s->err_id;
copypipes(s, fd, &t, W_up);
rdpipe(P_PRIME, s);
}

View File

@ -0,0 +1,31 @@
# include <stdio.h>
# include "gen.h"
# include "../h/pipes.h"
/*
** RESYNCHRONIZE PIPES AFTER AN INTERRUPT
**
** The pipes are all cleared out. This routines must be called
** by all processes in the system simultaneously. It should be
** called from the interrupt catching routine.
*/
resyncpipes()
{
register struct pipfrmt *pbuf;
register int fd;
struct pipfrmt buf;
wrpipe(P_PRIME, pbuf = &buf, 0, (char *) 0, 0);
/* synchronize the downward pipes */
if ((fd = R_up) >= 0)
rdpipe(P_INT, pbuf, fd);
if ((fd = W_down) >= 0)
wrpipe(P_INT, pbuf, fd);
/* now the upward pipes */
if ((fd = R_down) >= 0)
rdpipe(P_INT, pbuf, fd);
if ((fd = W_up) >= 0)
wrpipe(P_INT, pbuf, fd);
}