Commit Graph

3248 Commits

Author SHA1 Message Date
Andrew Johnson
42f0b9be21 Posix: Fix how we check POSIX features
Darwin defines some macros as -1, which means unsupported.
2014-09-11 17:08:49 -05:00
Janet Anderson
81fdbdebd9 Added dummy for solaris build. 2014-09-11 09:10:44 -05:00
Andrew Johnson
431e87f95c libCom/posix: Drop SCHED_FIFO before exec() in child process
osiSpawnDetachedProcess() switches to SCHED_OTHER after fork() so
the new program will not be real-time unless is requests it itself.
Only happens when USE_POSIX_THREAD_PRIORITY_SCHEDULING = YES
2014-09-09 18:06:09 -05:00
Andrew Johnson
3f88273d0f Linux builds: Define _GNU_SOURCE and _DEFAULT_SOURCE
These replace the mixture of macros used to pick the features
presented by the standard system header files on Linux.

Updated the section of the CA reference manual that showed some
example compile lines to correct for 3.15 build changes.

Removed unused code & out-of-date comments.
2014-09-08 17:57:18 -05:00
Andrew Johnson
7a9407d7ab libCom: Clean up MS compiler warnings.
This doesn't fix the Microsoft link failure though, that may
need an upgrade of MS Visual Studio on our Hudson Windows VM.
2014-09-04 11:07:59 -05:00
Andrew Johnson
8604d4643a Merged Murali's memlock_all branch. 2014-08-29 10:58:55 -07:00
Murali Shankar
1b7c161f7f On POSIX systems, an IOC application's ability to meet timing deadlines is often
dependent on its ability to lock  part  or  all  of  the process's virtual
address space into RAM, preventing that memory from being paged to the swap
area.  This patch will attempt to lock the process's virtual address space into
RAM if the process has the ability to run threads with different priorities. If
unsuccessful, it prints an message to stderr.  

In Linux, one can grant a process the ability to run threads with different
priorities by using a command like ulimit -r unlimited. To use the FIFO
scheduler, use a command like so - chrt -f 1 softIoc -d test.db

In Linux, one can grant a process the ability to lock memory by using a command
like ulimit -l unlimited. Alternatively, these limits can be configured on a per
user/per group basis by using /etc/security/limits.conf or its equivalent.

In Linux, a child process created via fork inherits its parent's resource
limits.  Thus, it is probably a good idea to start the caRepeater before
starting the IOC.
2014-08-26 17:29:27 -07:00
Ralph Lange
f40c25723d libCom/osi: Fix for MinGW32 builds on Windows 2014-08-26 17:14:35 -07:00
Andrew Johnson
0d33e8a872 epicsStdio.c allow stderr from inside epicsThreadInit()
Circular initialization problem that Murali discovered when you
try to fprintf(stderr) from the posix/osdThread.c once() routine.
This change lets the stderr stream through in that case.
2014-08-26 16:40:02 -07:00
Andrew Johnson
83d22ce164 libCom: Darwin has setenv(), use it. 2014-08-26 14:51:18 -07:00
Andrew Johnson
2aea693faf Merged Jeff's 3.15_libcom_from_cvs_trunk branch. 2014-08-25 16:27:18 -05:00
Andrew Johnson
9079c8aa53 Reverted changes to epicsTime.h and epicsThread.h 2014-08-18 22:55:07 -05:00
Andrew Johnson
5e0bf53fec epicsTypes.h: Don't use C99 types
The __STDC_VERSION__ >= 199901L test never succeeds
in C++, and there were issues with the epicsInt8
definition anyway (int8_t is signed, but char might
not be).

I also removed the epicsBoolean enum which we never use.
2014-08-15 12:24:31 -05:00
Andrew Johnson
547a9b3ebc Tweak some dependency rules for correctness 2014-08-05 14:03:37 -05:00
Andrew Johnson
aedea0da37 default/osdSpin.c add missing #include "cantProceed.h"
Also adjusted some error messages for common style.
2014-08-02 23:15:43 -05:00
Andrew Johnson
b7f8f17227 blockingSockTest: Undo member renames using m_ prefix
Using the m_ prefix to denote class data members is dangerous in
code that has to compile on VxWorks 5.5 (which 3.15 does) because
the net/mbuf.h header contains the following macro definitions:

