Commit Graph

992 Commits

Author SHA1 Message Date
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
Sebastian Huber
9566538823 termios: Make rtems_termios_ttyMutex private
This mutex is used to maintain termios internal data structures.
2020-08-04 15:48:32 +02:00
Sebastian Huber
7746b0def9 malloc: Make deferred free support optional
Only include the deferred free support if free() is actually used by the
application.

The free() implementation in RTEMS supports that allocated memory is
freed in interrupt context.  Since the heap is protected by a mutex, the
frees issued in interrupt context cannot immediately be freed to the
heap, instead they are placed on a deferred free list.  This list is
emptied by the core allocation function
rtems_heap_allocate_aligned_with_boundary().  This adds a dependency to
free() in rtems_heap_allocate_aligned_with_boundary(). In order to
better support applications which only allocate memory and never free
it, this dependency should be avoided.  Provide a weak default
implementation of _Malloc_Process_deferred_frees() for
rtems_heap_allocate_aligned_with_boundary().  In the free() module
provide the strong implementation.

Close #4032.
2020-07-24 07:14:02 +02:00
Kinsey Moore
48dd7b8c2e score: Add CPU_USE_LIBC_INIT_FINI_ARRAY
This introduces the CPU_USE_LIBC_INIT_FINI_ARRAY define for use by CPU
ports to determine which global constructor and destructor methods are
used instead of placing architecture defines where they shouldn't be.

Close #4018
2020-06-30 09:46:12 +02:00
Sebastian Huber
153b26699e termios: Replace rtems_termios_isig_status_code
Merge the rtems_termios_isig_status_code and
rtems_termios_iproc_status_code enums into a single
rtems_termios_iproc_status_code which is now a part of the API.

Simplify rtems_termios_posix_isig_handler() to avoid unreachable code.

Close #3800.
2020-05-07 12:31:56 +02:00
Sebastian Huber
cfe8f7a9b7 doxygen: Switch @brief and @ingroup
This order change fixes the Latex documentation build via Doxygen.
2020-04-28 09:04:00 +02:00
Sebastian Huber
80cf60efec Canonicalize config.h include
Use the following variant which was already used by most source files:

  #ifdef HAVE_CONFIG_H
  #include "config.h"
  #endif
2020-04-16 07:30:00 +02:00
Sebastian Huber
c584d4eda4 rtems: Add rtems_put_char()
Update #3904.
2020-03-16 11:54:27 +01:00
Sebastian Huber
c2287ba2cf libio: Robust file descriptor reference counting
There was a race conditon in the reference counting of file descriptors
during a close() operation.  After the call to the close handler, the
rtems_libio_free() function cleared the flags to zero.  However, at this
point in time there may still exist some holders of the file descriptor.
With RTEMS_DEBUG enabled this could lead to failed assertions in
rtems_libio_iop_drop().

Change the code to use only atomic read-modify-write operations on the
rtems_libio_iop::flags.
2020-03-13 09:57:04 +01:00
Sebastian Huber
fa3005f6c1 console: Use IMFS_add_node() for simple task cons
Change license to BSD-2-Clause according to file history.

Update #3053.
Update #3894.
2020-03-04 09:38:58 +01:00
Sebastian Huber
7e3b5c0ced console: Use IMFS_add_node() for simple console
Change license to BSD-2-Clause according to file history.

Update #3053.
Update #3894.
2020-03-04 09:37:59 +01:00
Sebastian Huber
03aff2cf85 config: Add <rtems/confdefs/malloc.h>
Remove all comments and copyrightable content from the moved content.
Use BSD-2-Clause license for new file.

Move the default configuration to library files so that application
configurations do not include the definitions for the default case.

Update #3053.
Update #3875.
2020-02-25 07:18:37 +01:00
Sebastian Huber
ba74ebde74 libio: Add POSIX user environment pointer to TCB
The IO library used a POSIX key to store an optional POSIX user
environment pointer.  This pulled in the POSIX keys support in every
application configuration.  Add a user environment pointer to the thread
control block (TCB) instead.  Applications which do not need the POSIX
user environment will just get an overhead of one pointer per thread.

