diff --git a/third_party/fwkacllib/inc/hccl/base.h b/third_party/fwkacllib/inc/hccl/base.h index 94253bf4..8194097e 100644 --- a/third_party/fwkacllib/inc/hccl/base.h +++ b/third_party/fwkacllib/inc/hccl/base.h @@ -68,8 +68,10 @@ struct MemRegisterAddr { u64 addr; u64 length; }; - -const u32 HCCL_MAX_MEM_REGISTER_NUM = 8; // The max number of memory register address. +/* + * @brief The max number of memory register address for remote access. + */ +const u32 HCCL_MAX_MEM_REGISTER_NUM = 32; enum GradSplitForceMode { FORCE_NONE, /**< no force */ diff --git a/third_party/fwkacllib/inc/mmpa/mmpa_api.h b/third_party/fwkacllib/inc/mmpa/mmpa_api.h index f5b80269..38a689ee 100644 --- a/third_party/fwkacllib/inc/mmpa/mmpa_api.h +++ b/third_party/fwkacllib/inc/mmpa/mmpa_api.h @@ -26,6 +26,12 @@ #define _GNU_SOURCE #endif +#ifdef FUNC_VISIBILITY +#define MMPA_FUNC_VISIBILITY __attribute__((visibility("default"))) +#else +#define MMPA_FUNC_VISIBILITY +#endif + #include #include #include @@ -86,6 +92,13 @@ #if(OS_TYPE == WIN) //lint !e553 + +#ifdef FUNC_VISIBILITY +#define MMPA_FUNC_VISIBILITY _declspec(dllexport) +#else +#define MMPA_FUNC_VISIBILITY +#endif + #include #include #include "Windows.h" diff --git a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h index aced4968..ea51f497 100644 --- a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h +++ b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h @@ -44,12 +44,16 @@ typedef VOID *mmExitCode; typedef key_t mmKey_t; typedef int mmMsgid; typedef struct dirent mmDirent; +typedef struct dirent mmDirent2; typedef struct shmid_ds mmshmId_ds; typedef int (*mmFilter)(const mmDirent *entry); +typedef int (*mmFilter2)(const mmDirent2 *entry); typedef int (*mmSort)(const mmDirent **a, const mmDirent **b); +typedef int (*mmSort2)(const mmDirent2 **a, const mmDirent2 **b); typedef size_t mmSize_t; typedef off_t mmOfft_t; typedef pid_t mmPid_t; +typedef long MM_LONG; typedef VOID *(*userProcFunc)(VOID *pulArg); @@ -113,6 +117,7 @@ typedef struct { } mmIoctlBuf; typedef int mmAtomicType; +typedef int mmAtomicType64; typedef enum { pollTypeRead = 1, // pipe read @@ -151,8 +156,8 @@ typedef struct { } mmTimeval; typedef struct { - LONG tv_sec; - LONG tv_nsec; + MM_LONG tv_sec; + MM_LONG tv_nsec; } mmTimespec; typedef struct { @@ -272,6 +277,9 @@ typedef struct { #define M_R_OK R_OK #define M_W_OK W_OK +#define MM_DT_DIR DT_DIR +#define MM_DT_REG DT_REG + #define MMPA_STDIN STDIN_FILENO #define MMPA_STDOUT STDOUT_FILENO #define MMPA_STDERR STDERR_FILENO @@ -283,182 +291,195 @@ typedef struct { #define MMPA_DL_EXT_NAME ".so" -extern INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *funcBlock); -extern INT32 mmJoinTask(mmThread *threadHandle); -extern INT32 mmMutexInit(mmMutex_t *mutex); -extern INT32 mmMutexLock(mmMutex_t *mutex); -extern INT32 mmMutexTryLock(mmMutex_t *mutex); -extern INT32 mmMutexUnLock(mmMutex_t *mutex); -extern INT32 mmMutexDestroy(mmMutex_t *mutex); -extern INT32 mmCondInit(mmCond *cond); -extern INT32 mmCondLockInit(mmMutexFC *mutex); -extern INT32 mmCondLock(mmMutexFC *mutex); -extern INT32 mmCondUnLock(mmMutexFC *mutex); -extern INT32 mmCondLockDestroy(mmMutexFC *mutex); -extern INT32 mmRWLockInit(mmRWLock_t *rwLock); -extern INT32 mmRWLockRDLock(mmRWLock_t *rwLock); -extern INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); -extern INT32 mmRWLockWRLock(mmRWLock_t *rwLock); -extern INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); -extern INT32 mmRDLockUnLock(mmRWLock_t *rwLock); -extern INT32 mmWRLockUnLock(mmRWLock_t *rwLock); -extern INT32 mmRWLockDestroy(mmRWLock_t *rwLock); -extern INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); -extern INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); -extern INT32 mmCondNotify(mmCond *cond); -extern INT32 mmCondNotifyAll(mmCond *cond); -extern INT32 mmCondDestroy(mmCond *cond); -extern INT32 mmGetPid(); -extern INT32 mmGetTid(); -extern INT32 mmGetPidHandle(mmProcess *processHandle); -extern INT32 mmGetLocalTime(mmSystemTime_t *sysTime); -extern INT32 mmGetSystemTime(mmSystemTime_t *sysTime); - -extern INT32 mmSemInit(mmSem_t *sem, UINT32 value); -extern INT32 mmSemWait(mmSem_t *sem); -extern INT32 mmSemPost(mmSem_t *sem); -extern INT32 mmSemDestroy(mmSem_t *sem); -extern INT32 mmOpen(const CHAR *pathName, INT32 flags); -extern INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); -extern FILE *mmPopen(CHAR *command, CHAR *type); -extern INT32 mmClose(INT32 fd); -extern INT32 mmPclose(FILE *stream); -extern mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); -extern mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); -extern mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); -extern INT32 mmBind(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); -extern INT32 mmListen(mmSockHandle sockFd, INT32 backLog); -extern mmSockHandle mmAccept(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t *addrLen); -extern INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); -extern INT32 mmCloseSocket(mmSockHandle sockFd); -extern mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); -extern mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); -extern INT32 mmSocketSendTo(mmSockHandle sockFd, +MMPA_FUNC_VISIBILITY INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *funcBlock); +MMPA_FUNC_VISIBILITY INT32 mmJoinTask(mmThread *threadHandle); +MMPA_FUNC_VISIBILITY INT32 mmMutexInit(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmMutexLock(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmMutexTryLock(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmMutexUnLock(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmMutexDestroy(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondInit(mmCond *cond); +MMPA_FUNC_VISIBILITY INT32 mmCondLockInit(mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondLock(mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondUnLock(mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondLockDestroy(mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmRWLockInit(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockRDLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockWRLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRDLockUnLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmWRLockUnLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockDestroy(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); +MMPA_FUNC_VISIBILITY INT32 mmCondNotify(mmCond *cond); +MMPA_FUNC_VISIBILITY INT32 mmCondNotifyAll(mmCond *cond); +MMPA_FUNC_VISIBILITY INT32 mmCondDestroy(mmCond *cond); +MMPA_FUNC_VISIBILITY INT32 mmGetPid(); +MMPA_FUNC_VISIBILITY INT32 mmGetTid(); +MMPA_FUNC_VISIBILITY INT32 mmGetPidHandle(mmProcess *processHandle); +MMPA_FUNC_VISIBILITY INT32 mmGetLocalTime(mmSystemTime_t *sysTime); +MMPA_FUNC_VISIBILITY INT32 mmGetSystemTime(mmSystemTime_t *sysTime); + +MMPA_FUNC_VISIBILITY INT32 mmSemInit(mmSem_t *sem, UINT32 value); +MMPA_FUNC_VISIBILITY INT32 mmSemWait(mmSem_t *sem); +MMPA_FUNC_VISIBILITY INT32 mmSemPost(mmSem_t *sem); +MMPA_FUNC_VISIBILITY INT32 mmSemDestroy(mmSem_t *sem); +MMPA_FUNC_VISIBILITY INT32 mmOpen(const CHAR *pathName, INT32 flags); +MMPA_FUNC_VISIBILITY INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); +MMPA_FUNC_VISIBILITY FILE *mmPopen(CHAR *command, CHAR *type); +MMPA_FUNC_VISIBILITY INT32 mmClose(INT32 fd); +MMPA_FUNC_VISIBILITY INT32 mmPclose(FILE *stream); +MMPA_FUNC_VISIBILITY mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); +MMPA_FUNC_VISIBILITY mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); +MMPA_FUNC_VISIBILITY mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); +MMPA_FUNC_VISIBILITY INT32 mmBind(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); +MMPA_FUNC_VISIBILITY INT32 mmListen(mmSockHandle sockFd, INT32 backLog); +MMPA_FUNC_VISIBILITY mmSockHandle mmAccept(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t *addrLen); +MMPA_FUNC_VISIBILITY INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); +MMPA_FUNC_VISIBILITY INT32 mmCloseSocket(mmSockHandle sockFd); +MMPA_FUNC_VISIBILITY mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); +MMPA_FUNC_VISIBILITY mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); +MMPA_FUNC_VISIBILITY INT32 mmSocketSendTo(mmSockHandle sockFd, VOID *sendMsg, INT32 sendLen, UINT32 sendFlag, const mmSockAddr* addr, INT32 tolen); -extern mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, +MMPA_FUNC_VISIBILITY mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, VOID *recvBuf, mmSize recvLen, UINT32 recvFlag, mmSockAddr* addr, mmSocklen_t *FromLen); -extern INT32 mmSAStartup(); -extern INT32 mmSACleanup(); -extern VOID *mmDlopen(const CHAR *fileName, INT32 mode); -extern INT32 mmDladdr(VOID *addr, mmDlInfo *info); -extern VOID *mmDlsym(VOID *handle, CHAR *funcName); -extern INT32 mmDlclose(VOID *handle); -extern CHAR *mmDlerror(); -extern INT32 mmCreateAndSetTimer(mmTimer *timerHandle, mmUserBlock_t *timerBlock, UINT milliSecond, UINT period); -extern INT32 mmDeleteTimer(mmTimer timerHandle); -extern INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); -extern INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); -extern INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); -extern INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); -extern INT32 mmSleep(UINT32 milliSecond); - -extern INT32 mmCreateTaskWithAttr(mmThread *threadHandle, mmUserBlock_t *funcBlock); -extern INT32 mmGetProcessPrio(mmProcess pid); -extern INT32 mmSetProcessPrio(mmProcess pid, INT32 processPrio); -extern INT32 mmGetThreadPrio(mmThread *threadHandle); -extern INT32 mmSetThreadPrio(mmThread *threadHandle, INT32 threadPrio); -extern INT32 mmAccess(const CHAR *pathName); -extern INT32 mmAccess2(const CHAR *pathName, INT32 mode); -extern INT32 mmRmdir(const CHAR *pathName); - -extern INT32 mmIoctl(mmProcess fd, INT32 ioctlCode, mmIoctlBuf *bufPtr); -extern INT32 mmSemTimedWait(mmSem_t *sem, INT32 timeout); -extern mmSsize_t mmWritev(mmProcess fd, mmIovSegment *iov, INT32 iovcnt); -extern VOID mmMb(); -extern INT32 mmInetAton(const CHAR *addrStr, mmInAddr *addr); - -extern mmProcess mmOpenFile(const CHAR *fileName, UINT32 access, mmCreateFlag fileFlag); -extern mmSsize_t mmReadFile(mmProcess fileId, VOID *buffer, INT32 len); -extern mmSsize_t mmWriteFile(mmProcess fileId, VOID *buffer, INT32 len); -extern INT32 mmCloseFile(mmProcess fileId); - -extern mmAtomicType mmSetData(mmAtomicType *ptr, mmAtomicType value); -extern mmAtomicType mmValueInc(mmAtomicType *ptr, mmAtomicType value); -extern mmAtomicType mmValueSub(mmAtomicType *ptr, mmAtomicType value); -extern INT32 mmCreateTaskWithDetach(mmThread *threadHandle, mmUserBlock_t *funcBlock); +MMPA_FUNC_VISIBILITY INT32 mmSAStartup(); +MMPA_FUNC_VISIBILITY INT32 mmSACleanup(); +MMPA_FUNC_VISIBILITY VOID *mmDlopen(const CHAR *fileName, INT32 mode); +MMPA_FUNC_VISIBILITY INT32 mmDladdr(VOID *addr, mmDlInfo *info); +MMPA_FUNC_VISIBILITY VOID *mmDlsym(VOID *handle, const CHAR *funcName); +MMPA_FUNC_VISIBILITY INT32 mmDlclose(VOID *handle); +MMPA_FUNC_VISIBILITY CHAR *mmDlerror(); +MMPA_FUNC_VISIBILITY INT32 mmCreateAndSetTimer(mmTimer *timerHandle, mmUserBlock_t *timerBlock, UINT milliSecond, UINT period); +MMPA_FUNC_VISIBILITY INT32 mmDeleteTimer(mmTimer timerHandle); +MMPA_FUNC_VISIBILITY INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); +MMPA_FUNC_VISIBILITY INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); +MMPA_FUNC_VISIBILITY INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); +MMPA_FUNC_VISIBILITY INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); +MMPA_FUNC_VISIBILITY INT32 mmSleep(UINT32 milliSecond); + +MMPA_FUNC_VISIBILITY INT32 mmCreateTaskWithAttr(mmThread *threadHandle, mmUserBlock_t *funcBlock); +MMPA_FUNC_VISIBILITY INT32 mmGetProcessPrio(mmProcess pid); +MMPA_FUNC_VISIBILITY INT32 mmSetProcessPrio(mmProcess pid, INT32 processPrio); +MMPA_FUNC_VISIBILITY INT32 mmGetThreadPrio(mmThread *threadHandle); +MMPA_FUNC_VISIBILITY INT32 mmSetThreadPrio(mmThread *threadHandle, INT32 threadPrio); +MMPA_FUNC_VISIBILITY INT32 mmAccess(const CHAR *pathName); +MMPA_FUNC_VISIBILITY INT32 mmAccess2(const CHAR *pathName, INT32 mode); +MMPA_FUNC_VISIBILITY INT32 mmRmdir(const CHAR *pathName); + +MMPA_FUNC_VISIBILITY INT32 mmIoctl(mmProcess fd, INT32 ioctlCode, mmIoctlBuf *bufPtr); +MMPA_FUNC_VISIBILITY INT32 mmSemTimedWait(mmSem_t *sem, INT32 timeout); +MMPA_FUNC_VISIBILITY mmSsize_t mmWritev(mmProcess fd, mmIovSegment *iov, INT32 iovcnt); +MMPA_FUNC_VISIBILITY VOID mmMb(); +MMPA_FUNC_VISIBILITY INT32 mmInetAton(const CHAR *addrStr, mmInAddr *addr); + +MMPA_FUNC_VISIBILITY mmProcess mmOpenFile(const CHAR *fileName, UINT32 access, mmCreateFlag fileFlag); +MMPA_FUNC_VISIBILITY mmSsize_t mmReadFile(mmProcess fileId, VOID *buffer, INT32 len); +MMPA_FUNC_VISIBILITY mmSsize_t mmWriteFile(mmProcess fileId, VOID *buffer, INT32 len); +MMPA_FUNC_VISIBILITY INT32 mmCloseFile(mmProcess fileId); + +MMPA_FUNC_VISIBILITY mmAtomicType mmSetData(mmAtomicType *ptr, mmAtomicType value); +MMPA_FUNC_VISIBILITY mmAtomicType mmValueInc(mmAtomicType *ptr, mmAtomicType value); +MMPA_FUNC_VISIBILITY mmAtomicType mmValueSub(mmAtomicType *ptr, mmAtomicType value); +MMPA_FUNC_VISIBILITY mmAtomicType64 mmSetData64(mmAtomicType64 *ptr, mmAtomicType64 value); +MMPA_FUNC_VISIBILITY mmAtomicType64 mmValueInc64(mmAtomicType64 *ptr, mmAtomicType64 value); +MMPA_FUNC_VISIBILITY mmAtomicType64 mmValueSub64(mmAtomicType64 *ptr, mmAtomicType64 value); +MMPA_FUNC_VISIBILITY INT32 mmCreateTaskWithDetach(mmThread *threadHandle, mmUserBlock_t *funcBlock); // The following 3 interfaces are to be deleted -extern INT32 mmCreateNamedPipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); -extern INT32 mmOpenNamePipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); -extern VOID mmCloseNamedPipe(mmPipeHandle namedPipe[]); +MMPA_FUNC_VISIBILITY INT32 mmCreateNamedPipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); +MMPA_FUNC_VISIBILITY INT32 mmOpenNamePipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); +MMPA_FUNC_VISIBILITY VOID mmCloseNamedPipe(mmPipeHandle namedPipe[]); -extern INT32 mmCreatePipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); -extern INT32 mmOpenPipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); -extern VOID mmClosePipe(mmPipeHandle pipe[], UINT32 pipeCount); +MMPA_FUNC_VISIBILITY INT32 mmCreatePipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); +MMPA_FUNC_VISIBILITY INT32 mmOpenPipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); +MMPA_FUNC_VISIBILITY VOID mmClosePipe(mmPipeHandle pipe[], UINT32 pipeCount); // Poll related interface -extern mmCompletionHandle mmCreateCompletionPort(); -extern VOID mmCloseCompletionPort(mmCompletionHandle handle); -extern INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, mmCompletionHandle handleIOCP, pmmPollData polledData, - mmPollBack pollBack); -extern INT32 mmGetErrorCode(); -extern CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); -extern INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); -extern mmTimespec mmGetTickCount(); -extern INT32 mmGetRealPath(CHAR *path, CHAR *realPath); -extern INT32 mmRealPath(const CHAR *path, CHAR *realPath, INT32 realPathLen); +MMPA_FUNC_VISIBILITY mmCompletionHandle mmCreateCompletionPort(); +MMPA_FUNC_VISIBILITY VOID mmCloseCompletionPort(mmCompletionHandle handle); +MMPA_FUNC_VISIBILITY INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, mmCompletionHandle handleIOCP, + pmmPollData polledData, mmPollBack pollBack); +MMPA_FUNC_VISIBILITY INT32 mmGetErrorCode(); +MMPA_FUNC_VISIBILITY CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); +MMPA_FUNC_VISIBILITY INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); +MMPA_FUNC_VISIBILITY mmTimespec mmGetTickCount(); +MMPA_FUNC_VISIBILITY INT32 mmGetRealPath(CHAR *path, CHAR *realPath); +MMPA_FUNC_VISIBILITY INT32 mmRealPath(const CHAR *path, CHAR *realPath, INT32 realPathLen); -extern INT32 mmDup2(INT32 oldFd, INT32 newFd); +MMPA_FUNC_VISIBILITY INT32 mmDup2(INT32 oldFd, INT32 newFd); -extern INT32 mmDup(INT32 fd); +MMPA_FUNC_VISIBILITY INT32 mmDup(INT32 fd); -extern INT32 mmUnlink(const CHAR *filename); +MMPA_FUNC_VISIBILITY INT32 mmUnlink(const CHAR *filename); -extern INT32 mmChmod(const CHAR *filename, INT32 mode); +MMPA_FUNC_VISIBILITY INT32 mmChmod(const CHAR *filename, INT32 mode); -extern INT32 mmFileno(FILE *stream); +MMPA_FUNC_VISIBILITY INT32 mmFileno(FILE *stream); -extern INT32 mmScandir(const CHAR *path, mmDirent ***entryList, mmFilter filterFunc, mmSort sort); +MMPA_FUNC_VISIBILITY INT32 mmScandir(const CHAR *path, mmDirent ***entryList, mmFilter filterFunc, mmSort sort); +MMPA_FUNC_VISIBILITY INT32 mmScandir2(const CHAR *path, mmDirent2 ***entryList, mmFilter2 filterFunc, mmSort2 sort); -extern VOID mmScandirFree(mmDirent **entryList, INT32 count); +MMPA_FUNC_VISIBILITY VOID mmScandirFree(mmDirent **entryList, INT32 count); +MMPA_FUNC_VISIBILITY VOID mmScandirFree2(mmDirent2 **entryList, INT32 count); -extern mmMsgid mmMsgCreate(mmKey_t key, INT32 msgFlag); +MMPA_FUNC_VISIBILITY mmMsgid mmMsgCreate(mmKey_t key, INT32 msgFlag); -extern mmMsgid mmMsgOpen(mmKey_t key, INT32 msgFlag); +MMPA_FUNC_VISIBILITY mmMsgid mmMsgOpen(mmKey_t key, INT32 msgFlag); -extern INT32 mmMsgSnd(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); +MMPA_FUNC_VISIBILITY INT32 mmMsgSnd(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); -extern INT32 mmMsgRcv(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); +MMPA_FUNC_VISIBILITY INT32 mmMsgRcv(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); -extern INT32 mmMsgClose(mmMsgid msqid); +MMPA_FUNC_VISIBILITY INT32 mmMsgClose(mmMsgid msqid); -extern INT32 mmLocalTimeR(const time_t *timep, struct tm *result); +MMPA_FUNC_VISIBILITY INT32 mmLocalTimeR(const time_t *timep, struct tm *result); -extern INT32 mmGetOpt(INT32 argc, char *const *argv, const char *opts); -extern INT32 mmGetOptLong(INT32 argc, char *const *argv, const char *opts, const mmStructOption *longOpts, - INT32 *longIndex); +MMPA_FUNC_VISIBILITY INT32 mmGetOptErr(); +MMPA_FUNC_VISIBILITY VOID mmSetOptErr(INT32 mmOptErr); +MMPA_FUNC_VISIBILITY INT32 mmGetOptInd(); +MMPA_FUNC_VISIBILITY VOID mmSetOptInd(INT32 mmOptInd); +MMPA_FUNC_VISIBILITY INT32 mmGetOptOpt(); +MMPA_FUNC_VISIBILITY VOID mmSetOpOpt(INT32 mmOptOpt); +MMPA_FUNC_VISIBILITY CHAR *mmGetOptArg(); +MMPA_FUNC_VISIBILITY VOID mmSetOptArg(CHAR *mmOptArg); +MMPA_FUNC_VISIBILITY INT32 mmGetOpt(INT32 argc, char *const *argv, const char *opts); +MMPA_FUNC_VISIBILITY INT32 mmGetOptLong(INT32 argc, char *const *argv, const char *opts, const mmStructOption *longOpts, + INT32 *longIndex); -extern LONG mmLseek(INT32 fd, INT64 offset, INT32 seekFlag); -extern INT32 mmFtruncate(mmProcess fd, UINT32 length); +MMPA_FUNC_VISIBILITY LONG mmLseek(INT32 fd, INT64 offset, INT32 seekFlag); +MMPA_FUNC_VISIBILITY INT32 mmFtruncate(mmProcess fd, UINT32 length); -extern INT32 mmTlsCreate(mmThreadKey *key, VOID (*destructor)(VOID *)); -extern INT32 mmTlsSet(mmThreadKey key, const VOID *value); -extern VOID *mmTlsGet(mmThreadKey key); -extern INT32 mmTlsDelete(mmThreadKey key); -extern INT32 mmGetOsType(); +MMPA_FUNC_VISIBILITY INT32 mmTlsCreate(mmThreadKey *key, VOID (*destructor)(VOID *)); +MMPA_FUNC_VISIBILITY INT32 mmTlsSet(mmThreadKey key, const VOID *value); +MMPA_FUNC_VISIBILITY VOID *mmTlsGet(mmThreadKey key); +MMPA_FUNC_VISIBILITY INT32 mmTlsDelete(mmThreadKey key); +MMPA_FUNC_VISIBILITY INT32 mmGetOsType(); -extern INT32 mmFsync(mmProcess fd); -extern INT32 mmFsync2(INT32 fd); -extern INT32 mmChdir(const CHAR *path); -extern INT32 mmUmask(INT32 pmode); -extern INT32 mmThreadKill(mmThread id); -extern INT32 mmWaitPid(mmProcess pid, INT32 *status, INT32 options); +MMPA_FUNC_VISIBILITY INT32 mmFsync(mmProcess fd); +MMPA_FUNC_VISIBILITY INT32 mmFsync2(INT32 fd); +MMPA_FUNC_VISIBILITY INT32 mmChdir(const CHAR *path); +MMPA_FUNC_VISIBILITY INT32 mmUmask(INT32 pmode); +MMPA_FUNC_VISIBILITY INT32 mmThreadKill(mmThread id); +MMPA_FUNC_VISIBILITY INT32 mmWaitPid(mmProcess pid, INT32 *status, INT32 options); -extern INT32 mmGetCwd(CHAR *buffer, INT32 maxLen); -extern INT32 mmGetEnv(const CHAR *name, CHAR *value, UINT32 len); -extern INT32 mmSetEnv(const CHAR *name, const CHAR *value, INT32 overwrite); -extern CHAR *mmStrTokR(CHAR *str, const CHAR *delim, CHAR **saveptr); -extern CHAR *mmDirName(CHAR *path); -extern CHAR *mmBaseName(CHAR *path); -extern INT32 mmGetDiskFreeSpace(const char *path, mmDiskSize *diskSize); +MMPA_FUNC_VISIBILITY INT32 mmGetCwd(CHAR *buffer, INT32 maxLen); +MMPA_FUNC_VISIBILITY INT32 mmGetEnv(const CHAR *name, CHAR *value, UINT32 len); +MMPA_FUNC_VISIBILITY INT32 mmSetEnv(const CHAR *name, const CHAR *value, INT32 overwrite); +MMPA_FUNC_VISIBILITY CHAR *mmStrTokR(CHAR *str, const CHAR *delim, CHAR **saveptr); +MMPA_FUNC_VISIBILITY CHAR *mmDirName(CHAR *path); +MMPA_FUNC_VISIBILITY CHAR *mmBaseName(CHAR *path); +MMPA_FUNC_VISIBILITY INT32 mmGetDiskFreeSpace(const char *path, mmDiskSize *diskSize); /* * Function: set the thread name created by mmcreatetask @@ -467,7 +488,7 @@ extern INT32 mmGetDiskFreeSpace(const char *path, mmDiskSize *diskSize); * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the * execution failure returns EN_ERROR */ -extern INT32 mmSetThreadName(mmThread *threadHandle, const CHAR *name); +MMPA_FUNC_VISIBILITY INT32 mmSetThreadName(mmThread *threadHandle, const CHAR *name); /* * Function: get thread name @@ -477,37 +498,38 @@ extern INT32 mmSetThreadName(mmThread *threadHandle, const CHAR *name); * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the * execution failure returns EN_ERROR */ -extern INT32 mmGetThreadName(mmThread *threadHandle, CHAR *name, INT32 size); +MMPA_FUNC_VISIBILITY INT32 mmGetThreadName(mmThread *threadHandle, CHAR *name, INT32 size); /* * Function:Set the thread name of the currently executing thread - call inside the thread body * Input:name:Thread name to be set * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the * execution failure returns EN_ERROR */ -extern INT32 mmSetCurrentThreadName(const CHAR *name); +MMPA_FUNC_VISIBILITY INT32 mmSetCurrentThreadName(const CHAR *name); /* * Function:Get the thread name of the currently executing thread - in body call * Input:name:The name of the thread to get, and the cache is allocated by the user,size>=MMPA_THREADNAME_SIZE * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the * execution failure returns EN_ERROR */ -extern INT32 mmGetCurrentThreadName(CHAR *name, INT32 size); -extern INT32 mmGetFileSize(const CHAR *fileName, ULONGLONG *length); -extern INT32 mmIsDir(const CHAR *fileName); -extern INT32 mmGetOsName(CHAR *name, INT32 nameSize); -extern INT32 mmGetOsVersion(CHAR *versionInfo, INT32 versionLength); -extern INT32 mmGetMac(mmMacInfo **list, INT32 *count); -extern INT32 mmGetMacFree(mmMacInfo *list, INT32 count); -extern INT32 mmGetCpuInfo(mmCpuDesc **cpuInfo, INT32 *count); -extern INT32 mmCpuInfoFree(mmCpuDesc *cpuInfo, INT32 count); -extern INT32 mmCreateProcess(const CHAR *fileName, const mmArgvEnv *env, const char *stdoutRedirectFile, mmProcess *id); - -extern INT32 mmCreateTaskWithThreadAttr(mmThread *threadHandle, const mmUserBlock_t *funcBlock, - const mmThreadAttr *threadAttr); -extern mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); -extern INT32 mmShmUnlink(const CHAR *name); -extern VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); -extern INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); +MMPA_FUNC_VISIBILITY INT32 mmGetCurrentThreadName(CHAR *name, INT32 size); +MMPA_FUNC_VISIBILITY INT32 mmGetFileSize(const CHAR *fileName, ULONGLONG *length); +MMPA_FUNC_VISIBILITY INT32 mmIsDir(const CHAR *fileName); +MMPA_FUNC_VISIBILITY INT32 mmGetOsName(CHAR *name, INT32 nameSize); +MMPA_FUNC_VISIBILITY INT32 mmGetOsVersion(CHAR *versionInfo, INT32 versionLength); +MMPA_FUNC_VISIBILITY INT32 mmGetMac(mmMacInfo **list, INT32 *count); +MMPA_FUNC_VISIBILITY INT32 mmGetMacFree(mmMacInfo *list, INT32 count); +MMPA_FUNC_VISIBILITY INT32 mmGetCpuInfo(mmCpuDesc **cpuInfo, INT32 *count); +MMPA_FUNC_VISIBILITY INT32 mmCpuInfoFree(mmCpuDesc *cpuInfo, INT32 count); +MMPA_FUNC_VISIBILITY INT32 mmCreateProcess(const CHAR *fileName, const mmArgvEnv *env, const char *stdoutRedirectFile, + mmProcess *id); + +MMPA_FUNC_VISIBILITY INT32 mmCreateTaskWithThreadAttr(mmThread *threadHandle, const mmUserBlock_t *funcBlock, + const mmThreadAttr *threadAttr); +MMPA_FUNC_VISIBILITY mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); +MMPA_FUNC_VISIBILITY INT32 mmShmUnlink(const CHAR *name); +MMPA_FUNC_VISIBILITY VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); +MMPA_FUNC_VISIBILITY INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); #define MMPA_DLL_API #ifdef __cplusplus diff --git a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h index 6adc1426..5db6bbf8 100644 --- a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h +++ b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h @@ -30,11 +30,6 @@ extern "C" { #define MMPA_MACINFO_DEFAULT_SIZE 18 #define MMPA_CPUDESC_DEFAULT_SIZE 64 -MMPA_DLL_API extern char *optarg; -MMPA_DLL_API extern int opterr; -MMPA_DLL_API extern int optind; -MMPA_DLL_API extern int optopt; - #pragma section(".CRT$XCU", long, read) #pragma section(".CRT$XPU", long, read) @@ -65,6 +60,7 @@ typedef struct sockaddr mmSockAddr; typedef int mmSocklen_t; typedef int mmSemTimeout_t; typedef long mmAtomicType; +typedef long long mmAtomicType64; typedef DWORD mmExitCode; typedef DWORD mmErrorMsg; typedef int mmKey_t; @@ -76,6 +72,7 @@ typedef INT32 mmSsize_t; typedef int mmSize; // size typedef size_t mmSize_t; typedef VOID mmshmId_ds; +typedef long long MM_LONG; typedef enum { DT_DIR = FILE_ATTRIBUTE_DIRECTORY, @@ -86,8 +83,15 @@ typedef struct { char d_name[MAX_PATH]; // file name } mmDirent; +typedef struct { + unsigned long d_type; + char d_name[MAX_PATH]; // file name +} mmDirent2; + typedef int (*mmFilter)(const mmDirent *entry); +typedef int (*mmFilter2)(const mmDirent2 *entry); typedef int (*mmSort)(const mmDirent **a, const mmDirent **b); +typedef int (*mmSort2)(const mmDirent2 **a, const mmDirent2 **b); typedef struct { VOID *sendBuf; @@ -162,8 +166,8 @@ typedef struct { } mmTimezone; typedef struct { - LONG tv_sec; - LONG tv_nsec; + MM_LONG tv_sec; + MM_LONG tv_nsec; } mmTimespec; typedef mmTimerHandle mmTimer; @@ -283,12 +287,13 @@ typedef VOID (*mmPf)(VOID); #define DT_UNKNOWN 0 #define DT_FIFO 1 #define DT_CHR 2 -#define DT_DIR 4 #define DT_BLK 6 #define DT_REG 8 #define DT_LNK 10 #define DT_SOCK 12 #define DT_WHT 14 +#define MM_DT_DIR 16 +#define MM_DT_REG 32 #define mmConstructor(x) __declspec(allocate(".CRT$XCU")) mmPf con = x #define mmDestructor(x) __declspec(allocate(".CRT$XPU")) mmPf de = x @@ -327,175 +332,188 @@ typedef VOID (*mmPf)(VOID); #define __attribute__(v) -_declspec(dllexport) INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *funcBlock); -_declspec(dllexport) INT32 mmJoinTask(mmThread *threadHandle); -_declspec(dllexport) INT32 mmMutexInit(mmMutex_t *mutex); -_declspec(dllexport) INT32 mmMutexLock(mmMutex_t *mutex); -_declspec(dllexport) INT32 mmMutexTryLock(mmMutex_t *mutex); -_declspec(dllexport) INT32 mmMutexUnLock(mmMutex_t *mutex); -_declspec(dllexport) INT32 mmMutexDestroy(mmMutex_t *mutex); -_declspec(dllexport) INT32 mmCondInit(mmCond *cond); -_declspec(dllexport) INT32 mmCondLockInit(mmMutexFC *mutex); -_declspec(dllexport) INT32 mmCondLock(mmMutexFC *mutex); -_declspec(dllexport) INT32 mmCondUnLock(mmMutexFC *mutex); -_declspec(dllexport) INT32 mmCondLockDestroy(mmMutexFC *mutex); -_declspec(dllexport) INT32 mmRWLockInit(mmRWLock_t *rwLock); -_declspec(dllexport) INT32 mmRWLockRDLock(mmRWLock_t *rwLock); -_declspec(dllexport) INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); -_declspec(dllexport) INT32 mmRWLockWRLock(mmRWLock_t *rwLock); -_declspec(dllexport) INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); -_declspec(dllexport) INT32 mmRDLockUnLock(mmRWLock_t *rwLock); -_declspec(dllexport) INT32 mmWRLockUnLock(mmRWLock_t *rwLock); -_declspec(dllexport) INT32 mmRWLockDestroy(mmRWLock_t *rwLock); -_declspec(dllexport) INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); -_declspec(dllexport) INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); - -_declspec(dllexport) INT32 mmCondNotify(mmCond *cond); -_declspec(dllexport) INT32 mmCondNotifyAll(mmCond *cond); -_declspec(dllexport) INT32 mmCondDestroy(mmCond *cond); -_declspec(dllexport) INT32 mmGetPid(VOID); -_declspec(dllexport) INT32 mmGetTid(VOID); -_declspec(dllexport) INT32 mmGetPidHandle(mmProcess *processHandle); -_declspec(dllexport) INT32 mmGetLocalTime(mmSystemTime_t *sysTime); -_declspec(dllexport) INT32 mmGetSystemTime(mmSystemTime_t *sysTime); -_declspec(dllexport) INT32 mmSemInit(mmSem_t *sem, UINT32 value); -_declspec(dllexport) INT32 mmSemWait(mmSem_t *sem); -_declspec(dllexport) INT32 mmSemPost(mmSem_t *sem); -_declspec(dllexport) INT32 mmSemDestroy(mmSem_t *sem); -_declspec(dllexport) INT32 mmOpen(const CHAR *pathName, INT32 flags); -_declspec(dllexport) INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); -_declspec(dllexport) FILE *mmPopen(CHAR *command, CHAR *type); -_declspec(dllexport) INT32 mmClose(INT32 fd); -_declspec(dllexport) INT32 mmPclose(FILE *stream); -_declspec(dllexport) mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); -_declspec(dllexport) mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); -_declspec(dllexport) mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); -_declspec(dllexport) INT32 mmBind(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); -_declspec(dllexport) INT32 mmListen(mmSockHandle sockFd, INT32 backLog); -_declspec(dllexport) mmSockHandle mmAccept(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t *addrLen); -_declspec(dllexport) INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); -_declspec(dllexport) INT32 mmCloseSocket(mmSockHandle sockFd); -_declspec(dllexport) mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); -_declspec(dllexport) mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); -_declspec(dllexport) INT32 mmSocketSendTo(mmSockHandle sockFd, +MMPA_FUNC_VISIBILITY INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *funcBlock); +MMPA_FUNC_VISIBILITY INT32 mmJoinTask(mmThread *threadHandle); +MMPA_FUNC_VISIBILITY INT32 mmMutexInit(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmMutexLock(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmMutexTryLock(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmMutexUnLock(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmMutexDestroy(mmMutex_t *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondInit(mmCond *cond); +MMPA_FUNC_VISIBILITY INT32 mmCondLockInit(mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondLock(mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondUnLock(mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondLockDestroy(mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmRWLockInit(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockRDLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockWRLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRDLockUnLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmWRLockUnLock(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmRWLockDestroy(mmRWLock_t *rwLock); +MMPA_FUNC_VISIBILITY INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); +MMPA_FUNC_VISIBILITY INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); + +MMPA_FUNC_VISIBILITY INT32 mmCondNotify(mmCond *cond); +MMPA_FUNC_VISIBILITY INT32 mmCondNotifyAll(mmCond *cond); +MMPA_FUNC_VISIBILITY INT32 mmCondDestroy(mmCond *cond); +MMPA_FUNC_VISIBILITY INT32 mmGetPid(VOID); +MMPA_FUNC_VISIBILITY INT32 mmGetTid(VOID); +MMPA_FUNC_VISIBILITY INT32 mmGetPidHandle(mmProcess *processHandle); +MMPA_FUNC_VISIBILITY INT32 mmGetLocalTime(mmSystemTime_t *sysTime); +MMPA_FUNC_VISIBILITY INT32 mmGetSystemTime(mmSystemTime_t *sysTime); +MMPA_FUNC_VISIBILITY INT32 mmSemInit(mmSem_t *sem, UINT32 value); +MMPA_FUNC_VISIBILITY INT32 mmSemWait(mmSem_t *sem); +MMPA_FUNC_VISIBILITY INT32 mmSemPost(mmSem_t *sem); +MMPA_FUNC_VISIBILITY INT32 mmSemDestroy(mmSem_t *sem); +MMPA_FUNC_VISIBILITY INT32 mmOpen(const CHAR *pathName, INT32 flags); +MMPA_FUNC_VISIBILITY INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); +MMPA_FUNC_VISIBILITY FILE *mmPopen(CHAR *command, CHAR *type); +MMPA_FUNC_VISIBILITY INT32 mmClose(INT32 fd); +MMPA_FUNC_VISIBILITY INT32 mmPclose(FILE *stream); +MMPA_FUNC_VISIBILITY mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); +MMPA_FUNC_VISIBILITY mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); +MMPA_FUNC_VISIBILITY mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); +MMPA_FUNC_VISIBILITY INT32 mmBind(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); +MMPA_FUNC_VISIBILITY INT32 mmListen(mmSockHandle sockFd, INT32 backLog); +MMPA_FUNC_VISIBILITY mmSockHandle mmAccept(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t *addrLen); +MMPA_FUNC_VISIBILITY INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); +MMPA_FUNC_VISIBILITY INT32 mmCloseSocket(mmSockHandle sockFd); +MMPA_FUNC_VISIBILITY mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); +MMPA_FUNC_VISIBILITY mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); +MMPA_FUNC_VISIBILITY INT32 mmSocketSendTo(mmSockHandle sockFd, VOID *sendMsg, INT32 sendLen, UINT32 sendFlag, const mmSockAddr* addr, INT32 tolen); -_declspec(dllexport) mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, +MMPA_FUNC_VISIBILITY mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, VOID *recvBuf, mmSize recvLen, UINT32 recvFlag, mmSockAddr* addr, mmSocklen_t *FromLen); -_declspec(dllexport) INT32 mmSAStartup(VOID); -_declspec(dllexport) INT32 mmSACleanup(VOID); -_declspec(dllexport) VOID *mmDlopen(const CHAR *fileName, INT mode); -_declspec(dllexport) INT32 mmDladdr(VOID *addr, mmDlInfo *info); -_declspec(dllexport) VOID *mmDlsym(VOID *handle, CHAR *fileName); -_declspec(dllexport) INT32 mmDlclose(VOID *handle); -_declspec(dllexport) CHAR *mmDlerror(VOID); -_declspec(dllexport) INT32 +MMPA_FUNC_VISIBILITY INT32 mmSAStartup(VOID); +MMPA_FUNC_VISIBILITY INT32 mmSACleanup(VOID); +MMPA_FUNC_VISIBILITY VOID *mmDlopen(const CHAR *fileName, INT mode); +MMPA_FUNC_VISIBILITY INT32 mmDladdr(VOID *addr, mmDlInfo *info); +MMPA_FUNC_VISIBILITY VOID *mmDlsym(VOID *handle, const CHAR *fileName); +MMPA_FUNC_VISIBILITY INT32 mmDlclose(VOID *handle); +MMPA_FUNC_VISIBILITY CHAR *mmDlerror(VOID); +MMPA_FUNC_VISIBILITY INT32 mmCreateAndSetTimer(mmTimer *timerHandle, mmUserBlock_t *timerBlock, UINT milliSecond, UINT period); -_declspec(dllexport) INT32 mmDeleteTimer(mmTimer timerHandle); -_declspec(dllexport) INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); -_declspec(dllexport) INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); -_declspec(dllexport) INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); -_declspec(dllexport) INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); -_declspec(dllexport) INT32 mmSleep(UINT32 milliSecond); -_declspec(dllexport) INT32 mmCreateTaskWithAttr(mmThread *threadHandle, mmUserBlock_t *funcBlock); -_declspec(dllexport) INT32 mmGetProcessPrio(mmProcess pid); -_declspec(dllexport) INT32 mmSetProcessPrio(mmProcess pid, INT32 processPrio); -_declspec(dllexport) INT32 mmGetThreadPrio(mmThread *threadHandle); -_declspec(dllexport) INT32 mmSetThreadPrio(mmThread *threadHandle, INT32 threadPrio); -_declspec(dllexport) INT32 mmAccess(const CHAR *pathName); -_declspec(dllexport) INT32 mmAccess2(const CHAR *pathName, INT32 mode); -_declspec(dllexport) INT32 mmRmdir(const CHAR *pathName); - -_declspec(dllexport) INT32 mmIoctl(mmProcess fd, INT32 ioctlCode, mmIoctlBuf *bufPtr); -_declspec(dllexport) INT32 mmSemTimedWait(mmSem_t *sem, INT32 timeout); -_declspec(dllexport) mmSsize_t mmWritev(mmSockHandle fd, mmIovSegment *iov, INT32 iovcnt); -_declspec(dllexport) VOID mmMb(); -_declspec(dllexport) INT32 mmInetAton(const CHAR *addrStr, mmInAddr *addr); - -_declspec(dllexport) mmProcess mmOpenFile(const CHAR *fileName, UINT32 access, mmCreateFlag fileFlag); -_declspec(dllexport) mmSsize_t mmReadFile(mmProcess fileId, VOID *buffer, INT32 len); -_declspec(dllexport) mmSsize_t mmWriteFile(mmProcess fileId, VOID *buffer, INT32 len); -_declspec(dllexport) INT32 mmCloseFile(mmProcess fileId); - -_declspec(dllexport) mmAtomicType mmSetData(mmAtomicType *ptr, mmAtomicType value); -_declspec(dllexport) mmAtomicType mmValueInc(mmAtomicType *ptr, mmAtomicType value); -_declspec(dllexport) mmAtomicType mmValueSub(mmAtomicType *ptr, mmAtomicType value); -_declspec(dllexport) INT32 mmCreateTaskWithDetach(mmThread *threadHandle, mmUserBlock_t *funcBlock); - -_declspec(dllexport) INT32 mmCreateNamedPipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); -_declspec(dllexport) INT32 mmOpenNamePipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); -_declspec(dllexport) VOID mmCloseNamedPipe(mmPipeHandle namedPipe[]); - -_declspec(dllexport) INT32 mmCreatePipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); -_declspec(dllexport) INT32 mmOpenPipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); -_declspec(dllexport) VOID mmClosePipe(mmPipeHandle pipe[], UINT32 pipeCount); - -_declspec(dllexport) mmCompletionHandle mmCreateCompletionPort(); -_declspec(dllexport) VOID mmCloseCompletionPort(mmCompletionHandle handle); -_declspec(dllexport) INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, mmCompletionHandle handleIOCP, +MMPA_FUNC_VISIBILITY INT32 mmDeleteTimer(mmTimer timerHandle); +MMPA_FUNC_VISIBILITY INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); +MMPA_FUNC_VISIBILITY INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); +MMPA_FUNC_VISIBILITY INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); +MMPA_FUNC_VISIBILITY INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); +MMPA_FUNC_VISIBILITY INT32 mmSleep(UINT32 milliSecond); +MMPA_FUNC_VISIBILITY INT32 mmCreateTaskWithAttr(mmThread *threadHandle, mmUserBlock_t *funcBlock); +MMPA_FUNC_VISIBILITY INT32 mmGetProcessPrio(mmProcess pid); +MMPA_FUNC_VISIBILITY INT32 mmSetProcessPrio(mmProcess pid, INT32 processPrio); +MMPA_FUNC_VISIBILITY INT32 mmGetThreadPrio(mmThread *threadHandle); +MMPA_FUNC_VISIBILITY INT32 mmSetThreadPrio(mmThread *threadHandle, INT32 threadPrio); +MMPA_FUNC_VISIBILITY INT32 mmAccess(const CHAR *pathName); +MMPA_FUNC_VISIBILITY INT32 mmAccess2(const CHAR *pathName, INT32 mode); +MMPA_FUNC_VISIBILITY INT32 mmRmdir(const CHAR *pathName); + +MMPA_FUNC_VISIBILITY INT32 mmIoctl(mmProcess fd, INT32 ioctlCode, mmIoctlBuf *bufPtr); +MMPA_FUNC_VISIBILITY INT32 mmSemTimedWait(mmSem_t *sem, INT32 timeout); +MMPA_FUNC_VISIBILITY mmSsize_t mmWritev(mmSockHandle fd, mmIovSegment *iov, INT32 iovcnt); +MMPA_FUNC_VISIBILITY VOID mmMb(); +MMPA_FUNC_VISIBILITY INT32 mmInetAton(const CHAR *addrStr, mmInAddr *addr); + +MMPA_FUNC_VISIBILITY mmProcess mmOpenFile(const CHAR *fileName, UINT32 access, mmCreateFlag fileFlag); +MMPA_FUNC_VISIBILITY mmSsize_t mmReadFile(mmProcess fileId, VOID *buffer, INT32 len); +MMPA_FUNC_VISIBILITY mmSsize_t mmWriteFile(mmProcess fileId, VOID *buffer, INT32 len); +MMPA_FUNC_VISIBILITY INT32 mmCloseFile(mmProcess fileId); + +MMPA_FUNC_VISIBILITY mmAtomicType mmSetData(mmAtomicType *ptr, mmAtomicType value); +MMPA_FUNC_VISIBILITY mmAtomicType mmValueInc(mmAtomicType *ptr, mmAtomicType value); +MMPA_FUNC_VISIBILITY mmAtomicType mmValueSub(mmAtomicType *ptr, mmAtomicType value); +MMPA_FUNC_VISIBILITY mmAtomicType64 mmSetData64(mmAtomicType64 *ptr, mmAtomicType64 value); +MMPA_FUNC_VISIBILITY mmAtomicType64 mmValueInc64(mmAtomicType64 *ptr, mmAtomicType64 value); +MMPA_FUNC_VISIBILITY mmAtomicType64 mmValueSub64(mmAtomicType64 *ptr, mmAtomicType64 value); +MMPA_FUNC_VISIBILITY INT32 mmCreateTaskWithDetach(mmThread *threadHandle, mmUserBlock_t *funcBlock); + +MMPA_FUNC_VISIBILITY INT32 mmCreateNamedPipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); +MMPA_FUNC_VISIBILITY INT32 mmOpenNamePipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); +MMPA_FUNC_VISIBILITY VOID mmCloseNamedPipe(mmPipeHandle namedPipe[]); + +MMPA_FUNC_VISIBILITY INT32 mmCreatePipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); +MMPA_FUNC_VISIBILITY INT32 mmOpenPipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); +MMPA_FUNC_VISIBILITY VOID mmClosePipe(mmPipeHandle pipe[], UINT32 pipeCount); + +MMPA_FUNC_VISIBILITY mmCompletionHandle mmCreateCompletionPort(); +MMPA_FUNC_VISIBILITY VOID mmCloseCompletionPort(mmCompletionHandle handle); +MMPA_FUNC_VISIBILITY INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, mmCompletionHandle handleIOCP, pmmPollData polledData, mmPollBack pollBack); -_declspec(dllexport) INT32 mmGetErrorCode(); -_declspec(dllexport) CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); -_declspec(dllexport) INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); -_declspec(dllexport) mmTimespec mmGetTickCount(); -_declspec(dllexport) INT32 mmGetRealPath(CHAR *path, CHAR *realPath); - -_declspec(dllexport) INT32 mmRealPath(const CHAR *path, CHAR *realPath, INT32 realPathLen); - -_declspec(dllexport) INT32 mmDup2(INT32 oldFd, INT32 newFd); -_declspec(dllexport) INT32 mmDup(INT32 fd); -_declspec(dllexport) INT32 mmUnlink(const CHAR *filename); -_declspec(dllexport) INT32 mmChmod(const CHAR *filename, INT32 mode); -_declspec(dllexport) INT32 mmFileno(FILE *stream); -_declspec(dllexport) INT32 mmScandir(const CHAR *path, mmDirent ***entryList, mmFilter filterFunc, mmSort sort); -_declspec(dllexport) VOID mmScandirFree(mmDirent **entryList, INT32 count); - -_declspec(dllexport) mmMsgid mmMsgCreate(mmKey_t key, INT32 msgFlag); -_declspec(dllexport) mmMsgid mmMsgOpen(mmKey_t key, INT32 msgFlag); -_declspec(dllexport) INT32 mmMsgRcv(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); -_declspec(dllexport) INT32 mmMsgSnd(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); - -_declspec(dllexport) INT32 mmMsgClose(mmMsgid msqid); - -_declspec(dllexport) INT32 mmLocalTimeR(const time_t *timep, struct tm *result); -_declspec(dllexport) INT32 mmGetOpt(INT32 argc, char *const *argv, const char *opts); -_declspec(dllexport) INT32 +MMPA_FUNC_VISIBILITY INT32 mmGetErrorCode(); +MMPA_FUNC_VISIBILITY CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); +MMPA_FUNC_VISIBILITY INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); +MMPA_FUNC_VISIBILITY mmTimespec mmGetTickCount(); +MMPA_FUNC_VISIBILITY INT32 mmGetRealPath(CHAR *path, CHAR *realPath); + +MMPA_FUNC_VISIBILITY INT32 mmRealPath(const CHAR *path, CHAR *realPath, INT32 realPathLen); + +MMPA_FUNC_VISIBILITY INT32 mmDup2(INT32 oldFd, INT32 newFd); +MMPA_FUNC_VISIBILITY INT32 mmDup(INT32 fd); +MMPA_FUNC_VISIBILITY INT32 mmUnlink(const CHAR *filename); +MMPA_FUNC_VISIBILITY INT32 mmChmod(const CHAR *filename, INT32 mode); +MMPA_FUNC_VISIBILITY INT32 mmFileno(FILE *stream); +MMPA_FUNC_VISIBILITY INT32 mmScandir(const CHAR *path, mmDirent ***entryList, mmFilter filterFunc, mmSort sort); +MMPA_FUNC_VISIBILITY INT32 mmScandir2(const CHAR *path, mmDirent2 ***entryList, mmFilter2 filterFunc, mmSort2 sort); +MMPA_FUNC_VISIBILITY VOID mmScandirFree(mmDirent **entryList, INT32 count); +MMPA_FUNC_VISIBILITY VOID mmScandirFree2(mmDirent2 **entryList, INT32 count); + +MMPA_FUNC_VISIBILITY mmMsgid mmMsgCreate(mmKey_t key, INT32 msgFlag); +MMPA_FUNC_VISIBILITY mmMsgid mmMsgOpen(mmKey_t key, INT32 msgFlag); +MMPA_FUNC_VISIBILITY INT32 mmMsgRcv(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); +MMPA_FUNC_VISIBILITY INT32 mmMsgSnd(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); + +MMPA_FUNC_VISIBILITY INT32 mmMsgClose(mmMsgid msqid); + +MMPA_FUNC_VISIBILITY INT32 mmLocalTimeR(const time_t *timep, struct tm *result); +MMPA_FUNC_VISIBILITY INT32 mmGetOptErr(); +MMPA_FUNC_VISIBILITY VOID mmSetOptErr(INT32 mmOptErr); +MMPA_FUNC_VISIBILITY INT32 mmGetOptInd(); +MMPA_FUNC_VISIBILITY VOID mmSetOptInd(INT32 mmOptInd); +MMPA_FUNC_VISIBILITY INT32 mmGetOptOpt(); +MMPA_FUNC_VISIBILITY VOID mmSetOpOpt(INT32 mmOptOpt); +MMPA_FUNC_VISIBILITY CHAR *mmGetOptArg(); +MMPA_FUNC_VISIBILITY VOID mmSetOptArg(CHAR *mmOptArg); +MMPA_FUNC_VISIBILITY INT32 mmGetOpt(INT32 argc, char *const *argv, const char *opts); +MMPA_FUNC_VISIBILITY INT32 mmGetOptLong(INT32 argc, CHAR *const *argv, const CHAR *opts, const mmStructOption *longopts, INT32 *longindex); -_declspec(dllexport) LONG mmLseek(INT32 fd, INT64 offset, INT32 seekFlag); -_declspec(dllexport) INT32 mmFtruncate(mmProcess fd, UINT32 length); +MMPA_FUNC_VISIBILITY LONG mmLseek(INT32 fd, INT64 offset, INT32 seekFlag); +MMPA_FUNC_VISIBILITY INT32 mmFtruncate(mmProcess fd, UINT32 length); -_declspec(dllexport) INT32 mmTlsCreate(mmThreadKey *key, VOID (*destructor)(VOID *)); -_declspec(dllexport) INT32 mmTlsSet(mmThreadKey key, const VOID *value); -_declspec(dllexport) VOID *mmTlsGet(mmThreadKey key); -_declspec(dllexport) INT32 mmTlsDelete(mmThreadKey key); -_declspec(dllexport) INT32 mmGetOsType(); +MMPA_FUNC_VISIBILITY INT32 mmTlsCreate(mmThreadKey *key, VOID (*destructor)(VOID *)); +MMPA_FUNC_VISIBILITY INT32 mmTlsSet(mmThreadKey key, const VOID *value); +MMPA_FUNC_VISIBILITY VOID *mmTlsGet(mmThreadKey key); +MMPA_FUNC_VISIBILITY INT32 mmTlsDelete(mmThreadKey key); +MMPA_FUNC_VISIBILITY INT32 mmGetOsType(); -_declspec(dllexport) INT32 mmFsync(mmProcess fd); -_declspec(dllexport) INT32 mmFsync2(INT32 fd); -_declspec(dllexport) INT32 mmChdir(const CHAR *path); -_declspec(dllexport) INT32 mmUmask(INT32 pmode); -_declspec(dllexport) INT32 mmWaitPid(mmProcess pid, INT32 *status, INT32 options); +MMPA_FUNC_VISIBILITY INT32 mmFsync(mmProcess fd); +MMPA_FUNC_VISIBILITY INT32 mmFsync2(INT32 fd); +MMPA_FUNC_VISIBILITY INT32 mmChdir(const CHAR *path); +MMPA_FUNC_VISIBILITY INT32 mmUmask(INT32 pmode); +MMPA_FUNC_VISIBILITY INT32 mmWaitPid(mmProcess pid, INT32 *status, INT32 options); -_declspec(dllexport) INT32 mmGetCwd(CHAR *buffer, INT32 maxLen); -_declspec(dllexport) CHAR *mmStrTokR(CHAR *str, const CHAR *delim, CHAR **saveptr); +MMPA_FUNC_VISIBILITY INT32 mmGetCwd(CHAR *buffer, INT32 maxLen); +MMPA_FUNC_VISIBILITY CHAR *mmStrTokR(CHAR *str, const CHAR *delim, CHAR **saveptr); -_declspec(dllexport) INT32 mmGetEnv(const CHAR *name, CHAR *value, UINT32 len); -_declspec(dllexport) INT32 mmSetEnv(const CHAR *name, const CHAR *value, INT32 overwrite); -_declspec(dllexport) CHAR *mmDirName(CHAR *path); -_declspec(dllexport) CHAR *mmBaseName(CHAR *path); -_declspec(dllexport) INT32 mmGetDiskFreeSpace(const char *path, mmDiskSize *diskSize); +MMPA_FUNC_VISIBILITY INT32 mmGetEnv(const CHAR *name, CHAR *value, UINT32 len); +MMPA_FUNC_VISIBILITY INT32 mmSetEnv(const CHAR *name, const CHAR *value, INT32 overwrite); +MMPA_FUNC_VISIBILITY CHAR *mmDirName(CHAR *path); +MMPA_FUNC_VISIBILITY CHAR *mmBaseName(CHAR *path); +MMPA_FUNC_VISIBILITY INT32 mmGetDiskFreeSpace(const char *path, mmDiskSize *diskSize); -_declspec(dllexport) INT32 mmSetThreadName(mmThread *threadHandle, const CHAR *name); -_declspec(dllexport) INT32 mmGetThreadName(mmThread *threadHandle, CHAR *name, INT32 size); +MMPA_FUNC_VISIBILITY INT32 mmSetThreadName(mmThread *threadHandle, const CHAR *name); +MMPA_FUNC_VISIBILITY INT32 mmGetThreadName(mmThread *threadHandle, CHAR *name, INT32 size); /* * Function: set the thread name of the currently executing thread - internal call of thread, which is not supported @@ -504,7 +522,7 @@ _declspec(dllexport) INT32 mmGetThreadName(mmThread *threadHandle, CHAR *name, I * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the * execution failure returns EN_ERROR */ -_declspec(dllexport) INT32 mmSetCurrentThreadName(const CHAR *name); +MMPA_FUNC_VISIBILITY INT32 mmSetCurrentThreadName(const CHAR *name); /* * Function: Get the thread name of the currently executing thread - thread body call, not supported under windows, null @@ -513,25 +531,25 @@ _declspec(dllexport) INT32 mmSetCurrentThreadName(const CHAR *name); * The input parameter error returns EN_INVALID_PARAM, the execution success returns * EN_OK, and the execution failure returns EN_ERROR */ -_declspec(dllexport) INT32 mmGetCurrentThreadName(CHAR *name, INT32 size); - -_declspec(dllexport) INT32 mmGetFileSize(const CHAR *fileName, ULONGLONG *length); -_declspec(dllexport) INT32 mmIsDir(const CHAR *fileName); -_declspec(dllexport) INT32 mmGetOsName(CHAR *name, INT32 nameSize); -_declspec(dllexport) INT32 mmGetOsVersion(CHAR *versionInfo, INT32 versionLength); -_declspec(dllexport) INT32 mmGetMac(mmMacInfo **list, INT32 *count); -_declspec(dllexport) INT32 mmGetMacFree(mmMacInfo *list, INT32 count); -_declspec(dllexport) INT32 mmGetCpuInfo(mmCpuDesc **cpuInfo, INT32 *count); -_declspec(dllexport) INT32 mmCpuInfoFree(mmCpuDesc *cpuInfo, INT32 count); -_declspec(dllexport) INT32 +MMPA_FUNC_VISIBILITY INT32 mmGetCurrentThreadName(CHAR *name, INT32 size); + +MMPA_FUNC_VISIBILITY INT32 mmGetFileSize(const CHAR *fileName, ULONGLONG *length); +MMPA_FUNC_VISIBILITY INT32 mmIsDir(const CHAR *fileName); +MMPA_FUNC_VISIBILITY INT32 mmGetOsName(CHAR *name, INT32 nameSize); +MMPA_FUNC_VISIBILITY INT32 mmGetOsVersion(CHAR *versionInfo, INT32 versionLength); +MMPA_FUNC_VISIBILITY INT32 mmGetMac(mmMacInfo **list, INT32 *count); +MMPA_FUNC_VISIBILITY INT32 mmGetMacFree(mmMacInfo *list, INT32 count); +MMPA_FUNC_VISIBILITY INT32 mmGetCpuInfo(mmCpuDesc **cpuInfo, INT32 *count); +MMPA_FUNC_VISIBILITY INT32 mmCpuInfoFree(mmCpuDesc *cpuInfo, INT32 count); +MMPA_FUNC_VISIBILITY INT32 mmCreateProcess(const CHAR *fileName, const mmArgvEnv *env, const char *stdoutRedirectFile, mmProcess *id); -_declspec(dllexport) INT32 +MMPA_FUNC_VISIBILITY INT32 mmCreateTaskWithThreadAttr(mmThread *threadHandle, const mmUserBlock_t *funcBlock, const mmThreadAttr *threadAttr); -_declspec(dllexport) mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); -_declspec(dllexport) INT32 mmShmUnlink(const CHAR *name); -_declspec(dllexport) VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); -_declspec(dllexport) INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); +MMPA_FUNC_VISIBILITY mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); +MMPA_FUNC_VISIBILITY INT32 mmShmUnlink(const CHAR *name); +MMPA_FUNC_VISIBILITY VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); +MMPA_FUNC_VISIBILITY INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); #ifdef __cplusplus #if __cplusplus } diff --git a/third_party/fwkacllib/inc/runtime/base.h b/third_party/fwkacllib/inc/runtime/base.h index fcb7a627..4e735438 100644 --- a/third_party/fwkacllib/inc/runtime/base.h +++ b/third_party/fwkacllib/inc/runtime/base.h @@ -391,6 +391,8 @@ typedef void (*rtErrorCallback)(rtExceptionType); typedef void (*rtTaskFailCallback)(rtExceptionInfo *exceptionInfo); +typedef void (*rtDeviceStateCallback)(uint32_t devId, bool isOpen); + /** * @ingroup dvrt_base * @brief stream handle. @@ -419,7 +421,7 @@ RTS_API rtError_t rtSetProfDirEx(const char *profDir, const char *address, const * @ingroup profiling_base * @brief init profiler object. */ -RTS_API rtError_t rtProfilerInit(const char *profdir, const char *address, const char *job_ctx); +RTS_API rtError_t rtProfilerInit(const char *profDir, const char *address, const char *jobCtx); /** * @ingroup profiling_base @@ -473,6 +475,16 @@ RTS_API rtError_t rtSetExceptCallback(rtErrorCallback callback); */ RTS_API rtError_t rtSetTaskFailCallback(rtTaskFailCallback callback); +/** + * @ingroup dvrt_base + * @brief register callback for deviceid + * @param [in] uniName unique register name, can't be null + * @param [in] callback Device state callback function + * @param [out] NA + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtRegDeviceStateCallback(const char *regName, rtDeviceStateCallback callback); + /** * @ingroup dvrt_base * @brief notify handle. @@ -593,7 +605,7 @@ RTS_API rtError_t rtLabelCreateEx(rtLabel_t *label, rtStream_t stream); * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for input null ptr */ -RTS_API rtError_t rtGetTaskIdAndStreamID(uint32_t *taskid, uint32_t *streamid); +RTS_API rtError_t rtGetTaskIdAndStreamID(uint32_t *taskId, uint32_t *streamId); #if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) } diff --git a/third_party/fwkacllib/inc/runtime/context.h b/third_party/fwkacllib/inc/runtime/context.h index ffcf7e4b..4be49a8c 100644 --- a/third_party/fwkacllib/inc/runtime/context.h +++ b/third_party/fwkacllib/inc/runtime/context.h @@ -139,7 +139,7 @@ RTS_API rtError_t rtSetGroup(int32_t groupId); * @param [in] groupid count * @return RT_ERROR_NONE for ok, errno for failed */ -RTS_API rtError_t rtGetGroupInfo(int32_t groupId, rtGroupInfo_t* groupInfo, uint32_t count); +RTS_API rtError_t rtGetGroupInfo(int32_t groupId, rtGroupInfo_t *groupInfo, uint32_t count); /** * @ingroup diff --git a/third_party/fwkacllib/inc/runtime/dev.h b/third_party/fwkacllib/inc/runtime/dev.h index f3f2937c..b378e3b0 100644 --- a/third_party/fwkacllib/inc/runtime/dev.h +++ b/third_party/fwkacllib/inc/runtime/dev.h @@ -295,7 +295,7 @@ RTS_API rtError_t rtGetRunMode(rtRunMode *mode); * @return RT_ERROR_NONE for ok * @return RT_ERROR_DRV_ERR for can not get aicpu deploy */ -RTS_API rtError_t rtGetAicpuDeploy(rtAicpuDeployType_t *deplyType); +RTS_API rtError_t rtGetAicpuDeploy(rtAicpuDeployType_t *deployType); /** * @ingroup dvrt_dev @@ -309,7 +309,7 @@ RTS_API rtError_t rtSetSocVersion(const char *version); * @brief get chipType * @return RT_ERROR_NONE for ok */ -rtError_t rtGetSocVersion(char *version, const uint32_t maxLen); +RTS_API rtError_t rtGetSocVersion(char *version, const uint32_t maxLen); /** * @ingroup dvrt_dev diff --git a/third_party/fwkacllib/inc/runtime/event.h b/third_party/fwkacllib/inc/runtime/event.h index c8a227e8..41e611ea 100644 --- a/third_party/fwkacllib/inc/runtime/event.h +++ b/third_party/fwkacllib/inc/runtime/event.h @@ -57,6 +57,16 @@ RTS_API rtError_t rtEventCreateWithFlag(rtEvent_t *event, uint32_t flag); */ RTS_API rtError_t rtEventDestroy(rtEvent_t event); +/** + * @ingroup dvrt_event + * @brief get event id + * @param [in] event_ event to be get + * @param [in|out] event_id event_id id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetEventID(rtEvent_t event, uint32_t *eventId); + /** * @ingroup dvrt_event * @brief event record @@ -116,13 +126,13 @@ RTS_API rtError_t rtEventGetTimeStamp(uint64_t *time, rtEvent_t event); /** * @ingroup dvrt_event * @brief name an event - * @param [in] event_ event to be named + * @param [in] event event to be named * @param [in] name identification name * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input of event, name * @return RT_ERROR_DRV_ERR for driver error */ -RTS_API rtError_t rtNameEvent(rtEvent_t event_, const char *name); +RTS_API rtError_t rtNameEvent(rtEvent_t event, const char *name); /** * @ingroup dvrt_event @@ -132,7 +142,7 @@ RTS_API rtError_t rtNameEvent(rtEvent_t event_, const char *name); * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ -RTS_API rtError_t rtNotifyCreate(int32_t device_id, rtNotify_t *notify_); +RTS_API rtError_t rtNotifyCreate(int32_t deviceId, rtNotify_t *notify); /** * @ingroup dvrt_event @@ -142,7 +152,7 @@ RTS_API rtError_t rtNotifyCreate(int32_t device_id, rtNotify_t *notify_); * @return RT_ERROR_INVALID_VALUE for error input * @return RT_ERROR_DRV_ERR for driver error */ -RTS_API rtError_t rtNotifyDestroy(rtNotify_t notify_); +RTS_API rtError_t rtNotifyDestroy(rtNotify_t notify); /** * @ingroup dvrt_event @@ -153,7 +163,7 @@ RTS_API rtError_t rtNotifyDestroy(rtNotify_t notify_); * @return RT_ERROR_INVALID_VALUE for error input * @return RT_ERROR_STREAM_CONTEXT for stream is not in current ctx */ -RTS_API rtError_t rtNotifyRecord(rtNotify_t notify_, rtStream_t stream_); +RTS_API rtError_t rtNotifyRecord(rtNotify_t notify, rtStream_t stream); /** * @ingroup dvrt_event @@ -164,7 +174,7 @@ RTS_API rtError_t rtNotifyRecord(rtNotify_t notify_, rtStream_t stream_); * @return RT_ERROR_INVALID_VALUE for error input * @return RT_ERROR_STREAM_CONTEXT for stream is not in current ctx */ -RTS_API rtError_t rtNotifyWait(rtNotify_t notify_, rtStream_t stream_); +RTS_API rtError_t rtNotifyWait(rtNotify_t notify, rtStream_t stream); /** * @ingroup dvrt_event @@ -174,7 +184,7 @@ RTS_API rtError_t rtNotifyWait(rtNotify_t notify_, rtStream_t stream_); * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ -RTS_API rtError_t rtNameNotify(rtNotify_t notify_, const char *name); +RTS_API rtError_t rtNameNotify(rtNotify_t notify, const char *name); /** * @ingroup dvrt_event @@ -184,7 +194,7 @@ RTS_API rtError_t rtNameNotify(rtNotify_t notify_, const char *name); * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ -RTS_API rtError_t rtGetNotifyID(rtNotify_t notify_, uint32_t *notify_id); +RTS_API rtError_t rtGetNotifyID(rtNotify_t notify, uint32_t *notifyId); /** * @ingroup dvrt_event @@ -199,7 +209,7 @@ RTS_API rtError_t rtIpcSetNotifyName(rtNotify_t notify, char *name, uint32_t len /** * @ingroup dvrt_event * @brief Open IPC notify - * @param [in] notify notify to be opened + * @param [out] notify the opened notify * @param [in] name identification name * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input diff --git a/third_party/fwkacllib/inc/runtime/kernel.h b/third_party/fwkacllib/inc/runtime/kernel.h index de806a9e..5f519442 100644 --- a/third_party/fwkacllib/inc/runtime/kernel.h +++ b/third_party/fwkacllib/inc/runtime/kernel.h @@ -169,6 +169,18 @@ typedef void (*rtCallback_t)(void *fnData); */ #define RT_DEV_BINARY_MAGIC_ELF_AIVEC 0x41415246 +/** + * @ingroup rt_kernel + * @brief magic number of elf binary for aicube + */ +#define RT_DEV_BINARY_MAGIC_ELF_AICUBE 0x41415247 + +/** + * @ingroup rt_kernel + * @brief magic number of elf binary for aivector + */ +#define RT_DEV_BINARY_MAGIC_ELF_AIVECTOR 0x41415248 + /** * @ingroup rt_kernel_flags * @brief kernel op bit flags @@ -285,7 +297,7 @@ RTS_API rtError_t rtQueryFunctionRegistered(const char *stubName); * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtKernelConfigDump(uint32_t kind, uint32_t dumpSizePerBlock, uint32_t blockDim, void **dumpBaseAddr, - rtStream_t stream_); + rtStream_t stream); /** * @ingroup rt_kernel @@ -297,7 +309,7 @@ RTS_API rtError_t rtKernelConfigDump(uint32_t kind, uint32_t dumpSizePerBlock, u * @param [in] smDesc shared memory description * @param [in] stream associated stream * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtKernelLaunch(const void *stubFunc, uint32_t blockDim, void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream); @@ -313,7 +325,7 @@ RTS_API rtError_t rtKernelLaunch(const void *stubFunc, uint32_t blockDim, void * * @param [in] stream associated stream * @param [in] flag dump flag * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtKernelLaunchWithFlag(const void *stubFunc, uint32_t blockDim, void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream, uint32_t flags); @@ -375,7 +387,7 @@ typedef void *rtModel_t; * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ - RTS_API rtError_t rtDumpAddrSet(rtModel_t model, void *addr , uint32_t dumpSize, uint32_t flag); + RTS_API rtError_t rtDumpAddrSet(rtModel_t model, void *addr, uint32_t dumpSize, uint32_t flag); /** * @ingroup rt_kernel @@ -444,7 +456,7 @@ RTS_API rtError_t rtKernelConfigTransArg(const void *ptr, uint64_t size, uint32_ * @brief start fusion kernels. * @param [in] stream stream for fusion kernels * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtKernelFusionStart(rtStream_t stream); @@ -453,7 +465,7 @@ RTS_API rtError_t rtKernelFusionStart(rtStream_t stream); * @brief end fusion kernels. * @param [in] stream stream for fusion kernels * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtKernelFusionEnd(rtStream_t stream); @@ -462,7 +474,7 @@ RTS_API rtError_t rtKernelFusionEnd(rtStream_t stream); * @brief set kernelinfo callback * @param [in] callback * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtSetKernelReportCallback(rtKernelReportCallback callBack); @@ -472,7 +484,7 @@ RTS_API rtError_t rtSetKernelReportCallback(rtKernelReportCallback callBack); * @param [in] threadId thread id for stream * @param [in] stream stream for subscribe * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtSubscribeReport(uint64_t threadId, rtStream_t stream); @@ -483,7 +495,7 @@ RTS_API rtError_t rtSubscribeReport(uint64_t threadId, rtStream_t stream); * @param [in] fnData user data * @param [in] stream subscribed stream * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtCallbackLaunch(rtCallback_t callBackFunc, void *fnData, rtStream_t stream, bool isBlock); @@ -492,7 +504,7 @@ RTS_API rtError_t rtCallbackLaunch(rtCallback_t callBackFunc, void *fnData, rtSt * @brief process callback report. * @param [in] timeout if timeout=-1, while(1); else timeout * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtProcessReport(int32_t timeout); @@ -502,7 +514,7 @@ RTS_API rtError_t rtProcessReport(int32_t timeout); * @param [in] threadId thread id for stream * @param [in] stream stream for subscribe * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtUnSubscribeReport(uint64_t threadId, rtStream_t stream); @@ -510,7 +522,7 @@ RTS_API rtError_t rtUnSubscribeReport(uint64_t threadId, rtStream_t stream); * @ingroup profiling_base * @brief start online prof. * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtStartOnlineProf(rtStream_t stream, uint32_t sampleNum); @@ -518,7 +530,7 @@ RTS_API rtError_t rtStartOnlineProf(rtStream_t stream, uint32_t sampleNum); * @ingroup profiling_base * @brief stop online prof. * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtStopOnlineProf(rtStream_t stream); @@ -526,9 +538,26 @@ RTS_API rtError_t rtStopOnlineProf(rtStream_t stream); * @ingroup profiling_base * @brief get online prof. * @return RT_ERROR_NONE for ok - * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_INVALID_VALUE for error input */ RTS_API rtError_t rtGetOnlineProfData(rtStream_t stream, rtProfDataInfo_t *pProfData, uint32_t profDataNum); + +/** + * @ingroup profiling_base + * @brief start mdc profiler. + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStartMDCProfiler(void **addr, uint32_t length); + +/** + * @ingroup profiling_base + * @brief stop mdc profiler. + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStopMDCProfiler(void *addr); + #if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) } #endif diff --git a/third_party/fwkacllib/inc/runtime/mem.h b/third_party/fwkacllib/inc/runtime/mem.h index 22a00ac6..e65d8604 100644 --- a/third_party/fwkacllib/inc/runtime/mem.h +++ b/third_party/fwkacllib/inc/runtime/mem.h @@ -475,7 +475,7 @@ RTS_API rtError_t rtIpcSetMemoryName(const void *ptr, uint64_t byteCount, char * * @return RT_ERROR_INVALID_VALUE for error input * @return RT_ERROR_DRV_ERR for driver error */ -rtError_t rtIpcDestroyMemoryName(const char *name); +RTS_API rtError_t rtIpcDestroyMemoryName(const char *name); /** * @ingroup dvrt_mem @@ -503,13 +503,13 @@ RTS_API rtError_t rtIpcCloseMemory(const void *ptr); * @ingroup dvrt_mem * @brief HCCL Async memory cpy * @param [in] index sq index - * @param [in] wqe_index moudle index + * @param [in] wqeIndex moudle index * @param [in] stream asynchronized task stream * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input * @return RT_ERROR_DRV_ERR for driver error */ -RTS_API rtError_t rtRDMASend(uint32_t index, uint32_t wqe_index, rtStream_t stream); +RTS_API rtError_t rtRDMASend(uint32_t index, uint32_t wqeIndex, rtStream_t stream); /** * @ingroup dvrt_mem diff --git a/third_party/fwkacllib/inc/runtime/rt_model.h b/third_party/fwkacllib/inc/runtime/rt_model.h index 78bb2321..b72b142d 100644 --- a/third_party/fwkacllib/inc/runtime/rt_model.h +++ b/third_party/fwkacllib/inc/runtime/rt_model.h @@ -438,7 +438,8 @@ RTS_API rtError_t rtModelGetId(rtModel_t model, uint32_t *modelId); * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ -rtError_t rtDebugRegister(rtModel_t model, uint32_t flag, const void *addr, uint32_t *streamId, uint32_t *taskId); +RTS_API rtError_t rtDebugRegister(rtModel_t model, uint32_t flag, const void *addr, + uint32_t *streamId, uint32_t *taskId); /* * @ingroup rt_model diff --git a/third_party/fwkacllib/inc/runtime/stream.h b/third_party/fwkacllib/inc/runtime/stream.h index 81810a21..388fd3c2 100644 --- a/third_party/fwkacllib/inc/runtime/stream.h +++ b/third_party/fwkacllib/inc/runtime/stream.h @@ -126,17 +126,17 @@ RTS_API rtError_t rtGetStreamId(rtStream_t stream, int32_t *streamId); * @return RT_ERROR_NONE for complete * @return RT_ERROR_INVALID_VALUE for error input */ -RTS_API rtError_t rtGetMaxStreamAndTask(uint32_t streamType, uint32_t *MaxStrCount, uint32_t *MaxTaskCount); +RTS_API rtError_t rtGetMaxStreamAndTask(uint32_t streamType, uint32_t *maxStrCount, uint32_t *maxTaskCount); /** * @ingroup dvrt_stream * @brief Name a stream - * @param [in] stream_ stream to be named + * @param [in] stream stream to be named * @param [in] name identification name * @return RT_ERROR_NONE for complete * @return RT_ERROR_INVALID_VALUE for error input */ -RTS_API rtError_t rtNameStream(rtStream_t stream_, const char *name); +RTS_API rtError_t rtNameStream(rtStream_t stream, const char *name); /** * @ingroup dvrt_stream @@ -144,12 +144,12 @@ RTS_API rtError_t rtNameStream(rtStream_t stream_, const char *name); * @param [in] ptr Determine the address where the value of the true and false branches is located * @param [in] condition switch condition * @param [in] value switch value - * @param [in] true_stream Stream that needs to be activated when the value is non-zero + * @param [in] trueStream Stream that needs to be activated when the value is non-zero * @param [in] stream input stream to init task * @return RT_ERROR_NONE for complete * @return RT_ERROR_INVALID_VALUE for error input */ -RTS_API rtError_t rtStreamSwitch(void *ptr, rtCondition_t condition, int64_t value, rtStream_t true_stream, +RTS_API rtError_t rtStreamSwitch(void *ptr, rtCondition_t condition, int64_t value, rtStream_t trueStream, rtStream_t stream); /** @@ -162,18 +162,18 @@ RTS_API rtError_t rtStreamSwitch(void *ptr, rtCondition_t condition, int64_t val * @param [in] dataType data type of target value * @return RT_ERROR_NONE for complete */ -RTS_API rtError_t rtStreamSwitchEx(void *ptr, rtCondition_t condition, void *value_ptr, rtStream_t true_stream, +RTS_API rtError_t rtStreamSwitchEx(void *ptr, rtCondition_t condition, void *valuePtr, rtStream_t trueStream, rtStream_t stream, rtSwitchDataType_t dataType); /** * @ingroup dvrt_stream * @brief Active a stream - * @param [in] active_stream stream to be activated + * @param [in] activeStream stream to be activated * @param [in] stream input stream to init task * @return RT_ERROR_NONE for complete * @return RT_ERROR_INVALID_VALUE for error input */ -RTS_API rtError_t rtStreamActive(rtStream_t active_stream, rtStream_t stream); +RTS_API rtError_t rtStreamActive(rtStream_t activeStream, rtStream_t stream); /** * @brief execute extensible stream case switch task diff --git a/third_party/fwkacllib/inc/tdt/index_transform.h b/third_party/fwkacllib/inc/tdt/index_transform.h new file mode 100644 index 00000000..a5af2c83 --- /dev/null +++ b/third_party/fwkacllib/inc/tdt/index_transform.h @@ -0,0 +1,29 @@ +/** +* @file index_transform.h +* +* Copyright (C) Huawei Technologies Co., Ltd. 2018-2019. All Rights Reserved. +* +* This program is used to get logical device id by phy device id. +*/ + +#ifndef INC_TDT_INDEX_TRANSFORM_H +#define INC_TDT_INDEX_TRANSFORM_H + +#include "stdint.h" +/** +* @ingroup IndexTransform +* @brief get logical device id by phy device id. +* +* @par Function get logical device id by phy device id. +* +* @param phyId [IN] physical device id +* @param logicalId [OUT] logical device id +* @retval 0 Success +* @retval OtherValues Fail +* +* @par Dependency +* @li libruntime.so: Library to which the interface belongs. +*/ + +int32_t IndexTransform(const uint32_t phyId, uint32_t &logicId); +#endif diff --git a/third_party/fwkacllib/inc/tdt/status.h b/third_party/fwkacllib/inc/tdt/status.h index a42f38a5..d30564b8 100644 --- a/third_party/fwkacllib/inc/tdt/status.h +++ b/third_party/fwkacllib/inc/tdt/status.h @@ -193,6 +193,7 @@ enum { TDT_HDC_SRV_TYPE_ERROR_CODE, TDT_TSD_CLT_OPEN_FAILED_CODE, TDT_TSD_CLT_CLOSE_FAILED_CODE, + TDT_TSD_CLT_UPDATE_PROFILING_FAILED_CODE, TDT_TSD_CLT_INTERFACE_NOT_SUPPORT_CODE, TDT_SUPERVISOR_ILLEGAL_HEARTBEAT_TIME_CODE, TDT_SUPERVISOR_INOTIFY_READ_SIZE_ERROR_CODE, @@ -697,6 +698,8 @@ TDT_DEF_ERROR_CODE(MODID_HDC_SERVER, TDT_ERROR, TDT_BIND_CPUCORE_FAILED, "thread TDT_DEF_ERROR_CODE(MODID_HDC_SERVER, TDT_ERROR, TDT_HDC_SRV_CLOSED, "hdc server has been closed"); TDT_DEF_ERROR_CODE(MODID_TSD_CLIENT, TDT_ERROR, TDT_TSD_CLT_OPEN_FAILED, "tsd client open failed"); TDT_DEF_ERROR_CODE(MODID_TSD_CLIENT, TDT_ERROR, TDT_TSD_CLT_CLOSE_FAILED, "tsd client close failed"); +TDT_DEF_ERROR_CODE(MODID_TSD_CLIENT, TDT_ERROR, TDT_TSD_CLT_UPDATE_PROFILING_FAILED, + "tsd client update profiling failed"); TDT_DEF_ERROR_CODE(MODID_TSD_CLIENT, TDT_ERROR, TDT_TSD_CLT_INTERFACE_NOT_SUPPORT, "tsd client func not support"); TDT_DEF_ERROR_CODE(MODID_TDT_PREFETCH, TDT_ERROR, TDT_PREFETCH_FILELIST_NOT_EXIST, "tdt filelist open failed"); TDT_DEF_ERROR_CODE(MODID_TDT_PREFETCH, TDT_ERROR, TDT_PREFETCH_SAMPLE_FILE_NOT_FOUND, "tdt sample file is empty"); diff --git a/third_party/fwkacllib/inc/tdt/tsd_client.h b/third_party/fwkacllib/inc/tdt/tsd_client.h index 7886488e..6066a12e 100644 --- a/third_party/fwkacllib/inc/tdt/tsd_client.h +++ b/third_party/fwkacllib/inc/tdt/tsd_client.h @@ -49,7 +49,7 @@ extern "C" { * @li tsd_client.h: Header file where the interface declaration is located. * @li data_common.h: Header file where 'TDT_StatusT' defined */ -TDT_StatusT TsdOpen(const uint32_t phyDeviceId, const uint32_t rankSize); +TDT_LIB_EXPORT TDT_StatusT TsdOpen(const uint32_t phyDeviceId, const uint32_t rankSize); /** * @ingroup Close @@ -67,7 +67,25 @@ TDT_StatusT TsdOpen(const uint32_t phyDeviceId, const uint32_t rankSize); * @li tsd_client.h: Header file where the interface declaration is located. * @li data_common.h: Header file where 'TDT_StatusT' defined */ -TDT_StatusT TsdClose(const uint32_t phyDeviceId); +TDT_LIB_EXPORT TDT_StatusT TsdClose(const uint32_t phyDeviceId); + +/** +* @ingroup UpdateProfilingMode +* @brief notify TSDClient update profiling mode +* +* @par Function +* notify TSDClient update profiling mode +* +* @param NA +* @retval TDT_OK Success +* @retval OtherValues Failure +* +* @par Dependency +* @li libtsdclient.so: Library to which the interface belongs. +* @li tsd_client.h: Header file where the interface declaration is located. +* @li data_common.h: Header file where 'TDT_StatusT' defined +*/ +TDT_LIB_EXPORT TDT_StatusT UpdateProfilingMode(const uint32_t phyDeviceId, const uint32_t flag); /** * @ingroup CreateCmdParameterObj diff --git a/third_party/fwkacllib/inc/toolchain/slog.h b/third_party/fwkacllib/inc/toolchain/slog.h index 2cb00a05..bce58f32 100644 --- a/third_party/fwkacllib/inc/toolchain/slog.h +++ b/third_party/fwkacllib/inc/toolchain/slog.h @@ -25,10 +25,20 @@ extern "C" { #define LINUX 0 #endif // LINUX +#ifndef WIN +#define WIN 1 +#endif + #ifndef OS_TYPE #define OS_TYPE 0 #endif // OS_TYPE +#if (OS_TYPE == LINUX) +#define DLL_EXPORT __attribute__((visibility("default"))) +#else +#define DLL_EXPORT _declspec(dllexport) +#endif + /** * @ingroup slog * @@ -180,12 +190,11 @@ enum { INVLID_MOUDLE_ID }; -#if (OS_TYPE == LINUX) /** * @ingroup slog * @brief External log interface, which called by modules */ -extern void dlog_init(void); +DLL_EXPORT void dlog_init(void); /** * @ingroup slog @@ -195,7 +204,7 @@ extern void dlog_init(void); * @param [out]enableEvent: 1: enable; 0: disable * @return: module level(0: debug, 1: info, 2: warning, 3: error, 4: null output) */ -extern int dlog_getlevel(int moduleId, int *enableEvent); +DLL_EXPORT int dlog_getlevel(int moduleId, int *enableEvent); /** * @ingroup slog @@ -206,7 +215,7 @@ extern int dlog_getlevel(int moduleId, int *enableEvent); * @param [in]enableEvent: 1: enable; 0: disable, others:invalid * @return: 0: SUCCEED, others: FAILED */ -extern int dlog_setlevel(int moduleId, int level, int enableEvent); +DLL_EXPORT int dlog_setlevel(int moduleId, int level, int enableEvent); /** * @ingroup slog @@ -217,7 +226,7 @@ extern int dlog_setlevel(int moduleId, int level, int enableEvent); * @param [in]logLevel: eg: DLOG_EVENT/DLOG_ERROR/DLOG_WARN/DLOG_INFO/DLOG_DEBUG * @return: 1:enable, 0:disable */ -extern int CheckLogLevel(int moduleId, int logLevel); +DLL_EXPORT int CheckLogLevel(int moduleId, int logLevel); /** * @ingroup slog @@ -343,7 +352,7 @@ extern int CheckLogLevel(int moduleId, int logLevel); * @ingroup slog * @brief DlogFlush: flush log buffer to file */ -void DlogFlush(void); +DLL_EXPORT void DlogFlush(void); /** * @ingroup slog @@ -357,11 +366,6 @@ void DlogEventInner(int moduleId, const char *fmt, ...); void DlogInner(int moduleId, int level, const char *fmt, ...); void DlogWithKVInner(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...); -#else -_declspec(dllexport) void dlog_init(void); -_declspec(dllexport) int dlog_getlevel(int moduleId, int *enableEvent); -#endif // OS_TYPE - #ifdef __cplusplus } #endif // __cplusplus diff --git a/third_party/fwkacllib/inc/toolchain/tuning_tool/tune_api.h b/third_party/fwkacllib/inc/toolchain/tuning_tool/tune_api.h new file mode 100644 index 00000000..12b6aa1e --- /dev/null +++ b/third_party/fwkacllib/inc/toolchain/tuning_tool/tune_api.h @@ -0,0 +1,72 @@ +/** + * @file tune_api.h + * + * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.\n + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n + * 描述:mstune调优接口头文件 + */ +/** @defgroup mstune mstune调优接口 */ +#ifndef TUNE_API_H +#define TUNE_API_H +#include +#include +#include +#include "graph/graph.h" +#include "ge/ge_api.h" + +/** + * @ingroup mstune + * + * mstune status + */ +enum MsTuneStatus { + MSTUNE_SUCCESS, /** tune success */ + MSTUNE_FAILED, /** tune failed */ +}; + +// Option key: for train options sets +const std::string MSTUNE_SELF_KEY = "mstune"; +const std::string MSTUNE_GEINIT_KEY = "initialize"; +const std::string MSTUNE_GESESS_KEY = "session"; + +/** + * @ingroup mstune + * @par 描述: 命令行调优 + * + * @attention 无 + * @param option [IN] 调优参数 + * @param msg [OUT] 调优异常下返回信息 + * @retval #MSTUNE_SUCCESS 执行成功 + * @retval #MSTUNE_FAILED 执行失败 + * @par 依赖: + * @li tune_api.cpp:该接口所属的开发包。 + * @li tune_api.h:该接口声明所在的头文件。 + * @see 无 + * @since + */ +MsTuneStatus MsTuning(const std::map &option, std::string &msg); + +/** + * @ingroup mstune + * @par 描述: 梯度调优 + * + * @attention 无 + * @param tuningGraph [IN] 调优图 + * @param dependGraph [IN] 调优依赖图 + * @param session [IN] ge连接会话 + * @param option [IN] 参数集. 包含调优参数及ge参数 + * @retval #MSTUNE_SUCCESS 执行成功 + * @retval #MSTUNE_FAILED 执行失败 + * @par 依赖: + * @li tune_api.cpp:该接口所属的开发包。 + * @li tune_api.h:该接口声明所在的头文件。 + * @see 无 + * @since + */ +extern "C" MsTuneStatus MsTrainTuning(ge::Graph &tuningGraph, std::vector &dependGraph, + ge::Session *session, const std::map> &option); + +#endif