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

C++ ERROR_EXIT函数代码示例

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

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



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

示例1: main

int main()
{
#if defined(USE_DBC)
   psocMemoryFile  mem;
   psocErrorHandler errorHandler;
   bool ok;
   psocMemoryFileStatus status;
   
   /* The rename is a work around for a bug on Windows. It seems that the 
    * delete call (unlink) is not as synchroneous as it should be...
    */
   rename( "MemFile.mem", "MemFile.old" );
   unlink( "MemFile.old" );

   psocInitErrorDefs();
   psocInitErrorHandler( &errorHandler );
   psocInitMemoryFile( &mem, 10, "MemFile.mem" );

   ok = psocCreateBackstore( &mem, 0644, &errorHandler );
   if ( ok != true ) {
      ERROR_EXIT( expectedToPass, &errorHandler, unlink( "MemFile.mem" ) );
   }
   
   mem.initialized = 0;
   psocBackStoreStatus( &mem, &status );

   ERROR_EXIT( expectedToPass, NULL, unlink( "MemFile.mem" ) );
#else
   return 1;
#endif
}
开发者ID:dprevost,项目名称:photon,代码行数:31,代码来源:BackStatusInvalidSig.c


示例2: DEBUG_PRINTF

PdaDebugReturnCode
PciDevice_deleteDMABuffer
(
    PciDevice *device,
    DMABuffer *buffer
)
{
    DEBUG_PRINTF(PDADEBUG_ENTER, "");

    if(device == NULL)
    { ERROR_EXIT( EINVAL, exit, "Invalid pointer!\n" ); }

    if(buffer == NULL)
    { ERROR_EXIT( EINVAL, exit, "Invalid pointer!\n" ); }

    if(buffer == device->dma_buffer_list)
    {
        DMABuffer *head = NULL;
        if(DMABuffer_getNext(buffer, &head) != PDA_SUCCESS)
        { ERROR_EXIT( EINVAL, exit, "get_next failed!\n" ); }

        device->dma_buffer_list = head;
    }

    RETURN(DMABuffer_free(buffer, PDA_DELETE));

exit:
    RETURN(EINVAL);
}
开发者ID:cbm-fles,项目名称:pda,代码行数:29,代码来源:pci.c


示例3: main

int main()
{
#if defined(USE_DBC)
   psocMemoryFile  mem;
   psocErrorHandler errorHandler;
   bool ok;
   
   /* The rename is a work around for a bug on Windows. It seems that the delete
    * call is not as synchroneous as it should be...
    */
   rename( "MemFile.mem", "MemFile.old" );
   unlink( "MemFile.old" );
   
   psocInitErrorDefs();
   psocInitErrorHandler( &errorHandler );
   psocInitMemoryFile( &mem, 10, "MemFile.mem" );

   ok = psocCreateBackstore( &mem, 0755, &errorHandler );
   if ( ok != true ) {
      ERROR_EXIT( expectedToPass, &errorHandler, unlink( "MemFile.mem" ) );
   }
   
   ok = psocOpenMemFile( &mem, NULL, &errorHandler );

   unlink( "MemFile.mem" );
   
   psocFiniMemoryFile( &mem );
   psocFiniErrorHandler( &errorHandler );
   psocFiniErrorDefs();

   ERROR_EXIT( expectedToPass, NULL, unlink( "MemFile.mem" ) );
#else
   return 1;
#endif
}
开发者ID:dprevost,项目名称:photon,代码行数:35,代码来源:OpenAddrNull.c


示例4: file_ReadFileEnd

/* Read a SW filemark, verify that it is a SW filemark, then skip to the next
 * HW filemark. If the read of the SW filemark shows it's an EOF, then
 * ignore that the SW filemark is not there and return 0 (found the SW filemark
 * missing with some 3.1 dumps).
 */
