提交 5034cf4e 编写于 作者: wafwerar's avatar wafwerar

fix(grant): taosd -k.

上级 8ba6ddf8
...@@ -79,7 +79,7 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset) ...@@ -79,7 +79,7 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count); int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count);
void taosFprintfFile(TdFilePtr pFile, const char *format, ...); void taosFprintfFile(TdFilePtr pFile, const char *format, ...);
int64_t taosGetLineFile(TdFilePtr pFile, char ** __restrict__ ptrBuf); int64_t taosGetLineFile(TdFilePtr pFile, char ** __restrict ptrBuf);
int32_t taosEOFFile(TdFilePtr pFile); int32_t taosEOFFile(TdFilePtr pFile);
......
...@@ -29,6 +29,13 @@ extern "C" { ...@@ -29,6 +29,13 @@ extern "C" {
#define tcgetattr TCGETATTR_FUNC_TAOS_FORBID #define tcgetattr TCGETATTR_FUNC_TAOS_FORBID
#endif #endif
typedef struct TdCmd *TdCmdPtr;
TdCmdPtr taosOpenCmd(const char *cmd);
int64_t taosGetLineCmd(TdCmdPtr pCmd, char ** __restrict ptrBuf);
int32_t taosEOFCmd(TdCmdPtr pCmd);
int64_t taosCloseCmd(TdCmdPtr *ppCmd);
void* taosLoadDll(const char* filename); void* taosLoadDll(const char* filename);
void* taosLoadSym(void* handle, char* name); void* taosLoadSym(void* handle, char* name);
void taosCloseDll(void* handle); void taosCloseDll(void* handle);
......
...@@ -20,6 +20,7 @@ add_executable(taosd ${EXEC_SRC}) ...@@ -20,6 +20,7 @@ add_executable(taosd ${EXEC_SRC})
target_include_directories( target_include_directories(
taosd taosd
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
PRIVATE "${TD_SOURCE_DIR}/source/dnode/mnode/impl/inc"
) )
target_link_libraries(taosd dnode) target_link_libraries(taosd dnode)
...@@ -28,7 +29,6 @@ IF (TD_GRANT) ...@@ -28,7 +29,6 @@ IF (TD_GRANT)
ENDIF () ENDIF ()
IF (TD_USB_DONGLE) IF (TD_USB_DONGLE)
TARGET_LINK_LIBRARIES(taosd usb_dongle) TARGET_LINK_LIBRARIES(taosd usb_dongle)
else()
ENDIF () ENDIF ()
if(${BUILD_TEST}) if(${BUILD_TEST})
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "dndInt.h" #include "dndInt.h"
#include "tconfig.h" #include "tconfig.h"
#include "tgrant.h" #include "mndGrant.h"
static struct { static struct {
bool dumpConfig; bool dumpConfig;
......
...@@ -9,6 +9,13 @@ target_link_libraries( ...@@ -9,6 +9,13 @@ target_link_libraries(
mnode scheduler sdb wal transport cjson sync monitor executor qworker stream parser mnode scheduler sdb wal transport cjson sync monitor executor qworker stream parser
) )
IF (TD_GRANT)
TARGET_LINK_LIBRARIES(mnode grant)
ENDIF ()
IF (TD_USB_DONGLE)
TARGET_LINK_LIBRARIES(mnode usb_dongle)
ENDIF ()
if(${BUILD_TEST}) if(${BUILD_TEST})
add_subdirectory(test) add_subdirectory(test)
endif(${BUILD_TEST}) endif(${BUILD_TEST})
...@@ -36,8 +36,8 @@ typedef enum { ...@@ -36,8 +36,8 @@ typedef enum {
TSDB_GRANT_CPU_CORES, TSDB_GRANT_CPU_CORES,
} EGrantType; } EGrantType;
int32_t grantInit(); int32_t mndInitGrant();
void grantCleanUp(); void mndCleanupGrant();
void grantParseParameter(); void grantParseParameter();
int32_t grantCheck(EGrantType grant); int32_t grantCheck(EGrantType grant);
void grantReset(EGrantType grant, uint64_t value); void grantReset(EGrantType grant, uint64_t value);
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
#ifndef _GRANT #ifndef _GRANT
#include "os.h" #include "os.h"
#include "taoserror.h" #include "taoserror.h"
#include "tgrant.h" #include "mndGrant.h"
#include "mndInt.h" #include "mndInt.h"
int32_t grantInit() { return TSDB_CODE_SUCCESS; } int32_t mndInitGrant(SMnode *pMnode) { return TSDB_CODE_SUCCESS; }
void grantCleanUp() {} void mndCleanupGrant() {}
void grantParseParameter() { mError("can't parsed parameter k"); } void grantParseParameter() { mError("can't parsed parameter k"); }
int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; } int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; }
void grantReset(EGrantType grant, uint64_t value) {} void grantReset(EGrantType grant, uint64_t value) {}
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "mndUser.h" #include "mndUser.h"
#include "mndVgroup.h" #include "mndVgroup.h"
#include "mndQuery.h" #include "mndQuery.h"
#include "mndGrant.h"
#define MQ_TIMER_MS 3000 #define MQ_TIMER_MS 3000
#define TRNAS_TIMER_MS 6000 #define TRNAS_TIMER_MS 6000
...@@ -197,6 +198,7 @@ static int32_t mndInitSteps(SMnode *pMnode, bool deploy) { ...@@ -197,6 +198,7 @@ static int32_t mndInitSteps(SMnode *pMnode, bool deploy) {
if (mndAllocStep(pMnode, "mnode-qnode", mndInitBnode, mndCleanupBnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-qnode", mndInitBnode, mndCleanupBnode) != 0) return -1;
if (mndAllocStep(pMnode, "mnode-dnode", mndInitDnode, mndCleanupDnode) != 0) return -1; if (mndAllocStep(pMnode, "mnode-dnode", mndInitDnode, mndCleanupDnode) != 0) return -1;
if (mndAllocStep(pMnode, "mnode-user", mndInitUser, mndCleanupUser) != 0) return -1; if (mndAllocStep(pMnode, "mnode-user", mndInitUser, mndCleanupUser) != 0) return -1;
if (mndAllocStep(pMnode, "mnode-grant", mndInitGrant, mndCleanupGrant) != 0) return -1;
if (mndAllocStep(pMnode, "mnode-auth", mndInitAuth, mndCleanupAuth) != 0) return -1; if (mndAllocStep(pMnode, "mnode-auth", mndInitAuth, mndCleanupAuth) != 0) return -1;
if (mndAllocStep(pMnode, "mnode-acct", mndInitAcct, mndCleanupAcct) != 0) return -1; if (mndAllocStep(pMnode, "mnode-acct", mndInitAcct, mndCleanupAcct) != 0) return -1;
if (mndAllocStep(pMnode, "mnode-stream", mndInitStream, mndCleanupStream) != 0) return -1; if (mndAllocStep(pMnode, "mnode-stream", mndInitStream, mndCleanupStream) != 0) return -1;
......
...@@ -768,7 +768,7 @@ int32_t taosUmaskFile(int32_t maskVal) { ...@@ -768,7 +768,7 @@ int32_t taosUmaskFile(int32_t maskVal) {
} }
int32_t taosGetErrorFile(TdFilePtr pFile) { return errno; } int32_t taosGetErrorFile(TdFilePtr pFile) { return errno; }
int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict__ ptrBuf) { int64_t taosGetLineFile(TdFilePtr pFile, char **__restrict ptrBuf) {
if (pFile == NULL) { if (pFile == NULL) {
return -1; return -1;
} }
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
struct termios oldtio; struct termios oldtio;
#endif #endif
typedef struct FILE TdCmd;
void* taosLoadDll(const char* filename) { void* taosLoadDll(const char* filename) {
#if defined(WINDOWS) #if defined(WINDOWS)
return NULL; return NULL;
...@@ -178,3 +180,33 @@ void resetTerminalMode() { ...@@ -178,3 +180,33 @@ void resetTerminalMode() {
} }
#endif #endif
} }
TdCmdPtr taosOpenCmd(const char *cmd) {
if (cmd == NULL) return NULL;
return (TdCmdPtr)popen(cmd, "r");
}
int64_t taosGetLineCmd(TdCmdPtr pCmd, char ** __restrict ptrBuf) {
if (pCmd == NULL) {
return -1;
}
size_t len = 0;
return getline(ptrBuf, &len, (FILE*)pCmd);
}
int32_t taosEOFCmd(TdCmdPtr pCmd) {
if (pCmd == NULL) {
return 0;
}
return feof((FILE*)pCmd);
}
int64_t taosCloseCmd(TdCmdPtr *ppCmd) {
if (ppCmd == NULL || *ppCmd == NULL) {
return 0;
}
pclose((FILE*)(*ppCmd));
*ppCmd = NULL;
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册