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

C++ printerr函数代码示例

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

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



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

示例1: ifc_set_mask

int ifc_set_mask(const char *name, in_addr_t mask)
{
    struct ifreq ifr;
    int ret;

    ifc_init_ifr(name, &ifr);
    init_sockaddr_in(&ifr.ifr_addr, mask);

    ret = ioctl(ifc_ctl_sock, SIOCSIFNETMASK, &ifr);
    if (DBG) printerr("ifc_set_mask(%s, xx) = %d", name, ret);
    return ret;
}
开发者ID:0omega,项目名称:platform_system_core,代码行数:12,代码来源:ifc_utils.c


示例2: proccreate

/* perform create command */
static int proccreate(const char *path, int width, int64_t limsiz) {
    TCFDB *fdb = tcfdbnew();
    if (!INVALIDHANDLE(g_dbgfd)) tcfdbsetdbgfd(fdb, g_dbgfd);
    if (!tcfdbtune(fdb, width, limsiz)) {
        printerr(fdb);
        tcfdbdel(fdb);
        return 1;
    }
    if (!tcfdbopen(fdb, path, FDBOWRITER | FDBOCREAT | FDBOTRUNC)) {
        printerr(fdb);
        tcfdbdel(fdb);
        return 1;
    }
    bool err = false;
    if (!tcfdbclose(fdb)) {
        printerr(fdb);
        err = true;
    }
    tcfdbdel(fdb);
    return err ? 1 : 0;
}
开发者ID:Dean-Jansen,项目名称:ejdb,代码行数:22,代码来源:jbfmgr.c


示例3: procout

/* perform out command */
static int procout(const char *path, const char *pkbuf, int pksiz, int omode){
  TCTDB *tdb = tctdbnew();
  if(g_dbgfd != INVALID_HANDLE_VALUE) tctdbsetdbgfd(tdb, g_dbgfd);
  if(!tctdbsetcodecfunc(tdb, _tc_recencode, NULL, _tc_recdecode, NULL)) printerr(tdb);
  if(!tctdbopen(tdb, path, TDBOWRITER | omode)){
    printerr(tdb);
    tctdbdel(tdb);
    return 1;
  }
  bool err = false;
  if(!tctdbout(tdb, pkbuf, pksiz)){
    printerr(tdb);
    err = true;
  }
  if(!tctdbclose(tdb)){
    if(!err) printerr(tdb);
    err = true;
  }
  tctdbdel(tdb);
  return err ? 1 : 0;
}
开发者ID:hsn10,项目名称:tokyocabinet-win,代码行数:22,代码来源:tctmgr.c


示例4: lgssd_mutex_get

void lgssd_mutex_get(int semid)
{
	struct sembuf	op[1] = { {0, -1, SEM_UNDO} };
	int		rc;

	rc = semop(semid, op, 1);
	if (rc != 0) {
		printerr(0, "exit on mutex_get err %d: %s\n",
			 rc, strerror(errno));
		exit(1);
	}
}
开发者ID:Keeper-of-the-Keys,项目名称:Lustre,代码行数:12,代码来源:gssd.c


示例5: lgssd_create_mutex

static int lgssd_create_mutex(int *semid)
{
	int		id;
	int		arg;

	id = semget(IPC_PRIVATE, 1, IPC_CREAT);
	if (id == -1) {
		printerr(0, "semget: %s\n", strerror(errno));
		return -1;
	}

	arg = 1;
	if (semctl(id, 0, SETVAL, arg) != 0) {
		printerr(0, "semctl: %s\n", strerror(errno));
		semctl(id, 1, IPC_RMID, arg);
		return -1;
	}

	*semid = id;
	return 0;
}
开发者ID:DCteam,项目名称:lustre,代码行数:21,代码来源:gssd.c


示例6: procout

/* perform out command */
static int procout(const char *path, const char *kbuf, int ksiz, int omode){
  TCHDB *hdb = tchdbnew();
  if(g_dbgfd >= 0) tchdbsetdbgfd(hdb, g_dbgfd);
  if(!tchdbsetcodecfunc(hdb, _tc_recencode, NULL, _tc_recdecode, NULL)) printerr(hdb);
  if(!tchdbopen(hdb, path, HDBOWRITER | omode)){
    printerr(hdb);
    tchdbdel(hdb);
    return 1;
  }
  bool err = false;
  if(!tchdbout(hdb, kbuf, ksiz)){
    printerr(hdb);
    err = true;
  }
  if(!tchdbclose(hdb)){
    if(!err) printerr(hdb);
    err = true;
  }
  tchdbdel(hdb);
  return err ? 1 : 0;
}
开发者ID:SumiTomohiko,项目名称:o,代码行数:22,代码来源:tchmgr.c


