[PATCH v2 4/4] sb: Set the uid and gid on POSIX systems

Gedare Bloom gedare at rtems.org
Wed Dec 6 23:07:32 UTC 2023


These 4 look good to me.

On Wed, Dec 6, 2023 at 3:14 PM <chrisj at rtems.org> wrote:
>
> From: Chris Johns <chrisj at rtems.org>
>
> This improves performance because it avoids an exec each time
> the _uid macro is referenced and that can be a number of times
> for each config parsed.
> ---
>  source-builder/sb/options.py | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/source-builder/sb/options.py b/source-builder/sb/options.py
> index d554097..ac5982b 100644
> --- a/source-builder/sb/options.py
> +++ b/source-builder/sb/options.py
> @@ -46,7 +46,7 @@ basepath = 'sb'
>  #
>  # Save the host and POSIX state.
>  #
> -host_windows = False
> +host_windows = os.name == 'nt'
>  host_posix = True
>
>  class command_line:
> @@ -103,6 +103,10 @@ class command_line:
>                  self.defaults[self._long_opts[lo][0]] = ('none',
>                                                           'none',
>                                                           self._long_opts[lo][3])
> +        # Set the _uid field, performance improvement on Unix
> +        if not host_windows:
> +            self.defaults['_uid'] = str(os.getuid())
> +            self.defaults['_did'] = str(os.getdid())
>
>      def __str__(self):
>          def _dict(dd):
> --
> 2.37.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list