• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LOG_WARNING函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LOG_WARNING函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_WARNING函数的具体用法?C++ LOG_WARNING怎么用?C++ LOG_WARNING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LOG_WARNING函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: log_read

static int log_read(ambit_object_t *object, ambit_log_skip_cb skip_cb, ambit_log_push_cb push_cb, ambit_log_progress_cb progress_cb, void *userref)
{
    int entries_read = 0;

    uint8_t *reply_data = NULL;
    size_t replylen = 0;
    uint16_t log_entries_total = 0;
    uint16_t log_entries_walked = 0;

    uint32_t more = 0x00000400;

    bool read_pmem = false;

    ambit_log_header_t log_header;
    ambit_log_entry_t *log_entry;

    LOG_INFO("Reading number of logs");
    log_header.activity_name = NULL;

    /*
     * Read number of log entries
     */
    if (libambit_protocol_command(object, ambit_command_log_count, NULL, 0, &reply_data, &replylen, 0) != 0) {
        LOG_WARNING("Failed to read number of log entries");
        return -1;
    }
    log_entries_total = le16toh(*(uint16_t*)(reply_data + 2));
    libambit_protocol_free(reply_data);

    LOG_INFO("Number of logs=%d", log_entries_total);

    /*
     * First part walks through headers to check if there is any point in start
     * reading the PMEM content. If no skip callback is defined, there is no
     * point in checking the headers, because no one can tell us to not include
     * the logs...
     */

    if (skip_cb != NULL) {
        LOG_INFO("Look in headers for new logs");
        // Rewind
        if (libambit_protocol_command(object, ambit_command_log_head_first, NULL, 0, &reply_data, &replylen, 0) != 0) {
            LOG_WARNING("Failed to rewind header pointer");
            return -1;
        }
        more = le32toh(*(uint32_t*)reply_data);
        libambit_protocol_free(reply_data);

        // Loop through logs while more entries exists
        while (more == 0x00000400) {
            LOG_INFO("Reading next header");
            // Go to next entry
            if (libambit_protocol_command(object, ambit_command_log_head_step, NULL, 0, &reply_data, &replylen, 0) != 0) {
                LOG_WARNING("Failed to walk to next header");
                return -1;
            }
            libambit_protocol_free(reply_data);

            // Assume every header is composited by 2 parts, where only the
            // second is of interrest right now
            if (libambit_protocol_command(object, ambit_command_log_head, NULL, 0, &reply_data, &replylen, 0) != 0) {
                LOG_WARNING("Failed to read first part of header");
                return -1;
            }
            libambit_protocol_free(reply_data);

            if (libambit_protocol_command(object, ambit_command_log_head, NULL, 0, &reply_data, &replylen, 0) == 0) {
                if (replylen > 8 && libambit_pmem20_log_parse_header(reply_data + 8, replylen - 8, &log_header) == 0) {
                    if (skip_cb(userref, &log_header) != 0) {
                        // Header was NOT skipped, break out!
                        read_pmem = true;
                        LOG_INFO("Found new entry, start reading log data");
                        break;
                    }
                }
                else {
                    LOG_ERROR("Failed to parse log header");
                    return -1;
                }
                libambit_protocol_free(reply_data);
            }
            else {
                LOG_WARNING("Failed to read second part of header");
                return -1;
            }

            // Is there more entries to read?
            if (libambit_protocol_command(object, ambit_command_log_head_peek, NULL, 0, &reply_data, &replylen, 0) != 0) {
                LOG_WARNING("Failed to check for more headers");
                return -1;
            }
            more = le32toh(*(uint32_t*)reply_data);
            libambit_protocol_free(reply_data);
        }
    }
    else {
        LOG_INFO("No skip callback defined, reading log data");
        read_pmem = true;
    }

//.........这里部分代码省略.........
开发者ID:RAFTHOM,项目名称:openambit,代码行数:101,代码来源:device_driver_ambit.c


示例2: RenderMemoryGraph

//
// Renders the user interface using D2D on top of our D3D12 content.
//
HRESULT D3D12MemoryManagement::RenderUI()
{
    HRESULT hr = S_OK;

    UINT FrameIndex = m_pDXGISwapChain->GetCurrentBackBufferIndex();

    //
    // Acquire the wrapped back buffer object. When we release the wrapped object, it will
    // be placed in a presentable state, and we can call Present directly.
    //
    m_p11On12Device->AcquireWrappedResources(&m_pWrappedBackBuffers[FrameIndex], 1);

    m_pD2DContext->SetTarget(m_pD2DRenderTargets[FrameIndex]);
    m_pD2DContext->BeginDraw();
    m_pD2DContext->SetTransform(D2D1::Matrix3x2F::Identity());

    if (m_bRenderStats)
    {
        //
        // Render statistical information, such as the framerate, memory budget graph,
        // and glitch count.
        //
        m_pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_TRAILING);
        m_pTextFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
        RenderMemoryGraph();

        //
        // Frame statistics (FPS, CPU time, etc).
        //
        {
            D2D1_RECT_F TextRect;

            TextRect.left = 8;
            TextRect.top = 8;
            TextRect.right = 256;
            TextRect.bottom = 256;

            float StatTimeBetweenFrames = AverageStatistics(m_StatTimeBetweenFrames, STATISTIC_COUNT);
            float StatRenderScene = AverageStatistics(m_StatRenderScene, STATISTIC_COUNT);
            float StatRenderUI = AverageStatistics(m_StatRenderUI, STATISTIC_COUNT);

            m_pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);
            m_pTextFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);
            wchar_t FPSString[128];
            swprintf_s(
                FPSString,
                _TRUNCATE,
                L"FPS: %d (%.2fms)\n"
                L"Glitch Count: %d\n"
                L"\n"
                L"RenderScene: %.2f ms\n"
                L"RenderUI: %.2f ms",
                (UINT)(1.0f / StatTimeBetweenFrames),
                StatTimeBetweenFrames * 1000.0f,
                GetGlitchCount(),
                StatRenderScene * 1000.0f,
                StatRenderUI * 1000.0f);

            m_pD2DContext->DrawTextW(
                FPSString,
                (UINT)wcslen(FPSString),
                m_pTextFormat,
                &TextRect,
                m_pTextBrush);
        }
    }

    hr = m_pD2DContext->EndDraw();
    if (FAILED(hr))
    {
        LOG_WARNING("D2D EndDraw failed, hr=0x%.8x", hr);
    }

    //
    // Unreference the render target after rendering completes.
    //
    m_pD2DContext->SetTarget(nullptr);

    m_p11On12Device->ReleaseWrappedResources(&m_pWrappedBackBuffers[FrameIndex], 1);

    //
    // Flush D2D based content on the D3D11On12 device to synchronize with D3D12 content.
    //
    m_p11Context->Flush();

    return hr;
}
开发者ID:Microsoft,项目名称:DirectX-Graphics-Samples,代码行数:90,代码来源:D3D12MemoryManagement.cpp


