Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148091701
D17877.1785342336.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D17877.1785342336.diff
View Options
Index: head/sys/kern/tty.c
===================================================================
--- head/sys/kern/tty.c
+++ head/sys/kern/tty.c
@@ -33,6 +33,7 @@
__FBSDID("$FreeBSD$");
#include "opt_capsicum.h"
+#include "opt_printf.h"
#include <sys/param.h>
#include <sys/capsicum.h>
@@ -106,6 +107,12 @@
#define TTYBUF_MAX 65536
+#ifdef PRINTF_BUFR_SIZE
+#define TTY_PRBUF_SIZE PRINTF_BUFR_SIZE
+#else
+#define TTY_PRBUF_SIZE 256
+#endif
+
/*
* Allocate buffer space if necessary, and set low watermarks, based on speed.
* Note that the ttyxxxq_setsize() functions may drop and then reacquire the tty
@@ -1051,7 +1058,9 @@
PATCH_FUNC(busy);
#undef PATCH_FUNC
- tp = malloc(sizeof(struct tty), M_TTY, M_WAITOK|M_ZERO);
+ tp = malloc(sizeof(struct tty) + TTY_PRBUF_SIZE, M_TTY,
+ M_WAITOK | M_ZERO);
+ tp->t_prbufsz = TTY_PRBUF_SIZE;
tp->t_devsw = tsw;
tp->t_devswsoftc = sc;
tp->t_flags = tsw->tsw_flags;
Index: head/sys/kern/tty_info.c
===================================================================
--- head/sys/kern/tty_info.c
+++ head/sys/kern/tty_info.c
@@ -271,7 +271,7 @@
if (tty_checkoutq(tp) == 0)
return;
- (void)sbuf_new(&sb, tp->t_prbuf, sizeof(tp->t_prbuf), SBUF_FIXEDLEN);
+ (void)sbuf_new(&sb, tp->t_prbuf, tp->t_prbufsz, SBUF_FIXEDLEN);
sbuf_set_drain(&sb, sbuf_tty_drain, tp);
/* Print load average. */
Index: head/sys/sys/tty.h
===================================================================
--- head/sys/sys/tty.h
+++ head/sys/sys/tty.h
@@ -133,12 +133,8 @@
void *t_hooksoftc; /* (t) Soft config, for hooks. */
struct cdev *t_dev; /* (c) Primary character device. */
-#ifndef PRINTF_BUFR_SIZE
-#define TTY_PRINTF_SIZE 256
-#else
-#define TTY_PRINTF_SIZE PRINTF_BUFR_SIZE
-#endif
- char t_prbuf[TTY_PRINTF_SIZE]; /* (t) */
+ size_t t_prbufsz; /* (t) SIGINFO buffer size. */
+ char t_prbuf[]; /* (t) SIGINFO buffer. */
};
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 29, 4:25 PM (6 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29289969
Default Alt Text
D17877.1785342336.diff (1 KB)
Attached To
Mode
D17877: Avoid conditional references of PRINTF_BUFR_SIZE in headers.
Attached
Detach File
Event Timeline
Log In to Comment