- HandlerMinelayerData: BUILD_RTI Guards für RTI-Abhängigkeiten - svcTabCommon: Export-Header-Fix via Fallback-Target - TrainingAreaBase: Stub-Header für BUILD_RTI=OFF - ddsfts: Include-Pfad und Dependency-Fixes - BUILD_RTI=OFF Compilation vollständig unterstützt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M0JNZA586SACX1PRZ2DJAE5S
147 lines
4.4 KiB
C
147 lines
4.4 KiB
C
/*
|
|
* (c) Copyright, Real-Time Innovations, 2003-2024.
|
|
* All rights reserved.
|
|
*
|
|
* No duplications, whole or partial, manual or electronic, may be made
|
|
* without express written permission. Any such copies, or
|
|
* revisions thereof, must display this notice unaltered.
|
|
* This code contains trade secrets of Real-Time Innovations, Inc.
|
|
*/
|
|
|
|
#ifndef osapi_process_h
|
|
#define osapi_process_h
|
|
|
|
#include "osapi/osapi_type.h"
|
|
#include "osapi/osapi_ntptime.h"
|
|
#include "osapi/osapi_dll.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** @internal \file
|
|
* \brief process related utility
|
|
*/
|
|
/** @internal \defgroup RTIOsapiProcessClass RTIOsapiProcess
|
|
* \ingroup RTIOsapiModule
|
|
*
|
|
* \brief OS independent encapsulation of an application process,
|
|
* in a separate address space
|
|
*/
|
|
extern RTIOsapiDllExport RTI_UINT64 RTIOsapiProcess_getId(void);
|
|
|
|
/** @internal \defgroup RTIOsapiProcessClass RTIOsapiProcess
|
|
* \ingroup RTIOsapiModule
|
|
*
|
|
* \brief For kernel-mode VxWorks, this resets the global variable from
|
|
* RTIOsapiProcess_getId back to 0, so that the next application can set it
|
|
* properly without having to unload and reload the core library.
|
|
*/
|
|
extern RTIOsapiDllExport void RTIOsapiProcess_resetId(void);
|
|
|
|
/** @internal \ingroup RTIOsapiProcessClass
|
|
* @brief Determines whether the process is still alive.
|
|
* @param pidIn process id, which is unique for the application.
|
|
*
|
|
* @note this method internally generates exceptions,
|
|
* therefore the caller does not need to log an exception.
|
|
*/
|
|
extern RTIOsapiDllExport RTIBool RTIOsapiProcess_isAlive(RTI_UINT64 pidIn);
|
|
|
|
/** @internal \ingroup RTIOsapiProcessClass
|
|
* @brief Memory info.
|
|
*/
|
|
struct RTIOsapiProcessMemoryInfo {
|
|
/** @internal @brief Resident memory size */
|
|
RTI_UINT64 physicalMemory;
|
|
/** @internal @brief Virtual memory size */
|
|
RTI_UINT64 totalMemory;
|
|
};
|
|
|
|
#define RTIOsapiProcessMemoryInfo_INITIALIZER \
|
|
{ \
|
|
0, 0 \
|
|
}
|
|
|
|
/** @internal \ingroup RTIOsapiProcessClass
|
|
* @brief Obtain information about the memory used by the process.
|
|
*
|
|
* @return If there is an error or the API is not supported this API returns
|
|
* RTI_FALSE. Otherwise, RTI_TRUE
|
|
*/
|
|
extern RTIOsapiDllExport RTIBool
|
|
RTIOsapiProcess_getMemoryInfo(struct RTIOsapiProcessMemoryInfo *info);
|
|
|
|
#if !defined(RTI_IOS) \
|
|
&& (defined(RTI_LINUX) || defined(RTI_DARWIN) || defined(RTI_QNX) \
|
|
|| defined(RTI_WIN32) || defined(RTI_INTIME))
|
|
#define RTI_OSAPI_PROCESS_MEMORY_INFO_SUPPORTED 1
|
|
#else
|
|
#define RTI_OSAPI_PROCESS_MEMORY_INFO_SUPPORTED 0
|
|
#endif
|
|
|
|
struct RTIOsapiProcessCpuInfo {
|
|
struct RTINtpTime userCpuUsage;
|
|
struct RTINtpTime kernelCpuUsage;
|
|
};
|
|
|
|
#define RTIOsapiProcessCpuInfo_INITIALIZER \
|
|
{ \
|
|
RTI_NTP_TIME_ZERO, RTI_NTP_TIME_ZERO \
|
|
}
|
|
|
|
/** @internal \ingroup RTIOsapiProcessClass
|
|
* @brief Obtain information about the cpu used by the process.
|
|
*
|
|
* @return If there is an error or the API is not supported this API returns
|
|
* RTI_FALSE. Otherwise, RTI_TRUE
|
|
*/
|
|
extern RTIOsapiDllExport RTIBool
|
|
RTIOsapiProcess_getCpuInfo(struct RTIOsapiProcessCpuInfo *info);
|
|
|
|
|
|
#if defined(RTI_UNIX) || defined(RTI_QNX) || defined(RTI_WIN32)
|
|
#define RTI_OSAPI_PROCESS_CPU_INFO_SUPPORTED (1)
|
|
#else
|
|
#define RTI_OSAPI_PROCESS_CPU_INFO_SUPPORTED (0)
|
|
#endif
|
|
|
|
|
|
#if (defined(RTI_LINUX) || defined(RTI_QNX) || defined(RTI_DARWIN))
|
|
#include <sys/resource.h>
|
|
#endif
|
|
|
|
#if (defined(RTI_64BIT) \
|
|
&& (defined(RTI_SOL2) || defined(RTI_QNX) || defined(RTI_ANDROID)))
|
|
#define RTIOsapiProcessRLimit rlimit64
|
|
#elif (defined(RTI_LINUX) || defined(RTI_SOL2) || defined(RTI_QNX) \
|
|
|| defined(RTI_DARWIN))
|
|
#define RTIOsapiProcessRLimit rlimit
|
|
#else
|
|
struct RTIOsapiProcessRLimit {
|
|
RTI_UINT64 rlim_cur; /* Soft limit */
|
|
RTI_UINT64 rlim_max; /* Hard limit (ceiling for rlim_cur) */
|
|
};
|
|
#endif
|
|
|
|
/** @internal
|
|
* @brief Get the soft and hard limits of a resource. See
|
|
* https://man7.org/linux/man-pages/man2/getrlimit.2.html For architectures
|
|
* where the getrlimit API is not supported, this call returns successfully and
|
|
* sets limit->rlim_cur to RLIM_SAVED_CUR and limit->rlim_cur to RLIM_SAVED_MAX
|
|
* @param resource \st_in The resource for which we obtain the limits
|
|
* @param limit \st_out The variable where the limit values are stored
|
|
* @return 0 if it set the limits successfully, -1 upon error.
|
|
*/
|
|
extern RTIOsapiDllExport int RTIOsapiProcess_getrlimit(
|
|
int resource,
|
|
struct RTIOsapiProcessRLimit *limit);
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#include "osapi/osapi_process_impl.h"
|
|
|
|
#endif /* osapi_process_h */
|