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


C++ CRIT函数代码示例

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


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

示例1: oh_uid_map_to_file

/**
 * oh_uid_map_to_file: saves current uid and entity path mappings
 * to file, first element in file is 4 bytes for resource id,
 * then repeat EP_XREF structures holding uid and entity path pairings
 *
 * Return value: success 0, failed -1.
 **/
SaErrorT oh_uid_map_to_file(void)
{
        FILE *fp;

        if (!oh_uid_map_file) {
                return SA_OK;
        }

        uid_lock(&oh_uid_lock);

        fp = fopen(oh_uid_map_file, "wb");
        if(!fp) {
                CRIT("Configuration file '%s' could not be opened", oh_uid_map_file);
                uid_unlock(&oh_uid_lock);
                return SA_ERR_HPI_ERROR;
        }

        /* write resource id */
        if (fwrite((void *)&resource_id, sizeof(resource_id), 1, fp) != 1) {
		CRIT("write resource_id failed");
		fclose(fp);
                uid_unlock(&oh_uid_lock);
		return SA_ERR_HPI_ERROR;
	}

        /* write all EP_XREF data records */
        g_hash_table_foreach(oh_resource_id_table, write_ep_xref, fp);

        fclose(fp);

        uid_unlock(&oh_uid_lock);

        return SA_OK;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:41,代码来源:uid_utils.c

示例2: main

int main(int argc, char **argv)
{
        oh_el *el;
        SaErrorT retc;


	/* test failure of oh_el_map_from_file with nonexistant filename */
	
	el = oh_el_create(20);

        retc = oh_el_map_from_file(el, "./notthere.data");
        if (retc == SA_OK) {
                CRIT("oh_el_map_from_file failed.");
                return 1;
	}

        /* close el */
        retc = oh_el_close(el);
        if (retc != SA_OK) {
                CRIT("oh_el_close on el failed.");
                return 1;
        }

        return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:25,代码来源:el_test_039.c

示例3: oh_el_map_to_file

/* write a EL entry list to a file */
SaErrorT oh_el_map_to_file(oh_el *el, char *filename)
{
        FILE *fp;
        GList *node = NULL;

        if (el == NULL || filename == NULL) {
                return SA_ERR_HPI_INVALID_PARAMS;
        }

        fp = fopen(filename, "wb");
        if (!fp) {
                CRIT("EL file '%s' could not be opened", filename);
                return SA_ERR_HPI_ERROR;
        }
        
	for (node = el->list; node; node = node->next) {
                if (fwrite((void *)node->data, sizeof(oh_el_entry), 1, fp) != 1) {
			CRIT("Couldn't write to file '%s'.", filename);
			fclose(fp);
                	return SA_ERR_HPI_ERROR;
		}
        }

        fclose(fp);

        return SA_OK;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:28,代码来源:el_utils.c

示例4: main

int main(int argc, char **argv)
{
        oh_el *el;
        SaErrorT retc;


	/* test oh_el_info with info == NULL */

	el = oh_el_create(20);

        retc = oh_el_info(el, NULL);
        if (retc == SA_OK) {
                CRIT("oh_el_info failed.");
                return 1;
        }

        /* close el without saving to file*/
        retc = oh_el_close(el);
        if (retc != SA_OK) {
                CRIT("oh_el_close on el failed.");
                return 1;
        }

        return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:25,代码来源:el_test_031.c

示例5: main

int main(int argc, char **argv)
{
        oh_el *el;
	SaHpiTimeT timestamp = 0;
	SaErrorT retc;

	/* tests oh_el_timeset when el != NULL */

	el = oh_el_create(20);

	retc = oh_el_timeset(el, timestamp + 20);
	if (retc != SA_OK){
		CRIT("oh_el_timeset failed");
		return 1;
	}

	
        /* close el without saving to file*/
        retc = oh_el_close(el);
        if (retc != SA_OK) {
                CRIT("oh_el_close on el failed.");
                return 1;
        }


        return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:27,代码来源:el_test_042.c

示例6: test_audio

void test_audio(void)
{
	struct aes_data aes_data;
	struct audio_stream audio_stream;
	char pcm_testdata[] = "pcm_testfile";

	CRIT("Testing audio send routines; no connections "
	     "will be made to the server\n");

	lt_set_level(LT_AUDIO_STREAM, LT_INFO);
	lt_set_level(LT_RAOP_PLAY_SEND_AUDIO, LT_INFO);

	generate_aes_data(&aes_data);

	syscalls_strncpy(audio_stream.pcm_data_file,
			 pcm_testdata,
			 sizeof(audio_stream.pcm_data_file));

	audio_stream.session_fd = syscalls_open("./fake_session",
						O_RDWR | O_CREAT | O_TRUNC,
						S_IRUSR | S_IWUSR);

	if (-1 == audio_stream.session_fd) {
		ERRR("Failed to open fake session file descriptor\n");
		goto out;
	}

	init_audio_stream(&audio_stream);
	send_audio_stream(&audio_stream, &aes_data);

out:
	CRIT("Audio test done; exiting\n");
	exit (1);
}
开发者ID:dparnell,项目名称:raopd,代码行数:34,代码来源:audio_debug.c

示例7: exechandlerdestroy

static SaErrorT exechandlerdestroy(oHpiHandlerIdT handlerid)
{
   SaErrorT rv = SA_OK;
   if (copt.debug) DBG("Go and unload handler %u in domain %u", 
            handlerid, copt.domainid);
   
   rv = oHpiHandlerDestroy ( sessionid, handlerid );

   if (copt.debug) DBG("oHpiHandlerDestroy returned %s", oh_lookup_error(rv));

   if (rv==SA_OK) {
      printf("Handler %u successfully unloaded.\n\n", handlerid);
      return rv;
   }
   else if (rv==SA_ERR_HPI_NOT_PRESENT) {
      if (copt.domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) 
         CRIT("Handler %u is not existing in default domain.",
                handlerid);
      else CRIT("Handler %u is not existing in domain %u.",
                handlerid, copt.domainid);
      return rv;
   }
   else CRIT("\nHandler %u couldn't be unloaded, Returncode %s", 
                handlerid, oh_lookup_error(rv));
   return rv;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:26,代码来源:ohhandler.c

示例8: config_init

/**
 * Initialize the configuration. Have to be called befor using the config variable.
 *
 * @return 0 on success, otherwise something else.
 */
int config_init() {
  strncpy(config.mqtt_client_id, CONF_DEFAULT_MQTT_CLIENT_ID, CONF_MAX_LENGTH_MQTT_CLIENT_ID);
  strncpy(config.mqtt_broker,    CONF_DEFAULT_MQTT_BROKER,    CONF_MAX_LENGTH_MQTT_BROKER);
  strncpy(config.mqtt_topic,     CONF_DEFAULT_MQTT_TOPIC,     CONF_MAX_LENGTH_MQTT_TOPIC);
  strncpy(config.log_file,       CONF_DEFAULT_LOG_FILE,       CONF_MAX_LENGTH_LOG_FILE);

  config.mqtt_port          = CONF_DEFAULT_MQTT_PORT;
  config.mqtt_clean_session = CONF_DEFAULT_MQTT_CLEAN_SESSION;
  config.mqtt_keepalive     = CONF_DEFAULT_MQTT_KEEPALIVE;
  config.verbose            = CONF_DEFAULT_VERBOSE;

  config.start_time.tv_sec  = CONF_DEFAULT_SEC;
  config.start_time.tv_usec = CONF_DEFAULT_USEC;
  
  config.record_start_time.tv_sec  = CONF_DEFAULT_RECORD_SEC;
  config.record_start_time.tv_usec = CONF_DEFAULT_RECORD_USEC;

  config.ignore_timing      = CONF_DEFAULT_IGNORE_TIMING;
  config.repeat             = CONF_DEFAULT_REPEAT;

  config.mosq = NULL;
  if( 0 > sigemptyset(&config.sigset) ) {
    CRIT("sigemptyset()");
  }

  if( 0 > sigaddset(&config.sigset, SIGINT) ) {
    CRIT("sigaddset()");
  }

  return 0;
}
开发者ID:der-b,项目名称:mqttutils,代码行数:36,代码来源:mqtt-player.c

示例9: oh_ssl_init

/**
 * oh_ssl_init
 *
 * Intialize the OpenSSL library.  Note that the calls used in this routine
 * set up global data and are only to be called once for an SSL-based program.
 * To enforce this while allowing multiple callers (plugins) to initialize
 * the library, we use a static global variable to mark when we've done the
 * initialization.
 *
 * Note that the thread-safe initialization portion requires that
 * g_thread_init() has already been called, so don't call this routine
 * before then.
 *
 * Return value: 0 for success, -1 for failure
 **/
int		oh_ssl_init(void)
{
	if (! oh_ssl_init_done) {	/* Do this only once */
		oh_ssl_init_done = 1;

		/* Load error strings to provide human-readable error
		 * messages
		 */
		SSL_load_error_strings();
		ERR_load_BIO_strings();

		/* Initialize the SSL library */
		if (! SSL_library_init()) {
			CRIT("SSL_library_init() failed");
			return(-1);
		}

#ifndef NO_SSL_RAND_SEED		/* In case this isn't portable */
		/* Actions to seed PRNG */
		RAND_load_file("/dev/urandom", 1024);
#endif

		/* Set up multi-thread protection functions */
		if (thread_setup() ) {
			CRIT("SSL multi-thread protection setup call failed");
			return(-1);
		}

	}

	return(0);			/* Successful return */
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:47,代码来源:oh_ssl.c

示例10: exechandlercreate

static SaErrorT exechandlercreate (int argc, char **argv, int i)
{
   SaErrorT rv = SA_OK;
   oHpiHandlerIdT handlerid = 0;
   GHashTable * createparams = g_hash_table_new_full (
      g_str_hash, g_str_equal, g_free, g_free);
   SaHpiBoolT pluginnamegiven = SAHPI_FALSE;

   if (copt.debug) DBG ("createhandler started\n");

   while (i<argc){
      if (strcmp(argv[i],"-f")==0) {
         CRIT("input from file not implemented yet");
         return (SA_OK);
      }
      else if (++i<argc) {
         if (strcmp(argv[i-1],"plugin")==0) pluginnamegiven = SAHPI_TRUE;
         g_hash_table_insert( createparams,
            g_strdup( argv[i-1] ), 
            g_strdup( argv[i] ));
          if (copt.debug) DBG ("Pair of arguments: %s - %s\n",
            g_strdup( argv[i-1] ), 
            g_strdup( argv[i] ));
      }
      else // parameters not in pairs
         return (SA_ERR_HPI_INVALID_PARAMS);
      i++;
   }

   if (!pluginnamegiven) {
      CRIT("You must enter a valid plugin name");
      return (SA_ERR_HPI_INVALID_PARAMS);
   }

   rv = ohc_session_open_by_option ( &copt, &sessionid);
   if (rv != SA_OK) return rv;

   if (copt.debug) DBG("Calling oHpiHandlerCreate!");
   rv = oHpiHandlerCreate(sessionid, createparams, &handlerid );

   if ( rv != SA_OK ) {
      CRIT("oHpiHandlerCreate returned %s", oh_lookup_error(rv));
      saHpiSessionClose(sessionid);
      return(rv);
   }
   
   printf("Handler %u successfully created!\n", handlerid);

   rv = saHpiSessionClose(sessionid);
        
   return(SA_OK);

}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:53,代码来源:ohhandler.c

示例11: main

/**
 * main: Announcement test
 *
 * This test adds one announcement to the list
 *
 * Return value: 0 on success, 1 on failure
 **/
int main(int argc, char **argv)
{
        oh_announcement *ann;
        SaHpiAnnouncementT announ;
        SaErrorT rc;

        announ.EntryId = 0;         // modified by oh_announcement_append
        announ.Timestamp = 0;       // modified by oh_announcement_append
        announ.AddedByUser = FALSE; // modified by oh_announcement_append
        announ.Severity = SAHPI_CRITICAL;
        announ.Acknowledged = FALSE;
        announ.StatusCond.Type= SAHPI_STATUS_COND_TYPE_SENSOR;
        announ.StatusCond.Entity.Entry[0].EntityType = SAHPI_ENT_SYSTEM_BOARD;
        announ.StatusCond.Entity.Entry[0].EntityLocation = 1;
        announ.StatusCond.Entity.Entry[1].EntityType = SAHPI_ENT_ROOT;
        announ.StatusCond.Entity.Entry[1].EntityLocation = 0;
        announ.StatusCond.DomainId = 1;
        announ.StatusCond.ResourceId = 1;
        announ.StatusCond.SensorNum = 1;
        announ.StatusCond.EventState = SAHPI_ES_UNSPECIFIED;
        announ.StatusCond.Name.Length = 5;
        memcpy(&announ.StatusCond.Name.Value,"announ", 5);
        announ.StatusCond.Mid = 123;
        /* we will not worry about the Data field for this test */

        ann = oh_announcement_create();

        rc = oh_announcement_append(ann, &announ);

        announ.Severity = SAHPI_MAJOR;
        rc = oh_announcement_append(ann, &announ);

        announ.Severity = SAHPI_MINOR;
        rc = oh_announcement_append(ann, &announ);

        rc = oh_announcement_ack(ann, 2, SAHPI_MAJOR);
        if(rc != SA_OK) {
                CRIT("on_announcement_ack returned %d.", rc);
                return 1;
        }

        rc = oh_announcement_get(ann, 2, &announ);
        if(rc != SA_OK) {
                CRIT("on_announcement_get returned %d.", rc);
                return 1;
        }
        if(announ.Acknowledged != TRUE) {
                CRIT("announ.Acknowledged invalid");
                return 1;
        }

        return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:60,代码来源:ann_test_006.c

示例12: main

int main(int argc, char **argv)
{
        oh_el *el;
        SaErrorT retc;
	int x;
	SaHpiEventT event;
	static char *data[5] = {
        	"Test data one",
		"Test data two",
		"Test data three",
		"Test data four",
		"Test data five"
	};


	/* test oh_el_prepend with existing EL*/
	el = oh_el_create(20);


        /* get EL from file (el) */
        retc = oh_el_map_from_file(el, "./elTest.data");
        if (retc != SA_OK) {
                CRIT("oh_el_map_from_file failed.");
                return 1;
        }

	/* add 5 more events to el */
	for(x=0;x<5;x++){
        	event.Source = 1;
        	event.EventType = SAHPI_ET_USER;
        	event.Timestamp = SAHPI_TIME_UNSPECIFIED;
        	event.Severity = SAHPI_DEBUG;
		strcpy((char *) &event.EventDataUnion.UserEvent.UserEventData.Data, data[x]);


        	retc = oh_el_prepend(el, &event, NULL, NULL);
        	if (retc != SA_OK) {
              	  CRIT("oh_el_append failed.");
               	  return 1;
        	}       
	}

        /* close el */
        retc = oh_el_close(el);
        if (retc != SA_OK) {
                CRIT("oh_el_close on el failed.");
                return 1;
        }


        return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:52,代码来源:el_test_010.c

示例13: IsSimpleType

static gboolean
IsSimpleType( tMarshalType type )
{
  switch( type )
     {
       case eMtVoid:
       case eMtInt8:
       case eMtUint8:
       case eMtInt16:
       case eMtUint16:
       case eMtInt32:
       case eMtUint32:
       case eMtInt64:
       case eMtUint64:
       case eMtFloat32:
       case eMtFloat64:
	    return TRUE;

       case eMtArray:
       case eMtVarArray:
       case eMtStruct:
       case eMtStructElement:
       case eMtUnion:
       case eMtUnionElement:
       case eMtUserDefined:
	    return FALSE;

       default:
            CRIT( "Unknown marshal type %d!", type );
	    return FALSE;
     }
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:32,代码来源:marshal.c

示例14: process_hpi_event

static int process_hpi_event(struct oh_domain *d, struct oh_event *e)
{
        int i;
        GArray *sessions = NULL;
        SaHpiSessionIdT sid;
        SaHpiEventT *event = NULL;
        SaHpiRptEntryT *resource = NULL;
        SaHpiRdrT *rdr = NULL;

        if (!d || !e) return -1;

        event = &e->event;
        resource = &e->resource;
        rdr = (e->rdrs) ? (SaHpiRdrT *)e->rdrs->data : NULL;

        if (event->EventType == SAHPI_ET_USER) {
                resource->ResourceCapabilities = 0;
                if (rdr) rdr->RdrType = SAHPI_NO_RECORD;
        }

        oh_add_event_to_del(d, e);
        DBG("Added event to EL");

        /*
         * Here is the SESSION MULTIPLEXING code
         */
        sessions = oh_list_sessions(d->id);
        if (!sessions) {
                CRIT("Error: Got an empty session list on domain id %u", d->id);
                return -2;
        }
        DBG("Got session list for domain %u", d->id);

        /* Drop events if there are no sessions open to receive them.
         */
        if (sessions->len < 1) {
                g_array_free(sessions, TRUE);
                DBG("No sessions open for event's domain %u. "
                    "Dropping hpi_event", d->id);
                return 0;
        }

        /* multiplex event to the appropriate sessions */
        for (i = 0; i < sessions->len; i++) {
                SaHpiBoolT is_subscribed = SAHPI_FALSE;
#if defined(__sparc) || defined(__sparc__)
                sid = ((SaHpiSessionIdT *)((void *)(sessions->data)))[i];
#else
                sid = g_array_index(sessions, SaHpiSessionIdT, i);
#endif
                oh_get_session_subscription(sid, &is_subscribed);
                if (is_subscribed) {
                        oh_queue_session_event(sid, e);
                }
        }
        g_array_free(sessions, TRUE);
        DBG("done multiplexing event into sessions");

        return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:60,代码来源:event.c

示例15: build_uid_map_data

/*
 * build_uid_map_data: used by uid_map_from_file(),  recursively
 * reads map file and builds two hash tables and EP_XREF data
 * structures
 *
 * @file: key into a GHashTable
 *
 * Return value: success 0, error -1.
 */
static gint build_uid_map_data(FILE *fp)
{
        EP_XREF *ep_xref;
        EP_XREF ep_xref1;
        gpointer value;
        gpointer key;

        while (fread(&ep_xref1, sizeof(EP_XREF), 1, fp) == 1) {

                /* copy read record from ep_xref1 to malloc'd ep_xref */
                ep_xref = g_new0(EP_XREF, 1);
                if (!ep_xref)
                        return -1;
                memcpy(ep_xref, &ep_xref1, sizeof(EP_XREF));

                value = (gpointer)ep_xref;

                /* entity path based key */
                key = (gpointer)&ep_xref->entity_path;
                g_hash_table_insert(oh_ep_table, key, value);

                /* resource id based key */
                key = (gpointer)&ep_xref->resource_id;
                g_hash_table_insert(oh_resource_id_table, key, value);
        }

        if ((feof(fp) == 0) || (ferror(fp) != 0)) {
                CRIT("error building ep xref from map file");
                return -1;
        }
        return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:41,代码来源:uid_utils.c


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