本文整理汇总了C++中LOGMSG函数的典型用法代码示例。如果您正苦于以下问题:C++ LOGMSG函数的具体用法?C++ LOGMSG怎么用?C++ LOGMSG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOGMSG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: arch_bfdInit
static bool arch_bfdInit(pid_t pid, bfd_t * bfdParams)
{
char fname[PATH_MAX];
snprintf(fname, sizeof(fname), "/proc/%d/exe", pid);
if ((bfdParams->bfdh = bfd_openr(fname, 0)) == NULL) {
LOGMSG(l_ERROR, "bfd_openr(%s) failed", fname);
return false;
}
if (!bfd_check_format(bfdParams->bfdh, bfd_object)) {
LOGMSG(l_ERROR, "bfd_check_format() failed");
return false;
}
int storage_needed = bfd_get_symtab_upper_bound(bfdParams->bfdh);
if (storage_needed <= 0) {
LOGMSG(l_ERROR, "bfd_get_symtab_upper_bound() returned '%d'", storage_needed);
return false;
}
if ((bfdParams->syms = (asymbol **) malloc(storage_needed)) == NULL) {
LOGMSG_P(l_ERROR, "malloc(%d) failed", storage_needed);
return false;
}
bfd_canonicalize_symtab(bfdParams->bfdh, bfdParams->syms);
if ((bfdParams->section = bfd_get_section_by_name(bfdParams->bfdh, ".text")) == NULL) {
LOGMSG(l_ERROR, "bfd_get_section_by_name('.text') failed");
return false;
}
return true;
}
示例2: arch_prepareParent
bool arch_prepareParent(honggfuzz_t * hfuzz)
{
if (!hfuzz->pid) {
return true;
}
#define MAX_THREAD_IN_TASK 4096
int tasks[MAX_THREAD_IN_TASK + 1];
tasks[MAX_THREAD_IN_TASK] = 0;
if (!arch_listThreads(tasks, MAX_THREAD_IN_TASK, hfuzz->pid)) {
LOGMSG(l_ERROR, "Couldn't read thread list for pid '%d'", hfuzz->pid);
return false;
}
for (int i = 0; i < MAX_THREAD_IN_TASK && tasks[i]; i++) {
if (ptrace(PT_ATTACH, tasks[i], NULL, NULL) == -1) {
LOGMSG_P(l_ERROR, "Couldn't ptrace() ATTACH to pid: %d", tasks[i]);
return false;
}
int status;
while (waitpid(tasks[i], &status, WUNTRACED | __WALL) != tasks[i]) ;
if (ptrace(PT_CONTINUE, tasks[i], NULL, NULL) == -1) {
LOGMSG_P(l_ERROR, "Couldn't ptrace() CONTINUE pid: %d", tasks[i]);
ptrace(PT_DETACH, tasks[i], 0, SIGCONT);
return false;
}
LOGMSG(l_INFO, "Successfully attached to pid/tid: %d", tasks[i]);
}
return true;
}
示例3: InterpretException
// interpret exception processed by Utils::HandleException:
// filter out some errors like invalid db - users don't want to
// see such errors as actual errors
int InterpretException ( int64_t rcCodeUtil, bool bSilent, char const* szErrDesc )
{
if ( rcCodeUtil == Utils::rcUnknown ||
rcCodeUtil == Utils::rcErrorStdExc ||
rcCodeUtil == Utils::rcInvalid)
{
if ( ! bSilent )
LOGMSG ( klogErr, szErrDesc );
return 3;
}
else if (rcCodeUtil == SILENT_RC( rcDB,rcMgr,rcOpening,rcDatabase,rcIncorrect ) ||
rcCodeUtil == SILENT_RC( rcVFS,rcTree,rcResolving,rcPath,rcNotFound ))
{
if ( ! bSilent )
LOGMSG ( klogWarn, szErrDesc );
return 0;
}
else
{
if ( ! bSilent )
LOGMSG ( klogErr, szErrDesc );
return 3;
}
}
示例4: LOGMSG
int cRawWriter::Put(eStreamId StreamId, uint64_t StreamPos,
const uchar *Data, int DataCount)
{
if (Running() && StreamId == sidVdr) {
// Serialize Put access to keep Data and Header together
LOCK_THREAD;
if (m_RingBuffer.Free() < DataCount) {
if (m_BufferOverflows++ > MAX_OVERFLOWS_BEFORE_DISCONNECT) {
LOGMSG("cXinelibServer: Too many TCP buffer overflows, dropping client");
m_RingBuffer.Clear();
Cancel(-1);
return 0;
}
return -DataCount;
}
int n = m_RingBuffer.Put(Data, DataCount);
if (n == DataCount) {
m_BufferOverflows = 0;
m_PutPos += n;
return n;
}
LOGMSG("cXinelibServer: TCP buffer internal error ?!?");
m_RingBuffer.Clear();
Cancel(-1);
}
return 0;
}
示例5: arch_ptraceEvent
static void arch_ptraceEvent(honggfuzz_t * hfuzz, fuzzer_t * fuzzer, int status, pid_t pid)
{
unsigned long event_msg;
if (ptrace(PTRACE_GETEVENTMSG, pid, NULL, &event_msg) == -1) {
LOGMSG(l_ERROR, "ptrace(PTRACE_GETEVENTMSG,%d) failed", pid);
return;
}
LOGMSG(l_DEBUG, "PID: %d, Ptrace event: %d, event_msg: %ld", pid, __WEVENT(status), event_msg);
switch (__WEVENT(status)) {
case PTRACE_EVENT_EXIT:
if (WIFEXITED(event_msg)) {
LOGMSG(l_DEBUG, "PID: %d exited with exit_code: %d", pid, WEXITSTATUS(event_msg));
if (WEXITSTATUS(event_msg) == HF_MSAN_EXIT_CODE) {
arch_ptraceSaveData(hfuzz, pid, fuzzer);
}
} else if (WIFSIGNALED(event_msg)) {
LOGMSG(l_DEBUG, "PID: %d terminated with signal: %d", pid, WTERMSIG(event_msg));
} else {
LOGMSG(l_DEBUG, "PID: %d exited with unknown status: %ld", pid, event_msg);
}
break;
default:
break;
}
ptrace(PT_CONTINUE, pid, 0, 0);
return;
}
示例6: _remove_phone
static void _remove_phone(const char* phoneno)
{
phone_entry_t* entry;
phone_entry_t* prev = NULL;
//TODO: mutex protection of calling function
entry = G_phoneBook.head;
while(entry && strcmp(entry->phoneNo, phoneno)) {
prev = entry;
entry = entry->next;
}
if (entry == NULL) {
LOGMSG(LOG_LEVEL_WARN, "Could not found registered phone no %s. Has been removed or un-registered ?\n", phoneno);
return;
}
if (prev == NULL) {
G_phoneBook.head = entry->next;
} else {
prev->next = entry->next;
}
//Delete this number
delete_phone_entry(&entry);
G_phoneBook.size--;
LOGMSG(LOG_LEVEL_INFO, "Remove phone no %s success.\n", phoneno);
}
示例7: parse_phonebook
static gn_error parse_phonebook(char *text)
{
cJSON *root;
root = cJSON_Parse(text);
if (!root) {
LOGMSG(LOG_LEVEL_CRIT, "Error before: [%s]\n",cJSON_GetErrorPtr());
return GN_ERR_FAILED;
}
cJSON* phonebook = cJSON_GetObjectItem(root,"phonebook");
if (!phonebook) {
LOGMSG(LOG_LEVEL_CRIT, "Error: could not read phonebook object\n");
return GN_ERR_FAILED;
}
int i;
for (i = 0;i < cJSON_GetArraySize(phonebook);i++)
{
cJSON *phoneItem = cJSON_GetArrayItem(phonebook,i);
// handle subitem.
LOGMSG(LOG_LEVEL_DEBUG, "item #%d: name=%s phone=%s\n",i,
cJSON_GetObjectItem(phoneItem, "name")->valuestring,
cJSON_GetObjectItem(phoneItem, "phone")->valuestring);
_add_phone(cJSON_GetObjectItem(phoneItem, "name")->valuestring,
cJSON_GetObjectItem(phoneItem, "phone")->valuestring);
}
cJSON_Delete(root);
return GN_ERR_NONE;
}
示例8: BufferQPopBuffer
rc_t BufferQPopBuffer (BufferQ * self, const Buffer ** buff, timeout_t * tm)
{
rc_t rc = 0;
timeout_t t;
void * p;
LOGMSG (klogDebug10, "BufferQPopBuffer");
assert (self != NULL);
assert (buff != NULL);
if (tm == NULL)
{
LOGMSG (klogDebug10, "BufferQPopBuffer tm was NULL");
tm = &t;
rc = TimeoutInit (tm, self->timeout);
}
if (rc == 0)
{
LOGMSG (klogDebug10, "BufferQPopBuffer call KQueuePop");
rc = KQueuePop (self->q, &p, tm);
PLOGMSG (klogDebug10, "BufferQPopBuffer back from KQueuePop $(rc)", PLOG_U32(rc), rc);
if (rc == 0)
*buff = p;
else
{
*buff = NULL;
}
}
LOGMSG (klogDebug10, "leave BufferQPopBuffer");
return rc;
}
示例9: LOGMSG
LRESULT CWindowCredentials::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if ( (false == iSplashLaunched) && (::GetFocus() == m_hWnd) )
{
LOGMSG("launching splash!!!");
WindowsManager::GetInstnace()->ShowWindow( EWndSplash );
::SetFocus( WindowsManager::GetInstnace()->GetWindow( EWndSplash )->m_hWnd );
LOGMSG("Launched...");
iSplashLaunched = true;
}
if ( TRUE == this->IsWindowVisible() )
{
bHandled = FALSE;
}
//SHMENUBARINFO mbi;
//ZeroMemory(&mbi, sizeof(SHMENUBARINFO));
//mbi.cbSize = sizeof(SHMENUBARINFO);
//mbi.hwndParent = m_hWnd;
//mbi.nToolBarId = 201;
//mbi.hInstRes = ModuleHelper::GetResourceInstance();
//mbi.dwFlags = SHCMBF_HMENU;
//SHCreateMenuBar( &mbi );
//bHandled = TRUE;
return 0;
}
示例10: announce4
struct bt_announce4_reply* announce4(struct bt_announce4_request *request) {
#if 0
/* TODO: check if connection_id is known */
/* replace 0 (default) ip with the real ip address */
if(ip==0) {
ip = cliAddr.sin_addr.s_addr;
}
/* convert info_hash and peer_id to hex so that they are printable */
info_hash_hex = strToHexStr(info_hash,20);
peer_id_hex = strToHexStr(peer_id,20);
LOGMSG(LOG_DEBUG,"Connection ID: %lld",connection_id);
LOGMSG(LOG_DEBUG,"Info Hash: %s Peer ID: %s",info_hash_hex, peer_id_hex);
LOGMSG(LOG_DEBUG,"Downloaded: %lld Left: %lld Uploaded: %lld",downloaded,left,uploaded);
LOGMSG(LOG_DEBUG,"Event: %uNumber of Peers wanted: %u",event, num_want);
/* TODO: if authentication extension is activated check if auth correct */
/* check if peer has already announced */
int announced = has_peer_announced_in_past(info_hash_hex,peer_id_hex);
/* update entry if peer has announced already */
update_database4(info_hash_hex,peer_id_hex,downloaded,uploaded,left,ip,key,port,announced);
/* delet old peers from database */
delete_old_entries(interval);
/* Get number of seeders and leechers */
seeders_and_leechers(info_hash_hex,&seeders,&leechers);
/* get data of the peers from the database */
Peer *peers;
peers = get_peer_data4(&num_peers,info_hash_hex,num_want);
#endif
return NULL;
}
示例11: arch_ptraceAttach
bool arch_ptraceAttach(pid_t pid)
{
#define MAX_THREAD_IN_TASK 4096
int tasks[MAX_THREAD_IN_TASK + 1];
tasks[MAX_THREAD_IN_TASK] = 0;
if (!arch_listThreads(tasks, MAX_THREAD_IN_TASK, pid)) {
LOGMSG(l_ERROR, "Couldn't read thread list for pid '%d'", pid);
return false;
}
for (int i = 0; i < MAX_THREAD_IN_TASK && tasks[i]; i++) {
if (ptrace
(PTRACE_SEIZE, tasks[i], NULL,
PTRACE_O_TRACECLONE | PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORK | PTRACE_O_TRACEEXIT) ==
-1) {
LOGMSG_P(l_ERROR, "Couldn't ptrace(PTRACE_SEIZE) to pid: %d", tasks[i]);
return false;
}
LOGMSG(l_DEBUG, "Successfully attached to pid/tid: %d", tasks[i]);
}
for (int i = 0; i < MAX_THREAD_IN_TASK && tasks[i]; i++) {
ptrace(PT_CONTINUE, tasks[i], NULL, NULL);
}
return true;
}
示例12: db_Delete_comm_link
// 删除链路配置信息
defGSReturn CCommLinkManager::Cfg_Delete( const defLinkID LinkID )
{
db_Delete_comm_link( LinkID );
Relation_DeleteForLink( LinkID );
struDelCommLink delobj;
delobj.delts = timeGetTime();
//defmapCommLinkCfg::const_iterator it = this->m_CfgList.find(LinkID);
defmapCommLinkCfg::iterator it = this->m_CfgList.find(LinkID);
if( it != this->m_CfgList.end() )
{
it->second->enable = 0;
delobj.cfgobj = it->second;
m_CfgList.erase(it);
LOGMSG( "CommLinkMgr:CfgList Del LinkID=%d, aftercount(%d)", LinkID, m_CfgList.size() );
}
delobj.runobj = Run_Remove( LinkID );
{
gloox::util::MutexGuard mutexguard( m_mutex_CommLinkMgr );
m_DeleteList.push_back( delobj );
}
LOGMSG( "CommLinkMgr:DeleteList insert LinkID=%d, aftercount(%d)", LinkID, m_DeleteList.size() );
return defGSReturn_Success;
}
示例13: G_SpawnMap
void G_SpawnMap( g_map_t *map, char *path )
{
//
// load classes
//
SHV_Printf( " ... planes\n" );
map->planehm = G_MapTryClassLoad( path, MAP_CLASS_NAME_PLANES );
SHV_Printf( " ... mapnodes\n" );
map->mapnodehm = G_MapTryClassLoad( path, MAP_CLASS_NAME_MAPNODES );
SHV_Printf( " ... texdefs\n" );
map->texdefhm = G_MapTryClassLoad( path, MAP_CLASS_NAME_TEXDEFS );
SHV_Printf( " ... textures\n" );
map->texturehm = G_MapTryClassLoad( path, MAP_CLASS_NAME_TEXTURES );
SHV_Printf( " ... visleafs\n" );
map->visleafhm = G_MapTryClassLoad( path, MAP_CLASS_NAME_VISLEAFS );
SHV_Printf( " ... blockmap brushes\n" );
map->blockmaphm = G_MapTryClassLoad( path, MAP_CLASS_NAME_BLOCKMAP );
SHV_Printf( " ... shapes\n" );
map->shapehm = G_MapTryClassLoad( path, MAP_CLASS_NAME_SHAPES );
if ( !map->planehm )
__error( "plane class load failed.\n" );
if ( !map->mapnodehm )
__error( "mapnode class load failed.\n" );
if ( !map->texdefhm )
__error( "texdef class load failed.\n" );
if ( !map->texturehm )
__error( "texture class loaf failed.\n" );
if ( !map->visleafhm )
__error( "visleaf class load failed.\n" );
if ( !map->blockmaphm )
__error( "blockmap class load failed.\n" );
if ( !map->shapehm )
__error( "shape class load failed.\n" );
#if 0
LOGMSG( " volume map ...\n" );
map->volume_ccmap3 = G_MapTryCCMap3Load( path, MAP_CCMAP3_NAME_VOLUME );
LOGMSG( " field map ...\n" );
map->field_ccmap3 = G_MapTryCCMap3Load( path, MAP_CCMAP3_NAME_FIELD );
if ( !map->volume_ccmap3 )
__warning( "volume binary load failed.\n" );
if ( !map->field_ccmap3 )
__warning( "field binary load failed.\n" );
#endif
}
示例14: db_phone_store
gn_error db_phone_store(void)
{
char *begin = strdup(BEGIN_PHONE);
char *end = strdup(END_PHONE);
int fd;
char buffer[256];
int len;
snprintf(buffer, sizeof(buffer), "%s.encode", PHONE_FILENAME_BUFFER);
LOGMSG(LOG_LEVEL_INFO, "Will save phonebook to file %s\n", buffer);
fd = open(buffer, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
if (fd < 0) {
LOGMSG(LOG_LEVEL_CRIT, "Could not open file %s for saving phonebook\n", buffer);
goto out;
}
//Reset key
reset_key();
encode(begin, strlen(BEGIN_PHONE));
if (safe_write(fd, begin, strlen(BEGIN_PHONE))) {
LOGMSG(LOG_LEVEL_CRIT, "Write fail. Could not save phonebook\n");
goto out;
}
phone_entry_t* entry = G_phoneBook.head;
while(entry) {
if (entry->next) {
len = snprintf(buffer, sizeof(buffer), "{\"name\": \"%s\", \"phone\": \"%s\"},\n",
entry->name, entry->phoneNo);
} else {
len = snprintf(buffer, sizeof(buffer), "{\"name\": \"%s\", \"phone\": \"%s\"}\n",
entry->name, entry->phoneNo);
}
encode(buffer, len);
if (safe_write(fd, buffer, len)) {
LOGMSG(LOG_LEVEL_CRIT, "Write fail. Could not save phonebook\n");
goto out;
}
entry = entry->next;
}
encode(end, strlen(END_PHONE));
if (safe_write(fd, end, strlen(END_PHONE))) {
LOGMSG(LOG_LEVEL_CRIT, "Write fail. Could not save phonebook\n");
goto out;
}
out:
if (fd >= 0) {
close(fd);
}
free(begin);
free(end);
return GN_ERR_NONE;
}
示例15: scrape
char* scrape(int* sbufLen,uint64_t connection_id, uint32_t transaction_id, char msg[],int msgLen) {
/* TODO: check if connection_id and transaction_id is known */
int action = 2;
int request_num;
request_num =(msgLen-16)/20;
LOGMSG(LOG_DEBUG,"Number of Requested Hashes: %u",request_num);
*sbufLen = 8+request_num*12;
char* sbuffer = malloc(*sbufLen);
#ifdef LITTLE_ENDIAN
action = bswap_32(action);
transaction_id = bswap_32(transaction_id);
#endif
memcpy(sbuffer,&action,4);
memcpy(sbuffer+4,&transaction_id,4);
#if 0
while(request_num--) {
char info_hash[20];
char* info_hash_hex;
memcpy(info_hash,msg+16+request_num*20,20);
info_hash_hex = strToHexStr(info_hash,20);
LOGMSG(LOG_DEBUG," Info-Hash: %s",info_hash_hex);
int complete,downloaded,incomplete;
/* TODO: number of total downloads is missing
EVENT "complete" in announce has to be saved */
seeders_and_leechers(info_hash_hex,&downloaded,&incomplete);
complete = 0;
LOGMSG(LOG_DEBUG," Down: %u Incomp: %u",downloaded, incomplete);
#ifdef LITTLE_ENDIAN
complete = bswap_32(complete);
downloaded = bswap_32(downloaded);
incomplete = bswap_32(incomplete);
#endif
memcpy(sbuffer+8+request_num*12,&complete,4);
memcpy(sbuffer+12+request_num*12,&downloaded,4);
memcpy(sbuffer+16+request_num*12,&incomplete,4);
}
return sbuffer;
#endif
return NULL;
}