#define m_next          mBlkHdr.mNext
#define m_len           mBlkHdr.mLen
#define m_data          mBlkHdr.mData
#define m_type          mBlkHdr.mType
#define m_flags         mBlkHdr.mFlags
#define m_nextpkt       mBlkHdr.mNextPkt
#define m_act           m_nextpkt
#define m_pkthdr        mBlkPktHdr
#define m_ext           pClBlk
#define m_extBuf        m_ext->clNode.pClBuf
#define m_extFreeRtn    m_ext->pClFreeRtn
#define m_extSize       m_ext->clSize
#define m_extRefCnt     m_ext->clRefCnt
#define m_extArg1       m_ext->clFreeArg1
#define m_extArg2       m_ext->clFreeArg2
#define m_extArg3       m_ext->clFreeArg3
#define  m_copy(m, o, l)        m_copym((m), (o), (l), M_DONTWAIT)
#define  m_copym(m, o, l, w)    netMblkChainDup(_pNetDpool, (m), (o), (l), (w))
#define  m_freem(m)             netMblkClChainFree(m)
#define  m_free(m)              netMblkClFree(m)    
#define m_mbufs         mNum
#define m_drops         mDrops
#define m_wait          mWait
#define m_drain         mDrain
#define m_mtypes        mTypes

While the names in the original change all appear to be safe, I
don't want us to start using this convention because we will then
have to police commits more closely or risk build failures in the
future when someone who doesn't know about or remember the issue
can't or doesn't try building their code against VxWorks 5.5.

I don't particularly like the this-> convention to mark member
names either, but until the VxWorks 5.5 support requirement goes
away the m_ convention is worse. Another common convention of
using a leading underscore is not safe either, those names are
reserved for the C/C++ implementation.
2014-08-02 14:02:43 -05:00
Andrew Johnson
8d5cdc3747 Fix typo in macro name
Not that it really matters since only VxWorks and RTEMS actually
compile this file and they don't have shared libraries...
2014-08-02 13:13:49 -05:00
Andrew Johnson
f1a59aa64a Use epicsUInt types, stdint.h is not found on all platforms 2014-08-02 13:09:07 -05:00
Andrew Johnson
6767f5089f threadPool: Replaced errno.h status values with S_pool_* ones
ETIMEDOUT is not provided on MinGW.
2014-08-01 17:55:53 -05:00
Andrew Johnson
ab78480d54 Merged spinlockfix branch.
Some last-minute fixes for VxWorks build warnings.
2014-07-31 12:45:40 -05:00
Andrew Johnson
68bcc77885 Merged alarm-strings branch. 2014-07-31 10:17:24 -05:00
Andrew Johnson
b3afbea7cf Merged Michael's thread-pool branch.
Made various formatting changes, and fixed one problem in the
test program which failed a test on UP machines.
2014-07-29 16:05:24 -05:00
Michael Davidsaver
716f2679a7 thread pool: don't use reserved names
Avoid global symbols with leading underscore
2014-07-29 12:21:07 -04:00
Michael Davidsaver
b1a8b2f20e thread pool: switch thread counts to unsigned int
size_t is considered overly optimistic
2014-07-29 12:18:19 -04:00
Michael Davidsaver
6fee83900e don't include errCommon.h
doesn't exist anymore
2014-07-29 12:06:24 -04:00
Michael Davidsaver
c4a1208d6e epicsSpinTest: add to libCom test harness 2014-07-25 18:17:27 -04:00
Michael Davidsaver
9cb65e5408 epicsSpinTest: plug some leaks 2014-07-25 18:17:02 -04:00
Andrew Johnson
2a9d05248f Fix epicsSpinTest.c spinThread tests
Runs many more rounds, without blocking with the lock held.
2014-07-25 16:21:03 -05:00
Andrew Johnson
752549d1c8 Fix epicsAtomic headers when used from C code
Several C++ and C99-isms crept in.
2014-07-25 15:05:58 -05:00
Michael Davidsaver
8fec9d6e00 epicsSpin: try lock return non-blocking
Avoid cantProceed() in try lock, even for undefined behavior.
2014-07-25 15:12:02 -04:00
Michael Davidsaver
5824f98972 epicsSpinTest: fix verifyTryLock()
avoid sleeping with a spinlock held.
Now test only works on SMP systems.
2014-07-25 15:11:54 -04:00
Michael Davidsaver
95b916ecd4 thread pool: mark epicsJobCreate() as safe for job functions
Also, use epicsJobMove() to avoid some redundant code
2014-07-25 10:16:20 -04:00
Michael Davidsaver
cbfbce54f9 thread pool: epicsThreadPoolWait return ETIMEOUT 2014-07-25 09:59:46 -04:00
Michael Davidsaver
b3a1fe9c6b thread pool: fix return of epicsJobUnqueue()
Return 0 on success (was queued, now is not),
1 if not queued initially, and EINVAL
if orphaned.
2014-07-24 18:56:27 -04:00
Michael Davidsaver
83dfc7980d thread pool: handle failure to create worker
epicsJobQueue() returns EAGAIN when the first worker
can't be lazily created.

