summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1998-06-25 00:47:48 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1998-06-25 00:47:48 +0000
commit337dc04a90f1f6e3bc2a2c56d3360e86b10c8f40 (patch)
tree8014eeb9fd62bba8560c50b15240e668b5442334
parent4c2f91dcc4e0f06953160bc0efdeb754c297451f (diff)
Notes
-rw-r--r--sys/conf/options7
-rw-r--r--sys/i386/i386/machdep.c12
-rw-r--r--sys/i386/i386/pmap.c6
-rw-r--r--sys/i386/include/vmparam.h6
-rw-r--r--sys/kern/subr_log.c12
-rw-r--r--sys/kern/subr_prf.c59
-rw-r--r--sys/sys/msgbuf.h15
-rw-r--r--usr.sbin/syslogd/syslogd.c7
8 files changed, 87 insertions, 37 deletions
diff --git a/sys/conf/options b/sys/conf/options
index d4607dc357ba2..f09361d331fb1 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -1,4 +1,4 @@
-# $Id: options,v 1.18.2.11 1998/06/05 21:38:02 julian Exp $
+# $Id: options,v 1.18.2.12 1998/06/23 21:33:18 peter Exp $
# Format:
# Option name filename
@@ -111,6 +111,11 @@ DPT_HANDLE_TIMEOUTS opt_dpt.h
DPT_ALLOW_MEMIO opt_dpt.h
DPT_HINTR_CHECK_SOFTC opt_dpt.h
TCPDEBUG
+
+# Size of the kernel message buffer
+MSGBUF_SIZE opt_msgbuf.h
+
+# Options for "kernel ppp" and pppd.
PPP_BSDCOMP opt_ppp.h
PPP_DEFLATE opt_ppp.h
PPP_FILTER opt_ppp.h
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 60bbe54e24259..161a958a2bea8 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.209.2.22 1998/03/23 05:30:29 jkh Exp $
+ * $Id: machdep.c,v 1.209.2.23 1998/05/06 19:04:05 gibbs Exp $
*/
#include "npx.h"
@@ -43,6 +43,7 @@
#include "opt_cpu.h"
#include "opt_ddb.h"
#include "opt_machdep.h"
+#include "opt_msgbuf.h"
#include "opt_perfmon.h"
#include "opt_sysvipc.h"
#include "opt_userconfig.h"
@@ -144,7 +145,6 @@ int bouncepages = 0;
#endif /* BOUNCE_BUFFERS */
extern int freebufspace;
-int msgbufmapped = 0; /* set when safe to use msgbuf */
int _udatasel, _ucodesel;
u_int atdevbase;
@@ -1304,7 +1304,7 @@ init386(first)
* calculation, etc.).
*/
while (phys_avail[pa_indx - 1] + PAGE_SIZE +
- round_page(sizeof(struct msgbuf)) >= phys_avail[pa_indx]) {
+ round_page(MSGBUF_SIZE) >= phys_avail[pa_indx]) {
physmem -= atop(phys_avail[pa_indx] - phys_avail[pa_indx - 1]);
phys_avail[pa_indx--] = 0;
phys_avail[pa_indx--] = 0;
@@ -1313,17 +1313,17 @@ init386(first)
Maxmem = atop(phys_avail[pa_indx]);
/* Trim off space for the message buffer. */
- phys_avail[pa_indx] -= round_page(sizeof(struct msgbuf));
+ phys_avail[pa_indx] -= round_page(MSGBUF_SIZE);
avail_end = phys_avail[pa_indx];
/* now running on new page tables, configured,and u/iom is accessible */
/* Map the message buffer. */
- for (off = 0; off < round_page(sizeof(struct msgbuf)); off += PAGE_SIZE)
+ for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE)
pmap_enter(kernel_pmap, (vm_offset_t)msgbufp + off,
avail_end + off, VM_PROT_ALL, TRUE);
- msgbufmapped = 1;
+ msgbufinit(msgbufp, MSGBUF_SIZE);
/* make a initial tss so microp can get interrupt stack on syscall! */
proc0.p_addr->u_pcb.pcb_tss.tss_esp0 = (int) kstack + UPAGES*PAGE_SIZE;
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index 779af0203044d..f1c14a8dff795 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
- * $Id: pmap.c,v 1.128.2.5 1997/04/23 02:20:06 davidg Exp $
+ * $Id: pmap.c,v 1.128.2.6 1997/06/26 00:05:16 tegge Exp $
*/
/*
@@ -73,6 +73,8 @@
#define PMAP_LOCK 1
#define PMAP_PVLIST 1
+#include "opt_msgbuf.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
@@ -314,7 +316,7 @@ pmap_bootstrap(firstaddr, loadaddr)
* XXX msgbufmap is not used.
*/
SYSMAP(struct msgbuf *, msgbufmap, msgbufp,
- atop(round_page(sizeof(struct msgbuf))))
+ atop(round_page(MSGBUF_SIZE)))
/*
* ptemap is used for pmap_pte_quick
diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h
index ae405d32b9c4d..5fb85a162e5b5 100644
--- a/sys/i386/include/vmparam.h
+++ b/sys/i386/include/vmparam.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91
- * $Id: vmparam.h,v 1.21.2.1 1997/03/25 04:54:02 dyson Exp $
+ * $Id: vmparam.h,v 1.21.2.2 1997/10/27 00:39:15 jkh Exp $
*/
@@ -50,9 +50,9 @@
/*
* Virtual memory related constants, all in bytes
*/
-#define MAXTSIZ (16UL*1024*1024) /* max text size */
+#define MAXTSIZ (128UL*1024*1024) /* max text size */
#ifndef DFLDSIZ
-#define DFLDSIZ (64UL*1024*1024) /* initial data size limit */
+#define DFLDSIZ (256UL*1024*1024) /* initial data size limit */
#endif
#ifndef MAXDSIZ
#define MAXDSIZ (512UL*1024*1024) /* max data size */
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c
index 4c27b38b7baec..d985972a3f675 100644
--- a/sys/kern/subr_log.c
+++ b/sys/kern/subr_log.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)subr_log.c 8.1 (Berkeley) 6/10/93
- * $Id: subr_log.c,v 1.17 1996/03/27 19:45:28 bde Exp $
+ * $Id: subr_log.c,v 1.18 1996/07/09 16:51:11 wollman Exp $
*/
/*
@@ -135,16 +135,16 @@ logread(dev, uio, flag)
while (uio->uio_resid > 0) {
l = mbp->msg_bufx - mbp->msg_bufr;
if (l < 0)
- l = MSG_BSIZE - mbp->msg_bufr;
+ l = mbp->msg_size - mbp->msg_bufr;
l = min(l, uio->uio_resid);
if (l == 0)
break;
- error = uiomove((caddr_t)&mbp->msg_bufc[mbp->msg_bufr],
- (int)l, uio);
+ error = uiomove((caddr_t)msgbufp->msg_ptr + mbp->msg_bufr,
+ (int)l, uio);
if (error)
break;
mbp->msg_bufr += l;
- if (mbp->msg_bufr >= MSG_BSIZE)
+ if (mbp->msg_bufr >= mbp->msg_size)
mbp->msg_bufr = 0;
}
return (error);
@@ -213,7 +213,7 @@ logioctl(dev, com, data, flag, p)
l = msgbufp->msg_bufx - msgbufp->msg_bufr;
splx(s);
if (l < 0)
- l += MSG_BSIZE;
+ l += msgbufp->msg_size;
*(int *)data = l;
break;
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 10c57702c25d6..7144cf47b39b7 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -36,13 +36,14 @@
* SUCH DAMAGE.
*
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
- * $Id: subr_prf.c,v 1.38 1996/08/19 20:07:07 julian Exp $
+ * $Id: subr_prf.c,v 1.39 1996/08/31 16:52:25 bde Exp $
*/
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/kernel.h>
#include <sys/msgbuf.h>
#include <sys/proc.h>
#include <sys/tty.h>
@@ -71,6 +72,7 @@ static void putchar __P((int ch, void *arg));
static char *ksprintn __P((u_long num, int base, int *len));
static int consintr = 1; /* Ok to handle console interrupts? */
+static int msgbufmapped; /* Set when safe to use msgbuf */
/*
* Warn that a system table is full.
@@ -275,7 +277,7 @@ vprintf(const char *fmt, va_list ap)
/*
* Print a character on console or users terminal. If destination is
- * the console then the last MSGBUFS characters are saved in msgbuf for
+ * the console then the last bunch of characters are saved in msgbuf for
* inspection later.
*/
static void
@@ -589,19 +591,54 @@ msglogchar(int c, void *dummyarg)
if (c != '\0' && c != '\r' && c != 0177 && msgbufmapped) {
mbp = msgbufp;
- if (mbp->msg_magic != MSG_MAGIC ||
- mbp->msg_bufx >= MSG_BSIZE ||
- mbp->msg_bufr >= MSG_BSIZE) {
- bzero(mbp, sizeof(struct msgbuf));
- mbp->msg_magic = MSG_MAGIC;
- }
- mbp->msg_bufc[mbp->msg_bufx++] = c;
- if (mbp->msg_bufx >= MSG_BSIZE)
+ mbp->msg_ptr[mbp->msg_bufx++] = c;
+ if (mbp->msg_bufx >= mbp->msg_size)
mbp->msg_bufx = 0;
/* If the buffer is full, keep the most recent data. */
if (mbp->msg_bufr == mbp->msg_bufx) {
- if (++mbp->msg_bufr >= MSG_BSIZE)
+ if (++mbp->msg_bufr >= mbp->msg_size)
mbp->msg_bufr = 0;
}
}
}
+
+void
+msgbufinit(void *ptr, size_t size)
+{
+ char *cp;
+
+ cp = (char *)ptr;
+ msgbufp = (struct msgbuf *) (cp + size - sizeof(*msgbufp));
+ if (msgbufp->msg_magic != MSG_MAGIC || msgbufp->msg_ptr != cp) {
+ bzero(cp, size);
+ msgbufp->msg_magic = MSG_MAGIC;
+ msgbufp->msg_size = (char *)msgbufp - cp;
+ msgbufp->msg_ptr = cp;
+ }
+ msgbufmapped = 1;
+}
+
+#include "opt_ddb.h"
+#ifdef DDB
+#include <ddb/ddb.h>
+
+DB_SHOW_COMMAND(msgbuf, db_show_msgbuf)
+{
+ int i, j;
+
+ if (!msgbufmapped) {
+ db_printf("msgbuf not mapped yet\n");
+ return;
+ }
+ db_printf("msgbufp = %p\n", msgbufp);
+ db_printf("magic = %x, size = %d, r= %d, w = %d, ptr = %p\n",
+ msgbufp->msg_magic, msgbufp->msg_size, msgbufp->msg_bufr,
+ msgbufp->msg_bufx, msgbufp->msg_ptr);
+ for (i = 0; i < msgbufp->msg_size; i++) {
+ j = (i + msgbufp->msg_bufr) % msgbufp->msg_size;
+ db_printf("%c", msgbufp->msg_ptr[j]);
+ }
+ db_printf("\n");
+}
+
+#endif /* DDB */
diff --git a/sys/sys/msgbuf.h b/sys/sys/msgbuf.h
index 7b7d6411c5ffb..1e09e753e0f38 100644
--- a/sys/sys/msgbuf.h
+++ b/sys/sys/msgbuf.h
@@ -31,23 +31,30 @@
* SUCH DAMAGE.
*
* @(#)msgbuf.h 8.1 (Berkeley) 6/2/93
- * $Id: msgbuf.h,v 1.6 1995/08/07 07:58:23 davidg Exp $
+ * $Id: msgbuf.h,v 1.6.4.1 1997/01/28 11:28:36 phk Exp $
*/
#ifndef _SYS_MSGBUF_H_
#define _SYS_MSGBUF_H_
-#define MSG_BSIZE (8192 - 3 * sizeof(unsigned int))
struct msgbuf {
-#define MSG_MAGIC 0x063061
+#define MSG_MAGIC 0x063062
unsigned int msg_magic;
+ unsigned int msg_size; /* size of buffer area */
unsigned int msg_bufx; /* write pointer */
unsigned int msg_bufr; /* read pointer */
- char msg_bufc[MSG_BSIZE]; /* buffer */
+ char * msg_ptr; /* pointer to buffer */
};
+
#ifdef KERNEL
extern int msgbufmapped;
extern struct msgbuf *msgbufp;
+void msgbufinit __P((void *ptr, size_t size));
+
+#if !defined(MSGBUF_SIZE)
+#define MSGBUF_SIZE 8192
+#endif
+
#endif
#endif
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 5901c71b6fbda..db3b3ff6097e2 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#endif
static const char rcsid[] =
- "$Id: syslogd.c,v 1.12.2.10 1998/03/01 11:09:02 jraynard Exp $";
+ "$Id: syslogd.c,v 1.12.2.11 1998/03/09 13:56:07 jkh Exp $";
#endif /* not lint */
/*
@@ -81,7 +81,6 @@ static const char rcsid[] =
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/socket.h>
-#include <sys/msgbuf.h>
#include <sys/queue.h>
#include <sys/uio.h>
#include <sys/un.h>
@@ -286,7 +285,7 @@ main(argc, argv)
struct sockaddr_un sunx, fromunix;
struct sockaddr_in sin, frominet;
FILE *fp;
- char *p, *hname, line[MSG_BSIZE + 1];
+ char *p, *hname, line[MAXLINE + 1];
struct timeval tv, *tvp;
pid_t ppid;
@@ -433,7 +432,7 @@ main(argc, argv)
}
dprintf("got a message (%d, %#x)\n", nfds, readfds);
if (readfds & klogm) {
- i = read(fklog, line, sizeof(line) - 1);
+ i = read(fklog, line, MAXLINE - 1);
if (i > 0) {
line[i] = '\0';
printsys(line);