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

C++ pexit函数代码示例

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

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



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

示例1: gl_load_texture_raw

// load a 256x256 RGB .RAW file as a texture
// http://www.nullterminator.net/gltexture.html
GLuint gl_load_texture_raw(const char * filename, u_int width, u_int height, u_int alpha) {
  char* data;
  FILE* file;

  printf("loading raw texture [%s]\n", filename);

  // open texture data
  file = fopen(filename, "rb");
  if ( file == NULL ) return 0;

  // allocate buffer
  //  width = 256;
  //  height = 256;
  width = 512;
  height = 512;

  data = (char*)  malloc(width * height * (alpha ? 4 : 3));
  if (data == NULL)
    pexit(errno, "gl_load_texture_raw: can't allocate space for image data");

  // read texture data
  fread(data, width * height * (alpha ? 4 : 3), 1, file );
  fclose(file);

  return gl_load_texture_from_data(data, 512, 512, (alpha ? 4 : 3));
}
开发者ID:piotrm0,项目名称:progs,代码行数:28,代码来源:gl_util.c


示例2: linkproc

/*
 *  this is the body for all kproc's
 */
static void
linkproc(void)
{
	spllo();
	up->kpfun(up->kparg);
	pexit("kproc exiting", 0);
}
开发者ID:Earnestly,项目名称:plan9,代码行数:10,代码来源:arch.c


示例3: printf

void *merge(void *hnd, c4snet_data_t *OutFile, c4snet_data_t *Result,
            int X, c4snet_data_t *Out, int N, int B, int K, int J, int I)
{
    const int   P = N / B;

    if (verbose) {
        printf("%s: %p, %p, X=%d, %p, N=%d, B=%d, (%d, %d, %d)\n",
                __func__, OutFile, Result, X, Out, N, B, K, J, I);
    }
    if (compute) {
        c4snet_data_t **result = C4SNetGetData(Result);
        assert(result[J + I * P] == NULL);
        result[J + I * P] = Out;
    }
    if (X > 1) {
        C4SNetOut(hnd, 1, OutFile, Result, X - 1);
    }
    else if (compute) {
        struct timespec end;
        if (clock_gettime(CLOCK_REALTIME, &end)) {
            pexit("clock_gettime");
        }
        printf("Time for size %d x %d : %lf sec\n", N, N, delta_time(begin, end));
        write_matrix(Result, N, B, OutFile);
        C4SNetOut(hnd, 2, C4SNetCreate(CTYPE_char, 5, "Done."));
        C4SNetFree(OutFile);
        C4SNetFree(Result);
    }
    return hnd;
}
开发者ID:gijsbers,项目名称:cholesky,代码行数:30,代码来源:deboxes.c


示例4: get_block

/* Read a block. */
void
get_block(block_t n, void *buf)
{
  ssize_t k;

  /* First access returns a zero block */
  if (read_and_set(n) == 0) {
	memcpy(buf, zero, block_size);
	return;
  }
  if (lseek64(fd, mul64u(n, block_size), SEEK_SET, NULL) == (off_t)(-1))
	pexit("get_block couldn't seek");
  k = read(fd, buf, block_size);
  if (k != block_size)
	pexit("get_block couldn't read block #%u", (unsigned)n);
}
开发者ID:ChaosJohn,项目名称:minix,代码行数:17,代码来源:mkfs.c


示例5: main

int
main() {
  logInfo("Parent", "creating child");

  switch (fork()) {
    case -1:
      pexit("fork");
      break;

    case 0:
      /* child code: give a chance for parent finish itself (very basic means of
       * process synchronization */
      logInfo("Child", "child created, waiting parent to finish");
      sleep(5);

      char msg[BUFSIZ];
      snprintf(msg, BUFSIZ, "parent PID = %ld", (long) getppid());

      logInfo("Child", msg);
      break;

    default:
      /* parent: nothing to do but finish */
      logInfo("Parent", "finishing up");
      exit(EXIT_SUCCESS);
  }

  /* only child should get to this point */
  exit(EXIT_SUCCESS);
}
开发者ID:rmascarenhas,项目名称:lpi,代码行数:30,代码来源:dead_parent_init.c


示例6: toggle_lock_cursor

