Commit Graph

1370 Commits

Author SHA1 Message Date
Matt Joyce
6d4b390f99 Support _REENT_THREAD_LOCAL Newlib configuration
In case the Newlib _REENT_THREAD_LOCAL configuration option is enabled, the
struct _reent is not defined (there is only a forward declaration in
<sys/reent.h>).  Instead, the usual members of struct _reent are available as
dedicatd thread-local storage objects.

Update #4560.
2022-07-21 07:22:13 +02:00
Sebastian Huber
2bc233fe58 gcov: Add fork(), etc. gcov wrappers
The compiler wraps fork(), etc. system calls if coverage generation is enabled.
These functions must be provided by the system.  For RTEMS, they just return an
error status.

Update #4670.
2022-07-04 08:29:52 +02:00
Chris Johns
0cf0914efe cpukit: Change _COMPILING_NEWLIB to _LIBC for helper functions decls
Updates #4662
2022-06-15 13:00:48 +10:00
Sebastian Huber
3ccfb58311 Synchronize all file descriptors in sync()
Synchronize all file descriptors and not just the ones associated with a FILE
object.

Close #4656.
2022-05-17 15:20:37 +02:00
Ryan Long
3afdf65634 error.c: Add file header and license
This file had no header, copyright, or license. Based on git history,
added appropriate copyright and license.
2022-05-04 09:12:07 -05:00
Ryan Long
37bcb0e19f __getpid: Add file headers and licenses
This file had no header, copyright, or license. Based on git history,
added appropriate copyright and license.
2022-05-04 09:12:07 -05:00
Ryan Long
a8b63fd082 cpukit/libcsupport: Adding file headers and licenses
These files had no file header, copyright, or license. Based on git
history, added appropriate copyright and license.
2022-05-04 09:11:55 -05:00
Joel Sherrill
5f8c41c389 Update email address of Fernando Ruiz Casas to <fruizcasas@gmail.com>
This was requested to be executed prior to relicensing to BSD-2.
2022-04-05 13:13:31 -05:00
Joel Sherrill
821e89dab2 cpukit/libcsupport/src/_*: Change license to BSD-2
Updates #3053.
2022-04-01 10:02:30 -05:00
Joel Sherrill
70432fcff2 cpukit/libcsupport/src/[g-r]*: Change license to BSD-2
Updates #3053.
2022-04-01 10:02:30 -05:00
Joel Sherrill
df1cb9f397 cpukit/libcsupport/src/[s-z]*: Change license to BSD-2
Updates #3053.
2022-04-01 10:02:30 -05:00
Joel Sherrill
d90e2dc1e8 cpukit/libcsupport/src/[a-f]*: Change license to BSD-2
Updates #3053.
2022-04-01 10:02:30 -05:00
Sebastian Huber
a340ca191a libcsupport: Use _fwalk_reent()
Use _fwalk_reent() instead of _fwalk(), since _fwalk() was removed from Newlib.
Include <sys/reent.h> and remove local declarations.
2022-04-01 08:04:19 +02:00
Joel Sherrill
628bd9b682 cpukit/: Update Eric Norum contact info and normalize file headers 2022-03-24 10:01:51 -05:00
Joel Sherrill
255fe433fd cpukit/: Scripted embedded brains header file clean up
Updates #4625.
2022-03-10 08:43:49 +01:00
Christian Mauderer
7b5948d4d2 termios: Pass number of sent chars to l_start
At the moment the line discipline start function (l_start) has no
possibility to get feedback about the number of characters that have
been sent. This patch passes that information via an additional
parameter.

The change might trigger a warning on existing code because of a pointer
mismatch but it shouldn't break it. An existing function with the old
API will just ignore the additional parameter.

Update #4493
2022-02-10 09:07:26 +01:00
Sebastian Huber
2145e0c7bf Remove obsolete rtems_gxx_*() implementation
GCC versions prior to 6.1 used a RTEMS thread model based on
rtems_gxx_*() functions. GCC version 6.1 or later uses the
self-contained synchronization objects of Newlib <sys/lock.h> for the
RTEMS thread model.

Remove the obsolete implementation.

Close #3143.
2022-01-27 11:06:46 +01:00
Sebastian Huber
d7205f0083 libc: Optimize malloc() initialization
The BSPs provide memory for the separate C Program Heap initialization
via _Memory_Get().  Most BSPs provide exactly one memory area.  Only two
BSPs provide more than one memory area (arm/altera-cyclone-v and
bsps/powerpc/mpc55xxevb).  Only if more than one memory area is
provided, there is a need to use _Heap_Extend().  Provide two
implementations to initialize the separate C Program Heap and let the
BSP select one of the implementations based on the number of provided
memory areas.  This gets rid of a dependency on _Heap_Extend().  It
also avoids dead code sections for most BSPs.

Change licence to BSD-2-Clause according to file history.

