#4207 closed defect (fixed)

PZERO define in RTEMS is wrong

Reported by: Chris Johns Owned by: Chris Johns <chrisj@…>
Priority: normal Milestone: 6.1
Component: network/libbsd Version: 6
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Chris Johns)

Our libbsd support in RTEMS defines PZERO to be zero. FreeBSD defines PZERO to be (PRI_MIN_KERN + 20) and PRI_MIN_KERN is 80.

The __sleep() call uses bits allocated above the bits used to hold the highest priority to signal things to do. The PDROP (0x200) bit causes a lock to be dropped before sleeping and not reclaimed after.

Setting PZERO to 0 breaks FreeBSD code in libbsd because calls that end up in __sleep() can incorrectly have the PDROP bit set. A grep of FreeBSD shows how this happens:

   (void) nfsmsleep(&lp->nfslock_lock, mutex,
      PZERO - 1, "nfsv4gr", NULL);
   error = msleep(msqkptr, &msq_mtx, (PZERO - 4) | PCATCH,
     msgsnd", hz);

This examples shows how either side is used...

   selwakeuppri(&tp->tun_rsel, PZERO + 1);

Change History (2)

comment:1 Changed on Dec 23, 2020 at 7:23:03 PM by Chris Johns

Description: modified (diff)
Summary: PZERO define in newlib is wrongPZERO define in RTEMS is wrong

comment:2 Changed on Jan 7, 2021 at 10:54:34 PM by Chris Johns <chrisj@…>

Owner: set to Chris Johns <chrisj@…>
Resolution: fixed
Status: newclosed

In 7696533/rtems:

cpukit: Merge FreeBSD values for the priorities

It seems we need valid values or assumptions in the FreeBSD about
these values breaks some of the code.

Closes #4207

Note: See TracTickets for help on using tickets.