实现设置pcb名字和vsnprintf (#72)

* 实现pcb设置名字

* 实现设置pcb名字,实现vsnprintf

* 修改set_pcb_name和va_end

* bugfix: 修正一些小问题

Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
houmkh
2022-10-31 20:46:20 +08:00
committed by GitHub
parent 8a080f3cce
commit 8e3f5674f8
10 changed files with 174 additions and 47 deletions

View File

@ -5,6 +5,22 @@
#include <common/err.h>
#include <process/process.h>
/**
* @brief kthread信息
* 该结构体将会绑定到pcb的worker_private中
*/
struct kthread_info_t
{
uint64_t flags;
uint32_t cpu;
int result;
int (*thread_fn)(void *);
void *data;
// todo: 将这里改为completion机制
bool exited; // 是否已退出
char *full_name; // 内核线程的名称
};
struct process_control_block *kthread_create_on_node(int (*thread_fn)(void *data),
void *data,
int node,
@ -74,4 +90,5 @@ int kthread_mechanism_init();
* @param pcb pcb
* @return bool 成功或失败
*/
bool kthread_set_worker_private(struct process_control_block *pcb);
bool kthread_set_worker_private(struct process_control_block *pcb);

View File

@ -38,6 +38,7 @@
extern unsigned char font_ascii[256][16]; //导出ascii字体的bitmap8*16大小 ps:位于font.h中
/**
* @brief 将字符串按照fmt和args中的内容进行格式化然后保存到buf中
*
@ -48,6 +49,17 @@ extern unsigned char font_ascii[256][16]; //导出ascii字体的bitmap8*16大
*/
int vsprintf(char *buf, const char *fmt, va_list args);
/**
* @brief 将字符串按照fmt和args中的内容进行格式化截取字符串前buf_size-1保存到buf中
*
* @param buf 结果缓冲区大小为buf_size
* @param fmt 格式化字符串
* @param buf_size 缓冲区长度
* @param args 内容
* @return 最终字符串的长度
*/
int vsnprintf(char *buf, const char *fmt, int buf_size, va_list args);
/**
* @brief 格式化打印字符串
*