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


C++ printerr函数代码示例

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


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


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