当前位置: 首页>>代码示例>>C++>>正文


C++ DERROR函数代码示例

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


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

示例1: client_writen

int
client_writen(int fd, char *buf, size_t datalen, int timeout)
{
    size_t nleft;
    ssize_t nwritten;
    const char *ptr;

    ptr = buf;
    nleft = datalen;

    while (nleft > 0) {
        if (timeout > 0 && timeout_wait(fd, timeout, 0) == -1) {
            DERROR("write timeout\n");
            break;
        }
        if ((nwritten = write(fd, ptr, nleft)) <= 0) {
            if (nwritten < 0 && errno == EINTR) {
                nwritten = 0;
            } else {
                DERROR("writen error: %s\n", strerror(errno));
                return -1;
            }
        }

        nleft -= nwritten;
        ptr += nwritten;
    }

    return datalen-nleft;
}
开发者ID:cygsxak,项目名称:memlink,代码行数:30,代码来源:test.c

示例2: DENTRY

bool CDisplayPlane::Create(void)
{
  DENTRY();

  m_lock = g_pIOS->CreateResourceLock();
  if(!m_lock)
  {
    DERROR("failed to allocate resource lock\n");
    return false;
  }

  DEBUGF2(2,("%s: node entries = %lu \n",__PRETTY_FUNCTION__,m_ulNodeEntries));

  g_pIOS->AllocateDMAArea(&m_NodeListArea, (m_ulNodeEntries * sizeof(stm_plane_node)), 0, SDAAF_NONE);
  g_pIOS->MemsetDMAArea(&m_NodeListArea, 0, 0, m_NodeListArea.ulDataSize);
  if(!m_NodeListArea.pMemory)
  {
    DERROR("failed to allocate node list\n");
    return false;
  }

  m_pNodeList = (stm_plane_node*)m_NodeListArea.pData;

  DEXIT();

  return true;
}
开发者ID:MarkusVolk,项目名称:martii-tdt,代码行数:27,代码来源:DisplayPlane.cpp

示例3: DASSERT

void GEnv::setState(SoundCompEvent* e)
{
    DASSERT(e!=NULL);
    if(e->empty())return;
    if(e->getSize()!=sizeof(State))
    {
        DERROR("size missmatch");
        if(e->getSize() < sizeof(State))return;
	
        DERROR("trying to read...");
    }
    const State* s = (const State*)e->getData();
   
    mode->setValue(s->mode);
   
    if(mode->isPressed())
    {
        sig->setMode(EnvFollow::RMS);
    }
    else
    {
        sig->setMode(EnvFollow::PEAK);
    }
   
    per_knob->setValue(s->per);
    updatePer();
}
开发者ID:tenso,项目名称:subphonic,代码行数:27,代码来源:g_env.cpp

示例4: WaitSDStatus_Data

/**
* @brief 		SD polling stataus function when send data.
* @param 		device_id[in]: Index of SD controller.
* @param 		pollbit[in]: Polling status bit.
* @return		SP_TRUE: success, SP_FALSE: timeout or status fail.
*/
SP_BOOL WaitSDStatus_Data(
	UINT32 device_id,
	UINT32 pollbit)
{
	sdReg_t *psdReg = (sdReg_t*) SetSDBase(device_id);
	UINT32 init = jiffies;
 
	do
	{
		/* ----- SD status error ----- */
		if (psdReg->sdStatus & MASK_S_DataCRCError) 
		{
			DERROR("data SD%d CRC error, CMD = 0x%x, STATUS = 0x%x\n", device_id, psdReg->sdCmd, psdReg->sdStatus);
			return SP_FALSE;
		}
		/* ----- Timeout ----- */
		if((jiffies-init)>=DATA_TIMEOUT)
		{
			DERROR("data SD%d timeout, CMD = 0x%x, STATUS = 0x%x\n", device_id, psdReg->sdCmd, psdReg->sdStatus);
			return SP_FALSE;
		}
	} while((psdReg->sdStatus & pollbit)!=pollbit);
	
	return SP_TRUE;
}
开发者ID:danelledeano,项目名称:VTech-InnoTab,代码行数:31,代码来源:hal_sd.c

示例5: test_sl_range