Update #3053.
2021-11-30 08:33:12 +01:00
Sebastian Huber
0221da5f56 rtems: Fix rate monotonic statistics
The rate monotonic period statistics were affected by
rtems_cpu_usage_reset().  The logic to detect and work around a CPU
usage reset was broken.

The Thread_Contol::cpu_time_used is changed to contain the processor
time used throughout the entire lifetime of the thread.  The new member
Thread_Contol::cpu_time_used_at_last_reset is added to contain the
processor time used at the time of the last reset through
rtems_cpu_usage_reset().  This decouples the resets of the CPU usage and
the rate monotonic period statistics.

Update #4528.
2021-10-25 08:01:02 +02:00
Ryan Long
3951d4da6f pxcdevctl: Adjust for standard
psxdevctl is supposed to return the value in errno. Before, it was
returning -1 and setting errno. Changed the tests to reflect these
changes. Added code from RRADE's posix_devctl.c.

Closes #4506
2021-09-20 13:31:25 -05:00
Sebastian Huber
d999f865ea rtems: Generate <rtems/bspIo.h>
Change license to BSD-2-Clause according to file histories and
documentation re-licensing agreement.

Place the group into the I/O Manager group.  Add all source files to the
group.

Update #3899.
Update #3993.
Update #4482.
2021-08-02 07:14:05 +02:00
Sebastian Huber
6e82e9e89e libcsupport: Consistent rtems_putc() output
Use the same function to output the '\r\n' combination produced by
rtems_putc().  Fix the format.

Change licence according to file history.

Update #3053.
2021-07-28 19:05:42 +02:00
Sebastian Huber
79b94a2dcd libcsupport: Fix TOCTOU in getchark()
Use the same function pointer value to check against NULL and call the
function (if non-NULL).

Fix format, add Doxygen comments, and reduce includes.
2021-07-28 19:05:42 +02:00
Joel Sherrill
7a723293ab futimens.c, utime.c: Remove unnecessary include of <sys/stat.h>. 2021-06-09 10:36:06 -05:00
Ryan Long
ea41722c92 Change filesystem utime_h handler to utimens_h
Also updated licenses.

Closes #4400
Updates #3899
2021-05-28 14:27:40 -05:00
Ryan Long
ea881bf7a1 libcsupport: Implement utimes() in terms of utimensat()
utimes() now calls utimensat() to update file access
and modification timestamps.

Updated license.

Closes #4398
2021-05-28 14:27:39 -05:00
Ryan Long
bb70412306 libcsupport: Implement utime() in terms of utimensat()
utime() now calls utimensat() to update file access
and modification timestamps.

Updated license.

Closes #4397
2021-05-28 14:27:39 -05:00
Ryan Long
335f705082 libcsupport: Added futimens() and utimensat()
Created futimens.c and utimensat.c to add support for the POSIX
methods futimens() and utimensat().

utime() and utimes() are considered obsolote by POSIX, but RTEMS
will continue to support them.

Closes #4396
2021-05-28 14:27:39 -05:00
Joel Sherrill
76d5722b4a sysinit: Do not open console when just referencing reentrancy structure.
This change eliminates a system initialization dependentcy which resulted
in an application without a file system or console referencing errno being
forced to include the code to open(/dev/console), close(), atexit(),
and the unmount infrastructure.

Closes #4439.
2021-05-25 08:33:04 -05:00
Sebastian Huber
c46d125569 Check the alignment in posix_memalign() earlier
Make sure all conditions to do a proper memory allocation are satisfied
before a zero size memory allocation is performed.

Update #4390.
2021-05-07 07:08:04 +02:00
Sebastian Huber
2c5199bb04 Return NULL for zero size allocations
In POSIX, zero size memory allocations are implementation-defined
behaviour.  The implementation has two options:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html

https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html

Linux and FreeBSD return a unique pointer for zero size memory
allocations.   Return NULL on RTEMS to more likely catch the use of a
zero size memory area by erroneous applications.

Update #4390.
2021-05-06 08:03:58 +02:00
Sebastian Huber
5580b93f36 libc: Reimplement posix_memlign()
Move all error checks into posix_memalign() so that the returned memory
pointer is set to NULL under all error conditions except
memptr == NULL.

Use parameter names of POSIX documentation.
2021-05-06 08:03:58 +02:00
Sebastian Huber
d692c62dfb Make zero size allocation result consistent
The zero size allocations had no consistent behaviour in RTEMS.  For
example, malloc( 0 ) returned NULL and posix_memalign( &p, align, 0 )
returned in p a unique pointer (or NULL if no memory is available).  In
POSIX, zero size memory allocations are implementation-defined
behaviour.  The implementation has two options:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html

https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html

Linux and FreeBSD return a unique pointer for zero size memory
allocations.   Use this approach for RTEMS as well throughout the memory
allocation directives