void toggle_lock_cursor(tile* t) {
  u_int r;
  u_int new_lock = cursor_lock;

  if (NULL == t)
    pexit(EFAULT, "lock_cursor: got NULL tile");

  r = get_robot_at(t);

  switch(cursor_lock) {
  case CURSOR_LOCK_NONE:
    if (ROBOT_NONE != r) {
      new_lock = CURSOR_LOCK_ROBOT;
      cursor_lock_robot = r;
    } else {
      printf("nothing to lock onto\n");
    }
    break;
  case CURSOR_LOCK_ROBOT:
    if ((ROBOT_NONE == r) ||
	(cursor_lock_robot == r)) {
      //      place_robot(cursor_lock_robot, t);
      new_lock = CURSOR_LOCK_NONE;
      cursor_lock_robot = ROBOT_NONE;
      compile_robots();
    } else {
      printf("can't place a robot over another robot\n");
    }
    break;
  }
  cursor_lock = new_lock;
}
开发者ID:piotrm0,项目名称:progs,代码行数:32,代码来源:t1.c


示例7: sysexits

uintptr
sysexits(va_list list)
{
	char *status;
	char *inval = "invalid exit string";
	char buf[ERRMAX];

	status = va_arg(list, char*);
	if(status != nil){
		if(waserror())
			status = inval;
		else{
			validaddr((uintptr)status, 1, 0);
			if(vmemchr(status, 0, ERRMAX) == 0){
				memmove(buf, status, ERRMAX);
				buf[ERRMAX-1] = 0;
				status = buf;
			}
			poperror();
		}

	}
	pexit(status, 1);
	return 0;	/* not reached */
}
开发者ID:Nurb432,项目名称:plan9front,代码行数:25,代码来源:sysproc.c


示例8: main

int
main(int argc, char *argv[]) {
  int fd, newfd;
  int numWritten;
  Bool useDup2;

  if (argc < 2 || argc > 3) {
    helpAndLeave(argv[0], EXIT_FAILURE);
  }

  fd = (int) atol(argv[1]);
  newfd = -1; /* if not using dup2, this variable will not be used */

  if (argc == 3) {
    useDup2 = TRUE;
    newfd = (int) atol(argv[2]);
  } else {
    useDup2 = FALSE;
  }

  newfd = duplicate(fd, newfd, useDup2);

  numWritten = write(newfd, writeStr, sizeof(writeStr));
  if (numWritten == -1) {
    pexit("write");
  }

  safeClose(fd);
  safeClose(newfd);

  printf("Done. Written %d bytes to the new file descriptor #%d\n", numWritten, newfd);

  return EXIT_SUCCESS;
}
开发者ID:rmascarenhas,项目名称:lpi,代码行数:34,代码来源:dup_dup2.c


示例9: vt6102lproc