示例7: ifc_set_addr

int ifc_set_addr(const char *name, in_addr_t addr)
{
    struct ifreq ifr;
    int ret;

    ifc_init_ifr(name, &ifr);
    init_sockaddr_in(&ifr.ifr_addr, addr);

    ret = ioctl(ifc_ctl_sock, SIOCSIFADDR, &ifr);
    if (DBG) printerr("ifc_set_addr(%s, xx) = %d", name, ret);
    return ret;
}
开发者ID:0omega,项目名称:platform_system_core,代码行数:12,代码来源:ifc_utils.c


示例8: procoptimize

/* perform optimize command */
static int procoptimize(const char *path, int lmemb, int nmemb,
        int bnum, int apow, int fpow, TCCMP cmp, int opts, int omode, bool df) {
    TCBDB *bdb = tcbdbnew();
    if (!INVALIDHANDLE(g_dbgfd)) tcbdbsetdbgfd(bdb, g_dbgfd);
    if (cmp && !tcbdbsetcmpfunc(bdb, cmp, NULL)) printerr(bdb);
    if (!tcbdbsetcodecfunc(bdb, _tc_recencode, NULL, _tc_recdecode, NULL)) printerr(bdb);
    if (!tcbdbopen(bdb, path, BDBOWRITER | omode)) {
        printerr(bdb);
        tcbdbdel(bdb);
        return 1;
    }
    bool err = false;
    if (df) {
        if (!tcbdbdefrag(bdb, INT64_MAX)) {
            printerr(bdb);
            err = true;
        }
    } else {
        if (!tcbdboptimize(bdb, lmemb, nmemb, bnum, apow, fpow, opts)) {
            printerr(bdb);
            err = true;
        }
    }
    if (!tcbdbclose(bdb)) {
        if (!err) printerr(bdb);
        err = true;
    }
    tcbdbdel(bdb);
    return err ? 1 : 0;
}
开发者ID:JoakimSoderberg,项目名称:ejdb,代码行数:31,代码来源:tcbmgr.c


示例9: procput

/* perform put command */
static int procput(const char *path, const char *kbuf, int ksiz, const char *vbuf, int vsiz,
                   int omode, int dmode){
  TCHDB *hdb = tchdbnew();
  if(g_dbgfd >= 0) tchdbsetdbgfd(hdb, g_dbgfd);
  if(!tchdbsetcodecfunc(hdb, _tc_recencode, NULL, _tc_recdecode, NULL)) printerr(hdb);
  if(!tchdbopen(hdb, path, HDBOWRITER | omode)){
    printerr(hdb);
    tchdbdel(hdb);
    return 1;
  }
  bool err = false;
  switch(dmode){
  case -1:
    if(!tchdbputkeep(hdb, kbuf, ksiz, vbuf, vsiz)){
      printerr(hdb);
      err = true;
    }
    break;
  case 1:
    if(!tchdbputcat(hdb, kbuf, ksiz, vbuf, vsiz)){
      printerr(hdb);
      err = true;
    }
    break;
  case 10:
    if(tchdbaddint(hdb, kbuf, ksiz, tcatoi(vbuf)) == INT_MIN){
      printerr(hdb);
      err = true;
    }
    break;
  case 11:
    if(isnan(tchdbadddouble(hdb, kbuf, ksiz, tcatof(vbuf)))){
      printerr(hdb);
      err = true;
    }
    break;
  default:
    if(!tchdbput(hdb, kbuf, ksiz, vbuf, vsiz)){
      printerr(hdb);
      err = true;
    }
    break;
  }
  if(!tchdbclose(hdb)){
    if(!err) printerr(hdb);
    err = true;
  }
  tchdbdel(hdb);
  return err ? 1 : 0;
}
开发者ID:Fleurer,项目名称:nanodb,代码行数:51,代码来源:tchmgr.c


示例10: dentfill

