Deleted Added
full compact
subr_log.c (8876) subr_log.c (9979)
1/*
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)subr_log.c 8.1 (Berkeley) 6/10/93
1/*
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)subr_log.c 8.1 (Berkeley) 6/10/93
34 * $Id: subr_log.c,v 1.7 1995/04/29 11:36:47 jkh Exp $
34 * $Id: subr_log.c,v 1.8 1995/05/30 08:05:52 rgrimes Exp $
35 */
36
37/*
38 * Error log buffer for kernel printf's.
39 */
40
41#include <sys/param.h>
42#include <sys/systm.h>

--- 25 unchanged lines hidden (view full) ---

68 struct proc *p;
69{
70 register struct msgbuf *mbp = msgbufp;
71
72 if (log_open)
73 return (EBUSY);
74 log_open = 1;
75 logsoftc.sc_pgid = p->p_pid; /* signal process only */
35 */
36
37/*
38 * Error log buffer for kernel printf's.
39 */
40
41#include <sys/param.h>
42#include <sys/systm.h>

--- 25 unchanged lines hidden (view full) ---

68 struct proc *p;
69{
70 register struct msgbuf *mbp = msgbufp;
71
72 if (log_open)
73 return (EBUSY);
74 log_open = 1;
75 logsoftc.sc_pgid = p->p_pid; /* signal process only */
76 /*
77 * Potential race here with putchar() but since putchar should be
78 * called by autoconf, msg_magic should be initialized by the time
79 * we get here.
80 */
81 if (mbp->msg_magic != MSG_MAGIC) {
82 register int i;
83
84 mbp->msg_magic = MSG_MAGIC;
85 mbp->msg_bufx = mbp->msg_bufr = 0;
86 for (i=0; i < MSG_BSIZE; i++)
87 mbp->msg_bufc[i] = 0;
88 }
89 return (0);
90}
91
92/*ARGSUSED*/
93int
94logclose(dev, flag, mode, p)
95 dev_t dev;
96 int flag, mode;

--- 40 unchanged lines hidden (view full) ---

137 l = min(l, uio->uio_resid);
138 if (l == 0)
139 break;
140 error = uiomove((caddr_t)&mbp->msg_bufc[mbp->msg_bufr],
141 (int)l, uio);
142 if (error)
143 break;
144 mbp->msg_bufr += l;
76 return (0);
77}
78
79/*ARGSUSED*/
80int
81logclose(dev, flag, mode, p)
82 dev_t dev;
83 int flag, mode;

--- 40 unchanged lines hidden (view full) ---

124 l = min(l, uio->uio_resid);
125 if (l == 0)
126 break;
127 error = uiomove((caddr_t)&mbp->msg_bufc[mbp->msg_bufr],
128 (int)l, uio);
129 if (error)
130 break;
131 mbp->msg_bufr += l;
145 if (mbp->msg_bufr < 0 || mbp->msg_bufr >= MSG_BSIZE)
132 if (mbp->msg_bufr >= MSG_BSIZE)
146 mbp->msg_bufr = 0;
147 }
148 return (error);
149}
150
151/*ARGSUSED*/
152int
153logselect(dev, rw, p)

--- 87 unchanged lines hidden ---
133 mbp->msg_bufr = 0;
134 }
135 return (error);
136}
137
138/*ARGSUSED*/
139int
140logselect(dev, rw, p)

--- 87 unchanged lines hidden ---