コード例 #1
0
ファイル: sinsp.cpp プロジェクト: respi-chan/sysdig
void sinsp::open(string filename)
{
	char error[SCAP_LASTERR_SIZE];

	m_islive = false;

	if(filename == "")
	{
		open();
		return;
	}

	g_logger.log("starting offline capture");

	m_h = scap_open_offline((char *)filename.c_str(), error);

	if(m_h == NULL)
	{
		throw sinsp_exception(error);
	}

	m_filename = filename;

	init();
}
コード例 #2
0
ファイル: sinsp.cpp プロジェクト: ldegio/sysdig
void sinsp::open(string filename)
{
	char error[SCAP_LASTERR_SIZE];

	m_islive = false;

	if(filename == "")
	{
		open();
		return;
	}

	g_logger.log("starting offline capture");

	m_h = scap_open_offline(filename.c_str(), error);

	if(m_h == NULL)
	{
		throw sinsp_exception(error);
	}

	//
	// gianluca: This might need to be replaced with
	// a portable stat(), since I'm afraid that on S3
	// (that we'll use in the backend) the seek will
	// read the entire file anyway
	//
	FILE* fp = fopen(filename.c_str(), "rb");
	if(fp)
	{
		fseek(fp, 0L, SEEK_END);
		m_filesize = ftell(fp);
		fclose(fp);
	}

	init();
}