Commit Graph

335 Commits

Author SHA1 Message Date
Gustavo de Souza dos Reis
a13dfac124 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-11-28 11:51:42 +01:00
Ralph Lange
46d80bf50e libCom/posix: don't memlock() if opted out of FIFO scheduling 2025-11-28 11:51:42 +01:00
Ralph Lange
54c69ad5fa libCom/posix: add env var to opt out of FIFO scheduling
- add EPICS_ALLOW_POSIX_THREAD_PRIORITY_SCHEDULING
  (default: YES)
- start EPICS threads with default policy
  when set to NO
2025-11-28 11:51:42 +01:00
Michael Davidsaver
d7286cd956 posix: epicsThreadShowAll include OSD priority range and mlockall state 2025-11-28 11:51:41 +01:00
1918aebf97 Merge branch '7.0' 2025-10-10 10:33:50 +02:00
Jeremy Lorelli
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
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 Davidsaver
5ae9cc6536 gethostbyname -> getaddrinfo
Prefer reentrant DNS API
2025-07-30 10:16:23 -05:00
Jerzy Jamroz
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
0f29b34f68 Merge branch '7.0' into PSI-7.0 2025-07-14 10:49:20 +02:00
Hinko Kocevar
5813dcd639 attempt to fix a linter error for step 49 of "Path" 2025-06-20 16:01:44 -05:00
Hinko Kocevar
b8e70783d8 trying to fix vs2012 and vs2010 builds 2025-06-20 16:01:44 -05:00
Hinko Kocevar
87b8050437 handle backslash for EPICS command line library (similar to READLINE) 2025-06-20 16:01:44 -05:00
Hinko Kocevar
b9b2da26fd detect and handle backslash as part of multi-line string 2025-06-20 16:01:44 -05:00
Érico Nogueira
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] 1da177e4c3
2025-06-04 09:55:04 -05:00
09f96d056a Merge branch '7.0' into PSI-7.0 2025-03-21 15:15:57 +01:00
1732c9440a fix for mingw warning about order of header files 2025-03-21 13:49:05 +01:00
93ba98cdca VxWorks does not mark abort() or exit() noreturn 2025-03-21 13:49:04 +01:00
Jeremy Lorelli
6ea6ae633b Define NOCRYPT, NOSOUND and NOKANJI before including windows.h 2025-03-19 11:19:45 -05:00
JJL772
fc5d3c9a5c Disable extraneous WIN32 declarations when including windows.h in epicsAtomicOSD.h 2025-03-19 11:19:45 -05:00
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 Davidsaver
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
43e75e3901 decorate functions that do not return 2025-03-05 09:51:57 -06:00
ea7459084e Merge remote-tracking branch 'github/noreturn' into PSI-7.0 2025-03-04 17:55:32 +01:00
74d231b04f decorate functions that do not return 2025-03-04 14:41:05 +01:00
55791ef470 Merge branch 7.0.9 into PSI-7.0 2025-03-03 17:19:23 +01:00
7b2fb669ec Merge remote-tracking branch 'xiaoqiang/7.0' into PSI-7.0 2025-03-03 17:14:20 +01: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 Lorelli
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
b53505d339 Merge branch '7.0' into PSI-7.0 2024-12-05 16:58:15 +01:00
Chris Johns
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 Johns
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 Davidsaver
152d306ad8 avoid UB with self pthread_join() 2024-10-02 09:22:00 -05:00
Michael Davidsaver
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 Nogueira
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
4af01ed26a Merge branch '7.0' into PSI-7.0 2024-09-06 14:55:12 +02:00
Freddie Akeroyd
dd154180bf Avoid isnan/isinf redefine in c++ on VS2013 and above 2024-09-04 09:48:03 -05:00
Freddie Akeroyd
574fe116fc protect isnan/isinf define on c++ 2024-09-04 09:48:03 -05:00
d67036fcc0 Merge branch 'aliases' into PSI-7.0 2024-08-26 16:37:57 +02:00
Michael Davidsaver
057eb87101 readline: only keep history for interactive session 2024-08-21 09:36:39 -05:00
5930e8e2e4 time_t has 64 bit o 64 bit architectures 2024-08-09 11:44:26 +02:00
87d492bffd Merge branch '7.0' into PSI-7.0 2024-04-30 14:40:00 +02:00
Freddie Akeroyd
5dfc6caf3c Accept should return SOCKET rather than int 2024-03-06 09:48:26 -06:00
Freddie Akeroyd
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