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

C++ errlog函数代码示例

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

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



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

示例1: set_list

static int
set_list(void)
{
	int olderrors;
	char *token = currtok();

	errlog(BEGIN, "set_list() {");
	errlog(VERBOSE, "token = '%s'",
	    (token) ? token : "<NULL>");
	if (set() == FALSE) {
		errlog(END, "} /* set_list */");
		return (FALSE);
	}

	olderrors = Errors;
	while (set()) {
		continue;
	}
	if (olderrors != Errors) {
		errlog(END, "} /* set_list */");
		return (FALSE);
	}

	errlog(END, "} /* set_list */");
	return (TRUE);
}
开发者ID:0xffea,项目名称:illumos-gate,代码行数:26,代码来源:versions.c


示例2: perform_defile

void
perform_defile(struct room_data *room, int *state, char **olddesc,
    char **oldtitle)
{

    struct obj_data *fount = NULL;

    if (*state != STATE_HOLY) {
        errlog("invalid state in perform_defile from unholy_square.");
        return;
    }

    *state = STATE_UNHOLY;

    for (fount = room->contents; fount; fount = fount->next_content)
        if (GET_OBJ_VNUM(fount) == FOUNT_HOLY) {
            extract_obj(fount);
            break;
        }

    if (!(fount = read_object(FOUNT_UNHOLY)))
        errlog("unable to load unholy fount in unholy_square.");
    else
        obj_to_room(fount, room);

    *olddesc = room->description;
    *oldtitle = room->name;
    room->name = strdup(TITLE_UNHOLY);
    room->description = strdup(DESC_UNHOLY);

    SET_BIT(room->zone->flags, ZONE_LOCKED);

    REMOVE_BIT(room->room_flags, ROOM_PEACEFUL);
}
开发者ID:TempusMUD,项目名称:Tempuscode,代码行数:34,代码来源:unholy_square.c


示例3: generate_linkage

/*
 * generate_linkage -- make code for the linkage part of an individual
 *	interface. Assumes Bodyfp.
 */
void
generate_linkage(ENTRY *function)
{
	char	*library_name = db_get_current_library(),
		*function_name;
	char	composite_name[MAXLINE];

	errlog(BEGIN, "generate_linkage() {");

	function_name = name_of(function);
	(void) snprintf(composite_name, sizeof (composite_name),
		"%s_%s", library_name, function_name);

	/* Print the predeclaration of the interceptor. */
	generate_interface_predeclaration(composite_name, function);
	/* Collect things we'll use more than once. */

	/* Next the struct used to pass parameters. */
	(void) fprintf(Bodyfp, "static abisym_t __abi_%s_%s_sym;\n",
		library_name, function_name);

	/* The linkage function, */
	generate_linkage_function(library_name, function_name);

	(void) fputs("\n\n", Bodyfp);
	errlog(END, "}");
}
开发者ID:0xffea,项目名称:illumos-gate,代码行数:31,代码来源:linkage.c


示例4: cmd_conf

/* conf was used on the command line 
 * mysql and dbconf modules must be loaded
 * the command line will be processed with dbconf_cmd_line()
 */
int cmd_conf(int argc, char** argv)
{
/*  int* (*dbconf_cmd_line)(int argc, char **argv); */
  int* (*dbconf_cmd_line)(int, char **);

  if(module_load("mysql", 1) <0 )
  {
    errlog("Error loading mysql module !");
    return -1;
  }
  if(module_load("dbconf", 1) < 0)
  {
    errlog("Error loading dbconf module !");
    return -2;
  }

  dbconf_cmd_line = attach_to_function("dbconf_cmd_line", NULL);
  if(dbconf_cmd_line == NULL)
  {
    errlog("Missing dbconf_cmd_line() function !");
    return -2;
  }
  
  return (int)dbconf_cmd_line(argc, argv);
}
开发者ID:diegoagudo,项目名称:taps-services,代码行数:29,代码来源:ircsvs.c


示例5: clutter_init

