Commit Graph
279 Commits
Author SHA1 Message Date
Gustavo de Souza dos ReisandGitHub 0ab956b123 Fix doc. comments in epicsEvent.h
* Fix typo in epicsEventWaitWithTimeout.

* Reword epicsEvent timeout documentation to reflect the actual behavior.

Negative values of timeout are handled the same way as zero values.
Change the documentation to reflect this behavior.
2025-10-14 08:47:59 -07:00
Jeremy LorelliandAndrew Johnson bd8c35d8e7 Implement epicsMessageQueueSend/epicsMessageQueueReceive to resolve link error
These were defined as macros in osdMessageQueue.h, but declared as
prototypes in epcisMessageQueue.h public header. We need to implement
them as C functions for these to actually be usable.
2025-10-08 09:53:33 -05:00
Michael Davidsaver 7444936a22 colorize more errors/warnings 2025-09-20 09:42:01 -05:00
Michael Davidsaver 2e26ec09a6 posix: initialize pthread_attr for non-epics threads 2025-09-03 07:36:36 -07:00
zimochandGitHub 007df69726 fix EPICS_PRINTF_STYLE so old mingw recognizes %ll and %z (#674)
gcc knows __gnu_printf__ since version 4.4.0, not only for MinGW but for
all targets. As we would need to check the gcc version anyway to avoid
"unrecognized format function type" errors with older MinGW versions,
we can simply use it for recent gcc versions and not depend on MinGW at all.
2025-07-30 10:23:19 -05:00
Michael DavidsaverandAndrew Johnson 5ae9cc6536 gethostbyname -> getaddrinfo
Prefer reentrant DNS API
2025-07-30 10:16:23 -05:00
Jerzy Jamrozandmdavidsaver f4e1019ebe fix: ts{} {} warning: missing initializer for members
- warning: missing initializer for member ‘epicsTimeStamp::secPastEpoch’ [-Wmissing-field-initializers]
- warning: missing initializer for member ‘epicsTimeStamp::nsec’ [-Wmissing-field-initializers]
2025-07-21 10:23:12 -05:00
Hinko KocevarandAndrew Johnson 5813dcd639 attempt to fix a linter error for step 49 of "Path" 2025-06-20 16:01:44 -05:00
Hinko KocevarandAndrew Johnson b8e70783d8 trying to fix vs2012 and vs2010 builds 2025-06-20 16:01:44 -05:00
Hinko KocevarandAndrew Johnson 87b8050437 handle backslash for EPICS command line library (similar to READLINE) 2025-06-20 16:01:44 -05:00
Hinko KocevarandAndrew Johnson b9b2da26fd detect and handle backslash as part of multi-line string 2025-06-20 16:01:44 -05:00
Érico NogueiraandAndrew Johnson 21368dc7b4 Don't include linux/ header in osdSockUnsentCount.
Per the manpage in the file's comment, SIOCOUTQ is equivalent to the
TIOCOUTQ ioctl, whose value can be obtained by including <sys/ioctl.h>,
which allows us to avoid including any system-specific headers. This is
desirable so that, on a musl system, it won't be necessary to install
kernel headers in order to build epics-base.

Since it's first been checked into Git, the Linux kernel has defined
SIOCOUTQ to be TIOCOUTQ [1].

From the three main libc options on Linux: glibc and uclibc use the
kernel headers, so both ioctls are available; and musl defines only
TIOCOUTQ in their own headers.

[1] https://github.com/torvalds/linux/commit/1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
2025-06-04 09:55:04 -05:00
Jeremy LorelliandAndrew Johnson 6ea6ae633b Define NOCRYPT, NOSOUND and NOKANJI before including windows.h 2025-03-19 11:19:45 -05:00
JJL772andAndrew Johnson fc5d3c9a5c Disable extraneous WIN32 declarations when including windows.h in epicsAtomicOSD.h 2025-03-19 11:19:45 -05:00
zimochandAndrew Johnson b97a35fec8 Don't use __attribute__((noreturn)) on VxWorks
VxWorks does not mark abort() or exit() as noreturn.
Thus, functions declared noreturn which end in a call
to those functions cause a compiler warning on vxWorks.
2025-03-19 11:06:26 -05:00
Michael DavidsaverandAndrew Johnson 48ebe2c64e Avoid initMainThread() except on vxworks
Move isOkToBlock tracking to osdThread.
Targets except vxworks can store this flag in epicsThreadOSD.
Continue to use TLS w/ vxWorks.

Note that setting of isOkToBlock for "main" thread becomes lazy.
2025-03-19 10:53:42 -05:00
zimochandAndrew Johnson 43e75e3901 decorate functions that do not return 2025-03-05 09:51:57 -06:00
Michael Davidsaver e4ad4becde rationalize osdMutex
Avoids split allocation.
Eliminates special case free-list.

win32: eliminate pre-XP
rtems-score: eliminate non-fast
2024-12-29 16:35:26 -08:00
Jeremy LorelliandMichael Davidsaver 721e9cc3a7 Add ABORT_ON_ASSERT flag to CONFIG_SITE
This flag causes EPICS to call abort() on assertion failures rather than
suspend the executing thread. With the epicsThreadSuspendSelf() behavior,
an IOC can end up in a difficult to detect error state where one or more
threads has essentially crashed due to an assertion failure.

This also matches the C behavior of assert(3)
2024-12-29 16:34:10 -08:00
Chris JohnsandAndrew Johnson 594e5ee9db rtems: Set the name of EPICS threads so RTEMS commands report the name
Use the NP POSIX call pthread_setname_np to set the POSIX thread name.
2024-10-31 16:21:49 -05:00
Chris JohnsandAndrew Johnson 83cbf8a4c7 freebsd: Add support for x86 and amd64 builds
Use the OS compiler, ie cc and c++.
2024-10-31 16:16:45 -05:00
Michael DavidsaverandAndrew Johnson 152d306ad8 avoid UB with self pthread_join() 2024-10-02 09:22:00 -05:00
Michael DavidsaverandAndrew Johnson 012139638d posix: epicsThreadCreateOpt() avoid leak of joinable on EPERM
On a system where RT priorities have been probed.
When creating a joinable thread, but still fails
with EPERM, the first epicsThreadOSD was leaked.
2024-10-02 09:22:00 -05:00
Érico Nogueiraandmdavidsaver 8045770751 libCom: don't use std::unexpected in epicsThread.
Besides being deprecated in C++11 and removed in C++17, the intended use
case for this was always wrong, since std::unexpected() is called by the
C++ runtime when a function throws an exception that was not specified
in its "dynamic exception specification", which is different from an
exception thrown by user code which wasn't caught [1,2]. Using abort()
keeps the same behavior, but with the intended semantics.

We don't use std::abort() to simplify backwards compatibility.

[1] https://github.com/epics-base/epics-base/issues/343
[2] https://en.cppreference.com/w/cpp/error/unexpected
2024-09-09 07:27:32 -07:00
Freddie AkeroydandAndrew Johnson dd154180bf Avoid isnan/isinf redefine in c++ on VS2013 and above 2024-09-04 09:48:03 -05:00
Freddie AkeroydandAndrew Johnson 574fe116fc protect isnan/isinf define on c++ 2024-09-04 09:48:03 -05:00
Michael DavidsaverandAndrew Johnson 057eb87101 readline: only keep history for interactive session 2024-08-21 09:36:39 -05:00
Freddie AkeroydandAndrew Johnson 5dfc6caf3c Accept should return SOCKET rather than int 2024-03-06 09:48:26 -06:00
Freddie AkeroydandAndrew Johnson 4720b61c1f Move call to setThreadName()
The call to setThreadName() is moved to avoid a race condition that
can happen with very short lived processes. If the process terminates
very quickly e.g. is a google test runner or the msi.exe command
called from a Makefile during a build, then very occasionally a
crash can occur during process termination if setThreadName() when called
from the newly created thread. This looks to be becauae the DLL it is
trying to call gets unloaded between it getting a handle to the DLL
and making the call. Moving the setThreadName() call to the creating
thread avoids this problem. The issue was only ever seen with statically
linked epics executables, I am unsure if the way a DLL based epics
program unloads might avoid this, or just make it less likely but
still possible. As mentioned above, the issue will only ever occur
to threads that are created during process termination and so would
not affect running IOCs
2024-02-21 09:59:36 -06:00
Michael Davidsaver 07cbf00187 posix: warn on epicsSocketCreate() without osiSockAttach() 2023-12-22 10:26:28 -08:00
Michael Davidsaver a7a56912eb default/epicsMessageQueue: initialize threadNode 2023-12-22 10:26:28 -08:00
Michael Davidsaver fe4a32e425 default/epicsMessageQueue: avoid volatile flag
Only one place where eventSent was accessed
without locking.  Move this load earlier.
2023-12-22 10:26:28 -08:00
Andrew Johnson 2e6fd505d2 Use epicsSnprintf() for old MSVC compilers 2023-12-14 11:31:36 -06:00
Andrew Johnson 5ecf7d18a8 Clean up Clang 15 sprintf() warnings in libcom and ca 2023-12-13 13:34:25 -06:00
Michael Davidsaver b41787b6bf doc 2023-10-22 17:42:36 -07:00
JJL772andMichael Davidsaver 395015aac4 Com: Make STATIC_ASSERT macro typedefs unique 2023-10-22 17:42:36 -07:00
Michael Davidsaver 45b3bce515 epicsThreadShow() zombies
Flag when the thread has returned, but the tracking
struct is still around.  eg. in need of joining.
2023-09-22 08:19:25 -07:00
Érico NogueiraandMichael Davidsaver 7c4a21eab4 libCom: detect support for backtrace() with __has_include.
This is necessary in order to build epics-base with musl libc, for
example, and any other C libraries which don't include this
functionality. In order to not regress builds with older compilers, we
still support the uclibc check. Furthermore, it has been checked that
uclibc-ng (the maintained version of uclibc) doesn't install the
<execinfo.h> header when the functionality is disabled [1] [2].

To avoid repetition, we don't define HAS_EXECINFO to 0 when it is not
available.

[1] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/Makefile.in?id=cdb07d2cd52af39feb425e6d36c02b30916b9f0a#n224
[2] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/Makefile.in?id=cdb07d2cd52af39feb425e6d36c02b30916b9f0a#n277
2023-09-21 08:18:49 -07:00
Michael Davidsaver 1595ed8860 quieting clang-tidy, non-functional changes
Changes to syntax which should not effect generated code
2023-08-28 14:17:00 +02:00
Ralph LangeandMichael Davidsaver 6636b4b9e7 libCom: check calloc() failure in RTEMS-posix/osdMessageQueue.c 2023-07-22 08:35:59 -07:00
Ralph LangeandMichael Davidsaver b51d1de283 libCom: fix possible memory leak in RTEMS-posix/osdMessageQueue.c
found by static code analysis (cppcheck @ sonarqube)
2023-07-22 08:35:59 -07:00
Michael Davidsaver 42604fc794 Allow clang with GCC compilerSpecific.h
Check EditorConfig / editorconfig (push) Failing after 1s
Base / Cross linux-aarch64 (push) Failing after 2s
Base / Cross linux-arm gnueabi (push) Failing after 1s
Base / Cross linux-arm gnueabihf (push) Failing after 2s
Base / CentOS-7 (push) Failing after 1s
Base / Fedora-33 (push) Failing after 2s
Base / Fedora-latest (push) Failing after 1s
Base / Ub-20 clang-10 C++11 (push) Has been cancelled
Base / Ub-20 gcc-9 + RT-4.10 (push) Has been cancelled
Base / Ub-20 gcc-9 + RT-5.1 xilinx_zynq_a9_qemu (push) Has been cancelled
Base / Win2019 mingw (push) Has been cancelled
Base / Ub-20 gcc-9 + MinGW (push) Has been cancelled
Base / Ub-20 gcc-9 unsigned char (push) Has been cancelled
Base / Ub-20 gcc-9 C++11, static (push) Has been cancelled
Base / Ub-20 gcc-9 + MinGW, static (push) Has been cancelled
Base / MacOS clang-12 (push) Has been cancelled
Base / Ub-20 clang-10 (push) Has been cancelled
Base / Ub-20 gcc-9 + RT-5.1 beatnik (push) Has been cancelled
Base / Ub-20 gcc-9 + RT-4.9 (push) Has been cancelled
Base / Ub-20 gcc-9 + RT-5.1 pc686 (push) Has been cancelled
Base / Ub-20 gcc-9 + RT-5.1 uC5282 (push) Has been cancelled
Base / Win2019 MSC-19 (push) Has been cancelled
Base / Win2019 MSC-19, debug (push) Has been cancelled
Base / Win2019 MSC-19, static (push) Has been cancelled
Makes it easier to run clang derivative analysis tools
on builds configured for GCC.
2023-06-13 08:47:13 -07:00
Freddie AkeroydandMichael Davidsaver f56412d6a5 WIN32: use FlsAlloc() to cleanup epicsThreadOSD
Adjust macros for compiling for older MSVC/Win SDK versions

Try to cover missing fibres include in 7.0 SDK

Support Windows XP and above.
Also removed explicit define of _WIN32_WINNT in code if it has not
been passed on compile line. This is possibly a matter for
further discussion
2023-05-01 09:03:52 -07:00
Eva LottandMichael Davidsaver b878295d06 Added the new annotation EPICS_PRINTF_FMT 2023-05-01 09:03:45 -07:00
zimochandMichael Davidsaver f41f11c7f6 fix compiler warning on 32 bit systems 2023-04-28 09:35:49 -05:00
Michael Davidsaver 5507646ce7 posix: optimize epicsThreadOnce()
Use atomic ops to short circuit when already initialized
2023-04-18 09:51:24 -05:00
Michael Davidsaver e22d74310b RTEMS: ensure epicsThreadMustJoin() short-circuits 2023-03-10 09:52:08 +00:00
Andrew Johnson c2364d9d1c Add license header to new epicsReadlinePvt.h 2022-12-28 12:42:51 -06:00
Michael Davidsaver 166267a32f ringPointerTest in thread 2022-12-20 20:12:04 -08:00
Michael Davidsaver 07ffc1ffae Com: introduce epicsReadlinePvt.h
Helping IDEs understand gnuReadline.c and osdReadline.c
2022-12-20 20:11:45 -08:00