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
Desktop Linux ganha fôlego enquanto distros refinam experiência e segurança
Wayland em alta, IA em debate e novos ventos para distros e devices
Qt 6.10 e Python 3.14 puxam o ritmo do software livre nesta quarta
Atualizações de Apps, Desktop e Kernel agitam o ecossistema Linux nesta terça-feira
Como mudar o nome de dispositivos Bluetooth via linha de comando
Adicionando o repositório backports no Debian 13 Trixie
Erro ao enviar notificação por e-mail (0)
Primeiras impressões do Debian 13 (26)
Não tenho som no meu Kali linux (1)
Erro ao fazer remaster usando Penguin eggs (2)
Meu Amigo não consegue entrar em meu mundo, via tailscale, hamachi e z... (1)