Close #3882.
2020-02-25 07:18:26 +01:00
Sebastian Huber
90f11edd01 termios: Fix input canonical mode
Canonical input processing was broken by
667501a314 as shown by test case
termios09.

Update #3800.
2020-02-10 09:01:10 +01:00
Sebastian Huber
eea21eaca1 bsps: Rework work area initialization
The work area initialization was done by the BSP through
bsp_work_area_initialize(). This approach predated the system
initialization through the system initialization linker set. The
workspace and C program heap were unconditionally initialized.  The aim
is to support RTEMS application configurations which do not need the
workspace and C program heap.  In these configurations, the workspace
and C prgram heap should not get initialized.

Change all bsp_work_area_initialize() to implement _Memory_Get()
instead.  Move the dirty memory, sbrk(), per-CPU data, workspace, and
malloc() heap initialization into separate system initialization steps.
This makes it also easier to test the individual initialization steps.

This change adds a dependency to _Heap_Extend() to all BSPs.  This
dependency will be removed in a follow up change.

Update #3838.
2020-02-04 06:06:41 +01:00
Joel Sherrill
5e7b3c6533 posix_devctl - Add support for SOCKCLOSE
The FACE Technical Standard, Edition 3.0 and later require the definition
of the subcommand SOCKCLOSE in <devctl.h>.

Reference: ​https://www.opengroup.org/face

closes #3856.
2020-01-17 16:13:35 -06:00
Chris Johns
f7cd8c9b8d libcsupport: Update rtems_print printk handler to return the length 2019-12-16 12:27:32 +11:00
Sebastian Huber
a00dff42cf rtems: Add and use rtems_object_get_local_node()
Update #3841.
2019-12-13 08:22:58 +01:00
Sebastian Huber
5630008257 kill: Fix warning
Include right header file for kill().
2019-11-05 07:29:01 +01:00
Joel Sherrill
667501a314 termios: Add Capability to Generate SIGINTR and SIGQUIT
This patch adds the ability for termios to send SIGINTR on receipt
of VINTR and SIGQUIT for VKILL and return -1/EINTR from read() on
a termios channel. Importantly, this patch does not alter the default
behavior or force POSIX signal code in just because termios is used.
The application must explicitly enable the POSIX behavior of generating
a signal upon receipt of these characters. This is discussed in the
POSIX standard:

   https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap11.html

Closes #3800.
2019-10-08 14:25:41 -05:00
Sebastian Huber
3fe215502a Remove superfluous <rtems/system.h> includes 2019-03-14 13:13:27 +01:00
Sebastian Huber
8eaf136de9 memalign: Add missing attributes to fix warning
Update #3666.
2019-01-10 11:35:38 +01:00
Sebastian Huber
2158621366 Add aligned_alloc() and memalign()
Ensure that the C++17 aligned new operator works.

Close #3666.
2018-12-21 07:56:35 +01:00
Sebastian Huber
28bf4cae78 or1k: Support GCC 9
Close #3602.
2018-11-14 07:02:03 +01:00
Sebastian Huber
6efc831f0f Add rtems_malloc() and rtems_calloc()
Close #3583.
2018-11-12 13:26:22 +01:00
Sebastian Huber
ac8025c113 libcsupport: Add missing include
Update #3598.
2018-11-08 13:18:28 +01:00
Sebastian Huber
e94b73f345 config: Include <rtems.h> for RTEMS_NEWLIB 2018-11-07 14:29:20 +01:00
Sebastian Huber
e292beba32 termios: Move default lock functions
Move rtems_termios_device_lock_acquire_default() and
rtems_termios_device_lock_release_default() to a file separate from the
general Termios support.  This avoids complex dependencies in printk()
only scenarios.
2018-11-07 11:09:51 +01:00
Sebastian Huber
d1f7204649 config: Fix CONFIGURE_DISABLE_NEWLIB_REENTRANCY
Move the __getreent() variant using the global reentrancy structure to
librtemscpu.a.  This avoids a definition of __getreent() in the
configuration module if CONFIGURE_DISABLE_NEWLIB_REENTRANCY is defined.
This avoids all the dependencies which would be exposed by a reference
to the global reentrancy structure.