/*
  Wrapper for clutter_init()
  clutter_init()のラッパー関数

  log result of clutter_init()
  clutter_init()の結果を出力する。
*/
static ClutterInitError my_clutter_init( int argc, char *argv[] )
{
  ClutterInitError ret = clutter_init( &argc, &argv );
  switch( ret ) {
  case CLUTTER_INIT_SUCCESS:
    dbglog( "Initialisation successful\n" );
    break;
  case CLUTTER_INIT_ERROR_UNKNOWN:
    errlog( "Unknown error\n" );
    break;
  case CLUTTER_INIT_ERROR_THREADS:
    errlog( "Thread initialisation failed\n" );
    break;
  case CLUTTER_INIT_ERROR_BACKEND:
    errlog( "Backend initialisation failed\n" );
    break;
  case CLUTTER_INIT_ERROR_INTERNAL:
    errlog( "Internal error\n" );
    break;
  default:
    errlog( "Other error\n" );
    break;
  }
  return ret;
}
开发者ID:quwae,项目名称:myclutterexample,代码行数:32,代码来源:c01.c


示例6: create_pseudo_tty

/* Create a pseudo terminal for other process to use (as this program is using up the actual TTY) */
int create_pseudo_tty()
{
	int amaster, aslave;
	int flags;

	if (openpty(&amaster, &aslave, NULL, NULL, NULL) == -1) {
		errlog("Error: Openpty failed - %m\n");
		return -1;
	}

	/* Set to non blocking mode */
	flags = fcntl(amaster, F_GETFL);
	flags |= O_NONBLOCK;
	fcntl(amaster, F_SETFL, flags);

	FILE *pseudo_save_file = fopen(pseudo_tty_save_file, "w+");
	if (!pseudo_save_file) {
		errlog("Error: Unable to open the pseudo info file - %m\n");
		return -1;
	}
	/* Save the name of the created pseudo tty in a text file for other processes to use */
	if (fprintf(pseudo_save_file, "%s\n", ttyname(aslave)) == -1) {
		errlog("Error writing to the pseudo info file\n");
		fclose(pseudo_save_file);
		return -1;
	}
	fclose(pseudo_save_file);

	if (set_tty(aslave) == -1) {
		errlog("Error: Slave TTY not set properly\n");
		return -1;
	}

	return amaster;
}
开发者ID:HengWang,项目名称:openbmc,代码行数:36,代码来源:bmc-log.c


示例7: ev_irc_connect

/** internal functions implementation starts here **/
int ev_irc_connect(void* dummy1, void* dummy2)
{
    int cr;
    stdlog(L_INFO, "Connecting to IRC server %s:%i", RemoteServer, RemotePort);
    cr = irc_FullConnect(RemoteServer, RemotePort, ServerPass, 0);
    if(cr < 0)
    {
        errlog("Could not connect to IRC server: %s", irc_GetLastMsg());
        exit(1);
    }
    stdlog(L_INFO, "Netjoin complete, %.1d Kbs received", irc_InByteCount()/1024);

    /* not sure if this fork should be on the irc module
       for now lets leave it like this to make sure we only fork after the
       connection is fully established
    */
    if( nofork == 0 )
    {
        fork_process();
        write_pidfile();
    }

    irc_LoopWhileConnected();
    errlog("Disconnected:%s\n", irc_GetLastMsg());

    /* stdlog(L_INFO, "PTlink IRC Services Terminated"); */

    return 0;
}
开发者ID:joaompinto,项目名称:ptlink.irc.services,代码行数:30,代码来源:irc.c


示例8: recvmstr

/*
 * Receives message string from the network and
 * returns the appropriate numeric token.  If error
 * occurs -1 is returned.
 */
int
recvmstr(int sock,char **s)
{
  char buf[MAX_MSGSTR + 1];
  unsigned long ultmp;
  int i;
  size_t len;

  DLOG_MSG(("recvmstr() : recvul(%d)",sock));
  if (!recvul(sock,&ultmp))
    return -1;
  len = (size_t)ultmp;
  if (len == 0 || len > MAX_MSGSTR) {
    errlog(LOG_ERR,"recvmstr() : len=%lu",(unsigned long)len);
    return -1;
  }
  DLOG_MSG(("recvmstr() : x_recv(%d)",sock));
  if (!x_recv(sock,buf,len)) {
    DLOG_ERROR(("recvstr()"));
    return -1;
  }
  buf[len] = '\0';
  DLOG_MSG(("recvstr() : buf=%s",buf));
  for (i = 0; s[i]; i++)
    if (streql(s[i],buf)) return i;
  errlog(LOG_ERR,"recvmstr() : unknown message (%s)",buf);
  return -1;
}
开发者ID:apc-llc,项目名称:cernlib,代码行数:33,代码来源:sockio.c


示例9: read_vm