int
dentfill(char *path, struct entry **dents,
	 int (*filter)(regex_t *, char *), regex_t *re)
{
	DIR *dirp;
	struct dirent *dp;
	struct stat sb;
	char *newpath;
	int r, n = 0;

	dirp = opendir(path);
	if (dirp == NULL)
		return 0;

	while ((dp = readdir(dirp)) != NULL) {
		/* Skip self and parent */
		if (strcmp(dp->d_name, ".") == 0
		    || strcmp(dp->d_name, "..") == 0)
			continue;
		if (filter(re, dp->d_name) == 0)
			continue;
		*dents = xrealloc(*dents, (n + 1) * sizeof(**dents));
		(*dents)[n].name = xstrdup(dp->d_name);
		/* Get mode flags */
		newpath = mkpath(path, dp->d_name);
		r = lstat(newpath, &sb);
		if (r == -1)
			printerr(1, "lstat");
		(*dents)[n].mode = sb.st_mode;
		(*dents)[n].t = sb.st_mtime;
		n++;
	}

	/* Should never be null */
	r = closedir(dirp);
	if (r == -1)
		printerr(1, "closedir");

	return n;
}
开发者ID:PaulBatchelor,项目名称:Noice,代码行数:40,代码来源:noice.c


示例11: free_symlink_tree

int free_symlink_tree(void)
{
	int i;
	char tmppath[PATH_MAX];

	/* Remove the symlinks from the test tree */
	for (i =  num_tree_symlinks - 1; i > -1; i--) {
		snprintf(tmppath, PATH_MAX, "%s/%s",
				tree_origin, tree_symlinks[i].orig);

		if (unlink(tmppath) != 0) {
			snprintf(errmsg, ERRSIZE, "unlink %s", tmppath);
			printerr(errmsg);
			goto error;
		}
	}

	/* Remove the directories from the test tree */
	for (i = num_tree_dirs - 1; i > -1; i--) {
		snprintf(tmppath, PATH_MAX, "%s/%s", tree_origin, tree_dirs[i]);

		if (rmdir(tmppath) != 0) {
			snprintf(errmsg, ERRSIZE, "rmdir %s", tmppath);
			printerr(errmsg);
			goto error;
		}
	}

	/* Remove the temporary directory */
	if (rmdir(tree_origin) != 0) {
		snprintf(errmsg, ERRSIZE, "rmdir %s", tree_origin);
		printerr(errmsg);
		goto error;
	}

	return 0;

error:
	return 1;
}
开发者ID:MarkZ3,项目名称:lttng-tools,代码行数:40,代码来源:test_utils_expand_path.c


示例12: prepare_symlink_tree

int prepare_symlink_tree(void)
{
	int i;
	char tmppath[PATH_MAX];

	/* Create the temporary directory */
	if (mkdtemp(tree_origin) == NULL) {
		printerr("mkdtemp");
		goto error;
	}

	/* Create the directories of the test tree */
	for (i = 0; i < num_tree_dirs; i++) {
		snprintf(tmppath, PATH_MAX, "%s/%s", tree_origin, tree_dirs[i]);

		if (mkdir(tmppath, 0755) != 0) {
			snprintf(errmsg, ERRSIZE, "mkdir %s", tmppath);
			printerr(errmsg);
			goto error;
		}
	}

	/* Create the symlinks of the test tree */
	for (i = 0; i < num_tree_symlinks; i++) {
		snprintf(tmppath, PATH_MAX, "%s/%s",
				tree_origin, tree_symlinks[i].orig);

		if (symlink(tree_symlinks[i].dest, tmppath) != 0) {
			snprintf(errmsg, ERRSIZE, "symlink %s to %s",
					tmppath, tree_symlinks[i].dest);
			printerr(errmsg);
			goto error;
		}
	}

	return 0;

error:
	return 1;
}
开发者ID:MarkZ3,项目名称:lttng-tools,代码行数:40,代码来源:test_utils_expand_path.c


示例13: procout

