Lines 41-46
Link Here
|
41 |
#include <sys/tty.h> |
41 |
#include <sys/tty.h> |
42 |
#include <sys/kernel.h> |
42 |
#include <sys/kernel.h> |
43 |
#include <sys/malloc.h> |
43 |
#include <sys/malloc.h> |
|
|
44 |
#include <sys/sysctl.h> |
44 |
|
45 |
|
45 |
#if defined(__sparc64__) || defined(__powerpc__) |
46 |
#if defined(__sparc64__) || defined(__powerpc__) |
46 |
#include <machine/sc_machdep.h> |
47 |
#include <machine/sc_machdep.h> |
Lines 77-93
Link Here
|
77 |
static int extra_history_size |
78 |
static int extra_history_size |
78 |
= SC_MAX_HISTORY_SIZE - SC_HISTORY_SIZE*MAXCONS; |
79 |
= SC_MAX_HISTORY_SIZE - SC_HISTORY_SIZE*MAXCONS; |
79 |
|
80 |
|
|
|
81 |
static int sc_history_size = SC_HISTORY_SIZE; |
82 |
|
83 |
SYSCTL_DECL(_hw_syscons); |
84 |
SYSCTL_INT(_hw_syscons, OID_AUTO, history_size, CTLFLAG_RDTUN, &sc_history_size, 0, |
85 |
"Number of history buffer lines"); |
86 |
|
80 |
/* local functions */ |
87 |
/* local functions */ |
81 |
static void copy_history(sc_vtb_t *from, sc_vtb_t *to); |
88 |
static void copy_history(sc_vtb_t *from, sc_vtb_t *to); |
82 |
static void history_to_screen(scr_stat *scp); |
89 |
static void history_to_screen(scr_stat *scp); |
83 |
|
90 |
|
|
|
91 |
/* tune history buffer size */ |
92 |
void |
93 |
sc_init_history(void) |
94 |
{ |
95 |
|
96 |
TUNABLE_INT_FETCH("hw.syscons.history_size", &sc_history_size); |
97 |
if (sc_history_size < ROW * 4) |
98 |
sc_history_size = ROW * 4; |
99 |
extra_history_size = |
100 |
((sc_history_size * MAXCONS * MAXSC) > SC_MAX_HISTORY_SIZE ? |
101 |
sc_history_size * MAXCONS * MAXSC : SC_MAX_HISTORY_SIZE) - |
102 |
sc_history_size * MAXCONS; |
103 |
} |
104 |
|
84 |
/* allocate a history buffer */ |
105 |
/* allocate a history buffer */ |
85 |
int |
106 |
int |
86 |
sc_alloc_history_buffer(scr_stat *scp, int lines, int prev_ysize, int wait) |
107 |
sc_alloc_history_buffer(scr_stat *scp, int lines, int prev_ysize, int wait) |
87 |
{ |
108 |
{ |
88 |
/* |
109 |
/* |
89 |
* syscons unconditionally allocates buffers upto |
110 |
* syscons unconditionally allocates buffers upto |
90 |
* SC_HISTORY_SIZE lines or scp->ysize lines, whichever |
111 |
* sc_history_size lines or scp->ysize lines, whichever |
91 |
* is larger. A value greater than that is allowed, |
112 |
* is larger. A value greater than that is allowed, |
92 |
* subject to extra_history_size. |
113 |
* subject to extra_history_size. |
93 |
*/ |
114 |
*/ |
Lines 98-104
Link Here
|
98 |
int delta; /* lines to put back */ |
119 |
int delta; /* lines to put back */ |
99 |
|
120 |
|
100 |
if (lines <= 0) |
121 |
if (lines <= 0) |
101 |
lines = SC_HISTORY_SIZE; /* use the default value */ |
122 |
lines = sc_history_size; /* use the default value */ |
102 |
|
123 |
|
103 |
/* make it at least as large as the screen size */ |
124 |
/* make it at least as large as the screen size */ |
104 |
lines = imax(lines, scp->ysize); |
125 |
lines = imax(lines, scp->ysize); |
Lines 111-123
Link Here
|
111 |
delta = 0; |
132 |
delta = 0; |
112 |
if (prev_history) { |
133 |
if (prev_history) { |
113 |
cur_lines = sc_vtb_rows(history); |
134 |
cur_lines = sc_vtb_rows(history); |
114 |
min_lines = imax(SC_HISTORY_SIZE, prev_ysize); |
135 |
min_lines = imax(sc_history_size, prev_ysize); |
115 |
if (cur_lines > min_lines) |
136 |
if (cur_lines > min_lines) |
116 |
delta = cur_lines - min_lines; |
137 |
delta = cur_lines - min_lines; |
117 |
} |
138 |
} |
118 |
|
139 |
|
119 |
/* lines upto min_lines are always allowed. */ |
140 |
/* lines upto min_lines are always allowed. */ |
120 |
min_lines = imax(SC_HISTORY_SIZE, scp->ysize); |
141 |
min_lines = imax(sc_history_size, scp->ysize); |
121 |
if (lines > min_lines) { |
142 |
if (lines > min_lines) { |
122 |
if (lines - min_lines > extra_history_size + delta) { |
143 |
if (lines - min_lines > extra_history_size + delta) { |
123 |
/* too many lines are requested */ |
144 |
/* too many lines are requested */ |
Lines 196-202
Link Here
|
196 |
return; |
217 |
return; |
197 |
|
218 |
|
198 |
cur_lines = sc_vtb_rows(history); |
219 |
cur_lines = sc_vtb_rows(history); |
199 |
min_lines = imax(SC_HISTORY_SIZE, prev_ysize); |
220 |
min_lines = imax(sc_history_size, prev_ysize); |
200 |
extra_history_size += (cur_lines > min_lines) ? |
221 |
extra_history_size += (cur_lines > min_lines) ? |
201 |
cur_lines - min_lines : 0; |
222 |
cur_lines - min_lines : 0; |
202 |
|
223 |
|