Skip to content

Commit

Permalink
[servers/boot] Misc fixes
Browse files Browse the repository at this point in the history
- Unblock the parent much earlier. I'm not sure if this will have any
  effect in reality, but we want to block things for as short
  periods as possible.
- Add error handling when opening files listed in the startup script
  • Loading branch information
perlun committed Jul 5, 2019
1 parent 283f940 commit 0b6240e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions servers/system/boot/boot.c
Expand Up @@ -33,6 +33,7 @@ static void start_programs(unsigned int number_of_programs);
int main(void)
{
set_process_and_thread_name();
system_call_process_parent_unblock();

if (!resolve_log_service())
{
Expand Down Expand Up @@ -60,10 +61,8 @@ int main(void)

unsigned int number_of_programs = parse_program_list(file_size);
log_print_formatted(&log_structure, LOG_URGENCY_DEBUG, "Starting %u programs.", number_of_programs);
start_programs(number_of_programs);

system_call_process_parent_unblock();

start_programs(number_of_programs);
log_print(&log_structure, LOG_URGENCY_DEBUG, "Boot server completed.");

return 0;
Expand Down Expand Up @@ -213,7 +212,11 @@ static void start_programs(unsigned int number_of_programs)

// Open the file.
file_handle_type handle;
file_open(&vfs_structure, programs[i], FILE_MODE_READ, &handle);
if (file_open(&vfs_structure, programs[i], FILE_MODE_READ, &handle) != FILE_RETURN_SUCCESS)
{
log_print_formatted(&log_structure, LOG_URGENCY_ERROR, "Failed to open '%s'", programs[i]);
continue;
}

log_print_formatted(&log_structure, LOG_URGENCY_DEBUG,
"Allocating %u bytes for %s.",
Expand Down

0 comments on commit 0b6240e

Please sign in to comment.