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


C++ errlog函数代码示例

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


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


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