This change is only possible since the default configuration moved to
librtemsdefaultconfig.a recently.
2018-11-07 07:52:55 +01:00
Sebastian Huber
54f3588831 posix: Provide threads by default
Update #2514.
2018-10-29 10:52:45 +01:00
Sebastian Huber
167654e7f0 Remove checks for flockfile(), etc. declarations
Declarations provided by Newlib since 2002.

Update #3409.
2018-10-22 08:06:06 +02:00
Sebastian Huber
f59edebf7e Remove getcwd()
This function is provided by Newlib since 2000.

Update #3409.
2018-10-22 08:06:06 +02:00
Sebastian Huber
79d145a7a2 Remove optional getrusage() declaration
Declaration provided by Newlib since 2014.

Update #3409.
2018-10-22 08:06:06 +02:00
Sebastian Huber
e161767e51 Remove ttyname()
This function is provided by Newlib since 2000.

Update #3409.
2018-10-22 08:06:06 +02:00
Sebastian Huber
658ec757cf Remove __assert()
This function is provided by Newlib since 2000.

Update #3409.
2018-10-22 08:06:06 +02:00
Sebastian Huber
87a9900f30 Remove isatty()
These functions are provided by Newlib since 2000.

Update #3409.
2018-10-22 08:06:06 +02:00
Sebastian Huber
3cf12c9c6a Remove strlcat(), strlcpy(), strsep(), readdir_r()
These functions are provided by Newlib since 2002.

Update #3409.
2018-10-22 08:06:05 +02:00
Sebastian Huber
1ad26cdcf7 Support O_NOFOLLOW open() flag
Close #3546.
2018-10-22 08:06:05 +02:00
Sebastian Huber
4af18b34f4 Support O_DIRECTORY open() flag
Close #3545.
2018-10-18 11:11:24 +02:00
Sebastian Huber
c980eaff1d console: Be fair in simple console read
Wait for one tick in case no character is available after a call to
getchark().  Otherwise the system is constantly busy within an input
loop (for example in the RTEMS shell).  The polled Termios driver uses
the same approach.
2018-10-18 07:23:29 +02:00
Sebastian Huber
313f897f10 Optimize calloc()
Use return value of memset() to enable tail call optimizations.
2018-10-04 08:02:29 +02:00
Sebastian Huber
1ad43f8809 Avoid need for -fno-builtin for calloc()
Use RTEMS_OBFUSCATE_VARIABLE() instead.
2018-10-04 08:02:28 +02:00
Sebastian Huber
541889069b Remove superfluous pipe_create() 2018-10-04 08:02:28 +02:00
Sebastian Huber
f004b2b8dc Use rtems_task_exit()
Update #3530.
Update #3533.
2018-10-02 10:22:15 +02:00
Sebastian Huber
995e91e847 riscv: Fix global construction
Update #3433.
2018-06-29 10:04:38 +02:00
Sebastian Huber
196ce1859a console: Add missing return status
Update #3320.
2018-06-27 08:58:16 +02:00
Sebastian Huber
de9b7d712b Add RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE
An invalid heap usage such as a double free is usually a fatal error
since this indicates a use after free.  Replace the use of printk() in
free() with a fatal error.

Update #3437.
2018-06-05 08:49:56 +02:00
Sebastian Huber
337a186909 Add a simple task console driver
Close #3320.
2018-03-06 12:32:09 +01:00
Sebastian Huber
5618997dfd termios: Fix use of uninitialized variable
Update #2840.
2018-02-22 15:35:20 +01:00
Sebastian Huber
2c12262f9a termios: Use self-contained objects
Update #2840.
2018-02-02 15:01:21 +01:00