int test_sl_range(TestArgs *args)
{
    MemLink *m;
    int ret, i;

    DINFO("====== sl_range ======\n");
    if (args->longconn) {
        m = memlink_create(args->host, args->rport, args->wport, args->timeout);
        if (NULL == m) {
            DERROR("memlink_create error!\n");
            exit(-1);
            return -1;
        }
        for (i = 0; i < args->testcount; i++) {
            MemLinkResult   result;
            ret = memlink_cmd_rpop(m, args->table, args->key, args->len, &result);
            if (ret != MEMLINK_OK) {
                DERROR("range error! ret:%d\n", ret);
                return -2;
            }
            if (result.count != args->len) {
                DERROR("rpop result count error: %d, len:%d\n", result.count, args->len);
            }
            memlink_result_free(&result);
        }
        memlink_destroy(m);


    } else {
    }

    return 0;
}
开发者ID:cygsxak,项目名称:memlink,代码行数:33,代码来源:perf.c

示例6: sdialog_call

// execute dialog in a child process, leave it running
///////////////////////////////////////////////////////////////////////////////////////////
pid_t sdialog_call(const char* path,const char* msg)
{
    pid_t pid;

	DPRINTF("sdialog_call/fork\n");
    if((pid=fork())<0)
	{
		DERROR("sdialog_call/fork");
        return 0L;
    }

    if(pid==0)
	{
		DPRINTF("sdialog_call: in child\n");
		DPRINTF("sdialog_call: DISPLAY=%s\n",getenv("DISPLAY"));
       	umask(0);
		chdir("/");
		DPRINTF("call_dialog: about to exec %s\n",path);
		execlp(path,path,msg,(char*)0);
		DERROR("sdialog_call/execlp");
		exit(1);
    }

	DPRINTF("sdialog_call: child PID=%d\n",pid);
    return pid;
}
开发者ID:Andhr3y,项目名称:dcfd-mw-applet,代码行数:28,代码来源:single_dialog.c

示例7: client_readn

int
client_readn(int fd, char *buf, int datalen, int timeout)
{
    size_t nleft;
    ssize_t nread;
    char *ptr;

    ptr = buf;
    nleft = datalen;

    while (nleft > 0) {
        if (timeout > 0 && timeout_wait(fd, timeout, 1) == -1) {
            DERROR("read timeout\n");
            break;
        }
        if ((nread = read(fd, ptr, nleft)) == -1) {
            if (errno == EINTR) {
                nread = 0;
            } else {
                DERROR("readn error: %s\n", strerror(errno));
                return -1;
            }
        } else if (nread == 0) {
            DERROR("read 0, conn cloes\n");
            break;
        }
        nleft -= nread;
        ptr += nread;
    }

    return datalen-nleft;
}
开发者ID:cygsxak,项目名称:memlink,代码行数:32,代码来源:test.c

示例8: switch_master

//备切换成主
int 
switch_master(int voteid, char *data, int datalen)
{
    WThread    *wt = g_runtime->wthread;
    MasterInfo *minfo = wt->master_info;

    if (g_cf->role == ROLE_MASTER) {
        DERROR("master can not switch to master\n");
        return -1;
    } else if (g_cf->role == ROLE_BACKUP) {
        DINFO("backup switch to master\n");
        if (minfo != NULL) {
            //销毁备上面以前保存得主节点得信息
            event_del(&minfo->hb_timer_evt);
            event_del(&minfo->hbevt);
            if (minfo->hbsock > 0)
                close(minfo->hbsock);
            minfo->hbsock = -1;
            wt->master_info = NULL;
            
            zz_free(minfo);
            //构建主节点上得备节点信息
            master_init(voteid, data, datalen);
            if (wt->clog->state == INCOMPLETE) {
                int ret;
                int cmdlen;
                char *cmd = commitlog_get_cmd(wt->clog, &cmdlen);

                pthread_mutex_lock(&g_runtime->mutex);
                ret = wdata_apply(cmd, cmdlen, MEMLINK_NO_LOG, NULL);
                DINFO("===wdata_apply ret: %d\n", ret);
                if ( ret == 0) {
                    int sret;

                    sret = synclog_write(g_runtime->synclog, wt->clog->data, wt->clog->len);
                    if (sret < 0) {
                        DERROR("synclog_write error: %d\n", sret);
                        MEMLINK_EXIT;
                    }   
                    char *cmd;
                    int  cmdlen;

                    cmd = commitlog_get_cmd(wt->clog, &cmdlen);
                    sret = syncmem_write(g_runtime->syncmem, cmd, cmdlen, 
                        g_runtime->synclog->version, g_runtime->synclog->index_pos - 1); 
                    if (sret < 0) {
                        DERROR("syncmem_write error: %d\n", sret);
                        MEMLINK_EXIT;
                    }   
                }
                pthread_mutex_unlock(&g_runtime->mutex);
            }
        } else {
            DERROR("master info is null, can not switch\n");
            return -3;
        }
    }
    return 0; 
}
开发者ID:cygsxak,项目名称:memlink,代码行数:60,代码来源:master.c