vm
read_vm(int task_id)
{
    unsigned i, top, func_id, max;
    int vector;
    char c;
    vm the_vm;

    if (dbio_scanf("%u %d %u%c", &top, &vector, &func_id, &c) != 4
	|| (c == ' '
	    ? dbio_scanf("%u%c", &max, &c) != 2 || c != '\n'
	    : (max = DEFAULT_MAX_STACK_DEPTH, c != '\n'))) {
	errlog("READ_VM: Bad vm header\n");
	return 0;
    }
    the_vm = new_vm(task_id, top + 1);
    the_vm->max_stack_size = max;
    the_vm->top_activ_stack = top;
    the_vm->root_activ_vector = vector;
    the_vm->func_id = func_id;

    for (i = 0; i <= top; i++)
	if (!read_activ(&the_vm->activ_stack[i],
			i == 0 ? vector : MAIN_VECTOR)) {
	    errlog("READ_VM: Bad activ number %d\n", i);
	    return 0;
	}
    return the_vm;
}
开发者ID:EnderRealm,项目名称:c-lambdamoo-server,代码行数:29,代码来源:eval_vm.c


示例10: malloc

/* Get the address info of netcons server */
struct addrinfo *get_addr_info(int ip_version)
{
	int ip_family = (ip_version == IPV4) ? AF_INET : AF_INET6;
	struct addrinfo hints;

	struct addrinfo *result;
	result = malloc(sizeof(*result));
	if (!result) {
		errlog("Error: Unable to allocate memory - %m\n");
		return NULL;
	}

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = ip_family;	/* Allow IPv4 or IPv6 */
	hints.ai_socktype = SOCK_DGRAM;	/* Datagram socket */
	hints.ai_flags = AI_PASSIVE;	/* For wildcard IP address */
	hints.ai_protocol = 0;	/* Any protocol */
	hints.ai_canonname = NULL;
	hints.ai_addr = NULL;
	hints.ai_next = NULL;

	if (getaddrinfo(hostname, NULL, &hints, &result)) {
		errlog("Error: getaddrinfo failed - %m\n");
		return NULL;
	}

	return result;
}
开发者ID:HengWang,项目名称:openbmc,代码行数:29,代码来源:bmc-log.c


示例11: tokpragma

/* process a #pragma directive */
static void tokpragma(tokcxdef *ctx, char *p, int len)
{
    /* ignore empty pragmas */
    if (len == 0)
    {
        errlog(ctx->tokcxerr, ERR_PRAGMA);
        return;
    }

    /* see what we have */
    if (len > 1 && (*p == 'c' || *p == 'C')
        && (*(p+1) == '+' || *(p+1) == '-') || t_isspace(*(p+1)))
    {
        /* skip spaces after the 'C', if any */
        for (++p, --len ; len && t_isspace(*p) ; ++p, --len) ;

        /* look for the + or - flag */
        if (len && *p == '+')
            ctx->tokcxflg |= TOKCXFCMODE;
        else if (len && *p == '-')
            ctx->tokcxflg &= ~TOKCXFCMODE;
        else
        {
            errlog(ctx->tokcxerr, ERR_PRAGMA);
            return;
        }
    }
    else
    {
        errlog(ctx->tokcxerr, ERR_PRAGMA);
    }
}
开发者ID:BPaden,项目名称:garglk,代码行数:33,代码来源:tok.c


示例12: get_perms

int get_perms(struct identity_downcall_data *data)
{
	FILE *fp;
	char line[PATH_MAX];

        fp = fopen(PERM_PATHNAME, "r");
        if (fp == NULL) {
                if (errno == ENOENT) {
                        return 0;
                } else {
                        errlog("open %s failed: %s\n",
                               PERM_PATHNAME, strerror(errno));
                        data->idd_err = errno;
                        return -1;
                }
        }

	while (fgets(line, sizeof(line), fp)) {
                if (comment_line(line))
                        continue;

		if (parse_perm_line(data, line, sizeof(line))) {
                        errlog("parse line %s failed!\n", line);
                        data->idd_err = EINVAL;
                        fclose(fp);
                        return -1;
                }
        }

        fclose(fp);
        return 0;
}
开发者ID:EMSL-MSC,项目名称:lustre-release,代码行数:32,代码来源:l_getidentity.c


示例13: init_pcap