Failure to create workers beyond the first is
silently ignored.
2014-07-24 18:50:19 -04:00
Michael Davidsaver
69d1063067 thread pool: epicsJobQueue return EPERM
When pool control prevents operation
2014-07-24 18:19:33 -04:00
Andrew Johnson
9b6e270b97 Final spinlock tidying-up
* Abort epicsSpinTest() if epicsSpinCreate() returns NULL
* Adjust RELEASE_NOTES that describe the implementations.
2014-07-24 16:33:35 -05:00
Michael Davidsaver
fc4119094f thread pool: epicsThreadPoolGetShared accepts NULL as defaults 2014-07-24 14:44:28 -04:00
Michael Davidsaver
01a50b5165 thread pool test 2014-07-24 14:22:52 -04:00
Michael Davidsaver
658bd0b570 thread pool implementation 2014-07-24 14:22:52 -04:00
Michael Davidsaver
a8fd14aae1 Thread pool API 2014-07-24 14:22:52 -04:00
Michael Davidsaver
87a6688c17 epicsSpin: remove redundant cantProceed() messages 2014-07-24 10:23:55 -04:00
Michael Davidsaver
3ba5bf943e epicsSpin: better error messages when mis-use is detected 2014-07-23 18:40:08 -04:00
Andrew Johnson
6bdb8f911a Suppress errlog output of expected warning messages. 2014-07-23 16:18:32 -05:00
Andrew Johnson
3ff49fc9b2 Fixed build errors, remove dependency on std.
Build errors: Include guard missing from epicsUnitTest.h;
    dbShutdownTest.c was calling the non-universal strcasecmp()
    instead of epicsStrCaseCmp().

ioc/db/test no longer depends on std. I modified
    xRecord to make it a working record type, and simplified the
    other test programs so they all use the same new expanded
    dbd file rather than each making their own. I also added
    dbShutdownTest() to epicsRunDbTests().
2014-07-10 14:27:44 -05:00
Andrew Johnson
60a0c7f181 Make epicsExit subsystem reusable.
Calling epicsAtExit() after epicsExitCallAtExits() now
recreates the per-process list and registers the routine.
2014-06-23 16:28:25 -04:00
Michael Davidsaver
3ca42fc838 cleanup iocsh 2014-06-23 16:28:22 -04:00
Michael Davidsaver
ad2bb0725d asShutdown 2014-06-23 16:28:22 -04:00
Michael Davidsaver
f405b444a3 errlog: nicer exit handler name 2014-06-23 16:28:19 -04:00
Michael Davidsaver
a28a561d8a epicsExit: optional debug printing
Add a flag to cause a string to be printed
before each handler is run to show the order.
2014-06-23 16:28:18 -04:00