示例9: storage_license_check

int storage_license_check()
{
        int ret, now, retry = 0, free_limit = 0;
        long capacity;
        uint32_t createtime;
	struct stat buf;
        char license[MAX_PATH_LEN];

#if 0
        return 0;
#endif

	if (cluster_is_solomode())
		return 0;

retry:
        ret = storage_get_createtime(&createtime);
        if (ret) {
                if (ret == EAGAIN) {
                        SLEEP_RETRY(err_ret, ret, retry, retry);
                } else
                        GOTO(err_ret, ret);
        }

        now = time(NULL);
        snprintf(license, MAX_PATH_LEN, "%s/license", gloconf.home);
        ret = stat(license, &buf);
        if (!ret) {
                if ((buf.st_size == 0) && (now - createtime <= FREE_LICENSE)) {
                        return 0;
                }
        }

        ret = license_check(gloconf.home, &capacity, free_limit);
        if (ret) {
                if (ret == ENOENT) {
                        if (now - createtime > FREE_LICENSE) {
                                DERROR("No license found.\n");
                        }
                        else
                                return 0;
                } else if (ret == ETIME) {
                        DERROR("License expired.\n");
                } else if (ret == ENOSPC) {
                        DERROR("Excess capacity.\n");
                } else {
                        DERROR("Invalid license.\n");
                }

                exit(EACCES);
        }

        return 0;
err_ret:
        return ret;
}
开发者ID:spawn3,项目名称:python-util,代码行数:56,代码来源:license.c

示例10: _smi_free_int_scidesc

/* mark interrupt slot as unused, close descriptor if all slots are unused */
void _smi_free_int_scidesc(smi_sci_desc_t* pDesc, sci_error_t* pError) 
{  
    smi_sci_desc_list_t* pTemp;
    
    SMI_LOCK(&sdMutex);
    
    pTemp = **pDesc;
   
    switch(pTemp->ltype) {
    case sd_rmtlocfree:
	/* descriptor becomes unused => will be completely removed */
	sd_node_remove(*pDesc);
	rs_SCIClose(pTemp->sd,0,pError);
	free(pTemp);	
	break;
    case sd_locintfree:
    case sd_rmtintfree:
    case sd_intfree:
	DERROR("internal list-structure error");
	SMI_Abort(-1);
	break;
    case sd_full:
	/* descriptor now has a free interrupt slot */
	sd_node_remove(*pDesc);
	pTemp->ltype = sd_intfree;
	pTemp->pIntRef = NULL;	
	sd_node_push_front(&pIntListRoot, pTemp);
	*pError = SCI_ERR_OK;
	break;
    case sd_locfree:
	/* descriptor now has a free interrupt and local slot */
	sd_node_remove(*pDesc);
	pTemp->ltype = sd_locintfree;
	pTemp->pIntRef = NULL;	
	sd_node_push_front(&pLocIntListRoot, pTemp);
	*pError = SCI_ERR_OK;
	break;
    case sd_rmtfree:
	/* descriptor now has a free interrupt and remote slot */
	sd_node_remove(*pDesc);
	pTemp->ltype = sd_rmtintfree;
	pTemp->pIntRef = NULL;	
	sd_node_push_front(&pRmtIntListRoot, pTemp);
	*pError = SCI_ERR_OK;
	break;
    default:
       	DERROR("internal list-structure error (invalid type)");
	SMI_Abort(-1);
    }

    /* invalidate the given descriptor */
    *pDesc = NULL;

    SMI_UNLOCK(&sdMutex);
}
开发者ID:carsten-clauss,项目名称:MP-MPICH,代码行数:56,代码来源:sci_desc.c

示例11: gp_sdcard_write_scatter