void init_pcap(const char *dev, const char *bpf)
{
    char errbuf[PCAP_ERRBUF_SIZE];
    struct bpf_program  bp;
    
    memset(errbuf, 0, PCAP_ERRBUF_SIZE);

    /* 获取pcap设备句柄 */
    pcap_handle = pcap_open_live(dev, 5000, 1, 512, errbuf);
    if( pcap_handle == NULL)
    {
        errlog("Couldn't open device %s:%s", dev, errbuf);
        exit(-1);
    }
    
    /* 设置过滤规则 */
    if(pcap_compile(pcap_handle, &bp, bpf, 1, 0) == -1)
    {
        errlog("Couldn't parse filter %s:%s", bpf, pcap_geterr(pcap_handle));
        exit(-1);
    }
    if(pcap_setfilter(pcap_handle, &bp) == -1)
    {
        errlog("Couldn't install filter %s:%s", bpf, pcap_geterr(pcap_handle));
        exit(-1);
    }
}
开发者ID:sylar94444,项目名称:iptraffic,代码行数:27,代码来源:capture.c


示例14: exec_cmd

int exec_cmd()
{
	pid_t pid;
	int pstat;

	switch((pid = vfork())) {
		case -1:
			errlog(__FILE__, __LINE__, errno);
			return -11;
			break;
		case 0:
			if(execve(args[0], args, NULL) == -1) {
				errlog(__FILE__, __LINE__, errno);
				exit(-11);
			}
			break;
		default:
			if (wait(&pstat) == -1) {
				errlog(__FILE__, __LINE__, errno);
				return -11;
			}

			if (WIFEXITED(pstat))
				return WEXITSTATUS(pstat);
			break;
	}
	return -11; /* Normally, program never come here */
}
开发者ID:EnderUNIX,项目名称:qSheff,代码行数:28,代码来源:exec.c


示例15: parse_versions

/*
 * parse_versions -- parse the file whose name is passed, return
 *	the number of (fatal) errors encountered. Currently only
 *	knows about reading set files and writing vers files.
 */
int
parse_versions(const char *fileName)
{

	/* Prime the set-file parser dfa: */
	assert(fileName != NULL, "passed null filename to parse_versions");
	errlog(BEGIN, "parse_versions(%s) {", fileName);


	if ((Fp = fopen(fileName, "r")) == NULL) {
		(void) fprintf(stderr, "Cannot open version file \"%s\"\n",
		    fileName);
		errlog(END, "} /* parse_versions */");
		return (1);
	}
	Filename = fileName;
	Line = 0;

	errlog(VERBOSE, "reading set file %s looking for architecture %s",
	    Filename, TargetArchStr);

	/* Run the dfa. */
	while (arch())
		continue;

	(void) fclose(Fp);
	/* print_all_buckets(); */
	errlog(END, "} /* parse_versions */");
	return (Errors);
}
开发者ID:0xffea,项目名称:illumos-gate,代码行数:35,代码来源:versions.c


示例16: parse_args

static int
parse_args(int argc, char* argv[])
{
    int opt, ret = 0;
    while ((opt = getopt(argc, argv, "ni:h:d:s:g:")) != -1) {
        switch (opt) {
        case 'i':
            _ifname = optarg;
            break;
        case 'n':
            _is_pdump_file = 0; /* output to stderr */
            break;
        case 'h':
            _remote_host = optarg;
            break;
        case 'd':
            _eoj_code.cgc = parse_uchar(optarg);
            _eoj_code.clc = parse_uchar(optarg + 2);
            _eoj_code.inc = parse_uchar(optarg + 4);
            break;
        case 'g':
            _get_prop[_get_prop_len].epc = (unsigned char)strtoul(optarg, NULL, 16);
            _get_prop_len++;
            break;
        case 's':
            _set_prop[_set_prop_len].epc = (unsigned char)strtoul(optarg, NULL, 16);
            _set_prop[_set_prop_len].data = argv[optind++];
            _set_prop_len++;
            break;
        default: /* '?' */ 
            usage(argv[0]);
            break;
        }
    }
    if (!_remote_host || (0 == _get_prop_len && 0 == _set_prop_len))
    {
        usage(argv[0]);
    }

    _esv_code = _select_esv();

#if 0
    {
        int i;
        errlog("%s,%s,%x,%x,%x\n",
               _ifname, _remote_host, 
               _eoj_code.cgc, _eoj_code.clc, _eoj_code.inc);
        for (i = 0; i < _set_prop_len; i++) {
            errlog("SET:%d: %x=%s\n", i, _set_prop[i].epc, _set_prop[i].data);
        }
        for (i = 0; i < _get_prop_len; i++) {
            errlog("GET:%d: %x\n", i, _get_prop[i].epc);
        }
        exit(0);
    }
#endif
    return ret;
}
开发者ID:Masatoshi,项目名称:Mulus,代码行数:58,代码来源:main.c


