diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/printk.c | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 809cf9a258a0..3e162d867098 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -259,21 +259,6 @@ static inline void boot_delay_msec(void) | |||
259 | } | 259 | } |
260 | #endif | 260 | #endif |
261 | 261 | ||
262 | /* | ||
263 | * Commands to do_syslog: | ||
264 | * | ||
265 | * 0 -- Close the log. Currently a NOP. | ||
266 | * 1 -- Open the log. Currently a NOP. | ||
267 | * 2 -- Read from the log. | ||
268 | * 3 -- Read all messages remaining in the ring buffer. | ||
269 | * 4 -- Read and clear all messages remaining in the ring buffer | ||
270 | * 5 -- Clear ring buffer. | ||
271 | * 6 -- Disable printk's to console | ||
272 | * 7 -- Enable printk's to console | ||
273 | * 8 -- Set level of messages printed to console | ||
274 | * 9 -- Return number of unread characters in the log buffer | ||
275 | * 10 -- Return size of the log buffer | ||
276 | */ | ||
277 | int do_syslog(int type, char __user *buf, int len, bool from_file) | 262 | int do_syslog(int type, char __user *buf, int len, bool from_file) |
278 | { | 263 | { |
279 | unsigned i, j, limit, count; | 264 | unsigned i, j, limit, count; |
@@ -286,11 +271,11 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
286 | return error; | 271 | return error; |
287 | 272 | ||
288 | switch (type) { | 273 | switch (type) { |
289 | case 0: /* Close log */ | 274 | case SYSLOG_ACTION_CLOSE: /* Close log */ |
290 | break; | 275 | break; |
291 | case 1: /* Open log */ | 276 | case SYSLOG_ACTION_OPEN: /* Open log */ |
292 | break; | 277 | break; |
293 | case 2: /* Read from log */ | 278 | case SYSLOG_ACTION_READ: /* Read from log */ |
294 | error = -EINVAL; | 279 | error = -EINVAL; |
295 | if (!buf || len < 0) | 280 | if (!buf || len < 0) |
296 | goto out; | 281 | goto out; |
@@ -321,10 +306,12 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
321 | if (!error) | 306 | if (!error) |
322 | error = i; | 307 | error = i; |
323 | break; | 308 | break; |
324 | case 4: /* Read/clear last kernel messages */ | 309 | /* Read/clear last kernel messages */ |
310 | case SYSLOG_ACTION_READ_CLEAR: | ||
325 | do_clear = 1; | 311 | do_clear = 1; |
326 | /* FALL THRU */ | 312 | /* FALL THRU */ |
327 | case 3: /* Read last kernel messages */ | 313 | /* Read last kernel messages */ |
314 | case SYSLOG_ACTION_READ_ALL: | ||
328 | error = -EINVAL; | 315 | error = -EINVAL; |
329 | if (!buf || len < 0) | 316 | if (!buf || len < 0) |
330 | goto out; | 317 | goto out; |
@@ -377,21 +364,25 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
377 | } | 364 | } |
378 | } | 365 | } |
379 | break; | 366 | break; |
380 | case 5: /* Clear ring buffer */ | 367 | /* Clear ring buffer */ |
368 | case SYSLOG_ACTION_CLEAR: | ||
381 | logged_chars = 0; | 369 | logged_chars = 0; |
382 | break; | 370 | break; |
383 | case 6: /* Disable logging to console */ | 371 | /* Disable logging to console */ |
372 | case SYSLOG_ACTION_CONSOLE_OFF: | ||
384 | if (saved_console_loglevel == -1) | 373 | if (saved_console_loglevel == -1) |
385 | saved_console_loglevel = console_loglevel; | 374 | saved_console_loglevel = console_loglevel; |
386 | console_loglevel = minimum_console_loglevel; | 375 | console_loglevel = minimum_console_loglevel; |
387 | break; | 376 | break; |
388 | case 7: /* Enable logging to console */ | 377 | /* Enable logging to console */ |
378 | case SYSLOG_ACTION_CONSOLE_ON: | ||
389 | if (saved_console_loglevel != -1) { | 379 | if (saved_console_loglevel != -1) { |
390 | console_loglevel = saved_console_loglevel; | 380 | console_loglevel = saved_console_loglevel; |
391 | saved_console_loglevel = -1; | 381 | saved_console_loglevel = -1; |
392 | } | 382 | } |
393 | break; | 383 | break; |
394 | case 8: /* Set level of messages printed to console */ | 384 | /* Set level of messages printed to console */ |
385 | case SYSLOG_ACTION_CONSOLE_LEVEL: | ||
395 | error = -EINVAL; | 386 | error = -EINVAL; |
396 | if (len < 1 || len > 8) | 387 | if (len < 1 || len > 8) |
397 | goto out; | 388 | goto out; |
@@ -402,10 +393,12 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
402 | saved_console_loglevel = -1; | 393 | saved_console_loglevel = -1; |
403 | error = 0; | 394 | error = 0; |
404 | break; | 395 | break; |
405 | case 9: /* Number of chars in the log buffer */ | 396 | /* Number of chars in the log buffer */ |
397 | case SYSLOG_ACTION_SIZE_UNREAD: | ||
406 | error = log_end - log_start; | 398 | error = log_end - log_start; |
407 | break; | 399 | break; |
408 | case 10: /* Size of the log buffer */ | 400 | /* Size of the log buffer */ |
401 | case SYSLOG_ACTION_SIZE_BUFFER: | ||
409 | error = log_buf_len; | 402 | error = log_buf_len; |
410 | break; | 403 | break; |
411 | default: | 404 | default: |