rtems-kernel-init.c tries to re-make existing "/etc"

Peter Dufault dufault at hda.com
Thu Apr 18 15:10:19 UTC 2024



> On Apr 18, 2024, at 10:55 AM, Joel Sherrill <joel at rtems.org> wrote:
> 
> 
> 
> On Thu, Apr 18, 2024 at 9:50 AM Peter Dufault <dufault at hda.com> wrote:
> 
> 
> > On Apr 18, 2024, at 10:34 AM, Kinsey Moore <kinsey.moore at oarcorp.com> wrote:
> > 
> > A patch for EEXIST here should be fine. It would be nice if the caller were more resilient.
> > 
> 
> I also changed "default-network-init.h" to assert rtems_bsd_initialize() worked.
> 
>   sc = rtems_bsd_initialize();
>   assert(sc == RTEMS_SUCCESSFUL);
> 
> At least you get a panic message.  I'll submit a patch.
> 
> Why does /etc already exist? Is it really an error if it already exists?
> 
> If the startup code untar'ed some initial file system contents before calling this, then /etc would almost certainly exist.
> 
> Unless I am missing something EEXIST should be acceptable. Other errors are most likely really fatal.
> 
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html
> 
> --joel 
> 

The function "_libcsupport_pwdgrp_init()" over in RTEMS also creates "/etc" through a "pthread_once()".  A call to "getpwnam()", "getpwuid()", "getgrnam()" and family will create it.  Apparently that is called first.

Peter Dufault
HD Associates, Inc.      Software and System Engineering





More information about the devel mailing list