bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

R: Asking help for a little project


From: Alessandro Sangiuliano
Subject: R: Asking help for a little project
Date: Thu, 27 Jan 2022 08:49:33 +0000

Hello, all th esuggestions of the previous mail are wrking.

Actually i can get the kernel task and set to it the nameserver task port as bootstrap port for the kernel task.

Not only, I also tried to create a new port in the nameserver, put a send right to it, and then set this new port as boot strap port to the kernel. A bit of code:

mach_port_t kernel_task_port = map_get_value(map, kernel_task); //a little linked key-value map i implemented

    print("Kernel task port:", "%d\n", &kernel_task_port);  // this prints 3. OK

    mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &bootstrap);

    print("Bootstrap port allocated:", "%d\n", &bootstrap); // this prints 9. OK

After inserting the send right:

task_set_bootstrap_port(kernel_task_port, bootstrap);

    mach_port_t ret = 0;

    task_get_bootstrap_port(kernel_task_port, &ret);

    print("Retrieved for testing:", "%d\n", &ret); // this prints again 9: So it is OK

New challenge now.

Afer all these setting my name server is ready to receive messages (not using the mig for now, but it will).

The problem:

while(1)
    receive_message(ret);

Obviously this is a blocking loop, it mens that actually when this code is reached the boot process is stopped, blocking here. This is happening to the Hurd too, when I use my custom nameserver.

I have to do task_resume() other tasks before the loop, so the boot can continue even if i'm using the custom nameserver near the hurd.

So assuming the situation where my custom name server is booting near the hurd as a module from grub, how to get the other tasks to resume them?

The grub.cfs is like the usual plus my module as third module. It means that ext2fs is started as first module, then exec (via ld.so) then my custom nameserver.

Some boot process output from qemu:

start ext2fs:
start hello_custom: Kernel task port: 3
Bootstrap port allocated: 9
Retrieved for testing: 9
Waiting for message
Hurd server bootstrap: ext2fs[device:hd0s2] exec startup proc auth.
Message received 0 //please ignore this value because is not expecting one. But we cna say it is receiving messages by somone. (the kernel?)
Waiting for message (stops here, needs some task_resume())


Thank you for the help,
Alex


Da: Samuel Thibault <samuel.thibault@gnu.org>
Inviato: lunedì 24 gennaio 2022 21:56
A: Alessandro Sangiuliano <alex22_7@hotmail.com>; bug-hurd@gnu.org <bug-hurd@gnu.org>
Oggetto: Re: Asking help for a little project
 
Samuel Thibault, le lun. 24 janv. 2022 22:49:50 +0100, a ecrit:
> the script launcher will first create the first requested port (here
> the host priv port),

(more precisely: create a name for it in your task. Names are numbered
from 1 for each process, think of them a bit like the file descriptors
of unix processes)

Samuel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]