示例3: LOG_WARNING

//
// Generates new graph geometry, which may change every frame.
//
HRESULT D3D12MemoryManagement::GenerateMemoryGraphGeometry(const RectF& Bounds, UINT GraphSizeMB, ID2D1PathGeometry** ppPathGeometry)
{
    HRESULT hr;

    ID2D1PathGeometry* pPathGeometry = nullptr;
    ID2D1GeometrySink* pGeometrySink = nullptr;

    hr = m_pD2DFactory->CreatePathGeometry(&pPathGeometry);
    if (FAILED(hr))
    {
        LOG_WARNING("Failed to create path geometry, hr=0x%.8x");
        goto cleanup;
    }

    hr = pPathGeometry->Open(&pGeometrySink);
    if (FAILED(hr))
    {
        LOG_WARNING("Failed to open path geometry sink, hr=0x%.8x");
        goto cleanup;
    }

    {
        float GraphHeightPadded = GRAPH_HEIGHT * GRAPH_HEIGHT_RATIO / 100;
        float XStep = GRAPH_WIDTH / GRAPH_SEGMENTS;

        D2D1_POINT_2F Point;
        Point.x = Bounds.Left;
        Point.y = Bounds.Bottom;

        pGeometrySink->BeginFigure(Point, D2D1_FIGURE_BEGIN_FILLED);

        for (UINT i = 0; i < NUM_GRAPH_POINTS; ++i)
        {
            UINT32 GraphPoint = (i + m_CurrentGraphPoint) % NUM_GRAPH_POINTS;

            Point.y = Bounds.Bottom - (m_GraphPoints[GraphPoint] / 1024 / 1024) / (float)GraphSizeMB * GraphHeightPadded;
            pGeometrySink->AddLine(Point);
            Point.x += XStep;
        }

        Point.x = Bounds.Right;
        Point.y = Bounds.Bottom;
        pGeometrySink->AddLine(Point);

        pGeometrySink->EndFigure(D2D1_FIGURE_END_CLOSED);
    }

    hr = pGeometrySink->Close();
    if (FAILED(hr))
    {
        LOG_ERROR("Failed to close path geometry sink, hr=0x%.8x", hr);
        goto cleanup;
    }

    pGeometrySink->Release();
    *ppPathGeometry = pPathGeometry;

    return S_OK;

cleanup:
    SafeRelease(pGeometrySink);
    SafeRelease(pPathGeometry);

    return hr;
}
开发者ID:Microsoft,项目名称:DirectX-Graphics-Samples,代码行数:68,代码来源:D3D12MemoryManagement.cpp


示例4: get_3d_objects_from_server

int get_3d_objects_from_server (int nr_objs, const Uint8 *data, int len)
{
	int iobj;
	int obj_x, obj_y;
	int offset, nb_left;
	float x = 0.0f, y = 0.0f, z = 0.0f, rx = 0.0f, ry = 0.0f, rz = 0.0f;
	char obj_name[128];
	int name_len, max_name_len;
	int id = -1;
	int all_ok = 1;
	
	offset = 0;
	nb_left = len;
	for (iobj = 0; iobj < nr_objs; iobj++)
	{
		int obj_err = 0;
		
		if (nb_left < 14)
		{
			// Warn about this error!
                        LOG_WARNING("Incomplete 3D objects list!");
			all_ok = 0;
                        break;
		}
		
		obj_x = SDL_SwapLE16 (*((Uint16 *)(&data[offset])));
		offset += 2;
		obj_y = SDL_SwapLE16 (*((Uint16 *)(&data[offset])));
		offset += 2;
		if (obj_x > tile_map_size_x * 6 || obj_y > tile_map_size_y * 6)
		{
			// Warn about this error!
			LOG_WARNING("A 3D object was located OUTSIDE the map!");
			offset += 8;
			obj_err = 1;
                }
		else
		{
			rx = SwapLEFloat (*((float *)(&data[offset])));
			offset += 2;
			ry = SwapLEFloat (*((float *)(&data[offset])));
			offset += 2;
			rz = SwapLEFloat (*((float *)(&data[offset])));
			offset += 2;
			id = SDL_SwapLE16 (*((Uint16 *)(&data[offset])));
			offset += 2;

			x = 0.5f * obj_x + 0.25f;
			y = 0.5f * obj_y + 0.25f;
			z = get_tile_height(obj_x, obj_y);
		}
		
		nb_left -= 12;
		max_name_len = nb_left > sizeof (obj_name) ? sizeof (obj_name) : nb_left;
		name_len = safe_snprintf (obj_name, max_name_len, "%s", &data[offset]);
		if (name_len < 0 || name_len >= sizeof (obj_name))
		{
			// Warn about this error!
                        LOG_WARNING("3D object has invalid or too long file name!");
			all_ok = 0;
                        break;
		}
		
		offset += name_len + 1;
		nb_left -= name_len + 1;
		
		if (!obj_err)
			add_e3d_at_id (id, obj_name, x, y, z, rx, ry, rz, 0, 0, 1.0f, 1.0f, 1.0f, 1);
		else
			all_ok = 0;
	}
	
	return all_ok;
}
开发者ID:ago1024,项目名称:Eternal-Lands,代码行数:74,代码来源:map.c


示例5: str9xpec_write