static void
vt6102lproc(void* arg)
{
	Ctlr *ctlr;
	Ether *edev;
	MiiPhy *phy;

	edev = arg;
	ctlr = edev->ctlr;
	for(;;){
		if(ctlr->mii == nil || ctlr->mii->curphy == nil)
			break;
		if(miistatus(ctlr->mii) < 0)
			goto enable;

		phy = ctlr->mii->curphy;
		ilock(&ctlr->clock);
		if(phy->fd)
			ctlr->cr |= Fdx;
		else
			ctlr->cr &= ~Fdx;
		csr16w(ctlr, Cr, ctlr->cr);
		iunlock(&ctlr->clock);
enable:
		ctlr->lwakeup = 0;
		vt6102imr(ctlr, Srci);

		ctlr->lsleep++;
		sleep(&ctlr->lrendez, vt6102wakeup, &ctlr->lwakeup);

	}
	pexit("vt6102lproc: done", 1);
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:33,代码来源:ethervt6102.c


示例10: loopbackread

static void
loopbackread(void *a)
{
	Ipifc *ifc;
	Block *bp;
	LB *lb;

	ifc = a;
	lb = ifc->arg;
	lb->readp = up;	/* hide identity under a rock for unbind */
	if(waserror()){
		lb->readp = 0;
		pexit("hangup", 1);
	}
	for(;;){
		bp = qbread(lb->q, Maxtu);
		if(bp == nil)
			continue;
		ifc->in++;
		if(!canrlock(ifc)){
			freeb(bp);
			continue;
		}
		if(waserror()){
			runlock(ifc);
			nexterror();
		}
		if(ifc->lifc == nil)
			freeb(bp);
		else
			ipiput4(lb->f, ifc, bp);
		runlock(ifc);
		poperror();
	}
}
开发者ID:8l,项目名称:inferno,代码行数:35,代码来源:loopbackmedium.c


示例11: insert_bit

/* Insert one bit into the bitmap */
void
insert_bit(block_t map, bit_t bit)
{
  int boff, w, s;
  unsigned int bits_per_block;
  block_t map_block;
  bitchunk_t *buf;

  buf = alloc_block();

  bits_per_block = FS_BITS_PER_BLOCK(block_size);
  map_block = map + bit / bits_per_block;
  if (map_block >= inode_offset)
	pexit("insertbit invades inodes area - this cannot happen");
  boff = bit % bits_per_block;

  assert(boff >=0);
  assert(boff < FS_BITS_PER_BLOCK(block_size));
  get_block(map_block, buf);
  w = boff / FS_BITCHUNK_BITS;
  s = boff % FS_BITCHUNK_BITS;
  buf[w] |= (1 << s);
  put_block(map_block, buf);

  free(buf);
}
开发者ID:ChaosJohn,项目名称:minix,代码行数:27,代码来源:mkfs.c


示例12: incr_size

/* Increment the file-size in inode n */
void
incr_size(ino_t n, size_t count)
{
  block_t b;
  int off;

  b = ((n - 1) / inodes_per_block) + inode_offset;
  off = (n - 1) % inodes_per_block;
  {
	struct inode *inodes;

	assert(inodes_per_block * sizeof(*inodes) == block_size);
	if(!(inodes = alloc_block()))
		err(1, "couldn't allocate a block of inodes");

	get_block(b, inodes);
	/* Check overflow; avoid compiler spurious warnings */
	if (inodes[off].i_size+(int)count < inodes[off].i_size ||
	    inodes[off].i_size > MAX_MAX_SIZE-(int)count)
		pexit("File has become too big to be handled by MFS");
	inodes[off].i_size += count;
	put_block(b, inodes);
	free(inodes);
  }
}
开发者ID:ChaosJohn,项目名称:minix,代码行数:26,代码来源:mkfs.c


示例13: mem_alloc_align_func

void * mem_alloc_align_func(size_t size,
							size_t align
#if defined(MEMDBG_ON)
							,
							char * file,
							int line
#endif
							)
{
	void * ptr = NULL;
#if defined(MEMDBG_ON)
	ptr = (char *) MEMDBG_alloc_align(size, align, file, line);
#elif HAVE_POSIX_MEMALIGN
	if (posix_memalign(&ptr, align, size)) pexit("posix_memalign");
#elif HAVE_ALIGNED_ALLOC
	/* According to the Linux man page, "size should be a multiple of
	   alignment", whatever they mean with "should"... This does not
	   make any sense whatsoever but we round it up to comply. */
	size = ((size + (align - 1)) / align) * align;
	if (!(ptr = aligned_alloc(align, size))) pexit("aligned_alloc");
#elif HAVE_MEMALIGN
/* Let's just pray this implementation can actually free it */
#if defined(__sparc__) || defined(__sparc) || defined(sparc)                   \
	|| defined(__sparcv9)
	if (!(ptr = memalign(align, size)))
#else
	if (!(ptr = memalign(&ptr, align, size)))
#endif
		perror("memalign");
#elif HAVE___MINGW_ALIGNED_MALLOC
	if (!(ptr = __mingw_aligned_malloc(size, align)))
		perror("__mingw_aligned_malloc");
#elif HAVE__ALIGNED_MALLOC
	if (!(ptr = _aligned_malloc(size, align))) perror("aligned_malloc");

#elif AC_BUILT
#error No suitable aligned alloc found, please report to john-dev mailing list (state your OS details).

/* we need an aligned alloc function for legacy builds */
#elif _ISOC11_SOURCE
	size = ((size + (align - 1)) / align) * align;
	if (!(ptr = aligned_alloc(align, size))) perror("aligned_alloc");
#else
	if (posix_memalign(&ptr, align, size)) perror("posix_memalign");
#endif
	return ptr;
}
开发者ID:JoeGilkey,项目名称:carnivore,代码行数:47,代码来源:memory.c


示例14: w_timer

static void
w_timer(void* arg)
{
    Ether* ether = (Ether*) arg;
    Ctlr* ctlr = (Ctlr*)ether->ctlr;

    ctlr->timerproc = up;
    for(;;) {
        tsleep(&up->sleep, return0, 0, MSperTick);
        ctlr = (Ctlr*)ether->ctlr;
        if(ctlr == 0)
            break;
        if((ctlr->state & (Attached|Power)) != (Attached|Power))
            continue;
        ctlr->ticks++;

        ilock(ctlr);

        // Seems that the card gets frames BUT does
        // not send the interrupt; this is a problem because
        // I suspect it runs out of receive buffers and
        // stops receiving until a transmit watchdog
        // reenables the card.
        // The problem is serious because it leads to
        // poor rtts.
        // This can be seen clearly by commenting out
        // the next if and doing a ping: it will stop
        // receiving (although the icmp replies are being
        // issued from the remote) after a few seconds.
        // Of course this `bug' could be because I'm reading
        // the card frames in the wrong way; due to the
        // lack of documentation I cannot know.

        if(csr_ins(ctlr, WR_EvSts)&WEvs) {
            ctlr->tickintr++;
            w_intr(ether);
        }

        if((ctlr->ticks % 10) == 0) {
            if(ctlr->txtmout && --ctlr->txtmout == 0) {
                ctlr->nwatchdogs++;
                w_txdone(ctlr, WTxErrEv);
                if(w_enable(ether)) {
                    DEBUG("wavelan: wdog enable failed\n");
                }
                w_txstart(ether);
            }
            if((ctlr->ticks % 120) == 0)
                if(ctlr->txbusy == 0)
                    w_cmd(ctlr, WCmdEnquire, WTyp_Stats);
            if(ctlr->scanticks > 0)
                if((ctlr->ticks % ctlr->scanticks) == 0)
                    if(ctlr->txbusy == 0)
                        w_cmd(ctlr, WCmdEnquire, WTyp_Scan);
        }
        iunlock(ctlr);
    }
    pexit("terminated", 0);
}
开发者ID:tusharsoni,项目名称:Inferno,代码行数:59,代码来源:wavelan.c


示例15: linkproc

static void
linkproc(void)
{
	Proc *up = externup();
	spllo();
	up->kpfun(up->kparg);
	pexit("kproc dying", 0);
}
开发者ID:Requaos,项目名称:harvey,代码行数:8,代码来源:arch.c


示例16: thread_function

static void *
thread_function(void *arg) {
	int tid = *((int *) arg);
	if (one_time_init(&control, init_function) == -1)
		pexit("one_time_init");

	printf("%d: value of shared variable: %d\n", tid, to_be_initialized);
	return NULL;
}
开发者ID:rmascarenhas,项目名称:lpi,代码行数:9,代码来源:one_time_init.c


示例17: log_file_flush

static void log_file_flush(struct log_file *f)
{
	int count;

	if (f->fd < 0) return;

	count = f->ptr - f->buffer;
	if (count <= 0) return;

#if defined(LOCK_EX) && OS_FLOCK
	if (flock(f->fd, LOCK_EX)) pexit("flock");
#endif
	if (write_loop(f->fd, f->buffer, count) < 0) pexit("write");
	f->ptr = f->buffer;
#if defined(LOCK_EX) && OS_FLOCK
	if (flock(f->fd, LOCK_UN)) pexit("flock");
#endif
}
开发者ID:Sayantan2048,项目名称:myrice-JtR,代码行数:18,代码来源:logger.c


示例18: log_file_fsync

static void log_file_fsync(struct log_file *f)
{
	if (f->fd < 0) return;

	log_file_flush(f);
#if !defined(__CYGWIN32__) && !defined(__MINGW32__) && !defined(_MSC_VER)
	if (fsync(f->fd)) pexit("fsync");
#endif
}
开发者ID:Sayantan2048,项目名称:myrice-JtR,代码行数:9,代码来源:logger.c


示例19: log_file_fsync

static void log_file_fsync(struct log_file *f)
{
	if (f->fd < 0) return;

	log_file_flush(f);
#if HAVE_WINDOWS_H==0
	if (fsync(f->fd)) pexit("fsync");
#endif
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:9,代码来源:logger.c


示例20: log_file_fsync

static void log_file_fsync(struct log_file *f)
{
	if (f->fd < 0) return;

	log_file_flush(f);
#ifndef __CYGWIN32__
	if (fsync(f->fd)) pexit("fsync");
#endif
}
开发者ID:0x0mar,项目名称:JohnTheRipper,代码行数:9,代码来源:logger.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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