mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-03 12:35:02 +00:00
patch 1of2 to prevent kill -1 syslogd from hanging the console
blindly applied patch provided by Christoph Robitschko: *** cons.c.orig Sat Jun 12 07:57:53 1993 --- cons.c Thu Aug 19 22:34:53 1993 *************** *** 56,61 **** --- 56,62 ---- #include "sys/tty.h" #include "sys/file.h" #include "sys/conf.h" + #include "sys/vnode.h" #include "cons.h" *************** *** 105,118 **** --- 106,130 ---- (*cp->cn_init)(cp); } + static struct vnode *cnopenvp = NULLVP; + + cnopen(dev, flag, mode, p) dev_t dev; int flag, mode; struct proc *p; { + int error; + + if (cn_tab == NULL) return (0); dev = cn_tab->cn_dev; + if (cnopenvp == NULLVP) + if ((error = getdevvp(dev, &cnopenvp, VCHR))) { + printf("cnopen: getdevvp returned %d !\n", error); + return(error); + } return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p)); } *************** *** 121,130 **** int flag, mode; struct proc *p; { if (cn_tab == NULL) return (0); dev = cn_tab->cn_dev; ! return ((*cdevsw[major(dev)].d_close)(dev, flag, mode, p)); } cnread(dev, uio, flag) --- 133,153 ---- int flag, mode; struct proc *p; { + int error; + + if (cn_tab == NULL) return (0); dev = cn_tab->cn_dev; ! if (vcount(cnopenvp) <= 1) ! error = (*cdevsw[major(dev)].d_close)(dev, flag, mode, p); ! else ! error = 0; ! if (error == 0) { ! vrele(cnopenvp); ! cnopenvp = NULLVP; ! return(error); ! } } cnread(dev, uio, flag)
This commit is contained in:
parent
79601a3464
commit
5bb374bc76
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301
@ -56,6 +56,7 @@
|
||||
#include "sys/tty.h"
|
||||
#include "sys/file.h"
|
||||
#include "sys/conf.h"
|
||||
#include "sys/vnode.h"
|
||||
|
||||
#include "cons.h"
|
||||
|
||||
@ -105,14 +106,25 @@ cninit()
|
||||
(*cp->cn_init)(cp);
|
||||
}
|
||||
|
||||
static struct vnode *cnopenvp = NULLVP;
|
||||
|
||||
|
||||
cnopen(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int error;
|
||||
|
||||
|
||||
if (cn_tab == NULL)
|
||||
return (0);
|
||||
dev = cn_tab->cn_dev;
|
||||
if (cnopenvp == NULLVP)
|
||||
if ((error = getdevvp(dev, &cnopenvp, VCHR))) {
|
||||
printf("cnopen: getdevvp returned %d !\n", error);
|
||||
return(error);
|
||||
}
|
||||
return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p));
|
||||
}
|
||||
|
||||
@ -121,10 +133,21 @@ cnclose(dev, flag, mode, p)
|
||||
int flag, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int error;
|
||||
|
||||
|
||||
if (cn_tab == NULL)
|
||||
return (0);
|
||||
dev = cn_tab->cn_dev;
|
||||
return ((*cdevsw[major(dev)].d_close)(dev, flag, mode, p));
|
||||
if (vcount(cnopenvp) <= 1)
|
||||
error = (*cdevsw[major(dev)].d_close)(dev, flag, mode, p);
|
||||
else
|
||||
error = 0;
|
||||
if (error == 0) {
|
||||
vrele(cnopenvp);
|
||||
cnopenvp = NULLVP;
|
||||
return(error);
|
||||
}
|
||||
}
|
||||
|
||||
cnread(dev, uio, flag)
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "sys/tty.h"
|
||||
#include "sys/file.h"
|
||||
#include "sys/conf.h"
|
||||
#include "sys/vnode.h"
|
||||
|
||||
#include "cons.h"
|
||||
|
||||
@ -105,14 +106,25 @@ cninit()
|
||||
(*cp->cn_init)(cp);
|
||||
}
|
||||
|
||||
static struct vnode *cnopenvp = NULLVP;
|
||||
|
||||
|
||||
cnopen(dev, flag, mode, p)
|
||||
dev_t dev;
|
||||
int flag, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int error;
|
||||
|
||||
|
||||
if (cn_tab == NULL)
|
||||
return (0);
|
||||
dev = cn_tab->cn_dev;
|
||||
if (cnopenvp == NULLVP)
|
||||
if ((error = getdevvp(dev, &cnopenvp, VCHR))) {
|
||||
printf("cnopen: getdevvp returned %d !\n", error);
|
||||
return(error);
|
||||
}
|
||||
return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p));
|
||||
}
|
||||
|
||||
@ -121,10 +133,21 @@ cnclose(dev, flag, mode, p)
|
||||
int flag, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int error;
|
||||
|
||||
|
||||
if (cn_tab == NULL)
|
||||
return (0);
|
||||
dev = cn_tab->cn_dev;
|
||||
return ((*cdevsw[major(dev)].d_close)(dev, flag, mode, p));
|
||||
if (vcount(cnopenvp) <= 1)
|
||||
error = (*cdevsw[major(dev)].d_close)(dev, flag, mode, p);
|
||||
else
|
||||
error = 0;
|
||||
if (error == 0) {
|
||||
vrele(cnopenvp);
|
||||
cnopenvp = NULLVP;
|
||||
return(error);
|
||||
}
|
||||
}
|
||||
|
||||
cnread(dev, uio, flag)
|
||||
|
Loading…
Reference in New Issue
Block a user