static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer,
		uint32_t offset, uint32_t count)
{
	struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv;
	uint32_t dwords_remaining = (count / 8);
	uint32_t bytes_remaining = (count & 0x00000007);
	uint32_t bytes_written = 0;
	uint8_t status;
	uint32_t check_address = offset;
	struct jtag_tap *tap;
	struct scan_field field;
	uint8_t *scanbuf;
	int i;
	int first_sector = 0;
	int last_sector = 0;

	tap = str9xpec_info->tap;

	if (!str9xpec_info->isc_enable)
		str9xpec_isc_enable(bank);

	if (!str9xpec_info->isc_enable)
		return ERROR_FLASH_OPERATION_FAILED;

	if (offset & 0x7) {
		LOG_WARNING("offset 0x%" PRIx32 " breaks required 8-byte alignment", offset);
		return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
	}

	for (i = 0; i < bank->num_sectors; i++) {
		uint32_t sec_start = bank->sectors[i].offset;
		uint32_t sec_end = sec_start + bank->sectors[i].size;

		/* check if destination falls within the current sector */
		if ((check_address >= sec_start) && (check_address < sec_end)) {
			/* check if destination ends in the current sector */
			if (offset + count < sec_end)
				check_address = offset + count;
			else
				check_address = sec_end;
		}

		if ((offset >= sec_start) && (offset < sec_end))
			first_sector = i;

		if ((offset + count >= sec_start) && (offset + count < sec_end))
			last_sector = i;
	}

	if (check_address != offset + count)
		return ERROR_FLASH_DST_OUT_OF_BANK;

	LOG_DEBUG("first_sector: %i, last_sector: %i", first_sector, last_sector);

	scanbuf = calloc(DIV_ROUND_UP(64, 8), 1);

	LOG_DEBUG("ISC_PROGRAM");

	for (i = first_sector; i <= last_sector; i++) {
		str9xpec_set_address(bank, str9xpec_info->sector_bits[i]);

		dwords_remaining = dwords_remaining < (bank->sectors[i].size/8)
				? dwords_remaining : (bank->sectors[i].size/8);

		while (dwords_remaining > 0) {
			str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE);

			field.num_bits = 64;
			field.out_value = (buffer + bytes_written);
			field.in_value = NULL;

			jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);

			/* small delay before polling */
			jtag_add_sleep(50);

			str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE);

			do {
				field.num_bits = 8;
				field.out_value = NULL;
				field.in_value = scanbuf;

				jtag_add_dr_scan(tap, 1, &field, TAP_IRPAUSE);
				jtag_execute_queue();

				status = buf_get_u32(scanbuf, 0, 8);

			} while (!(status & ISC_STATUS_BUSY));

			if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS)
				return ERROR_FLASH_OPERATION_FAILED;

			/* if ((status & ISC_STATUS_INT_ERROR) != STR9XPEC_ISC_INTFAIL)
				return ERROR_FLASH_OPERATION_FAILED; */

			dwords_remaining--;
			bytes_written += 8;
		}
	}
//.........这里部分代码省略.........
开发者ID:01org,项目名称:CODK-A-Flashpack,代码行数:101,代码来源:str9xpec.c


示例6: CHECK_ASSERTION

