contributed by < Jerejere0808
>
static inline void *get_loc_to_place(void *current, int size)
{
block_t *best_fit = NULL;
block_t *parse = current;
while (parse != NULL) {
if (parse->size >= (size + header_size)) {
if (best_fit == NULL || parse->size < best_fit->size) {
best_fit = parse;
}
}
parse = parse->prev;
}
parse = ((block_t *) current)->next;
while (parse != NULL) {
if (parse->size >= (size + header_size)) {
if (best_fit == NULL || parse->size < best_fit->size) {
best_fit = parse;
}
}
parse = parse->next;
}
if (best_fit != NULL) {
return best_fit;
} else {
return NULL;
}
}
title: Jerejere0808 (黃湙珵) categories: User ... 國立成功大學 電機工程所 113 級 (2022 ~ 2024) GitHub: Jerejere0808 2023 Linux 核心設計 自我評量 作業共筆 lab0-c: GitHub / HackMD
Jun 20, 2023contributed by < Jerejere0808 > $ sudo insmod kecho.ko port=1999 是如何讓 port=1999 傳遞到核心,作為核心模組初始化的參數呢? 首先透過 $modinfo khttpd.ko 可以看到核心模組的資訊裡面包含了參數 port 和 backlog,還有他們的型態。這是透過呼叫 module_param 來達成。 filename: /home/jeremy/linux2023/kecho/kecho.ko version: 0.1 description: Fast echo server in kernel author: National Cheng Kung University, Taiwan license: Dual MIT/GPL
May 15, 2023contributed by < Jerejere0808 > 新增以下資料結構使 fibonnaci 可以進行大數運算,其中 capacity 是用於分配多餘的記憶體空間,這樣就可以避免多次的 resize (realloc) , 只有在 capacity 不足時才會需要重新分配記憶體空間。 typedef struct _bn { unsigned int *number; unsigned int size; int sign; int capacity; } bn;
May 6, 2023contributed by < Jerejere0808 > 測驗 1 測驗 2 先解釋 static void local_irq_save(sigset_t *sig_set) { sigset_t block_set; sigfillset(&block_set);
Apr 16, 2023or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up