/* perform out command */
static int procout(const char *path, const char *kbuf, int ksiz, TCCMP cmp, int omode) {
    TCBDB *bdb = tcbdbnew();
    if (!INVALIDHANDLE(g_dbgfd)) tcbdbsetdbgfd(bdb, g_dbgfd);
    if (cmp && !tcbdbsetcmpfunc(bdb, cmp, NULL)) printerr(bdb);
    if (!tcbdbsetcodecfunc(bdb, _tc_recencode, NULL, _tc_recdecode, NULL)) printerr(bdb);
    if (!tcbdbopen(bdb, path, BDBOWRITER | omode)) {
        printerr(bdb);
        tcbdbdel(bdb);
        return 1;
    }
    bool err = false;
    if (!tcbdbout(bdb, kbuf, ksiz)) {
        printerr(bdb);
        err = true;
    }
    if (!tcbdbclose(bdb)) {
        if (!err) printerr(bdb);
        err = true;
    }
    tcbdbdel(bdb);
    return err ? 1 : 0;
}
开发者ID:JoakimSoderberg,项目名称:ejdb,代码行数:23,代码来源:tcbmgr.c


示例14: proccreate

/* perform create command */
static int proccreate(const char *path, int bnum, int apow, int fpow, int opts){
  TCTDB *tdb = tctdbnew();
  if(g_dbgfd != INVALID_HANDLE_VALUE) tctdbsetdbgfd(tdb, g_dbgfd);
  if(!tctdbsetcodecfunc(tdb, _tc_recencode, NULL, _tc_recdecode, NULL)) printerr(tdb);
  if(!tctdbtune(tdb, bnum, apow, fpow, opts)){
    printerr(tdb);
    tctdbdel(tdb);
    return 1;
  }
  if(!tctdbopen(tdb, path, TDBOWRITER | TDBOCREAT | TDBOTRUNC)){
    printerr(tdb);
    tctdbdel(tdb);
    return 1;
  }
  bool err = false;
  if(!tctdbclose(tdb)){
    printerr(tdb);
    err = true;
  }
  tctdbdel(tdb);
  return err ? 1 : 0;
}
开发者ID:hsn10,项目名称:tokyocabinet-win,代码行数:23,代码来源:tctmgr.c


示例15: do_error_downcall

static int
do_error_downcall(int k5_fd, uid_t uid, int err)
{
	char	buf[1024];
	char	*p = buf, *end = buf + 1024;
	unsigned int timeout = 0;
	int	zero = 0;

	printerr(2, "doing error downcall\n");

	if (WRITE_BYTES(&p, end, uid)) goto out_err;
	if (WRITE_BYTES(&p, end, timeout)) goto out_err;
	/* use seq_win = 0 to indicate an error: */
	if (WRITE_BYTES(&p, end, zero)) goto out_err;
	if (WRITE_BYTES(&p, end, err)) goto out_err;

	if (write(k5_fd, buf, p - buf) < p - buf) goto out_err;
	return 0;
out_err:
	printerr(1, "Failed to write error downcall!\n");
	return -1;
}
开发者ID:Distrotech,项目名称:nfs-utils,代码行数:22,代码来源:gssd_proc.c


示例16: do_downcall

static void
do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd,
	    gss_buffer_desc *context_token, OM_uint32 lifetime_rec,
	    gss_buffer_desc *acceptor)
{
	char    *buf = NULL, *p = NULL, *end = NULL;
	unsigned int timeout = context_timeout;
	unsigned int buf_size = 0;

	printerr(2, "doing downcall: lifetime_rec=%u acceptor=%.*s\n",
		lifetime_rec, acceptor->length, acceptor->value);
	buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
		sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
		sizeof(context_token->length) + context_token->length +
		sizeof(acceptor->length) + acceptor->length;
	p = buf = malloc(buf_size);
	if (!buf)
		goto out_err;

	end = buf + buf_size;

	/* context_timeout set by -t option overrides context lifetime */
	if (timeout == 0)
		timeout = lifetime_rec;
	if (WRITE_BYTES(&p, end, uid)) goto out_err;
	if (WRITE_BYTES(&p, end, timeout)) goto out_err;
	if (WRITE_BYTES(&p, end, pd->pd_seq_win)) goto out_err;
	if (write_buffer(&p, end, &pd->pd_ctx_hndl)) goto out_err;
	if (write_buffer(&p, end, context_token)) goto out_err;
	if (write_buffer(&p, end, acceptor)) goto out_err;

	if (write(k5_fd, buf, p - buf) < p - buf) goto out_err;
	free(buf);
	return;
out_err:
	free(buf);
	printerr(1, "Failed to write downcall!\n");
	return;
}
开发者ID:Distrotech,项目名称:nfs-utils,代码行数:39,代码来源:gssd_proc.c


示例17: proccreate