示例17: x_recv

static int
x_recv(int sock,char *buf,size_t len)
{
  size_t n;
  int nn, ret;


  /* now, this sure is a stupid kludge, but we just can't
     afford having the recv() block for ages when something
     goes wrong... */
  if (!alarmset) {
    struct sigaction sact;
    sact.sa_handler = xrecv_sigalarm;
    sigemptyset(&sact.sa_mask);
    sact.sa_flags = 0;
    if (sigaction(SIGALRM,&sact,(struct sigaction *)0) < 0)
      errlog(LOG_ERR,"x_recv() : cannot set SIGALRM");
    alarmset = 1;
  }
  if (setjmp(xrecv_jmp)) {
    errlog(LOG_ERR,"x_recv() : timeout (%d seconds)",RECV_ALARMTIMEOUT);
    ret = 0;
    goto end;
  }
  alarm(RECV_ALARMTIMEOUT);
#ifdef lint
  nn = 0;
#endif
  ret = 1;
  for (n = 0; n < len; n += (size_t)nn) {
#if 0
    int m = 0;
#endif
    DLOG_MSG(("x_recv() : len=%u, n=%u",len,n));
    errno = 0;
    while ((nn = recv(sock,&buf[n],len - n,0)) <= 0) {
      if (nn == 0) goto end;
#if 0
      /* tolerate EOF for a while */
      if (nn == 0 && m++ < MAX_SYSATTEMPTS) {
        errno = 0;
        continue;
      }
#endif
      errlog(LOG_INFO,"x_recv() : recv returns %d",nn);
      if (errno == EINTR) continue;
      errno = 0;
      ret = 0;
      goto end;
    }
    DLOG_MSG(("x_recv() : nn=%d",nn));
  }

  end:;

  alarm(0);
  return ret;
}
开发者ID:apc-llc,项目名称:cernlib,代码行数:58,代码来源:sockio.c


示例18: add_valid_version

/*
 * add_valid_version and _arch -- add a name to the table.
 */
static void
add_valid_version(char *vers_name)
{
	errlog(BEGIN, "add_valid_version(\"%s\") {", vers_name);
	if (Vers == NULL) {
		init_tables();
	}
	Vers = add_to_stringtable(Vers, vers_name);
	errlog(END, "}");
}
开发者ID:0xffea,项目名称:illumos-gate,代码行数:13,代码来源:versions.c


示例19: add_valid_arch

static void
add_valid_arch(char *arch_name)
{

	errlog(BEGIN, "add_valid_arch(\"%s\") {", arch_name);
	if (Vers == NULL) {
		init_tables();
	}
	Varch = add_to_stringtable(Varch, arch_name);
	errlog(END, "}");
}
开发者ID:0xffea,项目名称:illumos-gate,代码行数:11,代码来源:versions.c


示例20: create_dyntext_backup

static int
create_dyntext_backup(dynamic_text_file * dyntext)
{

    DIR *dir;
    struct dirent *dirp;
    int len = strlen(dyntext->filename);
    int num = 0, maxnum = 0;
    char filename[1024];
    FILE *fl = NULL;

    // open backup dir
    if (!(dir = opendir(DYN_TEXT_BACKUP_DIR))) {
        errlog("Cannot open dynamic text backup dir.");
        return 1;
    }
    // scan files in backup dir
    while ((dirp = readdir(dir))) {

        // looks like the right filename
        if (!strncasecmp(dirp->d_name, dyntext->filename, len) &&
            *(dirp->d_name + len) && *(dirp->d_name + len) == '.' &&
            *(dirp->d_name + len + 1)) {

            num = atoi(dirp->d_name + len + 1);

            if (num > maxnum)
                maxnum = num;

        }
    }

    closedir(dir);

    snprintf(filename, sizeof(filename), "%s/%s.%02d", DYN_TEXT_BACKUP_DIR, dyntext->filename,
        maxnum + 1);

    if (!(fl = fopen(filename, "w"))) {
        errlog("Dyntext backup unable to open '%s'.", filename);
        return 1;
    }

    if (dyntext->buffer) {
        char *ptr;
        for (ptr = dyntext->buffer; *ptr; ptr++) {
            if (*ptr == '\r')
                continue;
            fputc(*ptr, fl);
        }
    }

    fclose(fl);
    return 0;
}
开发者ID:mikeclemson,项目名称:Tempuscode,代码行数:54,代码来源:dyntext.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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