This commit splits heapimpl.h
to heapimpl.h and heapfirstfitimpl.h.
By moving first-fit-specific definitions into
heapfirstfitimpl.h and keeping only generic
heap helper definitions in heapimpl.h.
Updates:
rtems/rtos/rtems#5620
- Change TLS_Dynamic_thread_vector
generation_number from uint32_t to uintptr_t.
- Using a machine-word type resolves the FIXME concern
about correctness across architectures, since uintptr_t
is guaranteed to match size on both 32-bit and 64-bit
targets.
Updates #4827
- Removed #if 1 clause and error comment section.
- Updated the RTEMS_INVALID_SIZE doxygen comments for
queue create and construct directives.
- Added mp11 checks for oversized global message
queues to verify both rtems_message_queue_create()
and rtems_message_queue_construct() return
RTEMS_INVALID_SIZE when size is
max_packet_payload_size + 1.
- Updated mp11 documentation and expected output
to include these checks.
Updates #4819.
- Added a description to the _CONFIGURE_ASSERT_NOT_NULL() macro
definition in doxygen format.
- Improved comment section above the #pragmas to ignore warnings.
Updates #4831.
In duplicate_iop() and duplicate2_iop(), when the open handler
(open_h) returns a non-zero status (e.g. positive errno), the
open descriptor was freed via rtems_libio_free(), but the non-zero
status value was returned directly to fcntl()/dup2().
If open_h returned a positive errno value, fcntl()/dup2() would
return it as a positive file descriptor even though the descriptor
had been freed, leading to Use-After-Free (UAF) vulnerabilities.
Fix this by setting errno if rv > 0 and ensuring rv = -1 is
returned on error, satisfying POSIX compliance.
This support is added in the form of two public functions,
`leon3_irqmap_get_unchecked()` that will directly return the mapped
interrupt and `leon3_irqmap_get()` that will perform a check (<63) before
reading the mapping.
T_interrupt_test() bisects a busy wait to place an interrupt inside the
action of a test. It adjusts the bracket on an early and on a late
interrupt, but T_INTERRUPT_TEST_CONTINUE fell through both cases: the
bounds stayed as they were, the sample index did not advance, and the
next iteration used the very same busy count. A test whose interrupt
reliably lands inside the action, yet which is not satisfied by that
particular time point, therefore repeated one time point until it ran
out of iterations.
A continue says the interrupt hit the action but reports nothing about
early or late, so there is no gradient to bisect on. Count them, and
once the search has produced nothing else for a while, step the time
point through the bracket instead of using its middle. A stepped time
point which leaves the action yields an early or a late result again,
which clears the counter and lets the bisection narrow the bracket
around the action. A search which does make progress never reaches the
counter and keeps the behaviour it had.
The bracket is covered in a fixed number of steps rather than in steps
of one busy count. This is not needed to make the search converge, it
keeps the sweep predictable: the step follows the width of the bracket,
a bracket narrower than the step count degrades to a step of one, and
there is no division by a width which may be zero. The last point
needs the lower bound to stay below the upper bound. The bisection did
not guarantee this, since a busy count taken from the bracket of all
samples is accounted to one sample only. Pull the opposite bound along
in this case.
spintrcritical20 on the erc32 BSP hit exactly this. It reported
T_INTERRUPT_TEST_TIMEOUT with 9997 of its 10000 iterations landing
inside the action and none of them satisfying the test. It now
completes. All twenty spintrcritical tests pass on erc32, leon2,
gr712rc, gr740 and gr740 in SMP configuration.
The simulator is deterministic, so repeating a test under it adds no
information. A host simulation of the search over randomised action
windows, satisfied only after three distinct outcomes, completes in 200
of 200 runs with the sweep and in 1 of 200 without it.
Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
The interrupt handler runs on every clock tick, also between the test
iterations. Sending the event outside of the action left it pending, so
the event receive of the next action returned immediately instead of
blocking and the interrupt could no longer hit the critical section.
Send the event only if the action is in progress.
Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
The interrupt handler runs on every clock tick, also between the test
iterations. Releasing the semaphore outside of the action left a count
behind, so the semaphore obtain of the next action returned immediately
instead of blocking and the interrupt could no longer hit the critical
section. Release the semaphore only if the action is in progress.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Several comments in this file were indented with tabs while the rest of
the file uses spaces. Convert them. This is a whitespace only change.
Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Commit e618b20215 ("imfs/imfs_statvfs: Added the statvfs functionality
to IMFS module") gave IMFS a real statvfs handler:
cpukit/libfs/src/imfs/imfs_statvfs.c is wired up as .statvfs_h in the
IMFS operations table and returns 0. Before that commit no handler was
installed and the default handler made statvfs() fail with ENOSYS.
The psximfs01 test was updated along with that change, but psxstat was
not: test_statvfs() still asserts that statvfs() on a valid path
returns -1 with errno set to ENOSYS, so the test fails. Assert success
instead and update the expected output in psxstat.scn to match.
The stale expectation is architecture independent, so the test fails on
every BSP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- Add a default pipe2 which retuns an error.
- Add pipe and pipe2 handler register calls so implementations
with different file descriptors can use these calls.
Closes#5673
When the device is open multiple times and data
are sent to driver by multiple FIFOs/edges then
round-robin between same priority prevents
one application blocking whole bandwidth.
The problem has been introduced during switch
from original uLUt/LinCAN to NewLib provided TAILQ
Signed-off-by: Pavel Pisa <ppisa@pikron.com>
The I/O mapped SJA1000 is required to support Kvaser CanS/D/Q boards
which have emulation in mainline QEMU.
The I/O space mapping is enabled by RTEMS_CAN_SJA1000_ARCH_WITH_IO_PORTS
option set in hw_options during initialization.
Signed-off-by: Pavel Pisa <ppisa@pikron.com>
Add proper header file includes into fsfatfsformat01, fsfatfssync01.
Remove the duplicated structs, and duplicated extern calls.
Update test yaml files to include proper include folders to find header
files with defs.
In rtems_rap_app_alloc(), the return value of malloc() is passed
directly to memset() and rtems_chain_append() without being checked.
If the memory allocation fails, this results in a NULL pointer
dereference and a system crash. Explicitly check for NULL before
using the descriptor.
dup2() ran fstat() on fildes2 first, so duplicating onto a closed
descriptor - the normal use of dup2() - answered EBADF. The checks
belong to fcntl(F_DUP2FD): fildes is validated before fildes2 is
touched and fildes2 is range checked there.
Closes#5669
duplicate2_iop() assumed its target is open. A free target stayed on
the iop free list with no LIBIO_FLAGS_OPEN and no reference, so the
call answered success while the new descriptor answered EBADF to
everything and a later allocation handed the same iop out again.
Claim the target from the free list, release the previous location
when the target was open, publish LIBIO_FLAGS_OPEN only after the
open handler agreed, and answer the descriptor for a target that is
the source itself.
Closes#5670
vfcntl() never read the third argument: the duplicate was the next
free iop, whatever the caller asked for, an out-of-range minimum was
not refused, and a full table answered -1 with errno unset. POSIX
wants the lowest available descriptor at or above the argument, EINVAL
for a negative or out-of-range argument and EMFILE for a full table.
The free list is kept in close order, so rtems_libio_allocate_minimum()
walks it for the lowest qualifying entry.
Closes#5668
vfcntl() had no case for it, so the command fell through to default and
answered EINVAL. POSIX has required it since 2008 and newlib declares
it. The duplicate carries LIBIO_FLAGS_CLOSE_ON_EXEC, the flag F_GETFD
and F_SETFD already maintain.
Closes#5667
In rtems_bdpart_register(), when create_logical_disk_name() fails to
allocate memory and returns NULL, the error code variable 'esc' was
incorrectly assigned 'sc' (which evaluates to RTEMS_SUCCESSFUL).
This caused the function to falsely return RTEMS_SUCCESSFUL even when
memory allocation failed. Fix it by assigning RTEMS_NO_MEMORY.
Close the flash file before returning from these 5 early setup failure
paths. Otherwise the file descriptor and selected flash region remain
allocated.
Open works correclty with the read_only argument but mount
ignores and always uses READ_WRITE.
Use RTEMS_FILESYSTEM_READ_ONLY when read_only is true so the
filesystem rejects write operations and does not perform erase
operations when under a read-only mount.
The RX overflow handling uses CAN_ERR_ID_LOSTARB, which is an
err_frame.header.can_id mask, as an err_frame.data index.
Correct it to use CAN_ERR_DATA_BYTE_TRX_CTRL as intended.
The Error Active frame populates the TX and RX error counter bytes
but does not set CAN_ERR_ID_CNT.
Set CAN_ERR_ID_CNT so consumers know the counter fields are valid.
The Error Active frame populates the TX and RX error counter bytes
but does not set CAN_ERR_ID_CNT.
Set CAN_ERR_ID_CNT so consumers know the counter fields are valid.