/**
* @brief 	SD card write function with scatter list.
* @param 	sd[in]: Card information.
* @param 	sector[in]: Start sector.
* @param 	sg[in]: Scatter list pointer.
* @param 	ln[in]: List number.
* @return 	Actual sectors by reading/ERROR_ID(<0).
*/
int gp_sdcard_write_scatter(gpSDInfo_t * sd, unsigned int sector, struct scatterlist *sg, unsigned int ln)
{
	int i;
	struct scatterlist *sg_ev;
	int ret = 0;
	int sector_num = 0;
#ifdef USE_DMA	
	unsigned sgln;
	sgln = dma_map_sg(NULL, sg, ln, DMA_TO_DEVICE);
	if(sgln!=ln)
	{
		dma_unmap_sg(NULL, sg, sgln, DMA_TO_DEVICE);
		DERROR("[%d]: SG map fail, sgln = %d, ln = %d\n", sd->device_id, sgln, ln);
		return -ENOMEM;
	}
#endif	
	if(gp_sdcard_writecmd(sd->device_id,sector)==SP_FALSE)
	{
		ret = -EIO;
		goto out_error;
	}
	DEBUG("SD: write sector %d\n", sector);
	
	for_each_sg(sg, sg_ev, ln, i) 
	{
		unsigned int number = sg_dma_len(sg_ev)>>9;
		/* ----- Start dma ----- */ 
	#ifdef USE_DMA
		if(gp_sdcard_dma_en(sd->device_id, (unsigned char*)sg_phys(sg_ev), sg_dma_len(sg_ev),1)==SP_FALSE)
	#else
		if(gp_sdcard_dma_en(sd->device_id, (unsigned char*)sg_virt(sg_ev), sg_dma_len(sg_ev),1)==SP_FALSE)
	#endif
		{
			ret = -ENOMEM;
			DERROR("[%d]:DMA Enable error\n", sd->device_id);
			goto out_error;
		}
		/* ----- Wait dma finish ----- */
		ret = gp_sdcard_dma_finish(sd->device_id, (sg_dma_len(sg_ev)>>9)*WRITE_TIMEOUT);
		if(ret!=0)
		{
			gp_apbdma0_stop(sd->handle_dma);
			DERROR("[%d]:DMA error: %d, SD status 0x%x\n", sd->device_id, ret,gpHalSDGetStatus(sd->device_id));
			goto out_error;
		}
	#ifdef USE_DMA	
		if(gpHalSDWaitDataComplete(sd->device_id) == SP_FALSE)
		{
			DERROR("[%d]: wait complete error: SD status 0x%x\n", sd->device_id, gpHalSDGetStatus(sd->device_id));
			ret = -ETIMEDOUT;
			goto out_error;
		}
	#endif
		sector_num += number;
	}
开发者ID:WayWingsDev,项目名称:Gplus_2159_0801,代码行数:63,代码来源:gp_sd_core.c

示例12: master_init

int
master_init(int voteid, char *data, int datalen)
{
    int ret;
    WThread *wt = g_runtime->wthread;
    
    wt->clog = commitlog_create();
    g_cf->role = ROLE_MASTER;
    
    wt->backup_info = (BackupInfo *)zz_malloc(sizeof(BackupInfo));

    
    DNOTE("============I am the master\n");
    if (wt->backup_info == NULL) {
        DERROR("malloc BackupInfo struct error\n");
        MEMLINK_EXIT;
    }

    memset(wt->backup_info, 0x0, sizeof(BackupInfo));

    BackupInfo *binfo = wt->backup_info;
    g_runtime->servernums = 1;
    g_runtime->voteid = voteid;
    binfo->timer_send = FALSE;

    int  count = 0;
    char ip[16] = {0};
    uint16_t port;

    DINFO("datalen : %d\n", datalen);
    while (count < datalen) {
        ret = unpack_votehost(data + count, ip, &port);
        DINFO("ip: %s port: %d\n", ip, port);
        count += ret;
        BackupItem *bitem = (BackupItem *)zz_malloc(sizeof(BackupItem));
        if (bitem == NULL) {
            DERROR("malloc BackupItem struct error\n");
            MEMLINK_EXIT;
        }
        memset(bitem, 0x0, sizeof(BackupItem));
        strcpy(bitem->ip, ip);
        bitem->write_port = port;
        DINFO("backup ip, port: %s:%d\n", ip, port);
        bitem->next = binfo->item;
        binfo->item = bitem;
        g_runtime->servernums++;
    }

    master_create_heartbeat(wt);
    //初始化backupinfo结构
    ret = master_connect_backup_all(wt);
    return 0;
}
开发者ID:cygsxak,项目名称:memlink,代码行数:53,代码来源:master.c

示例13: test_move

int test_move(TestArgs *args)
{
    MemLink *m;
    int ret, i;
    char value[512] = {0};
    int valint = atoi(args->value);
    char format[64];

    DINFO("====== move ======\n");
    sprintf(format, "%%0%dd", args->valuesize);

    if (args->longconn) {
        m = memlink_create(args->host, args->rport, args->wport, args->timeout);
        if (NULL == m) {
            DERROR("memlink_create error!\n");
            exit(-1);
            return -1;
        }
        for (i = 0; i < args->testcount; i++) {
            sprintf(value, format, valint);
            ret = memlink_cmd_move(m, args->table, args->key, value, args->valuesize, args->pos);
            if (ret != MEMLINK_OK) {
                DERROR("move error! ret:%d, table:%s key:%s,value:%s,pos:%d\n",
                       ret, args->table, args->key, value, args->pos);
                return -2;
            }
            valint++;
        }
        memlink_destroy(m);
    } else {
        for (i = 0; i < args->testcount; i++) {
            m = memlink_create(args->host, args->rport, args->wport, args->timeout);
            if (NULL == m) {
                DERROR("memlink_create error!\n");
                exit(-1);
                return -1;
            }
            sprintf(value, format, valint);
            ret = memlink_cmd_move(m, args->table, args->key, value, args->valuesize, args->pos);
            if (ret != MEMLINK_OK) {
                DERROR("move error! ret:%d, table:%s key:%s,value:%s,pos:%d\n",
                       ret, args->table, args->key, value, args->pos);
                return -2;
            }
            valint++;
            memlink_destroy(m);
        }
    }

    return 0;
}
开发者ID:cygsxak,项目名称:memlink,代码行数:51,代码来源:perf.c

示例14: vote_destroy

void
vote_destroy(Conn *conn)
{
    VoteConn *vconn = (VoteConn *)conn;

    if (conn->rbuf)
        zz_free(conn->rbuf);
    event_del(&conn->evt);
    set_linger(conn->sock);
    close(conn->sock);



    if (vconn->vote_status == VOTE_TIMEOUT) {
        DERROR("*** VOTE TIMEOUT, TRY AGAIN\n");
        vconn->vote_status = VOTE_CONTINUE;
    } else if (vconn->vote_status == VOTE_REQUEST || vconn->vote_status == VOTE_WAITING) {
        /*
                if (g_cf->role == ROLE_NONE) {
                    DERROR("*** VOTE REQUEST TRY AGAIN\n");
                    vconn->status = VOTE_CONTINUE;
                } else {
        */
        DERROR("*** VOTE ABNORMAL ERROR/HOST INVALID\n");
        vconn->vote_status = VOTE_CONTINUE;
        /*
                    g_cf->role = ROLE_NONE;
                    g_runtime->voteid = 0;
                    zz_free(vconn);
                    return;
                }
        */
    } else if (vconn->vote_status == VOTE_ERR_PARAM) {
        DERROR("*** VOTE PARAM ERROR\n");
        g_cf->role = ROLE_NONE;
        g_runtime->voteid = 0;
        zz_free(vconn);
        return;
    }

    if (vconn->vote_status == VOTE_CONTINUE) {
        DINFO("*** VOTE CONTINUE\n");
        request_vote(vconn->id, vconn->idflag, vconn->voteid, vconn->wport);
        zz_free(vconn);
        return;
    }
    DINFO("*** VOTE OK\n");

    zz_free(vconn);
}
开发者ID:cygsxak,项目名称:memlink,代码行数:50,代码来源:vote.c

示例15: main

int main(int argc, char **argv)
{
#ifdef DEBUG
    logfile_create("test.log", 3);
#endif
    char *conffile = "memlink.conf";
    MemPool *mp;
    MemItem *item_100;
    MemItem *item_10;

    myconfig_create(conffile);
    my_runtime_create_common("memlink");
    mp = g_runtime->mpool;

    item_100 = (MemItem *)zz_malloc(sizeof(MemItem));
    memset(item_100, 0x0, sizeof(MemItem));

    item_10 = (MemItem *)zz_malloc(sizeof(MemItem));
    memset(item_10, 0x0, sizeof(MemItem));

    DataBlock *dbk;
    int i;
    for (i = 0; i < 100; i++) {
        dbk = mempool_get(mp, 100 + sizeof(DataBlock));
        dbk->next = item_100->data;
        item_100->data = dbk;
    }

    for (i = 0; i < mp->used; i++) {
        if (mp->freemem[i].memsize == 100 + sizeof(DataBlock)) {
            break;
        }
    }
    if (i == mp->used) {
        DERROR("i == mp->used\n"); 
        return -1;
    }
    if (mp->freemem[i].total != 100) {
        DERROR("mp->freemem[i].total != 100\n");
        return -1;
    }
    if (mp->freemem[i].block_count != 0) {
        DERROR("mp->freemem[i].block_count != 0\n");
        return -1;
    }

    return 0;
}
开发者ID:cygsxak,项目名称:memlink,代码行数:48,代码来源:mem_test.c


注:本文中的DERROR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。