diff --git a/Makefile b/Makefile index f859d43..732727b 100644 --- a/Makefile +++ b/Makefile @@ -9,5 +9,6 @@ SOURCES += updateMenuConvert.c SOURCES += addScan.c SOURCES += disctools.c SOURCES += exec.c +SOURCES += mlock.c SOURCES_vxWorks += bootNotify.c diff --git a/mlock.c b/mlock.c new file mode 100644 index 0000000..891e026 --- /dev/null +++ b/mlock.c @@ -0,0 +1,48 @@ +#include +#include + +#ifdef UNIX +#include +#include +#endif + +#ifdef UNIX +static const iocshFuncDef mlockDef = { "mlock", 0, NULL }; + +static void mlockFunc(const iocshArgBuf *args) +{ + int status; + + status = mlockall(MCL_CURRENT|MCL_FUTURE); + + if (status != 0) { + perror ("mlock failed"); + } +} + +static const iocshFuncDef munlockDef = { "munlock", 0, NULL }; + +static void munlockFunc(const iocshArgBuf *args) +{ + int status; + + status = munlockall(); + + if (status != 0) { + perror ("mlock failed"); + } +} +#endif + +static void +mlockRegister(void) +{ + static int firstTime = 1; + if (firstTime) { +#ifdef UNIX + iocshRegister(&mlockDef, mlockFunc); + iocshRegister(&munlockDef, munlockFunc); +#endif + } +} +epicsExportRegistrar(mlockRegister); diff --git a/mlock.dbd b/mlock.dbd new file mode 100644 index 0000000..ef34eb0 --- /dev/null +++ b/mlock.dbd @@ -0,0 +1 @@ +registrar(mlockRegister)