Exemplo n.º 1
0
void *procFunc(void *arg) {
	DynBuf printb;
	DynBuf b;
	const ProcThreadArgs *const args = (ProcThreadArgs *)arg;

	prctl(PR_SET_NAME, (unsigned long)&"gatord-proc", 0, 0, 0);

	// Gator runs at a high priority, reset the priority to the default
	if (setpriority(PRIO_PROCESS, syscall(__NR_gettid), 0) == -1) {
		logg->logError(__FILE__, __LINE__, "setpriority failed");
		handleException();
	}

	if (!readProcMaps(args->mCurrTime, args->mBuffer, &printb, &b)) {
		logg->logError(__FILE__, __LINE__, "readProcMaps failed");
		handleException();
	}
	args->mBuffer->commit(args->mCurrTime);

	if (!readKallsyms(args->mCurrTime, args->mBuffer, &args->mIsDone)) {
		logg->logError(__FILE__, __LINE__, "readKallsyms failed");
		handleException();
	}
	args->mBuffer->commit(args->mCurrTime);

	return NULL;
}
Exemplo n.º 2
0
static void *procFunc(void *arg)
{
    const ProcThreadArgs * const args = reinterpret_cast<const ProcThreadArgs *>(arg);

    prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(&"gatord-proc"), 0, 0, 0);

    // Gator runs at a high priority, reset the priority to the default
    if (setpriority(PRIO_PROCESS, syscall(__NR_gettid), 0) == -1) {
        logg.logError("setpriority failed");
        handleException();
    }

    if (!readProcMaps(args->mCurrTime, *args->mAttrsBuffer)) {
        logg.logError("readProcMaps failed");
        handleException();
    }

    if (!readKallsyms(args->mCurrTime, *args->mAttrsBuffer, args->mIsDone)) {
        logg.logError("readKallsyms failed");
        handleException();
    }
    args->mAttrsBuffer->commit(args->mCurrTime);

    return NULL;
}