1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-06 00:13:33 +00:00

Updated metadata

This commit is contained in:
Bryan Roe
2020-05-22 12:18:46 -07:00
parent 2a0cc4435d
commit a7b30fb729
7 changed files with 46 additions and 9 deletions

View File

@@ -1338,10 +1338,13 @@ void* kvm_relay_restart(int paused, void *processPipeMgr, ILibKVM_WriteHandler w
close(slave2master[1]);
close(master2slave[0]);
logFile = fopen("/tmp/master", "w");
char tmp[255];
sprintf_s(tmp, sizeof(tmp), "Child KVM (pid=%d)", g_slavekvm);
// We will asyncronously read from the pipe, so we can just return
ILibProcessPipe_Pipe_AddPipeReadHandler(slave_out, 65535, kvm_relay_readSink);
ILibProcessPipe_Pipe_SetBrokenPipeHandler(slave_out, kvm_relay_brokenPipeSink);
ILibProcessPipe_Pipe_ResetMetadata(slave_out, tmp);
return(slave_out);
}
}

View File

@@ -295,8 +295,9 @@ ILibDuktape_ChildProcess_SubProcess* ILibDuktape_ChildProcess_SpawnedProcess_PUS
#endif
if (callback != NULL) { ILibDuktape_EventEmitter_AddOnce(emitter, "exit", callback); }
ILibProcessPipe_Process_ResetMetadata(mProcess, "childProcess");
char tmp[255];
sprintf_s(tmp, sizeof(tmp), "childProcess (pid=%d)", ILibProcessPipe_Process_GetPID(mProcess));
ILibProcessPipe_Process_ResetMetadata(mProcess, tmp);
ILibProcessPipe_Process_AddHandlers(mProcess, 4096, ILibDuktape_ChildProcess_SubProcess_ExitHandler,
ILibDuktape_ChildProcess_SubProcess_StdOutHandler,
ILibDuktape_ChildProcess_SubProcess_StdErrHandler,

File diff suppressed because one or more lines are too long

View File

@@ -3029,6 +3029,8 @@ char *ILibChain_GetMetaDataFromDescriptorSetEx(void *chain, fd_set *inr, fd_set
fd_set emptyset; FD_ZERO(&emptyset);
int selectTimeout = UPNP_MAX_WAIT * 1000;
int f;
size_t tmp;
while (node != NULL && (module = (ILibChain_Link*)ILibLinkedList_GetDataFromNode(node)) != NULL)
{
if (module->PreSelectHandler != NULL)
@@ -3064,7 +3066,7 @@ char *ILibChain_GetMetaDataFromDescriptorSetEx(void *chain, fd_set *inr, fd_set
}
for (f = 0; f < scount; ++f)
{
len += sprintf_s(retStr + len, ILibMemory_Size(retStr) - len, " FD[%d] (R: %d, W: %d, E: %d) => %s\n", (int)slist[f], FD_ISSET(slist[f], inr), FD_ISSET(slist[f], inw), FD_ISSET(slist[f], ine), ((ILibChain_Link*)module)->MetaData);
len += sprintf_s(retStr + len, ILibMemory_Size(retStr) - len, " FD[%d] (R: %d, W: %d, E: %d) => %s\n", (int)slist[f], FD_ISSET(slist[f], inr), FD_ISSET(slist[f], inw), FD_ISSET(slist[f], ine), ((ILibChain_Link*)module)->QueryHandler != NULL ? ((ILibChain_Link*)module)->QueryHandler(chain, module, (int)slist[f], &tmp) : ((ILibChain_Link*)module)->MetaData);
}
#else
@@ -3072,7 +3074,7 @@ char *ILibChain_GetMetaDataFromDescriptorSetEx(void *chain, fd_set *inr, fd_set
{
if (FD_ISSET(f, &readset) || FD_ISSET(f, &writeset) || FD_ISSET(f, &errorset))
{
len += sprintf_s(retStr + len, ILibMemory_Size(retStr) - len, " FD[%d] (R: %d, W: %d, E: %d) => %s\n", f, FD_ISSET(f, inr), FD_ISSET(f, inw), FD_ISSET(f, ine), ((ILibChain_Link*)module)->MetaData);
len += sprintf_s(retStr + len, ILibMemory_Size(retStr) - len, " FD[%d] (R: %d, W: %d, E: %d) => %s\n", f, FD_ISSET(f, inr), FD_ISSET(f, inw), FD_ISSET(f, ine), ((ILibChain_Link*)module)->QueryHandler != NULL ? ((ILibChain_Link*)module)->QueryHandler(chain, module, f, &tmp) : ((ILibChain_Link*)module)->MetaData);
}
}
#endif

View File

@@ -342,6 +342,8 @@ int ILibIsRunningOnChainThread(void* chain);
typedef void(*ILibChain_PreSelect)(void* object, fd_set *readset, fd_set *writeset, fd_set *errorset, int* blocktime);
typedef void(*ILibChain_PostSelect)(void* object, int slct, fd_set *readset, fd_set *writeset, fd_set *errorset);
typedef void(*ILibChain_Destroy)(void* object);
typedef char*(*ILibChain_QueryData)(void* chain, void *object, int fd, size_t *dataLen);
typedef void(*ILibChain_DestroyEvent)(void *chain, void *user);
typedef void(*ILibChain_StartEvent)(void *chain, void *user);
typedef void*(*ILibChain_Link_GetUserMemory)(void *ChainLinkObject, int *len);
@@ -365,6 +367,7 @@ int ILibIsRunningOnChainThread(void* chain);
ILibChain_PreSelect PreSelectHandler;
ILibChain_PostSelect PostSelectHandler;
ILibChain_Destroy DestroyHandler;
ILibChain_QueryData QueryHandler;
void* ParentChain;
void* ExtraMemoryPtr;
char* MetaData;

View File

@@ -172,6 +172,30 @@ ILibProcessPipe_Pipe ILibProcessPipe_Process_GetStdOut(ILibProcessPipe_Process p
BOOL ILibProcessPipe_Process_OnExit(void *chain, HANDLE event, ILibWaitHandle_ErrorStatus errors, void* user);
#else
void ILibProcessPipe_Process_ReadHandler(void* user);
int ILibProcessPipe_Manager_OnQuery_comparer(void *j1, void *j2)
{
ILibProcessPipe_PipeObject *pj = (ILibProcessPipe_PipeObject*)j1;
int fd = (int)(uintptr_t)j2;
if (pj->mPipe_ReadEnd == fd) { return(0); }
return(1);
}
char * ILibProcessPipe_Manager_OnQuery(void *chain, void *object, int fd, size_t *dataLen)
{
ILibProcessPipe_Manager_Object *man = (ILibProcessPipe_Manager_Object*)object;
char *ret = ((ILibChain_Link*)object)->MetaData;
int i;
*dataLen = strnlen_s(((ILibChain_Link*)object)->MetaData, 1024);
void *node = ILibLinkedList_GetNode_Search(man->ActivePipes, ILibProcessPipe_Manager_OnQuery_comparer, (void*)(uintptr_t)fd);
if (node != NULL)
{
ILibProcessPipe_PipeObject *pj = (ILibProcessPipe_PipeObject*)ILibLinkedList_GetDataFromNode(node);
*dataLen = strnlen_s(pj->metadata, 1024);
ret = pj->metadata;
}
return(ret);
}
void ILibProcessPipe_Manager_OnPreSelect(void* object, fd_set *readset, fd_set *writeset, fd_set *errorset, int* blocktime)
{
ILibProcessPipe_Manager_Object *man = (ILibProcessPipe_Manager_Object*)object;
@@ -241,6 +265,7 @@ ILibProcessPipe_Manager ILibProcessPipe_Manager_Create(void *chain)
#ifndef WIN32
retVal->ChainLink.PreSelectHandler = &ILibProcessPipe_Manager_OnPreSelect;
retVal->ChainLink.PostSelectHandler = &ILibProcessPipe_Manager_OnPostSelect;
retVal->ChainLink.QueryHandler = ILibProcessPipe_Manager_OnQuery;
#endif
retVal->ChainLink.DestroyHandler = &ILibProcessPipe_Manager_OnDestroy;

View File

@@ -40,6 +40,7 @@ function windows_notifybar_system(title, tsid)
.addMethod('close', function close() { this.child.kill(); });
ret.child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-b64exec', script], { type: 1, uid: tsid });
ret.child.descriptorMetadata = 'notifybar-desktop';
ret.child.parent = ret;
ret.child.stdout.on('data', function (c) { });
ret.child.stderr.on('data', function (c) { });
@@ -198,6 +199,7 @@ function x_notifybar_check(title)
};
var xinfo = require('monitor-info').getXInfo(uid);
that.child = require('child_process').execFile(process.execPath, [process.execPath.split('/').pop(), '-b64exec', script], { uid: uid, env: xinfo.exportEnv() });
that.child.descriptorMetadata = 'notifybar-desktop';
that.child.parent = that;
that.child.stdout.on('data', function (c) { });
that.child.stderr.on('data', function (c) { });
@@ -224,6 +226,7 @@ function x_notifybar_check(title)
.addMethod('close', function close() { this.child.kill(); });
ret.child = require('child_process').execFile(process.execPath, [process.execPath.split('/').pop(), '-b64exec', script], { uid: uid, env: xinfo.exportEnv() });
ret.child.descriptorMetadata = 'notifybar-desktop';
ret.child.parent = ret;
ret.child.stdout.on('data', function (c) { });
ret.child.stderr.on('data', function (c) { });