[rtems-libbsd commit] Added rtems_bsd_thread0_ucred as a single global ucred.

Jennifer Averett Jennifer.Averett at OARcorp.com
Thu May 10 14:19:38 UTC 2012


The ucred portion of thread0 was needed by tcp_syncache for the Nic.
We discussed adding a global ucred for this and since thread0 was created
and initialized in init_main it seemed the logical place to put it.  I'm open to
moving it to another location though.

Jennifer Averett
On-Line Applications Research
________________________________________
From: rtems-devel-bounces at rtems.org [rtems-devel-bounces at rtems.org] On Behalf Of Sebastian Huber [sebastian.huber at embedded-brains.de]
Sent: Thursday, May 10, 2012 8:37 AM
To: rtems-devel at rtems.org
Cc: Jennifer Averett
Subject: Re: [rtems-libbsd commit] Added rtems_bsd_thread0_ucred as a single global ucred.

On 05/01/2012 08:48 PM, Jennifer Averett wrote:
> diff --git a/freebsd/kern/init_main.c b/freebsd/kern/init_main.c
> index 540e0cb..8ae8a71 100644
> --- a/freebsd/kern/init_main.c
> +++ b/freebsd/kern/init_main.c
> @@ -118,6 +118,8 @@ SYSINIT(placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, NULL, NULL);
>    * The sysinit table itself.  Items are checked off as the are run.
>    * If we want to register new sysinit types, add them to newsysinit.
>    */
> +#else  /* __rtems__ */
> +struct ucred *rtems_bsd_thread0_ucred;
>   #endif /* __rtems__ */
>   SET_DECLARE(sysinit_set, struct sysinit);
>   #ifndef __rtems__
> @@ -191,6 +193,13 @@ mi_startup(void)
>   #ifndef __rtems__
>       if (boothowto&  RB_VERBOSE)
>               bootverbose++;
> +#else  /* __rtems__ */
> +     rtems_bsd_thread0_ucred = crget();
> +     rtems_bsd_thread0_ucred->cr_ngroups = 1;        /* group 0 */
> +     rtems_bsd_thread0_ucred->cr_uidinfo = uifind(0);
> +     rtems_bsd_thread0_ucred = uifind(0);
> +     rtems_bsd_thread0_ucred->cr_prison =&prison0;
> +
>   #endif /* __rtems__ */

This change is quite bad.  Firstly it places code into a general FreeBSD file
which doesn't belong to its context.  Secondly it adds a lot of dependencies to
users (like the USB stack) which don't care about a thread0 or credentials.

--
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
rtems-devel mailing list
rtems-devel at rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel



More information about the devel mailing list