[PATCH rtems-libbsd 5/7] kern: Add a proc0

Chris Johns chrisj at rtems.org
Wed Jul 28 22:42:26 UTC 2021


On 29/7/21 12:22 am, Gedare Bloom wrote:
> On Tue, Jul 27, 2021 at 2:59 AM <chrisj at rtems.org> wrote:
>> From: Chris Johns <chrisj at rtems.org>
>> @@ -135,6 +171,8 @@ rtems_bsd_initialize(void)
>>         sbt_tickthreshold = bttosbt(bt_tickthreshold);
>>         maxid_maxcpus = (int) rtems_scheduler_get_processor_maximum();
>>
>> +       maxproc = 16;
> Why not use 1? Is this the smallest value that can be put here?

It is used here:

freebsd/sys/kern/kern_resource.c:       uihashtbl = hashinit(maxproc / 16,
M_UIDINFO, &uihash);

so anything less than 16 crashes. One of those things where you cater for all
cases or you work around how it is implemented and keep as much code as possible
as close to upstream as possible.

>> @@ -331,6 +336,8 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p, struct thread **new
>>         va_list ap;
>>
>>         va_start(ap, fmt);
>> +       /* the cast here is a hack but passing a proc as a thread struct is just wrong and I
>> +        * have no idea why it is like this */
> Does this point need discussion?

I do not know, I only added the comment.

Chris



More information about the devel mailing list