Close #4390.
2021-05-04 09:37:06 +02:00
Ryan Long
a70d60aff7 pwdgrp.c: Removed unused variable
The 'sc' variable was originally storing the return value of mkdir().
This was causing an issue, so it was changed to make it to where we
ignored the return value with (void). The 'sc' variable was left in
by mistake.
2021-04-29 08:23:22 -05:00
Sebastian Huber
51defd9274 Fix calloc() behaviour in case of overflow
The multiplication to calculate the length of the memory area to
allocate may overflow.  Return NULL in case of an overflow.

Close #4389.
2021-04-20 20:33:03 +02:00
Sebastian Huber
6c66bbbadf malloc: Hide RTEMS_Malloc_Sbrk_amount
Move RTEMS_Malloc_Sbrk_amount to the only implementation file which uses
it and make it private to hide implementation-details from an API
header.
2021-04-20 19:18:23 +02:00
Sebastian Huber
d8a5e140ec libcsupport: Move rtems_calloc()
Move rtems_calloc() since it only depends on rtems_malloc().  This may
make it easier to customize the heap allocator.

Change licence to BSD-2-Clause according to file history.

Update #3053.
2021-04-20 19:18:23 +02:00
Sebastian Huber
2b32146400 Remove superfluous <rtems/score/wkspace.h> includes 2021-04-20 19:18:23 +02:00
Joel Sherrill
d4d2f6487a pwdgrp.c: Change to simply ignore return value from mkdir(/etc)
At this point in time, /etc can be created in multiple ways. There
is a discussion (#4354) that would define a mechanism for
instantiating a base file system with some flexibility for the
set of directories included. For now, this particular mkdir()
call can fail because /etc could already have been created by
at least an initial filesystem image, the shell, or libbsd.

closes #4382.
2021-03-27 09:59:12 -05:00
Ryan Long
37fc6516d3 pwdgrp.c: Remove _Assert. /etc may already exist
Removed the _Assert_unused_variable_equals macro due to /etc
having already been created by the network stack initialization
or an initial filesystem image.

Closes #4282
2021-03-23 11:43:13 -05:00
Ryan Long
55ba229d22 pwdgrp.c: Fix Unchecked return value from library (CID #1255518)
CID 1255518: Unchecked return value from library in pwdgrp_init().

Closes #4282
2021-03-08 14:04:10 -06:00
Vijay Kumar Banerjee
f0f8c111c5 getgrent.c, record-client.c: Add missing includes for assert.h 2021-02-27 08:51:53 -07:00
Ryan Long
e5e58da6df getgrent.c: Fix Unchecked return value error (CID #1459004)
CID 1459004: Unchecked return value in endgrent().

Closes #4261
2021-02-26 16:56:07 -06:00
Ryan Long
1b322a6b83 printertask.c: Fix Unchecked return value (CID #1399710)
CID 1399710: Unchecked return value in printer_task().
CID 1472764: Unchecked return value in rtems_print_printer_task().

Closes #4258
2021-02-26 16:56:07 -06:00
Ryan Long
14f5a0597a consolesimpletask.c: Fix Two Unchecked Return Values (CID #1437625 and #1472765)
CID 1437625: Unchecked return value from call to rtems_task_create().
CID 1472765: Unchecked return value from call to rtems_task_start().

Closes #4237.
2021-02-12 17:13:13 -06:00
Chris Johns
03dff2019f libcsupport: Add sbrk greedy support to consume all sbrk memory
- Move the heap sbrk code into a separate routnine.

- Update heap and workspace greedy allocators to use the common
  sbrk greedy support.

Closes #3982
2021-02-10 17:28:32 +11:00
Chris Johns
7ca3b283ba libcsupport: Have greedy allocations use consume extended memory
- Call the heap extend handler until all memory has been
  requested.

Closes #3982
2021-02-08 17:45:52 +11:00
Chris Johns
822cad8967 libcsupport: Add no_regular_file_mknod as a mount option to the mount table
- Add the bool flag no_regular_file_mknod to the mount table so a file
  system can indicate creating regular files is not done by
  use the mknod handler. The file system will handle creating a
  file node in the open handler.

- Note, the mount option is an enum which means there is only one
  exclusive option supported. As a result no encapsulation is
  provided and file systems need to set no_regular_file_mknod directly.

Closes #4222
2021-02-08 13:10:37 +11:00
Sebastian Huber
f2185d1099 Decouple the C Program Heap initialization
Before this patch RTEMS_Malloc_Initialize() had a fixed dependency on
_Workspace_Area.  Introduce _Workspace_Malloc_initializer to have this
dependency only if CONFIGURE_UNIFIED_WORK_AREAS is defined by the
application configuration.
2020-10-01 19:05:33 +02:00
Sebastian Huber
6e6e23384f config: Add zero file descriptor data structures
Fix linker errors in the minimum test program on some BSPs introduced by
ced28f2cfc.
2020-08-31 17:30:17 +02:00