From 1ab047d5497f931b099a5b29a6f94b3baf4db3f4 Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Tue, 24 Jan 1989 18:05:09 +0000 Subject: [PATCH] ING_DB --- WEGA/contrib/ingres/dbs/src/iutil/copypipes.c | 26 ++++++++++++++++ WEGA/contrib/ingres/dbs/src/iutil/end_job.c | 26 ++++++++++++++++ .../contrib/ingres/dbs/src/iutil/proc_error.c | 26 ++++++++++++++++ .../ingres/dbs/src/iutil/resyncpipes.c | 31 +++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 WEGA/contrib/ingres/dbs/src/iutil/copypipes.c create mode 100644 WEGA/contrib/ingres/dbs/src/iutil/end_job.c create mode 100644 WEGA/contrib/ingres/dbs/src/iutil/proc_error.c create mode 100644 WEGA/contrib/ingres/dbs/src/iutil/resyncpipes.c diff --git a/WEGA/contrib/ingres/dbs/src/iutil/copypipes.c b/WEGA/contrib/ingres/dbs/src/iutil/copypipes.c new file mode 100644 index 0000000..51c331b --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/iutil/copypipes.c @@ -0,0 +1,26 @@ +# include +# 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); +} diff --git a/WEGA/contrib/ingres/dbs/src/iutil/end_job.c b/WEGA/contrib/ingres/dbs/src/iutil/end_job.c new file mode 100644 index 0000000..067e587 --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/iutil/end_job.c @@ -0,0 +1,26 @@ +# include +# 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); +} diff --git a/WEGA/contrib/ingres/dbs/src/iutil/proc_error.c b/WEGA/contrib/ingres/dbs/src/iutil/proc_error.c new file mode 100644 index 0000000..7405542 --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/iutil/proc_error.c @@ -0,0 +1,26 @@ +# include +# 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); +} diff --git a/WEGA/contrib/ingres/dbs/src/iutil/resyncpipes.c b/WEGA/contrib/ingres/dbs/src/iutil/resyncpipes.c new file mode 100644 index 0000000..a9c0186 --- /dev/null +++ b/WEGA/contrib/ingres/dbs/src/iutil/resyncpipes.c @@ -0,0 +1,31 @@ +# include +# 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); +}