to pgrp structure (use pgid), use read flag instead of local for non-blocking
SCCS-vsn: sys/kern/subr_log.c 7.7
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)subr_log.c 7.6 (Berkeley) %G%
+ * @(#)subr_log.c 7.7 (Berkeley) %G%
#define LOG_RDPRI (PZERO + 1)
#define LOG_RDPRI (PZERO + 1)
#define LOG_ASYNC 0x04
#define LOG_RDWAIT 0x08
struct logsoftc {
int sc_state; /* see above for possibilities */
struct proc *sc_selp; /* process waiting on select call */
#define LOG_ASYNC 0x04
#define LOG_RDWAIT 0x08
struct logsoftc {
int sc_state; /* see above for possibilities */
struct proc *sc_selp; /* process waiting on select call */
- struct pgrp *sc_pgrp; /* process group for async I/O */
+ int sc_pgid; /* process/group for async I/O */
} logsoftc;
int log_open; /* also used in log() */
} logsoftc;
int log_open; /* also used in log() */
if (log_open)
return (EBUSY);
log_open = 1;
if (log_open)
return (EBUSY);
log_open = 1;
- logsoftc.sc_selp = 0;
- logsoftc.sc_pgrp = u.u_procp->p_pgrp;
+ logsoftc.sc_pgid = u.u_procp->p_pid; /* signal process only */
/*
* Potential race here with putchar() but since putchar should be
* called by autoconf, msg_magic should be initialized by the time
/*
* Potential race here with putchar() but since putchar should be
* called by autoconf, msg_magic should be initialized by the time
log_open = 0;
logsoftc.sc_state = 0;
logsoftc.sc_selp = 0;
log_open = 0;
logsoftc.sc_state = 0;
logsoftc.sc_selp = 0;
- logsoftc.sc_pgrp = NULL;
dev_t dev;
struct uio *uio;
dev_t dev;
struct uio *uio;
{
register long l;
register int s;
{
register long l;
register int s;
s = splhigh();
while (msgbuf.msg_bufr == msgbuf.msg_bufx) {
s = splhigh();
while (msgbuf.msg_bufr == msgbuf.msg_bufx) {
- if (logsoftc.sc_state & LOG_NBIO) {
+ if (flag & IO_NDELAY) {
splx(s);
return (EWOULDBLOCK);
}
splx(s);
return (EWOULDBLOCK);
}
selwakeup(logsoftc.sc_selp, 0);
logsoftc.sc_selp = 0;
}
selwakeup(logsoftc.sc_selp, 0);
logsoftc.sc_selp = 0;
}
- if (logsoftc.sc_state & LOG_ASYNC)
- pgsignal(logsoftc.sc_pgrp, SIGIO, 0);
+ if (logsoftc.sc_state & LOG_ASYNC) {
+ if (logsoftc.sc_pgid < 0)
+ gsignal(logsoftc.sc_pgid, SIGIO);
+ else if (p = pfind(logsoftc.sc_pgid))
+ psignal(p, SIGIO);
+ }
if (logsoftc.sc_state & LOG_RDWAIT) {
wakeup((caddr_t)&msgbuf);
logsoftc.sc_state &= ~LOG_RDWAIT;
if (logsoftc.sc_state & LOG_RDWAIT) {
wakeup((caddr_t)&msgbuf);
logsoftc.sc_state &= ~LOG_RDWAIT;
-logioctl(com, data, flag)
+logioctl(dev, com, data, flag)
- if (*(int *)data)
- logsoftc.sc_state |= LOG_NBIO;
- else
- logsoftc.sc_state &= ~LOG_NBIO;
logsoftc.sc_state &= ~LOG_ASYNC;
break;
logsoftc.sc_state &= ~LOG_ASYNC;
break;
-#ifdef notdef /* XXX remove -- a single open device doesn't need this */
- case TIOCSPGRP: {
logsoftc.sc_pgid = *(int *)data;
break;
logsoftc.sc_pgid = *(int *)data;
break;
- *(int *)data = logsoftc.sc_pgrp->pg_id;
+ *(int *)data = logsoftc.sc_pgid;