Enviado em 27/04/2023 - 14:11h
Estou tentando executar uma funcao de um modulo pra linux que eu construi, mas nao obtenho sucesso.
void fp_printk(int number, int decimal_places, char* destination)
{
printk(KERN_INFO "um test no inicio");
static char buffer[32] = { 0 };
int buf_index = 30;
int count_decimal_place = 0;
int point_include = 0;
for (; number && buf_index; --buf_index, number /= 10) {
count_decimal_place++;
if (!point_include && count_decimal_place > decimal_places) {
buffer[buf_index] = '.';
buf_index--;
point_include = 1;
}
buffer[buf_index] = "0123456789"[number % 10];
}
strcpy(destination, &buffer[buf_index + 1]);
}
EXPORT_SYMBOL(fp_printk);
static int __init fp_printk_init(void)
{
printk(KERN_INFO "%s: initial execute module", OURMODNAME);
char *dest = kmalloc(sizeof("12.34"), GFP_KERNEL);
fp_printk(1243, 2, dest);
printk(KERN_INFO, "%s", dest);
return 0;
}
printk(KERN_INFO, "before exec\n");
char *r = kmalloc(sizeof("12.34"), GFP_KERNEL);
extern __visible void fp_printk(number, decimal_places, r);
printk(KERN_INFO, "%s: %s\n", "test_fp_printk", r);
printk(KERN_INFO, "after exec\n");
[1210228.128703] test_fp_printk: before exec
[1210228.128712] test_fp_printk: after exec
Atualizar o macOS no Mac - Opencore Legacy Patcher
Crie alias para as tarefas que possuam longas linhas de comando - bash e zsh
Criando um gateway de internet com o Debian
Configuração básica do Conky para mostrar informações sobre a sua máquina no Desktop
Aprenda a criar músicas com Inteligência Artificial usando Suno AI
Instalando e usando o Dconf Editor, o "regedit" para Linux
Como instalar o navegador TOR no seu Linux
Instalando Zoom Client no Ubuntu 24.04 LTS
Remover por completo uma DE (7)
validando quandidade de leitura no read[DUVIDA] (4)
Qual a relevancia dos valores de bogomips com os Mhz e Ghz[DUVIDA] (7)