bool SELFDecrypter::LoadHeaders(bool isElf32)
{
	// Read SCE header.
	CHECK_ASSERTION(self_f.Seek(0) != -1);
	sce_hdr.Load(self_f);

	// Check SCE magic.
	if (!sce_hdr.CheckMagic())
	{
		LOG_ERROR(LOADER, "SELF: Not a SELF file!");
		return false;
	}

	// Read SELF header.
	self_hdr.Load(self_f);

	// Read the APP INFO.
	CHECK_ASSERTION(self_f.Seek(self_hdr.se_appinfooff) != -1);
	app_info.Load(self_f);

	// Read ELF header.
	CHECK_ASSERTION(self_f.Seek(self_hdr.se_elfoff) != -1);

	if (isElf32)
		elf32_hdr.Load(self_f);
	else
		elf64_hdr.Load(self_f);

	// Read ELF program headers.
	if (isElf32)
	{
		phdr32_arr.clear();
		if(elf32_hdr.e_phoff == 0 && elf32_hdr.e_phnum)
		{
			LOG_ERROR(LOADER, "SELF: ELF program header offset is null!");
			return false;
		}
		self_f.Seek(self_hdr.se_phdroff);
		for(u32 i = 0; i < elf32_hdr.e_phnum; ++i)
		{
			phdr32_arr.emplace_back();
			phdr32_arr.back().Load(self_f);
		}
	}
	else
	{
		phdr64_arr.clear();

		if (elf64_hdr.e_phoff == 0 && elf64_hdr.e_phnum)
		{
			LOG_ERROR(LOADER, "SELF: ELF program header offset is null!");
			return false;
		}

		CHECK_ASSERTION(self_f.Seek(self_hdr.se_phdroff) != -1);

		for (u32 i = 0; i < elf64_hdr.e_phnum; ++i)
		{
			phdr64_arr.emplace_back();
			phdr64_arr.back().Load(self_f);
		}
	}


	// Read section info.
	secinfo_arr.clear();
	CHECK_ASSERTION(self_f.Seek(self_hdr.se_secinfoff) != -1);

	for(u32 i = 0; i < ((isElf32) ? elf32_hdr.e_phnum : elf64_hdr.e_phnum); ++i)
	{
		secinfo_arr.emplace_back();
		secinfo_arr.back().Load(self_f);
	}

	// Read SCE version info.
	CHECK_ASSERTION(self_f.Seek(self_hdr.se_sceveroff) != -1);
	scev_info.Load(self_f);

	// Read control info.
	ctrlinfo_arr.clear();
	CHECK_ASSERTION(self_f.Seek(self_hdr.se_controloff) != -1);

	u32 i = 0;
	while(i < self_hdr.se_controlsize)
	{
		ctrlinfo_arr.emplace_back();
		ControlInfo &cinfo = ctrlinfo_arr.back();
		cinfo.Load(self_f);
		i += cinfo.size;
	}

	// Read ELF section headers.
	if (isElf32)
	{
		shdr32_arr.clear();

		if (elf32_hdr.e_shoff == 0 && elf32_hdr.e_shnum)
		{
			LOG_WARNING(LOADER, "SELF: ELF section header offset is null!");
			return true;
//.........这里部分代码省略.........
开发者ID:ss23,项目名称:rpcs3,代码行数:101,代码来源:unself.cpp


示例7: switch

bool fs::file::open(const std::string& filename, u32 mode)
{
	this->close();

	g_tls_error = fse::ok;

#ifdef _WIN32
	DWORD access = 0;
	switch (mode & (fom::read | fom::write | fom::append))
	{
	case fom::read: access |= GENERIC_READ; break;
	case fom::read | fom::append: access |= GENERIC_READ; break;
	case fom::write: access |= GENERIC_WRITE; break;
	case fom::write | fom::append: access |= FILE_APPEND_DATA; break;
	case fom::read | fom::write: access |= GENERIC_READ | GENERIC_WRITE; break;
	case fom::read | fom::write | fom::append: access |= GENERIC_READ | FILE_APPEND_DATA; break;
	default:
	{
		LOG_ERROR(GENERAL, "fs::file::open('%s') failed: neither fom::read nor fom::write specified (0x%x)", filename, mode);
		return false;
	}
	}

	DWORD disp = 0;
	switch (mode & (fom::create | fom::trunc | fom::excl))
	{
	case 0: disp = OPEN_EXISTING; break;
	case fom::create: disp = OPEN_ALWAYS; break;
	case fom::trunc: disp = TRUNCATE_EXISTING; break;
	case fom::create | fom::trunc: disp = CREATE_ALWAYS; break;
	case fom::create | fom::excl: disp = CREATE_NEW; break;
	case fom::create | fom::excl | fom::trunc: disp = CREATE_NEW; break;
	}

	if (!disp || (mode & ~(fom::read | fom::write | fom::append | fom::create | fom::trunc | fom::excl)))
	{
		LOG_ERROR(GENERAL, "fs::file::open('%s') failed: unknown mode specified (0x%x)", filename, mode);
		return false;
	}

	m_fd = (std::intptr_t)CreateFileW(to_wchar(filename).get(), access, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, disp, FILE_ATTRIBUTE_NORMAL, NULL);
#else
	int flags = 0;

	switch (mode & (fom::read | fom::write))
	{
	case fom::read: flags |= O_RDONLY; break;
	case fom::write: flags |= O_WRONLY; break;
	case fom::read | fom::write: flags |= O_RDWR; break;
	default:
	{
		LOG_ERROR(GENERAL, "fs::file::open('%s') failed: neither fom::read nor fom::write specified (0x%x)", filename, mode);
		return false;
	}
	}

	if (mode & fom::append) flags |= O_APPEND;
	if (mode & fom::create) flags |= O_CREAT;
	if (mode & fom::trunc) flags |= O_TRUNC;
	if (mode & fom::excl) flags |= O_EXCL;

	if (((mode & fom::excl) && !(mode & fom::create)) || (mode & ~(fom::read | fom::write | fom::append | fom::create | fom::trunc | fom::excl)))
	{
		LOG_ERROR(GENERAL, "fs::file::open('%s') failed: unknown mode specified (0x%x)", filename, mode);
		return false;
	}

	m_fd = ::open(filename.c_str(), flags, 0666);
#endif

	if (m_fd == null)
	{
		LOG_WARNING(GENERAL, "fs::file::open('%s', 0x%x) failed: error 0x%llx", filename, mode, GET_API_ERROR);
		return false;
	}

	return true;
}
开发者ID:rodrigonh,项目名称:rpcs3,代码行数:78,代码来源:File.cpp


示例8: aduc702x_write_block

/* If this fn returns ERROR_TARGET_RESOURCE_NOT_AVAILABLE, then the caller can fall
 * back to another mechanism that does not require onboard RAM
 *
 * Caller should not check for other return values specifically
 */
static int aduc702x_write_block(struct flash_bank *bank,
	uint8_t *buffer,
	uint32_t offset,
	uint32_t count)
{
	struct target *target = bank->target;
	uint32_t buffer_size = 7000;
	struct working_area *write_algorithm;
	struct working_area *source;
	uint32_t address = bank->base + offset;
	struct reg_param reg_params[6];
	struct arm_algorithm arm_algo;
	int retval = ERROR_OK;

	if (((count%2) != 0) || ((offset%2) != 0)) {
		LOG_ERROR("write block must be multiple of two bytes in offset & length");
		return ERROR_FAIL;
	}

	/* parameters:

	r0 - address of source data (absolute)
	r1 - number of halfwords to be copied
	r2 - start address in flash (offset from beginning of flash memory)
	r3 - exit code
	r4 - base address of flash controller (0xFFFFF800)

	registers:

	r5 - scratch
	r6 - set to 2, used to write flash command

	*/
	static const uint32_t aduc702x_flash_write_code[] = {
		/* <_start>: */
		0xe3a05008,	/* mov	r5, #8	; 0x8 */
		0xe5845004,	/* str	r5, [r4, #4] */
		0xe3a06002,	/* mov	r6, #2	; 0x2 */
		/* <next>: */
		0xe1c421b0,	/* strh	r2, [r4, #16] */
		0xe0d050b2,	/* ldrh	r5, [r0], #2 */
		0xe1c450bc,	/* strh	r5, [r4, #12] */
		0xe5c46008,	/* strb	r6, [r4, #8] */
		/* <wait_complete>: */
		0xe1d430b0,	/* ldrh	r3, [r4] */
		0xe3130004,	/* tst	r3, #4	; 0x4 */
		0x1afffffc,	/* bne	1001c <wait_complete> */
		0xe2822002,	/* add	r2, r2, #2	; 0x2 */
		0xe2511001,	/* subs	r1, r1, #1	; 0x1 */
		0x0a000001,	/* beq	1003c <done> */
		0xe3130001,	/* tst	r3, #1	; 0x1 */
		0x1afffff3,	/* bne	1000c <next> */
		/* <done>: */
		0xeafffffe	/* b	1003c <done> */
	};

	/* flash write code */
	if (target_alloc_working_area(target, sizeof(aduc702x_flash_write_code),
			&write_algorithm) != ERROR_OK) {
		LOG_WARNING("no working area available, can't do block memory writes");
		return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
	}

	uint8_t code[sizeof(aduc702x_flash_write_code)];
	target_buffer_set_u32_array(target, code, ARRAY_SIZE(aduc702x_flash_write_code),
			aduc702x_flash_write_code);
	retval = target_write_buffer(target, write_algorithm->address, sizeof(code), code);
	if (retval != ERROR_OK)
		return retval;

	/* memory buffer */
	while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK) {
		buffer_size /= 2;
		if (buffer_size <= 256) {
			/* we already allocated the writing code, but failed to get a buffer,
			 *free the algorithm */
			target_free_working_area(target, write_algorithm);

			LOG_WARNING("no large enough working area available, can't do block memory writes");
			return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
		}
	}

	arm_algo.common_magic = ARM_COMMON_MAGIC;
	arm_algo.core_mode = ARM_MODE_SVC;
	arm_algo.core_state = ARM_STATE_ARM;

	init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
	init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);
	init_reg_param(&reg_params[2], "r2", 32, PARAM_OUT);
	init_reg_param(&reg_params[3], "r3", 32, PARAM_IN);
	init_reg_param(&reg_params[4], "r4", 32, PARAM_OUT);

	while (count > 0) {
		uint32_t thisrun_count = (count > buffer_size) ? buffer_size : count;
//.........这里部分代码省略.........
开发者ID:01org,项目名称:CODK-A-Flashpack,代码行数:101,代码来源:aduc702x.c


示例9: switch


//.........这里部分代码省略.........
			this->lastBroadcast = "";
			break;
		case OPCODE_SIMULATION_SYNCHRONIZE:
			argument = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_USER_ID);
			client = this->getClients().getClient(argument);
			instructionOut.setOpCode(OPCODE_SIMULATION_SYNCHRONIZE);
			argument = stringUtilities::unsignedToString(static_cast<unsigned>(SDL_GetTicks()));
			instructionOut.insertArgument(INSTRUCTION_ARGUMENT_KEY_CONNECTED_AT, argument);
			client->addInstruction(instructionOut);
			this->lastBroadcast = "";
			break;
		case OPCODE_DISCONNECT_FROM_SIMULATION:
			argument = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_USER_ID);
			client = this->getClients().detachClient(argument);
			client->stopClient();
			delete client;
			client = NULL;
			LOG_DEBUG("THE USER " + argument + " DISCONNECTED FROM SIMULATION");
			GameView::instance().setDisconnectedPlayer(argument);
			break;
		case OPCODE_CLIENT_COMMAND: {
			LOG_DEBUG("PROCESSING COMMAND FROM CLIENT: " + instructionIn.serialize());
			std::string userID = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_USER_ID);
			argument = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_COMMAND_DESTINATION);
			if (argument!="") {
				GameView::instance().manageMovementUpdate(userID, argument);
			}
			argument = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_COMMAND_STATE);
			if (argument!="") {
				GameView::instance().manageAnimationUpdate(userID, argument);
			}
			argument = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_COMMAND_CHANGE_WEAPON);
			if (argument!="") {
				GameView::instance().changeWeapon(userID,stringUtilities::stringToUnsigned(argument));
			}
			argument = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_COMMAND_RESTART_GAME);
			if (argument == "RESTART GAME") {
				this->numberOfRestartedClients++;
				if (numberOfRestartedClients >= GameView::instance().numberOfLoggedInPlayers()) {
					GameView::instance().restart();
					this->numberOfRestartedClients = 0;
					
					Instruction instructionOut = this->manageGeneralInitSynchronize(userID);
					instructionOut.insertArgument(INSTRUCTION_ARGUMENT_KEY_RESTART, "0");
					this->lastBroadcast = "";
					this->getClients().addBroadcast(instructionOut);
				}
			}
			else {
				if (argument == "RESTART CHARACTER") {
					Instruction instructionOut;
					instructionOut.clear();
					instructionOut.setOpCode(OPCODE_INIT_SYNCHRONIZE);
					std::string characterInit = GameView::instance().managePlayerInitialSynch(userID);
					instructionOut.insertArgument(INSTRUCTION_ARGUMENT_KEY_CHARACTER_INIT, characterInit);
					instructionOut.insertArgument(INSTRUCTION_ARGUMENT_KEY_RESTART, "1");
					client = this->getClients().getClient(userID);
					if (client)
						client->addInstruction(instructionOut);
				}
			}
			break;
		}
		case OPCODE_INIT_SYNCHRONIZE: {
			argument = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_USER_ID);
			client = this->getClients().getClient(argument);
			std::string characterType = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_CHARACTER);
			GameView::instance().addPlayer(argument, characterType);
			GameView::instance().startUpdatingPlayer(argument);
			client->setActive(true);

			client->addInstruction(this->manageInitSynchronize(argument));

			//broadcast for new players
			instructionOut.clear();
			instructionOut.setOpCode(OPCODE_CHARACTERS_SYNCHRONIZE);
			argument = GameView::instance().manageCharactersPlaying();
			instructionOut.insertArgument(INSTRUCTION_ARGUMENT_KEY_CHARACTERS_UPDATE, argument);
			this->lastBroadcast = "";
			this->getClients().addBroadcast(instructionOut);
			break;
		}
		case OPCODE_SIMULATION_UPDATE:
			break;
		case OPCODE_CONNECTION_ERROR: {
			argument = instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_USER_ID);
			LOG_ERROR("THE USER " + argument + " DISCONECTED ABRUPTLY FROM SIMULATION");
			client = this->getClients().detachClient(argument);
			if (client != NULL) {
				client->stopClient();
				delete client;
				client = NULL;
			}
			GameView::instance().setDisconnectedPlayer(argument);
			break;
		}
		default:
			LOG_WARNING("INVALID OPCODE RECEIVED FROM CLIENT " + instructionIn.getArgument(INSTRUCTION_ARGUMENT_KEY_USER_ID));
	}
}
开发者ID:hugo-chavar,项目名称:servertall,代码行数:101,代码来源:SimulationManager.cpp