/* perform create command */
static int proccreate(const char *path, int bnum, int apow, int fpow, int opts){
  TCHDB *hdb = tchdbnew();
  if(g_dbgfd >= 0) tchdbsetdbgfd(hdb, g_dbgfd);
  if(!tchdbsetcodecfunc(hdb, _tc_recencode, NULL, _tc_recdecode, NULL)) printerr(hdb);
  if(!tchdbtune(hdb, bnum, apow, fpow, opts)){
    printerr(hdb);
    tchdbdel(hdb);
    return 1;
  }
  if(!tchdbopen(hdb, path, HDBOWRITER | HDBOCREAT | HDBOTRUNC)){
    printerr(hdb);
    tchdbdel(hdb);
    return 1;
  }
  bool err = false;
  if(!tchdbclose(hdb)){
    printerr(hdb);
    err = true;
  }
  tchdbdel(hdb);
  return err ? 1 : 0;
}
开发者ID:Fleurer,项目名称:nanodb,代码行数:23,代码来源:tchmgr.c


示例18: display_status_1

static void
display_status_1(char *m, u_int32_t code, int type, const gss_OID mech)
{
	u_int32_t maj_stat, min_stat;
	gss_buffer_desc msg = GSS_C_EMPTY_BUFFER;
	u_int32_t msg_ctx = 0;
	char *typestr;

	switch (type) {
	case GSS_C_GSS_CODE:
		typestr = "GSS";
		break;
	case GSS_C_MECH_CODE:
		typestr = "mechanism";
		break;
	default:
		return;
		/* NOTREACHED */
	}

	for (;;) {
		maj_stat = gss_display_status(&min_stat, code,
		    type, mech, &msg_ctx, &msg);
		if (maj_stat != GSS_S_COMPLETE) {
			printerr(0, "ERROR: in call to "
				"gss_display_status called from %s\n", m);
			break;
		} else {
			printerr(0, "ERROR: GSS-API: (%s) error in %s(): %s\n",
			    typestr, m, (char *)msg.value);
		}

		if (msg.length != 0)
			(void) gss_release_buffer(&min_stat, &msg);

		if (msg_ctx == 0)
			break;
	}
}
开发者ID:ShyamsundarR,项目名称:nfs-ganesha,代码行数:39,代码来源:gss_util.c


示例19: trace_dup

static void trace_dup(int oldfd, int newfd) {
    debug("trace_dup %d %d", oldfd, newfd);

    if (oldfd == newfd) {
        printerr("trace_dup: duplicating the same fd %d\n", oldfd);
        return;
    }

    Descriptor *o = get_descriptor(oldfd);
    if (o == NULL) {
        return;
    }

    /* Not a descriptor we are tracing */
    if (o->path == NULL) {
        return;
    }

    /* Just in case newfd is already open */
    trace_close(newfd);

    char *temp = strdup(o->path);
    if (temp == NULL) {
        printerr("strdup: %s\n", strerror(errno));
        return;
    }

    /* Copy the old descriptor into the new */
    Descriptor *n = get_descriptor(newfd);
    n->type = o->type;
    n->path = temp;
    n->bread = 0;
    n->bwrite = 0;
    n->nread = 0;
    n->nwrite = 0;
    n->bseek = 0;
    n->nseek = 0;
}
开发者ID:bingzhang,项目名称:pegasus,代码行数:38,代码来源:interpose.c


示例20: trace_file

static void trace_file(const char *path, int fd) {
    debug("trace_file %s %d", path, fd);

    Descriptor *f = get_descriptor(fd);
    if (f == NULL) {
        return;
    }

    if (!should_trace(path)) {
        return;
    }

    struct stat s;
    if (fstat(fd, &s) != 0) {
        printerr("fstat: %s\n", strerror(errno));
        return;
    }

    /* Skip directories */
    if (s.st_mode & S_IFDIR) {
        return;
    }

    char *temp = strdup(path);
    if (temp == NULL) {
        printerr("strdup: %s\n", strerror(errno));
        return;
    }

    f->type = DTYPE_FILE;
    f->path = temp;
    f->bread = 0;
    f->bwrite = 0;
    f->nread = 0;
    f->nwrite = 0;
    f->bseek = 0;
    f->nseek = 0;
}
开发者ID:bingzhang,项目名称:pegasus,代码行数:38,代码来源:interpose.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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