genode_c_api: errors on socket/nic_client init

Prevent uncaught exceptiosn in (NIC-client) initialization but report
as errors from genode_socket_init() / genode_nic_client_create().
This commit is contained in:
Christian Helmuth
2025-04-01 12:35:00 +02:00
committed by Norman Feske
parent 14cfc765c6
commit 1f181f6ce3
8 changed files with 31 additions and 12 deletions

View File

@ -88,7 +88,7 @@ struct Main
};
void genode_socket_init(struct genode_env *_env,
bool genode_socket_init(struct genode_env *_env,
struct genode_socket_io_progress *io_progress,
char const *label)
{
@ -108,4 +108,6 @@ void genode_socket_init(struct genode_env *_env,
/* wait to finish initialization before returning to callee */
lx_emul_execute_kernel_until(lx_user_startup_complete, nullptr);
return lx_nic_client_initialized();
}

View File

@ -188,6 +188,10 @@ static int rx_task_function(void *arg)
}
static bool initialized;
bool lx_nic_client_initialized() { return initialized; }
static int __init virtio_net_driver_init(void)
{
struct net_device *dev;
@ -232,6 +236,7 @@ static int __init virtio_net_driver_init(void)
nic_rx_task_struct_ptr = find_task_by_pid_ns(pid, NULL);
initialized = true;
return 0;
out_nic:

View File

@ -23,6 +23,7 @@ extern "C" {
struct task_struct *lx_nic_client_rx_task(void);
bool lx_nic_client_link_state(void);
bool lx_nic_client_update_link_state(void);
bool lx_nic_client_initialized(void);
/* socket.cc */
void socket_schedule_peer(void);