mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 18:26:48 +00:00
* 实现写日志和读取日志,并且能够在用户态下执行dmesg命令查看日志 * 通过klogctl实现dmesg * 改用ConstGenericRingBuffer作内核缓冲区 * 更改缓冲区容量 * 将能够输出到控制台的日志级别改为日志级别枚举类,使用SpinLock控制KMSG,使用枚举类定义SYSLOG_ACTION,将do_syslog系统调用接口放在syscall.rs * fix warning * 完善do_syslog注释 * 将KMSG接入kinfo、kdebug等 * fix warning * 修复显示的秒数不正确,·以及无法通过CI的问题
31 lines
622 B
C
31 lines
622 B
C
#pragma once
|
|
|
|
#include <stdio.h>
|
|
#include <malloc.h>
|
|
#include <string.h>
|
|
|
|
/**
|
|
* @brief 识别dmesg程序的第一个选项参数
|
|
*
|
|
* @param arg dmesg命令第一个选项参数
|
|
* @return int 有效时返回对应选项码,无效时返回 -1
|
|
*/
|
|
int getopt(char *arg);
|
|
|
|
/**
|
|
* @brief 识别dmesg程序的第二个选项参数
|
|
*
|
|
* @param arg dmesg命令第一个选项参数
|
|
* @return int 有效时返回设置的日志级别,无效时返回 -1
|
|
*/
|
|
int getlevel(char *arg);
|
|
|
|
/**
|
|
* @brief 打印dmesg手册
|
|
*/
|
|
void print_help_msg();
|
|
|
|
/**
|
|
* @brief 打印dmesg错误使用的信息
|
|
*/
|
|
void print_bad_usage_msg(); |