static afs_int32
file_ReadFileEnd(struct butm_tapeInfo *info)
{
    afs_int32 code = 0;
    afs_int32 blockType;

    if (info->debug)
	printf("butm: Read filemark end\n");

    POLL();
    info->error = 0;

    code = check(info, READ_OP);
    if (code)
	ERROR_EXIT(code);
    if (!READS || WRITES)
	ERROR_EXIT(BUTM_BADOP);

    info->status &= ~BUTM_STATUS_EOF;

    code = ReadTapeBlock(info, tapeBlock, &blockType);
    if (code)
	ERROR_EXIT(code);

    if ((blockType != BLOCK_FMEND) && (blockType != BLOCK_EOF))
	ERROR_EXIT(BUTM_BADBLOCK);

  error_exit:
    return code;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:35,代码来源:file_tm.c


示例5: CALLOC

/* -------------------------------------------------------- */
BOT* ircBOT_new	(const char *nick, const char *pwd) {
    /* -------------------------------------------------------- */
    int x = 0;
    BOT *bot 	= (BOT*) CALLOC(1, sizeof(BOT));
    if(bot) {
        if(!nick)
            ERROR_EXIT("ircBOT_new: Error no NICK!!!\n");
        bot->nick 			= strdup(nick);
        if(pwd)
            bot->pwd 		= strdup(pwd);
        else
            bot->pwd 		= NULL;
        bot->srv.state 		= IRC_SYS_NEEDCONNECT;
        bot->srv.sendbuf	= NULL;
        bot->cmd_handler 	= LIST_new();
        bot->tee_handler 	= LIST_new();
        for(x=0; x<MAX_TIMER; x++)
            bot->timer[x].id = -1;
    }
    /* add this bot to the global ones */
    if(!all_bots)
        all_bots = LIST_new();
    if(!LIST_add(all_bots, bot))
        ERROR_EXIT("ircBOT_new: Error adding bot to global BOT-List!!\n");
    DEBUG("BOT with nick '%s' created.\n", bot->nick);
    return bot;
};
开发者ID:BackupTheBerlios,项目名称:ircbot,代码行数:28,代码来源:ircBOT.c


示例6: file_WriteEODump

/*
 * Write the end-of-dump marker.
 */
static afs_int32
file_WriteEODump(struct butm_tapeInfo *info)
{
    afs_int32 code = 0;

    if (info->debug)
	printf("butm: Write filemark EOD\n");

    POLL();
    info->error = 0;

    code = check(info, WRITE_OP);
    if (code)
	ERROR_EXIT(code);
    if (READS || WRITES)
	ERROR_EXIT(BUTM_BADOP);

    code = WriteTapeBlock(info, tapeBlock, BUTM_BLOCKSIZE, BLOCK_EOD);
    if (code)
	ERROR_EXIT(code);

    info->status |= BUTM_STATUS_EOD;

  error_exit:
    return (code);
}
开发者ID:bagdxk,项目名称:openafs,代码行数:29,代码来源:file_tm.c


示例7: main

int main()
{
	pid_t pid;
	int fd;
	char buff[BUFF_SIZE];

	if (-1 == (fd = open("/tmp/ipc", O_CREAT | O_RDWR, 0777)))
		ERROR_EXIT("pipe");

	pid = fork();
	if (0 == pid) { /* child */	
		memset(buff, 0, BUFF_SIZE);
		if (0 >= read(fd, buff, BUFF_SIZE))
			ERROR_EXIT("read");
		printf("read: %s\n", buff);
	}else if (0 < pid) {	/* father */
		sleep(1);
		strcpy(buff, "helloworld");
		if (0 >= write(fd, buff, strlen(buff)))
			ERROR_EXIT("write");
		printf("write: %s\n", buff);
	}

	exit(EXIT_SUCCESS);
	return 0;
}
开发者ID:chuandong,项目名称:C-code,代码行数:26,代码来源:file_ipc.c


示例8: priv_sock_recv_str

void priv_sock_recv_str(int fd, char *buf, int len)
{
	int rlen = priv_sock_recv_int(fd);
	if (rlen > len)
		ERROR_EXIT("priv_sock_recv_str");
	if (readn(fd, buf, rlen) != rlen)
		ERROR_EXIT("priv_sock_recv_str");
}
开发者ID:dcant,项目名称:zftp,代码行数:8,代码来源:privsock.c


示例9: evtchn_bind_pirq

static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
{
    struct evtchn *chn;
    struct domain *d = current->domain;
    struct vcpu   *v = d->vcpu[0];
    struct pirq   *info;
    int            port, pirq = bind->pirq;
    long           rc;

    if ( (pirq < 0) || (pirq >= d->nr_pirqs) )
        return -EINVAL;

    if ( !is_hvm_domain(d) && !irq_access_permitted(d, pirq) )
        return -EPERM;

    spin_lock(&d->event_lock);

    if ( pirq_to_evtchn(d, pirq) != 0 )
        ERROR_EXIT(-EEXIST);

    if ( (port = get_free_port(d)) < 0 )
        ERROR_EXIT(port);

    chn = evtchn_from_port(d, port);

    info = pirq_get_info(d, pirq);
    if ( !info )
        ERROR_EXIT(-ENOMEM);
    info->evtchn = port;
    rc = (!is_hvm_domain(d)
          ? pirq_guest_bind(v, info,
                            !!(bind->flags & BIND_PIRQ__WILL_SHARE))
          : 0);
    if ( rc != 0 )
    {
        info->evtchn = 0;
        pirq_cleanup_check(info, d);
        goto out;
    }

    chn->state  = ECS_PIRQ;
    chn->u.pirq.irq = pirq;
    link_pirq_port(port, chn, v);

    bind->port = port;

#ifdef CONFIG_X86
    if ( is_hvm_domain(d) && domain_pirq_to_irq(d, pirq) > 0 )
        map_domain_emuirq_pirq(d, pirq, IRQ_PT);
#endif

 out:
    spin_unlock(&d->event_lock);

    return rc;
}
开发者ID:Kylinux,项目名称:XenKylinx,代码行数:56,代码来源:event_channel.c


示例10: file_WriteFileData

/* Writes data out in block sizes of 16KB. Does destroy the data.
 * Assumes the data buffer has a space reserved at beginning for a blockMark.
 */
static afs_int32
file_WriteFileData(struct butm_tapeInfo *info, char *data, afs_int32 blocks, afs_int32 len)
{
    afs_int32 code = 0;
    int length;
    afs_int32 b;
    char *bstart;		/* Where block starts for a 16K block */
    char *dstart;		/* Where data  starts for a 16K block */

    if (info->debug)
	printf("butm: Write tape data - %u bytes\n", len);

    POLL();
    info->error = 0;

    code = check(info, WRITE_OP);
    if (code)
	ERROR_EXIT(code);
    if (!data || (len < 0))
	ERROR_EXIT(BUTM_BADARGUMENT);
    if (READS || !WRITES)
	ERROR_EXIT(BUTM_BADOP);

    b = 0;			/* start at block 0 */
    while (len > 0) {
	dstart = &data[b * BUTM_BLKSIZE];
	bstart = dstart - sizeof(struct blockMark);

	if (len < BUTM_BLKSIZE) {
	    memset(&dstart[len], 0, BUTM_BLKSIZE - len);
	    length = len;
	} else {
	    length = BUTM_BLKSIZE;
	}

	code = WriteTapeBlock(info, bstart, length, BLOCK_DATA);

	len -= length;

	/* If there are more blocks, step to next block */
	/* Otherwise, copy the data to beginning of last block */

	if (b < (blocks - 1))
	    b++;
	else if (len)
	    memcpy(&dstart[0], &dstart[BUTM_BLKSIZE], len);
    }

  error_exit:
    return (code);
}
开发者ID:bagdxk,项目名称:openafs,代码行数:54,代码来源:file_tm.c


示例11: main

int main()
{
   psocMemoryFile  mem;
   psocErrorHandler errorHandler;
   void *          pAddr = NULL;
   bool ok;
#if ! defined(WIN32)
   struct sigaction newAction, oldAction;
#endif

   /* The rename is a work around for a bug on Windows. It seems that the delete
    * call is not as synchroneous as it should be...
    */
   rename( "MemFile.mem", "MemFile.old" );
   unlink( "MemFile.old" );
   
   psocInitErrorDefs();
   psocInitErrorHandler( &errorHandler );
   psocInitMemoryFile( &mem, 10, "MemFile.mem" );

   ok = psocCreateBackstore( &mem, 0755, &errorHandler );
   if ( ok != true ) {
      ERROR_EXIT( expectedToPass, &errorHandler, unlink( "MemFile.mem" ) );
   }
   
   ok = psocOpenMemFile( &mem, &pAddr, &errorHandler );
   if ( ok != true ) {
      ERROR_EXIT( expectedToPass, &errorHandler, unlink( "MemFile.mem" ) );
   }
   
   ok = psocSetReadOnly( &mem, &errorHandler );
   if ( ok != true ) {
      ERROR_EXIT( expectedToPass, &errorHandler, unlink( "MemFile.mem" ) );
   }
   
   /* This should crash the whole thing. We intercept it with a signal.
    * This way, if there is no memory violation, we will know.
    */
#if defined(WIN32)
   signal(SIGSEGV, signalHandler );
#else
   newAction.sa_handler = signalHandler;
   newAction.sa_flags   = SA_RESTART;
   sigaction( SIGSEGV, &newAction, &oldAction );
#endif

   ((char*)pAddr)[0] = 'x';
   ((char*)pAddr)[1] = 'y';

   ERROR_EXIT( expectedToPass, NULL, unlink( "MemFile.mem" ) );
}
开发者ID:dprevost,项目名称:photon,代码行数:51,代码来源:ReadOnlyTryWrite.c


示例12: file_SeekEODump

/*
 * Seek to the EODump (end-of-dump) after the given position. This is
 * the position after the EOF filemark immediately after the EODump mark.
 * This is for tapes of version 4 or greater.
 */
static afs_int32
file_SeekEODump(struct butm_tapeInfo *info, afs_int32 position)
{
    afs_int32 code = 0;
    afs_int32 blockType;
    afs_int32 w;
    struct progress *p;
    afs_int64 stopOff;	/* file seek offsets */

    if (info->debug)
	printf("butm: Seek to end-of-dump\n");
    info->error = 0;

    code = check(info, READ_OP);
    if (code)
	ERROR_EXIT(code);
    if (READS || WRITES)
	ERROR_EXIT(BUTM_BADOP);

    if (isafile) {
	p = (struct progress *)info->tmRock;
	w = USD_SEEK(p->fid, 0, SEEK_END, &stopOff);
	if (w) {
	    info->error = w;
	    ERROR_EXIT(BUTM_POSITION);
	}

	if (stopOff % BUTM_BLOCKSIZE)
	    ERROR_EXIT(BUTM_POSITION);
	info->position = (stopOff / BUTM_BLOCKSIZE);
    } else {
	/* Seek to the desired position */
	code = SeekFile(info, (position - info->position) + 1);
	if (code)
	    ERROR_EXIT(code);

	/*
	 * Search until the filemark is an EODump filemark.
	 * Skip over volumes only.
	 */
	while (1) {
	    code = ReadTapeBlock(info, tapeBlock, &blockType);
	    if (code)
		ERROR_EXIT(code);

	    if (blockType == BLOCK_EOD)
		break;
	    if (blockType != BLOCK_FMBEGIN)
		ERROR_EXIT(BUTM_BADBLOCK);

	    code = SeekFile(info, 1);	/* Step forward to next volume */
	    if (code)
		ERROR_EXIT(code);
	}
	code = 0;
    }

  error_exit:
    return (code);
}
开发者ID:bagdxk,项目名称:openafs,代码行数:65,代码来源:file_tm.c


示例13: main

int main()
{
   psocMemoryFile  mem;
   psocErrorHandler errorHandler;
   void*           pAddr = NULL;
   bool ok;
   
   /* The rename is a work around for a bug on Windows. It seems that the delete
    * call is not as synchroneous as it should be...
    */
   rename( "MemFile.mem", "MemFile.old" );
   unlink( "MemFile.old" );
   
   psocInitErrorDefs();
   psocInitErrorHandler( &errorHandler );
   psocInitMemoryFile( &mem, 10, "MemFile.mem" );

   ok = psocCreateBackstore( &mem, 0755, &errorHandler );
   if ( ok != true ) {
      ERROR_EXIT( expectedToPass, &errorHandler, unlink( "MemFile.mem" ) );
   }
   
   ok = psocOpenMemFile( &mem, &pAddr, &errorHandler );
   if ( ok != true ) {
      ERROR_EXIT( expectedToPass, &errorHandler, unlink( "MemFile.mem" ) );
   }
   
   psocCloseMemFile( &mem, &errorHandler );
   
   if ( mem.fileHandle != PSO_INVALID_HANDLE ) {
      ERROR_EXIT( expectedToPass, NULL, unlink( "MemFile.mem" ) );
   }
   if ( mem.baseAddr   != PSO_MAP_FAILED ) {
      ERROR_EXIT( expectedToPass, NULL, unlink( "MemFile.mem" ) );
   }

#if defined (WIN32)
   if ( mem.mapHandle != PSO_INVALID_HANDLE ) {
      ERROR_EXIT( expectedToPass, NULL, unlink( "MemFile.mem" ) );
   }
#endif

   unlink( "MemFile.mem" );
   
   psocFiniMemoryFile( &mem );
   psocFiniErrorHandler( &errorHandler );
   psocFiniErrorDefs();

   return 0;
}
开发者ID:dprevost,项目名称:photon,代码行数:50,代码来源:ClosePass.c


示例14: evtchn_bind_pirq

static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
{
    struct evtchn *chn;
    struct domain *d = current->domain;
    struct vcpu   *v = d->vcpu[0];
    int            port, pirq = bind->pirq;
    long           rc;

    if ( (pirq < 0) || (pirq >= d->nr_pirqs) )
        return -EINVAL;

    if ( !is_hvm_domain(d) && !irq_access_permitted(d, pirq) )
        return -EPERM;

    spin_lock(&d->event_lock);

    if ( d->pirq_to_evtchn[pirq] != 0 )
        ERROR_EXIT(-EEXIST);

    if ( (port = get_free_port(d)) < 0 )
        ERROR_EXIT(port);

    chn = evtchn_from_port(d, port);

    d->pirq_to_evtchn[pirq] = port;
    rc = (!is_hvm_domain(d)
          ? pirq_guest_bind(
              v, pirq, !!(bind->flags & BIND_PIRQ__WILL_SHARE))
          : 0);
    if ( rc != 0 )
    {
        d->pirq_to_evtchn[pirq] = 0;
        goto out;
    }

    chn->state  = ECS_PIRQ;
    chn->u.pirq.irq = pirq;
    link_pirq_port(port, chn, v);

    bind->port = port;

    if ( is_hvm_domain(d) && domain_pirq_to_irq(d, pirq) > 0 )
        map_domain_emuirq_pirq(d, pirq, IRQ_PT);

 out:
    spin_unlock(&d->event_lock);

    return rc;
}
开发者ID:Angel666,项目名称:android_hardware_intel,代码行数:49,代码来源:event_channel.c


示例15: mapnode_new

mapnode_t *
mapnode_new()
{
	mapnode_t *ptr;

	ptr = calloc(1, sizeof(mapnode_t));
	if (!ptr)
		ERROR_EXIT();

	ptr->adj = calloc(1, sizeof(struct adj_st));
	if (!ptr->adj)
		ERROR_EXIT();

	return ptr;
}
开发者ID:mtmiron,项目名称:lich,代码行数:15,代码来源:render.c


示例16: evtchn_bind_ipi

static long evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
{
    struct evtchn *chn;
    struct domain *d = current->domain;
    int            port, vcpu = bind->vcpu;
    long           rc = 0;

    if ( (vcpu < 0) || (vcpu >= ARRAY_SIZE(d->vcpu)) ||
         (d->vcpu[vcpu] == NULL) )
        return -ENOENT;

    spin_lock(&d->evtchn_lock);

    if ( (port = get_free_port(d)) < 0 )
        ERROR_EXIT(port);

    chn = evtchn_from_port(d, port);
    chn->state          = ECS_IPI;
    chn->notify_vcpu_id = vcpu;

    bind->port = port;

 out:
    spin_unlock(&d->evtchn_lock);

    return rc;
}
开发者ID:mikesun,项目名称:xen-cow-checkpointing,代码行数:27,代码来源:event_channel.c


示例17: priv_sock_recv_int

int priv_sock_recv_int(int fd)
{
	int r;
	if (readn(fd, &r, sizeof(r)) != sizeof(r))
		ERROR_EXIT("readn");
	return r;
}
开发者ID:dcant,项目名称:zftp,代码行数:7,代码来源:privsock.c


示例18: handle_ftpcmd

void handle_ftpcmd(session_t *sess)
{
	char buf[MAXCMD] = {0};
	sprintf(buf, "Welcome to zftp!\r\n%d", FTP_READY);
	ftp_cmdio_write_m(sess->ctrl_fd, FTP_READY, buf);
	while (1) {
		start_signal_alarm_ctrl();
		_reset_session_cmd(sess);

		int ret = ftp_cmdio_get_cmd_args(sess->ctrl_fd, sess->ftp_cmd_line,
			MAXCMD);
		if (ret == -1) {
			if (errno == EINTR)
				continue;
			ERROR_EXIT("ftp_cmdio_get_cmd_args");
		} else if (ret == 0)
			exit(0);

		str_trim_crlf(sess->ftp_cmd_line);
		str_split(sess->ftp_cmd_line, sess->ftp_cmd_op,
			sess->ftp_cmd_arg, ' ');
		str_toupper(sess->ftp_cmd_op);

		_handle_map(sess);
	}
}
开发者ID:dcant,项目名称:zftp,代码行数:26,代码来源:process.c


示例19: getGeo

 /// implements Element::getGeo
 virtual int getGeo(GeoIndex i) const override
 {
   switch (i)
   {
   case VERTEX:
   case PARTS:
   case NEIGH:
     return 4;
     break;
   case EDGE:
     return 6;
   case FACE:
     return 4;
   case CENTER:
     return 1;
     break;
   case DIMEN:
     return 3;
     break;
   case BOUNDARY:
     return 14;
     break;
   case PROJECTION:
     return 10;
     break;
   default:
     ERROR_EXIT("invalid geo-index\n");
     return 0;
   }
 }
开发者ID:spraetor,项目名称:amdis2,代码行数:31,代码来源:Tetrahedron.hpp


示例20: rewindFile

static afs_int32
rewindFile(struct butm_tapeInfo *info)
{
    struct progress *p;
    afs_int32 code = 0;
    afs_int32 error;

    p = (struct progress *)info->tmRock;

    POLL();

    error = Rewind(p->fid);

    POLL();

    if (error) {
	info->status |= BUTM_STATUS_SEEKERROR;
	ERROR_EXIT(BUTM_IOCTL);
    }

    info->position = (isafile ? 0 : 1);
    info->kBytes = info->nBytes = 0;
    info->nFiles = info->nRecords = 0;
    p->reading = p->writing = 0;

  error_exit:
    if (error)
	info->error = error;
    return (code);
}
开发者ID:bagdxk,项目名称:openafs,代码行数:30,代码来源:file_tm.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ERROR_LOG函数代码示例发布时间:2022-05-30
下一篇:
C++ ERROR_CHECK函数代码示例发布时间: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