示例10: main

/**
 * \brief Get the mimetype for a package
 * \param argc the number of command line arguments
 * \param argv the command line arguments
 * \return 0 on a successful program execution
 */
int main(int argc, char *argv[])
{
  int arg;
  char *Parm = NULL;
  char *Path = NULL;
  int c;
  char *agent_desc = "Determines mimetype for each file";
  int pfile_count = 0;
  int Agent_pk;
  int ars_pk = 0;

  int upload_pk = 0;           // the upload primary key
  int user_pk = 0;
  char *AgentARSName = "mimetype_ars";
  int rv;
  PGresult *result;
  char sqlbuf[1024];
  int CmdlineFlag = 0;        ///< run from command line flag, 1 yes, 0 not
  char *COMMIT_HASH;
  char *VERSION;
  char agent_rev[MAXCMD];

  /* initialize the scheduler connection */
  fo_scheduler_connect(&argc, argv, &pgConn);

  /* Process command-line */
  while((c = getopt(argc,argv,"iCc:hvV")) != -1)
  {
    switch(c)
    {
      case 'i':
        PQfinish(pgConn);
        return(0);
      case 'c':
        /* do nothing with this option */
        break;
      case 'C':
        CmdlineFlag = 1;
        break;
      case 'v':
        agent_verbose++;
        break;
      case 'V':
        printf("%s", BuildVersion);
        PQfinish(pgConn);
        return(0);
      default:
        Usage(argv[0]);
        PQfinish(pgConn);
        exit(-1);
    }
  }

  COMMIT_HASH = fo_sysconfig("mimetype", "COMMIT_HASH");
  VERSION = fo_sysconfig("mimetype", "VERSION");
  sprintf(agent_rev, "%s.%s", VERSION, COMMIT_HASH);
  /* Get the Agent Key from the DB */
  Agent_pk = fo_GetAgentKey(pgConn, basename(argv[0]), 0, agent_rev, agent_desc);

  FMimetype = fopen("/etc/mime.types","rb");
  if (!FMimetype)
  {
    LOG_WARNING("Unable to open /etc/mime.types\n");
  }

  MagicCookie = magic_open(MAGIC_PRESERVE_ATIME|MAGIC_MIME);
  if (MagicCookie == NULL)
  {
    LOG_FATAL("Failed to initialize magic cookie\n");
    PQfinish(pgConn);
    exit(-1);
  }
  if (magic_load(MagicCookie,NULL) != 0)
  {
    LOG_FATAL("Failed to load magic file: UnMagic\n");
    PQfinish(pgConn);
    exit(-1);
  }

  /* Run from the command-line (for testing) */
  for(arg=optind; arg < argc; arg++)
  {
    Akey = -1;
    memset(A,'\0',sizeof(A));
    strncpy(A,argv[arg],sizeof(A));
    DBCheckMime(A);
  }

  /* Run from scheduler! */
  if (0 == CmdlineFlag)
  {
    user_pk = fo_scheduler_userID(); /* get user_pk for user who queued the agent */

    while(fo_scheduler_next())
//.........这里部分代码省略.........
开发者ID:fossology,项目名称:fossology,代码行数:101,代码来源:mimetype.c


示例11: MojErrCheck

MojErr ConnectionManagerProxy::UpdateWANStatus(const MojObject& response)
{
	MojErr err;
	bool wanAvailable = false;
	bool updated = false;
	MojInt64 confidence = (MojInt64)ConnectionConfidenceUnknown;

	MojObject wan;
	bool found = response.get(_T("wan"), wan);
	if (found) {
		updated = m_wanRequirementCore->SetCurrentValue(wan);

		MojString wanConnected;
		found = false;
		err = wan.get(_T("state"), wanConnected, found);
		MojErrCheck(err);

		if (!found) {
			LOG_WARNING(MSGID_WAN_CONN_STATUS_UNKNOWN, 0, "WAN connection status not returned by Connection Manager");
		} else if (wanConnected == "connected") {
			MojString wanNetwork;
			found = false;
			err = wan.get(_T("network"), wanNetwork, found);
			MojErrCheck(err);

			if (!found) {
				LOG_WARNING(MSGID_WAN_NW_MODE_UNKNOWN, 0, "WAN network mode not returned by Connection Manager");
			} else if (wanNetwork != "unusable") {
				MojString onInternet;
				err = wan.get(_T("onInternet"), onInternet, found);
				MojErrCheck(err);

				if (onInternet == "yes") {
					wanAvailable = true;
					confidence = GetConfidence(wan);
				}
			}
		}
	}

	if (wanAvailable) {
		if (!m_wanRequirementCore->IsMet()) {
			LOG_DEBUG("WAN connection is now available");
			m_wanRequirementCore->Met();
			std::for_each(m_wanRequirements.begin(), m_wanRequirements.end(),
				boost::mem_fn(&Requirement::Met));
		} else if (updated) {
			std::for_each(m_wanRequirements.begin(), m_wanRequirements.end(),
				boost::mem_fn(&Requirement::Updated));
		}
	} else {
		if (m_wanRequirementCore->IsMet()) {
			LOG_DEBUG("WAN connection is no longer available");
			m_wanRequirementCore->Unmet();
			std::for_each(m_wanRequirements.begin(), m_wanRequirements.end(),
				boost::mem_fn(&Requirement::Unmet));
		}
	}

	if (m_wanConfidence != (int)confidence) {
		m_wanConfidence = (int)confidence;
		LOG_DEBUG("WAN confidence level changed to %d",
			m_wanConfidence);
		UpdateConfidenceRequirements(m_wanConfidenceCores,
			m_wanConfidenceRequirements, m_wanConfidence);
	}

	return MojErrNone;
}
开发者ID:azimut2000,项目名称:activitymanager,代码行数:69,代码来源:ConnectionManagerProxy.cpp


示例12: LOG_TRACE

/*
 *luna://com.palm.connectionmanager/getstatus
 *
 * {
 *    "isInternetConnectionAvailable" : <bool>
 *    "wifi" : {
 *        "state" : "connected"|"disconnected"
 *        "ipAddress" : <string>
 *        "ssid" : <string>
 *        "bssid" : <string>
 *    }
 *
 *    "wan" : {
 *        "state" : "connected"|"disconnected"
 *        "ipAddress" : <string>
 *        "network" : "unknown" | "unusable" | "gprs" | "edge" | "umts" ...
 *			(unusable means WAN is available but blocked due to a call)
 *	  }
 *
 * }
 */
void ConnectionManagerProxy::ConnectionManagerUpdate(MojServiceMessage *msg,
	const MojObject& response, MojErr err)
{
	LOG_TRACE("Entering function %s", __FUNCTION__);

	if (err != MojErrNone) {
		if (MojoCall::IsPermanentFailure(msg, response, err)) {
			LOG_WARNING(MSGID_UNSOLVABLE_CONN_MGR_SUBSCR_ERR, 0,
				  "Subscription to Connection Manager experienced an uncorrectable failure: %s",
				  MojoObjectJson(response).c_str());
			m_call.reset();
		} else {
			LOG_WARNING(MSGID_CONN_MGR_SUBSCR_ERR, 0,
				    "Subscription to Connection Manager failed, resubscribing: %s",MojoObjectJson(response).c_str());
			m_call->Call();
		}
		return;
	}

	LOG_DEBUG("Update from Connection Manager: %s",
		MojoObjectJson(response).c_str());

	bool isInternetConnectionAvailable = false;
	response.get(_T("isInternetConnectionAvailable"),
		isInternetConnectionAvailable);

	bool updated = m_internetRequirementCore->SetCurrentValue(response);

	if (isInternetConnectionAvailable) {
		if (!m_internetRequirementCore->IsMet()) {
			LOG_DEBUG("Internet connection is now available");
			m_internetRequirementCore->Met();
			std::for_each(m_internetRequirements.begin(),
				m_internetRequirements.end(),
				boost::mem_fn(&Requirement::Met));
		} else if (updated) {
			std::for_each(m_internetRequirements.begin(),
				m_internetRequirements.end(),
				boost::mem_fn(&Requirement::Updated));
		}
	} else {
		if (m_internetRequirementCore->IsMet()) {
			LOG_DEBUG("Internet connection is no longer available");
			m_internetRequirementCore->Unmet();
			std::for_each(m_internetRequirements.begin(),
				m_internetRequirements.end(),
				boost::mem_fn(&Requirement::Unmet));
		}
	}

	UpdateWifiStatus(response);
	UpdateWANStatus(response);

	int maxConfidence = (m_wifiConfidence > m_wanConfidence) ?
		m_wifiConfidence : m_wanConfidence;
	if (m_internetConfidence != maxConfidence) {
		m_internetConfidence = maxConfidence;
		LOG_DEBUG("Internet confidence level changed to %d",
			m_internetConfidence);
		UpdateConfidenceRequirements(m_internetConfidenceCores,
			m_internetConfidenceRequirements, m_internetConfidence);
	}
}
开发者ID:azimut2000,项目名称:activitymanager,代码行数:84,代码来源:ConnectionManagerProxy.cpp


示例13: business_entry

void
business_entry(csnet_ss_t* ss, csnet_head_t* head, char* data, int data_len) {
	LOG_DEBUG(LOG, "new so business_entry: cmd: 0x%x, head len: %d, ctxid: %ld, data len: %d",
		head->cmd, head->len, head->ctxid, data_len);

	if (head->cmd == CSNET_NOTICE_REQ) {
		struct bmin_connect_server* bm = bmin_connect_server_new(ss, head);
		if (!bm) {
			LOG_ERROR(LOG, "could not create bmin_connect_server_new");
			csnet_module_ref_decrement(CONNTOR->module);
			return;
		}
		bmin_connect_server_req(bm, ss, head, data, data_len);
		bmin_connect_server_free(bm);
		csnet_module_ref_decrement(CONNTOR->module);
		return;
	}

	if (head->cmd == csnet_echo_msg_req) {
		struct bmin_send_msg* bm = bmin_send_msg_new(ss, head);
		if (!bm) {
			LOG_ERROR(LOG, "could not create bmin_send_msg");
			csnet_module_ref_decrement(CONNTOR->module);
			return;
		}
		int64_t ctxid = bm->ctxid;
		if (csnet_ctx_insert(CTX, ctxid, bm, sizeof(*bm)) == 0) {
			LOG_DEBUG(LOG, "insert bm ctxid: %d", ctxid);
			if (bmin_send_msg_req(bm, ss, head, data, data_len) == -1) {
				LOG_ERROR(LOG, "bmin_send_msg_req() failed. ctxid: %d", ctxid);
				csnet_ctx_delete(CTX, ctxid);
				bmin_send_msg_err(bm, ss, head);
				bmin_send_msg_free(bm);
				csnet_module_ref_decrement(CONNTOR->module);
			}
		} else {
			LOG_ERROR(LOG, "could not insert to CTX, ctxid: %ld", ctxid);
			bmin_send_msg_err(bm, ss, head);
			bmin_send_msg_free(bm);
			csnet_module_ref_decrement(CONNTOR->module);
		}
		return;
	}

	if (head->cmd == csnet_echo_msg_rsp) {
		struct bmin_send_msg* bm = csnet_ctx_search(CTX, head->ctxid);
		if (!bm) {
			LOG_ERROR(LOG, "could not find bm by ctxid: %ld", head->ctxid);
			csnet_module_ref_decrement(CONNTOR->module);
			return;
		}
		int ret = bm->ops.rsp(bm, head, data, data_len);
		if (ret == 0) {
			csnet_ctx_delete(CTX, head->ctxid);
		}
		csnet_module_ref_decrement(CONNTOR->module);
		bmin_send_msg_free(bm);
		return;
	}

	LOG_WARNING(LOG, "unknown cmd: 0x%x", head->cmd);
}
开发者ID:SunshineHuang,项目名称:csnet-1,代码行数:62,代码来源:business-module.c


示例14: jtagdp_transaction_endcheck

static int jtagdp_transaction_endcheck(struct adiv5_dap *dap)
{
	int retval;
	uint32_t ctrlstat;

	/* too expensive to call keep_alive() here */

	/* Here be dragons!
	 *
	 * It is easy to be in a JTAG clock range where the target
	 * is not operating in a stable fashion. This happens
	 * for a few reasons:
	 *
	 * - the user may construct a simple test case to try to see
	 * if a higher JTAG clock works to eke out more performance.
	 * This simple case may pass, but more complex situations can
	 * fail.
	 *
	 * - The mostly works JTAG clock rate and the complete failure
	 * JTAG clock rate may be as much as 2-4x apart. This seems
	 * to be especially true on RC oscillator driven parts.
	 *
	 * So: even if calling adi_jtag_scan_inout_check_u32() multiple
	 * times here seems to "make things better here", it is just
	 * hiding problems with too high a JTAG clock.
	 *
	 * Note that even if some parts have RCLK/RTCK, that doesn't
	 * mean that RCLK/RTCK is the *correct* rate to run the JTAG
	 * interface at, i.e. RCLK/RTCK rates can be "too high", especially
	 * before the RC oscillator phase is not yet complete.
	 */

	/* Post CTRL/STAT read; discard any previous posted read value
	 * but collect its ACK status.
	 */
	retval = adi_jtag_scan_inout_check_u32(dap, JTAG_DP_DPACC,
			DP_CTRL_STAT, DPAP_READ, 0, &ctrlstat);
	if (retval != ERROR_OK)
		return retval;
	retval = jtag_execute_queue();
	if (retval != ERROR_OK)
		return retval;

	dap->ack = dap->ack & 0x7;

	/* common code path avoids calling timeval_ms() */
	if (dap->ack != JTAG_ACK_OK_FAULT) {
		long long then = timeval_ms();

		while (dap->ack != JTAG_ACK_OK_FAULT) {
			if (dap->ack == JTAG_ACK_WAIT) {
				if ((timeval_ms()-then) > 1000) {
					LOG_WARNING("Timeout (1000ms) waiting "
						"for ACK=OK/FAULT "
						"in JTAG-DP transaction - aborting");

					uint8_t ack;
					int abort_ret = jtag_ap_q_abort(dap, &ack);

					if (abort_ret != 0)
						LOG_WARNING("Abort failed : return=%d ack=%d", abort_ret, ack);

					return ERROR_JTAG_DEVICE_ERROR;
				}
			} else {
				LOG_WARNING("Invalid ACK %#x "
						"in JTAG-DP transaction",
						dap->ack);
				return ERROR_JTAG_DEVICE_ERROR;
			}

			retval = adi_jtag_scan_inout_check_u32(dap, JTAG_DP_DPACC,
					DP_CTRL_STAT, DPAP_READ, 0, &ctrlstat);
			if (retval != ERROR_OK)
				return retval;
			retval = jtag_execute_queue();
			if (retval != ERROR_OK)
				return retval;
			dap->ack = dap->ack & 0x7;
		}
	}

	/* REVISIT also STICKYCMP, for pushed comparisons (nyet used) */

	/* Check for STICKYERR and STICKYORUN */
	if (ctrlstat & (SSTICKYORUN | SSTICKYERR)) {
		LOG_DEBUG("jtag-dp: CTRL/STAT error, 0x%" PRIx32, ctrlstat);
		/* Check power to debug regions */
		if ((ctrlstat & 0xf0000000) != 0xf0000000) {
			retval = ahbap_debugport_init(dap);
			if (retval != ERROR_OK)
				return retval;
		} else {
			uint32_t mem_ap_csw, mem_ap_tar;

			/* Maybe print information about last intended
			 * MEM-AP access; but not if autoincrementing.
			 * *Real* CSW and TAR values are always shown.
			 */
			if (dap->ap_tar_value != (uint32_t) -1)
//.........这里部分代码省略.........
开发者ID:Oridorichard,项目名称:openocd_osbdm,代码行数:101,代码来源:adi_v5_jtag.c


示例15: TRI_CheckExternalProcess

TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
                                                bool wait) {
  TRI_external_status_t status;
  TRI_external_t* external = nullptr;  // Just to please the compiler
  size_t i;
  
  TRI_LockMutex(&ExternalProcessesLock);

  status._status = TRI_EXT_NOT_FOUND;
  status._exitStatus = 0;

  for (i = 0;  i < ExternalProcesses._length;  ++i) {
    external = static_cast<TRI_external_t*>(TRI_AtVectorPointer(&ExternalProcesses, i));

    if (external->_pid == pid._pid) {
      break;
    }
  }

  if (i == ExternalProcesses._length) {
    TRI_UnlockMutex(&ExternalProcessesLock);
    status._errorMessage =
      std::string("the pid you're looking for is not in our list: ") + 
      triagens::basics::StringUtils::itoa(static_cast<int64_t>(pid._pid));
    status._status = TRI_EXT_NOT_FOUND;
    LOG_WARNING("checkExternal: pid not found: %d", (int) pid._pid);

    return status;
  }

  if (external->_status == TRI_EXT_RUNNING ||
      external->_status == TRI_EXT_STOPPED) {
#ifndef _WIN32
    TRI_pid_t res;
    int opts;
    int loc = 0;

    if (wait) {
      opts = WUNTRACED;
    }
    else {
      opts = WNOHANG | WUNTRACED;
    }

    res = waitpid(external->_pid, &loc, opts);

    if (res == 0) {
      if (wait) {
        status._errorMessage =
          std::string("waitpid returned 0 for pid while it shouldn't ") + 
          triagens::basics::StringUtils::itoa(external->_pid);

        if (WIFEXITED(loc)) {
          external->_status = TRI_EXT_TERMINATED;
          external->_exitStatus = WEXITSTATUS(loc);
        }
        else if (WIFSIGNALED(loc)) {
          external->_status = TRI_EXT_ABORTED;
          external->_exitStatus = WTERMSIG(loc);
        }
        else if (WIFSTOPPED(loc)) {
          external->_status = TRI_EXT_STOPPED;
          external->_exitStatus = 0;
        }
        else {
          external->_status = TRI_EXT_ABORTED;
          external->_exitStatus = 0;
        }
      }
      else {
        external->_exitStatus = 0;
      }
    }
    else if (res == -1) {
      TRI_set_errno(TRI_ERROR_SYS_ERROR);
      LOG_WARNING("waitpid returned error for pid %d (%d): %s", 
                  (int) external->_pid,  
                  (int) wait,
                  TRI_last_error());
      status._errorMessage =
        std::string("waitpid returned error for pid ") + 
        triagens::basics::StringUtils::itoa(external->_pid) + 
        std::string(": ") +        
        std::string(TRI_last_error());
    }
    else if (static_cast<TRI_pid_t>(external->_pid) == static_cast<TRI_pid_t>(res)) {
      if (WIFEXITED(loc)) {
        external->_status = TRI_EXT_TERMINATED;
        external->_exitStatus = WEXITSTATUS(loc);
      }
      else if (WIFSIGNALED(loc)) {
        external->_status = TRI_EXT_ABORTED;
        external->_exitStatus = WTERMSIG(loc);
      }
      else if (WIFSTOPPED(loc)) {
        external->_status = TRI_EXT_STOPPED;
        external->_exitStatus = 0;
      }
      else {
        external->_status = TRI_EXT_ABORTED;
//.........这里部分代码省略.........
开发者ID:asbdzxln118,项目名称:arangodb,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOG_WINDOW函数代码示例发布时间:2022-05-30
下一篇:
C++ LOG_WARN函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap